diff --git a/.gitea/ISSUE_TEMPLATE/a-bug.yml b/.gitea/ISSUE_TEMPLATE/a-bug.yml new file mode 100644 index 000000000..01a78f1a9 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/a-bug.yml @@ -0,0 +1,165 @@ +name: Bug Report +about: Draft a report to aid in our Debugging efforts. +title: "[BUG]: " +labels: + - bug +body: + - type: markdown + attributes: + value: | + We value your effort in reporting an bug! Your feedback is essential for us to address and fix the problem. + - type: textarea + id: what-happened + attributes: + label: What Happened? + description: Please provide a detailed description of the issue and explain what outcome you anticipate. + placeholder: Describe the issue you experienced. + value: "" + validations: + required: true + - type: textarea + id: steps_to_reproduce + attributes: + label: Steps to reproduce the Bug + description: Please provide a detailed description of the steps to reproduce the issue you experienced. + placeholder: Describe the steps to reproduce the issue. + value: "" + validations: + required: true + - type: markdown + attributes: + value: | + # Environment Details + - type: input + id: joomla_version_compiling + attributes: + label: Which Joomla version are you compiling in? + placeholder: e.g., v4.4.3, + validations: + required: true + - type: input + id: php_version_compiling + attributes: + label: Which PHP version are you compiling in? + placeholder: e.g., v8.1, + validations: + required: true + - type: input + id: joomla_versions_targeting + attributes: + label: Which Joomla versions are you targeting? + placeholder: e.g., v5.0.3, + validations: + required: true + - type: input + id: php_version_targeting + attributes: + label: Which PHP version are you targeting? + placeholder: e.g., 8.2 + validations: + required: true + - type: input + id: apache_version_using + attributes: + label: Which Web server is JCB running on? + description: Please provide the full name of the web server on which you are running JCB. + placeholder: e.g., Apache 2.4 + validations: + required: true + - type: input + id: mysql_version_using + attributes: + label: Which Relational Database is JCB running on? + description: Please provide the full name of the database on which you are running JCB. + placeholder: e.g., Mysql 8.0, MariaDB 10.6, + validations: + required: true + - type: input + id: os + attributes: + label: Which OS is JCB running on? + description: Please provide the full name of the OS on which you are running JCB. + placeholder: e.g. CentOS 8 sever, + value: "" + validations: + required: true + - type: input + id: jcb_version + attributes: + label: Which JCB version are you using? + description: Please provide the full name of the JCB version you are using. + placeholder: e.g., v5.0.0-alpha3 + validations: + required: true + - type: dropdown + id: area + attributes: + label: Where in JCB did this issue occur? + multiple: true + options: + - Compilation of a component + - Installation of a component + - Installation JCB pkg + - Installation of JCB plugins + - Compiler(admin_view) + - Dashboard(admin_view) + - Joomla Components(admin_views) + - Joomla Component(admin_view) + - Joomla Modules(admin_views) + - Joomla Module(admin_view) + - Joomla Plugins(admin_views) + - Joomla Plugin(admin_view) + - Power(admin_view) + - Powers(admin_views) + - Search(admin_view) + - Admin View(admin_view) + - Admin Views(admin_views) + - Custom Admin Views(admin_views) + - Site View(admin_view) + - Site Views(admin_views) + - Template(admin_view) + - Templates(admin_views) + - Layout(admin_view) + - Layouts(admin_views) + - Dynamic Get(admin_view) + - Dynamic Gets(admin_views) + - Custom Code(admin_view) + - Custom Codes(admin_views) + - Placeholder(admin_view) + - Placeholders(admin_views) + - Library(admin_view) + - Libraries(admin_views) + - Snippet(admin_view) + - Snippets(admin_views) + - Validation Rule(admin_view) + - Validation Rules(admin_views) + - Field(admin_view) + - Fields(admin_views) + - Fieldtypes(admin_views) + - Language Translations(admin_views) + - Server(admin_view) + - Servers(admin_views) + - Help Documents(admin_views) + - Other + validations: + required: true + - type: dropdown + id: browsers + attributes: + label: On which browsers did you encounter the issue? + multiple: true + options: + - Firefox + - Chrome + - Microsoft Edge + - Safari + - Opera + - Brave + - Vivaldi + validations: + required: true + - type: textarea + id: comments + attributes: + label: Additional Comments + description: Feel free to include any further comments or pertinent details that might assist us. \ No newline at end of file diff --git a/.gitea/ISSUE_TEMPLATE/b-enhancement.yml b/.gitea/ISSUE_TEMPLATE/b-enhancement.yml new file mode 100644 index 000000000..b62273bc1 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/b-enhancement.yml @@ -0,0 +1,81 @@ +name: Enhancement Request +about: Suggest an idea for JCB +title: "[ENHANCEMENT]: " +labels: + - enhancement +body: + - type: markdown + attributes: + value: | + Thank you for suggesting an enhancement! Your input is crucial for our innovation and progress. To assist us better, please share detailed information about your idea. + - type: textarea + id: enhancement-details + attributes: + label: Enhancement Details + description: Could you detail the enhancement you're suggesting? Explain the issue it addresses or the new feature it introduces. + placeholder: Please give an in-depth explanation of your proposed enhancement. + validations: + required: true + - type: markdown + attributes: + value: | + # Context and Priority + - type: dropdown + id: area + attributes: + label: Which part of the extension will be affected by this enhancement? + multiple: true + options: + - Compilation of component + - Installation of a component + - Installation JCB pkg + - Installation of JCB plugins + - Compiler(admin_view) + - Dashboard(admin_view) + - Joomla Components(admin_views) + - Joomla Component(admin_view) + - Joomla Modules(admin_views) + - Joomla Module(admin_view) + - Joomla Plugins(admin_views) + - Joomla Plugin(admin_view) + - Power(admin_view) + - Powers(admin_views) + - Search(admin_view) + - Admin View(admin_view) + - Admin Views(admin_views) + - Custom Admin Views(admin_views) + - Site View(admin_view) + - Site Views(admin_views) + - Template(admin_view) + - Templates(admin_views) + - Layout(admin_view) + - Layouts(admin_views) + - Dynamic Get(admin_view) + - Dynamic Gets(admin_views) + - Custom Code(admin_view) + - Custom Codes(admin_views) + - Placeholder(admin_view) + - Placeholders(admin_views) + - Library(admin_view) + - Libraries(admin_views) + - Snippet(admin_view) + - Snippets(admin_views) + - Validation Rule(admin_view) + - Validation Rules(admin_views) + - Field(admin_view) + - Fields(admin_views) + - Fieldtypes(admin_views) + - Language Translations(admin_views) + - Server(admin_view) + - Servers(admin_views) + - Help Documents(admin_views) + - Other + validations: + required: true + - type: textarea + id: additional-context + attributes: + label: Additional Context + description: Supply additional context or screenshots related to the enhancement request in this space. + validations: + required: false \ No newline at end of file diff --git a/.gitea/ISSUE_TEMPLATE/c-task.yml b/.gitea/ISSUE_TEMPLATE/c-task.yml new file mode 100644 index 000000000..de46e1bbd --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/c-task.yml @@ -0,0 +1,45 @@ +name: Task +about: Create a task for project management +title: "[TASK]: " +labels: + - task +body: + - type: markdown + attributes: + value: | + Thanks for setting up the task! Tasks assist us in arranging and ranking our work. Kindly provide comprehensive details about the task for clarity and efficient tracking. + - type: textarea + id: task-details + attributes: + label: Task Details + description: Please describe the task. What are the specific actions required? + placeholder: Provide a detailed description of the task. + validations: + required: true + - type: markdown + attributes: + value: | + # Task Context and Priority + - type: textarea + id: task-environment + attributes: + label: Task environment + description: Please provide the details of the environment in which this task will be completed. + placeholder: Describe the environment applicable to the task. + validations: + required: true + - type: textarea + id: task-objective + attributes: + label: Task Objective + description: What's the aim or purpose of this task? How will it contribute to the project or system's success? + placeholder: Describe the goal and anticipated result of the task. + validations: + required: true + - type: textarea + id: additional-context + attributes: + label: Additional Context + description: Please share any extra context, files, or screenshots that could aid in comprehending or carrying out the task. + validations: + required: false \ No newline at end of file diff --git a/.gitea/ISSUE_TEMPLATE/d-docs.yml b/.gitea/ISSUE_TEMPLATE/d-docs.yml new file mode 100644 index 000000000..ac6a62f34 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/d-docs.yml @@ -0,0 +1,37 @@ +name: Documentation +about: Propose improvements to the documentation or highlight any issues found within it. +title: "[DOCUMENTATION]: " +labels: + - documentation +body: + - type: markdown + attributes: + value: | + We appreciate your input on our documentation! Clear and comprehensive documentation plays a vital role in enabling users to effectively interact with our systems. To assist us in making improvements, kindly offer thorough details regarding your suggestion or the specific problem you've encountered. + - type: textarea + id: documentation-details + attributes: + label: Documentation Details + description: Please explain the specific problem with the documentation or the improvements you recommend. Is it a missing topic, unclear instructions, outdated content, or something else? + placeholder: Detail the issue with the documentation or suggest improvements.. + validations: + required: true + - type: markdown + attributes: + value: | + # Specific Context + - type: textarea + id: expected-outcome + attributes: + label: Expected Outcome + description: What outcomes do you anticipate from this change in documentation? How will it benifit the users or enhance the project? + placeholder: Explain the expected result of this change in the documentation. + validations: + required: true + - type: textarea + id: additional-context + attributes: + label: Additional Context + description: Share any extra details, files, or screenshots that could help in understanding or applying the documentation change. + validations: + required: false \ No newline at end of file diff --git a/.gitea/ISSUE_TEMPLATE/e-performance.yml b/.gitea/ISSUE_TEMPLATE/e-performance.yml new file mode 100644 index 000000000..4a2448328 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/e-performance.yml @@ -0,0 +1,61 @@ +name: Performance Issue +about: Recommend or propose performance improvements +title: "[PERFORMANCE]: " +labels: + - performance +body: + - type: markdown + attributes: + value: | + Appreciation for tackling performance challenges! Optimizing performance is vital for our system's efficiency and the user experience. Could you offer more comprehensive details to aid in identifying and resolving the suggested performance issue or improvement? + - type: textarea + id: performance-details + attributes: + label: Performance Details + description: Please outline the performance problem or the enhancements you propose. Is it related to speed, resource usage, responsiveness, or something else? + placeholder: Offer an in-depth explanation of the performance challenge or improvement. + validations: + required: true + - type: markdown + attributes: + value: | + # Affected Systems and Context + - type: textarea + id: performance-environment + attributes: + label: Environment in which performance issue occurs + description: Provide a detailed description of the environment in which you are experiencing this perforamnce issue. + placeholder: Describe the environment of the preformance issue. + validations: + required: true + - type: textarea + id: replication-steps + attributes: + label: Steps to Replicate + description: If possible, share a step-by-step guide to replicate the performance problem. + placeholder: Explain how to replicate the problem. + validations: + required: false + - type: textarea + id: impact-assessment + attributes: + label: Impact Assessment + description: How does the performance problem impact the system or its users? How severe is its effect? + placeholder: Explain the impact of the performance problem. + validations: + required: true + - type: textarea + id: proposed-solutions + attributes: + label: Proposed Solutions or Ideas + description: If you have any suggestions or ideas for resolving the performance problem, please share them here. + placeholder: Share any potential solutions or improvement problem. + validations: + required: false + - type: textarea + id: additional-context + attributes: + label: Additional Context + description: Provide any additional context, benchmarks, logs, or screenshots that might help in understanding or addressing the performance problem. + validations: + required: false \ No newline at end of file diff --git a/.gitea/ISSUE_TEMPLATE/f-refactor.yml b/.gitea/ISSUE_TEMPLATE/f-refactor.yml new file mode 100644 index 000000000..d1181c219 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/f-refactor.yml @@ -0,0 +1,45 @@ +name: Refactoring Task +about: Recommend or identify the necessity for code refactoring. +title: "[REFACTOR]: " +labels: + - refactor +body: + - type: markdown + attributes: + value: | + We appreciate your commitment to enhancing the maintainability and quality of our codebase! Code refactoring plays a crucial role in ensuring our system remains efficient and easy to manage. To assist us effectively, please share comprehensive details about the refactoring task you are suggesting or identifying. + - type: textarea + id: refactoring-details + attributes: + label: Refactoring Details + description: Outline the refactoring task, specifying which code segment requires attention and the reasons behind this need. What improvements are expected from this refactoring? + placeholder: Provide an in-depth explanation of the refactoring task? + validations: + required: true + - type: markdown + attributes: + value: | + # Affected Components and Context + - type: textarea + id: area + attributes: + label: Which file or area of JCB needs refactoring? + description: Which area in JCB should be refactored? + placeholder: Give a road map where the refactoring should take place. + validations: + required: true + - type: textarea + id: expected-outcome + attributes: + label: Expected Outcome + description: What benefits do you anticipate from this refactoring? How will it enhance the codebase or overall system? + placeholder: Explain the expected results of this refactoring. + validations: + required: true + - type: textarea + id: additional-context + attributes: + label: Additional Context + description: Share any further details or information, like code snippets, that could aid in comprehending or executing the refactoring task. + validations: + required: false diff --git a/.gitea/ISSUE_TEMPLATE/g-security.yml b/.gitea/ISSUE_TEMPLATE/g-security.yml new file mode 100644 index 000000000..edf2a04c8 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/g-security.yml @@ -0,0 +1,38 @@ +name: Security Issue +about: Identify a possible security risk. +title: "[SECURITY]: " +labels: + - security +body: + - type: markdown + attributes: + value: | + **⚠️ CRITICAL: Avoid sharing any sensitive or confidential details in this message.** Should you suspect a security flaw, please contact us directly at [joomla@vdm.io]. + - type: textarea + id: security-general-description + attributes: + label: General Description + description: Offer a broad overview of the security concern, ensuring not to disclose any sensitive information. + placeholder: Provide a general description of the security problem. + validations: + required: true + - type: markdown + attributes: + value: | + # Affected Systems + - type: textarea + id: security-environment + attributes: + label: Environment affected by security issue. + description: Give a general description of the environment affected by this security issue. + placeholder: Describe the affected environment. + validations: + required: true + - type: textarea + id: non-sensitive-details + attributes: + label: Non-Sensitive Details + description: If applicable, please offer further non-sensitive information or general observations regarding the security concern. + placeholder: Provide any relevant non-sensitive details or observations. + validations: + required: false \ No newline at end of file diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 7ae4e2d56..8c7ce1943 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -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. diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md index 905f46fc1..1d8b13a8f 100644 --- a/.github/SUPPORT.md +++ b/.github/SUPPORT.md @@ -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). diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..f9cb19948 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,185 @@ +# v3.2.1-beta3 + +- Fix version_update column size. +- Improved the Schema Table update engine. + +# v3.2.1-beta2 + +- Fix the media field size limitation. #1109 +- Add dynamic datatype update to schema field check. + +# v3.2.1-beta1 + +- Add fallback option to ensure that all JCB tables and fields exist. +- Move the powers autoloader to its own file. + +# v3.2.1-alpha4 + +- Add Joomla powers for namespace dynamic management. + +# v3.2.1-alpha3 + +- Fix plugin code display when methods and properties are missing. + +# v3.2.1-alpha2 + +- Add view list and single name fix. +- Add component code name fix. +- Add reset list of powers. +- Fix missing Factory class in plugin. #1102 + +# v3.2.1-alpha1 + +- Add power path override option on component level. +- Fix the sql build feature. #1032 + +# v3.2.0 + +- Fix #1053 so that the right and left tabs display correctly in Joomla 4&5 +- Move the old helper compiler files to powers +- Move the old helper extrusion files to powers +- Add Preferred Joomla Version to Components +- Add custom file file mapping for Joomla 4 and 5 +- Fix the plug-in installer script builder bug #1068 +- Fix Event triggers for Joomla 4 and 5 builds. +- Fix plugin field selection +- Fix plugin params tab layout +- Add issue templates +- Force autoloader to always load +- Add Factory class to the J5 Event class. #1093 +- Fix [Set String Value] in placeholder table to store the value as a base64 string. +- Fix the search area layout. +- Fix the search area code line selection. +- Fix the input edit button for custom fields. +- Add the new layout to list fields (GUI UPDATE) + +# v3.2.0-beta + +- Move beta to main repo + +# v3.1.42 + +- Fix #1055 to add the style and scripts to all views. + +# v3.1.40 + +- Fix #1052 so that tabs last opened is remembered and opened again on save, refresh or reopening of an item. +- Fix #1057 so that the datetime fields will be set correctly in mysql. + +# v3.1.39 + +- Fix #1051 making sure the list view is lowercase. + +# v3.1.38 + +- Fix #1046 so that the version restore function will work. + +# v3.1.37 + +- Fix #1041 so that custom tabs are build correctly. +- Fix #1043 so that delete function in Joomla 4 and 5 will work. +- Fix #1045 so that plug-in Structure::setMainXmlFile method will except an object. +- Fix #1042 so that it will remove line breaks and new lines from other languages as well. + +# v3.1.36 + +- Move the defined or die below use statements. +- Add the new router view + +# v3.1.35 + +- Improve the Joomla 4 Templates. +- Fix #1033 the response class issue for the gitea classes. +- Remove the JRegistry class to resolve #1036, #1035 + +# v3.1.34 + +- Fix the AjaxController contructor class. +- Improved the getModel calls from the AxajController class. + +# v3.1.33 + +- Fix #1026 by adding the correct layout to the filter views. +- Fix #1026 by adding the class to the filter views. +- Fix #1026 by adding a hint to the filters that are having multiple selection. +- Fix the directional bog where a field in the filters are also called direction. +- Fix the getModel helper method fot J4+. + +# v3.1.32 + +- Fix #1026 by removing chosen everywhere. +- Resolve #1028 by adding in line helper toggle integration to all admin views. +- Remove the import and export buttons until the area is fixed. +- Add emptystate list template to all admin list views. + +# v3.1.31 + +- Add joomla_version to custom code. +- Add Joomla 4 and 5 correct build files. + +# v3.1.30 + +- Add namspace prefix to both global, and component override level. +- Add Joomla 4 and 5 build option + +# v3.1.28 + +- Updates PHPSecLib. +- Fixed connection failure to remote server. +- Adds overriding of back-folder and git-folder on component level. + +# v3.1.27 + +- Adds better remote repository management for the super power features. +- Fixes #1014 so that powers are added to components. + +# v3.1.26 + +- Fixed changelog direction so newest changes is listed at top of the file. +- Finished the init function of super powers. +- Adds rest function inside super power. +- Adds super powers to all templates. +- Updates many helper class methods to now use the utility classes. +- Adds the `spl_autoload_register` method to the component entry file (as-well). +- Moved most methods from the compiler fields class to powers. #955 +- Refactored many new builder classes from the registry class. +- Converted the Content class to two builder classes. +- Adds option to add additional templates to a module. +- Resolves #1002 by adding STRING instead of WORD. +- Ported the FOF encryption class into Powers. https://git.vdm.dev/joomla/fof +- Changed all CSS and JS to use `Html::_(` instead of `$this->document->` in compiler code. +- Adds option to turn jQuery off if UIKIT 3 is added. +- Adds option to auto write injection boilerplate code in Powers area. +- Adds option to auto write service provider boilerplate code in the Powers area. +- Improved the `getDynamicContent` method and all banner locations to fetch from https://git.vdm.dev/joomla/jcb-external/ instead. +- Major stability improvements all over the new powers complier classes. +- New [base Registry class](https://git.vdm.dev/joomla/super-powers/src/branch/master/src/7e822c03-1b20-41d1-9427-f5b8d5836af7) has been created specially for JCB. +- Remember to update all plug-ins with this version update (use the package). + +# 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 + +# 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 \ No newline at end of file diff --git a/README.md b/README.md index 6f5a0b002..1162ef525 100644 --- a/README.md +++ b/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.5) 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.2.1-beta3) 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,17 +144,17 @@ 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*: 31st August, 2022 -+ *Version*: 3.1.5 ++ *Last Build*: 24th April, 2024 ++ *Version*: 3.2.1-beta3 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **319873** -+ *Field count*: **2002** -+ *File count*: **2090** -+ *Folder count*: **359** ++ *Line count*: **764955** ++ *Field count*: **2097** ++ *File count*: **5382** ++ *Folder count*: **471** -> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). -> Developed by [Llewellyn van der Merwe](mailto:llewellyn@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:joomla@vdm.io) ## Contributors diff --git a/admin/README.txt b/admin/README.txt index 6f5a0b002..1162ef525 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -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.5) 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.2.1-beta3) 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,17 +144,17 @@ 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*: 31st August, 2022 -+ *Version*: 3.1.5 ++ *Last Build*: 24th April, 2024 ++ *Version*: 3.2.1-beta3 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **319873** -+ *Field count*: **2002** -+ *File count*: **2090** -+ *Folder count*: **359** ++ *Line count*: **764955** ++ *Field count*: **2097** ++ *File count*: **5382** ++ *Folder count*: **471** -> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). -> Developed by [Llewellyn van der Merwe](mailto:llewellyn@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:joomla@vdm.io) ## Contributors diff --git a/admin/access.xml b/admin/access.xml index 1e51d294b..8bc3e282b 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -19,7 +19,6 @@ - @@ -212,6 +211,16 @@ + + + + + + + + + + @@ -235,7 +244,6 @@ - @@ -410,6 +418,19 @@ + + + + + + + + + + + + + @@ -485,6 +506,8 @@ + + @@ -498,6 +521,10 @@ + + + + @@ -515,7 +542,6 @@ - @@ -594,6 +620,17 @@ +
+ + + + + + + + + +
@@ -896,6 +933,17 @@
+
+ + + + + + + + + +
diff --git a/admin/assets/css/component_router.css b/admin/assets/css/component_router.css new file mode 100644 index 000000000..2731fc5aa --- /dev/null +++ b/admin/assets/css/component_router.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/components_routers.css b/admin/assets/css/components_routers.css new file mode 100644 index 000000000..2731fc5aa --- /dev/null +++ b/admin/assets/css/components_routers.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css index 615e5f30f..3b92116c7 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -11,153 +11,153 @@ /* CSS Document */ .dashboard-container { - margin-left: 10px; - margin-top: 10px; - width: 100%; + margin-left: 10px; + margin-top: 10px; + width: 100%; } .dashboard-container [class*="span"] { - display: block; - float: none; - margin-left: 0; - width: auto; + display: block; + float: none; + margin-left: 0; + width: auto; } .dashboard-container:before, .dashboard-container:after { - content: ""; - display: table; + content: ""; + display: table; } .dashboard-container:after { - clear: both; + clear: both; } .dashboard-container [class*="span"] { - box-sizing: border-box; - display: block; - float: left; - min-height: 145px; - min-width: 96px; - width: 100%; + box-sizing: border-box; + display: block; + float: left; + min-height: 145px; + min-width: 96px; + width: 100%; } .dashboard-container [class*="span"]:first-child { - margin-left: 0; + margin-left: 0; } .dashboard-wraper { - background: none repeat scroll 0 0 hsl(0, 0%, 93%); - border-radius: 5px; - float: left; - margin: 1%; - padding: 3px; - width: 17%; - min-height: 194px; - min-width: 96px; + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 5px; + float: left; + margin: 1%; + padding: 3px; + width: 17%; + min-height: 194px; + min-width: 96px; } .dashboard-content a { - background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 85%); - border-radius: 4px; - box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; - color: hsl(0, 0%, 20%); - display: block; - min-height: 89px; - padding: 10px; - text-align: center; - text-decoration: none; + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + min-height: 89px; + padding: 10px; + text-align: center; + text-decoration: none; } .dashboard-content a:hover { - background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - color: hsl(200, 100%, 30%); - text-decoration: none; + background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + color: hsl(200, 100%, 30%); + text-decoration: none; } .dashboard-title { - display: block; - padding-top: 5px; + display: block; + padding-top: 5px; } .dashboard-info { - background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 85%); - border-radius: 4px; - box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; - color: hsl(0, 0%, 20%); - display: block; - font-size: 12px; - padding: 10px; - text-align: center; + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + font-size: 12px; + padding: 10px; + text-align: center; } .dashboard-info span { - display: block; - text-align: center; + display: block; + text-align: center; } .dashboard-info img { - margin: 0 auto; + margin: 0 auto; } .dashboard-table { - border-top: 1px solid hsl(0, 0%, 87%); - margin-top: 5px; - width: 100%; + border-top: 1px solid hsl(0, 0%, 87%); + margin-top: 5px; + width: 100%; } .dashboard-info h5 { - font-size: 11px; - font-weight: bold; + font-size: 11px; + font-weight: bold; } .dashboard-block { - background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 76%); - border-radius: 3px; - box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; - margin-bottom: 20px; + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 76%); + border-radius: 3px; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; + margin-bottom: 20px; } .dashboard-block .dashboard-block-head { - background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border-bottom: 1px solid hsl(0, 0%, 76%); - border-radius: 3px 3px 0 0; - box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); - height: 40px; - position: relative; + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border-bottom: 1px solid hsl(0, 0%, 76%); + border-radius: 3px 3px 0 0; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); + height: 40px; + position: relative; } .dashboard-block .dashboard-block-head h5 { - font-size: 12px; - margin: 0; - padding-left: 10px; - padding-top: 11px; - text-transform: uppercase; + font-size: 12px; + margin: 0; + padding-left: 10px; + padding-top: 11px; + text-transform: uppercase; } .dashboard-block .dashboard-block-content { - background: none repeat scroll 0 0 hsl(0, 0%, 93%); - border-radius: 0 0 3px 3px; + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 0 0 3px 3px; } .dashboard-block .dashboard-block-box { - background: none repeat scroll 0 0 hsl(0, 0%, 100%); - border-top: 1px solid hsl(0, 0%, 82%); - box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; + background: none repeat scroll 0 0 hsl(0, 0%, 100%); + border-top: 1px solid hsl(0, 0%, 82%); + box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; } .dashboard-block .dashboard-block-content .dashboard-block-box { - margin-top: 0 !important; + margin-top: 0 !important; } .dashboard-block .dashboard-block-content .dashboard-block-box .dashboard-block-table { - margin-bottom: 0 !important; + margin-bottom: 0 !important; } .dashboard-block-table { - background-color: hsla(0, 0%, 0%, 0); - border-collapse: collapse; - border-spacing: 0; - margin-bottom: 20px; - max-width: 100%; - width: 100%; + background-color: hsla(0, 0%, 0%, 0); + border-collapse: collapse; + border-spacing: 0; + margin-bottom: 20px; + max-width: 100%; + width: 100%; } .dashboard-block-table th, .dashboard-block-table td { - border-top: 1px solid hsl(0, 0%, 87%); - line-height: 20px; - padding: 5px; - text-align: left; - vertical-align: middle; + border-top: 1px solid hsl(0, 0%, 87%); + line-height: 20px; + padding: 5px; + text-align: left; + vertical-align: middle; } .dashboard-badge { - background-color: hsl(0, 0%, 60%); - border-radius: 9px; - color: hsl(0, 0%, 100%); - font-size: 11.844px; - font-weight: bold; - line-height: 14px; - padding: 1px 9px 2px; - text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); - vertical-align: baseline; - white-space: nowrap; + background-color: hsl(0, 0%, 60%); + border-radius: 9px; + color: hsl(0, 0%, 100%); + font-size: 11.844px; + font-weight: bold; + line-height: 14px; + padding: 1px 9px 2px; + text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); + vertical-align: baseline; + white-space: nowrap; } \ No newline at end of file diff --git a/admin/assets/css/joomla_power.css b/admin/assets/css/joomla_power.css new file mode 100644 index 000000000..2731fc5aa --- /dev/null +++ b/admin/assets/css/joomla_power.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/joomla_powers.css b/admin/assets/css/joomla_powers.css new file mode 100644 index 000000000..2731fc5aa --- /dev/null +++ b/admin/assets/css/joomla_powers.css @@ -0,0 +1,13 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* CSS Document */ + + diff --git a/admin/assets/css/search.css b/admin/assets/css/search.css new file mode 100644 index 000000000..56b77adcf --- /dev/null +++ b/admin/assets/css/search.css @@ -0,0 +1,40 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* 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; +} diff --git a/admin/assets/images/icons/admin_view_add.png b/admin/assets/images/icons/admin_view_add.png deleted file mode 100644 index 38b7209f5..000000000 Binary files a/admin/assets/images/icons/admin_view_add.png and /dev/null differ diff --git a/admin/assets/images/icons/custom_admin_view_add.png b/admin/assets/images/icons/custom_admin_view_add.png deleted file mode 100644 index cb35345f6..000000000 Binary files a/admin/assets/images/icons/custom_admin_view_add.png and /dev/null differ diff --git a/admin/assets/images/icons/placeholders.png b/admin/assets/images/icons/placeholders.png index dae19113e..e05f4a723 100644 Binary files a/admin/assets/images/icons/placeholders.png and b/admin/assets/images/icons/placeholders.png differ diff --git a/admin/assets/images/icons/search.png b/admin/assets/images/icons/search.png new file mode 100644 index 000000000..dae19113e Binary files /dev/null and b/admin/assets/images/icons/search.png differ diff --git a/admin/assets/images/icons/site_view_add.png b/admin/assets/images/icons/site_view_add.png deleted file mode 100644 index 97a8ce39e..000000000 Binary files a/admin/assets/images/icons/site_view_add.png and /dev/null differ diff --git a/admin/assets/images/import.gif b/admin/assets/images/import.gif index 4371cc618..10bcb8569 100644 Binary files a/admin/assets/images/import.gif and b/admin/assets/images/import.gif differ diff --git a/admin/assets/js/search.js b/admin/assets/js/search.js new file mode 100644 index 000000000..1433d72ed --- /dev/null +++ b/admin/assets/js/search.js @@ -0,0 +1,956 @@ +/** + * @package Joomla.Component.Builder + * + * @created 30th April, 2015 + * @author Llewellyn van der Merwe + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* 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') + '
' + + Joomla.JText._('COM_COMPONENTBUILDER_YOU_WILL_REPLACE') + ': [' + htmlentities(searchValue) + '] ' + + Joomla.JText._('COM_COMPONENTBUILDER_WITH') + ': [' + htmlentities(replaceValue) + ']
' + + Joomla.JText._('COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_BYOU_HAVE_BEEN_WARNEDB') + '

' + + 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') + '.

' + + 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, '+') +} \ No newline at end of file diff --git a/admin/compiler/joomla_3/AdminController.php b/admin/compiler/joomla_3/AdminController.php index 34a6d3228..1837a17b6 100644 --- a/admin/compiler/joomla_3/AdminController.php +++ b/admin/compiler/joomla_3/AdminController.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -47,4 +47,4 @@ public function getModel($name = '###View###', $prefix = '###Component###Model', { return parent::getModel($name, $prefix, $config); }###CONTROLLEREXIMPORTMETHOD######CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER######ADMIN_CUSTOM_BUTTONS_CONTROLLER_LIST### -} +} \ No newline at end of file diff --git a/admin/compiler/joomla_3/AdminControllerDashboard.php b/admin/compiler/joomla_3/AdminControllerDashboard.php index 8f53ecd75..4bb2b3659 100644 --- a/admin/compiler/joomla_3/AdminControllerDashboard.php +++ b/admin/compiler/joomla_3/AdminControllerDashboard.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ diff --git a/admin/compiler/joomla_3/AdminController_custom_admin.php b/admin/compiler/joomla_3/AdminController_custom_admin.php index 8c32dc3cb..2cd69c6ed 100644 --- a/admin/compiler/joomla_3/AdminController_custom_admin.php +++ b/admin/compiler/joomla_3/AdminController_custom_admin.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -34,9 +34,9 @@ class ###Component###Controller###SViews### extends AdminController /** * Proxy for getModel. - * @since 2.5 + * @since 2.5 */ - public function getModel($name = '###SView###', $prefix = '###Component###Model', $config = array()) + public function getModel($name = '###SView###', $prefix = '###Component###Model', $config = []) { $model = parent::getModel($name, $prefix, array('ignore_request' => true)); @@ -45,7 +45,7 @@ public function getModel($name = '###SView###', $prefix = '###Component###Model' public function dashboard() { - $this->setRedirect(JRoute::_('index.php?option=com_###component###', false)); + $this->setRedirect(Route::_('index.php?option=com_###component###', false)); return; }###CUSTOM_ADMIN_CUSTOM_BUTTONS_CONTROLLER### } diff --git a/admin/compiler/joomla_3/AdminModel.php b/admin/compiler/joomla_3/AdminModel.php index 4c2c92c56..a41ce196a 100644 --- a/admin/compiler/joomla_3/AdminModel.php +++ b/admin/compiler/joomla_3/AdminModel.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -52,18 +52,18 @@ class ###Component###Model###View### extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = '###view###', $prefix = '###Component###Table', $config = array()) + public function getTable($type = '###view###', $prefix = '###Component###Table', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_###component###/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); }###ADMIN_CUSTOM_BUTTONS_METHOD### - + /** * Method to get a single record. * @@ -108,7 +108,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData;###JMODELADMIN_GETFORM### @@ -117,13 +117,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_###component###/js/###view###.js'; } - + /** * Method to test whether a record can be deleted. * @@ -149,24 +149,24 @@ protected function canDelete($record) protected function canEditState($record) {###JMODELADMIN_CANEDITSTATE### } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') {###JMODELADMIN_ALLOWEDIT### } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -174,19 +174,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) {###LICENSE_TABLE_LOCKED_CHECK### - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -198,7 +198,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__###component###_###view###')); @@ -213,7 +213,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -228,10 +228,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_###component###.edit.###view###.data', array()); + $data = Factory::getApplication()->getUserState('com_###component###.edit.###view###.data', []); if (empty($data)) { @@ -242,7 +242,7 @@ protected function loadFormData() return $data; }###VALIDATIONFIX######UNIQUEFIELDS### - + /** * Method to delete one or more records. * @@ -258,7 +258,7 @@ public function delete(&$pks) { return false; }###JMODELADMIN_AFTER_DELETE### - + return true; } @@ -278,10 +278,10 @@ public function publish(&$pks, $value = 1) { return false; }###JMODELADMIN_AFTER_PUBLISH### - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -307,30 +307,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ###Component###Helper::getActions('###view###'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ###Component###Helper::getActions('###view###'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -367,8 +367,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -377,7 +376,7 @@ public function batch($commands, $pks, $contexts) return true; }###MODEL_BATCH_COPY######MODEL_BATCH_MOVE### - + /** * Method to save the form data. * @@ -389,34 +388,34 @@ public function batch($commands, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; }###CHECKBOX_SAVE######METHOD_ITEM_SAVE### - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; }###TITLEALIASFIX### - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -429,7 +428,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/compiler/joomla_3/AdminModel_site.php b/admin/compiler/joomla_3/AdminModel_site.php index b805c970f..beb541e8d 100644 --- a/admin/compiler/joomla_3/AdminModel_site.php +++ b/admin/compiler/joomla_3/AdminModel_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -52,18 +52,18 @@ class ###Component###Model###View### extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = '###view###', $prefix = '###Component###Table', $config = array()) + public function getTable($type = '###view###', $prefix = '###Component###Table', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_###component###/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); }###ADMIN_CUSTOM_BUTTONS_METHOD### - + /** * Method to get a single record. * @@ -108,7 +108,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData;###JMODELADMIN_GETFORM### @@ -117,13 +117,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_###component###/js/###view###.js'; } - + /** * Method to test whether a record can be deleted. * @@ -149,24 +149,24 @@ protected function canDelete($record) protected function canEditState($record) {###JMODELADMIN_CANEDITSTATE### } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') {###JMODELADMIN_ALLOWEDIT### } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -174,19 +174,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) {###LICENSE_TABLE_LOCKED_CHECK### - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -198,7 +198,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__###component###_###view###')); @@ -213,7 +213,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -228,10 +228,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_###component###.edit.###view###.data', array()); + $data = Factory::getApplication()->getUserState('com_###component###.edit.###view###.data', []); if (empty($data)) { @@ -242,7 +242,7 @@ protected function loadFormData() return $data; }###VALIDATIONFIX######UNIQUEFIELDS### - + /** * Method to delete one or more records. * @@ -258,7 +258,7 @@ public function delete(&$pks) { return false; }###JMODELADMIN_AFTER_DELETE### - + return true; } @@ -278,10 +278,10 @@ public function publish(&$pks, $value = 1) { return false; }###JMODELADMIN_AFTER_PUBLISH### - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -307,30 +307,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ###Component###Helper::getActions('###view###'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ###Component###Helper::getActions('###view###'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -367,8 +367,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -377,7 +376,7 @@ public function batch($commands, $pks, $contexts) return true; }###MODEL_BATCH_COPY######MODEL_BATCH_MOVE### - + /** * Method to save the form data. * @@ -389,34 +388,34 @@ public function batch($commands, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; }###CHECKBOX_SAVE######METHOD_ITEM_SAVE### - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; }###TITLEALIASFIX### - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -427,9 +426,8 @@ public function save($data) * * @since 3.0 */ - protected function generateUnique($field,$value) + protected function generateUnique($field, $value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/compiler/joomla_3/BaseController.php b/admin/compiler/joomla_3/BaseController.php index b7dd77c85..51991743a 100644 --- a/admin/compiler/joomla_3/BaseController.php +++ b/admin/compiler/joomla_3/BaseController.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -19,6 +19,8 @@ use Joomla\CMS\MVC\Controller\BaseController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; /** * General Controller of ###Component### component @@ -34,7 +36,7 @@ class ###Component###Controller extends BaseController * * @since 3.0 */ - public function __construct($config = array()) + public function __construct($config = []) { // set the default view $config['default_view'] = '###DASHBOARDVIEW###'; @@ -50,38 +52,38 @@ public function __construct($config = array()) function display($cachable = false, $urlparams = false) { // set default view if not set - $view = $this->input->getCmd('view', '###DASHBOARDVIEW###'); - $data = $this->getViewRelation($view); - $layout = $this->input->get('layout', null, 'WORD'); - $id = $this->input->getInt('id'); + $view = $this->input->getCmd('view', '###DASHBOARDVIEW###'); + $data = $this->getViewRelation($view); + $layout = $this->input->get('layout', null, 'WORD'); + $id = $this->input->getInt('id'); // Check for edit form. - if(###Component###Helper::checkArray($data)) + if(Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($data)) { if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_###component###.edit.'.$data['view'], $id)) { // Somehow the person just went to the form - we don't allow that. - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); // check if item was opend from other then its own list view - $ref = $this->input->getCmd('ref', 0); - $refid = $this->input->getInt('refid', 0); + $ref = $this->input->getCmd('ref', 0); + $refid = $this->input->getInt('refid', 0); // set redirect - if ($refid > 0 && ###Component###Helper::checkString($ref)) + if ($refid > 0 && Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($ref)) { // redirect to item of ref - $this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); + $this->setRedirect(Route::_('index.php?option=com_###component###&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); } - elseif (###Component###Helper::checkString($ref)) + elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($ref)) { // redirect to ref - $this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.(string)$ref, false)); + $this->setRedirect(Route::_('index.php?option=com_###component###&view='.(string)$ref, false)); } else { // normal redirect back to the list view - $this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.$data['views'], false)); + $this->setRedirect(Route::_('index.php?option=com_###component###&view='.$data['views'], false)); } return false; @@ -94,7 +96,7 @@ function display($cachable = false, $urlparams = false) protected function getViewRelation($view) { // check the we have a value - if (###Component###Helper::checkString($view)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($view)) { // the view relationships $views = array(###VIEWARRAY### diff --git a/admin/compiler/joomla_3/BaseControllerAjax.php b/admin/compiler/joomla_3/BaseControllerAjax.php index fb3b4ac1c..1d9640c5b 100644 --- a/admin/compiler/joomla_3/BaseControllerAjax.php +++ b/admin/compiler/joomla_3/BaseControllerAjax.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,7 +17,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Session\Session; use Joomla\Utilities\ArrayHelper; /** @@ -29,9 +31,9 @@ public function __construct($config) { parent::__construct($config); // make sure all json stuff are set - JFactory::getDocument()->setMimeEncoding( 'application/json' ); + Factory::getDocument()->setMimeEncoding( 'application/json' ); // get the application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $app->setHeader('Content-Disposition','attachment;filename="getajax.json"'); $app->setHeader('Access-Control-Allow-Origin', '*'); // load the tasks ###REGISTER_AJAX_TASK### @@ -40,16 +42,16 @@ public function __construct($config) public function ajax() { // get the user for later use - $user = JFactory::getUser(); + $user = Factory::getUser(); // get the input values - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // check if we should return raw - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); // return to a callback function - $callback = $jinput->get('callback', null, 'CMD'); + $callback = $jinput->get('callback', null, 'CMD'); // Check Token! - $token = JSession::getFormToken(); - $call_token = $jinput->get('token', 0, 'ALNUM'); + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { // get the task diff --git a/admin/compiler/joomla_3/BaseControllerAjaxSite.php b/admin/compiler/joomla_3/BaseControllerAjaxSite.php index b32768f64..a02fa0127 100644 --- a/admin/compiler/joomla_3/BaseControllerAjaxSite.php +++ b/admin/compiler/joomla_3/BaseControllerAjaxSite.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,7 +17,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Session\Session; use Joomla\Utilities\ArrayHelper; /** @@ -29,9 +31,9 @@ public function __construct($config) { parent::__construct($config); // make sure all json stuff are set - JFactory::getDocument()->setMimeEncoding( 'application/json' ); + Factory::getDocument()->setMimeEncoding( 'application/json' ); // get the application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $app->setHeader('Content-Disposition','attachment;filename="getajax.json"'); $app->setHeader('Access-Control-Allow-Origin', '*'); // load the tasks ###REGISTER_SITE_AJAX_TASK### @@ -40,16 +42,16 @@ public function __construct($config) public function ajax() { // get the user for later use - $user = JFactory::getUser(); + $user = Factory::getUser(); // get the input values - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // check if we should return raw - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); // return to a callback function - $callback = $jinput->get('callback', null, 'CMD'); + $callback = $jinput->get('callback', null, 'CMD'); // Check Token! - $token = JSession::getFormToken(); - $call_token = $jinput->get('token', 0, 'ALNUM'); + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { // get the task @@ -71,7 +73,7 @@ public function ajax() echo json_encode(false); } else - { + { echo "(".json_encode(false).");"; } } diff --git a/admin/compiler/joomla_3/BaseControllerHelp.php b/admin/compiler/joomla_3/BaseControllerHelp.php index 86f92aa41..8cd3d0ebf 100644 --- a/admin/compiler/joomla_3/BaseControllerHelp.php +++ b/admin/compiler/joomla_3/BaseControllerHelp.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,7 +17,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Session\Session; use Joomla\Utilities\ArrayHelper; /** @@ -34,12 +37,12 @@ public function __construct($config) public function help() { - $user = JFactory::getUser(); - $jinput = JFactory::getApplication()->input; + $user = Factory::getUser(); + $jinput = Factory::getApplication()->input; // Check Token! - $token = JSession::getFormToken(); - $call_token = $jinput->get('token', 0, 'ALNUM'); - if($user->id != 0 && $token == $call_token) + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); + if($user->id != 0 && ($jinput->get($token, 0, 'ALNUM') || $token === $call_token)) { $task = $this->getTask(); switch($task){ @@ -67,7 +70,7 @@ public function help() break; } } - else + else { // stop execution gracefully jexit(); @@ -76,8 +79,8 @@ public function help() protected function getHelpDocumentText($id) { - $db = JFactory::getDbo(); - $query = $db->getQuery(true); + $db = Factory::getDbo(); + $query = $db->getQuery(true); $query->select(array('a.title','a.content')); $query->from('#__###component###_help_document AS a'); $query->where('a.id = '.(int) $id); @@ -86,21 +89,21 @@ protected function getHelpDocumentText($id) $db->execute(); if($db->getNumRows()) { - $text = array(); + $text = []; $document = $db->loadObject(); // fix image issue - $images['src="images'] = 'src="'.JURI::root().'images'; - $images["src='images"] = "src='".JURI::root()."images"; - $images['src="/images'] = 'src="'.JURI::root().'images'; - $images["src='/images"] = "src='".JURI::root()."images"; + $images['src="images'] = 'src="'.Uri::root().'images'; + $images["src='images"] = "src='".Uri::root()."images"; + $images['src="/images'] = 'src="'.Uri::root().'images'; + $images["src='/images"] = "src='".Uri::root()."images"; // set document template $text[] = ""; $text[] = ''; $text[] = ""; $text[] = ''; $text[] = "".$document->title.""; - $text[] = ''; - $text[] = ''; + $text[] = ''; + $text[] = ''; $text[] = ""; $text[] = '
'; $text[] = '
'; diff --git a/admin/compiler/joomla_3/BaseControllerHelp_site.php b/admin/compiler/joomla_3/BaseControllerHelp_site.php index 2df722c4b..dfeb2d229 100644 --- a/admin/compiler/joomla_3/BaseControllerHelp_site.php +++ b/admin/compiler/joomla_3/BaseControllerHelp_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,7 +17,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Session\Session; use Joomla\Utilities\ArrayHelper; /** @@ -34,12 +37,12 @@ public function __construct($config) public function help() { - $user = JFactory::getUser(); - $jinput = JFactory::getApplication()->input; + $user = Factory::getUser(); + $jinput = Factory::getApplication()->input; // Check Token! - $token = JSession::getFormToken(); - $call_token = $jinput->get('token', 0, 'ALNUM'); - if($token == $call_token) + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); + if($user->id != 0 && ($jinput->get($token, 0, 'ALNUM') || $token === $call_token)) { $task = $this->getTask(); switch($task){ @@ -76,8 +79,8 @@ public function help() protected function getHelpDocumentText($id) { - $db = JFactory::getDbo(); - $query = $db->getQuery(true); + $db = Factory::getDbo(); + $query = $db->getQuery(true); $query->select(array('a.title','a.content')); $query->from('#__###component###_help_document AS a'); $query->where('a.id = '.(int) $id); @@ -87,21 +90,21 @@ protected function getHelpDocumentText($id) $db->execute(); if($db->getNumRows()) { - $text = array(); + $text = []; $document = $db->loadObject(); // fix image issue - $images['src="images'] = 'src="'.JURI::root().'images'; - $images["src='images"] = "src='".JURI::root()."images"; - $images['src="/images'] = 'src="'.JURI::root().'images'; - $images["src='/images"] = "src='".JURI::root()."images"; + $images['src="images'] = 'src="'.Uri::root().'images'; + $images["src='images"] = "src='".Uri::root()."images"; + $images['src="/images'] = 'src="'.Uri::root().'images'; + $images["src='/images"] = "src='".Uri::root()."images"; // set document template $text[] = ""; $text[] = ''; $text[] = ""; $text[] = ''; $text[] = "".$document->title.""; - $text[] = ''; - $text[] = ''; + $text[] = ''; + $text[] = ''; $text[] = ""; $text[] = '
'; $text[] = '
'; diff --git a/admin/compiler/joomla_3/BaseControllerSITE.php b/admin/compiler/joomla_3/BaseControllerSITE.php index af2bde03e..cee5dbb72 100644 --- a/admin/compiler/joomla_3/BaseControllerSITE.php +++ b/admin/compiler/joomla_3/BaseControllerSITE.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,8 +17,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Router\Route; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Language\Text; /** * ###Component### Component Base Controller @@ -37,51 +40,51 @@ class ###Component###Controller extends BaseController function display($cachable = false, $urlparams = false) { // set default view if not set - $view = $this->input->getCmd('view', '###SITE_DEFAULT_VIEW###'); + $view = $this->input->getCmd('view', '###SITE_DEFAULT_VIEW###'); $this->input->set('view', $view); - $isEdit = $this->checkEditView($view); - $layout = $this->input->get('layout', null, 'WORD'); - $id = $this->input->getInt('id'); - // $cachable = true; (TODO) working on a fix [gh-238](https://github.com/vdm-io/Joomla-Component-Builder/issues/238) - + $isEdit = $this->checkEditView($view); + $layout = $this->input->get('layout', null, 'WORD'); + $id = $this->input->getInt('id'); + // $cachable = true; (TODO) working on a fix [gh-238](https://github.com/vdm-io/Joomla-Component-Builder/issues/238) + // insure that the view is not cashable if edit view or if user is logged in - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->get('id') || $isEdit) { $cachable = false; } - + // Check for edit form. if($isEdit) { if ($layout == 'edit' && !$this->checkEditId('com_###component###.edit.'.$view, $id)) { // Somehow the person just went to the form - we don't allow that. - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); // check if item was opend from other then its own list view - $ref = $this->input->getCmd('ref', 0); - $refid = $this->input->getInt('refid', 0); + $ref = $this->input->getCmd('ref', 0); + $refid = $this->input->getInt('refid', 0); // set redirect - if ($refid > 0 && ###Component###Helper::checkString($ref)) + if ($refid > 0 && Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($ref)) { // redirect to item of ref - $this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); + $this->setRedirect(Route::_('index.php?option=com_###component###&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); } - elseif (###Component###Helper::checkString($ref)) + elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($ref)) { // redirect to ref - $this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.(string)$ref, false)); + $this->setRedirect(Route::_('index.php?option=com_###component###&view='.(string)$ref, false)); } else { // normal redirect back to the list default site view - $this->setRedirect(JRoute::_('index.php?option=com_###component###&view=###SITE_DEFAULT_VIEW###', false)); + $this->setRedirect(Route::_('index.php?option=com_###component###&view=###SITE_DEFAULT_VIEW###', false)); } return false; } } - + // we may need to make this more dynamic in the future. (TODO) $safeurlparams = array( 'catid' => 'INT', @@ -102,9 +105,9 @@ function display($cachable = false, $urlparams = false) 'Itemid' => 'INT'); // should these not merge? - if (###Component###Helper::checkArray($urlparams)) + if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($urlparams)) { - $safeurlparams = ###Component###Helper::mergeArrays(array($urlparams, $safeurlparams)); + $safeurlparams = Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge(array($urlparams, $safeurlparams)); } return parent::display($cachable, $safeurlparams); @@ -112,7 +115,7 @@ function display($cachable = false, $urlparams = false) protected function checkEditView($view) { - if (###Component###Helper::checkString($view)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($view)) { $views = array(###SITE_EDIT_VIEW_ARRAY### ); diff --git a/admin/compiler/joomla_3/BaseController_custom_admin.php b/admin/compiler/joomla_3/BaseController_custom_admin.php index 8ed50653a..3976b770a 100644 --- a/admin/compiler/joomla_3/BaseController_custom_admin.php +++ b/admin/compiler/joomla_3/BaseController_custom_admin.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -31,7 +31,7 @@ public function __construct($config) public function dashboard() { - $this->setRedirect(JRoute::_('index.php?option=com_###component###', false)); + $this->setRedirect(Route::_('index.php?option=com_###component###', false)); return; }###CUSTOM_ADMIN_CUSTOM_BUTTONS_CONTROLLER### } diff --git a/admin/compiler/joomla_3/BaseController_import.php b/admin/compiler/joomla_3/BaseController_import.php index 9a13dbd18..f5811358a 100644 --- a/admin/compiler/joomla_3/BaseController_import.php +++ b/admin/compiler/joomla_3/BaseController_import.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,8 +17,7 @@ // 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 @@ -33,21 +32,21 @@ class ###Component###ControllerImport extends BaseController public function import() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $model = $this->getModel('import'); if ($model->import()) { - $cache = JFactory::getCache('mod_menu'); + $cache = Factory::getCache('mod_menu'); $cache->clean(); // TODO: Reset the users acl here as well to kill off any missing bits } - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $redirect_url = $app->getUserState('com_###component###.redirect_url'); if (empty($redirect_url)) { - $redirect_url = JRoute::_('index.php?option=com_###component###&view=import', false); + $redirect_url = Route::_('index.php?option=com_###component###&view=import', false); } else { diff --git a/admin/compiler/joomla_3/BaseController_import_custom.php b/admin/compiler/joomla_3/BaseController_import_custom.php index a4474ba5e..a9283454a 100644 --- a/admin/compiler/joomla_3/BaseController_import_custom.php +++ b/admin/compiler/joomla_3/BaseController_import_custom.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,8 +17,7 @@ // 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 @@ -33,21 +32,21 @@ class ###Component###Controller###View### extends BaseController public function import() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $model = $this->getModel('###View###'); if ($model->import()) { - $cache = JFactory::getCache('mod_menu'); + $cache = Factory::getCache('mod_menu'); $cache->clean(); // TODO: Reset the users acl here as well to kill off any missing bits } - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $redirect_url = $app->getUserState('com_###component###.redirect_url'); if (empty($redirect_url)) { - $redirect_url = JRoute::_('index.php?option=com_###component###&view=###view###', false); + $redirect_url = Route::_('index.php?option=com_###component###&view=###view###', false); } else { diff --git a/admin/compiler/joomla_3/BaseDatabaseModel_import.php b/admin/compiler/joomla_3/BaseDatabaseModel_import.php index 7d7b21a68..020739141 100644 --- a/admin/compiler/joomla_3/BaseDatabaseModel_import.php +++ b/admin/compiler/joomla_3/BaseDatabaseModel_import.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,13 +17,9 @@ // 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 @@ -31,8 +27,8 @@ class ###Component###ModelImport extends BaseDatabaseModel // set uploading values protected $use_streams = false; protected $allow_unsafe = false; - protected $safeFileOptions = array(); - + protected $safeFileOptions = []; + /** * @var object JTable object */ @@ -49,13 +45,13 @@ class ###Component###ModelImport extends BaseDatabaseModel * @var string */ protected $_context = 'com_###component###.import'; - + /** * Import Settings */ - protected $getType = NULL; - protected $dataType = NULL; - + protected $getType = NULL; + protected $dataType = NULL; + /** * Method to auto-populate the model state. * @@ -66,7 +62,7 @@ class ###Component###ModelImport extends BaseDatabaseModel */ protected function populateState() { - $app = JFactory::getApplication('administrator'); + $app = Factory::getApplication('administrator'); $this->setState('message', $app->getUserState('com_###component###.message')); $app->setUserState('com_###component###.message', ''); @@ -86,14 +82,14 @@ protected function populateState() public function import() { $this->setState('action', 'import'); - $app = JFactory::getApplication(); - $session = JFactory::getSession(); + $app = Factory::getApplication(); + $session = Factory::getSession(); $package = null; $continue = false; // get import type $this->getType = $app->input->getString('gettype', NULL); // get import type - $this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL); + $this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL); if ($package === null) { @@ -114,9 +110,9 @@ public function import() break; case 'continue': - $continue = true; - $package = $session->get('package', null); - $package = json_decode($package, true); + $continue = true; + $package = $session->get('package', null); + $package = json_decode($package, true); // clear session $session->clear('package'); $session->clear('dataType'); @@ -124,7 +120,7 @@ public function import() break; default: - $app->setUserState('com_###component###.message', JText::_('COM_###COMPONENT###_IMPORT_NO_IMPORT_TYPE_FOUND')); + $app->setUserState('com_###component###.message', Text::_('COM_###COMPONENT###_IMPORT_NO_IMPORT_TYPE_FOUND')); return false; break; @@ -138,10 +134,10 @@ public function import() $this->remove($package['packagename']); } - $app->setUserState('com_###component###.message', JText::_('COM_###COMPONENT###_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); + $app->setUserState('com_###component###.message', Text::_('COM_###COMPONENT###_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); return false; } - + // first link data to table headers if(!$continue){ $package = json_encode($package); @@ -150,13 +146,13 @@ public function import() $session->set('hasPackage', true); return true; } - + // set the data $headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false), true); if (!$this->setData($package,$this->dataType,$headerList)) { // There was an error importing the package - $msg = JText::_('COM_###COMPONENT###_IMPORT_ERROR'); + $msg = Text::_('COM_###COMPONENT###_IMPORT_ERROR'); $back = $session->get('backto_VDM_IMPORT', NULL); if ($back) { @@ -168,12 +164,12 @@ public function import() else { // Package imported sucessfully - $msg = JText::sprintf('COM_###COMPONENT###_IMPORT_SUCCESS', $package['packagename']); + $msg = Text::sprintf('COM_###COMPONENT###_IMPORT_SUCCESS', $package['packagename']); $back = $session->get('backto_VDM_IMPORT', NULL); if ($back) { - $app->setUserState('com_###component###.redirect_url', 'index.php?option=com_###component###&view='.$back); - $session->clear('backto_VDM_IMPORT'); + $app->setUserState('com_###component###.redirect_url', 'index.php?option=com_###component###&view='.$back); + $session->clear('backto_VDM_IMPORT'); } $result = true; } @@ -184,7 +180,7 @@ public function import() // remove file after import $this->remove($package['packagename']); $session->clear($this->getType.'_VDM_IMPORTHEADERS'); - + return $result; } @@ -194,48 +190,47 @@ public function import() * @return spreadsheet definition or false on failure */ protected function _getPackageFromUpload() - { + { // Get the uploaded file information - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get. $userfile = $input->files->get('import_package', null, 'raw'); - + // Make sure that file uploads are enabled in php if (!(bool) ini_get('file_uploads')) { - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); return false; } // If there is no uploaded file, we have a problem... if (!is_array($userfile)) { - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); return false; } // Check if there was a problem uploading the file. if ($userfile['error'] || $userfile['size'] < 1) { - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); return false; } // Build the appropriate paths - $config = JFactory::getConfig(); + $config = Factory::getConfig(); $tmp_dest = $config->get('tmp_path') . '/' . $userfile['name']; $tmp_src = $userfile['tmp_name']; // Move uploaded file - jimport('joomla.filesystem.file'); $p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); // Was the package downloaded? if (!$p_file) { - $session = JFactory::getSession(); + $session = Factory::getSession(); $session->clear('package'); $session->clear('dataType'); $session->clear('hasPackage'); @@ -257,16 +252,16 @@ protected function _getPackageFromUpload() */ protected function _getPackageFromFolder() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Get the path to the package to import $p_dir = $input->getString('import_directory'); - $p_dir = JPath::clean($p_dir); + $p_dir = Path::clean($p_dir); // Did you give us a valid path? if (!file_exists($p_dir)) { - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); return false; } @@ -276,17 +271,17 @@ protected function _getPackageFromFolder() // Did you give us a valid package? if (!$type) { - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); } - + // check the extention if(!$this->checkExtension($p_dir)) { // set error message - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); return false; } - + $package['packagename'] = null; $package['dir'] = $p_dir; $package['type'] = $type; @@ -302,26 +297,26 @@ protected function _getPackageFromFolder() */ protected function _getPackageFromUrl() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; - + // Get the URL of the package to import $url = $input->getString('import_url'); // Did you give us a URL? if (!$url) { - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_ENTER_A_URL'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_ENTER_A_URL'), 'warning'); return false; } // Download the package at the URL given - $p_file = JInstallerHelper::downloadPackage($url); + $p_file = InstallerHelper::downloadPackage($url); // Was the package downloaded? if (!$p_file) { - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_INVALID_URL'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_INVALID_URL'), 'warning'); return false; } @@ -330,7 +325,7 @@ protected function _getPackageFromUrl() return $package; } - + /** * Check a file and verifies it as a spreadsheet file * Supports .csv .xlsx .xls and .ods @@ -342,29 +337,29 @@ protected function _getPackageFromUrl() */ protected function check($archivename) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Clean the name - $archivename = JPath::clean($archivename); - + $archivename = Path::clean($archivename); + // check the extention if(!$this->checkExtension($archivename)) { // Cleanup the import files $this->remove($archivename); - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); return false; } - - $config = JFactory::getConfig(); + + $config = Factory::getConfig(); // set Package Name $check['packagename'] = $archivename; - + // set directory $check['dir'] = $config->get('tmp_path'). '/' .$archivename; - + // set type $check['type'] = $this->getType; - + return $check; }###IMPORT_EXT_METHOD### @@ -379,8 +374,8 @@ protected function check($archivename) protected function remove($package) { jimport('joomla.filesystem.file'); - - $config = JFactory::getConfig(); + + $config = Factory::getConfig(); $package = $config->get('tmp_path'). '/' .$package; // Is the package file a valid file? @@ -388,23 +383,23 @@ protected function remove($package) { File::delete($package); } - elseif (is_file(JPath::clean($package))) + elseif (is_file(Path::clean($package))) { // It might also be just a base filename - File::delete(JPath::clean($package)); + File::delete(Path::clean($package)); } }###IMPORT_SETDATA_METHOD######IMPORT_SAVE_METHOD### protected function getAlias($name,$type = false) { // sanitize the name to an alias - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $alias = JFilterOutput::stringURLUnicodeSlug($name); + $alias = OutputFilter::stringURLUnicodeSlug($name); } else { - $alias = JFilterOutput::stringURLSafe($name); + $alias = OutputFilter::stringURLSafe($name); } // must be a uniqe alias if ($type) @@ -413,7 +408,7 @@ protected function getAlias($name,$type = false) } return $alias; } - + /** * Method to generate a uniqe value. * @@ -428,16 +423,16 @@ protected function getUniqe($value,$field,$type) // insure the filed is always uniqe while (isset($this->uniqeValueArray[$type][$field][$value])) { - $value = JString::increment($value, 'dash'); + $value = StringHelper::increment($value, 'dash'); } $this->uniqeValueArray[$type][$field][$value] = $value; return $value; } - + protected function getAliasesUsed($table) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // first we check if there is a alias column $columns = $db->getTableColumns('#__###component###_'.$table); if(isset($columns['alias'])){ diff --git a/admin/compiler/joomla_3/BaseDatabaseModel_import_custom.php b/admin/compiler/joomla_3/BaseDatabaseModel_import_custom.php index 43d0c526f..e429a0223 100644 --- a/admin/compiler/joomla_3/BaseDatabaseModel_import_custom.php +++ b/admin/compiler/joomla_3/BaseDatabaseModel_import_custom.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,11 +17,7 @@ // 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 @@ -31,8 +27,8 @@ class ###Component###Model###View### extends BaseDatabaseModel // set uploading values protected $use_streams = false; protected $allow_unsafe = false; - protected $safeFileOptions = array(); - + protected $safeFileOptions = []; + /** * @var object JTable object */ @@ -49,13 +45,13 @@ class ###Component###Model###View### extends BaseDatabaseModel * @var string */ protected $_context = 'com_###component###.###view###'; - + /** * Import Settings */ protected $getType = NULL; protected $dataType = NULL; - + /** * Method to auto-populate the model state. * @@ -66,7 +62,7 @@ class ###Component###Model###View### extends BaseDatabaseModel */ protected function populateState() { - $app = JFactory::getApplication('administrator'); + $app = Factory::getApplication('administrator'); $this->setState('message', $app->getUserState('com_###component###.message')); $app->setUserState('com_###component###.message', ''); @@ -76,7 +72,7 @@ protected function populateState() $this->setState('import.directory', $path); parent::populateState(); } - ###IMPORT_METHOD_CUSTOM### + ###IMPORT_METHOD_CUSTOM### /** * Works out an importation spreadsheet from a HTTP upload @@ -84,37 +80,37 @@ protected function populateState() * @return spreadsheet definition or false on failure */ protected function _getPackageFromUpload() - { + { // Get the uploaded file information - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get. $userfile = $input->files->get('import_package', null, 'raw'); - + // Make sure that file uploads are enabled in php if (!(bool) ini_get('file_uploads')) { - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); return false; } // If there is no uploaded file, we have a problem... if (!is_array($userfile)) { - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); return false; } // Check if there was a problem uploading the file. if ($userfile['error'] || $userfile['size'] < 1) { - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); return false; } // Build the appropriate paths - $config = JFactory::getConfig(); + $config = Factory::getConfig(); $tmp_dest = $config->get('tmp_path') . '/' . $userfile['name']; $tmp_src = $userfile['tmp_name']; @@ -124,7 +120,7 @@ protected function _getPackageFromUpload() // Was the package downloaded? if (!$p_file) { - $session = JFactory::getSession(); + $session = Factory::getSession(); $session->clear('package'); $session->clear('dataType'); $session->clear('hasPackage'); @@ -146,16 +142,16 @@ protected function _getPackageFromUpload() */ protected function _getPackageFromFolder() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Get the path to the package to import $p_dir = $input->getString('import_directory'); - $p_dir = JPath::clean($p_dir); + $p_dir = Path::clean($p_dir); // Did you give us a valid path? if (!file_exists($p_dir)) { - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); return false; } @@ -165,17 +161,17 @@ protected function _getPackageFromFolder() // Did you give us a valid package? if (!$type) { - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); } - + // check the extention if(!$this->checkExtension($p_dir)) { // set error message - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); return false; } - + $package['packagename'] = null; $package['dir'] = $p_dir; $package['type'] = $type; @@ -191,7 +187,7 @@ protected function _getPackageFromFolder() */ protected function _getPackageFromUrl() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Get the URL of the package to import @@ -200,17 +196,17 @@ protected function _getPackageFromUrl() // Did you give us a URL? if (!$url) { - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_ENTER_A_URL'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_ENTER_A_URL'), 'warning'); return false; } // Download the package at the URL given - $p_file = JInstallerHelper::downloadPackage($url); + $p_file = InstallerHelper::downloadPackage($url); // Was the package downloaded? if (!$p_file) { - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_INVALID_URL'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_INVALID_URL'), 'warning'); return false; } @@ -219,7 +215,7 @@ protected function _getPackageFromUrl() return $package; } - + /** * Check a file and verifies it as a spreadsheet file * Supports .csv .xlsx .xls and .ods @@ -231,29 +227,29 @@ protected function _getPackageFromUrl() */ protected function check($archivename) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Clean the name - $archivename = JPath::clean($archivename); - + $archivename = Path::clean($archivename); + // check the extention if(!$this->checkExtension($archivename)) { // Cleanup the import files $this->remove($archivename); - $app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); return false; } - - $config = JFactory::getConfig(); + + $config = Factory::getConfig(); // set Package Name $check['packagename'] = $archivename; - + // set directory $check['dir'] = $config->get('tmp_path'). '/' .$archivename; - + // set type $check['type'] = $this->getType; - + return $check; } ###IMPORT_EXT_METHOD### @@ -268,9 +264,7 @@ protected function check($archivename) */ protected function remove($package) { - jimport('joomla.filesystem.file'); - - $config = JFactory::getConfig(); + $config = Factory::getConfig(); $package = $config->get('tmp_path'). '/' .$package; // Is the package file a valid file? @@ -278,10 +272,10 @@ protected function remove($package) { File::delete($package); } - elseif (is_file(JPath::clean($package))) + elseif (is_file(Path::clean($package))) { // It might also be just a base filename - File::delete(JPath::clean($package)); + File::delete(Path::clean($package)); } } ###IMPORT_SETDATA_METHOD### @@ -290,13 +284,13 @@ protected function remove($package) protected function getAlias($name,$type = false) { // sanitize the name to an alias - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $alias = JFilterOutput::stringURLUnicodeSlug($name); + $alias = OutputFilter::stringURLUnicodeSlug($name); } else { - $alias = JFilterOutput::stringURLSafe($name); + $alias = OutputFilter::stringURLSafe($name); } // must be a uniqe alias if ($type) @@ -305,7 +299,7 @@ protected function getAlias($name,$type = false) } return $alias; } - + /** * Method to generate a uniqe value. * @@ -320,16 +314,16 @@ protected function getUniqe($value,$field,$type) // insure the filed is always uniqe while (isset($this->uniqeValueArray[$type][$field][$value])) { - $value = JString::increment($value, 'dash'); + $value = StringHelper::increment($value, 'dash'); } $this->uniqeValueArray[$type][$field][$value] = $value; return $value; } - + protected function getAliasesUsed($table) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // first we check if there is a alias column $columns = $db->getTableColumns('#__###component###_'.$table); if(isset($columns['alias'])){ diff --git a/admin/compiler/joomla_3/CHANGELOG.md b/admin/compiler/joomla_3/CHANGELOG.md new file mode 100644 index 000000000..def8704dd --- /dev/null +++ b/admin/compiler/joomla_3/CHANGELOG.md @@ -0,0 +1 @@ +###CHANGELOG### \ No newline at end of file diff --git a/admin/compiler/joomla_3/DASHJViewLagacy.php b/admin/compiler/joomla_3/DASHJViewLagacy.php index c9a759f75..d8dc3d60f 100644 --- a/admin/compiler/joomla_3/DASHJViewLagacy.php +++ b/admin/compiler/joomla_3/DASHJViewLagacy.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -22,7 +22,7 @@ /** * ###Component### View class */ -class ###Component###View###Component### extends JViewLegacy +class ###Component###View###Component### extends HtmlView { /** * View display method @@ -31,15 +31,15 @@ class ###Component###View###Component### extends JViewLegacy function display($tpl = null) { // Assign data to the view - $this->icons = $this->get('Icons'); - $this->contributors = ###Component###Helper::getContributors();###DASH_GET_CUSTOM_DATA### - + $this->icons = $this->get('Icons'); + $this->contributors = ###Component###Helper::getContributors();###DASH_GET_CUSTOM_DATA### + // get the manifest details of the component $this->manifest = ###Component###Helper::manifest(); - + // Set the toolbar $this->addToolBar(); - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -59,18 +59,18 @@ function display($tpl = null) protected function addToolBar() { $canDo = ###Component###Helper::getActions('###component###'); - JToolBarHelper::title(JText::_('COM_###COMPONENT###_DASHBOARD'), 'grid-2'); + ToolbarHelper::title(Text::_('COM_###COMPONENT###_DASHBOARD'), 'grid-2'); // set help url for this view if found $this->help_url = ###Component###Helper::getHelpUrl('###component###'); - if (###Component###Helper::checkString($this->help_url)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } if ($canDo->get('core.admin') || $canDo->get('core.options')) { - JToolBarHelper::preferences('com_###component###'); + ToolbarHelper::preferences('com_###component###'); } } @@ -81,15 +81,17 @@ protected function addToolBar() */ protected function setDocument() { - $document = JFactory::getDocument(); - - // add dashboard style sheets - $document->addStyleSheet(JURI::root() . "administrator/components/com_###component###/assets/css/dashboard.css"); - + if (!isset($this->document)) + { + $this->document = Factory::getDocument(); + } // set page title - $document->setTitle(JText::_('COM_###COMPONENT###_DASHBOARD')); - + $this->document->setTitle(Text::_('COM_###COMPONENT###_DASHBOARD')); + // add manifest to page JavaScript - $document->addScriptDeclaration("var manifest = jQuery.parseJSON('" . json_encode($this->manifest) . "');", "text/javascript"); + $this->document->addScriptDeclaration("var manifest = jQuery.parseJSON('" . json_encode($this->manifest) . "');", "text/javascript"); + + // add dashboard style sheets + Html::_('stylesheet', "administrator/components/com_###component###/assets/css/dashboard.css", ['version' => 'auto']); } } diff --git a/admin/compiler/joomla_3/DASHdefault.php b/admin/compiler/joomla_3/DASHdefault.php index 14691c6cd..bda607bcf 100644 --- a/admin/compiler/joomla_3/DASHdefault.php +++ b/admin/compiler/joomla_3/DASHdefault.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ diff --git a/admin/compiler/joomla_3/FormController.php b/admin/compiler/joomla_3/FormController.php index feb4ec217..59827b281 100644 --- a/admin/compiler/joomla_3/FormController.php +++ b/admin/compiler/joomla_3/FormController.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -40,13 +40,13 @@ class ###Component###Controller###View### extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = '###Views###'; // safeguard for setting the return view listing to the main view. parent::__construct($config); }###ADMIN_CUSTOM_BUTTONS_CONTROLLER### - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -55,7 +55,7 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) {###JCONTROLLERFORM_ALLOWADD### } @@ -69,7 +69,7 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') {###JCONTROLLERFORM_ALLOWEDIT### } @@ -94,12 +94,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -116,13 +116,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('###View###', '', array()); + $model = $this->getModel('###View###', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_###component###&view=###views###' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_###component###&view=###views###' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -147,13 +147,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -164,7 +164,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -175,7 +175,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -201,7 +201,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -219,29 +219,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -253,15 +253,14 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) {###POSTSAVEHOOK### } - } diff --git a/admin/compiler/joomla_3/FormController_custom_site.php b/admin/compiler/joomla_3/FormController_custom_site.php index 8d6d30cd5..6f38faedb 100644 --- a/admin/compiler/joomla_3/FormController_custom_site.php +++ b/admin/compiler/joomla_3/FormController_custom_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -33,7 +33,7 @@ class ###Component###Controller###SView### extends FormController */ protected $task; - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = '###SITE_DEFAULT_VIEW###'; // safeguard for setting the return view listing to the default site view. parent::__construct($config); @@ -51,13 +51,13 @@ public function __construct($config = array()) * * @since 12.2 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // to insure no other tampering return false; } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -66,7 +66,7 @@ protected function allowEdit($data = array(), $key = 'id') * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // to insure no other tampering return false; @@ -101,7 +101,7 @@ protected function allowSave($data, $key = 'id') * * @since 12.2 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(JModelLegacy $model, $validData = []) { } } diff --git a/admin/compiler/joomla_3/FormController_site.php b/admin/compiler/joomla_3/FormController_site.php index 530f3ac90..b55b176fc 100644 --- a/admin/compiler/joomla_3/FormController_site.php +++ b/admin/compiler/joomla_3/FormController_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -40,13 +40,13 @@ class ###Component###Controller###View### extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = '###SITE_DEFAULT_VIEW###'; // safeguard for setting the return view listing to the default site view. parent::__construct($config); }###ADMIN_CUSTOM_BUTTONS_CONTROLLER### - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -55,7 +55,7 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) {###JCONTROLLERFORM_ALLOWADD### } @@ -69,7 +69,7 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') {###JCONTROLLERFORM_ALLOWEDIT### } @@ -94,12 +94,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -116,13 +116,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('###View###', '', array()); + $model = $this->getModel('###View###', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_###component###&view=###views###' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_###component###&view=###views###' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -147,35 +147,35 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -201,7 +201,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -219,29 +219,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -253,14 +253,14 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) {###POSTSAVEHOOK### } diff --git a/admin/compiler/joomla_3/Helper.php b/admin/compiler/joomla_3/Helper.php index 12ed53087..5df959fc1 100644 --- a/admin/compiler/joomla_3/Helper.php +++ b/admin/compiler/joomla_3/Helper.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -15,7 +15,14 @@ ###BOM### // No direct access to this file -defined('_JEXEC') or die('Restricted access');###ADMIN_POWER_HELPER### +defined('_JEXEC') or die('Restricted access'); + +// The power autoloader for this project admin area. +$power_autoloader = JPATH_ADMINISTRATOR . '/components/com_###component###/helpers/powerloader.php'; +if (file_exists($power_autoloader)) +{ + require_once $power_autoloader; +} ###ADMIN_HELPER_CLASS_HEADER### @@ -26,14 +33,14 @@ abstract class ###Component###Helper { /** * Composer Switch - * + * * @var array */ - protected static $composer = array(); + protected static $composer = []; /** * The Main Active Language - * + * * @var string */ public static $langTag;###ADMIN_GLOBAL_EVENT_HELPER######CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT### @@ -47,7 +54,7 @@ public static function composerAutoload($target) if (!isset(self::$composer[$target])) { // get the function name - $functionName = self::safeString('compose' . $target); + $functionName = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe('compose' . $target); // check if method exist if (method_exists(__CLASS__, $functionName)) { @@ -69,7 +76,7 @@ public static function manifest() /** * Joomla version object - */ + */ protected static $JVersion; /** @@ -78,9 +85,9 @@ public static function manifest() public static function jVersion() { // check if set - if (!self::checkObject(self::$JVersion)) + if (!Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check(self::$JVersion)) { - self::$JVersion = new JVersion(); + self::$JVersion = new Version(); } return self::$JVersion; } @@ -91,18 +98,18 @@ public static function jVersion() public static function getContributors() { // get params - $params = JComponentHelper::getParams('com_###component###'); + $params = ComponentHelper::getParams('com_###component###'); // start contributors array - $contributors = array(); + $contributors = []; // get all Contributors (max 20) $searchArray = range('0','20'); foreach($searchArray as $nr) - { + { if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 1 || $params->get("showContributor".$nr) == 3)) { // set link based of selected option if($params->get("useContributor".$nr) == 1) - { + { $link_front = ''; $link_back = ''; } @@ -116,8 +123,8 @@ public static function getContributors() $link_front = ''; $link_back = ''; } - $contributors[$nr]['title'] = self::htmlEscape($params->get("titleContributor".$nr)); - $contributors[$nr]['name'] = $link_front.self::htmlEscape($params->get("nameContributor".$nr)).$link_back; + $contributors[$nr]['title'] = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($params->get("nameContributor".$nr)).$link_back; } } return $contributors; @@ -129,13 +136,13 @@ public static function getContributors() public static function addSubmenu($submenu) { // load user for access menus - $user = JFactory::getUser(); + $user = Factory::getUser(); // load the submenus to sidebar ###SUBMENU### }###HELPER_CREATEUSER######HELPER_UIKIT######HELPER_EXEL### /** - * Get a Variable + * Get a Variable * * @param string $table The table from which to get the variable * @param string $where The value where @@ -145,46 +152,18 @@ public static function addSubmenu($submenu) * @param string $main The component in which the table is found * * @return mix string/int/float - * + * @deprecated 3.3 Use Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var(...); */ public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = '###component###') { - if(!$where) - { - $where = JFactory::getUser()->id; - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else - { - $query->from($db->quoteName('#__'.$main.'_'.$table)); - } - if (is_numeric($where)) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '.(int) $where); - } - elseif (is_string($where)) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where)); - } - else - { - return false; - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - return $db->loadResult(); - } - return false; + return Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var( + $table, + $where, + $whereString, + $what, + $operator, + $main + ); } /** @@ -199,110 +178,38 @@ public static function getVar($table, $where = null, $whereString = 'user', $wha * @param bool $unique The switch to return a unique array * * @return array - * + * @deprecated 3.3 Use Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::vars(...); */ public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = '###component###', $unique = true) { - if(!$where) - { - $where = JFactory::getUser()->id; - } - - if (!self::checkArray($where) && $where > 0) - { - $where = array($where); - } - - if (self::checkArray($where)) - { - // prep main <-- why? well if $main='' is empty then $table can be categories or users - if (self::checkString($main)) - { - $main = '_'.ltrim($main, '_'); - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else - { - $query->from($db->quoteName('#_'.$main.'_'.$table)); - } - // add strings to array search - if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator) - { - $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")'); - } - else - { - $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')'); - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - if ($unique) - { - return array_unique($db->loadColumn()); - } - return $db->loadColumn(); - } - } - return false; + return Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::vars( + $table, + $where, + $whereString, + $what, + $operator, + $main, + $unique + ); } + /** + * Convert a json object to a string + * + * @input string $value The json string to convert + * + * @returns a string + * @deprecated 3.3 Use Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::string(...); + */ public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') { - // do some table foot work - $external = false; - if (strpos($table, '#__') !== false) - { - $external = true; - $table = str_replace('#__', '', $table); - } - // check if string is JSON - $result = json_decode($value, true); - if (json_last_error() === JSON_ERROR_NONE) - { - // is JSON - if (self::checkArray($result)) - { - if (self::checkString($table)) - { - $names = array(); - foreach ($result as $val) - { - if ($external) - { - if ($_name = self::getVar(null, $val, $id, $name, '=', $table)) - { - $names[] = $_name; - } - } - else - { - if ($_name = self::getVar($table, $val, $id, $name)) - { - $names[] = $_name; - } - } - } - if (self::checkArray($names)) - { - return (string) implode($sperator,$names); - } - } - return (string) implode($sperator,$result); - } - return (string) json_decode($value); - } - return $value; + return Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::string( + $value, + $sperator, + $table, + $id, + $name + ); } public static function isPublished($id,$type) @@ -311,7 +218,7 @@ public static function isPublished($id,$type) { $type = 'item'; } - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select(array('a.published')); $query->from('#__###component###_'.$type.' AS a'); @@ -329,7 +236,7 @@ public static function isPublished($id,$type) public static function getGroupName($id) { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select(array('a.title')); $query->from('#__usergroups AS a'); @@ -338,7 +245,7 @@ public static function getGroupName($id) $db->execute(); $found = $db->getNumRows(); if($found) - { + { return $db->loadResult(); } return $id; @@ -354,39 +261,39 @@ public static function getGroupName($id) * @param string $component The target component * @param object $user The user whose permissions we are loading * - * @return object The JObject of permission/authorised actions - * + * @return object The CMSObject of permission/authorised actions + * */ public static function getActions($view, &$record = null, $views = null, $target = null, $component = '###component###', $user = 'null') { // load the user if not given - if (!self::checkObject($user)) + if (!Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($user)) { // get the user object - $user = JFactory::getUser(); + $user = Factory::getUser(); } - // load the JObject - $result = new JObject; + // load the CMSObject + $result = new CMSObject; // make view name safe (just incase) - $view = self::safeString($view); - if (self::checkString($views)) + $view = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($view); + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($views)) { - $views = self::safeString($views); - } + $views = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($views); + } // get all actions from component - $actions = JAccess::getActionsFromFile( + $actions = Access::getActionsFromFile( JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', "/access/section[@name='component']/" ); - // if non found then return empty JObject + // if non found then return empty CMSObject if (empty($actions)) { return $result; } // get created by if not found - if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) + if (Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($record) && !isset($record->created_by) && isset($record->id)) { - $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); + $record->created_by = Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var($view, $record->id, 'id', 'created_by', '=', $component); } // set actions only set in component settings $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); @@ -395,12 +302,12 @@ public static function getActions($view, &$record = null, $views = null, $target if ($target) { // convert to an array - if (self::checkString($target)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($target)) { $target = array($target); } // check if we are good to go - if (self::checkArray($target)) + if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($target)) { $checkTarget = true; } @@ -421,7 +328,7 @@ public static function getActions($view, &$record = null, $views = null, $target // set area $area = 'comp'; // check if the record has an ID and the action is item related (not a component action) - if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && + if (Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) { // we are in item @@ -454,7 +361,7 @@ public static function getActions($view, &$record = null, $views = null, $target } } } - elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) + elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($views) && isset($record->catid) && $record->catid > 0) { // we are in item $area = 'category'; @@ -526,7 +433,7 @@ public static function getActions($view, &$record = null, $views = null, $target * @param array $targets The array of target actions * * @return boolean true if action should be filtered out - * + * */ protected static function filterActions(&$view, &$action, &$targets) { @@ -545,22 +452,22 @@ protected static function filterActions(&$view, &$action, &$targets) /** * Get any component's model */ - public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = '###Component###', $config = array()) + public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = '###Component###', $config = []) { // fix the name - $name = self::safeString($name); + $name = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name); // full path to models $fullPathModels = $path . '/models'; // load the model file - JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); + BaseDatabaseModel::addIncludePath($fullPathModels, $Component . 'Model'); // make sure the table path is loaded - if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + if (!isset($config['table_path']) || !Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($config['table_path'])) { // This is the JCB default path to tables in Joomla 3.x $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; } // get instance - $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); + $model = BaseDatabaseModel::getInstance($name, $Component . 'Model', $config); // if model not found (strange) if ($model == false) { @@ -595,14 +502,14 @@ public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $C */ public static function setAsset($id, $table, $inherit = true) { - $parent = JTable::getInstance('Asset'); + $parent = Table::getInstance('Asset'); $parent->loadByName('com_###component###'); - + $parentId = $parent->id; $name = 'com_###component###.'.$table.'.'.$id; $title = ''; - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName($name); // Check for an error. @@ -626,14 +533,14 @@ public static function setAsset($id, $table, $inherit = true) $asset->title = $title; // get the default asset rules $rules = self::getDefaultAssetRules('com_###component###', $table, $inherit); - if ($rules instanceof JAccessRules) + if ($rules instanceof AccessRules) { $asset->rules = (string) $rules; } if (!$asset->check() || !$asset->store()) { - JFactory::getApplication()->enqueueMessage($asset->getError(), 'warning'); + Factory::getApplication()->enqueueMessage($asset->getError(), 'warning'); return false; } else @@ -646,7 +553,7 @@ public static function setAsset($id, $table, $inherit = true) $object->asset_id = (int) $asset->id; // Update their asset_id to link to the asset table. - return JFactory::getDbo()->updateObject('#__###component###_'.$table, $object, 'id'); + return Factory::getDbo()->updateObject('#__###component###_'.$table, $object, 'id'); } } return false; @@ -663,7 +570,7 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru if (!$inherit) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -678,8 +585,8 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru } } // get asset rules - $result = JAccess::getAssetRules($assetId); - if ($result instanceof JAccessRules) + $result = Access::getAssetRules($assetId); + if ($result instanceof AccessRules) { $_result = (string) $result; $_result = json_decode($_result); @@ -694,7 +601,7 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru elseif ($inherit) { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -702,8 +609,8 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules($_result); + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules($_result); // return filtered rules return $rules; } @@ -717,35 +624,12 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru * @param SimpleXMLElement $xml The XML element reference in which to inject a comment * @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement * - * @return null - * + * @return void + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::append($xml, $node); */ public static function xmlAppend(&$xml, $node) { - if (!$node) - { - // element was not returned - return; - } - switch (get_class($node)) - { - case 'stdClass': - if (property_exists($node, 'comment')) - { - self::xmlComment($xml, $node->comment); - } - if (property_exists($node, 'fieldXML')) - { - self::xmlAppend($xml, $node->fieldXML); - } - break; - case 'SimpleXMLElement': - $domXML = dom_import_simplexml($xml); - $domNode = dom_import_simplexml($node); - $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); - $xml = simplexml_import_dom($domXML); - break; - } + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::append($xml, $node); } /** @@ -754,16 +638,12 @@ public static function xmlAppend(&$xml, $node) * @param SimpleXMLElement $xml The XML element reference in which to inject a comment * @param string $comment The comment to inject * - * @return null - * + * @return void + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::comment($xml, $comment); */ public static function xmlComment(&$xml, $comment) { - $domXML = dom_import_simplexml($xml); - $domComment = new DOMComment($comment); - $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); - $domXML->appendChild($nodeTarget); - $xml = simplexml_import_dom($domXML); + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::comment($xml, $comment); } /** @@ -773,14 +653,11 @@ public static function xmlComment(&$xml, $comment) * @param array $attributes The attributes to apply to the XML element * * @return null - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::attributes($xml, $attributes); */ - public static function xmlAddAttributes(&$xml, $attributes = array()) + public static function xmlAddAttributes(&$xml, $attributes = []) { - foreach ($attributes as $key => $value) - { - $xml->addAttribute($key, $value); - } + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::attributes($xml, $attributes); } /** @@ -790,16 +667,11 @@ public static function xmlAddAttributes(&$xml, $attributes = array()) * @param array $options The options to apply to the XML element * * @return void - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::options($xml, $options); */ - public static function xmlAddOptions(&$xml, $options = array()) + public static function xmlAddOptions(&$xml, $options = []) { - foreach ($options as $key => $value) - { - $addOption = $xml->addChild('option'); - $addOption->addAttribute('value', $key); - $addOption[] = $value; - } + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::options($xml, $options); } /** @@ -810,28 +682,11 @@ public static function xmlAddOptions(&$xml, $options = array()) * @param array $options The options to apply to the XML element * * @return object - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($attributes, $default, $options); */ public static function getFieldObject(&$attributes, $default = '', $options = null) { - // make sure we have attributes and a type value - if (self::checkArray($attributes) && isset($attributes['type'])) - { - // make sure the form helper class is loaded - if (!method_exists('JFormHelper', 'loadFieldType')) - { - jimport('joomla.form.form'); - } - // get field type - $field = JFormHelper::loadFieldType($attributes['type'], true); - // get field xml - $XML = self::getFieldXML($attributes, $options); - // setup the field - $field->setup($XML, $default); - // return the field object - return $field; - } - return false; + return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($attributes, $default, $options); } /** @@ -841,27 +696,11 @@ public static function getFieldObject(&$attributes, $default = '', $options = nu * @param array $options The options to apply to the XML element * * @return object - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::xml($attributes, $options); */ public static function getFieldXML(&$attributes, $options = null) { - // make sure we have attributes and a type value - if (self::checkArray($attributes)) - { - // start field xml - $XML = new SimpleXMLElement(''); - // load the attributes - self::xmlAddAttributes($XML, $attributes); - // check if we have options - if (self::checkArray($options)) - { - // load the options - self::xmlAddOptions($XML, $options); - } - // return the field xml - return $XML; - } - return false; + return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::xml($attributes, $options); } /** @@ -885,94 +724,69 @@ public static function renderBoolButton() // button attributes $buttonAttributes = array( 'type' => 'radio', - 'name' => isset($args[0]) ? self::htmlEscape($args[0]) : 'bool_button', - 'label' => isset($args[0]) ? self::safeString(self::htmlEscape($args[0]), 'Ww') : 'Bool Button', // not seen anyway + 'name' => isset($args[0]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[0]) : 'bool_button', + 'label' => isset($args[0]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[0]), 'Ww') : 'Bool Button', // not seen anyway 'class' => 'btn-group', 'filter' => 'INT', 'default' => isset($args[2]) ? (int) $args[2] : 0); // set the button options $buttonOptions = array( - '1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES', - '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); + '1' => isset($args[3]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[3]) : 'JYES', + '0' => isset($args[4]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[4]) : 'JNO'); // return the input - return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; + return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; } /** * Check if have an json string * - * @input string The json string to check + * @input string The json string to check * * @returns bool true on success + * @deprecated 3.3 Use Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check($string); */ public static function checkJson($string) { - if (self::checkString($string)) - { - json_decode($string); - return (json_last_error() === JSON_ERROR_NONE); - } - return false; + return Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check($string); } /** * Check if have an object with a length * - * @input object The object to check + * @input object The object to check * * @returns bool true on success + * @deprecated 3.3 Use Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($object); */ public static function checkObject($object) { - if (isset($object) && is_object($object)) - { - return count((array)$object) > 0; - } - return false; + return Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($object); } /** * Check if have an array with a length * - * @input array The array to check + * @input array The array to check * * @returns bool/int number of items in array on success + * @deprecated 3.3 Use Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($array, $removeEmptyString); */ public static function checkArray($array, $removeEmptyString = false) { - if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) - { - // also make sure the empty strings are removed - if ($removeEmptyString) - { - foreach ($array as $key => $string) - { - if (empty($string)) - { - unset($array[$key]); - } - } - return self::checkArray($array, false); - } - return $nr; - } - return false; + return Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($array, $removeEmptyString); } /** * Check if have a string with a length * - * @input string The string to check + * @input string The string to check * * @returns bool true on success + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($string); */ public static function checkString($string) { - if (isset($string) && is_string($string) && strlen($string) > 0) - { - return true; - } - return false; + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($string); } /** @@ -984,8 +798,8 @@ public static function checkString($string) public static function isConnected() { // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right? - $connected = @fsockopen("www.example.com", 80); - // website, port (try 80 or 443) + $connected = @fsockopen("www.example.com", 80); + // website, port (try 80 or 443) if ($connected) { //action when connected @@ -1003,25 +817,14 @@ public static function isConnected() /** * Merge an array of array's * - * @input array The arrays you would like to merge + * @input array The arrays you would like to merge * * @returns array on success + * @deprecated 3.3 Use Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge($arrays); */ public static function mergeArrays($arrays) { - if(self::checkArray($arrays)) - { - $arrayBuket = array(); - foreach ($arrays as $array) - { - if (self::checkArray($array)) - { - $arrayBuket = array_merge($arrayBuket, $array); - } - } - return $arrayBuket; - } - return false; + return Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge($arrays); } // typo sorry! @@ -1033,310 +836,100 @@ public static function sorten($string, $length = 40, $addTip = true) /** * Shorten a string * - * @input string The you would like to shorten + * @input string The you would like to shorten * * @returns string on success + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::shorten(...); */ public static function shorten($string, $length = 40, $addTip = true) { - if (self::checkString($string)) - { - $initial = strlen($string); - $words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE); - $words_count = count((array)$words); - - $word_length = 0; - $last_word = 0; - for (; $last_word < $words_count; ++$last_word) - { - $word_length += strlen($words[$last_word]); - if ($word_length > $length) - { - break; - } - } - - $newString = implode(array_slice($words, 0, $last_word)); - $final = strlen($newString); - if ($initial != $final && $addTip) - { - $title = self::shorten($string, 400 , false); - return ''.trim($newString).'...'; - } - elseif ($initial != $final && !$addTip) - { - return trim($newString).'...'; - } - } - return $string; + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::shorten($string, $length, $addTip); } /** * Making strings safe (various ways) * - * @input string The you would like to make safe + * @input string The you would like to make safe * * @returns string on success + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(...); */ public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) { - if ($replaceNumbers === true) - { - // remove all numbers and replace with english text version (works well only up to millions) - $string = self::replaceNumbers($string); - } - // 0nly continue if we have a string - if (self::checkString($string)) - { - // create file name without the extention that is safe - if ($type === 'filename') - { - // make sure VDM is not in the string - $string = str_replace('VDM', 'vDm', $string); - // Remove anything which isn't a word, whitespace, number - // or any of the following caracters -_() - // If you don't need to handle multi-byte characters - // you can use preg_replace rather than mb_ereg_replace - // Thanks @Łukasz Rysiak! - // $string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string); - $string = preg_replace("([^\w\s\d\-_\(\)])", '', $string); - // http://stackoverflow.com/a/2021729/1429677 - return preg_replace('/\s+/', ' ', $string); - } - // remove all other characters - $string = trim($string); - $string = preg_replace('/'.$spacer.'+/', ' ', $string); - $string = preg_replace('/\s+/', ' ', $string); - // Transliterate string - $string = self::transliterate($string); - // remove all and keep only characters - if ($keepOnlyCharacters) - { - $string = preg_replace("/[^A-Za-z ]/", '', $string); - } - // keep both numbers and characters - else - { - $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); - } - // select final adaptations - if ($type === 'L' || $type === 'strtolower') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // default is to return lower - return strtolower($string); - } - elseif ($type === 'W') - { - // return a string with all first letter of each word uppercase(no undersocre) - return ucwords(strtolower($string)); - } - elseif ($type === 'w' || $type === 'word') - { - // return a string with all lowercase(no undersocre) - return strtolower($string); - } - elseif ($type === 'Ww' || $type === 'Word') - { - // return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre) - return ucfirst(strtolower($string)); - } - elseif ($type === 'WW' || $type === 'WORD') - { - // return a string with all the uppercase(no undersocre) - return strtoupper($string); - } - elseif ($type === 'U' || $type === 'strtoupper') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // return all upper - return strtoupper($string); - } - elseif ($type === 'F' || $type === 'ucfirst') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // return with first caracter to upper - return ucfirst(strtolower($string)); - } - elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase') - { - // convert all words to first letter uppercase - $string = ucwords(strtolower($string)); - // remove white space - $string = preg_replace('/\s+/', '', $string); - // now return first letter lowercase - return lcfirst($string); - } - // return string - return $string; - } - // not a string - return ''; + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe( + $string, + $type, + $spacer, + $replaceNumbers, + $keepOnlyCharacters + ); } + /** + * Convert none English strings to code usable string + * + * @input an string + * + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::transliterate($string); + */ public static function transliterate($string) { - // set tag only once - if (!self::checkString(self::$langTag)) - { - // get global value - self::$langTag = JComponentHelper::getParams('com_###component###')->get('language', 'en-GB'); - } - // Transliterate on the language requested - $lang = Language::getInstance(self::$langTag); - return $lang->transliterate($string); + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::transliterate($string); } + /** + * make sure a string is HTML save + * + * @input an html string + * + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html(...); + */ public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40) { - if (self::checkString($var)) - { - $filter = new JFilterInput(); - $string = $filter->clean(html_entity_decode(htmlentities($var, ENT_COMPAT, $charset)), 'HTML'); - if ($shorten) - { - return self::shorten($string,$length); - } - return $string; - } - else - { - return ''; - } + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html( + $var, + $charset, + $shorten, + $length + ); }###HELPER_LICENSE_LOCK### + /** + * Convert all int in a string to an English word string + * + * @input an string with numbers + * + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::numbers($string); + */ public static function replaceNumbers($string) { - // set numbers array - $numbers = array(); - // first get all numbers - preg_match_all('!\d+!', $string, $numbers); - // check if we have any numbers - if (isset($numbers[0]) && self::checkArray($numbers[0])) - { - foreach ($numbers[0] as $number) - { - $searchReplace[$number] = self::numberToString((int)$number); - } - // now replace numbers in string - $string = str_replace(array_keys($searchReplace), array_values($searchReplace),$string); - // check if we missed any, strange if we did. - return self::replaceNumbers($string); - } - // return the string with no numbers remaining. - return $string; + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::numbers($string); } /** * Convert an integer into an English word string * Thanks to Tom Nicholson * - * @input an int + * @input an int * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::number($x); */ public static function numberToString($x) { - $nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", - "eight", "nine", "ten", "eleven", "twelve", "thirteen", - "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", - "nineteen", "twenty", 30 => "thirty", 40 => "forty", - 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", - 90 => "ninety" ); - - if(!is_numeric($x)) - { - $w = $x; - } - elseif(fmod($x, 1) != 0) - { - $w = $x; - } - else - { - if($x < 0) - { - $w = 'minus '; - $x = -$x; - } - else - { - $w = ''; - // ... now $x is a non-negative integer. - } - - if($x < 21) // 0 to 20 - { - $w .= $nwords[$x]; - } - elseif($x < 100) // 21 to 99 - { - $w .= $nwords[10 * floor($x/10)]; - $r = fmod($x, 10); - if($r > 0) - { - $w .= ' '. $nwords[$r]; - } - } - elseif($x < 1000) // 100 to 999 - { - $w .= $nwords[floor($x/100)] .' hundred'; - $r = fmod($x, 100); - if($r > 0) - { - $w .= ' and '. self::numberToString($r); - } - } - elseif($x < 1000000) // 1000 to 999999 - { - $w .= self::numberToString(floor($x/1000)) .' thousand'; - $r = fmod($x, 1000); - if($r > 0) - { - $w .= ' '; - if($r < 100) - { - $w .= 'and '; - } - $w .= self::numberToString($r); - } - } - else // millions - { - $w .= self::numberToString(floor($x/1000000)) .' million'; - $r = fmod($x, 1000000); - if($r > 0) - { - $w .= ' '; - if($r < 100) - { - $w .= 'and '; - } - $w .= self::numberToString($r); - } - } - } - return $w; + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::number($x); } /** * Random Key * * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::random($size); */ public static function randomkey($size) { - $bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; - $key = array(); - $bagsize = strlen($bag) - 1; - for ($i = 0; $i < $size; $i++) - { - $get = rand(0, $bagsize); - $key[] = $bag[$get]; - } - return implode($key); + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::random($size); }###GET_CRYPT_KEY### } - diff --git a/admin/compiler/joomla_3/Helper_category.php b/admin/compiler/joomla_3/Helper_category.php index ad4ed490c..193ebff3a 100644 --- a/admin/compiler/joomla_3/Helper_category.php +++ b/admin/compiler/joomla_3/Helper_category.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ diff --git a/admin/compiler/joomla_3/Helper_category_view.php b/admin/compiler/joomla_3/Helper_category_view.php index 53e2d88d3..ac2046a0e 100644 --- a/admin/compiler/joomla_3/Helper_category_view.php +++ b/admin/compiler/joomla_3/Helper_category_view.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -28,7 +28,7 @@ class ###Component######View###Categories extends JCategories * @param array $options Array of options * */ - public function __construct($options = array()) + public function __construct($options = []) { $options['table'] = '#__###component###_###view###'; $options['extension'] = 'com_###component###.###view###'; diff --git a/admin/compiler/joomla_3/Helper_email.php b/admin/compiler/joomla_3/Helper_email.php index 309817cac..f51347eb9 100644 --- a/admin/compiler/joomla_3/Helper_email.php +++ b/admin/compiler/joomla_3/Helper_email.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,6 +17,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Mail\Mail; +use Joomla\Registry\Registry; + /** * ###Component### component email helper */ @@ -27,28 +32,28 @@ abstract class ###Component###Email * * @var activeRecipient (array) */ - public static $active = array(); + public static $active = []; /** * Configuraiton object * - * @var JConfig + * @var Registry */ - public static $config = null; + public static ?Registry $config = null; /** * Mailer object * - * @var JMail + * @var Mail */ - public static $mailer = null; + public static ?Mail $mailer = null; /** * Custom Headers * * @var array */ - protected static $header = array(); + protected static array $header = []; /** * Get a configuration object @@ -58,7 +63,7 @@ public static function getConfig() { if (!self::$config) { - self::$config = JComponentHelper::getParams('com_###component###'); + self::$config = ComponentHelper::getParams('com_###component###'); } return self::$config; @@ -97,7 +102,7 @@ public static function getMailerInstance() * @static * @access public */ - public static function validateAddress($address, $patternselect = null) + public static function validateAddress($address, $patternselect = null): bool { return self::getMailerInstance()->validateAddress($address, $patternselect); } @@ -105,13 +110,13 @@ public static function validateAddress($address, $patternselect = null) /** * Get a mailer object. * - * Returns the global {@link JMail} object, only creating it if it doesn't already exist. + * Returns the global {@link Mail} object, only creating it if it doesn't already exist. * - * @return JMail object + * @return Mail object * - * @see JMail + * @see Mail */ - public static function getMailer() + public static function getMailer(): Mail { if (!self::$mailer) { @@ -126,58 +131,58 @@ public static function getMailer() /** * Create a mailer object * - * @return JMail object + * @return Mail object * - * @see JMail + * @see Mail */ - protected static function createMailer() + protected static function createMailer(): Mail { // set component params $conf = self::getConfig(); - + // now load the mailer $mailer = $conf->get('mailer', 'global'); - - // Create a JMail object - $mail = JMail::getInstance(); + + // Create a Mail object + $mail = Mail::getInstance(); // check if set to global if ('global' == $mailer) { // get the global details - $globalConf = JFactory::getConfig(); - - $mailer = $globalConf->get('mailer'); - $smtpauth = ($globalConf->get('smtpauth') == 0) ? null : 1; - $smtpuser = $globalConf->get('smtpuser'); - $smtppass = $globalConf->get('smtppass'); - $smtphost = $globalConf->get('smtphost'); - $smtpsecure = $globalConf->get('smtpsecure'); - $smtpport = $globalConf->get('smtpport'); - $sendmail = $globalConf->get('sendmail'); - $mailfrom = $globalConf->get('mailfrom'); - $fromname = $globalConf->get('fromname'); - $replyto = $globalConf->get('replyto'); - $replytoname = $globalConf->get('replytoname'); + $globalConf = Factory::getConfig(); + + $mailer = $globalConf->get('mailer'); + $smtpauth = ($globalConf->get('smtpauth') == 0) ? null : 1; + $smtpuser = $globalConf->get('smtpuser'); + $smtppass = $globalConf->get('smtppass'); + $smtphost = $globalConf->get('smtphost'); + $smtpsecure = $globalConf->get('smtpsecure'); + $smtpport = $globalConf->get('smtpport'); + $sendmail = $globalConf->get('sendmail'); + $mailfrom = $globalConf->get('mailfrom'); + $fromname = $globalConf->get('fromname'); + $replyto = $globalConf->get('replyto'); + $replytoname = $globalConf->get('replytoname'); } else { - $smtpauth = ($conf->get('smtpauth') == 0) ? null : 1; - $smtpuser = $conf->get('smtpuser'); - $smtppass = $conf->get('smtppass'); - $smtphost = $conf->get('smtphost'); - $smtpsecure = $conf->get('smtpsecure'); - $smtpport = $conf->get('smtpport'); - $sendmail = $conf->get('sendmail'); - $mailfrom = $conf->get('emailfrom'); - $fromname = $conf->get('fromname'); - $replyto = $conf->get('replyto'); - $replytoname = $conf->get('replytoname'); + $smtpauth = ($conf->get('smtpauth') == 0) ? null : 1; + $smtpuser = $conf->get('smtpuser'); + $smtppass = $conf->get('smtppass'); + $smtphost = $conf->get('smtphost'); + $smtpsecure = $conf->get('smtpsecure'); + $smtpport = $conf->get('smtpport'); + $sendmail = $conf->get('sendmail'); + $mailfrom = $conf->get('emailfrom'); + $fromname = $conf->get('fromname'); + $replyto = $conf->get('replyto'); + $replytoname = $conf->get('replytoname'); } // Set global sender $mail->setSender(array($mailfrom, $fromname)); - + // set the global reply-to if found if ($replyto && $replytoname) { @@ -226,25 +231,25 @@ public static function setHeader($target, $value) */ public static function send($recipient, $subject, $body, $textonly, $mode = 0, $bounce_email = null, $idsession = null, $mailreply = null, $replyname = null , $mailfrom = null, $fromname = null, $cc = null, $bcc = null, $attachment = null, $embeded = null , $embeds = null) { - // Get a JMail instance + // Get a Mail instance $mail = self::getMailer(); - + // set component params $conf = self::getConfig(); - + // set if we have override if ($mailfrom && $fromname) { $mail->setSender(array($mailfrom, $fromname)); } - + // load the bounce email as sender if set if (!is_null($bounce_email)) - { + { $mail->Sender = $bounce_email; } - - // Add tag to email to identify it + + // Add tag to email to identify it if (!is_null($idsession)) { $mail->addCustomHeader('X-VDMmethodID:'.$idsession); @@ -262,7 +267,7 @@ public static function send($recipient, $subject, $body, $textonly, $mode = 0, $ // set the subject & Body $mail->setSubject($subject); $mail->setBody($body); - + // Are we sending the email as HTML? if ($mode) { @@ -273,7 +278,7 @@ public static function send($recipient, $subject, $body, $textonly, $mode = 0, $ //embed images if ($embeded) { - if(###Component###Helper::checkArray($embeds)) + if(Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($embeds)) { foreach($embeds as $embed) { @@ -308,21 +313,21 @@ public static function send($recipient, $subject, $body, $textonly, $mode = 0, $ { if (!empty($conf->get('dkim_domain')) && !empty($conf->get('dkim_selector')) && !empty($conf->get('dkim_private')) && !empty($conf->get('dkim_public'))) { - $mail->DKIM_domain = $conf->get('dkim_domain'); - $mail->DKIM_selector = $conf->get('dkim_selector'); - $mail->DKIM_identity = $conf->get('dkim_identity'); - $mail->DKIM_passphrase = $conf->get('dkim_passphrase'); - - $tmp = tempnam(sys_get_temp_dir(), 'VDM'); - $h = fopen($tmp, 'w'); + $mail->DKIM_domain = $conf->get('dkim_domain'); + $mail->DKIM_selector = $conf->get('dkim_selector'); + $mail->DKIM_identity = $conf->get('dkim_identity'); + $mail->DKIM_passphrase = $conf->get('dkim_passphrase'); + + $tmp = tempnam(sys_get_temp_dir(), 'VDM'); + $h = fopen($tmp, 'w'); fwrite($h, $conf->get('dkim_private')); fclose($h); - $mail->DKIM_private = $tmp; + $mail->DKIM_private = $tmp; } } $sendmail = $mail->Send(); - + if ($conf->get('enable_dkim') && !empty($conf->get('dkim_domain')) && !empty($conf->get('dkim_selector')) && !empty($conf->get('dkim_private')) && !empty($conf->get('dkim_public'))) { @unlink($tmp); @@ -351,7 +356,7 @@ public static function send($recipient, $subject, $body, $textonly, $mode = 0, $ /** * Set html text (in a row) and subject (as title) to a email table. * do not use

instead use
- * in your html that you pass to this method + * in your html that you pass to this method * since it is a table row it does not * work well with paragraphs * @@ -360,7 +365,7 @@ public static function send($recipient, $subject, $body, $textonly, $mode = 0, $ */ public static function setBasicBody($html, $subject) { - $body = array(); + $body = []; $body[] = ""; $body[] = ""; $body[] = ""; @@ -397,7 +402,7 @@ public static function setBasicBody($html, $subject) /** * Set html text (in a row) and subject (as title) to a email table. * do not use

instead use
- * in your html that you pass to this method + * in your html that you pass to this method * since it is a table row it does not * work well with paragraphs * @@ -406,7 +411,7 @@ public static function setBasicBody($html, $subject) */ public static function setTableBody($html, $subject) { - $body = array(); + $body = []; $body[] = ""; $body[] = ""; $body[] = ""; diff --git a/admin/compiler/joomla_3/Helper_site.php b/admin/compiler/joomla_3/Helper_site.php index d9069328c..d773a70df 100644 --- a/admin/compiler/joomla_3/Helper_site.php +++ b/admin/compiler/joomla_3/Helper_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -15,7 +15,14 @@ ###BOM### // No direct access to this file -defined('_JEXEC') or die('Restricted access');###SITE_POWER_HELPER### +defined('_JEXEC') or die('Restricted access'); + +// The power autoloader for this project site area. +$power_autoloader = JPATH_SITE . '/components/com_###component###/helpers/powerloader.php'; +if (file_exists($power_autoloader)) +{ + require_once $power_autoloader; +} ###SITE_HELPER_CLASS_HEADER### @@ -26,14 +33,14 @@ abstract class ###Component###Helper { /** * Composer Switch - * + * * @var array */ - protected static $composer = array(); + protected static $composer = []; /** * The Main Active Language - * + * * @var string */ public static $langTag;###SITE_GLOBAL_EVENT_HELPER######SITE_CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT### @@ -47,7 +54,7 @@ public static function composerAutoload($target) if (!isset(self::$composer[$target])) { // get the function name - $functionName = self::safeString('compose' . $target); + $functionName = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe('compose' . $target); // check if method exist if (method_exists(__CLASS__, $functionName)) { @@ -59,54 +66,22 @@ public static function composerAutoload($target) } /** - * Convert it into a string + * Convert a json object to a string + * + * @input string $value The json string to convert + * + * @returns a string + * @deprecated 3.3 Use Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::string(...); */ public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') { - // do some table foot work - $external = false; - if (strpos($table, '#__') !== false) - { - $external = true; - $table = str_replace('#__', '', $table); - } - // check if string is JSON - $result = json_decode($value, true); - if (json_last_error() === JSON_ERROR_NONE) - { - // is JSON - if (self::checkArray($result)) - { - if (self::checkString($table)) - { - $names = array(); - foreach ($result as $val) - { - if ($external) - { - if ($_name = self::getVar(null, $val, $id, $name, '=', $table)) - { - $names[] = $_name; - } - } - else - { - if ($_name = self::getVar($table, $val, $id, $name)) - { - $names[] = $_name; - } - } - } - if (self::checkArray($names)) - { - return (string) implode($sperator,$names); - } - } - return (string) implode($sperator,$result); - } - return (string) json_decode($value); - } - return $value; + return Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::string( + $value, + $sperator, + $table, + $id, + $name + ); } /** @@ -120,7 +95,7 @@ public static function manifest() /** * Joomla version object - */ + */ protected static $JVersion; /** @@ -129,9 +104,9 @@ public static function manifest() public static function jVersion() { // check if set - if (!self::checkObject(self::$JVersion)) + if (!Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check(self::$JVersion)) { - self::$JVersion = new JVersion(); + self::$JVersion = new Version(); } return self::$JVersion; } @@ -142,9 +117,9 @@ public static function jVersion() public static function getContributors() { // get params - $params = JComponentHelper::getParams('com_###component###'); + $params = ComponentHelper::getParams('com_###component###'); // start contributors array - $contributors = array(); + $contributors = []; // get all Contributors (max 20) $searchArray = range('0','20'); foreach($searchArray as $nr) @@ -153,22 +128,22 @@ public static function getContributors() { // set link based of selected option if($params->get("useContributor".$nr) == 1) - { + { $link_front = ''; $link_back = ''; } - elseif($params->get("useContributor".$nr) == 2) - { + elseif($params->get("useContributor".$nr) == 2) + { $link_front = ''; $link_back = ''; } - else - { + else + { $link_front = ''; $link_back = ''; } - $contributors[$nr]['title'] = self::htmlEscape($params->get("titleContributor".$nr)); - $contributors[$nr]['name'] = $link_front.self::htmlEscape($params->get("nameContributor".$nr)).$link_back; + $contributors[$nr]['title'] = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($params->get("nameContributor".$nr)).$link_back; } } return $contributors; @@ -177,22 +152,22 @@ public static function getContributors() /** * Get any component's model */ - public static function getModel($name, $path = JPATH_COMPONENT_SITE, $Component = '###Component###', $config = array()) + public static function getModel($name, $path = JPATH_COMPONENT_SITE, $Component = '###Component###', $config = []) { // fix the name - $name = self::safeString($name); + $name = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name); // full path to models $fullPathModels = $path . '/models'; // load the model file - JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); + BaseDatabaseModel::addIncludePath($fullPathModels, $Component . 'Model'); // make sure the table path is loaded - if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + if (!isset($config['table_path']) || !Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($config['table_path'])) { // This is the JCB default path to tables in Joomla 3.x $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; } // get instance - $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); + $model = BaseDatabaseModel::getInstance($name, $Component . 'Model', $config); // if model not found (strange) if ($model == false) { @@ -227,14 +202,14 @@ public static function getModel($name, $path = JPATH_COMPONENT_SITE, $Component */ public static function setAsset($id, $table, $inherit = true) { - $parent = JTable::getInstance('Asset'); + $parent = Table::getInstance('Asset'); $parent->loadByName('com_###component###'); - + $parentId = $parent->id; $name = 'com_###component###.'.$table.'.'.$id; $title = ''; - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName($name); // Check for an error. @@ -258,14 +233,14 @@ public static function setAsset($id, $table, $inherit = true) $asset->title = $title; // get the default asset rules $rules = self::getDefaultAssetRules('com_###component###', $table, $inherit); - if ($rules instanceof JAccessRules) + if ($rules instanceof AccessRules) { $asset->rules = (string) $rules; } if (!$asset->check() || !$asset->store()) { - JFactory::getApplication()->enqueueMessage($asset->getError(), 'warning'); + Factory::getApplication()->enqueueMessage($asset->getError(), 'warning'); return false; } else @@ -278,7 +253,7 @@ public static function setAsset($id, $table, $inherit = true) $object->asset_id = (int) $asset->id; // Update their asset_id to link to the asset table. - return JFactory::getDbo()->updateObject('#__###component###_'.$table, $object, 'id'); + return Factory::getDbo()->updateObject('#__###component###_'.$table, $object, 'id'); } } return false; @@ -295,7 +270,7 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru if (!$inherit) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -310,8 +285,8 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru } } // get asset rules - $result = JAccess::getAssetRules($assetId); - if ($result instanceof JAccessRules) + $result = Access::getAssetRules($assetId); + if ($result instanceof AccessRules) { $_result = (string) $result; $_result = json_decode($_result); @@ -326,7 +301,7 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru elseif ($inherit) { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -334,8 +309,8 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules($_result); + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules($_result); // return filtered rules return $rules; } @@ -349,35 +324,12 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru * @param SimpleXMLElement $xml The XML element reference in which to inject a comment * @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement * - * @return null - * + * @return void + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::append($xml, $node); */ public static function xmlAppend(&$xml, $node) { - if (!$node) - { - // element was not returned - return; - } - switch (get_class($node)) - { - case 'stdClass': - if (property_exists($node, 'comment')) - { - self::xmlComment($xml, $node->comment); - } - if (property_exists($node, 'fieldXML')) - { - self::xmlAppend($xml, $node->fieldXML); - } - break; - case 'SimpleXMLElement': - $domXML = dom_import_simplexml($xml); - $domNode = dom_import_simplexml($node); - $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); - $xml = simplexml_import_dom($domXML); - break; - } + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::append($xml, $node); } /** @@ -386,16 +338,12 @@ public static function xmlAppend(&$xml, $node) * @param SimpleXMLElement $xml The XML element reference in which to inject a comment * @param string $comment The comment to inject * - * @return null - * + * @return void + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::comment($xml, $comment); */ public static function xmlComment(&$xml, $comment) { - $domXML = dom_import_simplexml($xml); - $domComment = new DOMComment($comment); - $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); - $domXML->appendChild($nodeTarget); - $xml = simplexml_import_dom($domXML); + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::comment($xml, $comment); } /** @@ -405,14 +353,11 @@ public static function xmlComment(&$xml, $comment) * @param array $attributes The attributes to apply to the XML element * * @return null - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::attributes($xml, $attributes); */ - public static function xmlAddAttributes(&$xml, $attributes = array()) + public static function xmlAddAttributes(&$xml, $attributes = []) { - foreach ($attributes as $key => $value) - { - $xml->addAttribute($key, $value); - } + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::attributes($xml, $attributes); } /** @@ -422,16 +367,11 @@ public static function xmlAddAttributes(&$xml, $attributes = array()) * @param array $options The options to apply to the XML element * * @return void - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::options($xml, $options); */ - public static function xmlAddOptions(&$xml, $options = array()) + public static function xmlAddOptions(&$xml, $options = []) { - foreach ($options as $key => $value) - { - $addOption = $xml->addChild('option'); - $addOption->addAttribute('value', $key); - $addOption[] = $value; - } + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::options($xml, $options); } /** @@ -442,28 +382,11 @@ public static function xmlAddOptions(&$xml, $options = array()) * @param array $options The options to apply to the XML element * * @return object - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($attributes, $default, $options); */ public static function getFieldObject(&$attributes, $default = '', $options = null) { - // make sure we have attributes and a type value - if (self::checkArray($attributes) && isset($attributes['type'])) - { - // make sure the form helper class is loaded - if (!method_exists('JFormHelper', 'loadFieldType')) - { - jimport('joomla.form.form'); - } - // get field type - $field = JFormHelper::loadFieldType($attributes['type'], true); - // get field xml - $XML = self::getFieldXML($attributes, $options); - // setup the field - $field->setup($XML, $default); - // return the field object - return $field; - } - return false; + return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($attributes, $default, $options); } /** @@ -473,27 +396,11 @@ public static function getFieldObject(&$attributes, $default = '', $options = nu * @param array $options The options to apply to the XML element * * @return object - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::xml($attributes, $options); */ public static function getFieldXML(&$attributes, $options = null) { - // make sure we have attributes and a type value - if (self::checkArray($attributes)) - { - // start field xml - $XML = new SimpleXMLElement(''); - // load the attributes - self::xmlAddAttributes($XML, $attributes); - // check if we have options - if (self::checkArray($options)) - { - // load the options - self::xmlAddOptions($XML, $options); - } - // return the field xml - return $XML; - } - return false; + return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::xml($attributes, $options); } /** @@ -517,21 +424,21 @@ public static function renderBoolButton() // button attributes $buttonAttributes = array( 'type' => 'radio', - 'name' => isset($args[0]) ? self::htmlEscape($args[0]) : 'bool_button', - 'label' => isset($args[0]) ? self::safeString(self::htmlEscape($args[0]), 'Ww') : 'Bool Button', // not seen anyway + 'name' => isset($args[0]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[0]) : 'bool_button', + 'label' => isset($args[0]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[0]), 'Ww') : 'Bool Button', // not seen anyway 'class' => 'btn-group', 'filter' => 'INT', 'default' => isset($args[2]) ? (int) $args[2] : 0); // set the button options $buttonOptions = array( - '1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES', - '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); + '1' => isset($args[3]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[3]) : 'JYES', + '0' => isset($args[4]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[4]) : 'JNO'); // return the input - return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; + return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; }###HELPER_UIKIT######HELPER_CREATEUSER### /** - * Get a variable + * Get a variable * * @param string $table The table from which to get the variable * @param string $where The value where @@ -541,46 +448,18 @@ public static function renderBoolButton() * @param string $main The component in which the table is found * * @return mix string/int/float - * + * @deprecated 3.3 Use Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var(...); */ public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = '###component###') { - if(!$where) - { - $where = JFactory::getUser()->id; - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else - { - $query->from($db->quoteName('#__'.$main.'_'.$table)); - } - if (is_numeric($where)) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '.(int) $where); - } - elseif (is_string($where)) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where)); - } - else - { - return false; - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - return $db->loadResult(); - } - return false; + return Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var( + $table, + $where, + $whereString, + $what, + $operator, + $main + ); } /** @@ -595,63 +474,20 @@ public static function getVar($table, $where = null, $whereString = 'user', $wha * @param bool $unique The switch to return a unique array * * @return array - * + * @deprecated 3.3 Use Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::vars(...); */ public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = '###component###', $unique = true) { - if(!$where) - { - $where = JFactory::getUser()->id; - } - - if (!self::checkArray($where) && $where > 0) - { - $where = array($where); - } - - if (self::checkArray($where)) - { - // prep main <-- why? well if $main='' is empty then $table can be categories or users - if (self::checkString($main)) - { - $main = '_'.ltrim($main, '_'); - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else - { - $query->from($db->quoteName('#_'.$main.'_'.$table)); - } - // add strings to array search - if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator) - { - $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")'); - } - else - { - $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')'); - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - if ($unique) - { - return array_unique($db->loadColumn()); - } - return $db->loadColumn(); - } - } - return false; - } + return Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::vars( + $table, + $where, + $whereString, + $what, + $operator, + $main, + $unique + ); + } public static function isPublished($id,$type) { @@ -659,7 +495,7 @@ public static function isPublished($id,$type) { $type = 'item'; } - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select(array('a.published')); $query->from('#__###component###_'.$type.' AS a'); @@ -677,7 +513,7 @@ public static function isPublished($id,$type) public static function getGroupName($id) { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select(array('a.title')); $query->from('#__usergroups AS a'); @@ -702,39 +538,39 @@ public static function getGroupName($id) * @param string $component The target component * @param object $user The user whose permissions we are loading * - * @return object The JObject of permission/authorised actions - * + * @return object The CMSObject of permission/authorised actions + * */ public static function getActions($view, &$record = null, $views = null, $target = null, $component = '###component###', $user = 'null') { // load the user if not given - if (!self::checkObject($user)) + if (!Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($user)) { // get the user object - $user = JFactory::getUser(); + $user = Factory::getUser(); } - // load the JObject - $result = new JObject; + // load the CMSObject + $result = new CMSObject; // make view name safe (just incase) - $view = self::safeString($view); - if (self::checkString($views)) + $view = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($view); + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($views)) { - $views = self::safeString($views); - } + $views = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($views); + } // get all actions from component - $actions = JAccess::getActionsFromFile( + $actions = Access::getActionsFromFile( JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', "/access/section[@name='component']/" ); - // if non found then return empty JObject + // if non found then return empty CMSObject if (empty($actions)) { return $result; } // get created by if not found - if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) + if (Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($record) && !isset($record->created_by) && isset($record->id)) { - $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); + $record->created_by = Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var($view, $record->id, 'id', 'created_by', '=', $component); } // set actions only set in component settings $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); @@ -743,12 +579,12 @@ public static function getActions($view, &$record = null, $views = null, $target if ($target) { // convert to an array - if (self::checkString($target)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($target)) { $target = array($target); } // check if we are good to go - if (self::checkArray($target)) + if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($target)) { $checkTarget = true; } @@ -769,7 +605,7 @@ public static function getActions($view, &$record = null, $views = null, $target // set area $area = 'comp'; // check if the record has an ID and the action is item related (not a component action) - if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && + if (Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) { // we are in item @@ -802,7 +638,7 @@ public static function getActions($view, &$record = null, $views = null, $target } } } - elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) + elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($views) && isset($record->catid) && $record->catid > 0) { // we are in item $area = 'category'; @@ -874,7 +710,7 @@ public static function getActions($view, &$record = null, $views = null, $target * @param array $targets The array of target actions * * @return boolean true if action should be filtered out - * + * */ protected static function filterActions(&$view, &$action, &$targets) { @@ -893,78 +729,53 @@ protected static function filterActions(&$view, &$action, &$targets) /** * Check if have an json string * - * @input string The json string to check + * @input string The json string to check * * @returns bool true on success + * @deprecated 3.3 Use Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check($string); */ public static function checkJson($string) { - if (self::checkString($string)) - { - json_decode($string); - return (json_last_error() === JSON_ERROR_NONE); - } - return false; + return Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check($string); } /** * Check if have an object with a length * - * @input object The object to check + * @input object The object to check * * @returns bool true on success + * @deprecated 3.3 Use Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($object); */ public static function checkObject($object) { - if (isset($object) && is_object($object)) - { - return count((array)$object) > 0; - } - return false; + return Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($object); } /** * Check if have an array with a length * - * @input array The array to check + * @input array The array to check * * @returns bool/int number of items in array on success + * @deprecated 3.3 Use Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($array, $removeEmptyString); */ public static function checkArray($array, $removeEmptyString = false) { - if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) - { - // also make sure the empty strings are removed - if ($removeEmptyString) - { - foreach ($array as $key => $string) - { - if (empty($string)) - { - unset($array[$key]); - } - } - return self::checkArray($array, false); - } - return $nr; - } - return false; + return Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($array, $removeEmptyString); } /** * Check if have a string with a length * - * @input string The string to check + * @input string The string to check * * @returns bool true on success + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($string); */ public static function checkString($string) { - if (isset($string) && is_string($string) && strlen($string) > 0) - { - return true; - } - return false; + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($string); } /** @@ -976,8 +787,8 @@ public static function checkString($string) public static function isConnected() { // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right? - $connected = @fsockopen("www.example.com", 80); - // website, port (try 80 or 443) + $connected = @fsockopen("www.example.com", 80); + // website, port (try 80 or 443) if ($connected) { //action when connected @@ -995,25 +806,14 @@ public static function isConnected() /** * Merge an array of array's * - * @input array The arrays you would like to merge + * @input array The arrays you would like to merge * * @returns array on success + * @deprecated 3.3 Use Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge($arrays); */ public static function mergeArrays($arrays) { - if(self::checkArray($arrays)) - { - $arrayBuket = array(); - foreach ($arrays as $array) - { - if (self::checkArray($array)) - { - $arrayBuket = array_merge($arrayBuket, $array); - } - } - return $arrayBuket; - } - return false; + return Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge($arrays); } // typo sorry! @@ -1025,310 +825,100 @@ public static function sorten($string, $length = 40, $addTip = true) /** * Shorten a string * - * @input string The you would like to shorten + * @input string The you would like to shorten * * @returns string on success + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::shorten(...); */ public static function shorten($string, $length = 40, $addTip = true) { - if (self::checkString($string)) - { - $initial = strlen($string); - $words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE); - $words_count = count((array)$words); - - $word_length = 0; - $last_word = 0; - for (; $last_word < $words_count; ++$last_word) - { - $word_length += strlen($words[$last_word]); - if ($word_length > $length) - { - break; - } - } - - $newString = implode(array_slice($words, 0, $last_word)); - $final = strlen($newString); - if ($initial != $final && $addTip) - { - $title = self::shorten($string, 400 , false); - return ''.trim($newString).'...'; - } - elseif ($initial != $final && !$addTip) - { - return trim($newString).'...'; - } - } - return $string; + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::shorten($string, $length, $addTip); } /** * Making strings safe (various ways) * - * @input string The you would like to make safe + * @input string The you would like to make safe * * @returns string on success + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(...); */ public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) { - if ($replaceNumbers === true) - { - // remove all numbers and replace with english text version (works well only up to millions) - $string = self::replaceNumbers($string); - } - // 0nly continue if we have a string - if (self::checkString($string)) - { - // create file name without the extention that is safe - if ($type === 'filename') - { - // make sure VDM is not in the string - $string = str_replace('VDM', 'vDm', $string); - // Remove anything which isn't a word, whitespace, number - // or any of the following caracters -_() - // If you don't need to handle multi-byte characters - // you can use preg_replace rather than mb_ereg_replace - // Thanks @Łukasz Rysiak! - // $string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string); - $string = preg_replace("([^\w\s\d\-_\(\)])", '', $string); - // http://stackoverflow.com/a/2021729/1429677 - return preg_replace('/\s+/', ' ', $string); - } - // remove all other characters - $string = trim($string); - $string = preg_replace('/'.$spacer.'+/', ' ', $string); - $string = preg_replace('/\s+/', ' ', $string); - // Transliterate string - $string = self::transliterate($string); - // remove all and keep only characters - if ($keepOnlyCharacters) - { - $string = preg_replace("/[^A-Za-z ]/", '', $string); - } - // keep both numbers and characters - else - { - $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); - } - // select final adaptations - if ($type === 'L' || $type === 'strtolower') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // default is to return lower - return strtolower($string); - } - elseif ($type === 'W') - { - // return a string with all first letter of each word uppercase(no undersocre) - return ucwords(strtolower($string)); - } - elseif ($type === 'w' || $type === 'word') - { - // return a string with all lowercase(no undersocre) - return strtolower($string); - } - elseif ($type === 'Ww' || $type === 'Word') - { - // return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre) - return ucfirst(strtolower($string)); - } - elseif ($type === 'WW' || $type === 'WORD') - { - // return a string with all the uppercase(no undersocre) - return strtoupper($string); - } - elseif ($type === 'U' || $type === 'strtoupper') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // return all upper - return strtoupper($string); - } - elseif ($type === 'F' || $type === 'ucfirst') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // return with first caracter to upper - return ucfirst(strtolower($string)); - } - elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase') - { - // convert all words to first letter uppercase - $string = ucwords(strtolower($string)); - // remove white space - $string = preg_replace('/\s+/', '', $string); - // now return first letter lowercase - return lcfirst($string); - } - // return string - return $string; - } - // not a string - return ''; + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe( + $string, + $type, + $spacer, + $replaceNumbers, + $keepOnlyCharacters + ); } + /** + * Convert none English strings to code usable string + * + * @input an string + * + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::transliterate($string); + */ public static function transliterate($string) { - // set tag only once - if (!self::checkString(self::$langTag)) - { - // get global value - self::$langTag = JComponentHelper::getParams('com_###component###')->get('language', 'en-GB'); - } - // Transliterate on the language requested - $lang = Language::getInstance(self::$langTag); - return $lang->transliterate($string); + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::transliterate($string); } + /** + * make sure a string is HTML save + * + * @input an html string + * + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html(...); + */ public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40) { - if (self::checkString($var)) - { - $filter = new JFilterInput(); - $string = $filter->clean(html_entity_decode(htmlentities($var, ENT_COMPAT, $charset)), 'HTML'); - if ($shorten) - { - return self::shorten($string,$length); - } - return $string; - } - else - { - return ''; - } + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html( + $var, + $charset, + $shorten, + $length + ); }###HELPER_SITE_LICENSE_LOCK### + /** + * Convert all int in a string to an English word string + * + * @input an string with numbers + * + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::numbers($string); + */ public static function replaceNumbers($string) { - // set numbers array - $numbers = array(); - // first get all numbers - preg_match_all('!\d+!', $string, $numbers); - // check if we have any numbers - if (isset($numbers[0]) && self::checkArray($numbers[0])) - { - foreach ($numbers[0] as $number) - { - $searchReplace[$number] = self::numberToString((int)$number); - } - // now replace numbers in string - $string = str_replace(array_keys($searchReplace), array_values($searchReplace),$string); - // check if we missed any, strange if we did. - return self::replaceNumbers($string); - } - // return the string with no numbers remaining. - return $string; + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::numbers($string); } /** * Convert an integer into an English word string * Thanks to Tom Nicholson * - * @input an int + * @input an int * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::number($x); */ public static function numberToString($x) { - $nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", - "eight", "nine", "ten", "eleven", "twelve", "thirteen", - "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", - "nineteen", "twenty", 30 => "thirty", 40 => "forty", - 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", - 90 => "ninety" ); - - if(!is_numeric($x)) - { - $w = $x; - } - elseif(fmod($x, 1) != 0) - { - $w = $x; - } - else - { - if($x < 0) - { - $w = 'minus '; - $x = -$x; - } - else - { - $w = ''; - // ... now $x is a non-negative integer. - } - - if($x < 21) // 0 to 20 - { - $w .= $nwords[$x]; - } - elseif($x < 100) // 21 to 99 - { - $w .= $nwords[10 * floor($x/10)]; - $r = fmod($x, 10); - if($r > 0) - { - $w .= ' '. $nwords[$r]; - } - } - elseif($x < 1000) // 100 to 999 - { - $w .= $nwords[floor($x/100)] .' hundred'; - $r = fmod($x, 100); - if($r > 0) - { - $w .= ' and '. self::numberToString($r); - } - } - elseif($x < 1000000) // 1000 to 999999 - { - $w .= self::numberToString(floor($x/1000)) .' thousand'; - $r = fmod($x, 1000); - if($r > 0) - { - $w .= ' '; - if($r < 100) - { - $w .= 'and '; - } - $w .= self::numberToString($r); - } - } - else // millions - { - $w .= self::numberToString(floor($x/1000000)) .' million'; - $r = fmod($x, 1000000); - if($r > 0) - { - $w .= ' '; - if($r < 100) - { - $w .= 'and '; - } - $w .= self::numberToString($r); - } - } - } - return $w; + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::number($x); } /** * Random Key * * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::random($size); */ public static function randomkey($size) { - $bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; - $key = array(); - $bagsize = strlen($bag) - 1; - for ($i = 0; $i < $size; $i++) - { - $get = rand(0, $bagsize); - $key[] = $bag[$get]; - } - return implode($key); + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::random($size); }###GET_CRYPT_KEY### } - diff --git a/admin/compiler/joomla_3/HtmlView_custom_admin.php b/admin/compiler/joomla_3/HtmlView_custom_admin.php index ca7f5df16..dc0f06ed4 100644 --- a/admin/compiler/joomla_3/HtmlView_custom_admin.php +++ b/admin/compiler/joomla_3/HtmlView_custom_admin.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -15,9 +15,9 @@ ###BOM### // No direct access to this file -defined('_JEXEC') or die('Restricted access'); ###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_GET_MODULE_JIMPORT### +defined('_JEXEC') or die('Restricted access'); ###LICENSE_LOCKED_DEFINED### -###CUSTOM_ADMIN_VIEW_HTML_HEADER### +###CUSTOM_ADMIN_VIEW_HTML_HEADER######CUSTOM_ADMIN_GET_MODULE_JIMPORT### /** * ###Component### Html View class for the ###SView### @@ -28,11 +28,11 @@ class ###Component###View###SView### extends HtmlView function display($tpl = null) { // get component params - $this->params = JComponentHelper::getParams('com_###component###'); + $this->params = ComponentHelper::getParams('com_###component###'); // get the application - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); // get the user object - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // get global action permissions $this->canDo = ###Component###Helper::getActions('###sview###');###CUSTOM_ADMIN_DIPLAY_METHOD### }###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS### @@ -43,7 +43,7 @@ function display($tpl = null) protected function setDocument() {###CUSTOM_ADMIN_LIBRARIES_LOADER######CUSTOM_ADMIN_DOCUMENT_METADATA######CUSTOM_ADMIN_UIKIT_LOADER######CUSTOM_ADMIN_GOOGLECHART_LOADER######CUSTOM_ADMIN_FOOTABLE_LOADER######CUSTOM_ADMIN_DOCUMENT_CUSTOM_PHP### // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_###component###/assets/css/###sview###.css', (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');###CUSTOM_ADMIN_DOCUMENT_CUSTOM_CSS######CUSTOM_ADMIN_DOCUMENT_CUSTOM_JS### + Html::_('stylesheet', 'administrator/components/com_###component###/assets/css/###sview###.css', ['version' => 'auto']);###CUSTOM_ADMIN_DOCUMENT_CUSTOM_CSS######CUSTOM_ADMIN_DOCUMENT_CUSTOM_JS### } /** @@ -59,22 +59,22 @@ protected function addToolBar() // Check for empty title and add view name if param is set if (empty($title)) { - $title = JText::_('COM_###COMPONENT###_###SVIEW###'); + $title = Text::_('COM_###COMPONENT###_###SVIEW###'); } // add title to the page - JToolbarHelper::title($title,'###ICOMOON###');###CUSTOM_ADMIN_CUSTOM_BUTTONS### + ToolbarHelper::title($title,'###ICOMOON###');###CUSTOM_ADMIN_CUSTOM_BUTTONS### // set help url for this view if found $this->help_url = ###Component###Helper::getHelpUrl('###sviews###'); - if (###Component###Helper::checkString($this->help_url)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_###component###'); + ToolbarHelper::preferences('com_###component###'); } }###CUSTOM_ADMIN_GET_MODULE### @@ -88,7 +88,17 @@ protected function addToolBar() public function escape($var) { // use the helper htmlEscape method instead. - return ###Component###Helper::htmlEscape($var, $this->_charset); + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } ?> diff --git a/admin/compiler/joomla_3/HtmlView_edit.php b/admin/compiler/joomla_3/HtmlView_edit.php index 309e298b9..a0c3431a5 100644 --- a/admin/compiler/joomla_3/HtmlView_edit.php +++ b/admin/compiler/joomla_3/HtmlView_edit.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -31,7 +31,7 @@ class ###Component###View###View### extends HtmlView public function display($tpl = null) { // set params - $this->params = JComponentHelper::getParams('com_###component###'); + $this->params = ComponentHelper::getParams('com_###component###'); // Assign the variables $this->form = $this->get('Form'); $this->item = $this->get('Item'); @@ -40,7 +40,7 @@ public function display($tpl = null) // get action permissions $this->canDo = ###Component###Helper::getActions('###view###', $this->item); // get input - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $this->ref = $jinput->get('ref', 0, 'word'); $this->refid = $jinput->get('refid', 0, 'int'); $return = $jinput->get('return', null, 'base64'); @@ -65,7 +65,7 @@ public function display($tpl = null) // Set the toolbar $this->addToolBar(); - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -99,11 +99,11 @@ public function escape($var) { if(strlen($var) > 30) { - // use the helper htmlEscape method instead and shorten the string - return ###Component###Helper::htmlEscape($var, $this->_charset, true, 30); + // use the helper htmlEscape method instead and shorten the string + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset, true, 30); } // use the helper htmlEscape method instead. - return ###Component###Helper::htmlEscape($var, $this->_charset); + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset); } /** @@ -114,14 +114,20 @@ public function escape($var) protected function setDocument() { $isNew = ($this->item->id < 1); - if (!isset($this->document)) - { - $this->document = JFactory::getDocument(); - } - $this->document->setTitle(JText::_($isNew ? 'COM_###COMPONENT###_###VIEW###_NEW' : 'COM_###COMPONENT###_###VIEW###_EDIT')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_###component###/assets/css/###view###.css", (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');###AJAXTOKE######LINKEDVIEWTABLESCRIPTS### - $this->document->addScript(JURI::root() . $this->script, (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root() . "administrator/components/com_###component###/views/###view###/submitbutton.js", (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); ###DOCUMENT_CUSTOM_PHP### - JText::script('view not acceptable. Error'); + $this->getDocument()->setTitle(Text::_($isNew ? 'COM_###COMPONENT###_###VIEW###_NEW' : 'COM_###COMPONENT###_###VIEW###_EDIT')); + Html::_('stylesheet', "administrator/components/com_###component###/assets/css/###view###.css", ['version' => 'auto']);###AJAXTOKE######LINKEDVIEWTABLESCRIPTS### + Html::_('script', $this->script, ['version' => 'auto']); + Html::_('script', "administrator/components/com_###component###/views/###view###/submitbutton.js", ['version' => 'auto']);###DOCUMENT_CUSTOM_PHP### + Text::script('view not acceptable. Error'); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/admin/compiler/joomla_3/HtmlView_edit_site.php b/admin/compiler/joomla_3/HtmlView_edit_site.php index b2fd1f338..070fde9f5 100644 --- a/admin/compiler/joomla_3/HtmlView_edit_site.php +++ b/admin/compiler/joomla_3/HtmlView_edit_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -31,7 +31,7 @@ class ###Component###View###View### extends HtmlView public function display($tpl = null) { // set params - $this->params = JComponentHelper::getParams('com_###component###'); + $this->params = ComponentHelper::getParams('com_###component###'); // Assign the variables $this->form = $this->get('Form'); $this->item = $this->get('Item'); @@ -40,7 +40,7 @@ public function display($tpl = null) // get action permissions $this->canDo = ###Component###Helper::getActions('###view###', $this->item); // get input - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $this->ref = $jinput->get('ref', 0, 'word'); $this->refid = $jinput->get('refid', 0, 'int'); $return = $jinput->get('return', null, 'base64'); @@ -65,7 +65,7 @@ public function display($tpl = null) // Set the toolbar $this->addToolBar(); - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -86,7 +86,7 @@ public function display($tpl = null) protected function addToolBar() {###ADDTOOLBAR### // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); + $this->toolbar = Toolbar::getInstance(); } /** @@ -100,11 +100,11 @@ public function escape($var) { if(strlen($var) > 30) { - // use the helper htmlEscape method instead and shorten the string - return ###Component###Helper::htmlEscape($var, $this->_charset, true, 30); + // use the helper htmlEscape method instead and shorten the string + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset, true, 30); } // use the helper htmlEscape method instead. - return ###Component###Helper::htmlEscape($var, $this->_charset); + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset); } /** @@ -115,11 +115,7 @@ public function escape($var) protected function setDocument() { $isNew = ($this->item->id < 1); - if (!isset($this->document)) - { - $this->document = JFactory::getDocument(); - } - $this->document->setTitle(JText::_($isNew ? 'COM_###COMPONENT###_###VIEW###_NEW' : 'COM_###COMPONENT###_###VIEW###_EDIT')); + $this->getDocument()->setTitle(Text::_($isNew ? 'COM_###COMPONENT###_###VIEW###_NEW' : 'COM_###COMPONENT###_###VIEW###_EDIT')); // only add the ISIS template css & js if needed (default is 1 = true) // you can override this in the global component options // just add a (radio yes/no field) with a name called add_isis_template @@ -127,14 +123,24 @@ protected function setDocument() if ($this->params->get('add_isis_template', 1)) { // we need this to fix the form display (TODO) - $this->document->addStyleSheet(JURI::root() . "administrator/templates/isis/css/template.css", (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript(JURI::root() . "administrator/templates/isis/js/template.js", (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + Html::_('stylesheet', "administrator/templates/isis/css/template.css", ['version' => 'auto']); + Html::_('script', "administrator/templates/isis/js/template.js", ['version' => 'auto']); } // the default style of this view - $this->document->addStyleSheet(JURI::root()."components/com_###component###/assets/css/###view###.css", (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');###AJAXTOKE######LINKEDVIEWTABLESCRIPTS### + Html::_('stylesheet', "components/com_###component###/assets/css/###view###.css", ['version' => 'auto']);###AJAXTOKE######LINKEDVIEWTABLESCRIPTS### // default javascript of this view - $this->document->addScript(JURI::root(). $this->script, (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root(). "components/com_###component###/views/###view###/submitbutton.js", (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); ###DOCUMENT_CUSTOM_PHP### - JText::script('view not acceptable. Error'); + Html::_('script', $this->script, ['version' => 'auto']); + Html::_('script', "components/com_###component###/views/###view###/submitbutton.js", ['version' => 'auto']);###DOCUMENT_CUSTOM_PHP### + Text::script('view not acceptable. Error'); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/admin/compiler/joomla_3/HtmlView_import.php b/admin/compiler/joomla_3/HtmlView_import.php index c19e19f8d..9569a7aec 100644 --- a/admin/compiler/joomla_3/HtmlView_import.php +++ b/admin/compiler/joomla_3/HtmlView_import.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,7 +17,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Toolbar\ToolbarHelper; /** * ###Component### Import Html View @@ -31,7 +34,7 @@ class ###Component###ViewImport extends HtmlView protected $dataType; public function display($tpl = null) - { + { if ($this->getLayout() !== 'modal') { // Include helper submenu @@ -44,7 +47,7 @@ public function display($tpl = null) $this->paths = &$paths; $this->state = &$state; - // get global action permissions + // get global action permissions $this->canDo = ###Component###Helper::getActions('import'); // We don't need toolbar in the modal window. @@ -55,18 +58,18 @@ public function display($tpl = null) } // get the session object - $session = JFactory::getSession(); + $session = Factory::getSession(); // check if it has package - $this->hasPackage = $session->get('hasPackage', false); - $this->dataType = $session->get('dataType', false); + $this->hasPackage = $session->get('hasPackage', false); + $this->dataType = $session->get('dataType', false); if($this->hasPackage && $this->dataType) { - $this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true); - $this->headers = ###Component###Helper::getFileHeaders($this->dataType); + $this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true); + $this->headers = ###Component###Helper::getFileHeaders($this->dataType); // clear the data type $session->clear('dataType'); } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -82,19 +85,19 @@ public function display($tpl = null) */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_###COMPONENT###_IMPORT_TITLE'), 'upload'); + ToolbarHelper::title(Text::_('COM_###COMPONENT###_IMPORT_TITLE'), 'upload'); JHtmlSidebar::setAction('index.php?option=com_###component###&view=import'); if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_###component###'); + ToolbarHelper::preferences('com_###component###'); } // set help url for this view if found $this->help_url = ###Component###Helper::getHelpUrl('import'); - if (###Component###Helper::checkString($this->help_url)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } } } diff --git a/admin/compiler/joomla_3/HtmlView_import_custom.php b/admin/compiler/joomla_3/HtmlView_import_custom.php index bee878fc1..68390de5b 100644 --- a/admin/compiler/joomla_3/HtmlView_import_custom.php +++ b/admin/compiler/joomla_3/HtmlView_import_custom.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,7 +17,13 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Toolbar\ToolbarHelper; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; /** * ###Component### ###View### Html View @@ -30,19 +36,19 @@ class ###Component###View###View### extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_###COMPONENT###_IMPORT_TITLE'), 'upload'); + ToolbarHelper::title(Text::_('COM_###COMPONENT###_IMPORT_TITLE'), 'upload'); JHtmlSidebar::setAction('index.php?option=com_###component###&view=###view###'); if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_###component###'); + ToolbarHelper::preferences('com_###component###'); } // set help url for this view if found $this->help_url = ###Component###Helper::getHelpUrl('###view###'); - if (###Component###Helper::checkString($this->help_url)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } } } diff --git a/admin/compiler/joomla_3/HtmlView_list.php b/admin/compiler/joomla_3/HtmlView_list.php index 740a8c545..f00898087 100644 --- a/admin/compiler/joomla_3/HtmlView_list.php +++ b/admin/compiler/joomla_3/HtmlView_list.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -40,10 +40,10 @@ function display($tpl = null) $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser();###ADMIN_DIPLAY_METHOD### + $this->user = Factory::getUser();###ADMIN_DIPLAY_METHOD### $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = ###Component###Helper::getActions('###view###');###JVIEWLISTCANDO### @@ -58,7 +58,7 @@ function display($tpl = null) $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -77,32 +77,32 @@ function display($tpl = null) */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_###COMPONENT###_###VIEWS###'), '###ICOMOON###'); JHtmlSidebar::setAction('index.php?option=com_###component###&view=###views###'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_###COMPONENT###_###VIEWS###'), '###ICOMOON###'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('###view###.add'); + ToolbarHelper::addNew('###view###.add'); } // Only load if there are items - if (###Component###Helper::checkArray($this->items)) + if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('###view###.edit'); + ToolbarHelper::editList('###view###.edit'); } if ($this->canState) { - JToolBarHelper::publishList('###views###.publish'); - JToolBarHelper::unpublishList('###views###.unpublish'); - JToolBarHelper::archiveList('###views###.archive'); + ToolbarHelper::publishList('###views###.publish'); + ToolbarHelper::unpublishList('###views###.unpublish'); + ToolbarHelper::archiveList('###views###.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('###views###.checkin'); + ToolbarHelper::checkin('###views###.checkin'); } } @@ -110,11 +110,11 @@ protected function addToolBar() if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -122,25 +122,25 @@ protected function addToolBar() if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', '###views###.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', '###views###.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('###views###.trash'); + ToolbarHelper::trash('###views###.trash'); }###EXPORTBUTTON### }###ADMIN_CUSTOM_FUNCTION_ONLY_BUTTONS_LIST######IMPORTBUTTON### // set help url for this view if found $this->help_url = ###Component###Helper::getHelpUrl('###views###'); - if (###Component###Helper::checkString($this->help_url)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_###component###'); + ToolbarHelper::preferences('com_###component###'); }###FILTERFIELDDISPLAYHELPER######BATCHDISPLAYHELPER### } @@ -153,10 +153,10 @@ protected function setDocument() { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_###COMPONENT###_###VIEWS###')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_###component###/assets/css/###views###.css", (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');###ADMIN_ADD_JAVASCRIPT_FILE### + $this->document->setTitle(Text::_('COM_###COMPONENT###_###VIEWS###')); + Html::_('stylesheet', "administrator/components/com_###component###/assets/css/###views###.css", ['version' => 'auto']);###ADMIN_ADD_JAVASCRIPT_FILE### } /** @@ -171,19 +171,29 @@ public function escape($var) if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return ###Component###Helper::htmlEscape($var, $this->_charset, true); + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return ###Component###Helper::htmlEscape($var, $this->_charset); + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { ###SORTFIELDS### + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; }###FILTERFUNCTIONS### } diff --git a/admin/compiler/joomla_3/HtmlView_list_custom_admin.php b/admin/compiler/joomla_3/HtmlView_list_custom_admin.php index 766c63395..ebea61327 100644 --- a/admin/compiler/joomla_3/HtmlView_list_custom_admin.php +++ b/admin/compiler/joomla_3/HtmlView_list_custom_admin.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -15,9 +15,9 @@ ###BOM### // No direct access to this file -defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_GET_MODULE_JIMPORT### +defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### -###CUSTOM_ADMIN_VIEWS_HTML_HEADER### +###CUSTOM_ADMIN_VIEWS_HTML_HEADER######CUSTOM_ADMIN_GET_MODULE_JIMPORT### /** * ###Component### Html View class for the ###SViews### @@ -28,11 +28,11 @@ class ###Component###View###SViews### extends HtmlView function display($tpl = null) { // get component params - $this->params = JComponentHelper::getParams('com_###component###'); + $this->params = ComponentHelper::getParams('com_###component###'); // get the application - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); // get the user object - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // get global action permissions $this->canDo = ###Component###Helper::getActions('###sview###');###CUSTOM_ADMIN_DIPLAY_METHOD### }###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS### @@ -43,7 +43,7 @@ function display($tpl = null) protected function setDocument() {###CUSTOM_ADMIN_LIBRARIES_LOADER######CUSTOM_ADMIN_UIKIT_LOADER######CUSTOM_ADMIN_GOOGLECHART_LOADER######CUSTOM_ADMIN_FOOTABLE_LOADER######CUSTOM_ADMIN_DOCUMENT_CUSTOM_PHP### // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_###component###/assets/css/###sviews###.css', (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');###CUSTOM_ADMIN_DOCUMENT_CUSTOM_CSS######CUSTOM_ADMIN_DOCUMENT_CUSTOM_JS### + Html::_('stylesheet', 'administrator/components/com_###component###/assets/css/###sviews###.css', ['version' => 'auto']);###CUSTOM_ADMIN_DOCUMENT_CUSTOM_CSS######CUSTOM_ADMIN_DOCUMENT_CUSTOM_JS### } /** @@ -52,19 +52,19 @@ protected function setDocument() protected function addToolBar() {###HIDEMAINMENU### // add title to the page - JToolbarHelper::title(JText::_('COM_###COMPONENT###_###SVIEWS###'),'###ICOMOON###');###CUSTOM_ADMIN_CUSTOM_BUTTONS### + ToolbarHelper::title(Text::_('COM_###COMPONENT###_###SVIEWS###'),'###ICOMOON###');###CUSTOM_ADMIN_CUSTOM_BUTTONS### // set help url for this view if found $this->help_url = ###Component###Helper::getHelpUrl('###sviews###'); - if (###Component###Helper::checkString($this->help_url)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_###component###'); + ToolbarHelper::preferences('com_###component###'); } }###CUSTOM_ADMIN_GET_MODULE### @@ -78,6 +78,16 @@ protected function addToolBar() public function escape($var) { // use the helper htmlEscape method instead. - return ###Component###Helper::htmlEscape($var, $this->_charset); + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/admin/compiler/joomla_3/HtmlView_list_site.php b/admin/compiler/joomla_3/HtmlView_list_site.php index dea200543..424a6acae 100644 --- a/admin/compiler/joomla_3/HtmlView_list_site.php +++ b/admin/compiler/joomla_3/HtmlView_list_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -15,9 +15,9 @@ ###BOM### // No direct access to this file -defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######SITE_GET_MODULE_JIMPORT### +defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### -###SITE_VIEWS_HTML_HEADER### +###SITE_VIEWS_HTML_HEADER######SITE_GET_MODULE_JIMPORT### /** * ###Component### Html View class for the ###SViews### @@ -26,13 +26,13 @@ class ###Component###View###SViews### extends HtmlView { // Overwriting JView display method function display($tpl = null) - { + { // get combined params of both component and menu - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->params = $this->app->getParams(); $this->menu = $this->app->getMenu()->getActive(); // get the user object - $this->user = JFactory::getUser();###SITE_DIPLAY_METHOD### + $this->user = Factory::getUser();###SITE_DIPLAY_METHOD### }###SITE_EXTRA_DIPLAY_METHODS### /** @@ -41,7 +41,7 @@ function display($tpl = null) protected function _prepareDocument() {###SITE_LIBRARIES_LOADER######SITE_UIKIT_LOADER######SITE_GOOGLECHART_LOADER######SITE_FOOTABLE_LOADER######SITE_DOCUMENT_METADATA######SITE_DOCUMENT_CUSTOM_PHP### // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/components/com_###component###/assets/css/###sview###.css', (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');###SITE_DOCUMENT_CUSTOM_CSS######SITE_DOCUMENT_CUSTOM_JS######SITE_JAVASCRIPT_FOR_BUTTONS### + Html::_('stylesheet', 'components/com_###component###/assets/css/###sview###.css', ['version' => 'auto']);###SITE_DOCUMENT_CUSTOM_CSS######SITE_DOCUMENT_CUSTOM_JS######SITE_JAVASCRIPT_FOR_BUTTONS### } /** @@ -49,15 +49,15 @@ protected function _prepareDocument() */ protected function addToolBar() {###SITE_CUSTOM_BUTTONS### - + // set help url for this view if found $this->help_url = ###Component###Helper::getHelpUrl('###sviews###'); - if (###Component###Helper::checkString($this->help_url)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); + $this->toolbar = Toolbar::getInstance(); }###SITE_GET_MODULE### /** @@ -70,6 +70,16 @@ protected function addToolBar() public function escape($var, $sorten = false, $length = 40) { // use the helper htmlEscape method instead. - return ###Component###Helper::htmlEscape($var, $this->_charset, $sorten, $length); + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset, $sorten, $length); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/admin/compiler/joomla_3/HtmlView_site.php b/admin/compiler/joomla_3/HtmlView_site.php index 12e20f031..5c4ca5ecd 100644 --- a/admin/compiler/joomla_3/HtmlView_site.php +++ b/admin/compiler/joomla_3/HtmlView_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -15,9 +15,9 @@ ###BOM### // No direct access to this file -defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######SITE_GET_MODULE_JIMPORT### +defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### -###SITE_VIEW_HTML_HEADER### +###SITE_VIEW_HTML_HEADER######SITE_GET_MODULE_JIMPORT### /** * ###Component### Html View class for the ###SView### @@ -26,22 +26,22 @@ class ###Component###View###SView### extends HtmlView { // Overwriting JView display method function display($tpl = null) - { + { // get combined params of both component and menu - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->params = $this->app->getParams(); $this->menu = $this->app->getMenu()->getActive(); // get the user object - $this->user = JFactory::getUser();###SITE_DIPLAY_METHOD### + $this->user = Factory::getUser();###SITE_DIPLAY_METHOD### }###SITE_EXTRA_DIPLAY_METHODS### /** * Prepares the document */ protected function _prepareDocument() - {###SITE_LIBRARIES_LOADER######SITE_UIKIT_LOADER######SITE_GOOGLECHART_LOADER######SITE_FOOTABLE_LOADER######SITE_DOCUMENT_METADATA######SITE_DOCUMENT_CUSTOM_PHP### + {###SITE_LIBRARIES_LOADER######SITE_UIKIT_LOADER######SITE_GOOGLECHART_LOADER######SITE_FOOTABLE_LOADER######SITE_DOCUMENT_METADATA######SITE_DOCUMENT_CUSTOM_PHP### // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/components/com_###component###/assets/css/###sview###.css', (###Component###Helper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');###SITE_DOCUMENT_CUSTOM_CSS######SITE_DOCUMENT_CUSTOM_JS######SITE_JAVASCRIPT_FOR_BUTTONS### + Html::_('stylesheet', 'components/com_###component###/assets/css/###sview###.css', ['version' => 'auto']);###SITE_DOCUMENT_CUSTOM_CSS######SITE_DOCUMENT_CUSTOM_JS######SITE_JAVASCRIPT_FOR_BUTTONS### } /** @@ -52,12 +52,12 @@ protected function addToolBar() // set help url for this view if found $this->help_url = ###Component###Helper::getHelpUrl('###sview###'); - if (###Component###Helper::checkString($this->help_url)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); + $this->toolbar = Toolbar::getInstance(); }###SITE_GET_MODULE### /** @@ -70,6 +70,16 @@ protected function addToolBar() public function escape($var, $sorten = false, $length = 40) { // use the helper htmlEscape method instead. - return ###Component###Helper::htmlEscape($var, $this->_charset, $sorten, $length); + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset, $sorten, $length); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/admin/compiler/joomla_3/ItemModel_custom_admin.php b/admin/compiler/joomla_3/ItemModel_custom_admin.php index 56f08cab1..c8c49b430 100644 --- a/admin/compiler/joomla_3/ItemModel_custom_admin.php +++ b/admin/compiler/joomla_3/ItemModel_custom_admin.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -31,7 +31,7 @@ class ###Component###Model###SView### extends ItemModel */ protected $_context = 'com_###component###.###sview###'; - /** + /** * Model user data. * * @var strings @@ -61,7 +61,7 @@ class ###Component###Model###SView### extends ItemModel */ protected function populateState() { - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; // Get the item main id $id = $this->input->getInt('id', null); @@ -80,12 +80,12 @@ protected function populateState() */ public function getItem($pk = null) { - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // check if this user has permission to access item if (!$this->user->authorise('###sview###.access', 'com_###component###')) { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('Not authorised!'), 'error'); + $app = Factory::getApplication(); + $app->enqueueMessage(Text::_('Not authorised!'), 'error'); // redirect away if not a correct to cPanel/default view $app->redirect('index.php?option=com_###component###'); return false; @@ -98,10 +98,10 @@ public function getItem($pk = null) $this->initSet = true; $pk = (!empty($pk)) ? $pk : (int) $this->getState('###sview###.id');###CUSTOM_ADMIN_BEFORE_GET_ITEM### - + if ($this->_item === null) { - $this->_item = array(); + $this->_item = []; }###LICENSE_LOCKED_CHECK### if (!isset($this->_item[$pk])) @@ -114,7 +114,7 @@ public function getItem($pk = null) if ($e->getCode() == 404) { // Need to go thru the error handler to allow Redirect to work. - JError::raiseWarning(404, $e->getMessage()); + JError::raiseError(404, $e->getMessage()); } else { diff --git a/admin/compiler/joomla_3/ItemModel_site.php b/admin/compiler/joomla_3/ItemModel_site.php index 621f2f1c7..ca73e7e3e 100644 --- a/admin/compiler/joomla_3/ItemModel_site.php +++ b/admin/compiler/joomla_3/ItemModel_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -61,7 +61,7 @@ class ###Component###Model###SView### extends ItemModel */ protected function populateState() { - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; // Get the itme main id $id = $this->input->getInt('id', null); @@ -82,7 +82,7 @@ protected function populateState() */ public function getItem($pk = null) { - $this->user = JFactory::getUser();###USER_PERMISSION_CHECK_ACCESS### + $this->user = Factory::getUser();###USER_PERMISSION_CHECK_ACCESS### $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); @@ -91,10 +91,10 @@ public function getItem($pk = null) $this->initSet = true; $pk = (!empty($pk)) ? $pk : (int) $this->getState('###sview###.id');###SITE_BEFORE_GET_ITEM### - + if ($this->_item === null) { - $this->_item = array(); + $this->_item = []; }###LICENSE_LOCKED_CHECK### if (!isset($this->_item[$pk])) @@ -107,7 +107,7 @@ public function getItem($pk = null) if ($e->getCode() == 404) { // Need to go thru the error handler to allow Redirect to work. - JError::raiseWarning(404, $e->getMessage()); + JError::raiseError(404, $e->getMessage()); } else { diff --git a/admin/compiler/joomla_3/JFormFieldCheckboxes.php b/admin/compiler/joomla_3/JFormFieldCheckboxes.php index d5a12f4ba..f852886b6 100644 --- a/admin/compiler/joomla_3/JFormFieldCheckboxes.php +++ b/admin/compiler/joomla_3/JFormFieldCheckboxes.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,6 +17,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('checkboxes'); @@ -29,14 +33,14 @@ class ###JPREFIX###FormField###Type### extends JFormFieldCheckboxes /** * The ###type### field type. * - * @var string + * @var string */ public $type = '###type###'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/compiler/joomla_3/JFormFieldCustom.php b/admin/compiler/joomla_3/JFormFieldCustom.php index ee8b72e07..307bc608a 100644 --- a/admin/compiler/joomla_3/JFormFieldCustom.php +++ b/admin/compiler/joomla_3/JFormFieldCustom.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,7 +17,7 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -###JFORM_TYPE_HEADER### +###FORM_CUSTOM_FIELD_HEADER### /** * ###Type### Form Field class for the ###Component### component @@ -27,7 +27,7 @@ class ###JPREFIX###FormField###Type### extends JFormField###JFORM_EXTENDS### /** * The ###type### field type. * - * @var string + * @var string */ - public $type = '###type###';###JFORM_TYPE_PHP### + public $type = '###type###';###FORM_CUSTOM_FIELD_PHP### } diff --git a/admin/compiler/joomla_3/JFormFieldList.php b/admin/compiler/joomla_3/JFormFieldList.php index 5a56cd132..504167838 100644 --- a/admin/compiler/joomla_3/JFormFieldList.php +++ b/admin/compiler/joomla_3/JFormFieldList.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,6 +17,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -29,14 +33,14 @@ class ###JPREFIX###FormField###Type### extends JFormFieldList /** * The ###type### field type. * - * @var string + * @var string */ public $type = '###type###';###ADD_BUTTON### /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/compiler/joomla_3/JFormFieldRadio.php b/admin/compiler/joomla_3/JFormFieldRadio.php index ac9412514..75ec4e5c5 100644 --- a/admin/compiler/joomla_3/JFormFieldRadio.php +++ b/admin/compiler/joomla_3/JFormFieldRadio.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,6 +17,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('radio'); @@ -29,14 +33,14 @@ class ###JPREFIX###FormField###Type### extends JFormFieldRadio /** * The ###type### field type. * - * @var string + * @var string */ public $type = '###type###'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/compiler/joomla_3/JFormFieldUser.php b/admin/compiler/joomla_3/JFormFieldUser.php index 4a9966db1..85ed69077 100644 --- a/admin/compiler/joomla_3/JFormFieldUser.php +++ b/admin/compiler/joomla_3/JFormFieldUser.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,6 +17,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('user'); @@ -29,7 +33,7 @@ class ###JPREFIX###FormField###Type### extends JFormFieldUser /** * The ###type### field type. * - * @var string + * @var string */ public $type = '###type###'; diff --git a/admin/compiler/joomla_3/JFormRule.php b/admin/compiler/joomla_3/JFormRule.php index 830ed92a0..34b02fefa 100644 --- a/admin/compiler/joomla_3/JFormRule.php +++ b/admin/compiler/joomla_3/JFormRule.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,9 +17,12 @@ // No direct access to this file defined('JPATH_PLATFORM') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Form\Form; use Joomla\CMS\Form\FormRule; use Joomla\Registry\Registry; +use Joomla\CMS\HTML\HTMLHelper as Html; /** * Form Rule (###Name###) class for the Joomla Platform. diff --git a/admin/compiler/joomla_3/ListModel.php b/admin/compiler/joomla_3/ListModel.php index 2d45037ab..f2d12e963 100644 --- a/admin/compiler/joomla_3/ListModel.php +++ b/admin/compiler/joomla_3/ListModel.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -24,10 +24,10 @@ */ class ###Component###Model###Views### extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( ###FILTER_FIELDS### ); @@ -49,7 +49,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -60,7 +60,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -70,21 +70,21 @@ public function getItems() {###LICENSE_LOCKED_CHECK######CHECKINCALL### // load parent items $items = parent::getItems();###GET_ITEMS_METHOD_STRING_FIX######SELECTIONTRANSLATIONFIX######GET_ITEMS_METHOD_AFTER_ALL### - + // return items return $items; }###SELECTIONTRANSLATIONFIXFUNC### - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() {###LICENSE_LOCKED_CHECK### ###LISTQUERY### }###MODELEXPORTMETHOD######LICENSE_LOCKED_SET_BOOL### - + /** * Method to get a store id based on model configuration state. * diff --git a/admin/compiler/joomla_3/ListModelAjax.php b/admin/compiler/joomla_3/ListModelAjax.php index cf9cb916f..18d5f23b7 100644 --- a/admin/compiler/joomla_3/ListModelAjax.php +++ b/admin/compiler/joomla_3/ListModelAjax.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -25,12 +25,12 @@ class ###Component###ModelAjax extends ListModel { protected $app_params; - - public function __construct() - { - parent::__construct(); + + public function __construct() + { + parent::__construct(); // get params - $this->app_params = JComponentHelper::getParams('com_###component###'); - + $this->app_params = ComponentHelper::getParams('com_###component###'); + }###AJAX_MODEL_METHODS### } diff --git a/admin/compiler/joomla_3/ListModelAjaxSite.php b/admin/compiler/joomla_3/ListModelAjaxSite.php index 2aacc4948..d02c9bfca 100644 --- a/admin/compiler/joomla_3/ListModelAjaxSite.php +++ b/admin/compiler/joomla_3/ListModelAjaxSite.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -30,7 +30,7 @@ public function __construct() { parent::__construct(); // get params - $this->app_params = JComponentHelper::getParams('com_###component###'); + $this->app_params = ComponentHelper::getParams('com_###component###'); }###AJAX_SITE_MODEL_METHODS### } diff --git a/admin/compiler/joomla_3/ListModelDASH.php b/admin/compiler/joomla_3/ListModelDASH.php index ad8357abb..25f57f5eb 100644 --- a/admin/compiler/joomla_3/ListModelDASH.php +++ b/admin/compiler/joomla_3/ListModelDASH.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -27,9 +27,9 @@ class ###Component###Model###Component### extends ListModel public function getIcons() { // load user for access menus - $user = JFactory::getUser(); + $user = Factory::getUser(); // reset icon array - $icons = array(); + $icons = []; // view groups array $viewGroups = array( 'main' => array(###DASHBOARDICONS###) @@ -38,7 +38,7 @@ public function getIcons() foreach($viewGroups as $group => $views) { $i = 0; - if (###Component###Helper::checkArray($views)) + if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($views)) { foreach($views as $view) { @@ -50,11 +50,11 @@ public function getIcons() if (count($dwd) == 3) { list($type, $name, $url) = $dwd; - $viewName = $name; - $alt = $name; - $url = $url; - $image = $name . '.' . $type; - $name = 'COM_###COMPONENT###_DASHBOARD_' . ###Component###Helper::safeString($name,'U'); + $viewName = $name; + $alt = $name; + $url = $url; + $image = $name . '.' . $type; + $name = 'COM_###COMPONENT###_DASHBOARD_' . Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name,'U'); } } // internal views @@ -76,11 +76,11 @@ public function getIcons() switch($action) { case 'add': - $url = 'index.php?option=com_###component###&view=' . $name . '&layout=edit'; - $image = $name . '_' . $action. '.' . $type; - $alt = $name . ' ' . $action; - $name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U').'_ADD'; - $add = true; + $url = 'index.php?option=com_###component###&view=' . $name . '&layout=edit'; + $image = $name . '_' . $action. '.' . $type; + $alt = $name . ' ' . $action; + $name = 'COM_###COMPONENT###_DASHBOARD_'.Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name,'U').'_ADD'; + $add = true; break; default: // check for new convention (more stable) @@ -93,34 +93,34 @@ public function getIcons() { $extension = 'com_###component###.' . $name; } - $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; - $image = $name . '_' . $action . '.' . $type; - $alt = $viewName . ' ' . $action; - $name = 'COM_###COMPONENT###_DASHBOARD_' . ###Component###Helper::safeString($name,'U') . '_' . ###Component###Helper::safeString($action,'U'); + $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; + $image = $name . '_' . $action . '.' . $type; + $alt = $viewName . ' ' . $action; + $name = 'COM_###COMPONENT###_DASHBOARD_' . Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name,'U') . '_' . Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($action,'U'); break; } } else { - $viewName = $name; - $alt = $name; - $url = 'index.php?option=com_###component###&view=' . $name; - $image = $name . '.' . $type; - $name = 'COM_###COMPONENT###_DASHBOARD_' . ###Component###Helper::safeString($name,'U'); - $hover = false; + $viewName = $name; + $alt = $name; + $url = 'index.php?option=com_###component###&view=' . $name; + $image = $name . '.' . $type; + $name = 'COM_###COMPONENT###_DASHBOARD_' . Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name,'U'); + $hover = false; } } else { - $viewName = $view; - $alt = $view; - $url = 'index.php?option=com_###component###&view=' . $view; - $image = $view . '.png'; - $name = ucwords($view).'

'; - $hover = false; + $viewName = $view; + $alt = $view; + $url = 'index.php?option=com_###component###&view=' . $view; + $image = $view . '.png'; + $name = ucwords($view).'

'; + $hover = false; } // first make sure the view access is set - if (###Component###Helper::checkArray($viewAccess)) + if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($viewAccess)) { // setup some defaults $dashboard_add = false; @@ -128,11 +128,11 @@ public function getIcons() $accessTo = ''; $accessAdd = ''; // access checking start - $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? ###Component###Helper::checkString($viewAccess[$viewName.'.create']):false; - $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? ###Component###Helper::checkString($viewAccess[$viewName.'.access']):false; + $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($viewAccess[$viewName.'.create']):false; + $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($viewAccess[$viewName.'.access']):false; // set main controllers - $accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? ###Component###Helper::checkString($viewAccess[$viewName.'.dashboard_add']):false; - $accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? ###Component###Helper::checkString($viewAccess[$viewName.'.dashboard_list']):false; + $accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($viewAccess[$viewName.'.dashboard_add']):false; + $accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($viewAccess[$viewName.'.dashboard_list']):false; // check for adding access if ($add && $accessCreate) { @@ -150,64 +150,64 @@ public function getIcons() // set main access controllers if ($accessDashboard_add) { - $dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_###component###'); + $dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_###component###'); } if ($accessDashboard_list) { $dashboard_list = $user->authorise($viewAccess[$viewName.'.dashboard_list'], 'com_###component###'); } - if (###Component###Helper::checkString($accessAdd) && ###Component###Helper::checkString($accessTo)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessAdd) && Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessTo)) { // check access if($user->authorise($accessAdd, 'com_###component###') && $user->authorise($accessTo, 'com_###component###') && $dashboard_add) { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } - elseif (###Component###Helper::checkString($accessTo)) + elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessTo)) { // check access if($user->authorise($accessTo, 'com_###component###') && $dashboard_list) { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } - elseif (###Component###Helper::checkString($accessAdd)) + elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessAdd)) { // check access if($user->authorise($accessAdd, 'com_###component###') && $dashboard_add) { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } else { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } else { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } $i++; } diff --git a/admin/compiler/joomla_3/ListModel_custom_admin.php b/admin/compiler/joomla_3/ListModel_custom_admin.php index d49fcec4a..fd561d58e 100644 --- a/admin/compiler/joomla_3/ListModel_custom_admin.php +++ b/admin/compiler/joomla_3/ListModel_custom_admin.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -46,15 +46,15 @@ class ###Component###Model###SViews### extends ListModel protected function getListQuery() { // Get the current user for authorisation checks - $this->user = JFactory::getUser(); + $this->user = Factory::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->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; - $this->initSet = true; ###CUSTOM_ADMIN_GET_LIST_QUERY### + $this->initSet = true;###CUSTOM_ADMIN_GET_LIST_QUERY### } /** @@ -64,12 +64,12 @@ protected function getListQuery() */ public function getItems() { - $user = JFactory::getUser(); + $user = Factory::getUser(); // check if this user has permission to access items if (!$user->authorise('###sviews###.access', 'com_###component###')) { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('Not authorised!'), 'error'); + $app = Factory::getApplication(); + $app->enqueueMessage(Text::_('Not authorised!'), 'error'); // redirect away if not a correct (TODO for now we go to default view) $app->redirect('index.php?option=com_###component###'); return false; @@ -78,7 +78,7 @@ public function getItems() $items = parent::getItems(); // Get the global params - $globalParams = JComponentHelper::getParams('com_###component###', true);###CUSTOM_ADMIN_GET_ITEMS######CUSTOM_ADMIN_AFTER_GET_ITEMS### + $globalParams = ComponentHelper::getParams('com_###component###', true);###CUSTOM_ADMIN_GET_ITEMS######CUSTOM_ADMIN_AFTER_GET_ITEMS### // return items return $items; diff --git a/admin/compiler/joomla_3/ListModel_site.php b/admin/compiler/joomla_3/ListModel_site.php index 441031541..4ccc2f36b 100644 --- a/admin/compiler/joomla_3/ListModel_site.php +++ b/admin/compiler/joomla_3/ListModel_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -46,13 +46,13 @@ class ###Component###Model###SViews### extends ListModel protected function getListQuery() { // Get the current user for authorisation checks - $this->user = JFactory::getUser(); + $this->user = Factory::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->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; $this->initSet = true; ###SITE_GET_LIST_QUERY### } @@ -64,12 +64,12 @@ protected function getListQuery() */ public function getItems() { - $user = JFactory::getUser();###USER_PERMISSION_CHECK_ACCESS######LICENSE_LOCKED_CHECK######SITE_BEFORE_GET_ITEMS### + $user = Factory::getUser();###USER_PERMISSION_CHECK_ACCESS######LICENSE_LOCKED_CHECK######SITE_BEFORE_GET_ITEMS### // load parent items $items = parent::getItems(); // Get the global params - $globalParams = JComponentHelper::getParams('com_###component###', true);###SITE_GET_ITEMS######SITE_AFTER_GET_ITEMS### + $globalParams = ComponentHelper::getParams('com_###component###', true);###SITE_GET_ITEMS######SITE_AFTER_GET_ITEMS### // return items return $items; diff --git a/admin/compiler/joomla_3/Table.php b/admin/compiler/joomla_3/Table.php index fd286af4b..cacbbf67c 100644 --- a/admin/compiler/joomla_3/Table.php +++ b/admin/compiler/joomla_3/Table.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,10 +17,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * ###Views### Table class @@ -34,60 +41,60 @@ class ###Component###Table###View### extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__###component###_###view###', 'id', $db);###JTABLECONSTRUCTOR######LICENSE_LOCKED_CHECK### - } - + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the ###View### table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -102,33 +109,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('###view###', '###Component###Table'); + $table = Table::getInstance('###view###', '###Component###Table'); if ($table->load(array('alias' => $this->alias###JTABLEALIASCATEGORY###)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_###COMPONENT###_###VIEW###_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_###COMPONENT###_###VIEW###_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_###COMPONENT###_###VIEW###_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -140,20 +152,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('###view###', '###component###Table'); + + $table = Table::getInstance('###view###', '###component###Table'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -164,7 +176,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -187,13 +199,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_###component###.###view###.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -209,12 +221,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -225,14 +237,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -249,7 +261,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -257,8 +269,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -267,7 +279,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -275,8 +287,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -287,8 +299,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -302,12 +314,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_###component###'); return $asset->id; diff --git a/admin/compiler/joomla_3/ajax.json.php b/admin/compiler/joomla_3/ajax.json.php index 6883172ef..54ca2b52a 100644 --- a/admin/compiler/joomla_3/ajax.json.php +++ b/admin/compiler/joomla_3/ajax.json.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,6 +17,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Session\Session; + /** * ###Component### Ajax Controller */ @@ -26,19 +29,19 @@ public function __construct($config) { parent::__construct($config); // make sure all json stuff are set - JFactory::getDocument()->setMimeEncoding( 'application/json' ); - JFactory::getApplication()->setHeader('Content-Disposition','attachment;filename="getajax.json"'); - JFactory::getApplication()->setHeader("Access-Control-Allow-Origin", "*"); + Factory::getDocument()->setMimeEncoding( 'application/json' ); + Factory::getApplication()->setHeader('Content-Disposition','attachment;filename="getajax.json"'); + Factory::getApplication()->setHeader("Access-Control-Allow-Origin", "*"); // load the tasks $this->registerTask('fieldRequired', 'ajax'); } public function ajax() { - $user = JFactory::getUser(); - $jinput = JFactory::getApplication()->input; + $user = Factory::getUser(); + $jinput = Factory::getApplication()->input; // Check Token! - $token = JSession::getFormToken(); + $token = Session::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); if($user->id != 0 && $token == $call_token) { @@ -50,8 +53,8 @@ public function ajax() $name = $jinput->get('name', NULL, 'WORD'); $form = $jinput->get('form', NULL, 'WORD'); $status = $jinput->get('status', NULL, 'INT'); - - if (###Component###Helper::checkString($name) && ###Component###Helper::checkString($form)) + + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($name) && Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($form)) { $result = $this->getModel('ajax')->setFieldRequired($name,$form,$status); } diff --git a/admin/compiler/joomla_3/ajax.php b/admin/compiler/joomla_3/ajax.php index 198a571f4..9500de486 100644 --- a/admin/compiler/joomla_3/ajax.php +++ b/admin/compiler/joomla_3/ajax.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,27 +17,32 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Component\ComponentHelper; + /** * ###Component### Ajax Model */ -class ###Component###ModelAjax extends JModelList +class ###Component###ModelAjax extends ListModel { protected $app_params; public function __construct() - { - parent::__construct(); + { + parent::__construct(); // get params - $this->app_params = JComponentHelper::getParams('com_###component###'); + $this->app_params = ComponentHelper::getParams('com_###component###'); } public function setFieldRequired($name,$form,$status) { // get the session - $session = JFactory::getSession(); + $session = Factory::getSession(); // get this forms set fields $fields = $session->get($form.'_requiredFieldFix'); - if(###Component###Helper::checkArray($fields)) + if(Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($fields)) { if ($status == 1) { @@ -45,7 +50,7 @@ public function setFieldRequired($name,$form,$status) $fields = array_unique($fields); } else - { + { // remove from array if(($key = array_search($name, $fields)) !== false) { @@ -61,7 +66,7 @@ public function setFieldRequired($name,$form,$status) } } // load the remaining values to session - if(###Component###Helper::checkArray($fields)) + if(Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($fields)) { $session->set($form.'_requiredFieldFix', $fields); } diff --git a/admin/compiler/joomla_3/autoloader.php b/admin/compiler/joomla_3/autoloader.php new file mode 100644 index 000000000..f28ef98fb --- /dev/null +++ b/admin/compiler/joomla_3/autoloader.php @@ -0,0 +1,18 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); +?> +###BOM### + +// No direct access to this file +defined('_JEXEC') or die;###ADMIN_POWER_HELPER### diff --git a/admin/compiler/joomla_3/autoloader_site.php b/admin/compiler/joomla_3/autoloader_site.php new file mode 100644 index 000000000..d182b4669 --- /dev/null +++ b/admin/compiler/joomla_3/autoloader_site.php @@ -0,0 +1,18 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); +?> +###BOM### + +// No direct access to this file +defined('_JEXEC') or die;###SITE_POWER_HELPER### diff --git a/admin/compiler/joomla_3/batch_.php b/admin/compiler/joomla_3/batch_.php index 0d8a36c64..ef1abac7f 100644 --- a/admin/compiler/joomla_3/batch_.php +++ b/admin/compiler/joomla_3/batch_.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -30,7 +30,7 @@ abstract class JHtmlBatch_ * @var array * @since 3.0 */ - protected static $ListSelection = array(); + protected static $ListSelection = []; /** * Render the batch selection options. diff --git a/admin/compiler/joomla_3/batchselection.php b/admin/compiler/joomla_3/batchselection.php index 455979edf..d8199d7bb 100644 --- a/admin/compiler/joomla_3/batchselection.php +++ b/admin/compiler/joomla_3/batchselection.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,6 +17,7 @@ // No direct access to this file defined('JPATH_BASE') or die; +use Joomla\CMS\Language\Text; JHtmlBehavior::core(); $divWrapper = range(1,120,2); $counter = 0; @@ -24,8 +25,8 @@ ListSelection) : ?>

ListSelection as $ListSelection) : ?> -
-
+
+
-
+
- +
- - -
+ + +
\ No newline at end of file diff --git a/admin/compiler/joomla_3/component_admin.php b/admin/compiler/joomla_3/component_admin.php index 622b1bde0..f4f64bed3 100644 --- a/admin/compiler/joomla_3/component_admin.php +++ b/admin/compiler/joomla_3/component_admin.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,28 +17,34 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +// The power autoloader for this project admin area. +$power_autoloader = JPATH_ADMINISTRATOR . '/components/com_###component###/helpers/powerloader.php'; +if (file_exists($power_autoloader)) +{ + require_once $power_autoloader; +} + ###ADMIN_COMPONENT_HEADER### // Access check. -if (!JFactory::getUser()->authorise('core.manage', 'com_###component###')) +if (!Factory::getUser()->authorise('core.manage', 'com_###component###')) { - throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); -}; + throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403); +} // Add CSS file for all pages -$document = JFactory::getDocument(); -$document->addStyleSheet('components/com_###component###/assets/css/admin.css'); -$document->addScript('components/com_###component###/assets/js/admin.js'); +Html::_('stylesheet', 'components/com_###component###/assets/css/admin.css', ['version' => 'auto']); +Html::_('script', 'components/com_###component###/assets/js/admin.js', ['version' => 'auto']); // require helper files JLoader::register('###Component###Helper', __DIR__ . '/helpers/###component###.php');###HELPER_EMAIL### JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php');###LICENSE_LOCKED_INT######ADMIN_GLOBAL_EVENT### // Get an instance of the controller prefixed by ###Component### -$controller = JControllerLegacy::getInstance('###Component###'); +$controller = BaseController::getInstance('###Component###'); // Perform the Request task -$controller->execute(JFactory::getApplication()->input->get('task')); +$controller->execute(Factory::getApplication()->input->get('task')); // Redirect if set by the controller $controller->redirect(); diff --git a/admin/compiler/joomla_3/component_site.php b/admin/compiler/joomla_3/component_site.php index 451f984fd..99dd26f53 100644 --- a/admin/compiler/joomla_3/component_site.php +++ b/admin/compiler/joomla_3/component_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,22 +17,28 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +// The power autoloader for this project site area. +$power_autoloader = JPATH_SITE . '/components/com_###component###/helpers/powerloader.php'; +if (file_exists($power_autoloader)) +{ + require_once $power_autoloader; +} + ###SITE_COMPONENT_HEADER### // Set the component css/js -$document = JFactory::getDocument(); -$document->addStyleSheet('components/com_###component###/assets/css/site.css'); -$document->addScript('components/com_###component###/assets/js/site.js'); +Html::_('stylesheet', 'components/com_###component###/assets/css/site.css', ['version' => 'auto']); +Html::_('script', 'components/com_###component###/assets/js/site.js', ['version' => 'auto']); // Require helper files JLoader::register('###Component###Helper', __DIR__ . '/helpers/###component###.php');###HELPER_EMAIL### JLoader::register('###Component###HelperRoute', __DIR__ . '/helpers/route.php');###LICENSE_LOCKED_INT######SITE_GLOBAL_EVENT### // Get an instance of the controller prefixed by ###Component### -$controller = JControllerLegacy::getInstance('###Component###'); +$controller = BaseController::getInstance('###Component###'); // Perform the request task -$controller->execute(JFactory::getApplication()->input->get('task')); +$controller->execute(Factory::getApplication()->input->get('task')); // Redirect if set by the controller $controller->redirect(); diff --git a/admin/compiler/joomla_3/dashboard.css b/admin/compiler/joomla_3/dashboard.css index 65aa4e8b2..6502707ff 100644 --- a/admin/compiler/joomla_3/dashboard.css +++ b/admin/compiler/joomla_3/dashboard.css @@ -3,153 +3,153 @@ /* CSS Document */ .dashboard-container { - margin-left: 10px; - margin-top: 10px; - width: 100%; + margin-left: 10px; + margin-top: 10px; + width: 100%; } .dashboard-container [class*="span"] { - display: block; - float: none; - margin-left: 0; - width: auto; + display: block; + float: none; + margin-left: 0; + width: auto; } .dashboard-container:before, .dashboard-container:after { - content: ""; - display: table; + content: ""; + display: table; } .dashboard-container:after { - clear: both; + clear: both; } .dashboard-container [class*="span"] { - box-sizing: border-box; - display: block; - float: left; - min-height: 145px; - min-width: 96px; - width: 100%; + box-sizing: border-box; + display: block; + float: left; + min-height: 145px; + min-width: 96px; + width: 100%; } .dashboard-container [class*="span"]:first-child { - margin-left: 0; + margin-left: 0; } .dashboard-wraper { - background: none repeat scroll 0 0 hsl(0, 0%, 93%); - border-radius: 5px; - float: left; - margin: 1%; - padding: 3px; - width: 17%; - min-height: 194px; - min-width: 96px; + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 5px; + float: left; + margin: 1%; + padding: 3px; + width: 17%; + min-height: 194px; + min-width: 96px; } .dashboard-content a { - background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 85%); - border-radius: 4px; - box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; - color: hsl(0, 0%, 20%); - display: block; - min-height: 89px; - padding: 10px; - text-align: center; - text-decoration: none; + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + min-height: 89px; + padding: 10px; + text-align: center; + text-decoration: none; } .dashboard-content a:hover { - background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - color: hsl(200, 100%, 30%); - text-decoration: none; + background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + color: hsl(200, 100%, 30%); + text-decoration: none; } .dashboard-title { - display: block; - padding-top: 5px; + display: block; + padding-top: 5px; } .dashboard-info { - background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 85%); - border-radius: 4px; - box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; - color: hsl(0, 0%, 20%); - display: block; - font-size: 12px; - padding: 10px; - text-align: center; + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + font-size: 12px; + padding: 10px; + text-align: center; } .dashboard-info span { - display: block; - text-align: center; + display: block; + text-align: center; } .dashboard-info img { - margin: 0 auto; + margin: 0 auto; } .dashboard-table { - border-top: 1px solid hsl(0, 0%, 87%); - margin-top: 5px; - width: 100%; + border-top: 1px solid hsl(0, 0%, 87%); + margin-top: 5px; + width: 100%; } .dashboard-info h5 { - font-size: 11px; - font-weight: bold; + font-size: 11px; + font-weight: bold; } .dashboard-block { - background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 76%); - border-radius: 3px; - box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; - margin-bottom: 20px; + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 76%); + border-radius: 3px; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; + margin-bottom: 20px; } .dashboard-block .dashboard-block-head { - background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border-bottom: 1px solid hsl(0, 0%, 76%); - border-radius: 3px 3px 0 0; - box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); - height: 40px; - position: relative; + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border-bottom: 1px solid hsl(0, 0%, 76%); + border-radius: 3px 3px 0 0; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); + height: 40px; + position: relative; } .dashboard-block .dashboard-block-head h5 { - font-size: 12px; - margin: 0; - padding-left: 10px; - padding-top: 11px; - text-transform: uppercase; + font-size: 12px; + margin: 0; + padding-left: 10px; + padding-top: 11px; + text-transform: uppercase; } .dashboard-block .dashboard-block-content { - background: none repeat scroll 0 0 hsl(0, 0%, 93%); - border-radius: 0 0 3px 3px; + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 0 0 3px 3px; } .dashboard-block .dashboard-block-box { - background: none repeat scroll 0 0 hsl(0, 0%, 100%); - border-top: 1px solid hsl(0, 0%, 82%); - box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; + background: none repeat scroll 0 0 hsl(0, 0%, 100%); + border-top: 1px solid hsl(0, 0%, 82%); + box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; } .dashboard-block .dashboard-block-content .dashboard-block-box { - margin-top: 0 !important; + margin-top: 0 !important; } .dashboard-block .dashboard-block-content .dashboard-block-box .dashboard-block-table { - margin-bottom: 0 !important; + margin-bottom: 0 !important; } .dashboard-block-table { - background-color: hsla(0, 0%, 0%, 0); - border-collapse: collapse; - border-spacing: 0; - margin-bottom: 20px; - max-width: 100%; - width: 100%; + background-color: hsla(0, 0%, 0%, 0); + border-collapse: collapse; + border-spacing: 0; + margin-bottom: 20px; + max-width: 100%; + width: 100%; } .dashboard-block-table th, .dashboard-block-table td { - border-top: 1px solid hsl(0, 0%, 87%); - line-height: 20px; - padding: 5px; - text-align: left; - vertical-align: middle; + border-top: 1px solid hsl(0, 0%, 87%); + line-height: 20px; + padding: 5px; + text-align: left; + vertical-align: middle; } .dashboard-badge { - background-color: hsl(0, 0%, 60%); - border-radius: 9px; - color: hsl(0, 0%, 100%); - font-size: 11.844px; - font-weight: bold; - line-height: 14px; - padding: 1px 9px 2px; - text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); - vertical-align: baseline; - white-space: nowrap; + background-color: hsl(0, 0%, 60%); + border-radius: 9px; + color: hsl(0, 0%, 100%); + font-size: 11.844px; + font-weight: bold; + line-height: 14px; + padding: 1px 9px 2px; + text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); + vertical-align: baseline; + white-space: nowrap; } \ No newline at end of file diff --git a/admin/compiler/joomla_3/default.php b/admin/compiler/joomla_3/default.php index 0166c0fb8..8eecd5d99 100644 --- a/admin/compiler/joomla_3/default.php +++ b/admin/compiler/joomla_3/default.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -18,10 +18,11 @@ defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### ###ADMIN_VIEWS_HEADER### + if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_###component###&task=###views###.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', '###view###List', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); + Html::_('sortablelist.sortable', '###view###List', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } ?> ###VIEWS_DEFAULT_BODY######VIEWS_FOOTER_SCRIPT### diff --git a/admin/compiler/joomla_3/default_batch_body.php b/admin/compiler/joomla_3/default_batch_body.php index a1fe1378e..ec4f6be38 100644 --- a/admin/compiler/joomla_3/default_batch_body.php +++ b/admin/compiler/joomla_3/default_batch_body.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,7 +17,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> -

+

batchDisplay; ?> \ No newline at end of file diff --git a/admin/compiler/joomla_3/default_batch_footer.php b/admin/compiler/joomla_3/default_batch_footer.php index 7964422a5..73d7824e9 100644 --- a/admin/compiler/joomla_3/default_batch_footer.php +++ b/admin/compiler/joomla_3/default_batch_footer.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,12 +17,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### +use Joomla\CMS\Language\Text; + ?> \ No newline at end of file diff --git a/admin/compiler/joomla_3/default_body.php b/admin/compiler/joomla_3/default_body.php index 5db8ffb81..d5c40e434 100644 --- a/admin/compiler/joomla_3/default_body.php +++ b/admin/compiler/joomla_3/default_body.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,6 +17,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + $edit = "index.php?option=com_###component###&view=###views###&task=###view###.edit"; ?> diff --git a/admin/compiler/joomla_3/default_custom_admin.php b/admin/compiler/joomla_3/default_custom_admin.php index 925f748c9..c68079a4d 100644 --- a/admin/compiler/joomla_3/default_custom_admin.php +++ b/admin/compiler/joomla_3/default_custom_admin.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -18,11 +18,11 @@ defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### ###CUSTOM_ADMIN_VIEW_HEADER######CUSTOM_ADMIN_CODE_BODY### + ?> canDo->get('###sview###.access')): ?>###CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT### item->id)) ? '&id='. (int) $this->item->id : ''; ?> ###CUSTOM_ADMIN_TOP_FORM######CUSTOM_ADMIN_BODY######CUSTOM_ADMIN_BOTTOM_FORM### -

+

- diff --git a/admin/compiler/joomla_3/default_custom_admin_template.php b/admin/compiler/joomla_3/default_custom_admin_template.php index 3b5ea3e22..de8533c69 100644 --- a/admin/compiler/joomla_3/default_custom_admin_template.php +++ b/admin/compiler/joomla_3/default_custom_admin_template.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -15,6 +15,10 @@ ###BOM### // No direct access to this file -defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_TEMPLATE_CODE_BODY### +defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### + +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html;###CUSTOM_ADMIN_TEMPLATE_CODE_BODY### ?>###CUSTOM_ADMIN_TEMPLATE_BODY### diff --git a/admin/compiler/joomla_3/default_foot.php b/admin/compiler/joomla_3/default_foot.php index 725eba045..93585b9b7 100644 --- a/admin/compiler/joomla_3/default_foot.php +++ b/admin/compiler/joomla_3/default_foot.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ diff --git a/admin/compiler/joomla_3/default_head.php b/admin/compiler/joomla_3/default_head.php index 894d421fe..72243e3e8 100644 --- a/admin/compiler/joomla_3/default_head.php +++ b/admin/compiler/joomla_3/default_head.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,5 +17,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> ###LISTHEAD### \ No newline at end of file diff --git a/admin/compiler/joomla_3/default_import.php b/admin/compiler/joomla_3/default_import.php index 1cab7a6c4..ba0519b09 100644 --- a/admin/compiler/joomla_3/default_import.php +++ b/admin/compiler/joomla_3/default_import.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,13 +17,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### -JHtml::_('jquery.framework'); -JHtml::_('bootstrap.tooltip'); -JHtml::_('script', 'system/core.js', false, true); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; +Html::_('jquery.framework'); +Html::_('bootstrap.tooltip'); +Html::_('script', 'system/core.js', false, true); +Html::_('behavior.keepalive'); + ?>
-
+ sidebar)) : ?>
@@ -137,13 +141,13 @@
- hasPackage && ###Component###Helper::checkArray($this->headerList) && ###Component###Helper::checkArray($this->headers)) : ?> + hasPackage && Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($this->headerList) && Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($this->headers)) : ?>
- +
- +
- +
headerList as $name => $title): ?> @@ -151,72 +155,72 @@
- +
- 'upload')); ?> - - + 'upload')); ?> + +
- +
- +
-     (.csv .xls .ods) +     (.csv .xls .ods)
- - - + + +
- +
- +
-     (.csv .xls .ods) +     (.csv .xls .ods)
- + - +
- +
- +
-     (.csv .xls .ods) +     (.csv .xls .ods)
- - + + - +
\ No newline at end of file diff --git a/admin/compiler/joomla_3/default_import_custom.php b/admin/compiler/joomla_3/default_import_custom.php index 6329fd18b..04bc64bdc 100644 --- a/admin/compiler/joomla_3/default_import_custom.php +++ b/admin/compiler/joomla_3/default_import_custom.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,8 +17,13 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### -JHtml::_('jquery.framework'); -JHtml::_('bootstrap.tooltip'); -JHtml::_('script', 'system/core.js', false, true); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; +Html::_('jquery.framework'); +Html::_('bootstrap.tooltip'); +Html::_('script', 'system/core.js', false, true); +Html::_('behavior.keepalive'); + ?>###IMPORT_DEFAULT_VIEW_CUSTOM### diff --git a/admin/compiler/joomla_3/default_list_custom_admin.php b/admin/compiler/joomla_3/default_list_custom_admin.php index 3f6dd6fb1..a3d41a83f 100644 --- a/admin/compiler/joomla_3/default_list_custom_admin.php +++ b/admin/compiler/joomla_3/default_list_custom_admin.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -22,5 +22,5 @@ canDo->get('###sview###.access')): ?>###CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT### ###CUSTOM_ADMIN_TOP_FORM######CUSTOM_ADMIN_BODY######CUSTOM_ADMIN_BOTTOM_FORM### -

+

diff --git a/admin/compiler/joomla_3/default_list_site.php b/admin/compiler/joomla_3/default_list_site.php index 936804bd2..62479ff87 100644 --- a/admin/compiler/joomla_3/default_list_site.php +++ b/admin/compiler/joomla_3/default_list_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ diff --git a/admin/compiler/joomla_3/default_main.php b/admin/compiler/joomla_3/default_main.php index 4bde280d1..5bec37199 100644 --- a/admin/compiler/joomla_3/default_main.php +++ b/admin/compiler/joomla_3/default_main.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,19 +17,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + ?> icons['main']) && is_array($this->icons['main'])) :?> icons['main'] as $icon): ?>
-
-

+

\ No newline at end of file diff --git a/admin/compiler/joomla_3/default_site.php b/admin/compiler/joomla_3/default_site.php index 61864331f..6ab8f1a3a 100644 --- a/admin/compiler/joomla_3/default_site.php +++ b/admin/compiler/joomla_3/default_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ diff --git a/admin/compiler/joomla_3/default_site_template.php b/admin/compiler/joomla_3/default_site_template.php index 55687f70a..337f5b7ca 100644 --- a/admin/compiler/joomla_3/default_site_template.php +++ b/admin/compiler/joomla_3/default_site_template.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -15,6 +15,10 @@ ###BOM### // No direct access to this file -defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######SITE_TEMPLATE_CODE_BODY### +defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### + +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper;###SITE_TEMPLATE_CODE_BODY### ?>###SITE_TEMPLATE_BODY### diff --git a/admin/compiler/joomla_3/default_toolbar.php b/admin/compiler/joomla_3/default_toolbar.php index c608f71e0..ba3d37eb1 100644 --- a/admin/compiler/joomla_3/default_toolbar.php +++ b/admin/compiler/joomla_3/default_toolbar.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,34 +17,37 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?>
- -
- - -
-
- - pagination->getLimitBox(); ?> -
-
- - -
-
- - -
-
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
\ No newline at end of file diff --git a/admin/compiler/joomla_3/default_vdm.php b/admin/compiler/joomla_3/default_vdm.php index ec4349bd6..4f12c9cab 100644 --- a/admin/compiler/joomla_3/default_vdm.php +++ b/admin/compiler/joomla_3/default_vdm.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,22 +17,24 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + ?> -<?php echo JText::_('COM_###COMPONENT###'); ?> +<?php echo Text::_('COM_###COMPONENT###'); ?>
-contributors)): ?> +contributors)): ?> contributors) > 1): ?> -

+

-

+

    contributors as $contributor): ?> diff --git a/admin/compiler/joomla_3/edit.php b/admin/compiler/joomla_3/edit.php index 86edbead4..fa2f7ff82 100644 --- a/admin/compiler/joomla_3/edit.php +++ b/admin/compiler/joomla_3/edit.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -18,10 +18,11 @@ defined('_JEXEC') or die('Restricted access'); ###ADMIN_VIEW_HEADER### + $componentParams = $this->params; // will be removed just use $this->params instead ?> ###EDITBODYFADEIN### -
    + ###EDITBODY###
###EDITBODYSCRIPT### diff --git a/admin/compiler/joomla_3/edit_site.php b/admin/compiler/joomla_3/edit_site.php index 7a6efb4f7..a398e73e7 100644 --- a/admin/compiler/joomla_3/edit_site.php +++ b/admin/compiler/joomla_3/edit_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -18,10 +18,11 @@ defined('_JEXEC') or die('Restricted access'); ###SITE_ADMIN_VIEW_HEADER### + ?>
toolbar->render(); ?> -
+ ###EDITBODY###
###EDITBODYSCRIPT### diff --git a/admin/compiler/joomla_3/getBible.txt b/admin/compiler/joomla_3/getBible.txt new file mode 100644 index 000000000..8e228213c --- /dev/null +++ b/admin/compiler/joomla_3/getBible.txt @@ -0,0 +1,10 @@ +/** + * @package getBible.net + * + * @created ###CREATIONDATE### + * @author ###AUTHOR### <###AUTHORWEBSITE###> + * @git Get Bible + * @github Get Bible + * @copyright ###COPYRIGHT### + * @license ###LICENSE### + */ \ No newline at end of file diff --git a/admin/compiler/joomla_3/headercheck.php b/admin/compiler/joomla_3/headercheck.php index 6dcee6c35..36d0e0d04 100644 --- a/admin/compiler/joomla_3/headercheck.php +++ b/admin/compiler/joomla_3/headercheck.php @@ -1,24 +1,24 @@ - @my wife Roline van der Merwe - @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 - + @package Component Builder + @subpackage componentbuilder.php + @author Llewellyn van der Merwe + @my wife Roline van der Merwe + @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 @@ -29,24 +29,36 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; + class ###component###HeaderCheck { + protected $document = null; + protected $app = null; + function js_loaded($script_name) { // UIkit check point if (strpos($script_name,'uikit') !== false) { - $app = JFactory::getApplication(); - $getTemplateName = $app->getTemplate('template')->template; - + if (!$this->app) + { + $this->app = Factory::getApplication(); + } + + $getTemplateName = $this->app->getTemplate('template')->template; if (strpos($getTemplateName,'yoo') !== false) { return true; } } - - $document = JFactory::getDocument(); - $head_data = $document->getHeadData(); + + if (!$this->document) + { + $this->document = Factory::getDocument(); + } + + $head_data = $this->document->getHeadData(); foreach (array_keys($head_data['scripts']) as $script) { if (stristr($script, $script_name)) @@ -57,24 +69,30 @@ function js_loaded($script_name) return false; } - + function css_loaded($script_name) { // UIkit check point if (strpos($script_name,'uikit') !== false) { - $app = JFactory::getApplication(); - $getTemplateName = $app->getTemplate('template')->template; - + if (!$this->app) + { + $this->app = Factory::getApplication(); + } + + $getTemplateName = $this->app->getTemplate('template')->template; if (strpos($getTemplateName,'yoo') !== false) { return true; } } - - $document = JFactory::getDocument(); - $head_data = $document->getHeadData(); - + + if (!$this->document) + { + $this->document = Factory::getDocument(); + } + + $head_data = $this->document->getHeadData(); foreach (array_keys($head_data['styleSheets']) as $script) { if (stristr($script, $script_name)) diff --git a/admin/compiler/joomla_3/headercheck_admin.php b/admin/compiler/joomla_3/headercheck_admin.php index 402101246..7955eb0e0 100644 --- a/admin/compiler/joomla_3/headercheck_admin.php +++ b/admin/compiler/joomla_3/headercheck_admin.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,24 +17,36 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; + class ###component###HeaderCheck { + protected $document = null; + protected $app = null; + function js_loaded($script_name) { // UIkit check point if (strpos($script_name,'uikit') !== false) { - $app = JFactory::getApplication(); - $getTemplateName = $app->getTemplate('template')->template; - + if (!$this->app) + { + $this->app = Factory::getApplication(); + } + + $getTemplateName = $this->app->getTemplate('template')->template; if (strpos($getTemplateName,'yoo') !== false) { return true; } } - - $document = JFactory::getDocument(); - $head_data = $document->getHeadData(); + + if (!$this->document) + { + $this->document = Factory::getDocument(); + } + + $head_data = $this->document->getHeadData(); foreach (array_keys($head_data['scripts']) as $script) { if (stristr($script, $script_name)) @@ -45,24 +57,30 @@ function js_loaded($script_name) return false; } - + function css_loaded($script_name) { // UIkit check point if (strpos($script_name,'uikit') !== false) { - $app = JFactory::getApplication(); - $getTemplateName = $app->getTemplate('template')->template; - + if (!$this->app) + { + $this->app = Factory::getApplication(); + } + + $getTemplateName = $this->app->getTemplate('template')->template; if (strpos($getTemplateName,'yoo') !== false) { return true; } } - - $document = JFactory::getDocument(); - $head_data = $document->getHeadData(); - + + if (!$this->document) + { + $this->document = Factory::getDocument(); + } + + $head_data = $this->document->getHeadData(); foreach (array_keys($head_data['styleSheets']) as $script) { if (stristr($script, $script_name)) @@ -73,4 +91,4 @@ function css_loaded($script_name) return false; } -} \ No newline at end of file +} diff --git a/admin/compiler/joomla_3/import.gif b/admin/compiler/joomla_3/import.gif index 4371cc618..10bcb8569 100644 Binary files a/admin/compiler/joomla_3/import.gif and b/admin/compiler/joomla_3/import.gif differ diff --git a/admin/compiler/joomla_3/layout.php b/admin/compiler/joomla_3/layout.php index 2a1d95ed8..d7af88c11 100644 --- a/admin/compiler/joomla_3/layout.php +++ b/admin/compiler/joomla_3/layout.php @@ -1,24 +1,24 @@ - @my wife Roline van der Merwe - @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 - + @package Component Builder + @subpackage componentbuilder.php + @author Llewellyn van der Merwe + @my wife Roline van der Merwe + @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 @@ -46,7 +46,7 @@ ###LAYOUTITEMS### ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/compiler/joomla_3/layout_admin.php b/admin/compiler/joomla_3/layout_admin.php index c9c13b2cd..5188aec67 100644 --- a/admin/compiler/joomla_3/layout_admin.php +++ b/admin/compiler/joomla_3/layout_admin.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ diff --git a/admin/compiler/joomla_3/layout_custom_admin.php b/admin/compiler/joomla_3/layout_custom_admin.php index c26e133cc..12e0c32d7 100644 --- a/admin/compiler/joomla_3/layout_custom_admin.php +++ b/admin/compiler/joomla_3/layout_custom_admin.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ diff --git a/admin/compiler/joomla_3/layout_site.php b/admin/compiler/joomla_3/layout_site.php index 31edafa09..cd8bd0548 100644 --- a/admin/compiler/joomla_3/layout_site.php +++ b/admin/compiler/joomla_3/layout_site.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ diff --git a/admin/compiler/joomla_3/layoutfull.php b/admin/compiler/joomla_3/layoutfull.php index e6b6cc02a..bdc3cda15 100644 --- a/admin/compiler/joomla_3/layoutfull.php +++ b/admin/compiler/joomla_3/layoutfull.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -34,7 +34,7 @@ ###LAYOUTITEMS### ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/compiler/joomla_3/layoutitems.php b/admin/compiler/joomla_3/layoutitems.php index 1314a034e..b58e0dcf4 100644 --- a/admin/compiler/joomla_3/layoutitems.php +++ b/admin/compiler/joomla_3/layoutitems.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -34,7 +34,7 @@ ###LAYOUTITEMS### ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/compiler/joomla_3/layoutlinkedview.php b/admin/compiler/joomla_3/layoutlinkedview.php index 86c99b879..5ab1010a0 100644 --- a/admin/compiler/joomla_3/layoutlinkedview.php +++ b/admin/compiler/joomla_3/layoutlinkedview.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,9 +17,13 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // set the defaults $items = $displayData->###LAYOUTITEMS###; -$user = JFactory::getUser(); +$user = Factory::getUser(); $id = $displayData->item->id; ###LAYOUTITEMSHEADER### diff --git a/admin/compiler/joomla_3/layoutmetadata.php b/admin/compiler/joomla_3/layoutmetadata.php index d19a24cb1..3c465bddb 100644 --- a/admin/compiler/joomla_3/layoutmetadata.php +++ b/admin/compiler/joomla_3/layoutmetadata.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,6 +17,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + $form = $displayData->getForm(); // JLayout for standard handling of metadata fields in the administrator content edit screens. @@ -25,7 +27,7 @@ $fieldSet) : ?> description) && trim($fieldSet->description)) : ?> -

escape(JText::_($fieldSet->description)); ?>

+

escape(Text::_($fieldSet->description)); ?>

- * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ diff --git a/admin/compiler/joomla_3/layoutpublished.php b/admin/compiler/joomla_3/layoutpublished.php index 1314a034e..b58e0dcf4 100644 --- a/admin/compiler/joomla_3/layoutpublished.php +++ b/admin/compiler/joomla_3/layoutpublished.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -34,7 +34,7 @@ ###LAYOUTITEMS### ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/compiler/joomla_3/layouttitle.php b/admin/compiler/joomla_3/layouttitle.php index 95149e8c8..2afa93ac1 100644 --- a/admin/compiler/joomla_3/layouttitle.php +++ b/admin/compiler/joomla_3/layouttitle.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -34,7 +34,7 @@ ###LAYOUTITEMS### ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/compiler/joomla_3/module_forms.js b/admin/compiler/joomla_3/module_forms.js index ec598c680..4bf5019bf 100644 --- a/admin/compiler/joomla_3/module_forms.js +++ b/admin/compiler/joomla_3/module_forms.js @@ -1,3 +1,3 @@ ###BOM### -###VIEW_SCRIPT### +###VIEW_SCRIPT### diff --git a/admin/compiler/joomla_3/module_forms.xml b/admin/compiler/joomla_3/module_forms.xml index a31e5d4ac..8028c6880 100644 --- a/admin/compiler/joomla_3/module_forms.xml +++ b/admin/compiler/joomla_3/module_forms.xml @@ -4,6 +4,6 @@ addfieldpath="/administrator/components/com_###component###/models/fields" > ###FIELDSETS### - + ###ACCESSCONTROL### \ No newline at end of file diff --git a/admin/compiler/joomla_3/routeHelper.php b/admin/compiler/joomla_3/routeHelper.php index d28c1c0ec..afa52631f 100644 --- a/admin/compiler/joomla_3/routeHelper.php +++ b/admin/compiler/joomla_3/routeHelper.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,6 +17,13 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Language\Multilanguage; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Categories\CategoryNode; +use Joomla\CMS\Categories\Categories; + /** * ###Component### Route Helper **/ @@ -27,7 +34,7 @@ abstract class ###Component###HelperRoute /** * Get the URL route for ###component### category from a category ID and language * - * @param mixed $catid The id of the items's category either an integer id or a instance of JCategoryNode + * @param mixed $catid The id of the items's category either an integer id or a instance of CategoryNode * @param mixed $language The id of the language being used. * * @return string The link to the contact @@ -36,20 +43,20 @@ abstract class ###Component###HelperRoute */ public static function getCategoryRoute_keep_for_later($catid, $language = 0) { - if ($catid instanceof JCategoryNode) + if ($catid instanceof CategoryNode) { - $id = $catid->id; - $category = $catid; + $id = $catid->id; + $category = $catid; } else - { - throw new Exception('First parameter must be JCategoryNode'); + { + throw new Exception('First parameter must be CategoryNode'); } - + $views = array(###ROUTER_CATEGORY_VIEWS###); $view = $views[$category->extension]; - - if ($id < 1 || !($category instanceof JCategoryNode)) + + if ($id < 1 || !($category instanceof CategoryNode)) { $link = ''; } @@ -57,20 +64,20 @@ public static function getCategoryRoute_keep_for_later($catid, $language = 0) { //Create the link $link = 'index.php?option=com_###component###&view='.$view.'&category='.$category->slug; - + $needles = array( $view => array($id), 'category' => array($id) ); - - if ($language && $language != "*" && JLanguageMultilang::isEnabled()) + + if ($language && $language != "*" && Multilanguage::isEnabled()) { - $db = JFactory::getDbo(); - $query = $db->getQuery(true) + $db = Factory::getDbo(); + $query = $db->getQuery(true) ->select('a.sef AS sef') ->select('a.lang_code AS lang_code') ->from('#__languages AS a'); - + $db->setQuery($query); $langs = $db->loadObjectList(); foreach ($langs as $lang) @@ -82,11 +89,11 @@ public static function getCategoryRoute_keep_for_later($catid, $language = 0) } } } - + if ($item = self::_findItem($needles,'category')) { - $link .= '&Itemid='.$item; + $link .= '&Itemid='.$item; } else { @@ -112,16 +119,16 @@ public static function getCategoryRoute_keep_for_later($catid, $language = 0) protected static function _findItem($needles = null,$type = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $menus = $app->getMenu('site'); $language = isset($needles['language']) ? $needles['language'] : '*'; // Prepare the reverse lookup array. if (!isset(self::$lookup[$language])) { - self::$lookup[$language] = array(); + self::$lookup[$language] = []; - $component = JComponentHelper::getComponent('com_###component###'); + $component = ComponentHelper::getComponent('com_###component###'); $attributes = array('component_id'); $values = array($component->id); @@ -142,7 +149,7 @@ protected static function _findItem($needles = null,$type = null) if (!isset(self::$lookup[$language][$view])) { - self::$lookup[$language][$view] = array(); + self::$lookup[$language][$view] = []; } if (isset($item->query['id'])) @@ -171,7 +178,7 @@ protected static function _findItem($needles = null,$type = null) { if (isset(self::$lookup[$language][$view])) { - if (###Component###Helper::checkArray($ids)) + if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($ids)) { foreach ($ids as $id) { @@ -192,7 +199,7 @@ protected static function _findItem($needles = null,$type = null) if ($type) { // Check if the global menu item has been set. - $params = JComponentHelper::getParams('com_###component###'); + $params = ComponentHelper::getParams('com_###component###'); if ($item = $params->get($type.'_menu', 0)) { return $item; @@ -204,7 +211,7 @@ protected static function _findItem($needles = null,$type = null) if ($active && $active->component == 'com_###component###' - && ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled())) + && ($language == '*' || in_array($active->language, array('*', $language)) || !Multilanguage::isEnabled())) { return $active->id; } diff --git a/admin/compiler/joomla_3/router.php b/admin/compiler/joomla_3/router.php index 6bd91af36..834ab4e37 100644 --- a/admin/compiler/joomla_3/router.php +++ b/admin/compiler/joomla_3/router.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -17,13 +17,16 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Component\ComponentHelper; + /** * Routing class from com_###component### * * @since 3.3 */ class ###Component###Router extends JComponentRouterBase -{ +{ /** * Build the route for the com_###component### component * @@ -35,11 +38,11 @@ class ###Component###Router extends JComponentRouterBase */ public function build(&$query) { - $segments = array(); + $segments = []; // Get a menu item based on Itemid or currently active - $params = JComponentHelper::getParams('com_###component###'); - + $params = ComponentHelper::getParams('com_###component###'); + if (empty($query['Itemid'])) { $menuItem = $this->menu->getActive(); @@ -63,7 +66,7 @@ public function build(&$query) unset($query['view']); } - + // Are we dealing with a item that is attached to a menu item? if (isset($view) && ($mView == $view) and (isset($query['id'])) and ($mId == (int) $query['id'])) { @@ -93,7 +96,7 @@ public function build(&$query) } unset($query['id']); } - + $total = count($segments); for ($i = 0; $i < $total; $i++) @@ -101,8 +104,8 @@ public function build(&$query) $segments[$i] = str_replace(':', '-', $segments[$i]); } - return $segments; - + return $segments; + } /** @@ -115,17 +118,17 @@ public function build(&$query) * @since 3.3 */ public function parse(&$segments) - { + { $count = count($segments); - $vars = array(); - + $vars = []; + // Handle View and Identifier switch($segments[0]) {###ROUTER_PARSE_SWITCH### } return $vars; - } + } protected function getVar($table, $where = null, $whereString = null, $what = null, $category = false, $operator = '=', $main = '###component###') { @@ -134,7 +137,7 @@ protected function getVar($table, $where = null, $whereString = null, $what = nu return false; } // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -150,7 +153,7 @@ protected function getVar($table, $where = null, $whereString = null, $what = nu { // we must check if the table exist (TODO not ideal) $tables = $db->getTableList(); - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $prefix = $app->get('dbprefix'); $check = $prefix.$main.'_'.$table; if (in_array($check, $tables)) @@ -192,7 +195,7 @@ protected function getVar($table, $where = null, $whereString = null, $what = nu } return false; } - + protected function checkString($string) { if (isset($string) && is_string($string) && strlen($string) > 0) @@ -206,7 +209,7 @@ protected function checkString($string) function ###Component###BuildRoute(&$query) { $router = new ###Component###Router; - + return $router->build($query); } diff --git a/admin/compiler/joomla_3/router_4.php b/admin/compiler/joomla_3/router_4.php index 72b9168c2..c03d0f2f4 100644 --- a/admin/compiler/joomla_3/router_4.php +++ b/admin/compiler/joomla_3/router_4.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ diff --git a/admin/compiler/joomla_3/script.php b/admin/compiler/joomla_3/script.php index 7240aed62..910c5e563 100644 --- a/admin/compiler/joomla_3/script.php +++ b/admin/compiler/joomla_3/script.php @@ -17,20 +17,24 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; use Joomla\CMS\Installer\Adapter\ComponentAdapter; -JHTML::_('bootstrap.renderModal'); +use Joomla\CMS\Version; +use Joomla\CMS\HTML\HTMLHelper as Html; +HTML::_('bootstrap.renderModal'); /** * Script File of ###Component### Component */ -class com_###component###InstallerScript +class Com_###Component###InstallerScript { /** * Constructor * - * @param JAdapterInstance $parent The object responsible for running this script + * @param ComponentAdapter $parent The object responsible for running this script */ public function __construct(ComponentAdapter $parent) {} @@ -78,14 +82,14 @@ public function update(ComponentAdapter $parent){} public function preflight($type, ComponentAdapter $parent) { // get application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // is redundant or so it seems ...hmmm let me know if it works again if ($type === 'uninstall') { return true; } // the default for both install and update - $jversion = new JVersion(); + $jversion = new Version(); if (!$jversion->isCompatible('3.8.0')) { $app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error'); @@ -121,7 +125,7 @@ public function preflight($type, ComponentAdapter $parent) public function postflight($type, ComponentAdapter $parent) { // get application - $app = JFactory::getApplication();###MOVEFOLDERSSCRIPT### + $app = Factory::getApplication();###MOVEFOLDERSSCRIPT### // set the default component settings if ($type === 'install') {###POSTINSTALLSCRIPT### @@ -135,12 +139,12 @@ public function postflight($type, ComponentAdapter $parent) /** * Remove folders with files - * + * * @param string $dir The path to folder to remove * @param boolean $ignore The folders and files to ignore and not remove * * @return boolean True in all is removed - * + * */ protected function removeFolder($dir, $ignore = false) { @@ -209,7 +213,7 @@ protected function removeFolder($dir, $ignore = false) /** * Check if have an array with a length * - * @input array The array to check + * @input array The array to check * * @returns bool/int number of items in array on success */ @@ -232,5 +236,5 @@ protected function checkArray($array, $removeEmptyString = false) return $nr; } return false; - }###MOVEFOLDERSMETHOD### + }###INSTALLERMETHODS### } diff --git a/admin/compiler/joomla_3/settings.json b/admin/compiler/joomla_3/settings.json index a49ebc81f..ff301f6a6 100644 --- a/admin/compiler/joomla_3/settings.json +++ b/admin/compiler/joomla_3/settings.json @@ -164,6 +164,20 @@ "newName": "category.php", "type": "file" }, + "autoloader.php": { + "naam": "autoloader.php", + "path": "c0mp0n3nt/admin/helpers", + "rename": "new", + "newName": "powerloader.php", + "type": "file" + }, + "autoloader_site.php": { + "naam": "autoloader_site.php", + "path": "c0mp0n3nt/site/helpers", + "rename": "new", + "newName": "powerloader.php", + "type": "file" + }, "script.php": { "naam": "script.php", "path": "c0mp0n3nt/", @@ -207,6 +221,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", diff --git a/admin/compiler/joomla_3/settings_componentbuilder.json b/admin/compiler/joomla_3/settings_componentbuilder.json deleted file mode 100644 index d543db459..000000000 --- a/admin/compiler/joomla_3/settings_componentbuilder.json +++ /dev/null @@ -1,784 +0,0 @@ -{ - "create": { - "admin": { - "assets": { - "css": "css", - "images": { - "icons": "icons" - }, - "js": "js" - }, - "controllers": "controllers", - "helpers": { - "html": "html" - }, - "language": { - "en-GB": "en-GB" - }, - "layouts": "layouts", - "models": { - "fields": "fields", - "forms": "forms", - "rules": "rules" - }, - "sql": { - "updates": { - "mysql": "mysql" - } - }, - "tables": "tables", - "views": "views" - }, - "site": { - "assets": { - "css": "css", - "images": "images", - "js": "js" - }, - "controllers": "controllers", - "helpers": "helpers", - "language": { - "en-GB": "en-GB" - }, - "layouts": "layouts", - "models": "models", - "views": "views" - }, - "media": { - "css": "css", - "images": "images", - "js": "js" - } - }, - "move": { - "static": { - "access.xml": { - "naam": "access.xml", - "path": "c0mp0n3nt/admin", - "rename": false, - "type": "file" - }, - "config.xml": { - "naam": "config.xml", - "path": "c0mp0n3nt/admin", - "rename": false, - "type": "file" - }, - "BaseController.php": { - "naam": "BaseController.php", - "path": "c0mp0n3nt/admin", - "rename": "new", - "newName": "controller.php", - "type": "file" - }, - "component.xml": { - "naam": "component.xml", - "path": "c0mp0n3nt/", - "rename": "component", - "type": "file" - }, - "component_admin.php": { - "naam": "component_admin.php", - "path": "c0mp0n3nt/admin", - "rename": "component_admin", - "type": "file" - }, - "admin.css": { - "naam": "admin.css", - "path": "c0mp0n3nt/admin/assets/css", - "rename": false, - "type": "file" - }, - "admin.js": { - "naam": "admin.js", - "path": "c0mp0n3nt/admin/assets/js", - "rename": false, - "type": "file" - }, - "site.css": { - "naam": "site.css", - "path": "c0mp0n3nt/site/assets/css", - "rename": false, - "type": "file" - }, - "site.js": { - "naam": "site.js", - "path": "c0mp0n3nt/site/assets/js", - "rename": false, - "type": "file" - }, - "batch_.php": { - "naam": "batch_.php", - "path": "c0mp0n3nt/admin/helpers/html", - "rename": false, - "type": "file" - }, - "batchselection.php": { - "naam": "batchselection.php", - "path": "c0mp0n3nt/admin/layouts", - "rename": false, - "type": "file" - }, - "component_site.php": { - "naam": "component_site.php", - "path": "c0mp0n3nt/site", - "rename": "component_site", - "type": "file" - }, - "router.php": { - "naam": "router.php", - "path": "c0mp0n3nt/site", - "rename": false, - "type": "file" - }, - "routeHelper.php": { - "naam": "routeHelper.php", - "path": "c0mp0n3nt/site/helpers", - "rename": "new", - "newName": "route.php", - "type": "file" - }, - "BaseControllerSITE.php": { - "naam": "BaseControllerSITE.php", - "path": "c0mp0n3nt/site", - "rename": "new", - "newName": "controller.php", - "type": "file" - }, - "Helper.php": { - "naam": "JCB_Helper.php", - "path": "c0mp0n3nt/admin/helpers", - "rename": "JCB_Helper", - "type": "file" - }, - "Helper_site.php": { - "naam": "JCB_Helper_site.php", - "path": "c0mp0n3nt/site/helpers", - "rename": "JCB_Helper_site", - "type": "file" - }, - "Helper_category.php": { - "naam": "Helper_category.php", - "path": "c0mp0n3nt/site/helpers", - "rename": "new", - "newName": "category.php", - "type": "file" - }, - "script.php": { - "naam": "script.php", - "path": "c0mp0n3nt/", - "rename": false, - "type": "file" - }, - "install.mysql.utf8.sql": { - "naam": "install.mysql.utf8.sql", - "path": "c0mp0n3nt/admin/sql", - "rename": false, - "type": "file" - }, - "uninstall.mysql.utf8.sql": { - "naam": "uninstall.mysql.utf8.sql", - "path": "c0mp0n3nt/admin/sql", - "rename": false, - "type": "file" - }, - "headercheck_admin.php": { - "naam": "headercheck_admin.php", - "path": "c0mp0n3nt/admin/helpers", - "rename": "new", - "newName": "headercheck.php", - "type": "file" - }, - "LICENSE.txt": { - "naam": "LICENSE.txt", - "path": "c0mp0n3nt/", - "rename": false, - "type": "file" - }, - "README.txt": { - "naam": "README.txt", - "path": "c0mp0n3nt/admin", - "rename": false, - "type": "file" - }, - "README.md": { - "naam": "README.md", - "path": "c0mp0n3nt/", - "rename": false, - "type": "file" - }, - "headercheck.php": { - "naam": "headercheck.php", - "path": "c0mp0n3nt/site/helpers", - "rename": false, - "type": "file" - }, - "import.gif": { - "naam": "import.gif", - "path": "c0mp0n3nt/admin/assets/images", - "rename": false, - "type": "file" - } - }, - "dynamic": { - "admin": { - "whmcs.php": { - "path": "c0mp0n3nt/admin", - "rename": false, - "type": "whmcs" - }, - "Helper_email.php": { - "path": "c0mp0n3nt/admin/helpers", - "rename": "Helper_", - "type": "emailer" - }, - "AdminControllerDashboard.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "AdminControllerDashboard", - "type": "dashboard" - }, - "ListModelDASH.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "ListModelDASH", - "type": "dashboard" - }, - "DASHJViewLagacy.php": { - "path": "c0mp0n3nt/admin/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "dashboard" - }, - "default_vdm.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "dashboard" - }, - "default_main.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "dashboard" - }, - "DASHdefault.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": "new", - "newName": "default.php", - "type": "dashboard" - }, - "dashboard.css": { - "path": "c0mp0n3nt/admin/assets/css", - "rename": false, - "type": "dashboard" - }, - "filter_forms.xml": { - "path": "c0mp0n3nt/admin/models/forms", - "rename": "filter_forms", - "type": "filter" - }, - "module_forms.xml": { - "path": "c0mp0n3nt/admin/models/forms", - "rename": "module_forms", - "type": "single" - }, - "module_forms.js": { - "path": "c0mp0n3nt/media/js", - "rename": "module_forms", - "type": "single" - }, - "edit.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "single" - }, - "AdminModel.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "AdminModel", - "type": "single" - }, - "FormController.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "FormController", - "type": "single" - }, - "Table.php": { - "path": "c0mp0n3nt/admin/tables", - "rename": "Table", - "type": "single" - }, - "submitbutton.js": { - "path": "c0mp0n3nt/admin/views/VIEW", - "rename": false, - "type": "single" - }, - "HtmlView_edit.php": { - "path": "c0mp0n3nt/admin/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "single" - }, - "view.css": { - "path": "c0mp0n3nt/admin/assets/css", - "rename": "view", - "type": "single" - }, - "AdminController.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "AdminController", - "type": "list" - }, - "ListModel.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "ListModel", - "type": "list" - }, - "views.css": { - "path": "c0mp0n3nt/admin/assets/css", - "rename": "views", - "type": "list" - }, - "HtmlView_list.php": { - "path": "c0mp0n3nt/admin/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "list" - }, - "default.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "list" - }, - "default_batch_body.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "list" - }, - "default_batch_footer.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "list" - }, - "default_toolbar.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "list" - }, - "default_head.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "list" - }, - "default_body.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "list" - }, - "default_foot.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "list" - }, - "JFormRule.php": { - "path": "c0mp0n3nt/admin/models/rules", - "rename": "JFormRule", - "type": "rule" - }, - "layout_admin.php": { - "path": "c0mp0n3nt/admin/layouts", - "rename": "layout_admin", - "type": "layout" - }, - "layoutoverride.php": { - "path": "c0mp0n3nt/admin/layouts/VIEW", - "rename": "layoutoverride", - "type": "layoutoverride" - }, - "layoutitems.php": { - "path": "c0mp0n3nt/admin/layouts/VIEW", - "rename": "layoutitems", - "type": "layoutitems" - }, - "layoutfull.php": { - "path": "c0mp0n3nt/admin/layouts/VIEW", - "rename": "layoutfull", - "type": "layoutfull" - }, - "layoutlinkedview.php": { - "path": "c0mp0n3nt/admin/layouts/VIEW", - "rename": "layoutlinkedview", - "type": "layoutlinkedview" - }, - "layouttitle.php": { - "path": "c0mp0n3nt/admin/layouts/VIEW", - "rename": "layouttitle", - "type": "layouttitle" - }, - "layoutpublished.php": { - "path": "c0mp0n3nt/admin/layouts/VIEW", - "rename": "layoutpublished", - "type": "layoutpublished" - }, - "layoutmetadata.php": { - "path": "c0mp0n3nt/admin/layouts/VIEW", - "rename": "layoutmetadata", - "type": "layoutmetadata" - }, - "JFormFieldCustom.php": { - "path": "c0mp0n3nt/admin/models/fields", - "rename": "JFormFieldCustom", - "type": "fieldcustom" - }, - "JFormFieldList.php": { - "path": "c0mp0n3nt/admin/models/fields", - "rename": "JFormFieldList", - "type": "fieldlist" - }, - "JFormFieldRadio.php": { - "path": "c0mp0n3nt/admin/models/fields", - "rename": "JFormFieldRadio", - "type": "fieldradio" - }, - "JFormFieldCheckboxes.php": { - "path": "c0mp0n3nt/admin/models/fields", - "rename": "JFormFieldCheckboxes", - "type": "fieldcheckboxes" - }, - "JFormFieldUser.php": { - "path": "c0mp0n3nt/admin/models/fields", - "rename": "JFormFieldUser", - "type": "fielduser" - }, - "BaseControllerAjax.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "new", - "newName": "ajax.json.php", - "type": "ajax" - }, - "ListModelAjax.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "new", - "newName": "ajax.php", - "type": "ajax" - }, - "BaseController_import.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "new", - "newName": "import.php", - "type": "import" - }, - "BaseDatabaseModel_import.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "new", - "newName": "import.php", - "type": "import" - }, - "HtmlView_import.php": { - "path": "c0mp0n3nt/admin/views/import", - "rename": "new", - "newName": "view.html.php", - "type": "import" - }, - "default_import.php": { - "path": "c0mp0n3nt/admin/views/import/tmpl", - "rename": "new", - "newName": "default.php", - "type": "import" - }, - "BaseController_import_custom.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "BaseController_import_custom", - "type": "customimport" - }, - "BaseDatabaseModel_import_custom.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "BaseDatabaseModel_import_custom", - "type": "customimport" - }, - "HtmlView_import_custom.php": { - "path": "c0mp0n3nt/admin/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "customimport" - }, - "default_import_custom.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": "new", - "newName": "default.php", - "type": "customimport" - }, - "BaseControllerHelp.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "new", - "newName": "help.php", - "type": "help" - }, - "1.0.0.sql": { - "path": "c0mp0n3nt/admin/sql/updates/mysql", - "rename": "1.0.0", - "type": "sql_update" - }, - "update_server.xml": { - "path": "c0mp0n3nt/", - "rename": "update_server", - "type": "update_server" - }, - "viewFile.js": { - "path": "c0mp0n3nt/admin/assets/js", - "rename": "viewFile", - "type": "javascript_file" - } - }, - "site": { - "HtmlView_list_site.php": { - "path": "c0mp0n3nt/site/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "list" - }, - "ListModel_site.php": { - "path": "c0mp0n3nt/site/models", - "rename": "ListModel_site", - "type": "list" - }, - "views_site.css": { - "path": "c0mp0n3nt/site/assets/css", - "rename": "views_site", - "type": "list" - }, - "default_list_site.php": { - "path": "c0mp0n3nt/site/views/VIEW/tmpl", - "rename": "new", - "newName": "default.php", - "type": "list" - }, - "HtmlView_site.php": { - "path": "c0mp0n3nt/site/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "single" - }, - "view_site.css": { - "path": "c0mp0n3nt/site/assets/css", - "rename": "view_site", - "type": "single" - }, - "ItemModel_site.php": { - "path": "c0mp0n3nt/site/models", - "rename": "ItemModel_site", - "type": "single" - }, - "default_site.php": { - "path": "c0mp0n3nt/site/views/VIEW/tmpl", - "rename": "new", - "newName": "default.php", - "type": "single" - }, - "default_site_template.php": { - "path": "c0mp0n3nt/site/views/VIEW/tmpl", - "rename": "site_template", - "type": "template" - }, - "layout_site.php": { - "path": "c0mp0n3nt/site/layouts", - "rename": "layout_site", - "type": "layout" - }, - "layoutoverride.php": { - "path": "c0mp0n3nt/site/layouts/VIEW", - "rename": "layoutoverride", - "type": "layoutoverride" - }, - "layoutitems.php": { - "path": "c0mp0n3nt/site/layouts/VIEW", - "rename": "layoutitems", - "type": "layoutitems" - }, - "layoutfull.php": { - "path": "c0mp0n3nt/site/layouts/VIEW", - "rename": "layoutfull", - "type": "layoutfull" - }, - "layoutlinkedview.php": { - "path": "c0mp0n3nt/site/layouts/VIEW", - "rename": "layoutlinkedview", - "type": "layoutlinkedview" - }, - "layouttitle.php": { - "path": "c0mp0n3nt/site/layouts/VIEW", - "rename": "layouttitle", - "type": "layouttitle" - }, - "layoutpublished.php": { - "path": "c0mp0n3nt/site/layouts/VIEW", - "rename": "layoutpublished", - "type": "layoutpublished" - }, - "layoutmetadata.php": { - "path": "c0mp0n3nt/site/layouts/VIEW", - "rename": "layoutmetadata", - "type": "layoutmetadata" - }, - "default.xml": { - "path": "c0mp0n3nt/site/views/VIEW/tmpl", - "rename": false, - "type": "menu" - }, - "edit.xml": { - "path": "c0mp0n3nt/site/views/VIEW/tmpl", - "rename": false, - "type": "admin_menu" - }, - "module_forms.xml": { - "path": "c0mp0n3nt/site/models/forms", - "rename": "module_forms", - "type": "edit" - }, - "module_forms.js": { - "path": "c0mp0n3nt/site/models/forms", - "rename": "module_forms", - "type": "edit" - }, - "edit_site.php": { - "path": "c0mp0n3nt/site/views/VIEW/tmpl", - "rename": "new", - "newName": "edit.php", - "type": "edit" - }, - "AdminModel_site.php": { - "path": "c0mp0n3nt/site/models", - "rename": "AdminModel_site", - "type": "edit" - }, - "FormController_site.php": { - "path": "c0mp0n3nt/site/controllers", - "rename": "FormController_site", - "type": "edit" - }, - "submitbutton.js": { - "path": "c0mp0n3nt/site/views/VIEW", - "rename": false, - "type": "edit" - }, - "HtmlView_edit_site.php": { - "path": "c0mp0n3nt/site/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "edit" - }, - "view_site_edit.css": { - "path": "c0mp0n3nt/site/assets/css", - "rename": "view_site_edit", - "type": "edit" - }, - "BaseControllerAjaxSite.php": { - "path": "c0mp0n3nt/site/controllers", - "rename": "new", - "newName": "ajax.json.php", - "type": "ajax" - }, - "ListModelAjaxSite.php": { - "path": "c0mp0n3nt/site/models", - "rename": "new", - "newName": "ajax.php", - "type": "ajax" - }, - "BaseControllerHelp_site.php": { - "path": "c0mp0n3nt/site/controllers", - "rename": "new", - "newName": "help.php", - "type": "help" - }, - "FormController_custom_site.php": { - "path": "c0mp0n3nt/site/controllers", - "rename": "FormController_custom_site", - "type": "custom_form" - }, - "submitbutton_site.js": { - "path": "c0mp0n3nt/site/views/VIEW", - "rename": "new", - "newName": "submitbutton.js", - "type": "custom_form" - }, - "Helper_category_view.php": { - "path": "c0mp0n3nt/site/helpers", - "rename": "Helper_category_view", - "type": "category" - }, - "viewFileSite.js": { - "path": "c0mp0n3nt/site/assets/js", - "rename": "viewFileSite", - "type": "javascript_file" - } - }, - "custom_admin": { - "HtmlView_list_custom_admin.php": { - "path": "c0mp0n3nt/admin/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "list" - }, - "ListModel_custom_admin.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "ListModel_custom_admin", - "type": "list" - }, - "default_list_custom_admin.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": "new", - "newName": "default.php", - "type": "list" - }, - "AdminController_custom_admin.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "AdminController_custom_admin", - "type": "list" - }, - "views_custom_admin.css": { - "path": "c0mp0n3nt/admin/assets/css", - "rename": "views_custom_admin", - "type": "list" - }, - "view_custom_admin.css": { - "path": "c0mp0n3nt/admin/assets/css", - "rename": "view_custom_admin", - "type": "single" - }, - "HtmlView_custom_admin.php": { - "path": "c0mp0n3nt/admin/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "single" - }, - "ItemModel_custom_admin.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "ItemModel_custom_admin", - "type": "single" - }, - "default_custom_admin.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": "new", - "newName": "default.php", - "type": "single" - }, - "BaseController_custom_admin.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "BaseController_custom_admin", - "type": "single" - }, - "default_custom_admin_template.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": "custom_admin_template", - "type": "template" - }, - "layout_custom_admin.php": { - "path": "c0mp0n3nt/admin/layouts", - "rename": "layout_custom_admin", - "type": "layout" - }, - "viewFileCustomAdmin.js": { - "path": "c0mp0n3nt/admin/assets/js", - "rename": "viewFileCustomAdmin", - "type": "javascript_file" - } - } - } - } -} \ No newline at end of file diff --git a/admin/compiler/joomla_3/submitbutton.js b/admin/compiler/joomla_3/submitbutton.js index e459e897e..cd10493cd 100644 --- a/admin/compiler/joomla_3/submitbutton.js +++ b/admin/compiler/joomla_3/submitbutton.js @@ -4,7 +4,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/compiler/joomla_3/submitbutton_site.js b/admin/compiler/joomla_3/submitbutton_site.js index ed4feb712..40938b445 100644 --- a/admin/compiler/joomla_3/submitbutton_site.js +++ b/admin/compiler/joomla_3/submitbutton_site.js @@ -4,7 +4,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/compiler/joomla_3/whmcs.php b/admin/compiler/joomla_3/whmcs.php index 06e6cc3af..2bf15a8ff 100644 --- a/admin/compiler/joomla_3/whmcs.php +++ b/admin/compiler/joomla_3/whmcs.php @@ -3,8 +3,8 @@ * @package Joomla.Component.Builder * * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ diff --git a/admin/compiler/joomla_4/1.0.0.sql b/admin/compiler/joomla_4/1.0.0.sql new file mode 100644 index 000000000..2e5802f84 --- /dev/null +++ b/admin/compiler/joomla_4/1.0.0.sql @@ -0,0 +1 @@ +###UPDATE_VERSION_MYSQL### diff --git a/admin/compiler/joomla_4/ADMIN_AJAX_CONTROLLER.php b/admin/compiler/joomla_4/ADMIN_AJAX_CONTROLLER.php new file mode 100644 index 000000000..2f67bb7db --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_AJAX_CONTROLLER.php @@ -0,0 +1,102 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Controller; + +use Joomla\CMS\Factory; +use Joomla\CMS\Application\CMSApplication; +use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\MVC\Factory\MVCFactoryInterface; +use Joomla\CMS\Session\Session; +use Joomla\Input\Input; +use Joomla\Utilities\ArrayHelper; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### Ajax Base Controller + * + * @since 1.6 + */ +class AjaxController extends BaseController +{ + /** + * Constructor. + * + * @param array $config An optional associative array of configuration settings. + * Recognized key values include 'name', 'default_task', 'model_path', and + * 'view_path' (this list is not meant to be comprehensive). + * @param ?MVCFactoryInterface $factory The factory. + * @param ?CMSApplication $app The Application for the dispatcher + * @param ?Input $input Input + * + * @since 3.0 + */ + public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null) + { + parent::__construct($config, $factory, $app, $input); + + // make sure all json stuff are set + $this->app->getDocument()->setMimeEncoding( 'application/json' ); + $this->app->setHeader('Content-Disposition','attachment;filename="getajax.json"'); + $this->app->setHeader('Access-Control-Allow-Origin', '*'); + // load the tasks###REGISTER_AJAX_TASK### + } + + /** + * The ajax function + * + * @since 3.10 + */ + public function ajax() + { + // get the user for later use + $user = $this->app->getIdentity(); + // get the input values + $jinput = $this->input ?? $this->app->input; + // check if we should return raw (DEFAULT TRUE SINCE J4) + $returnRaw = $jinput->get('raw', true, 'BOOLEAN'); + // return to a callback function + $callback = $jinput->get('callback', null, 'CMD'); + // Check Token! + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); + if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) + { + // get the task + $task = $this->getTask(); + switch($task) + {###AJAX_INPUT_RETURN### + } + } + else + { + // return to a callback function + if($callback) + { + echo $callback."(".json_encode(['error' => 'There was an error! [129]']).");"; + } + elseif($returnRaw) + { + echo json_encode(['error' => 'There was an error! [129]']); + } + else + { + echo "(".json_encode(['error' => 'There was an error! [129]']).");"; + } + } + } +} diff --git a/admin/compiler/joomla_4/ADMIN_AJAX_MODEL.php b/admin/compiler/joomla_4/ADMIN_AJAX_MODEL.php new file mode 100644 index 000000000..c02dcc00a --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_AJAX_MODEL.php @@ -0,0 +1,62 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Model; + +###AJAX_ADMIN_MODEL_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### Ajax List Model + * + * @since 1.6 + */ +class AjaxModel extends ListModel +{ + /** + * The component params. + * + * @var Registry + * @since 3.2.0 + */ + protected Registry $app_params; + + /** + * The application object. + * + * @var CMSApplicationInterface The application instance. + * @since 3.2.0 + */ + protected CMSApplicationInterface $app; + + /** + * Constructor + * + * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). + * @param ?MVCFactoryInterface $factory The factory. + * + * @since 1.6 + * @throws \Exception + */ + public function __construct($config = [], MVCFactoryInterface $factory = null) + { + parent::__construct($config, $factory); + + $this->app_params = ComponentHelper::getParams('com_###component###'); + $this->app ??= Factory::getApplication(); + }###AJAX_MODEL_METHODS### +} diff --git a/admin/compiler/joomla_4/ADMIN_AUTOLOADER_CLASS.php b/admin/compiler/joomla_4/ADMIN_AUTOLOADER_CLASS.php new file mode 100644 index 000000000..5f0142dd3 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_AUTOLOADER_CLASS.php @@ -0,0 +1,18 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +// No direct access to this file +defined('_JEXEC') or die;###ADMIN_POWER_HELPER### diff --git a/admin/compiler/joomla_4/ADMIN_DISPLAY_CONTROLLER.php b/admin/compiler/joomla_4/ADMIN_DISPLAY_CONTROLLER.php new file mode 100644 index 000000000..199578ec5 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_DISPLAY_CONTROLLER.php @@ -0,0 +1,50 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Controller; + +use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### master admin display controller. + * + * @since 4.0 + */ +class DisplayController extends BaseController +{ + /** + * The default view. + * + * @var string + * @since 1.0.0 + */ + protected $default_view = '###DASHBOARDVIEW###'; + + /** + * display task + * + * @return void + */ + function display($cachable = false, $urlparams = false) + { + return parent::display($cachable, $urlparams); + } +} diff --git a/admin/compiler/joomla_4/ADMIN_EXTENSION_COMPONENT.php b/admin/compiler/joomla_4/ADMIN_EXTENSION_COMPONENT.php new file mode 100644 index 000000000..abb451609 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_EXTENSION_COMPONENT.php @@ -0,0 +1,80 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Extension; + +use Joomla\CMS\Association\AssociationServiceInterface; +use Joomla\CMS\Association\AssociationServiceTrait; +use Joomla\CMS\Categories\CategoryServiceInterface; +use Joomla\CMS\Categories\CategoryServiceTrait; +use Joomla\CMS\Component\Router\RouterServiceInterface; +use Joomla\CMS\Component\Router\RouterServiceTrait; +use Joomla\CMS\Extension\BootableExtensionInterface; +use Joomla\CMS\Extension\MVCComponent; +use Joomla\CMS\Factory; +use Joomla\CMS\Fields\FieldsServiceInterface; +use Joomla\CMS\Form\Form; +use Joomla\CMS\HTML\HTMLRegistryAwareTrait; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Tag\TagServiceInterface; +use Joomla\CMS\Tag\TagServiceTrait; +use Joomla\CMS\User\UserFactoryInterface; +// (soon) use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Service\HTML\AdministratorService; +use Psr\Container\ContainerInterface; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * Component class for com_###component### + * + * @since 4.0 + */ +class ###Component###Component extends MVCComponent implements + BootableExtensionInterface, + CategoryServiceInterface, + RouterServiceInterface +{ + use AssociationServiceTrait; + use HTMLRegistryAwareTrait; + use RouterServiceTrait; + use CategoryServiceTrait, TagServiceTrait { + CategoryServiceTrait::getTableNameForSection insteadof TagServiceTrait; + CategoryServiceTrait::getStateColumnForSection insteadof TagServiceTrait; + } + + /** + * Booting the extension. This is the function to set up the environment of the extension like + * registering new class loaders, etc. + * + * If required, some initial set up can be done from services of the container, eg. + * registering HTML services. + * + * @param ContainerInterface $container The container + * + * @return void + * + * @since 4.0.0 + */ + public function boot(ContainerInterface $container) + { + // (soon) $this->getRegistry()->register('###component###administrator', new AdministratorService()); + } + + // will fix these soon + protected function getTableNameForSection(string $section = null){} + public function countItems(array $items, string $section){} + +} diff --git a/admin/compiler/joomla_4/ADMIN_HEADERCHECK.php b/admin/compiler/joomla_4/ADMIN_HEADERCHECK.php new file mode 100644 index 000000000..e07898584 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_HEADERCHECK.php @@ -0,0 +1,135 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper; + +use Joomla\CMS\Factory; +use Joomla\CMS\Document\Document; +use Joomla\CMS\Application\CMSApplication; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * Helper class for checking loaded scripts and styles in the document header. + * + * @since 3.2.0 + */ +class HeaderCheck +{ + /** + * @var CMSApplication Application object + * + * @since 3.2.0 + */ + protected CMSApplication $app; + + /** + * @var Document object + * + * @since 3.2.0 + */ + protected Document $document; + + /** + * Construct the app and document + * + * @since 3.2.0 + */ + public function __construct() + { + // Initializes the application object. + $this->app ??= Factory::getApplication(); + + // Initializes the document object. + $this->document = $this->app->getDocument(); + } + + /** + * Check if a JavaScript file is loaded in the document head. + * + * @param string $scriptName Name of the script to check. + * + * @return bool True if the script is loaded, false otherwise. + * @since 3.2.0 + */ + public function js_loaded(string $scriptName): bool + { + return $this->isLoaded($scriptName, 'scripts'); + } + + /** + * Check if a CSS file is loaded in the document head. + * + * @param string $scriptName Name of the stylesheet to check. + * + * @return bool True if the stylesheet is loaded, false otherwise. + * @since 3.2.0 + */ + public function css_loaded(string $scriptName): bool + { + return $this->isLoaded($scriptName, 'styleSheets'); + } + + /** + * Abstract method to check if a given script or stylesheet is loaded. + * + * @param string $scriptName Name of the script or stylesheet. + * @param string $type Type of asset to check ('scripts' or 'styleSheets'). + * + * @return bool True if the asset is loaded, false otherwise. + * @since 3.2.0 + */ + private function isLoaded(string $scriptName, string $type): bool + { + // UIkit specific check + if ($this->isUIkit($scriptName)) + { + return true; + } + + $head_data = $this->document->getHeadData(); + foreach (array_keys($head_data[$type]) as $script) + { + if (stristr($script, $scriptName)) + { + return true; + } + } + + return false; + } + + /** + * Check for UIkit framework specific conditions. + * + * @param string $scriptName Name of the script or stylesheet. + * + * @return bool True if UIkit specific conditions are met, false otherwise. + * @since 3.2.0 + */ + private function isUIkit(string $scriptName): bool + { + if (strpos($scriptName, 'uikit') !== false) + { + $get_template_name = $this->app->getTemplate('template')->template; + if (strpos($get_template_name, 'yoo') !== false) + { + return true; + } + } + return false; + } +} diff --git a/admin/compiler/joomla_3/JCB_Helper.php b/admin/compiler/joomla_4/ADMIN_HELPER_CLASS.php similarity index 51% rename from admin/compiler/joomla_3/JCB_Helper.php rename to admin/compiler/joomla_4/ADMIN_HELPER_CLASS.php index 4f65b36c9..3318da99a 100644 --- a/admin/compiler/joomla_3/JCB_Helper.php +++ b/admin/compiler/joomla_4/ADMIN_HELPER_CLASS.php @@ -2,46 +2,51 @@ /** * @package Joomla.Component.Builder * - * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @created 4th September 2022 + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; ?> ###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper; -// No direct access to this file -defined('_JEXEC') or die('Restricted access');###ADMIN_POWER_HELPER### +// The power autoloader for this project admin area. +$power_autoloader = JPATH_ADMINISTRATOR . '/components/com_###component###/src/Helper/PowerloaderHelper.php'; +if (file_exists($power_autoloader)) +{ + require_once $power_autoloader; +} ###ADMIN_HELPER_CLASS_HEADER### +// No direct access to this file +\defined('_JEXEC') or die; + /** * ###Component### component helper. + * + * @since 3.0 */ abstract class ###Component###Helper { /** - * Adding the utilities trait to this class + * Composer Switch * - * @deprecated 4.0 - Check the trait methods for details, a legacy implementation - */ - use Utilities; - - /** - * get the Component Code Name + * @var array */ - public static $ComponentCodeName = '###component###'; + protected static $composer = []; /** - * Composer Switch - * - * @var array + * The Main Active Language + * + * @var string */ - protected static $composer = array();###ADMIN_GLOBAL_EVENT_HELPER######CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT### + public static $langTag;###ADMIN_GLOBAL_EVENT_HELPER######CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT### /** * Load the Composer Vendors @@ -52,7 +57,7 @@ public static function composerAutoload($target) if (!isset(self::$composer[$target])) { // get the function name - $functionName = self::safeString('compose' . $target); + $functionName = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe('compose' . $target); // check if method exist if (method_exists(__CLASS__, $functionName)) { @@ -74,7 +79,7 @@ public static function manifest() /** * Joomla version object - */ + */ protected static $JVersion; /** @@ -83,9 +88,9 @@ public static function manifest() public static function jVersion() { // check if set - if (!self::checkObject(self::$JVersion)) + if (!Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check(self::$JVersion)) { - self::$JVersion = new JVersion(); + self::$JVersion = new Version(); } return self::$JVersion; } @@ -96,18 +101,18 @@ public static function jVersion() public static function getContributors() { // get params - $params = JComponentHelper::getParams('com_###component###'); + $params = ComponentHelper::getParams('com_###component###'); // start contributors array - $contributors = array(); + $contributors = []; // get all Contributors (max 20) $searchArray = range('0','20'); foreach($searchArray as $nr) - { + { if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 1 || $params->get("showContributor".$nr) == 3)) { // set link based of selected option if($params->get("useContributor".$nr) == 1) - { + { $link_front = ''; $link_back = ''; } @@ -121,8 +126,8 @@ public static function getContributors() $link_front = ''; $link_back = ''; } - $contributors[$nr]['title'] = self::htmlEscape($params->get("titleContributor".$nr)); - $contributors[$nr]['name'] = $link_front.self::htmlEscape($params->get("nameContributor".$nr)).$link_back; + $contributors[$nr]['title'] = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($params->get("nameContributor".$nr)).$link_back; } } return $contributors; @@ -134,18 +139,89 @@ public static function getContributors() public static function addSubmenu($submenu) { // load user for access menus - $user = JFactory::getUser(); + $user = Factory::getApplication()->getIdentity(); // load the submenus to sidebar ###SUBMENU### }###HELPER_CREATEUSER######HELPER_UIKIT######HELPER_EXEL### + /** + * Get a Variable + * + * @param string $table The table from which to get the variable + * @param string $where The value where + * @param string $whereString The target/field string where/name + * @param string $what The return field + * @param string $operator The operator between $whereString/field and $where/value + * @param string $main The component in which the table is found + * + * @return mix string/int/float + * @deprecated 3.3 Use Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var(...); + */ + public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = '###component###') + { + return Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var( + $table, + $where, + $whereString, + $what, + $operator, + $main + ); + } + + /** + * Get array of variables + * + * @param string $table The table from which to get the variables + * @param string $where The value where + * @param string $whereString The target/field string where/name + * @param string $what The return field + * @param string $operator The operator between $whereString/field and $where/value + * @param string $main The component in which the table is found + * @param bool $unique The switch to return a unique array + * + * @return array + * @deprecated 3.3 Use Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::vars(...); + */ + public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = '###component###', $unique = true) + { + return Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::vars( + $table, + $where, + $whereString, + $what, + $operator, + $main, + $unique + ); + } + + /** + * Convert a json object to a string + * + * @input string $value The json string to convert + * + * @returns a string + * @deprecated 3.3 Use Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::string(...); + */ + public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') + { + return Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::string( + $value, + $sperator, + $table, + $id, + $name + ); + } + public static function isPublished($id,$type) { if ($type == 'raw') { $type = 'item'; } - $db = JFactory::getDbo(); + $db = Factory::getContainer()->get(DatabaseInterface::class); $query = $db->getQuery(true); $query->select(array('a.published')); $query->from('#__###component###_'.$type.' AS a'); @@ -163,7 +239,7 @@ public static function isPublished($id,$type) public static function getGroupName($id) { - $db = JFactory::getDBO(); + $db = Factory::getContainer()->get(DatabaseInterface::class); $query = $db->getQuery(true); $query->select(array('a.title')); $query->from('#__usergroups AS a'); @@ -172,7 +248,7 @@ public static function getGroupName($id) $db->execute(); $found = $db->getNumRows(); if($found) - { + { return $db->loadResult(); } return $id; @@ -188,39 +264,39 @@ public static function getGroupName($id) * @param string $component The target component * @param object $user The user whose permissions we are loading * - * @return object The JObject of permission/authorised actions - * + * @return object The CMSObject of permission/authorised actions + * */ public static function getActions($view, &$record = null, $views = null, $target = null, $component = '###component###', $user = 'null') { // load the user if not given - if (!self::checkObject($user)) + if (!Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($user)) { // get the user object - $user = JFactory::getUser(); + $user = Factory::getApplication()->getIdentity(); } - // load the JObject - $result = new JObject; + // load the CMSObject + $result = new CMSObject; // make view name safe (just incase) - $view = self::safeString($view); - if (self::checkString($views)) + $view = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($view); + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($views)) { - $views = self::safeString($views); - } + $views = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($views); + } // get all actions from component - $actions = JAccess::getActionsFromFile( + $actions = Access::getActionsFromFile( JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', "/access/section[@name='component']/" ); - // if non found then return empty JObject + // if non found then return empty CMSObject if (empty($actions)) { return $result; } // get created by if not found - if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) + if (Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($record) && !isset($record->created_by) && isset($record->id)) { - $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); + $record->created_by = Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var($view, $record->id, 'id', 'created_by', '=', $component); } // set actions only set in component settings $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); @@ -229,12 +305,12 @@ public static function getActions($view, &$record = null, $views = null, $target if ($target) { // convert to an array - if (self::checkString($target)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($target)) { $target = array($target); } // check if we are good to go - if (self::checkArray($target)) + if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($target)) { $checkTarget = true; } @@ -255,7 +331,7 @@ public static function getActions($view, &$record = null, $views = null, $target // set area $area = 'comp'; // check if the record has an ID and the action is item related (not a component action) - if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && + if (Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) { // we are in item @@ -288,7 +364,7 @@ public static function getActions($view, &$record = null, $views = null, $target } } } - elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) + elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($views) && isset($record->catid) && $record->catid > 0) { // we are in item $area = 'category'; @@ -360,7 +436,7 @@ public static function getActions($view, &$record = null, $views = null, $target * @param array $targets The array of target actions * * @return boolean true if action should be filtered out - * + * */ protected static function filterActions(&$view, &$action, &$targets) { @@ -377,51 +453,55 @@ protected static function filterActions(&$view, &$action, &$targets) } /** - * Get any component's model + * Returns any Model object. + * + * @param string $type The model type to instantiate + * @param string $prefix Prefix for the model class name. Optional. + * @param string $component Component name the model belongs to. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return \Joomla\CMS\MVC\Model\BaseDatabaseModel + * @throws \Exception + * @since 4.4 */ - public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = '###Component###', $config = array()) + public static function getModel(string $type, string $prefix = 'Administrator', + string $component = '###component###', array $config = []) { - // fix the name - $name = self::safeString($name); - // full path to models - $fullPathModels = $path . '/models'; - // load the model file - JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); - // make sure the table path is loaded - if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + // make sure the name is correct + $type = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($type, 'F'); + $component = strtolower($component); + + if ($prefix !== 'Site' && $prefix !== 'Administrator') { - // This is the JCB default path to tables in Joomla 3.x - $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; + $prefix = self::getPrefixFromModelPath($prefix); } - // get instance - $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); - // if model not found (strange) - if ($model == false) + + // Get the model through the MVCFactory + return Factory::getApplication()->bootComponent('com_' . $component)->getMVCFactory()->createModel($type, $prefix, $config); + } + + /** + * Get the prefix from the model path + * + * @param string $path The model path + * + * @return string The prefix value + * @since 4.4 + */ + protected static function getPrefixFromModelPath(string $path): string + { + // Check if $path starts with JPATH_ADMINISTRATOR path + if (str_starts_with($path, JPATH_ADMINISTRATOR . '/components/')) { - jimport('joomla.filesystem.file'); - // get file path - $filePath = $path . '/' . $name . '.php'; - $fullPathModel = $fullPathModels . '/' . $name . '.php'; - // check if it exists - if (File::exists($filePath)) - { - // get the file - require_once $filePath; - } - elseif (File::exists($fullPathModel)) - { - // get the file - require_once $fullPathModel; - } - // build class names - $modelClass = $Component . 'Model' . $name; - if (class_exists($modelClass)) - { - // initialize the model - return new $modelClass($config); - } + return 'Administrator'; + } + // Check if $path starts with JPATH_SITE path + elseif (str_starts_with($path, JPATH_SITE . '/components/')) + { + return 'Site'; } - return $model; + + return 'Administrator'; } /** @@ -429,14 +509,14 @@ public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $C */ public static function setAsset($id, $table, $inherit = true) { - $parent = JTable::getInstance('Asset'); + $parent = Table::getInstance('Asset'); $parent->loadByName('com_###component###'); - + $parentId = $parent->id; $name = 'com_###component###.'.$table.'.'.$id; $title = ''; - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName($name); // Check for an error. @@ -460,27 +540,27 @@ public static function setAsset($id, $table, $inherit = true) $asset->title = $title; // get the default asset rules $rules = self::getDefaultAssetRules('com_###component###', $table, $inherit); - if ($rules instanceof JAccessRules) + if ($rules instanceof AccessRules) { $asset->rules = (string) $rules; } if (!$asset->check() || !$asset->store()) { - JFactory::getApplication()->enqueueMessage($asset->getError(), 'warning'); + Factory::getApplication()->enqueueMessage($asset->getError(), 'warning'); return false; } else { // Create an asset_id or heal one that is corrupted. - $object = new stdClass(); + $object = new \StdClass(); // Must be a valid primary key value. $object->id = $id; $object->asset_id = (int) $asset->id; // Update their asset_id to link to the asset table. - return JFactory::getDbo()->updateObject('#__###component###_'.$table, $object, 'id'); + return Factory::getDbo()->updateObject('#__###component###_'.$table, $object, 'id'); } } return false; @@ -497,7 +577,7 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru if (!$inherit) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getContainer()->get(DatabaseInterface::class); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -512,8 +592,8 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru } } // get asset rules - $result = JAccess::getAssetRules($assetId); - if ($result instanceof JAccessRules) + $result = Access::getAssetRules($assetId); + if ($result instanceof AccessRules) { $_result = (string) $result; $_result = json_decode($_result); @@ -528,7 +608,7 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru elseif ($inherit) { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -536,8 +616,8 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules($_result); + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules($_result); // return filtered rules return $rules; } @@ -551,35 +631,12 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru * @param SimpleXMLElement $xml The XML element reference in which to inject a comment * @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement * - * @return null - * + * @return void + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::append($xml, $node); */ public static function xmlAppend(&$xml, $node) { - if (!$node) - { - // element was not returned - return; - } - switch (get_class($node)) - { - case 'stdClass': - if (property_exists($node, 'comment')) - { - self::xmlComment($xml, $node->comment); - } - if (property_exists($node, 'fieldXML')) - { - self::xmlAppend($xml, $node->fieldXML); - } - break; - case 'SimpleXMLElement': - $domXML = dom_import_simplexml($xml); - $domNode = dom_import_simplexml($node); - $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); - $xml = simplexml_import_dom($domXML); - break; - } + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::append($xml, $node); } /** @@ -588,16 +645,12 @@ public static function xmlAppend(&$xml, $node) * @param SimpleXMLElement $xml The XML element reference in which to inject a comment * @param string $comment The comment to inject * - * @return null - * + * @return void + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::comment($xml, $comment); */ public static function xmlComment(&$xml, $comment) { - $domXML = dom_import_simplexml($xml); - $domComment = new DOMComment($comment); - $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); - $domXML->appendChild($nodeTarget); - $xml = simplexml_import_dom($domXML); + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::comment($xml, $comment); } /** @@ -607,14 +660,11 @@ public static function xmlComment(&$xml, $comment) * @param array $attributes The attributes to apply to the XML element * * @return null - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::attributes($xml, $attributes); */ - public static function xmlAddAttributes(&$xml, $attributes = array()) + public static function xmlAddAttributes(&$xml, $attributes = []) { - foreach ($attributes as $key => $value) - { - $xml->addAttribute($key, $value); - } + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::attributes($xml, $attributes); } /** @@ -624,16 +674,11 @@ public static function xmlAddAttributes(&$xml, $attributes = array()) * @param array $options The options to apply to the XML element * * @return void - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::options($xml, $options); */ - public static function xmlAddOptions(&$xml, $options = array()) + public static function xmlAddOptions(&$xml, $options = []) { - foreach ($options as $key => $value) - { - $addOption = $xml->addChild('option'); - $addOption->addAttribute('value', $key); - $addOption[] = $value; - } + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::options($xml, $options); } /** @@ -644,28 +689,11 @@ public static function xmlAddOptions(&$xml, $options = array()) * @param array $options The options to apply to the XML element * * @return object - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($attributes, $default, $options); */ public static function getFieldObject(&$attributes, $default = '', $options = null) { - // make sure we have attributes and a type value - if (self::checkArray($attributes) && isset($attributes['type'])) - { - // make sure the form helper class is loaded - if (!method_exists('JFormHelper', 'loadFieldType')) - { - jimport('joomla.form.form'); - } - // get field type - $field = JFormHelper::loadFieldType($attributes['type'], true); - // get field xml - $XML = self::getFieldXML($attributes, $options); - // setup the field - $field->setup($XML, $default); - // return the field object - return $field; - } - return false; + return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($attributes, $default, $options); } /** @@ -675,27 +703,11 @@ public static function getFieldObject(&$attributes, $default = '', $options = nu * @param array $options The options to apply to the XML element * * @return object - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::xml($attributes, $options); */ public static function getFieldXML(&$attributes, $options = null) { - // make sure we have attributes and a type value - if (self::checkArray($attributes)) - { - // start field xml - $XML = new SimpleXMLElement(''); - // load the attributes - self::xmlAddAttributes($XML, $attributes); - // check if we have options - if (self::checkArray($options)) - { - // load the options - self::xmlAddOptions($XML, $options); - } - // return the field xml - return $XML; - } - return false; + return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::xml($attributes, $options); } /** @@ -719,17 +731,69 @@ public static function renderBoolButton() // button attributes $buttonAttributes = array( 'type' => 'radio', - 'name' => isset($args[0]) ? self::htmlEscape($args[0]) : 'bool_button', - 'label' => isset($args[0]) ? self::safeString(self::htmlEscape($args[0]), 'Ww') : 'Bool Button', // not seen anyway + 'name' => isset($args[0]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[0]) : 'bool_button', + 'label' => isset($args[0]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[0]), 'Ww') : 'Bool Button', // not seen anyway 'class' => 'btn-group', 'filter' => 'INT', 'default' => isset($args[2]) ? (int) $args[2] : 0); // set the button options $buttonOptions = array( - '1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES', - '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); + '1' => isset($args[3]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[3]) : 'JYES', + '0' => isset($args[4]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[4]) : 'JNO'); // return the input - return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; + return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; + } + + /** + * Check if have an json string + * + * @input string The json string to check + * + * @returns bool true on success + * @deprecated 3.3 Use Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check($string); + */ + public static function checkJson($string) + { + return Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check($string); + } + + /** + * Check if have an object with a length + * + * @input object The object to check + * + * @returns bool true on success + * @deprecated 3.3 Use Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($object); + */ + public static function checkObject($object) + { + return Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($object); + } + + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns bool/int number of items in array on success + * @deprecated 3.3 Use Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($array, $removeEmptyString); + */ + public static function checkArray($array, $removeEmptyString = false) + { + return Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($array, $removeEmptyString); + } + + /** + * Check if have a string with a length + * + * @input string The string to check + * + * @returns bool true on success + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($string); + */ + public static function checkString($string) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($string); } /** @@ -741,8 +805,8 @@ public static function renderBoolButton() public static function isConnected() { // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right? - $connected = @fsockopen("www.example.com", 80); - // website, port (try 80 or 443) + $connected = @fsockopen("www.example.com", 80); + // website, port (try 80 or 443) if ($connected) { //action when connected @@ -757,9 +821,122 @@ public static function isConnected() return $is_conn; } + /** + * Merge an array of array's + * + * @input array The arrays you would like to merge + * + * @returns array on success + * @deprecated 3.3 Use Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge($arrays); + */ + public static function mergeArrays($arrays) + { + return Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge($arrays); + } + // typo sorry! public static function sorten($string, $length = 40, $addTip = true) { return self::shorten($string, $length, $addTip); - }###HELPER_LICENSE_LOCK######GET_CRYPT_KEY### + } + + /** + * Shorten a string + * + * @input string The you would like to shorten + * + * @returns string on success + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::shorten(...); + */ + public static function shorten($string, $length = 40, $addTip = true) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::shorten($string, $length, $addTip); + } + + /** + * Making strings safe (various ways) + * + * @input string The you would like to make safe + * + * @returns string on success + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(...); + */ + public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe( + $string, + $type, + $spacer, + $replaceNumbers, + $keepOnlyCharacters + ); + } + + /** + * Convert none English strings to code usable string + * + * @input an string + * + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::transliterate($string); + */ + public static function transliterate($string) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::transliterate($string); + } + + /** + * make sure a string is HTML save + * + * @input an html string + * + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html(...); + */ + public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html( + $var, + $charset, + $shorten, + $length + ); + }###HELPER_LICENSE_LOCK### + + /** + * Convert all int in a string to an English word string + * + * @input an string with numbers + * + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::numbers($string); + */ + public static function replaceNumbers($string) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::numbers($string); + } + + /** + * Convert an integer into an English word string + * Thanks to Tom Nicholson + * + * @input an int + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::number($x); + */ + public static function numberToString($x) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::number($x); + } + + /** + * Random Key + * + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::random($size); + */ + public static function randomkey($size) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::random($size); + }###GET_CRYPT_KEY### } diff --git a/admin/compiler/joomla_4/ADMIN_HELPER_CONTROLLER.php b/admin/compiler/joomla_4/ADMIN_HELPER_CONTROLLER.php new file mode 100644 index 000000000..91b90a0d1 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_HELPER_CONTROLLER.php @@ -0,0 +1,128 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Controller; + +use Joomla\CMS\Factory; +use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\Database\DatabaseInterface; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Session\Session; +use Joomla\Utilities\ArrayHelper; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### Help Base Controller + * + * @since 1.6 + */ +class HelpController extends BaseController +{ + public function __construct($config) + { + parent::__construct($config); + // load the tasks + $this->registerTask('getText', 'help'); + } + + public function help() + { + $user = Factory::getApplication()->getIdentity(); + $jinput = Factory::getApplication()->input; + // Check Token! + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); + if($user->id != 0 && ($jinput->get($token, 0, 'ALNUM') || $token === $call_token)) + { + $task = $this->getTask(); + switch($task){ + case 'getText': + try + { + $idValue = $jinput->get('id', 0, 'INT'); + if($idValue) + { + $result = $this->getHelpDocumentText($idValue); + } + else + { + $result = ''; + } + echo $result; + // stop execution gracefully + jexit(); + } + catch(Exception $e) + { + // stop execution gracefully + jexit(); + } + break; + } + } + else + { + // stop execution gracefully + jexit(); + } + } + + protected function getHelpDocumentText($id) + { + $db = Factory::getContainer()->get(DatabaseInterface::class); + $query = $db->getQuery(true); + $query->select(array('a.title','a.content')); + $query->from('#__###component###_help_document AS a'); + $query->where('a.id = '.(int) $id); + $query->where('a.published = 1'); + $db->setQuery($query); + $db->execute(); + if($db->getNumRows()) + { + $text = []; + $document = $db->loadObject(); + // fix image issue + $images['src="images'] = 'src="'.Uri::root().'images'; + $images["src='images"] = "src='".Uri::root()."images"; + $images['src="/images'] = 'src="'.Uri::root().'images'; + $images["src='/images"] = "src='".Uri::root()."images"; + // set document template + $text[] = ""; + $text[] = ''; + $text[] = ""; + $text[] = ''; + $text[] = "".$document->title.""; + $text[] = ''; + $text[] = ''; + $text[] = ""; + $text[] = '
'; + $text[] = '
'; + $text[] = '
'; + // build the help text + $text[] = '

'.$document->title."

"; + $text[] = str_replace(array_keys($images),array_values($images),$document->content); + // end template + $text[] = '


'; + $text[] = '
'; + $text[] = ""; + $text[] = ""; + + return implode("\n",$text); + } + return false; + } +} diff --git a/admin/compiler/joomla_4/ADMIN_HELPER_EMAIL.php b/admin/compiler/joomla_4/ADMIN_HELPER_EMAIL.php new file mode 100644 index 000000000..ac42ef225 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_HELPER_EMAIL.php @@ -0,0 +1,474 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper; + +use Joomla\CMS\Factory; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Mail\Mail; +use Joomla\Registry\Registry; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### component email helper + * + * @since 3.0 + */ +abstract class ###Component###Email +{ + /** + * The active recipient + * + * @var activeRecipient (array) + */ + public static $active = []; + + /** + * Configuraiton object + * + * @var Registry + */ + public static ?Registry $config = null; + + /** + * Mailer object + * + * @var Mail + */ + public static ?Mail $mailer = null; + + /** + * Custom Headers + * + * @var array + */ + protected static array $header = []; + + /** + * Get a configuration object + * + */ + public static function getConfig() + { + if (!self::$config) + { + self::$config = ComponentHelper::getParams('com_###component###'); + } + + return self::$config; + } + + /** + * Returns the global mailer object, only creating it if it doesn't already exist. + * + */ + public static function getMailerInstance() + { + if (!self::$mailer) + { + self::$mailer = self::createMailer(); + } + + return self::$mailer; + } + + /** + * Check that a string looks like an email address. + * @param string $address The email address to check + * @param string|callable $patternselect A selector for the validation pattern to use : + * * `auto` Pick best pattern automatically; + * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14; + * * `pcre` Use old PCRE implementation; + * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; + * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. + * * `noregex` Don't use a regex: super fast, really dumb. + * Alternatively you may pass in a callable to inject your own validator, for example: + * PHPMailer::validateAddress('user@example.com', function($address) { + * return (strpos($address, '@') !== false); + * }); + * You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator. + * @return boolean + * @static + * @access public + */ + public static function validateAddress($address, $patternselect = null): bool + { + return self::getMailerInstance()->validateAddress($address, $patternselect); + } + + /** + * Get a mailer object. + * + * Returns the global {@link Mail} object, only creating it if it doesn't already exist. + * + * @return Mail object + * + * @see Mail + */ + public static function getMailer(): Mail + { + if (!self::$mailer) + { + self::$mailer = self::createMailer(); + } + + $copy = clone self::$mailer; + + return $copy; + } + + /** + * Create a mailer object + * + * @return Mail object + * + * @see Mail + */ + protected static function createMailer(): Mail + { + // set component params + $conf = self::getConfig(); + + // now load the mailer + $mailer = $conf->get('mailer', 'global'); + + // Create a Mail object + $mail = Mail::getInstance(); + + // check if set to global + if ('global' == $mailer) + { + // get the global details + $globalConf = Factory::getConfig(); + + $mailer = $globalConf->get('mailer'); + $smtpauth = ($globalConf->get('smtpauth') == 0) ? null : 1; + $smtpuser = $globalConf->get('smtpuser'); + $smtppass = $globalConf->get('smtppass'); + $smtphost = $globalConf->get('smtphost'); + $smtpsecure = $globalConf->get('smtpsecure'); + $smtpport = $globalConf->get('smtpport'); + $sendmail = $globalConf->get('sendmail'); + $mailfrom = $globalConf->get('mailfrom'); + $fromname = $globalConf->get('fromname'); + $replyto = $globalConf->get('replyto'); + $replytoname = $globalConf->get('replytoname'); + } + else + { + $smtpauth = ($conf->get('smtpauth') == 0) ? null : 1; + $smtpuser = $conf->get('smtpuser'); + $smtppass = $conf->get('smtppass'); + $smtphost = $conf->get('smtphost'); + $smtpsecure = $conf->get('smtpsecure'); + $smtpport = $conf->get('smtpport'); + $sendmail = $conf->get('sendmail'); + $mailfrom = $conf->get('emailfrom'); + $fromname = $conf->get('fromname'); + $replyto = $conf->get('replyto'); + $replytoname = $conf->get('replytoname'); + } + + // Set global sender + $mail->setSender(array($mailfrom, $fromname)); + + // set the global reply-to if found + if ($replyto && $replytoname) + { + $mail->ClearReplyTos(); + $mail->addReplyTo($replyto, $replytoname); + } + + // Default mailer is to use PHP's mail function + switch ($mailer) + { + case 'smtp': + // set the SMTP option + $mail->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport); + break; + + case 'sendmail': + // set the sendmail option + $mail->useSendmail($sendmail); + $mail->IsSendmail(); + break; + + default: + $mail->IsMail(); + break; + } + + return $mail; + } + + /** + * Set a Mail custom header. + * + * @return void + */ + public static function setHeader($target, $value) + { + // set the header + self::$header[$target] = $value; + } + + /** + * Send an email + * + * @return bool on success + * + */ + public static function send($recipient, $subject, $body, $textonly, $mode = 0, $bounce_email = null, $idsession = null, $mailreply = null, $replyname = null , $mailfrom = null, $fromname = null, $cc = null, $bcc = null, $attachment = null, $embeded = null , $embeds = null) + { + // Get a Mail instance + $mail = self::getMailer(); + + // set component params + $conf = self::getConfig(); + + // set if we have override + if ($mailfrom && $fromname) + { + $mail->setSender(array($mailfrom, $fromname)); + } + + // load the bounce email as sender if set + if (!is_null($bounce_email)) + { + $mail->Sender = $bounce_email; + } + + // Add tag to email to identify it + if (!is_null($idsession)) + { + $mail->addCustomHeader('X-VDMmethodID:'.$idsession); + } + + // set headers if found + if (isset(self::$header) && is_array(self::$header) && count((array)self::$header) > 0) + { + foreach (self::$header as $_target => $_value) + { + $mail->addCustomHeader($_target.':'.$_value); + } + } + + // set the subject & Body + $mail->setSubject($subject); + $mail->setBody($body); + + // Are we sending the email as HTML? + if ($mode) + { + $mail->IsHTML(true); + $mail->AltBody = $textonly; + } + + //embed images + if ($embeded) + { + if(Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($embeds)) + { + foreach($embeds as $embed) + { + $mail->AddEmbeddedImage($embed->Path,$embed->FileName); + } + } + } + + $mail->addRecipient($recipient); + $mail->addCC($cc); + $mail->addBCC($bcc); + $mail->addAttachment($attachment); + + // Take care of reply email addresses + if (is_array($mailreply)) + { + $mail->ClearReplyTos(); + $numReplyTo = count((array)$mailreply); + for ($i=0; $i < $numReplyTo; $i++) + { + $mail->addReplyTo($mailreply[$i], $replyname[$i]); + } + } + elseif (!empty($mailreply)) + { + $mail->ClearReplyTos(); + $mail->addReplyTo($mailreply, $replyname); + } + + // check if we can add the DKIM to email + if ($conf->get('enable_dkim')) + { + if (!empty($conf->get('dkim_domain')) && !empty($conf->get('dkim_selector')) && !empty($conf->get('dkim_private')) && !empty($conf->get('dkim_public'))) + { + $mail->DKIM_domain = $conf->get('dkim_domain'); + $mail->DKIM_selector = $conf->get('dkim_selector'); + $mail->DKIM_identity = $conf->get('dkim_identity'); + $mail->DKIM_passphrase = $conf->get('dkim_passphrase'); + + $tmp = tempnam(sys_get_temp_dir(), 'VDM'); + $h = fopen($tmp, 'w'); + fwrite($h, $conf->get('dkim_private')); + fclose($h); + $mail->DKIM_private = $tmp; + } + } + + $sendmail = $mail->Send(); + + if ($conf->get('enable_dkim') && !empty($conf->get('dkim_domain')) && !empty($conf->get('dkim_selector')) && !empty($conf->get('dkim_private')) && !empty($conf->get('dkim_public'))) + { + @unlink($tmp); + } + + if (method_exists('###Component###Helper','storeMessage')) + { + // if we have active recipient details + if (isset(self::$active[$recipient])) + { + // store the massage if the method is set + ###Component###Helper::storeMessage($sendmail, self::$active[$recipient], $subject, $body, $textonly, $mode, 'email'); + // clear memory + unset(self::$active[$recipient]); + } + else + { + // store the massage if the method is set + ###Component###Helper::storeMessage($sendmail, $recipient, $subject, $body, $textonly, $mode, 'email'); + } + } + + return $sendmail; + } + + /** + * Set html text (in a row) and subject (as title) to a email table. + * do not use

instead use
+ * in your html that you pass to this method + * since it is a table row it does not + * work well with paragraphs + * + * @return string on success + * + */ + public static function setBasicBody($html, $subject) + { + $body = []; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = "" . $subject . ""; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = $html; + $body[] = ""; + $body[] = ""; + + return implode("\n", $body); + } + + /** + * Set html text (in a row) and subject (as title) to a email table. + * do not use

instead use
+ * in your html that you pass to this method + * since it is a table row it does not + * work well with paragraphs + * + * @return string on success + * + */ + public static function setTableBody($html, $subject) + { + $body = []; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = "" . $subject . ""; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = "\n"; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = "
"; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = "
"; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = ""; + $body[] = "
"; + $body[] = $html; + $body[] = "
"; + $body[] = ""; + $body[] = "
"; + $body[] = ""; + $body[] = "
"; + $body[] = ""; + $body[] = ""; + $body[] = ""; + + return implode("\n", $body); + } +} diff --git a/admin/compiler/joomla_4/ADMIN_IMPORT_CONTROLLER.php b/admin/compiler/joomla_4/ADMIN_IMPORT_CONTROLLER.php new file mode 100644 index 000000000..865a18c44 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_IMPORT_CONTROLLER.php @@ -0,0 +1,63 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Controller; + +###IMPORT_CONTROLLER_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### Import Base Controller + * + * @since 1.6 + */ +class ImportController extends BaseController +{ + /** + * Import an spreadsheet. + * + * @return void + */ + public function import() + { + // Check for request forgeries + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); + + $model = $this->getModel('import'); + if ($model->import()) + { + $cache = Factory::getCache('mod_menu'); + $cache->clean(); + // TODO: Reset the users acl here as well to kill off any missing bits + } + + $app = Factory::getApplication(); + $redirect_url = $app->getUserState('com_###component###.redirect_url'); + if (empty($redirect_url)) + { + $redirect_url = Route::_('index.php?option=com_###component###&view=import', false); + } + else + { + // wipe out the user state when we're going to redirect + $app->setUserState('com_###component###.redirect_url', ''); + $app->setUserState('com_###component###.message', ''); + $app->setUserState('com_###component###.extension_message', ''); + } + $this->setRedirect($redirect_url); + } +} diff --git a/admin/compiler/joomla_4/ADMIN_IMPORT_CONTROLLER_CUSTOM.php b/admin/compiler/joomla_4/ADMIN_IMPORT_CONTROLLER_CUSTOM.php new file mode 100644 index 000000000..59b242d3d --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_IMPORT_CONTROLLER_CUSTOM.php @@ -0,0 +1,63 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Controller; + +###IMPORT_CUSTOM_CONTROLLER_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### ###View### Base Controller + * + * @since 1.6 + */ +class ###View###importController extends BaseController +{ + /** + * Import an spreadsheet. + * + * @return void + */ + public function import() + { + // Check for request forgeries + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); + + $model = $this->getModel('###View###'); + if ($model->import()) + { + $cache = Factory::getCache('mod_menu'); + $cache->clean(); + // TODO: Reset the users acl here as well to kill off any missing bits + } + + $app = Factory::getApplication(); + $redirect_url = $app->getUserState('com_###component###.redirect_url'); + if (empty($redirect_url)) + { + $redirect_url = Route::_('index.php?option=com_###component###&view=###view###', false); + } + else + { + // wipe out the user state when we're going to redirect + $app->setUserState('com_###component###.redirect_url', ''); + $app->setUserState('com_###component###.message', ''); + $app->setUserState('com_###component###.extension_message', ''); + } + $this->setRedirect($redirect_url); + } +} diff --git a/admin/compiler/joomla_4/ADMIN_IMPORT_HTML.php b/admin/compiler/joomla_4/ADMIN_IMPORT_HTML.php new file mode 100644 index 000000000..87dee6372 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_IMPORT_HTML.php @@ -0,0 +1,110 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\View\Import; + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; +use Joomla\CMS\Toolbar\ToolbarHelper; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper\###Component###Helper; + +// No direct access to this file +\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +/** + * ###Component### Import Html View + * + * @since 1.6 + */ +class HtmlView extends BaseHtmlView +{ + protected $headerList; + protected $hasPackage = false; + protected $headers; + protected $hasHeader = 0; + protected $dataType; + + /** + * Display the view + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return void + * @since 1.6 + */ + public function display($tpl = null) + { + $paths = new \StdClass; + $paths->first = ''; + $state = $this->get('state'); + + $this->paths = &$paths; + $this->state = &$state; + // get global action permissions + $this->canDo = ###Component###Helper::getActions('import'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + } + + // get the session object + $session = Factory::getSession(); + // check if it has package + $this->hasPackage = $session->get('hasPackage', false); + $this->dataType = $session->get('dataType', false); + if($this->hasPackage && $this->dataType) + { + $this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true); + $this->headers = ###Component###Helper::getFileHeaders($this->dataType); + // clear the data type + $session->clear('dataType'); + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new \Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + } + + /** + * Add the page title and toolbar. + * + * @return void + * @since 1.6 + */ + protected function addToolbar(): void + { + ToolbarHelper::title(Text::_('COM_###COMPONENT###_IMPORT_TITLE'), 'upload'); + + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + ToolbarHelper::preferences('com_###component###'); + } + + // set help url for this view if found + $this->help_url = ###Component###Helper::getHelpUrl('import'); + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) + { + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + } + } +} diff --git a/admin/compiler/joomla_4/ADMIN_IMPORT_HTML_CUSTOM.php b/admin/compiler/joomla_4/ADMIN_IMPORT_HTML_CUSTOM.php new file mode 100644 index 000000000..7265d0600 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_IMPORT_HTML_CUSTOM.php @@ -0,0 +1,60 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\View\###View###Import; + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; +use Joomla\CMS\Toolbar\ToolbarHelper; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper\###Component###Helper; + +// No direct access to this file +\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +/** + * ###Component### ###View### Html View + * + * @since 1.6 + */ +class HtmlView extends BaseHtmlView +{###IMPORT_DISPLAY_METHOD_CUSTOM### + + /** + * Add the page title and toolbar. + * + * @return void + * @since 1.6 + */ + protected function addToolbar(): void + { + ToolbarHelper::title(Text::_('COM_###COMPONENT###_IMPORT_TITLE'), 'upload'); + + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + ToolbarHelper::preferences('com_###component###'); + } + + // set help url for this view if found + $this->help_url = ###Component###Helper::getHelpUrl('###view###'); + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) + { + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + } + } +} diff --git a/admin/compiler/joomla_4/ADMIN_IMPORT_MODEL.php b/admin/compiler/joomla_4/ADMIN_IMPORT_MODEL.php new file mode 100644 index 000000000..70efddb07 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_IMPORT_MODEL.php @@ -0,0 +1,460 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Model; + +###IMPORT_MODEL_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/*** + * ###Component### Import Base Database Model + * + * @since 1.6 + */ +class ImportModel extends BaseDatabaseModel +{ + // set uploading values + protected $use_streams = false; + protected $allow_unsafe = false; + protected $safeFileOptions = []; + + /** + * @var object JTable object + */ + protected $_table = null; + + /** + * @var object JTable object + */ + protected $_url = null; + + /** + * Model context string. + * + * @var string + */ + protected $_context = 'com_###component###.import'; + + /** + * Import Settings + */ + protected $getType = NULL; + protected $dataType = NULL; + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @return void + * + */ + protected function populateState() + { + $app = Factory::getApplication('administrator'); + + $this->setState('message', $app->getUserState('com_###component###.message')); + $app->setUserState('com_###component###.message', ''); + + // Recall the 'Import from Directory' path. + $path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path')); + $this->setState('import.directory', $path); + parent::populateState(); + } + + /** + * Import an spreadsheet from either folder, url or upload. + * + * @return boolean result of import + * + */ + public function import() + { + $this->setState('action', 'import'); + $app = Factory::getApplication(); + $session = Factory::getSession(); + $package = null; + $continue = false; + // get import type + $this->getType = $app->input->getString('gettype', NULL); + // get import type + $this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL); + + if ($package === null) + { + switch ($this->getType) + { + case 'folder': + // Remember the 'Import from Directory' path. + $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory'); + $package = $this->_getPackageFromFolder(); + break; + + case 'upload': + $package = $this->_getPackageFromUpload(); + break; + + case 'url': + $package = $this->_getPackageFromUrl(); + break; + + case 'continue': + $continue = true; + $package = $session->get('package', null); + $package = json_decode($package, true); + // clear session + $session->clear('package'); + $session->clear('dataType'); + $session->clear('hasPackage'); + break; + + default: + $app->setUserState('com_###component###.message', Text::_('COM_###COMPONENT###_IMPORT_NO_IMPORT_TYPE_FOUND')); + + return false; + break; + } + } + // Was the package valid? + if (!$package || !$package['type']) + { + if (in_array($this->getType, array('upload', 'url'))) + { + $this->remove($package['packagename']); + } + + $app->setUserState('com_###component###.message', Text::_('COM_###COMPONENT###_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); + return false; + } + + // first link data to table headers + if(!$continue){ + $package = json_encode($package); + $session->set('package', $package); + $session->set('dataType', $this->dataType); + $session->set('hasPackage', true); + return true; + } + + // set the data + $headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false), true); + if (!$this->setData($package,$this->dataType,$headerList)) + { + // There was an error importing the package + $msg = Text::_('COM_###COMPONENT###_IMPORT_ERROR'); + $back = $session->get('backto_VDM_IMPORT', NULL); + if ($back) + { + $app->setUserState('com_###component###.redirect_url', 'index.php?option=com_###component###&view='.$back); + $session->clear('backto_VDM_IMPORT'); + } + $result = false; + } + else + { + // Package imported sucessfully + $msg = Text::sprintf('COM_###COMPONENT###_IMPORT_SUCCESS', $package['packagename']); + $back = $session->get('backto_VDM_IMPORT', NULL); + if ($back) + { + $app->setUserState('com_###component###.redirect_url', 'index.php?option=com_###component###&view='.$back); + $session->clear('backto_VDM_IMPORT'); + } + $result = true; + } + + // Set some model state values + $app->enqueueMessage($msg); + + // remove file after import + $this->remove($package['packagename']); + $session->clear($this->getType.'_VDM_IMPORTHEADERS'); + + return $result; + } + + /** + * Works out an importation spreadsheet from a HTTP upload + * + * @return spreadsheet definition or false on failure + */ + protected function _getPackageFromUpload() + { + // Get the uploaded file information + $app = Factory::getApplication(); + $input = $app->input; + + // Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get. + $userfile = $input->files->get('import_package', null, 'raw'); + + // Make sure that file uploads are enabled in php + if (!(bool) ini_get('file_uploads')) + { + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); + return false; + } + + // If there is no uploaded file, we have a problem... + if (!is_array($userfile)) + { + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); + return false; + } + + // Check if there was a problem uploading the file. + if ($userfile['error'] || $userfile['size'] < 1) + { + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); + return false; + } + + // Build the appropriate paths + $config = Factory::getConfig(); + $tmp_dest = $config->get('tmp_path') . '/' . $userfile['name']; + $tmp_src = $userfile['tmp_name']; + + // Move uploaded file + $p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); + + // Was the package downloaded? + if (!$p_file) + { + $session = Factory::getSession(); + $session->clear('package'); + $session->clear('dataType'); + $session->clear('hasPackage'); + // was not uploaded + return false; + } + + // check that this is a valid spreadsheet + $package = $this->check($userfile['name']); + + return $package; + } + + /** + * Import an spreadsheet from a directory + * + * @return array Spreadsheet details or false on failure + * + */ + protected function _getPackageFromFolder() + { + $app = Factory::getApplication(); + $input = $app->input; + + // Get the path to the package to import + $p_dir = $input->getString('import_directory'); + $p_dir = Path::clean($p_dir); + // Did you give us a valid path? + if (!file_exists($p_dir)) + { + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); + return false; + } + + // Detect the package type + $type = $this->getType; + + // Did you give us a valid package? + if (!$type) + { + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); + } + + // check the extention + if(!$this->checkExtension($p_dir)) + { + // set error message + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + return false; + } + + $package['packagename'] = null; + $package['dir'] = $p_dir; + $package['type'] = $type; + + return $package; + } + + /** + * Import an spreadsheet from a URL + * + * @return Package details or false on failure + * + */ + protected function _getPackageFromUrl() + { + $app = Factory::getApplication(); + $input = $app->input; + + // Get the URL of the package to import + $url = $input->getString('import_url'); + + // Did you give us a URL? + if (!$url) + { + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_ENTER_A_URL'), 'warning'); + return false; + } + + // Download the package at the URL given + $p_file = InstallerHelper::downloadPackage($url); + + // Was the package downloaded? + if (!$p_file) + { + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_INVALID_URL'), 'warning'); + return false; + } + + // check that this is a valid spreadsheet + $package = $this->check($p_file); + + return $package; + } + + /** + * Check a file and verifies it as a spreadsheet file + * Supports .csv .xlsx .xls and .ods + * + * @param string $p_filename The uploaded package filename or import directory + * + * @return array of elements + * + */ + protected function check($archivename) + { + $app = Factory::getApplication(); + // Clean the name + $archivename = Path::clean($archivename); + + // check the extention + if(!$this->checkExtension($archivename)) + { + // Cleanup the import files + $this->remove($archivename); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + return false; + } + + $config = Factory::getConfig(); + // set Package Name + $check['packagename'] = $archivename; + + // set directory + $check['dir'] = $config->get('tmp_path'). '/' .$archivename; + + // set type + $check['type'] = $this->getType; + + return $check; + }###IMPORT_EXT_METHOD### + + /** + * Clean up temporary uploaded spreadsheet + * + * @param string $package Name of the uploaded spreadsheet file + * + * @return boolean True on success + * + */ + protected function remove($package) + { + jimport('joomla.filesystem.file'); + + $config = Factory::getConfig(); + $package = $config->get('tmp_path'). '/' .$package; + + // Is the package file a valid file? + if (is_file($package)) + { + File::delete($package); + } + elseif (is_file(Path::clean($package))) + { + // It might also be just a base filename + File::delete(Path::clean($package)); + } + }###IMPORT_SETDATA_METHOD######IMPORT_SAVE_METHOD### + + protected function getAlias($name,$type = false) + { + // sanitize the name to an alias + if (Factory::getConfig()->get('unicodeslugs') == 1) + { + $alias = OutputFilter::stringURLUnicodeSlug($name); + } + else + { + $alias = OutputFilter::stringURLSafe($name); + } + // must be a uniqe alias + if ($type) + { + return $this->getUniqe($alias,'alias',$type); + } + return $alias; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * @param string $type table. + * + * @return string New value. + */ + protected function getUniqe($value,$field,$type) + { + // insure the filed is always uniqe + while (isset($this->uniqeValueArray[$type][$field][$value])) + { + $value = StringHelper::increment($value, 'dash'); + } + $this->uniqeValueArray[$type][$field][$value] = $value; + return $value; + } + + protected function getAliasesUsed($table) + { + // Get a db connection. + $db = $this->getDatabase(); + // first we check if there is a alias column + $columns = $db->getTableColumns('#__###component###_'.$table); + if(isset($columns['alias'])){ + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array('alias'))); + $query->from($db->quoteName('#__###component###_'.$table)); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $aliases = $db->loadColumn(); + foreach($aliases as $alias) + { + $this->uniqeValueArray[$table]['alias'][$alias] = $alias; + } + } + return true; + } + return false; + } +} diff --git a/admin/compiler/joomla_4/ADMIN_IMPORT_MODEL_CUSTOM.php b/admin/compiler/joomla_4/ADMIN_IMPORT_MODEL_CUSTOM.php new file mode 100644 index 000000000..7b3b58651 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_IMPORT_MODEL_CUSTOM.php @@ -0,0 +1,351 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Model; + +###IMPORT_CUSTOM_MODEL_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### ###View### Base Database Model + * + * @since 1.6 + */ +class ###View###importModel extends BaseDatabaseModel +{ + // set uploading values + protected $use_streams = false; + protected $allow_unsafe = false; + protected $safeFileOptions = []; + + /** + * @var object JTable object + */ + protected $_table = null; + + /** + * @var object JTable object + */ + protected $_url = null; + + /** + * Model context string. + * + * @var string + */ + protected $_context = 'com_###component###.###view###'; + + /** + * Import Settings + */ + protected $getType = NULL; + protected $dataType = NULL; + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @return void + * + */ + protected function populateState() + { + $app = Factory::getApplication('administrator'); + + $this->setState('message', $app->getUserState('com_###component###.message')); + $app->setUserState('com_###component###.message', ''); + + // Recall the 'Import from Directory' path. + $path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path')); + $this->setState('import.directory', $path); + parent::populateState(); + } + ###IMPORT_METHOD_CUSTOM### + + /** + * Works out an importation spreadsheet from a HTTP upload + * + * @return spreadsheet definition or false on failure + */ + protected function _getPackageFromUpload() + { + // Get the uploaded file information + $app = Factory::getApplication(); + $input = $app->input; + + // Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get. + $userfile = $input->files->get('import_package', null, 'raw'); + + // Make sure that file uploads are enabled in php + if (!(bool) ini_get('file_uploads')) + { + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); + return false; + } + + // If there is no uploaded file, we have a problem... + if (!is_array($userfile)) + { + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); + return false; + } + + // Check if there was a problem uploading the file. + if ($userfile['error'] || $userfile['size'] < 1) + { + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); + return false; + } + + // Build the appropriate paths + $config = Factory::getConfig(); + $tmp_dest = $config->get('tmp_path') . '/' . $userfile['name']; + $tmp_src = $userfile['tmp_name']; + + // Move uploaded file + $p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); + + // Was the package downloaded? + if (!$p_file) + { + $session = Factory::getSession(); + $session->clear('package'); + $session->clear('dataType'); + $session->clear('hasPackage'); + // was not uploaded + return false; + } + + // check that this is a valid spreadsheet + $package = $this->check($userfile['name']); + + return $package; + } + + /** + * Import an spreadsheet from a directory + * + * @return array Spreadsheet details or false on failure + * + */ + protected function _getPackageFromFolder() + { + $app = Factory::getApplication(); + $input = $app->input; + + // Get the path to the package to import + $p_dir = $input->getString('import_directory'); + $p_dir = Path::clean($p_dir); + // Did you give us a valid path? + if (!file_exists($p_dir)) + { + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); + return false; + } + + // Detect the package type + $type = $this->getType; + + // Did you give us a valid package? + if (!$type) + { + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); + } + + // check the extention + if(!$this->checkExtension($p_dir)) + { + // set error message + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + return false; + } + + $package['packagename'] = null; + $package['dir'] = $p_dir; + $package['type'] = $type; + + return $package; + } + + /** + * Import an spreadsheet from a URL + * + * @return Package details or false on failure + * + */ + protected function _getPackageFromUrl() + { + $app = Factory::getApplication(); + $input = $app->input; + + // Get the URL of the package to import + $url = $input->getString('import_url'); + + // Did you give us a URL? + if (!$url) + { + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_ENTER_A_URL'), 'warning'); + return false; + } + + // Download the package at the URL given + $p_file = InstallerHelper::downloadPackage($url); + + // Was the package downloaded? + if (!$p_file) + { + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_INVALID_URL'), 'warning'); + return false; + } + + // check that this is a valid spreadsheet + $package = $this->check($p_file); + + return $package; + } + + /** + * Check a file and verifies it as a spreadsheet file + * Supports .csv .xlsx .xls and .ods + * + * @param string $p_filename The uploaded package filename or import directory + * + * @return array of elements + * + */ + protected function check($archivename) + { + $app = Factory::getApplication(); + // Clean the name + $archivename = Path::clean($archivename); + + // check the extention + if(!$this->checkExtension($archivename)) + { + // Cleanup the import files + $this->remove($archivename); + $app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + return false; + } + + $config = Factory::getConfig(); + // set Package Name + $check['packagename'] = $archivename; + + // set directory + $check['dir'] = $config->get('tmp_path'). '/' .$archivename; + + // set type + $check['type'] = $this->getType; + + return $check; + } + ###IMPORT_EXT_METHOD### + + /** + * Clean up temporary uploaded spreadsheet + * + * @param string $package Name of the uploaded spreadsheet file + * + * @return boolean True on success + * + */ + protected function remove($package) + { + $config = Factory::getConfig(); + $package = $config->get('tmp_path'). '/' .$package; + + // Is the package file a valid file? + if (is_file($package)) + { + File::delete($package); + } + elseif (is_file(Path::clean($package))) + { + // It might also be just a base filename + File::delete(Path::clean($package)); + } + } + ###IMPORT_SETDATA_METHOD### + ###IMPORT_SAVE_METHOD### + + protected function getAlias($name,$type = false) + { + // sanitize the name to an alias + if (Factory::getConfig()->get('unicodeslugs') == 1) + { + $alias = OutputFilter::stringURLUnicodeSlug($name); + } + else + { + $alias = OutputFilter::stringURLSafe($name); + } + // must be a uniqe alias + if ($type) + { + return $this->getUniqe($alias,'alias',$type); + } + return $alias; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * @param string $type table. + * + * @return string New value. + */ + protected function getUniqe($value,$field,$type) + { + // insure the filed is always uniqe + while (isset($this->uniqeValueArray[$type][$field][$value])) + { + $value = StringHelper::increment($value, 'dash'); + } + $this->uniqeValueArray[$type][$field][$value] = $value; + return $value; + } + + protected function getAliasesUsed($table) + { + // Get a db connection. + $db = $this->getDatabase(); + // first we check if there is a alias column + $columns = $db->getTableColumns('#__###component###_'.$table); + if(isset($columns['alias'])){ + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array('alias'))); + $query->from($db->quoteName('#__###component###_'.$table)); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $aliases = $db->loadColumn(); + foreach($aliases as $alias) + { + $this->uniqeValueArray[$table]['alias'][$alias] = $alias; + } + } + return true; + } + return false; + } +} diff --git a/admin/compiler/joomla_4/ADMIN_LAYOUT.php b/admin/compiler/joomla_4/ADMIN_LAYOUT.php new file mode 100644 index 000000000..857ae2766 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_LAYOUT.php @@ -0,0 +1,22 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +###ADMIN_LAYOUT_HEADER### + +// No direct access to this file +defined('JPATH_BASE') or die;###ADMIN_LAYOUT_CODE### + +?>###ADMIN_LAYOUT_BODY### diff --git a/admin/compiler/joomla_4/ADMIN_PROVIDER.php b/admin/compiler/joomla_4/ADMIN_PROVIDER.php new file mode 100644 index 000000000..4bd2aa763 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_PROVIDER.php @@ -0,0 +1,83 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +// The power autoloader for this project admin area. +$power_autoloader = JPATH_ADMINISTRATOR . '/components/com_###component###/src/Helper/PowerloaderHelper.php'; +if (file_exists($power_autoloader)) +{ + require_once $power_autoloader; +} + +// (soon) use Joomla\CMS\Association\AssociationExtensionInterface; +use Joomla\CMS\Categories\CategoryFactoryInterface; +use Joomla\CMS\Component\Router\RouterFactoryInterface; +use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; +use Joomla\CMS\Extension\ComponentInterface; +use Joomla\CMS\Extension\Service\Provider\CategoryFactory; +use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory; +use Joomla\CMS\Extension\Service\Provider\MVCFactory; +use Joomla\CMS\Extension\Service\Provider\RouterFactory; +use Joomla\CMS\HTML\Registry; +use Joomla\CMS\MVC\Factory\MVCFactoryInterface; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Extension\###Component###Component; +// (soon) use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper\AssociationsHelper; +use Joomla\DI\Container; +use Joomla\DI\ServiceProviderInterface; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * The ###NAMESPACEPREFIX### ###Component### service provider. + * + * @since 4.0.0 + */ +return new class () implements ServiceProviderInterface +{ + /** + * Registers the service provider with a DI container. + * + * @param Container $container The DI container. + * + * @return void + * + * @since 4.0.0 + */ + public function register(Container $container) + { + // (soon) $container->set(AssociationExtensionInterface::class, new AssociationsHelper()); + + $container->registerServiceProvider(new CategoryFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###')); + $container->registerServiceProvider(new MVCFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###')); + $container->registerServiceProvider(new ComponentDispatcherFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###')); + $container->registerServiceProvider(new RouterFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###')); + + $container->set( + ComponentInterface::class, + function (Container $container) { + $component = new ###Component###Component($container->get(ComponentDispatcherFactoryInterface::class)); + + $component->setRegistry($container->get(Registry::class)); + $component->setMVCFactory($container->get(MVCFactoryInterface::class)); + $component->setCategoryFactory($container->get(CategoryFactoryInterface::class)); + // (soon) $component->setAssociationExtension($container->get(AssociationExtensionInterface::class)); + $component->setRouterFactory($container->get(RouterFactoryInterface::class)); + + return $component; + } + ); + } +}; diff --git a/admin/compiler/joomla_4/ADMIN_VIEW.php b/admin/compiler/joomla_4/ADMIN_VIEW.php new file mode 100644 index 000000000..1790e1989 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_VIEW.php @@ -0,0 +1,27 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +###ADMIN_VIEW_HEADER### + +// No direct access to this file +defined('_JEXEC') or die; + +?> +###EDITBODYFADEIN### +

+###EDITBODY### +
+
###EDITBODYSCRIPT### diff --git a/admin/compiler/joomla_4/ADMIN_VIEWS.php b/admin/compiler/joomla_4/ADMIN_VIEWS.php new file mode 100644 index 000000000..90dd4a345 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_VIEWS.php @@ -0,0 +1,28 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +###ADMIN_VIEWS_HEADER### + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_###component###&task=###views###.saveOrderAjax&tmpl=component'; + Html::_('sortablelist.sortable', '###view###List', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +###VIEWS_DEFAULT_BODY######VIEWS_FOOTER_SCRIPT### diff --git a/admin/compiler/joomla_4/ADMIN_VIEWS_CONTROLLER.php b/admin/compiler/joomla_4/ADMIN_VIEWS_CONTROLLER.php new file mode 100644 index 000000000..28bede844 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_VIEWS_CONTROLLER.php @@ -0,0 +1,53 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Controller; + +###ADMIN_VIEWS_CONTROLLER_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Views### Admin Controller + * + * @since 1.6 + */ +class ###Views###Controller extends AdminController +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_###COMPONENT###_###VIEWS###'; + + /** + * Proxy for getModel. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return \Joomla\CMS\MVC\Model\BaseDatabaseModel + * + * @since 1.6 + */ + public function getModel($name = '###View###', $prefix = 'Administrator', $config = ['ignore_request' => true]) + { + return parent::getModel($name, $prefix, $config); + }###CONTROLLEREXIMPORTMETHOD######CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER######ADMIN_CUSTOM_BUTTONS_CONTROLLER_LIST### +} \ No newline at end of file diff --git a/admin/compiler/joomla_4/ADMIN_VIEWS_EMPTYSTATE.php b/admin/compiler/joomla_4/ADMIN_VIEWS_EMPTYSTATE.php new file mode 100644 index 000000000..7169372a0 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_VIEWS_EMPTYSTATE.php @@ -0,0 +1,33 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Layout\LayoutHelper; + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +$displayData = [ + 'textPrefix' => 'COM_###COMPONENT###_###VIEWS###', + 'formURL' => 'index.php?option=com_###component###&view=###views###', + 'icon' => 'icon-###ICOMOON###', +]; + +if ($this->user->authorise('###view###.create', 'com_###component###')) +{ + $displayData['createURL'] = 'index.php?option=com_###component###&task=###view###.add'; +} + +echo LayoutHelper::render('joomla.content.emptystate', $displayData); diff --git a/admin/compiler/joomla_4/ADMIN_VIEWS_HTML.php b/admin/compiler/joomla_4/ADMIN_VIEWS_HTML.php new file mode 100644 index 000000000..2ae71fed7 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_VIEWS_HTML.php @@ -0,0 +1,188 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\View\###Views###; + +###ADMIN_VIEWS_HTML_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +/** + * ###Component### Html View class for the ###Views### + * + * @since 1.6 + */ +class HtmlView extends BaseHtmlView +{ + /** + * ###Views### view display method + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return void + * @since 1.6 + */ + public function display($tpl = null) + { + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->styles = $this->get('Styles'); + $this->scripts = $this->get('Scripts'); + $this->user ??= Factory::getApplication()->getIdentity();###ADMIN_DIPLAY_METHOD### + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); + // get global action permissions + $this->canDo = ###Component###Helper::getActions('###view###');###JVIEWLISTCANDO### + + // If we don't have items we load the empty state + if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState')) + { + $this->setLayout('emptystate'); + } + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new \Exception(implode("\n", $errors), 500); + } + + // Set the html view document stuff + $this->_prepareDocument(); + + // Display the template + parent::display($tpl); + } + + /** + * Add the page title and toolbar. + * + * @return void + * @since 1.6 + */ + protected function addToolbar(): void + { + ToolbarHelper::title(Text::_('COM_###COMPONENT###_###VIEWS###'), '###ICOMOON###'); + + if ($this->canCreate) + { + ToolbarHelper::addNew('###view###.add'); + } + + // Only load if there are items + if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($this->items)) + { + if ($this->canEdit) + { + ToolbarHelper::editList('###view###.edit'); + } + + if ($this->canState) + { + ToolbarHelper::publishList('###views###.publish'); + ToolbarHelper::unpublishList('###views###.unpublish'); + ToolbarHelper::archiveList('###views###.archive'); + + if ($this->canDo->get('core.admin')) + { + ToolbarHelper::checkin('###views###.checkin'); + } + }###CUSTOM_ADMIN_DYNAMIC_BUTTONS######ADMIN_CUSTOM_BUTTONS_LIST### + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + ToolbarHelper::deleteList('', '###views###.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + ToolbarHelper::trash('###views###.trash'); + }###EXPORTBUTTON### + }###ADMIN_CUSTOM_FUNCTION_ONLY_BUTTONS_LIST######IMPORTBUTTON### + + // set help url for this view if found + $this->help_url = ###Component###Helper::getHelpUrl('###views###'); + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) + { + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + ToolbarHelper::preferences('com_###component###'); + }###FILTERFIELDDISPLAYHELPER######BATCHDISPLAYHELPER### + } + + /** + * Prepare some document related stuff. + * + * @return void + * @since 1.6 + */ + protected function _prepareDocument(): void + {###JQUERY### + $this->getDocument()->setTitle(Text::_('COM_###COMPONENT###_###VIEWS###')); + // add styles + foreach ($this->styles as $style) + { + Html::_('stylesheet', $style, ['version' => 'auto']); + } + // add scripts + foreach ($this->scripts as $script) + { + Html::_('script', $script, ['version' => 'auto']); + }###ADMIN_ADD_JAVASCRIPT_FILE### + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * @param bool $shorten The switch to shorten. + * @param int $length The shorting length. + * + * @return mixed The escaped value. + * @since 1.6 + */ + public function escape($var, bool $shorten = true, int $length = 50) + { + if (!is_string($var)) + { + return $var; + } + + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array containing the field name to sort by as the key and display text as value + * @since 1.6 + */ + protected function getSortFields() + { + ###SORTFIELDS### + }###FILTERFUNCTIONS### +} diff --git a/admin/compiler/joomla_4/ADMIN_VIEWS_MODEL.php b/admin/compiler/joomla_4/ADMIN_VIEWS_MODEL.php new file mode 100644 index 000000000..7431385d4 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_VIEWS_MODEL.php @@ -0,0 +1,189 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Model; + +###ADMIN_VIEWS_MODEL_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Views### List Model + * + * @since 1.6 + */ +class ###Views###Model extends ListModel +{ + /** + * The application object. + * + * @var CMSApplicationInterface The application instance. + * @since 3.2.0 + */ + protected CMSApplicationInterface $app; + + /** + * The styles array. + * + * @var array + * @since 4.3 + */ + protected array $styles = [ + 'administrator/components/com_###component###/assets/css/admin.css', + 'administrator/components/com_###component###/assets/css/###views###.css' + ]; + + /** + * The scripts array. + * + * @var array + * @since 4.3 + */ + protected array $scripts = [ + 'administrator/components/com_###component###/assets/js/admin.js' + ]; + + /** + * Constructor + * + * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). + * @param ?MVCFactoryInterface $factory The factory. + * + * @since 1.6 + * @throws \Exception + */ + public function __construct($config = [], MVCFactoryInterface $factory = null) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + ###FILTER_FIELDS### + ); + } + + parent::__construct($config, $factory); + + $this->app ??= Factory::getApplication(); + }###ADMIN_CUSTOM_BUTTONS_METHOD_LIST### + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * @since 1.7.0 + */ + protected function populateState($ordering = null, $direction = null) + { + $app = $this->app; + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + }###POPULATESTATE### + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + * @since 1.6 + */ + public function getItems() + {###LICENSE_LOCKED_CHECK######CHECKINCALL### + // load parent items + $items = parent::getItems();###GET_ITEMS_METHOD_STRING_FIX######SELECTIONTRANSLATIONFIX######GET_ITEMS_METHOD_AFTER_ALL### + + // return items + return $items; + }###SELECTIONTRANSLATIONFIXFUNC### + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + * @since 1.6 + */ + protected function getListQuery() + {###LICENSE_LOCKED_CHECK### + ###LISTQUERY### + }###MODELEXPORTMETHOD######LICENSE_LOCKED_SET_BOOL### + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * @since 1.6 + */ + protected function getStoreId($id = '') + { + ###STOREDID### + + return parent::getStoreId($id); + } + + /** + * Method to get the styles that have to be included on the view + * + * @return array styles files + * @since 4.3 + */ + public function getStyles(): array + { + return $this->styles; + } + + /** + * Method to set the styles that have to be included on the view + * + * @return void + * @since 4.3 + */ + public function setStyles(string $path): void + { + $this->styles[] = $path; + } + + /** + * Method to get the script that have to be included on the view + * + * @return array script files + * @since 4.3 + */ + public function getScripts(): array + { + return $this->scripts; + } + + /** + * Method to set the script that have to be included on the view + * + * @return void + * @since 4.3 + */ + public function setScript(string $path): void + { + $this->scripts[] = $path; + }###AUTOCHECKIN### +} diff --git a/admin/compiler/joomla_4/ADMIN_VIEW_CONTROLLER.php b/admin/compiler/joomla_4/ADMIN_VIEW_CONTROLLER.php new file mode 100644 index 000000000..f5150bf72 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_VIEW_CONTROLLER.php @@ -0,0 +1,274 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Controller; + +###ADMIN_VIEW_CONTROLLER_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###View### Form Controller + * + * @since 1.6 + */ +class ###View###Controller extends FormController +{ + use VersionableControllerTrait; + + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_###COMPONENT###_###VIEW###'; + + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * The URL view list variable. + * + * @var string + * @since 1.6 + */ + protected $view_list = '###views###';###ADMIN_CUSTOM_BUTTONS_CONTROLLER### + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = []) + {###JCONTROLLERFORM_ALLOWADD### + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = [], $key = 'id') + {###JCONTROLLERFORM_ALLOWEDIT### + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string) $ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('###View###', '', []); + + // Preset the redirect + $this->setRedirect(Route::_('index.php?option=com_###component###&view=###views###' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64');###JCONTROLLERFORM_BEFORECANCEL### + + $cancel = parent::cancel($key); + + if (!is_null($return) && Uri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + Route::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + }###JCONTROLLERFORM_AFTERCANCEL### + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + Route::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; + + // Redirect to the item screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string) $this->ref; + + // Redirect to the list screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) + {###POSTSAVEHOOK### + } +} diff --git a/admin/compiler/joomla_4/ADMIN_VIEW_HTML.php b/admin/compiler/joomla_4/ADMIN_VIEW_HTML.php new file mode 100644 index 000000000..5e4b702cf --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_VIEW_HTML.php @@ -0,0 +1,144 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\View\###View###; + +###ADMIN_VIEW_HTML_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +/** + * ###View### Html View class + * + * @since 1.6 + */ +class HtmlView extends BaseHtmlView +{ + /** + * ###View### view display method + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return void + * @since 1.6 + */ + public function display($tpl = null) + { + // set params + $this->params = ComponentHelper::getParams('com_###component###'); + $this->useCoreUI = true; + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->styles = $this->get('Styles'); + $this->scripts = $this->get('Scripts'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = ###Component###Helper::getActions('###view###', $this->item); + // get input + $jinput = Factory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string) $this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string) $return; + }###LINKEDVIEWITEMS### + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new \Exception(implode("\n", $errors), 500); + } + + // Set the html view document stuff + $this->_prepareDocument(); + + // Display the template + parent::display($tpl); + } + + + /** + * Add the page title and toolbar. + * + * @return void + * @since 1.6 + */ + protected function addToolbar(): void + { + ###ADDTOOLBAR### + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * @param bool $shorten The switch to shorten. + * @param int $length The shorting length. + * + * @return mixed The escaped value. + * @since 1.6 + */ + public function escape($var, bool $shorten = true, int $length = 30) + { + if (!is_string($var)) + { + return $var; + } + + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length); + } + + /** + * Prepare some document related stuff. + * + * @return void + * @since 1.6 + */ + protected function _prepareDocument(): void + {###JQUERY### + $isNew = ($this->item->id < 1); + $this->getDocument()->setTitle(Text::_($isNew ? 'COM_###COMPONENT###_###VIEW###_NEW' : 'COM_###COMPONENT###_###VIEW###_EDIT')); + // add styles + foreach ($this->styles as $style) + { + Html::_('stylesheet', $style, ['version' => 'auto']); + }###AJAXTOKE######LINKEDVIEWTABLESCRIPTS### + // add scripts + foreach ($this->scripts as $script) + { + Html::_('script', $script, ['version' => 'auto']); + }###DOCUMENT_CUSTOM_PHP### + } +} diff --git a/admin/compiler/joomla_4/ADMIN_VIEW_MODEL.php b/admin/compiler/joomla_4/ADMIN_VIEW_MODEL.php new file mode 100644 index 000000000..b425ecfb7 --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_VIEW_MODEL.php @@ -0,0 +1,491 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Model; + +###ADMIN_VIEW_MODEL_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### ###View### Admin Model + * + * @since 1.6 + */ +class ###View###Model extends AdminModel +{ + use VersionableModelTrait; + + /** + * The tab layout fields array. + * + * @var array + * @since 3.0.0 + */ + protected $tabLayoutFields = ###TABLAYOUTFIELDSARRAY###; + + /** + * The styles array. + * + * @var array + * @since 4.3 + */ + protected array $styles = [ + 'administrator/components/com_###component###/assets/css/admin.css', + 'administrator/components/com_###component###/assets/css/###view###.css' + ]; + + /** + * The scripts array. + * + * @var array + * @since 4.3 + */ + protected array $scripts = [ + 'administrator/components/com_###component###/assets/js/admin.js', + 'media/com_###component###/js/###view###.js' + ]; + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_###COMPONENT###'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_###component###.###view###'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return Table A database object + * @since 3.0 + * @throws \Exception + */ + public function getTable($type = '###view###', $prefix = 'Administrator', $config = []) + { + // get instance of the table + return parent::getTable($type, $prefix, $config); + }###ADMIN_CUSTOM_BUTTONS_METHOD### + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * @since 1.6 + */ + public function getItem($pk = null) + {###LICENSE_LOCKED_CHECK### + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + }###METHOD_GET_ITEM### + }###LINKEDVIEWGLOBAL### + + return $item; + }###LINKEDVIEWMETHODS######LICENSE_LOCKED_SET_BOOL### + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return Form|boolean A Form object on success, false on failure + * @since 1.6 + */ + public function getForm($data = [], $loadData = true, $options = ['control' => 'jform']) + { + // set load data option + $options['load_data'] = $loadData;###JMODELADMIN_GETFORM### + } + + /** + * Method to get the styles that have to be included on the view + * + * @return array styles files + * @since 4.3 + */ + public function getStyles(): array + { + return $this->styles; + } + + /** + * Method to set the styles that have to be included on the view + * + * @return void + * @since 4.3 + */ + public function setStyles(string $path): void + { + $this->styles[] = $path; + } + + /** + * Method to get the script that have to be included on the view + * + * @return array script files + * @since 4.3 + */ + public function getScripts(): array + { + return $this->scripts; + } + + /** + * Method to set the script that have to be included on the view + * + * @return void + * @since 4.3 + */ + public function setScript(string $path): void + { + $this->scripts[] = $path; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * @since 1.6 + */ + protected function canDelete($record) + {###JMODELADMIN_CANDELETE### + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * @since 1.6 + */ + protected function canEditState($record) + {###JMODELADMIN_CANEDITSTATE### + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = [], $key = 'id') + {###JMODELADMIN_ALLOWEDIT### + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param Table $table A Table object. + * + * @return void + * @since 1.6 + */ + protected function prepareTable($table) + {###LICENSE_TABLE_LOCKED_CHECK### + $date = Factory::getDate(); + $user = $this->getCurrentUser(); + + if (isset($table->name)) + { + $table->name = \htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = $this->getDatabase(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__###component###_###view###')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = Factory::getApplication()->getUserState('com_###component###.edit.###view###.data', []); + + if (empty($data)) + { + $data = $this->getItem(); + } + + // run the perprocess of the data + $this->preprocessData('com_###component###.###view###', $data); + + return $data; + }###VALIDATIONFIX######UNIQUEFIELDS### + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs + * @since 12.2 + */ + public function delete(&$pks) + {###JMODELADMIN_BEFORE_DELETE### + if (!parent::delete($pks)) + { + return false; + }###JMODELADMIN_AFTER_DELETE### + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + {###JMODELADMIN_BEFORE_PUBLISH### + if (!parent::publish($pks, $value)) + { + return false; + }###JMODELADMIN_AFTER_PUBLISH### + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user ??= $this->getCurrentUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ###Component###Helper::getActions('###view###'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new UCMType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + }###MODEL_BATCH_COPY######MODEL_BATCH_MOVE### + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * @since 1.6 + */ + public function save($data) + { + $input = Factory::getApplication()->getInput(); + $filter = InputFilter::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new Registry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + }###CHECKBOX_SAVE######METHOD_ITEM_SAVE### + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new Registry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + }###TITLEALIASFIX### + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * @since 3.0 + */ + protected function generateUnique($field, $value) + { + // set field value unique + $table = $this->getTable(); + + while ($table->load([$field => $value])) + { + $value = StringHelper::increment($value); + } + + return $value; + }###GENERATENEWTITLE### +} diff --git a/admin/compiler/joomla_4/ADMIN_VIEW_TABLE.php b/admin/compiler/joomla_4/ADMIN_VIEW_TABLE.php new file mode 100644 index 000000000..0a38769fe --- /dev/null +++ b/admin/compiler/joomla_4/ADMIN_VIEW_TABLE.php @@ -0,0 +1,372 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Table; + +use Joomla\CMS\Factory; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Language\Text; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; +use Joomla\CMS\Tag\TaggableTableInterface; +use Joomla\CMS\Tag\TaggableTableTrait; +use Joomla\CMS\User\CurrentUserInterface; +use Joomla\CMS\User\CurrentUserTrait; +use Joomla\CMS\Versioning\VersionableTableInterface; +use Joomla\CMS\Application\ApplicationHelper; +use Joomla\Database\DatabaseInterface; +use Joomla\Registry\Registry; +use Joomla\Database\DatabaseDriver; +use Joomla\Event\DispatcherInterface; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper\###Component###Helper; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Views### Table class + * + * @since 1.6 + */ +class ###View###Table extends Table implements VersionableTableInterface, TaggableTableInterface, CurrentUserInterface +{ + use TaggableTableTrait; + use CurrentUserTrait; + + /** + * Constructor + * + * @param DatabaseDriver $db Database connector object + * @param ?DispatcherInterface $dispatcher Event dispatcher for this table + * + * @param object Database connector object + * @since 4.0 + */ + function __construct(DatabaseDriver $db, ?DispatcherInterface $dispatcher = null) + { + // The type alias generally is the internal component name with the + // content type. Ex.: com_content.article + $this->typeAlias = 'com_###component###.###view###'; + + // Ensure the params and metadata in json encoded in the bind method + $this->_jsonEncode = ['params', 'metadata']; + + // Indicates that columns fully support the NULL value in the database + // $this->_supportNullValue = true; // hmmm will keep an eye on this ;) + + parent::__construct('#__###component###_###view###', 'id', $db, $dispatcher);###LICENSE_LOCKED_CHECK### + } + + /** + * Method to bind an associative array or object to the Table instance.This + * method only binds properties that are publicly accessible and optionally + * takes an array of properties to ignore when binding. + * + * @param array|object $src An associative array or object to bind to the Table instance. + * @param array|string $ignore An optional array or space separated list of properties to ignore while binding. + * + * @return boolean True on success. + * + * @since 1.7.0 + * @throws \InvalidArgumentException + */ + public function bind($array, $ignore = '') + { + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); + } + + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the ###View### table. + * + * @param boolean Toggle whether null values should be updated. + * + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = Factory::getDate()->toSql(); + $userId = $this->getCurrentUser()->id; + + if ($this->id) + { + // Existing item + $this->modified = $date; + $this->modified_by = $userId; + } + else + { + // New ###view###. A ###view### created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date; + } + if (empty($this->created_by)) + { + $this->created_by = $userId; + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = new self($this->getDbo(), $this->getDispatcher()); + + if ($table->load(['alias' => $this->alias###JTABLEALIASCATEGORY###]) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(Text::_('COM_###COMPONENT###_###VIEW###_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_###COMPONENT###_###VIEW###_ERROR_UNIQUE_ALIAS_TRASHED')); + } + + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = PunycodeHelper::urlToPunycode($this->url); + } + + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = PunycodeHelper::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + * + * @see \Joomla\CMS\Table\Table::check + * @since 1.5 + */ + public function check() + { + try { + parent::check(); + } catch (\Exception $e) { + $this->setError($e->getMessage()); + return false; + } + + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = new self($this->getDbo(), $this->getDispatcher()); + + while ($table->load(['alias' => $this->alias]) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = []; + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty AccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_###component###.###view###.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + }###LICENSE_LOCKED_SET_BOOL### + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return AccessRules The AccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = Factory::getContainer()->get(DatabaseInterface::class); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof AccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = []; + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return AccessRules::getAssetRules(0); + } + + /** + * Get the type alias for the history table + * + * The type alias generally is the internal component name with the + * content type. Ex.: com_content.article + * + * @return string The alias as described above + * + * @since 3.10.0 + */ + public function getTypeAlias() + { + return $this->typeAlias; + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form table_name.id + * where id is the value of the primary key of the table. + * + * @return string + * + * @since 1.7.0 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + + return $this->getTypeAlias() . '.' . (int) $this->$k; + } + + /** + * Method to get the parent asset under which to register this one. + * + * By default, all assets are registered to the ROOT node with ID, which will default to 1 if none exists. + * An extended class can define a table and ID to lookup. If the asset does not exist it will be created. + * + * @param Table $table A Table object for the asset parent. + * @param integer $id Id to look up + * + * @return integer + * + * @since 1.7.0 + */ + protected function _getAssetParentId(Table $table = null, $id = null) + { + /** @var Asset $assets */ + $assets = self::getInstance('Asset', 'JTable', ['dbo' => $this->getDbo()]); + $rootId = $assets->getRootId(); + + // load the ###component### asset + $assets->loadByName('com_###component###'); + + return $assets->id ?? $rootId ?? 1; + }###GENERATENEWALIAS### +} diff --git a/admin/compiler/joomla_4/CHANGELOG.md b/admin/compiler/joomla_4/CHANGELOG.md new file mode 100644 index 000000000..def8704dd --- /dev/null +++ b/admin/compiler/joomla_4/CHANGELOG.md @@ -0,0 +1 @@ +###CHANGELOG### \ No newline at end of file diff --git a/admin/compiler/joomla_4/CUSTOM_ADMIN_LAYOUT.php b/admin/compiler/joomla_4/CUSTOM_ADMIN_LAYOUT.php new file mode 100644 index 000000000..c3981e98e --- /dev/null +++ b/admin/compiler/joomla_4/CUSTOM_ADMIN_LAYOUT.php @@ -0,0 +1,22 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +###CUSTOM_ADMIN_LAYOUT_HEADER### + +// No direct access to this file +defined('JPATH_BASE') or die;###CUSTOM_ADMIN_LAYOUT_CODE### + +?>###CUSTOM_ADMIN_LAYOUT_BODY### diff --git a/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW.php b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW.php new file mode 100644 index 000000000..47e384fe5 --- /dev/null +++ b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW.php @@ -0,0 +1,28 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +###CUSTOM_ADMIN_VIEW_HEADER### + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_CODE_BODY### + +?> +canDo->get('###sview###.access')): ?>###CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT### +item->id)) ? '&id='. (int) $this->item->id : ''; ?> +###CUSTOM_ADMIN_TOP_FORM######CUSTOM_ADMIN_BODY######CUSTOM_ADMIN_BOTTOM_FORM### + +

+ diff --git a/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS.php b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS.php new file mode 100644 index 000000000..6b23540da --- /dev/null +++ b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS.php @@ -0,0 +1,27 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +###CUSTOM_ADMIN_VIEWS_HEADER### + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_CODE_BODY### + +?> +canDo->get('###sview###.access')): ?>###CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT### +###CUSTOM_ADMIN_TOP_FORM######CUSTOM_ADMIN_BODY######CUSTOM_ADMIN_BOTTOM_FORM### + +

+ diff --git a/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_CONTROLLER.php b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_CONTROLLER.php new file mode 100644 index 000000000..0fbe25922 --- /dev/null +++ b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_CONTROLLER.php @@ -0,0 +1,65 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Controller; + +###CUSTOM_ADMIN_VIEWS_CONTROLLER_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###SViews### Admin Controller + * + * @since 1.6 + */ +class ###SViews###Controller extends AdminController +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_###COMPONENT###_###SVIEWS###'; + + /** + * Proxy for getModel. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return \Joomla\CMS\MVC\Model\BaseDatabaseModel + * + * @since 1.6 + */ + public function getModel($name = '###View###', $prefix = 'Administrator', $config = ['ignore_request' => true]) + { + return parent::getModel($name, $prefix, $config); + } + + /** + * Adds option to redirect back to the dashboard. + * + * @return void + * + * @since 3.0 + */ + public function dashboard(): void + { + $this->setRedirect(Route::_('index.php?option=com_###component###', false)); + }###CUSTOM_ADMIN_CUSTOM_BUTTONS_CONTROLLER### +} diff --git a/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_HTML.php b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_HTML.php new file mode 100644 index 000000000..c8d70e3ac --- /dev/null +++ b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_HTML.php @@ -0,0 +1,119 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\View\###SViews###; + +###CUSTOM_ADMIN_VIEWS_HTML_HEADER######CUSTOM_ADMIN_GET_MODULE_JIMPORT### + +// No direct access to this file +\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +/** + * ###Component### Html View class for the ###SViews### + * + * @since 1.6 + */ +class HtmlView extends BaseHtmlView +{ + /** + * Display the view + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return void + * @since 1.6 + */ + public function display($tpl = null) + { + // get component params + $this->params = ComponentHelper::getParams('com_###component###'); + // get the application + $this->app ??= Factory::getApplication(); + // get the user object + $this->user ??= $this->app->getIdentity(); + // get global action permissions + $this->canDo = ###Component###Helper::getActions('###sview###'); + $this->styles = $this->get('Styles'); + $this->scripts = $this->get('Scripts');###CUSTOM_ADMIN_DIPLAY_METHOD### + + // Set the html view document stuff + $this->_prepareDocument(); + }###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS### + + /** + * Prepare some document related stuff. + * + * @return void + * @since 1.6 + */ + protected function _prepareDocument(): void + {###CUSTOM_ADMIN_LIBRARIES_LOADER######CUSTOM_ADMIN_UIKIT_LOADER######CUSTOM_ADMIN_GOOGLECHART_LOADER######CUSTOM_ADMIN_FOOTABLE_LOADER######CUSTOM_ADMIN_DOCUMENT_CUSTOM_PHP### + // add styles + foreach ($this->styles as $style) + { + Html::_('stylesheet', $style, ['version' => 'auto']); + }###CUSTOM_ADMIN_DOCUMENT_CUSTOM_CSS### + // add scripts + foreach ($this->scripts as $script) + { + Html::_('script', $script, ['version' => 'auto']); + }###CUSTOM_ADMIN_DOCUMENT_CUSTOM_JS### + } + + /** + * Add the page title and toolbar. + * + * @return void + * @since 1.6 + */ + protected function addToolbar(): void + {###HIDEMAINMENU### + // add title to the page + ToolbarHelper::title(Text::_('COM_###COMPONENT###_###SVIEWS###'),'###ICOMOON###');###CUSTOM_ADMIN_CUSTOM_BUTTONS### + + // set help url for this view if found + $this->help_url = ###Component###Helper::getHelpUrl('###sviews###'); + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) + { + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + ToolbarHelper::preferences('com_###component###'); + } + }###CUSTOM_ADMIN_GET_MODULE### + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * @param bool $shorten The switch to shorten. + * @param int $length The shorting length. + * + * @return mixed The escaped value. + * @since 1.6 + */ + public function escape($var, bool $shorten = false, int $length = 40) + { + if (!is_string($var)) + { + return $var; + } + + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length); + } +} diff --git a/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_MODEL.php b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_MODEL.php new file mode 100644 index 000000000..584eb6b38 --- /dev/null +++ b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_MODEL.php @@ -0,0 +1,220 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Model; + +###CUSTOM_ADMIN_VIEWS_MODEL_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### List Model for ###SViews### + * + * @since 1.6 + */ +class ###SViews###Model extends ListModel +{ + /** + * Represents the current user object. + * + * @var User The user object representing the current user. + * @since 3.2.0 + */ + protected User $user; + + /** + * The unique identifier of the current user. + * + * @var int|null The ID of the current user. + * @since 3.2.0 + */ + protected ?int $userId; + + /** + * Flag indicating whether the current user is a guest. + * + * @var int 1 if the user is a guest, 0 otherwise. + * @since 3.2.0 + */ + protected int $guest; + + /** + * An array of groups that the current user belongs to. + * + * @var array|null An array of user group IDs. + * @since 3.2.0 + */ + protected ?array $groups; + + /** + * An array of view access levels for the current user. + * + * @var array|null An array of access level IDs. + * @since 3.2.0 + */ + protected ?array $levels; + + /** + * The application object. + * + * @var CMSApplicationInterface The application instance. + * @since 3.2.0 + */ + protected CMSApplicationInterface $app; + + /** + * The input object, providing access to the request data. + * + * @var Input The input object. + * @since 3.2.0 + */ + protected Input $input; + + /** + * The styles array. + * + * @var array + * @since 4.3 + */ + protected array $styles = [ + 'administrator/components/com_###component###/assets/css/admin.css', + 'administrator/components/com_###component###/assets/css/###sviews###.css' + ]; + + /** + * The scripts array. + * + * @var array + * @since 4.3 + */ + protected array $scripts = [ + 'administrator/components/com_###component###/assets/js/admin.js' + ]; + + /** + * A custom property for UIKit components. (not used unless you load v2) + */ + protected $uikitComp; + + /** + * Constructor + * + * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). + * @param ?MVCFactoryInterface $factory The factory. + * + * @since 1.6 + * @throws \Exception + */ + public function __construct($config = [], MVCFactoryInterface $factory = null) + { + parent::__construct($config, $factory); + + $this->app ??= Factory::getApplication(); + $this->input ??= $this->app->getInput(); + + // Set the current user for authorisation checks (for those calling this model directly) + $this->user ??= $this->getCurrentUser(); + $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(); + + // will be removed + $this->initSet = true; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + * @since 1.6 + */ + protected function getListQuery() + {###CUSTOM_ADMIN_GET_LIST_QUERY### + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + * @since 1.6 + */ + public function getItems() + { + $user = $this->user; + // check if this user has permission to access items + if (!$user->authorise('###sviews###.access', 'com_###component###')) + { + $this->app->enqueueMessage(Text::_('Not authorised!'), 'error'); + // redirect away if not a correct to default view + $this->app->redirect('index.php?option=com_###component###'); + return false; + }###LICENSE_LOCKED_CHECK######CUSTOM_ADMIN_BEFORE_GET_ITEMS### + // load parent items + $items = parent::getItems(); + + // Get the global params + $globalParams = ComponentHelper::getParams('com_###component###', true);###CUSTOM_ADMIN_GET_ITEMS######CUSTOM_ADMIN_AFTER_GET_ITEMS### + + // return items + return $items; + } + + /** + * Method to get the styles that have to be included on the view + * + * @return array styles files + * @since 4.3 + */ + public function getStyles(): array + { + return $this->styles; + } + + /** + * Method to set the styles that have to be included on the view + * + * @return void + * @since 4.3 + */ + public function setStyles(string $path): void + { + $this->styles[] = $path; + } + + /** + * Method to get the script that have to be included on the view + * + * @return array script files + * @since 4.3 + */ + public function getScripts(): array + { + return $this->scripts; + } + + /** + * Method to set the script that have to be included on the view + * + * @return void + * @since 4.3 + */ + public function setScript(string $path): void + { + $this->scripts[] = $path; + }###CUSTOM_ADMIN_CUSTOM_METHODS######LICENSE_LOCKED_SET_BOOL######CUSTOM_ADMIN_CUSTOM_BUTTONS_METHOD### +} diff --git a/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_CONTROLLER.php b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_CONTROLLER.php new file mode 100644 index 000000000..b7fa6648b --- /dev/null +++ b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_CONTROLLER.php @@ -0,0 +1,56 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Controller; + +###CUSTOM_ADMIN_VIEW_CONTROLLER_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### ###SView### Base Controller + * + * @since 1.6 + */ +class ###SView###Controller extends BaseController +{ + /** + * The context for storing internal data, e.g. record. + * + * @var string + * @since 1.6 + */ + protected $context = '###sview###'; + + /** + * The URL view item variable. + * + * @var string + * @since 1.6 + */ + protected $view_item = '###sview###'; + + /** + * Adds option to redirect back to the dashboard. + * + * @return void + * @since 3.0 + */ + public function dashboard(): void + { + $this->setRedirect(Route::_('index.php?option=com_###component###', false)); + }###CUSTOM_ADMIN_CUSTOM_BUTTONS_CONTROLLER### +} diff --git a/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_HTML.php b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_HTML.php new file mode 100644 index 000000000..6fe4459f2 --- /dev/null +++ b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_HTML.php @@ -0,0 +1,129 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\View\###SView###; + +###CUSTOM_ADMIN_VIEW_HTML_HEADER######CUSTOM_ADMIN_GET_MODULE_JIMPORT### + +// No direct access to this file +\defined('_JEXEC') or die; ###LICENSE_LOCKED_DEFINED### + +/** + * ###Component### Html View class for the ###SView### + * + * @since 1.6 + */ +class HtmlView extends BaseHtmlView +{ + /** + * Display the view + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return void + * @since 1.6 + */ + public function display($tpl = null) + { + // get component params + $this->params = ComponentHelper::getParams('com_###component###'); + // get the application + $this->app ??= Factory::getApplication(); + // get the user object + $this->user ??= Factory::getApplication()->getIdentity(); + // get global action permissions + $this->canDo = ###Component###Helper::getActions('###sview###'); + $this->styles = $this->get('Styles'); + $this->scripts = $this->get('Scripts');###CUSTOM_ADMIN_DIPLAY_METHOD### + + // Set the html view document stuff + $this->_prepareDocument(); + }###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS### + + /** + * Prepare some document related stuff. + * + * @return void + * @since 1.6 + */ + protected function _prepareDocument(): void + {###CUSTOM_ADMIN_LIBRARIES_LOADER######CUSTOM_ADMIN_DOCUMENT_METADATA######CUSTOM_ADMIN_UIKIT_LOADER######CUSTOM_ADMIN_GOOGLECHART_LOADER######CUSTOM_ADMIN_FOOTABLE_LOADER######CUSTOM_ADMIN_DOCUMENT_CUSTOM_PHP### + // add styles + foreach ($this->styles as $style) + { + Html::_('stylesheet', $style, ['version' => 'auto']); + }###CUSTOM_ADMIN_DOCUMENT_CUSTOM_CSS### + // add scripts + foreach ($this->scripts as $script) + { + Html::_('script', $script, ['version' => 'auto']); + }###CUSTOM_ADMIN_DOCUMENT_CUSTOM_JS### + } + + /** + * Add the page title and toolbar. + * + * @return void + * @since 1.6 + */ + protected function addToolbar(): void + {###HIDEMAINMENU### + // set the title + if (isset($this->item->name) && $this->item->name) + { + $title = $this->item->name; + } + // Check for empty title and add view name if param is set + if (empty($title)) + { + $title = Text::_('COM_###COMPONENT###_###SVIEW###'); + } + // add title to the page + ToolbarHelper::title($title,'###ICOMOON###');###CUSTOM_ADMIN_CUSTOM_BUTTONS### + + // set help url for this view if found + $this->help_url = ###Component###Helper::getHelpUrl('###sviews###'); + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) + { + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + ToolbarHelper::preferences('com_###component###'); + } + }###CUSTOM_ADMIN_GET_MODULE### + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * @param bool $shorten The switch to shorten. + * @param int $length The shorting length. + * + * @return mixed The escaped value. + * @since 1.6 + */ + public function escape($var, bool $shorten = false, int $length = 40) + { + if (!is_string($var)) + { + return $var; + } + + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length); + } +} diff --git a/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_MODEL.php b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_MODEL.php new file mode 100644 index 000000000..f71b26864 --- /dev/null +++ b/admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_MODEL.php @@ -0,0 +1,267 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Model; + +###CUSTOM_ADMIN_VIEW_MODEL_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### ###SView### Item Model + * + * @since 1.6 + */ +class ###SView###Model extends ItemModel +{ + /** + * Model context string. + * + * @var string + * @since 1.6 + */ + protected $_context = 'com_###component###.###sview###'; + + /** + * Represents the current user object. + * + * @var User The user object representing the current user. + * @since 3.2.0 + */ + protected User $user; + + /** + * The unique identifier of the current user. + * + * @var int|null The ID of the current user. + * @since 3.2.0 + */ + protected ?int $userId; + + /** + * Flag indicating whether the current user is a guest. + * + * @var int 1 if the user is a guest, 0 otherwise. + * @since 3.2.0 + */ + protected int $guest; + + /** + * An array of groups that the current user belongs to. + * + * @var array|null An array of user group IDs. + * @since 3.2.0 + */ + protected ?array $groups; + + /** + * An array of view access levels for the current user. + * + * @var array|null An array of access level IDs. + * @since 3.2.0 + */ + protected ?array $levels; + + /** + * The application object. + * + * @var CMSApplicationInterface The application instance. + * @since 3.2.0 + */ + protected CMSApplicationInterface $app; + + /** + * The input object, providing access to the request data. + * + * @var Input The input object. + * @since 3.2.0 + */ + protected Input $input; + + /** + * The styles array. + * + * @var array + * @since 4.3 + */ + protected array $styles = [ + 'administrator/components/com_###component###/assets/css/admin.css', + 'administrator/components/com_###component###/assets/css/###sview###.css' + ]; + + /** + * The scripts array. + * + * @var array + * @since 4.3 + */ + protected array $scripts = [ + 'administrator/components/com_###component###/assets/js/admin.js' + ]; + + /** + * A custom property for UI Kit components. + * + * @var array|null Property for storing UI Kit component-related data or objects. + * @since 3.2.0 + */ + protected ?array $uikitComp; + + /** + * @var object item + * @since 1.6 + */ + protected $item; + + /** + * Constructor + * + * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). + * @param ?MVCFactoryInterface $factory The factory. + * + * @since 3.0 + * @throws \Exception + */ + public function __construct($config = [], MVCFactoryInterface $factory = null) + { + parent::__construct($config, $factory); + + $this->app ??= Factory::getApplication(); + $this->input ??= $this->app->getInput(); + + // Set the current user for authorisation checks (for those calling this model directly) + $this->user ??= $this->getCurrentUser(); + $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(); + + // will be removed + $this->initSet = true; + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @return void + * @since 1.6 + */ + protected function populateState() + { + // Get the item main id + $id = $this->input->getInt('id', null); + $this->setState('###sview###.id', $id); + + // Load the parameters. + parent::populateState(); + } + + /** + * Method to get article data. + * + * @param integer $pk The id of the article. + * + * @return mixed Menu item data object on success, false on failure. + * @since 1.6 + */ + public function getItem($pk = null) + { + // check if this user has permission to access item + if (!$this->user->authorise('###sview###.access', 'com_###component###')) + { + $this->app->enqueueMessage(Text::_('Not authorised!'), 'error'); + // redirect away if not a correct to cPanel/default view + $this->app->redirect('index.php?option=com_###component###'); + return false; + } + + $pk = (!empty($pk)) ? $pk : (int) $this->getState('###sview###.id');###CUSTOM_ADMIN_BEFORE_GET_ITEM### + + if ($this->_item === null) + { + $this->_item = []; + }###LICENSE_LOCKED_CHECK### + + if (!isset($this->_item[$pk])) + { + try + {###CUSTOM_ADMIN_GET_ITEM### + } + catch (\Exception $e) + { + if ($e->getCode() == 404) + { + // Need to go thru the error handler to allow Redirect to work. + throw $e; + } + else + { + $this->setError($e); + $this->_item[$pk] = false; + } + } + }###CUSTOM_ADMIN_AFTER_GET_ITEM### + + return $this->_item[$pk]; + } + + /** + * Method to get the styles that have to be included on the view + * + * @return array styles files + * @since 4.3 + */ + public function getStyles(): array + { + return $this->styles; + } + + /** + * Method to set the styles that have to be included on the view + * + * @return void + * @since 4.3 + */ + public function setStyles(string $path): void + { + $this->styles[] = $path; + } + + /** + * Method to get the script that have to be included on the view + * + * @return array script files + * @since 4.3 + */ + public function getScripts(): array + { + return $this->scripts; + } + + /** + * Method to set the script that have to be included on the view + * + * @return void + * @since 4.3 + */ + public function setScript(string $path): void + { + $this->scripts[] = $path; + }###CUSTOM_ADMIN_CUSTOM_METHODS######LICENSE_LOCKED_SET_BOOL######CUSTOM_ADMIN_CUSTOM_BUTTONS_METHOD### +} diff --git a/admin/compiler/joomla_4/DASH_CONTROLLER.php b/admin/compiler/joomla_4/DASH_CONTROLLER.php new file mode 100644 index 000000000..564117d8d --- /dev/null +++ b/admin/compiler/joomla_4/DASH_CONTROLLER.php @@ -0,0 +1,31 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Controller; + +###DASH_CONTROLLER_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### Admin Controller + * + * @since 1.6 + */ +class ###Component###Controller extends AdminController +{ + +} diff --git a/admin/compiler/joomla_4/DASH_MODEL.php b/admin/compiler/joomla_4/DASH_MODEL.php new file mode 100644 index 000000000..5e14fff76 --- /dev/null +++ b/admin/compiler/joomla_4/DASH_MODEL.php @@ -0,0 +1,225 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Model; + +###DASH_MODEL_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### List Model + * + * @since 1.6 + */ +class ###Component###Model extends ListModel +{ + public function getIcons() + { + // load user for access menus + $user = Factory::getApplication()->getIdentity(); + // reset icon array + $icons = []; + // view groups array + $viewGroups = array( + 'main' => array(###DASHBOARDICONS###) + );###DASHBOARDICONACCESS### + // loop over the $views + foreach($viewGroups as $group => $views) + { + $i = 0; + if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($views)) + { + foreach($views as $view) + { + $add = false; + // external views (links) + if (strpos($view,'||') !== false) + { + $dwd = explode('||', $view); + if (count($dwd) == 3) + { + list($type, $name, $url) = $dwd; + $viewName = $name; + $alt = $name; + $url = $url; + $image = $name . '.' . $type; + $name = 'COM_###COMPONENT###_DASHBOARD_' . Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name,'U'); + } + } + // internal views + elseif (strpos($view,'.') !== false) + { + $dwd = explode('.', $view); + if (count($dwd) == 3) + { + list($type, $name, $action) = $dwd; + } + elseif (count($dwd) == 2) + { + list($type, $name) = $dwd; + $action = false; + } + if ($action) + { + $viewName = $name; + switch($action) + { + case 'add': + $url = 'index.php?option=com_###component###&view=' . $name . '&layout=edit'; + $image = $name . '_' . $action. '.' . $type; + $alt = $name . ' ' . $action; + $name = 'COM_###COMPONENT###_DASHBOARD_'.Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name,'U').'_ADD'; + $add = true; + break; + default: + // check for new convention (more stable) + if (strpos($action, '_qpo0O0oqp_') !== false) + { + list($action, $extension) = (array) explode('_qpo0O0oqp_', $action); + $extension = str_replace('_po0O0oq_', '.', $extension); + } + else + { + $extension = 'com_###component###.' . $name; + } + $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; + $image = $name . '_' . $action . '.' . $type; + $alt = $viewName . ' ' . $action; + $name = 'COM_###COMPONENT###_DASHBOARD_' . Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name,'U') . '_' . Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($action,'U'); + break; + } + } + else + { + $viewName = $name; + $alt = $name; + $url = 'index.php?option=com_###component###&view=' . $name; + $image = $name . '.' . $type; + $name = 'COM_###COMPONENT###_DASHBOARD_' . Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name,'U'); + $hover = false; + } + } + else + { + $viewName = $view; + $alt = $view; + $url = 'index.php?option=com_###component###&view=' . $view; + $image = $view . '.png'; + $name = ucwords($view).'

'; + $hover = false; + } + // first make sure the view access is set + if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($viewAccess)) + { + // setup some defaults + $dashboard_add = false; + $dashboard_list = false; + $accessTo = ''; + $accessAdd = ''; + // access checking start + $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($viewAccess[$viewName.'.create']):false; + $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($viewAccess[$viewName.'.access']):false; + // set main controllers + $accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($viewAccess[$viewName.'.dashboard_add']):false; + $accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($viewAccess[$viewName.'.dashboard_list']):false; + // check for adding access + if ($add && $accessCreate) + { + $accessAdd = $viewAccess[$viewName.'.create']; + } + elseif ($add) + { + $accessAdd = 'core.create'; + } + // check if access to view is set + if ($accessAccess) + { + $accessTo = $viewAccess[$viewName.'.access']; + } + // set main access controllers + if ($accessDashboard_add) + { + $dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_###component###'); + } + if ($accessDashboard_list) + { + $dashboard_list = $user->authorise($viewAccess[$viewName.'.dashboard_list'], 'com_###component###'); + } + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessAdd) && Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessTo)) + { + // check access + if($user->authorise($accessAdd, 'com_###component###') && $user->authorise($accessTo, 'com_###component###') && $dashboard_add) + { + $icons[$group][$i] = new \StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + } + elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessTo)) + { + // check access + if($user->authorise($accessTo, 'com_###component###') && $dashboard_list) + { + $icons[$group][$i] = new \StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + } + elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessAdd)) + { + // check access + if($user->authorise($accessAdd, 'com_###component###') && $dashboard_add) + { + $icons[$group][$i] = new \StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + } + else + { + $icons[$group][$i] = new \StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + } + else + { + $icons[$group][$i] = new \StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + $i++; + } + } + else + { + $icons[$group][$i] = false; + } + } + return $icons; + }###DASH_MODEL_METHODS### +} diff --git a/admin/compiler/joomla_4/DASH_VIEW.php b/admin/compiler/joomla_4/DASH_VIEW.php new file mode 100644 index 000000000..c95d6aeb6 --- /dev/null +++ b/admin/compiler/joomla_4/DASH_VIEW.php @@ -0,0 +1,22 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +###DASH_VIEW_HEADER### + +// No direct access to this file +defined('_JEXEC') or die; + +?>###DASH_DISPLAY_DATA### \ No newline at end of file diff --git a/admin/compiler/joomla_4/DASH_VIEW_HTML.php b/admin/compiler/joomla_4/DASH_VIEW_HTML.php new file mode 100644 index 000000000..8e6decf8b --- /dev/null +++ b/admin/compiler/joomla_4/DASH_VIEW_HTML.php @@ -0,0 +1,100 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\View\###Component###; + +###DASH_VIEW_HTML_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### View class + * + * @since 1.6 + */ +class HtmlView extends BaseHtmlView +{ + /** + * View display method + * @return void + */ + function display($tpl = null) + { + // Assign data to the view + $this->icons = $this->get('Icons'); + $this->contributors = ###Component###Helper::getContributors(); + + // get the manifest details of the component + $this->manifest = ###Component###Helper::manifest();###DASH_GET_CUSTOM_DATA### + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new \Exception(implode("\n", $errors), 500); + } + + // Set the html view document stuff + $this->_prepareDocument(); + + // Display the template + parent::display($tpl); + } + + /** + * Add the page title and toolbar. + * + * @return void + * @since 1.6 + */ + protected function addToolbar(): void + { + $canDo = ###Component###Helper::getActions('###component###'); + ToolbarHelper::title(Text::_('COM_###COMPONENT###_DASHBOARD'), 'grid-2'); + + // set help url for this view if found + $this->help_url = ###Component###Helper::getHelpUrl('###component###'); + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) + { + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + } + + if ($canDo->get('core.admin') || $canDo->get('core.options')) + { + ToolbarHelper::preferences('com_###component###'); + } + } + + /** + * Prepare some document related stuff. + * + * @return void + * @since 1.6 + */ + protected function _prepareDocument(): void + { + // set page title + $this->getDocument()->setTitle(Text::_('COM_###COMPONENT###_DASHBOARD')); + + // add manifest to page JavaScript + $this->getDocument()->addScriptDeclaration("var manifest = JSON.parse('" . json_encode($this->manifest) . "');", "text/javascript"); + + // add dashboard style sheets + Html::_('stylesheet', "administrator/components/com_###component###/assets/css/dashboard.css", ['version' => 'auto']); + } +} diff --git a/admin/compiler/joomla_4/FORM_CHECKBOXES_FIELD.php b/admin/compiler/joomla_4/FORM_CHECKBOXES_FIELD.php new file mode 100644 index 000000000..007fd3bac --- /dev/null +++ b/admin/compiler/joomla_4/FORM_CHECKBOXES_FIELD.php @@ -0,0 +1,51 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Field; + +use Joomla\CMS\Factory; +use Joomla\CMS\Form\Field\CheckboxesField; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Component\ComponentHelper; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper\###Component###Helper; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Type### Form Field class for the ###Component### component + * + * @since 1.6 + */ +class ###Type###Field extends CheckboxesField +{ + /** + * The ###type### field type. + * + * @var string + */ + public $type = '###Type###'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of Html options. + */ + protected function getOptions() + { + ###JFORM_GETOPTIONS_PHP### + } +} diff --git a/admin/compiler/joomla_4/FORM_CUSTOM_FIELD.php b/admin/compiler/joomla_4/FORM_CUSTOM_FIELD.php new file mode 100644 index 000000000..5afa801f2 --- /dev/null +++ b/admin/compiler/joomla_4/FORM_CUSTOM_FIELD.php @@ -0,0 +1,36 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Field; + +###FORM_CUSTOM_FIELD_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Type### Form Field class for the ###Component### component + * + * @since 1.6 + */ +class ###Type###Field extends ###FORM_EXTENDS### +{ + /** + * The ###type### field type. + * + * @var string + */ + public $type = '###Type###';###FORM_CUSTOM_FIELD_PHP### +} diff --git a/admin/compiler/joomla_4/FORM_LIST_FIELD.php b/admin/compiler/joomla_4/FORM_LIST_FIELD.php new file mode 100644 index 000000000..72b8880ae --- /dev/null +++ b/admin/compiler/joomla_4/FORM_LIST_FIELD.php @@ -0,0 +1,52 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Field; + +use Joomla\CMS\Factory; +use Joomla\CMS\Form\Field\ListField; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Component\ComponentHelper; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper\###Component###Helper; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Type### Form Field class for the ###Component### component + * + * @since 1.6 + */ +class ###Type###Field extends ListField +{ + /** + * The ###type### field type. + * + * @var string + */ + public $type = '###Type###';###ADD_BUTTON### + + /** + * Method to get a list of options for a list input. + * + * @return array An array of Html options. + * @since 1.6 + */ + protected function getOptions() + { + ###JFORM_GETOPTIONS_PHP### + } +} diff --git a/admin/compiler/joomla_4/FORM_RADIO_FIELD.php b/admin/compiler/joomla_4/FORM_RADIO_FIELD.php new file mode 100644 index 000000000..60460a463 --- /dev/null +++ b/admin/compiler/joomla_4/FORM_RADIO_FIELD.php @@ -0,0 +1,51 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Field; + +use Joomla\CMS\Factory; +use Joomla\CMS\Form\Field\RadioField; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Component\ComponentHelper; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper\###Component###Helper; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Type### Form Field class for the ###Component### component + * + * @since 1.6 + */ +class ###Type###Field extends RadioField +{ + /** + * The ###type### field type. + * + * @var string + */ + public $type = '###Type###'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of Html options. + */ + protected function getOptions() + { + ###JFORM_GETOPTIONS_PHP### + } +} diff --git a/admin/compiler/joomla_4/FORM_RULE.php b/admin/compiler/joomla_4/FORM_RULE.php new file mode 100644 index 000000000..c280db455 --- /dev/null +++ b/admin/compiler/joomla_4/FORM_RULE.php @@ -0,0 +1,37 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Rule; + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\Form; +use Joomla\CMS\Form\FormRule; +use Joomla\Registry\Registry; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Component\ComponentHelper; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper\###Component###Helper; + +// No direct access to this file +\defined('JPATH_PLATFORM') or die; + +/** + * Form Rule (###Name###) class for the Joomla Platform. + * + * @since 3.5 + */ +class ###Name###Rule extends FormRule +{###VALIDATION_RULE_METHODS### +} diff --git a/admin/compiler/joomla_4/FORM_USER_FIELD.php b/admin/compiler/joomla_4/FORM_USER_FIELD.php new file mode 100644 index 000000000..9ad457423 --- /dev/null +++ b/admin/compiler/joomla_4/FORM_USER_FIELD.php @@ -0,0 +1,65 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Field; + +use Joomla\CMS\Factory; +use Joomla\CMS\Form\Field\UserField; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Component\ComponentHelper; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper\###Component###Helper; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Type### Form Field class for the ###Component### component + * + * @since 1.6 + */ +class ###Type###Field extends UserField +{ + /** + * The ###type### field type. + * + * @var string + */ + public $type = '###Type###'; + + /** + * Method to get the filtering groups (null means no filtering) + * + * @return mixed array of filtering groups or null. + * + * @since 1.6 + */ + protected function getGroups() + { + ###JFORM_GETGROUPS_PHP### + } + + /** + * Method to get the users to exclude from the list of users + * + * @return mixed Array of users to exclude or null to not exclude them + * + * @since 1.6 + */ + protected function getExcluded() + { + ###JFORM_GETEXCLUDED_PHP### + } +} diff --git a/admin/compiler/joomla_4/INSTALLER_SCRIPT.php b/admin/compiler/joomla_4/INSTALLER_SCRIPT.php new file mode 100644 index 000000000..133ee1132 --- /dev/null +++ b/admin/compiler/joomla_4/INSTALLER_SCRIPT.php @@ -0,0 +1,1099 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Installer\InstallerAdapter; +use Joomla\CMS\Installer\InstallerScriptInterface; +use Joomla\CMS\Application\CMSApplication; +use Joomla\CMS\Log\Log; +use Joomla\CMS\Version; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\Filesystem\Folder; +use Joomla\Database\DatabaseInterface; + +// No direct access to this file +defined('_JEXEC') or die; + +/** + * Script File of ###Component### Component + * + * @since 3.6 + */ +class Com_###Component###InstallerScript implements InstallerScriptInterface +{ + /** + * The CMS Application. + * + * @var CMSApplication + * @since 4.4.2 + */ + protected CMSApplication $app; + + /** + * The database class. + * + * @since 4.4.2 + */ + protected $db; + + /** + * The version number of the extension. + * + * @var string + * @since 3.6 + */ + protected $release; + + /** + * The table the parameters are stored in. + * + * @var string + * @since 3.6 + */ + protected $paramTable; + + /** + * The extension name. This should be set in the installer script. + * + * @var string + * @since 3.6 + */ + protected $extension; + + /** + * A list of files to be deleted + * + * @var array + * @since 3.6 + */ + protected $deleteFiles = []; + + /** + * A list of folders to be deleted + * + * @var array + * @since 3.6 + */ + protected $deleteFolders = []; + + /** + * A list of CLI script files to be copied to the cli directory + * + * @var array + * @since 3.6 + */ + protected $cliScriptFiles = []; + + /** + * Minimum PHP version required to install the extension + * + * @var string + * @since 3.6 + */ + protected $minimumPhp; + + /** + * Minimum Joomla! version required to install the extension + * + * @var string + * @since 3.6 + */ + protected $minimumJoomla; + + /** + * Extension script constructor. + * + * @since 3.0.0 + */ + public function __construct() + { + $this->minimumJoomla = '4.3'; + $this->minimumPhp = JOOMLA_MINIMUM_PHP; + $this->app ??= Factory::getApplication(); + $this->db = Factory::getContainer()->get(DatabaseInterface::class); + + // check if the files exist + if (is_file(JPATH_ROOT . '/administrator/components/com_###component###/###component###.php')) + { + // remove Joomla 3 files + $this->deleteFiles = [ + '/administrator/components/com_###component###/###component###.php', + '/administrator/components/com_###component###/controller.php', + '/components/com_###component###/###component###.php', + '/components/com_###component###/controller.php', + '/components/com_###component###/router.php', + ]; + } + + // check if the Folders exist + if (is_dir(JPATH_ROOT . '/administrator/components/com_###component###/modules')) + { + // remove Joomla 3 folder + $this->deleteFolders = [ + '/administrator/components/com_###component###/controllers', + '/administrator/components/com_###component###/helpers', + '/administrator/components/com_###component###/modules', + '/administrator/components/com_###component###/tables', + '/administrator/components/com_###component###/views', + '/components/com_###component###/controllers', + '/components/com_###component###/helpers', + '/components/com_###component###/modules', + '/components/com_###component###/views', + ]; + } + } + + /** + * Function called after the extension is installed. + * + * @param InstallerAdapter $adapter The adapter calling this method + * + * @return boolean True on success + * + * @since 4.2.0 + */ + public function install(InstallerAdapter $adapter): bool {return true;} + + /** + * Function called after the extension is updated. + * + * @param InstallerAdapter $adapter The adapter calling this method + * + * @return boolean True on success + * + * @since 4.2.0 + */ + public function update(InstallerAdapter $adapter): bool {return true;} + + /** + * Function called after the extension is uninstalled. + * + * @param InstallerAdapter $adapter The adapter calling this method + * + * @return boolean True on success + * + * @since 4.2.0 + */ + public function uninstall(InstallerAdapter $adapter): bool + {###UNINSTALLSCRIPT### + // little notice as after service, in case of bad experience with component. + echo '
+

Did something go wrong? Are you disappointed?

+

Please let me know at ###AUTHOREMAIL###. +
We at ###COMPANYNAME### are committed to building extensions that performs proficiently! You can help us, really! +
Send me your thoughts on improvements that is needed, trust me, I will be very grateful! +
Visit us at ###AUTHORWEBSITE### today!

'; + + return true; + } + + /** + * Function called before extension installation/update/removal procedure commences. + * + * @param string $type The type of change (install or discover_install, update, uninstall) + * @param InstallerAdapter $adapter The adapter calling this method + * + * @return boolean True on success + * + * @since 4.2.0 + */ + public function preflight(string $type, InstallerAdapter $adapter): bool + { + // Check for the minimum PHP version before continuing + if (!empty($this->minimumPhp) && version_compare(PHP_VERSION, $this->minimumPhp, '<')) + { + Log::add(Text::sprintf('JLIB_INSTALLER_MINIMUM_PHP', $this->minimumPhp), Log::WARNING, 'jerror'); + + return false; + } + + // Check for the minimum Joomla version before continuing + if (!empty($this->minimumJoomla) && version_compare(JVERSION, $this->minimumJoomla, '<')) + { + Log::add(Text::sprintf('JLIB_INSTALLER_MINIMUM_JOOMLA', $this->minimumJoomla), Log::WARNING, 'jerror'); + + return false; + } + + // Extension manifest file version + $this->extension = $adapter->getName(); + $this->release = $adapter->getManifest()->version; + + // do any updates needed + if ($type === 'update') + {###PREUPDATESCRIPT### + } + + // do any install needed + if ($type === 'install') + {###PREINSTALLSCRIPT### + } + + return true; + } + + /** + * Function called after extension installation/update/removal procedure commences. + * + * @param string $type The type of change (install or discover_install, update, uninstall) + * @param InstallerAdapter $adapter The adapter calling this method + * + * @return boolean True on success + * + * @since 4.2.0 + */ + public function postflight(string $type, InstallerAdapter $adapter): bool + {###MOVEFOLDERSSCRIPT### + + // set the default component settings + if ($type === 'install') + {###POSTINSTALLSCRIPT### + } + + // do any updates needed + if ($type === 'update') + {###POSTUPDATESCRIPT### + } + + // move CLI files + $this->moveCliFiles(); + + // remove old files and folders + $this->removeFiles(); + + return true; + } + + /** + * Remove the files and folders in the given array from + * + * @return void + * + * @since 3.6 + */ + protected function removeFiles() + { + if (!empty($this->deleteFiles)) + { + foreach ($this->deleteFiles as $file) + { + if (is_file(JPATH_ROOT . $file) && !File::delete(JPATH_ROOT . $file)) + { + echo Text::sprintf('JLIB_INSTALLER_ERROR_FILE_FOLDER', $file) . '
'; + } + } + } + + if (!empty($this->deleteFolders)) + { + foreach ($this->deleteFolders as $folder) + { + if (is_dir(JPATH_ROOT . $folder) && !Folder::delete(JPATH_ROOT . $folder)) + { + echo Text::sprintf('JLIB_INSTALLER_ERROR_FILE_FOLDER', $folder) . '
'; + } + } + } + } + + /** + * Moves the CLI scripts into the CLI folder in the CMS + * + * @return void + * + * @since 3.6 + */ + protected function moveCliFiles() + { + if (!empty($this->cliScriptFiles)) + { + foreach ($this->cliScriptFiles as $file) + { + $name = basename($file); + + if (file_exists(JPATH_ROOT . $file) && !File::move(JPATH_ROOT . $file, JPATH_ROOT . '/cli/' . $name)) + { + echo Text::sprintf('JLIB_INSTALLER_FILE_ERROR_MOVE', $name); + } + } + } + } + + /** + * Set content type integration + * + * @param string $typeTitle + * @param string $typeAlias + * @param string $table + * @param string $rules + * @param string $fieldMappings + * @param string $router + * @param string $contentHistoryOptions + * + * @return void + * @since 4.4.2 + */ + protected function setContentType( + string $typeTitle, + string $typeAlias, + string $table, + string $rules, + string $fieldMappings, + string $router, + string $contentHistoryOptions): void + { + // Create the content type object. + $content = new stdClass(); + $content->type_title = $typeTitle; + $content->type_alias = $typeAlias; + $content->table = $table; + $content->rules = $rules; + $content->field_mappings = $fieldMappings; + $content->router = $router; + $content->content_history_options = $contentHistoryOptions; + + // Check if content type is already in content_type DB. + $query = $this->db->getQuery(true); + $query->select($this->db->quoteName(array('type_id'))); + $query->from($this->db->quoteName('#__content_types')); + $query->where($this->db->quoteName('type_alias') . ' LIKE '. $this->db->quote($content->type_alias)); + + $this->db->setQuery($query); + $this->db->execute(); + + // Check if the type alias is already in the content types table. + if ($this->db->getNumRows()) + { + $content->type_id = $this->db->loadResult(); + if ($this->db->updateObject('#__content_types', $content, 'type_id')) + { + // If its successfully update. + $this->app->enqueueMessage( + Text::sprintf('The (%s) was found in the #__content_types table, and updated.', $content->type_alias) + ); + } + } + elseif ($this->db->insertObject('#__content_types', $content)) + { + // If its successfully added. + $this->app->enqueueMessage( + Text::sprintf('The (%s) was added to the #__content_types table.', $content->type_alias) + ); + } + } + + /** + * Set action log config integration + * + * @param string $typeTitle + * @param string $typeAlias + * @param string $idHolder + * @param string $titleHolder + * @param string $tableName + * @param string $textPrefix + * + * @return void + * @since 4.4.2 + */ + protected function setActionLogConfig( + string $typeTitle, + string $typeAlias, + string $idHolder, + string $titleHolder, + string $tableName, + string $textPrefix): void + { + // Create the content action log config object. + $content = new stdClass(); + $content->type_title = $typeTitle; + $content->type_alias = $typeAlias; + $content->id_holder = $idHolder; + $content->title_holder = $titleHolder; + $content->table_name = $tableName; + $content->text_prefix = $textPrefix; + + // Check if the action log config is already in action_log_config DB. + $query = $this->db->getQuery(true); + $query->select($this->db->quoteName(['id'])); + $query->from($this->db->quoteName('#__action_log_config')); + $query->where($this->db->quoteName('type_alias') . ' LIKE '. $this->db->quote($content->type_alias)); + + $this->db->setQuery($query); + $this->db->execute(); + + // Check if the type alias is already in the action log config table. + if ($this->db->getNumRows()) + { + $content->id = $this->db->loadResult(); + if ($this->db->updateObject('#__action_log_config', $content, 'id')) + { + // If its successfully update. + $this->app->enqueueMessage( + Text::sprintf('The (%s) was found in the #__action_log_config table, and updated.', $content->type_alias) + ); + } + } + elseif ($this->db->insertObject('#__action_log_config', $content)) + { + // If its successfully added. + $this->app->enqueueMessage( + Text::sprintf('The (%s) was added to the #__action_log_config table.', $content->type_alias) + ); + } + } + + /** + * Set action logs extensions integration + * + * @return void + * @since 4.4.2 + */ + protected function setActionLogsExtensions(): void + { + // Create the extension action logs object. + $data = new stdClass(); + $data->extension = 'com_###component###'; + + // Check if ###component### action log extension is already in action logs extensions DB. + $query = $this->db->getQuery(true); + $query->select($this->db->quoteName(['id'])); + $query->from($this->db->quoteName('#__action_logs_extensions')); + $query->where($this->db->quoteName('extension') . ' = '. $this->db->quote($data->extension)); + + $this->db->setQuery($query); + $this->db->execute(); + + // Set the object into the action logs extensions table if not found. + if ($this->db->getNumRows()) + { + // If its already set don't set it again. + $this->app->enqueueMessage( + Text::_('The (com_###component###) is already in the #__action_logs_extensions table.') + ); + } + elseif ($this->db->insertObject('#__action_logs_extensions', $data)) + { + // give a success message + $this->app->enqueueMessage( + Text::_('The (com_###component###) was successfully added to the #__action_logs_extensions table.') + ); + } + } + + /** + * Set global extension assets permission of this component + * (on install only) + * + * @param string $rules The component rules + * + * @return void + * @since 4.4.2 + */ + protected function setAssetsRules(string $rules): void + { + // Condition. + $conditions = [ + $this->db->quoteName('name') . ' = ' . $this->db->quote('com_###component###') + ]; + + // Field to update. + $fields = [ + $this->db->quoteName('rules') . ' = ' . $this->db->quote($rules), + ]; + + $query = $this->db->getQuery(true); + $query->update( + $this->db->quoteName('#__assets') + )->set($fields)->where($conditions); + + $this->db->setQuery($query); + + $done = $this->db->execute(); + if ($done) + { + // give a success message + $this->app->enqueueMessage( + Text::_('The (com_###component###) rules was successfully added to the #__assets table.') + ); + } + } + + /** + * Set global extension params of this component + * (on install only) + * + * @param string $params The component rules + * + * @return void + * @since 4.4.2 + */ + protected function setExtensionsParams(string $params): void + { + // Condition. + $conditions = [ + $this->db->quoteName('element') . ' = ' . $this->db->quote('com_###component###') + ]; + + // Field to update. + $fields = [ + $this->db->quoteName('params') . ' = ' . $this->db->quote($params), + ]; + + $query = $this->db->getQuery(true); + $query->update( + $this->db->quoteName('#__extensions') + )->set($fields)->where($conditions); + + $this->db->setQuery($query); + + $done = $this->db->execute(); + if ($done) + { + // give a success message + $this->app->enqueueMessage( + Text::_('The (com_###component###) params was successfully added to the #__extensions table.') + ); + } + } + + /** + * Set database fix (if needed) + * => WHY DO WE NEED AN ASSET TABLE FIX? + * https://git.vdm.dev/joomla/Component-Builder/issues/616#issuecomment-12085 + * https://www.mysqltutorial.org/mysql-varchar/ + * https://stackoverflow.com/a/15227917/1429677 + * https://forums.mysql.com/read.php?24,105964,105964 + * + * @param int $accessWorseCase This is the max rules column size com_###component### would needs. + * @param string $dataType This datatype we will change the rules column to if it to small. + * + * @return void + * @since 4.4.2 + */ + protected function setDatabaseAssetsRulesFix(int $accessWorseCase, string $dataType): void + { + // Get the biggest rule column in the assets table at this point. + $length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; + $this->db->setQuery($length); + if ($this->db->execute()) + { + $rule_length = $this->db->loadResult(); + // Check the size of the rules column + if ($rule_length <= $accessWorseCase) + { + // Fix the assets table rules column size + $fix = "ALTER TABLE `#__assets` CHANGE `rules` `rules` {$dataType} NOT NULL COMMENT 'JSON encoded access control. Enlarged to {$dataType} by ###Component###';"; + $this->db->setQuery($fix); + + $done = $this->db->execute(); + if ($done) + { + $this->app->enqueueMessage( + Text::sprintf('The #__assets table rules column was resized to the %s datatype for the components possible large permission rules.', $dataType) + ); + } + } + } + } + + /** + * Remove remnant data related to this view + * + * @param string $context The view context + * @param bool $fields The switch to also remove related field data + * + * @return void + * @since 4.4.2 + */ + protected function removeViewData(string $context, bool $fields = false): void + { + $this->removeContentTypes($context); + $this->removeViewHistory($context); + $this->removeUcmContent($context); // this might be obsolete... + $this->removeContentItemTagMap($context); + $this->removeActionLogConfig($context); + + if ($fields) + { + $this->removeFields($context); + $this->removeFieldsGroups($context); + } + } + + /** + * Remove content types related to this view + * + * @param string $context The view context + * + * @return void + * @since 4.4.2 + */ + protected function removeContentTypes(string $context): void + { + // Create a new query object. + $query = $this->db->getQuery(true); + + // Select id from content type table + $query->select($this->db->quoteName('type_id')); + $query->from($this->db->quoteName('#__content_types')); + + // Where Item alias is found + $query->where($this->db->quoteName('type_alias') . ' = '. $this->db->quote($context)); + $this->db->setQuery($query); + + // Execute query to see if alias is found + $this->db->execute(); + $found = $this->db->getNumRows(); + + // Now check if there were any rows + if ($found) + { + // Since there are load the needed item type ids + $ids = $this->db->loadColumn(); + + // Remove Item from the content type table + $condition = [ + $this->db->quoteName('type_alias') . ' = '. $this->db->quote($context) + ]; + + // Create a new query object. + $query = $this->db->getQuery(true); + $query->delete($this->db->quoteName('#__content_types')); + $query->where($condition); + $this->db->setQuery($query); + + // Execute the query to remove Item items + $done = $this->db->execute(); + if ($done) + { + // If successfully remove Item add queued success message. + $this->app->enqueueMessage( + Text::sprintf('The (%s) type alias was removed from the #__content_type table.', $context) + ); + } + + // Make sure that all the items are cleared from DB + $this->removeUcmBase($ids); + } + } + + /** + * Remove fields related to this view + * + * @param string $context The view context + * + * @return void + * @since 4.4.2 + */ + protected function removeFields(string $context): void + { + // Create a new query object. + $query = $this->db->getQuery(true); + + // Select ids from fields + $query->select($this->db->quoteName('id')); + $query->from($this->db->quoteName('#__fields')); + + // Where context is found + $query->where( + $this->db->quoteName('context') . ' = '. $this->db->quote($context) + ); + $this->db->setQuery($query); + + // Execute query to see if context is found + $this->db->execute(); + $found = $this->db->getNumRows(); + + // Now check if there were any rows + if ($found) + { + // Since there are load the needed release_check field ids + $ids = $this->db->loadColumn(); + + // Create a new query object. + $query = $this->db->getQuery(true); + + // Remove context from the field table + $condition = [ + $this->db->quoteName('context') . ' = '. $this->db->quote($context) + ]; + + $query->delete($this->db->quoteName('#__fields')); + $query->where($condition); + + $this->db->setQuery($query); + + // Execute the query to remove release_check items + $done = $this->db->execute(); + if ($done) + { + // If successfully remove context add queued success message. + $this->app->enqueueMessage( + Text::sprintf('The fields with context (%s) was removed from the #__fields table.', $context) + ); + } + + // Make sure that all the field values are cleared from DB + $this->removeFieldsValues($context, $ids); + } + } + + /** + * Remove fields values related to fields + * + * @param string $context The view context + * @param array $ids The view context + * + * @return void + * @since 4.4.2 + */ + protected function removeFieldsValues(string $context, array $ids): void + { + $condition = [ + $this->db->quoteName('field_id') . ' IN ('. implode(',', $ids) .')' + ]; + + // Create a new query object. + $query = $this->db->getQuery(true); + $query->delete($this->db->quoteName('#__fields_values')); + $query->where($condition); + $this->db->setQuery($query); + + // Execute the query to remove field values + $done = $this->db->execute(); + if ($done) + { + // If successfully remove release_check add queued success message. + $this->app->enqueueMessage( + Text::sprintf('The fields values for (%s) was removed from the #__fields_values table.', $context) + ); + } + } + + /** + * Remove fields groups related to fields + * + * @param string $context The view context + * + * @return void + * @since 4.4.2 + */ + protected function removeFieldsGroups(string $context): void + { + // Create a new query object. + $query = $this->db->getQuery(true); + + // Select ids from fields + $query->select($this->db->quoteName('id')); + $query->from($this->db->quoteName('#__fields_groups')); + + // Where context is found + $query->where( + $this->db->quoteName('context') . ' = '. $this->db->quote($context) + ); + $this->db->setQuery($query); + + // Execute query to see if context is found + $this->db->execute(); + $found = $this->db->getNumRows(); + + // Now check if there were any rows + if ($found) + { + // Create a new query object. + $query = $this->db->getQuery(true); + + // Remove context from the field table + $condition = [ + $this->db->quoteName('context') . ' = '. $this->db->quote($context) + ]; + + $query->delete($this->db->quoteName('#__fields_groups')); + $query->where($condition); + + $this->db->setQuery($query); + + // Execute the query to remove release_check items + $done = $this->db->execute(); + if ($done) + { + // If successfully remove context add queued success message. + $this->app->enqueueMessage( + Text::sprintf('The fields with context (%s) was removed from the #__fields_groups table.', $context) + ); + } + } + } + + /** + * Remove history related to this view + * + * @param string $context The view context + * + * @return void + * @since 4.4.2 + */ + protected function removeViewHistory(string $context): void + { + // Remove Item items from the ucm content table + $condition = [ + $this->db->quoteName('item_id') . ' LIKE ' . $this->db->quote($context . '.%') + ]; + + // Create a new query object. + $query = $this->db->getQuery(true); + $query->delete($this->db->quoteName('#__history')); + $query->where($condition); + $this->db->setQuery($query); + + // Execute the query to remove Item items + $done = $this->db->execute(); + if ($done) + { + // If successfully removed Items add queued success message. + $this->app->enqueueMessage( + Text::sprintf('The (%s) items were removed from the #__history table.', $context) + ); + } + } + + /** + * Remove ucm base values related to these IDs + * + * @param array $ids The type ids + * + * @return void + * @since 4.4.2 + */ + protected function removeUcmBase(array $ids): void + { + // Make sure that all the items are cleared from DB + foreach ($ids as $type_id) + { + // Remove Item items from the ucm base table + $condition = [ + $this->db->quoteName('ucm_type_id') . ' = ' . $type_id + ]; + + // Create a new query object. + $query = $this->db->getQuery(true); + $query->delete($this->db->quoteName('#__ucm_base')); + $query->where($condition); + $this->db->setQuery($query); + + // Execute the query to remove Item items + $this->db->execute(); + } + + $this->app->enqueueMessage( + Text::_('All related items was removed from the #__ucm_base table.') + ); + } + + /** + * Remove ucm content values related to this view + * + * @param string $context The view context + * + * @return void + * @since 4.4.2 + */ + protected function removeUcmContent(string $context): void + { + // Remove Item items from the ucm content table + $condition = [ + $this->db->quoteName('core_type_alias') . ' = ' . $this->db->quote($context) + ]; + + // Create a new query object. + $query = $this->db->getQuery(true); + $query->delete($this->db->quoteName('#__ucm_content')); + $query->where($condition); + $this->db->setQuery($query); + + // Execute the query to remove Item items + $done = $this->db->execute(); + if ($done) + { + // If successfully removed Item add queued success message. + $this->app->enqueueMessage( + Text::sprintf('The (%s) type alias was removed from the #__ucm_content table.', $context) + ); + } + } + + /** + * Remove content item tag map related to this view + * + * @param string $context The view context + * + * @return void + * @since 4.4.2 + */ + protected function removeContentItemTagMap(string $context): void + { + // Create a new query object. + $query = $this->db->getQuery(true); + + // Remove Item items from the contentitem tag map table + $condition = [ + $this->db->quoteName('type_alias') . ' = '. $this->db->quote($context) + ]; + + // Create a new query object. + $query = $this->db->getQuery(true); + $query->delete($this->db->quoteName('#__contentitem_tag_map')); + $query->where($condition); + $this->db->setQuery($query); + + // Execute the query to remove Item items + $done = $this->db->execute(); + if ($done) + { + // If successfully remove Item add queued success message. + $this->app->enqueueMessage( + Text::sprintf('The (%s) type alias was removed from the #__contentitem_tag_map table.', $context) + ); + } + } + + /** + * Remove action log config related to this view + * + * @param string $context The view context + * + * @return void + * @since 4.4.2 + */ + protected function removeActionLogConfig(string $context): void + { + // Remove ###component### view from the action_log_config table + $condition = [ + $this->db->quoteName('type_alias') . ' = '. $this->db->quote($context) + ]; + + // Create a new query object. + $query = $this->db->getQuery(true); + $query->delete($this->db->quoteName('#__action_log_config')); + $query->where($condition); + $this->db->setQuery($query); + + // Execute the query to remove com_###component###.view + $done = $this->db->execute(); + if ($done) + { + // If successfully removed ###component### view add queued success message. + $this->app->enqueueMessage( + Text::sprintf('The (%s) type alias was removed from the #__action_log_config table.', $context) + ); + } + } + + /** + * Remove Asset Table Integrated + * + * @return void + * @since 4.4.2 + */ + protected function removeAssetData(): void + { + // Remove ###component### assets from the assets table + $condition = [ + $this->db->quoteName('name') . ' LIKE ' . $this->db->quote('com_###component###.%') + ]; + + // Create a new query object. + $query = $this->db->getQuery(true); + $query->delete($this->db->quoteName('#__assets')); + $query->where($condition); + $this->db->setQuery($query); + $done = $this->db->execute(); + if ($done) + { + // If successfully removed ###component### add queued success message. + $this->app->enqueueMessage( + Text::_('All related (com_###component###) items was removed from the #__assets table.') + ); + } + } + + /** + * Remove action logs extensions integrated + * + * @return void + * @since 4.4.2 + */ + protected function removeActionLogsExtensions(): void + { + // Remove ###component### from the action_logs_extensions table + $extension = [ + $this->db->quoteName('extension') . ' = ' . $this->db->quote('com_###component###') + ]; + + // Create a new query object. + $query = $this->db->getQuery(true); + $query->delete($this->db->quoteName('#__action_logs_extensions')); + $query->where($extension); + $this->db->setQuery($query); + + // Execute the query to remove ###component### + $done = $this->db->execute(); + if ($done) + { + // If successfully remove ###component### add queued success message. + $this->app->enqueueMessage( + Text::_('The (com_###component###) extension was removed from the #__action_logs_extensions table.') + ); + } + } + + /** + * Remove remove database fix (if possible) + * + * @return void + * @since 4.4.2 + */ + protected function removeDatabaseAssetsRulesFix(): void + { + // Get the biggest rule column in the assets table at this point. + $length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; + $this->db->setQuery($length); + if ($this->db->execute()) + { + $rule_length = $this->db->loadResult(); + // Check the size of the rules column + if ($rule_length < 5120) + { + // Revert the assets table rules column back to the default + $revert_rule = "ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.';"; + $this->db->setQuery($revert_rule); + $this->db->execute(); + + $this->app->enqueueMessage( + Text::_('Reverted the #__assets table rules column back to its default size of varchar(5120).') + ); + } + else + { + $this->app->enqueueMessage( + Text::_('Could not revert the #__assets table rules column back to its default size of varchar(5120), since there is still one or more components that still requires the column to be larger.') + ); + } + } + }###INSTALLERMETHODS### +} diff --git a/admin/compiler/joomla_4/LAYOUT_OVERRIDE.php b/admin/compiler/joomla_4/LAYOUT_OVERRIDE.php new file mode 100644 index 000000000..1db124be7 --- /dev/null +++ b/admin/compiler/joomla_4/LAYOUT_OVERRIDE.php @@ -0,0 +1,22 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +###OVERRIDE_LAYOUT_HEADER### + +// No direct access to this file +defined('JPATH_BASE') or die;###OVERRIDE_LAYOUT_CODE### + +?>###OVERRIDE_LAYOUT_BODY### diff --git a/admin/compiler/joomla_4/LICENSE.txt b/admin/compiler/joomla_4/LICENSE.txt new file mode 100644 index 000000000..df50810b8 --- /dev/null +++ b/admin/compiler/joomla_4/LICENSE.txt @@ -0,0 +1,340 @@ +GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/admin/compiler/joomla_4/README.md b/admin/compiler/joomla_4/README.md new file mode 100644 index 000000000..dbb7b6a53 --- /dev/null +++ b/admin/compiler/joomla_4/README.md @@ -0,0 +1 @@ +###README### \ No newline at end of file diff --git a/admin/compiler/joomla_4/README.txt b/admin/compiler/joomla_4/README.txt new file mode 100644 index 000000000..dbb7b6a53 --- /dev/null +++ b/admin/compiler/joomla_4/README.txt @@ -0,0 +1 @@ +###README### \ No newline at end of file diff --git a/admin/compiler/joomla_4/SITE_ADMIN_VIEW.php b/admin/compiler/joomla_4/SITE_ADMIN_VIEW.php new file mode 100644 index 000000000..285eb38ee --- /dev/null +++ b/admin/compiler/joomla_4/SITE_ADMIN_VIEW.php @@ -0,0 +1,28 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +###SITE_ADMIN_VIEW_HEADER### + +// No direct access to this file +defined('_JEXEC') or die; + +?> +
+toolbar->render(); ?> +
+###EDITBODY### +
+
###EDITBODYSCRIPT### diff --git a/admin/compiler/joomla_4/SITE_ADMIN_VIEW_CONTROLLER.php b/admin/compiler/joomla_4/SITE_ADMIN_VIEW_CONTROLLER.php new file mode 100644 index 000000000..95af762f1 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_ADMIN_VIEW_CONTROLLER.php @@ -0,0 +1,291 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Controller; + +###SITE_ADMIN_VIEW_CONTROLLER_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###View### Form Controller + * + * @since 1.6 + */ +class ###View###Controller extends FormController +{ + use VersionableControllerTrait; + + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_###COMPONENT###_###VIEW###'; + + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * The context for storing internal data, e.g. record. + * + * @var string + * @since 1.6 + */ + protected $context = '###view###'; + + /** + * The URL view item variable. + * + * @var string + * @since 1.6 + */ + protected $view_item = '###view###'; + + /** + * The URL view list variable. + * + * @var string + * @since 1.6 + */ + protected $view_list = '###SITE_DEFAULT_VIEW###';###ADMIN_CUSTOM_BUTTONS_CONTROLLER### + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = []) + {###JCONTROLLERFORM_ALLOWADD### + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = [], $key = 'id') + {###JCONTROLLERFORM_ALLOWEDIT### + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string) $ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('###View###', '', []); + + // Preset the redirect + $this->setRedirect(Route::_('index.php?option=com_###component###&view=###views###' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64');###JCONTROLLERFORM_BEFORECANCEL### + + $cancel = parent::cancel($key); + + if (!is_null($return) && Uri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + Route::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; + + // Redirect to the item screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string) $this->ref; + + // Redirect to the list screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + }###JCONTROLLERFORM_AFTERCANCEL### + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + Route::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; + + // Redirect to the item screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string) $this->ref; + + // Redirect to the list screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) + {###POSTSAVEHOOK### + } + +} diff --git a/admin/compiler/joomla_4/SITE_ADMIN_VIEW_HTML.php b/admin/compiler/joomla_4/SITE_ADMIN_VIEW_HTML.php new file mode 100644 index 000000000..0f3cac219 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_ADMIN_VIEW_HTML.php @@ -0,0 +1,143 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\View\###View###; + +###SITE_ADMIN_VIEW_HTML_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +/** + * ###View### Html View class + * + * @since 1.6 + */ +class HtmlView extends BaseHtmlView +{ + /** + * ###View### view display method + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return void + * @since 1.6 + */ + public function display($tpl = null) + { + // set params + $this->params = ComponentHelper::getParams('com_###component###'); + $this->useCoreUI = true; + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->state = $this->get('State'); + $this->styles = $this->get('Styles'); + $this->scripts = $this->get('Scripts'); + // get action permissions + $this->canDo = ###Component###Helper::getActions('###view###', $this->item); + // get input + $jinput = Factory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + }###LINKEDVIEWITEMS### + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new \Exception(implode("\n", $errors), 500); + } + + // Set the html view document stuff + $this->_prepareDocument(); + + // Display the template + parent::display($tpl); + } + + /** + * Add the page title and toolbar. + * + * @return void + * @since 1.6 + */ + protected function addToolbar(): void + { + ###ADDTOOLBAR### + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * @param bool $shorten The switch to shorten. + * @param int $length The shorting length. + * + * @return mixed The escaped value. + * @since 1.6 + */ + public function escape($var, bool $shorten = true, int $length = 30) + { + if (!is_string($var)) + { + return $var; + } + + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length); + } + + /** + * Prepare some document related stuff. + * + * @return void + * @since 1.6 + */ + protected function _prepareDocument(): void + {###JQUERY### + $isNew = ($this->item->id < 1); + $this->getDocument()->setTitle(Text::_($isNew ? 'COM_###COMPONENT###_###VIEW###_NEW' : 'COM_###COMPONENT###_###VIEW###_EDIT')); + // add styles + foreach ($this->styles as $style) + { + Html::_('stylesheet', $style, ['version' => 'auto']); + }###AJAXTOKE######LINKEDVIEWTABLESCRIPTS### + // add scripts + foreach ($this->scripts as $script) + { + Html::_('script', $script, ['version' => 'auto']); + }###DOCUMENT_CUSTOM_PHP### + } +} diff --git a/admin/compiler/joomla_4/SITE_ADMIN_VIEW_MODEL.php b/admin/compiler/joomla_4/SITE_ADMIN_VIEW_MODEL.php new file mode 100644 index 000000000..facbcf2c0 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_ADMIN_VIEW_MODEL.php @@ -0,0 +1,446 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Model; + +###SITE_ADMIN_VIEW_MODEL_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### ###View### Admin Model + * + * @since 1.6 + */ +class ###View###Model extends AdminModel +{ + use VersionableModelTrait; + + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = ###TABLAYOUTFIELDSARRAY###; + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_###COMPONENT###'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_###component###.###view###'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return Table A database object + * + * @since 3.0 + * @throws \Exception + */ + public function getTable($type = '###view###', $prefix = 'Administrator', $config = []) + { + // get instance of the table + return parent::getTable($type, $prefix, $config); + }###ADMIN_CUSTOM_BUTTONS_METHOD### + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + {###LICENSE_LOCKED_CHECK### + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + }###METHOD_GET_ITEM### + }###LINKEDVIEWGLOBAL### + + return $item; + }###LINKEDVIEWMETHODS######LICENSE_LOCKED_SET_BOOL### + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData;###JMODELADMIN_GETFORM### + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_###component###/js/###view###.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + {###JMODELADMIN_CANDELETE### + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + {###JMODELADMIN_CANEDITSTATE### + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = [], $key = 'id') + {###JMODELADMIN_ALLOWEDIT### + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param Table $table A Table object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + {###LICENSE_TABLE_LOCKED_CHECK### + $date = $this->getDatabase(); + $user = $this->getCurrentUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = $this->getDatabase(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__###component###_###view###')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = Factory::getApplication()->getUserState('com_###component###.edit.###view###.data', []); + + if (empty($data)) + { + $data = $this->getItem(); + } + + // run the perprocess of the data + $this->preprocessData('com_###component###.###view###', $data); + + return $data; + }###VALIDATIONFIX######UNIQUEFIELDS### + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + {###JMODELADMIN_BEFORE_DELETE### + if (!parent::delete($pks)) + { + return false; + }###JMODELADMIN_AFTER_DELETE### + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + {###JMODELADMIN_BEFORE_PUBLISH### + if (!parent::publish($pks, $value)) + { + return false; + }###JMODELADMIN_AFTER_PUBLISH### + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user ??= $this->getCurrentUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ###Component###Helper::getActions('###view###'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new UCMType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + }###MODEL_BATCH_COPY######MODEL_BATCH_MOVE### + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new Registry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + }###CHECKBOX_SAVE######METHOD_ITEM_SAVE### + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new Registry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + }###TITLEALIASFIX### + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field, $value) + { + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + }###GENERATENEWTITLE### +} diff --git a/admin/compiler/joomla_4/SITE_AJAX_CONTROLLER.php b/admin/compiler/joomla_4/SITE_AJAX_CONTROLLER.php new file mode 100644 index 000000000..423691e92 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_AJAX_CONTROLLER.php @@ -0,0 +1,97 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Controller; + +use Joomla\CMS\Factory; +use Joomla\CMS\Application\CMSApplication; +use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\MVC\Factory\MVCFactoryInterface; +use Joomla\CMS\Session\Session; +use Joomla\Input\Input; +use Joomla\Utilities\ArrayHelper; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### Ajax Base Controller + * + * @since 1.6 + */ +class AjaxController extends BaseController +{ + /** + * Constructor. + * + * @param array $config An optional associative array of configuration settings. + * Recognized key values include 'name', 'default_task', 'model_path', and + * 'view_path' (this list is not meant to be comprehensive). + * @param ?MVCFactoryInterface $factory The factory. + * @param ?CMSApplication $app The Application for the dispatcher + * @param ?Input $input Input + * + * @since 3.0 + */ + public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null) + { + parent::__construct($config, $factory, $app, $input); + + // make sure all json stuff are set + $this->app->getDocument()->setMimeEncoding( 'application/json' ); + $this->app->setHeader('Content-Disposition','attachment;filename="getajax.json"'); + $this->app->setHeader('Access-Control-Allow-Origin', '*'); + // load the tasks ###REGISTER_SITE_AJAX_TASK### + } + + public function ajax() + { + // get the user for later use + $user = $this->app->getIdentity(); + // get the input values + $jinput = $this->input ?? $this->app->input; + // check if we should return raw (DEFAULT TRUE SINCE J4) + $returnRaw = $jinput->get('raw', true, 'BOOLEAN'); + // return to a callback function + $callback = $jinput->get('callback', null, 'CMD'); + // Check Token! + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); + if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) + { + // get the task + $task = $this->getTask(); + switch($task) + {###AJAX_SITE_INPUT_RETURN### + } + } + else + { + // return to a callback function + if($callback) + { + echo $callback."(".json_encode(['error' => 'There was an error! [139]']).");"; + } + elseif($returnRaw) + { + echo json_encode(['error' => 'There was an error! [139]']); + } + else + { + echo "(".json_encode(['error' => 'There was an error! [139]']).");"; + } + } + } +} diff --git a/admin/compiler/joomla_4/SITE_AJAX_MODEL.php b/admin/compiler/joomla_4/SITE_AJAX_MODEL.php new file mode 100644 index 000000000..b56b2df9c --- /dev/null +++ b/admin/compiler/joomla_4/SITE_AJAX_MODEL.php @@ -0,0 +1,62 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Model; + +###AJAX_SITE_MODEL_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### Ajax List Model + * + * @since 1.6 + */ +class AjaxModel extends ListModel +{ + /** + * The component params. + * + * @var Registry + * @since 3.2.0 + */ + protected Registry $app_params; + + /** + * The application object. + * + * @var CMSApplicationInterface The application instance. + * @since 3.2.0 + */ + protected CMSApplicationInterface $app; + + /** + * Constructor + * + * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). + * @param ?MVCFactoryInterface $factory The factory. + * + * @since 1.6 + * @throws \Exception + */ + public function __construct($config = [], MVCFactoryInterface $factory = null) + { + parent::__construct($config, $factory); + + $this->app_params = ComponentHelper::getParams('com_###component###'); + $this->app ??= Factory::getApplication(); + }###AJAX_SITE_MODEL_METHODS### +} diff --git a/admin/compiler/joomla_4/SITE_AUTOLOADER_CLASS.php b/admin/compiler/joomla_4/SITE_AUTOLOADER_CLASS.php new file mode 100644 index 000000000..d3af848bd --- /dev/null +++ b/admin/compiler/joomla_4/SITE_AUTOLOADER_CLASS.php @@ -0,0 +1,18 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +// No direct access to this file +defined('_JEXEC') or die;###SITE_POWER_HELPER### diff --git a/admin/compiler/joomla_4/SITE_DISPATCHER.php b/admin/compiler/joomla_4/SITE_DISPATCHER.php new file mode 100644 index 000000000..c14886997 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_DISPATCHER.php @@ -0,0 +1,41 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Dispatcher; + +use Joomla\CMS\Dispatcher\ComponentDispatcher; + +// No direct access to this file +\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +/** + * ComponentDispatcher class for com_###component### + * + * @since 4.0.0 + */ +class Dispatcher extends ComponentDispatcher +{ + /** + * Dispatch a controller task. Redirecting the user if appropriate. + * + * @return void + * + * @since 4.0.0 + */ + public function dispatch() + { + parent::dispatch(); + } +} diff --git a/admin/compiler/joomla_4/SITE_DISPLAY_CONTROLLER.php b/admin/compiler/joomla_4/SITE_DISPLAY_CONTROLLER.php new file mode 100644 index 000000000..704227616 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_DISPLAY_CONTROLLER.php @@ -0,0 +1,132 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Controller; + +use Joomla\CMS\Factory; +use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Router\Route; +use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Language\Text; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### master site display controller. + * + * @since 4.0 + */ +class DisplayController extends BaseController +{ + /** + * Method to display a view. + * + * @param boolean $cachable If true, the view output will be cached. + * @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link InputFilter::clean()}. + * + * @return DisplayController This object to support chaining. + * @since 1.5 + */ + function display($cachable = false, $urlparams = false) + { + // set default view if not set + $view = $this->input->getCmd('view', '###SITE_DEFAULT_VIEW###'); + $this->input->set('view', $view); + $isEdit = $this->checkEditView($view); + $layout = $this->input->get('layout', null, 'WORD'); + $id = $this->input->getInt('id'); + $cachable = true; + + // ensure that the view is not cashable if edit view or if user is logged in + $user = $this->app->getIdentity(); + if ($user->get('id') || $this->input->getMethod() === 'POST' || $isEdit) + { + $cachable = false; + } + + // Check for edit form. + if ($isEdit && !$this->checkEditId('com_###component###.edit.'.$view, $id)) + { + // check if item was opened from other than its own list view + $ref = $this->input->getCmd('ref', 0); + $refid = $this->input->getInt('refid', 0); + + // set redirect + if ($refid > 0 && Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($ref)) + { + // redirect to item of ref + $this->setRedirect(Route::_('index.php?option=com_###component###&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); + } + elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($ref)) + { + // redirect to ref + $this->setRedirect(Route::_('index.php?option=com_###component###&view='.(string)$ref, false)); + } + else + { + // normal redirect back to the list default site view + $this->setRedirect(Route::_('index.php?option=com_###component###&view=###SITE_DEFAULT_VIEW###', false)); + } + + // Somehow the person just went to the form - we don't allow that. + throw new \Exception(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 403); + } + + // we may need to make this more dynamic in the future. (TODO) + $safeurlparams = array( + 'catid' => 'INT', + 'id' => 'INT', + 'cid' => 'ARRAY', + 'year' => 'INT', + 'month' => 'INT', + 'limit' => 'UINT', + 'limitstart' => 'UINT', + 'showall' => 'INT', + 'return' => 'BASE64', + 'filter' => 'STRING', + 'filter_order' => 'CMD', + 'filter_order_Dir' => 'CMD', + 'filter-search' => 'STRING', + 'print' => 'BOOLEAN', + 'lang' => 'CMD', + 'Itemid' => 'INT'); + + // should these not merge? + if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($urlparams)) + { + $safeurlparams = Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge(array($urlparams, $safeurlparams)); + } + + parent::display($cachable, $safeurlparams); + + return $this; + } + + protected function checkEditView($view) + { + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($view)) + { + $views = [###SITE_EDIT_VIEW_ARRAY### + ]; + // check if this is a edit view + if (in_array($view,$views)) + { + return true; + } + } + return false; + } +} diff --git a/admin/compiler/joomla_4/SITE_FORM_CHECKBOXES_FIELD.php b/admin/compiler/joomla_4/SITE_FORM_CHECKBOXES_FIELD.php new file mode 100644 index 000000000..f6a272785 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_FORM_CHECKBOXES_FIELD.php @@ -0,0 +1,51 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Field; + +use Joomla\CMS\Factory; +use Joomla\CMS\Form\Field\CheckboxesField; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Component\ComponentHelper; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Helper\###Component###Helper; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Type### Form Field class for the ###Component### component + * + * @since 1.6 + */ +class ###Type###Field extends CheckboxesField +{ + /** + * The ###type### field type. + * + * @var string + */ + public $type = '###Type###'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of Html options. + */ + protected function getOptions() + { + ###JFORM_GETOPTIONS_PHP### + } +} diff --git a/admin/compiler/joomla_4/SITE_FORM_CUSTOM_FIELD.php b/admin/compiler/joomla_4/SITE_FORM_CUSTOM_FIELD.php new file mode 100644 index 000000000..b9562c00b --- /dev/null +++ b/admin/compiler/joomla_4/SITE_FORM_CUSTOM_FIELD.php @@ -0,0 +1,36 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Field; + +###SITE_FORM_CUSTOM_FIELD_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Type### Form Field class for the ###Component### component + * + * @since 1.6 + */ +class ###Type###Field extends ###FORM_EXTENDS### +{ + /** + * The ###type### field type. + * + * @var string + */ + public $type = '###Type###';###FORM_CUSTOM_FIELD_PHP### +} diff --git a/admin/compiler/joomla_4/SITE_FORM_LIST_FIELD.php b/admin/compiler/joomla_4/SITE_FORM_LIST_FIELD.php new file mode 100644 index 000000000..23cdf9972 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_FORM_LIST_FIELD.php @@ -0,0 +1,52 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Field; + +use Joomla\CMS\Factory; +use Joomla\CMS\Form\Field\ListField; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Component\ComponentHelper; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Helper\###Component###Helper; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Type### Form Field class for the ###Component### component + * + * @since 1.6 + */ +class ###Type###Field extends ListField +{ + /** + * The ###type### field type. + * + * @var string + */ + public $type = '###Type###';###ADD_BUTTON### + + /** + * Method to get a list of options for a list input. + * + * @return array An array of Html options. + * @since 1.6 + */ + protected function getOptions() + { + ###JFORM_GETOPTIONS_PHP### + } +} diff --git a/admin/compiler/joomla_4/SITE_FORM_RADIO_FIELD.php b/admin/compiler/joomla_4/SITE_FORM_RADIO_FIELD.php new file mode 100644 index 000000000..bab377f5a --- /dev/null +++ b/admin/compiler/joomla_4/SITE_FORM_RADIO_FIELD.php @@ -0,0 +1,51 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Field; + +use Joomla\CMS\Factory; +use Joomla\CMS\Form\Field\RadioField; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Component\ComponentHelper; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Helper\###Component###Helper; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Type### Form Field class for the ###Component### component + * + * @since 1.6 + */ +class ###Type###Field extends RadioField +{ + /** + * The ###type### field type. + * + * @var string + */ + public $type = '###Type###'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of Html options. + */ + protected function getOptions() + { + ###JFORM_GETOPTIONS_PHP### + } +} diff --git a/admin/compiler/joomla_4/SITE_FORM_RULE.php b/admin/compiler/joomla_4/SITE_FORM_RULE.php new file mode 100644 index 000000000..8dba963e5 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_FORM_RULE.php @@ -0,0 +1,37 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Rule; + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\Form; +use Joomla\CMS\Form\FormRule; +use Joomla\Registry\Registry; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Component\ComponentHelper; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Helper\###Component###Helper; + +// No direct access to this file +\defined('JPATH_PLATFORM') or die; + +/** + * Form Rule (###Name###) class for the Joomla Platform. + * + * @since 3.5 + */ +class ###Name###Rule extends FormRule +{###VALIDATION_RULE_METHODS### +} diff --git a/admin/compiler/joomla_4/SITE_FORM_USER_FIELD.php b/admin/compiler/joomla_4/SITE_FORM_USER_FIELD.php new file mode 100644 index 000000000..fbc1b36d9 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_FORM_USER_FIELD.php @@ -0,0 +1,65 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Field; + +use Joomla\CMS\Factory; +use Joomla\CMS\Form\Field\UserField; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Component\ComponentHelper; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Helper\###Component###Helper; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Type### Form Field class for the ###Component### component + * + * @since 1.6 + */ +class ###Type###Field extends UserField +{ + /** + * The ###type### field type. + * + * @var string + */ + public $type = '###Type###'; + + /** + * Method to get the filtering groups (null means no filtering) + * + * @return mixed array of filtering groups or null. + * + * @since 1.6 + */ + protected function getGroups() + { + ###JFORM_GETGROUPS_PHP### + } + + /** + * Method to get the users to exclude from the list of users + * + * @return mixed Array of users to exclude or null to not exclude them + * + * @since 1.6 + */ + protected function getExcluded() + { + ###JFORM_GETEXCLUDED_PHP### + } +} diff --git a/admin/compiler/joomla_4/SITE_HEADERCHECK.php b/admin/compiler/joomla_4/SITE_HEADERCHECK.php new file mode 100644 index 000000000..55e244ed3 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_HEADERCHECK.php @@ -0,0 +1,135 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Helper; + +use Joomla\CMS\Factory; +use Joomla\CMS\Document\Document; +use Joomla\CMS\Application\CMSApplication; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * Helper class for checking loaded scripts and styles in the document header. + * + * @since 3.2.0 + */ +class HeaderCheck +{ + /** + * @var CMSApplication Application object + * + * @since 3.2.0 + */ + protected CMSApplication $app; + + /** + * @var Document object + * + * @since 3.2.0 + */ + protected Document $document; + + /** + * Construct the app and document + * + * @since 3.2.0 + */ + public function __construct() + { + // Initializes the application object. + $this->app ??= Factory::getApplication(); + + // Initializes the document object. + $this->document = $this->app->getDocument(); + } + + /** + * Check if a JavaScript file is loaded in the document head. + * + * @param string $scriptName Name of the script to check. + * + * @return bool True if the script is loaded, false otherwise. + * @since 3.2.0 + */ + public function js_loaded(string $scriptName): bool + { + return $this->isLoaded($scriptName, 'scripts'); + } + + /** + * Check if a CSS file is loaded in the document head. + * + * @param string $scriptName Name of the stylesheet to check. + * + * @return bool True if the stylesheet is loaded, false otherwise. + * @since 3.2.0 + */ + public function css_loaded(string $scriptName): bool + { + return $this->isLoaded($scriptName, 'styleSheets'); + } + + /** + * Abstract method to check if a given script or stylesheet is loaded. + * + * @param string $scriptName Name of the script or stylesheet. + * @param string $type Type of asset to check ('scripts' or 'styleSheets'). + * + * @return bool True if the asset is loaded, false otherwise. + * @since 3.2.0 + */ + private function isLoaded(string $scriptName, string $type): bool + { + // UIkit specific check + if ($this->isUIkit($scriptName)) + { + return true; + } + + $head_data = $this->document->getHeadData(); + foreach (array_keys($head_data[$type]) as $script) + { + if (stristr($script, $scriptName)) + { + return true; + } + } + + return false; + } + + /** + * Check for UIkit framework specific conditions. + * + * @param string $scriptName Name of the script or stylesheet. + * + * @return bool True if UIkit specific conditions are met, false otherwise. + * @since 3.2.0 + */ + private function isUIkit(string $scriptName): bool + { + if (strpos($scriptName, 'uikit') !== false) + { + $get_template_name = $this->app->getTemplate('template')->template; + if (strpos($get_template_name, 'yoo') !== false) + { + return true; + } + } + return false; + } +} diff --git a/admin/compiler/joomla_3/JCB_Helper_site.php b/admin/compiler/joomla_4/SITE_HELPER_CLASS.php similarity index 50% rename from admin/compiler/joomla_3/JCB_Helper_site.php rename to admin/compiler/joomla_4/SITE_HELPER_CLASS.php index c85a72e34..7dad6f100 100644 --- a/admin/compiler/joomla_3/JCB_Helper_site.php +++ b/admin/compiler/joomla_4/SITE_HELPER_CLASS.php @@ -2,46 +2,51 @@ /** * @package Joomla.Component.Builder * - * @created 30th April, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Component Builder + * @created 4th September 2022 + * @author Llewellyn van der Merwe + * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; ?> ###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Helper; -// No direct access to this file -defined('_JEXEC') or die('Restricted access');###SITE_POWER_HELPER### +// The power autoloader for this project site area. +$power_autoloader = JPATH_SITE . '/components/com_###component###/src/Helper/PowerloaderHelper.php'; +if (file_exists($power_autoloader)) +{ + require_once $power_autoloader; +} ###SITE_HELPER_CLASS_HEADER### +// No direct access to this file +\defined('_JEXEC') or die; + /** * ###Component### component helper + * + * @since 3.0 */ abstract class ###Component###Helper { /** - * Adding the utilities trait to this class + * Composer Switch * - * @deprecated 4.0 - Check the trait methods for details, a legacy implementation - */ - use Utilities; - - /** - * get the Component Code Name + * @var array */ - public static $ComponentCodeName = '###component###'; + protected static $composer = []; /** - * Composer Switch - * - * @var array + * The Main Active Language + * + * @var string */ - protected static $composer = array();###SITE_GLOBAL_EVENT_HELPER######SITE_CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT### + public static $langTag;###SITE_GLOBAL_EVENT_HELPER######SITE_CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT### /** * Load the Composer Vendors @@ -52,7 +57,7 @@ public static function composerAutoload($target) if (!isset(self::$composer[$target])) { // get the function name - $functionName = self::safeString('compose' . $target); + $functionName = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe('compose' . $target); // check if method exist if (method_exists(__CLASS__, $functionName)) { @@ -63,6 +68,25 @@ public static function composerAutoload($target) return self::$composer[$target]; } + /** + * Convert a json object to a string + * + * @input string $value The json string to convert + * + * @returns a string + * @deprecated 3.3 Use Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::string(...); + */ + public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') + { + return Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::string( + $value, + $sperator, + $table, + $id, + $name + ); + } + /** * Load the Component xml manifest. */ @@ -74,7 +98,7 @@ public static function manifest() /** * Joomla version object - */ + */ protected static $JVersion; /** @@ -83,9 +107,9 @@ public static function manifest() public static function jVersion() { // check if set - if (!self::checkObject(self::$JVersion)) + if (!Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check(self::$JVersion)) { - self::$JVersion = new JVersion(); + self::$JVersion = new Version(); } return self::$JVersion; } @@ -96,9 +120,9 @@ public static function jVersion() public static function getContributors() { // get params - $params = JComponentHelper::getParams('com_###component###'); + $params = ComponentHelper::getParams('com_###component###'); // start contributors array - $contributors = array(); + $contributors = []; // get all Contributors (max 20) $searchArray = range('0','20'); foreach($searchArray as $nr) @@ -107,73 +131,77 @@ public static function getContributors() { // set link based of selected option if($params->get("useContributor".$nr) == 1) - { + { $link_front = ''; $link_back = ''; } - elseif($params->get("useContributor".$nr) == 2) - { + elseif($params->get("useContributor".$nr) == 2) + { $link_front = ''; $link_back = ''; } - else - { + else + { $link_front = ''; $link_back = ''; } - $contributors[$nr]['title'] = self::htmlEscape($params->get("titleContributor".$nr)); - $contributors[$nr]['name'] = $link_front.self::htmlEscape($params->get("nameContributor".$nr)).$link_back; + $contributors[$nr]['title'] = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($params->get("nameContributor".$nr)).$link_back; } } return $contributors; }###HELP_SITE### /** - * Get any component's model + * Returns any Model object. + * + * @param string $type The model type to instantiate + * @param string $prefix Prefix for the model class name. Optional. + * @param string $component Component name the model belongs to. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return \Joomla\CMS\MVC\Model\BaseDatabaseModel + * @throws \Exception + * @since 4.4 */ - public static function getModel($name, $path = JPATH_COMPONENT_SITE, $Component = '###Component###', $config = array()) + public static function getModel(string $type, string $prefix = 'Site', + string $component = '###component###', array $config = []) { - // fix the name - $name = self::safeString($name); - // full path to models - $fullPathModels = $path . '/models'; - // load the model file - JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); - // make sure the table path is loaded - if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + // make sure the name is correct + $type = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($type, 'F'); + $component = strtolower($component); + + if ($prefix !== 'Site' && $prefix !== 'Administrator') { - // This is the JCB default path to tables in Joomla 3.x - $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; + $prefix = self::getPrefixFromModelPath($prefix); } - // get instance - $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); - // if model not found (strange) - if ($model == false) + + // Get the model through the MVCFactory + return Factory::getApplication()->bootComponent('com_' . $component)->getMVCFactory()->createModel($type, $prefix, $config); + } + + /** + * Get the prefix from the model path + * + * @param string $path The model path + * + * @return string The prefix value + * @since 4.4 + */ + protected static function getPrefixFromModelPath(string $path): string + { + // Check if $path starts with JPATH_ADMINISTRATOR path + if (str_starts_with($path, JPATH_ADMINISTRATOR . '/components/')) { - jimport('joomla.filesystem.file'); - // get file path - $filePath = $path . '/' . $name . '.php'; - $fullPathModel = $fullPathModels . '/' . $name . '.php'; - // check if it exists - if (File::exists($filePath)) - { - // get the file - require_once $filePath; - } - elseif (File::exists($fullPathModel)) - { - // get the file - require_once $fullPathModel; - } - // build class names - $modelClass = $Component . 'Model' . $name; - if (class_exists($modelClass)) - { - // initialize the model - return new $modelClass($config); - } + return 'Administrator'; + } + // Check if $path starts with JPATH_SITE path + elseif (str_starts_with($path, JPATH_SITE . '/components/')) + { + return 'Site'; } - return $model; + + return 'Site'; } /** @@ -181,14 +209,14 @@ public static function getModel($name, $path = JPATH_COMPONENT_SITE, $Component */ public static function setAsset($id, $table, $inherit = true) { - $parent = JTable::getInstance('Asset'); + $parent = Table::getInstance('Asset'); $parent->loadByName('com_###component###'); - + $parentId = $parent->id; $name = 'com_###component###.'.$table.'.'.$id; $title = ''; - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName($name); // Check for an error. @@ -212,27 +240,27 @@ public static function setAsset($id, $table, $inherit = true) $asset->title = $title; // get the default asset rules $rules = self::getDefaultAssetRules('com_###component###', $table, $inherit); - if ($rules instanceof JAccessRules) + if ($rules instanceof AccessRules) { $asset->rules = (string) $rules; } if (!$asset->check() || !$asset->store()) { - JFactory::getApplication()->enqueueMessage($asset->getError(), 'warning'); + Factory::getApplication()->enqueueMessage($asset->getError(), 'warning'); return false; } else { // Create an asset_id or heal one that is corrupted. - $object = new stdClass(); + $object = new \StdClass(); // Must be a valid primary key value. $object->id = $id; $object->asset_id = (int) $asset->id; // Update their asset_id to link to the asset table. - return JFactory::getDbo()->updateObject('#__###component###_'.$table, $object, 'id'); + return Factory::getDbo()->updateObject('#__###component###_'.$table, $object, 'id'); } } return false; @@ -249,7 +277,7 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru if (!$inherit) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getContainer()->get(DatabaseInterface::class); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -264,8 +292,8 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru } } // get asset rules - $result = JAccess::getAssetRules($assetId); - if ($result instanceof JAccessRules) + $result = Access::getAssetRules($assetId); + if ($result instanceof AccessRules) { $_result = (string) $result; $_result = json_decode($_result); @@ -280,7 +308,7 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru elseif ($inherit) { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -288,8 +316,8 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules($_result); + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules($_result); // return filtered rules return $rules; } @@ -303,35 +331,12 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru * @param SimpleXMLElement $xml The XML element reference in which to inject a comment * @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement * - * @return null - * + * @return void + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::append($xml, $node); */ public static function xmlAppend(&$xml, $node) { - if (!$node) - { - // element was not returned - return; - } - switch (get_class($node)) - { - case 'stdClass': - if (property_exists($node, 'comment')) - { - self::xmlComment($xml, $node->comment); - } - if (property_exists($node, 'fieldXML')) - { - self::xmlAppend($xml, $node->fieldXML); - } - break; - case 'SimpleXMLElement': - $domXML = dom_import_simplexml($xml); - $domNode = dom_import_simplexml($node); - $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); - $xml = simplexml_import_dom($domXML); - break; - } + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::append($xml, $node); } /** @@ -340,16 +345,12 @@ public static function xmlAppend(&$xml, $node) * @param SimpleXMLElement $xml The XML element reference in which to inject a comment * @param string $comment The comment to inject * - * @return null - * + * @return void + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::comment($xml, $comment); */ public static function xmlComment(&$xml, $comment) { - $domXML = dom_import_simplexml($xml); - $domComment = new DOMComment($comment); - $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); - $domXML->appendChild($nodeTarget); - $xml = simplexml_import_dom($domXML); + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::comment($xml, $comment); } /** @@ -359,14 +360,11 @@ public static function xmlComment(&$xml, $comment) * @param array $attributes The attributes to apply to the XML element * * @return null - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::attributes($xml, $attributes); */ - public static function xmlAddAttributes(&$xml, $attributes = array()) + public static function xmlAddAttributes(&$xml, $attributes = []) { - foreach ($attributes as $key => $value) - { - $xml->addAttribute($key, $value); - } + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::attributes($xml, $attributes); } /** @@ -376,16 +374,11 @@ public static function xmlAddAttributes(&$xml, $attributes = array()) * @param array $options The options to apply to the XML element * * @return void - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::options($xml, $options); */ - public static function xmlAddOptions(&$xml, $options = array()) + public static function xmlAddOptions(&$xml, $options = []) { - foreach ($options as $key => $value) - { - $addOption = $xml->addChild('option'); - $addOption->addAttribute('value', $key); - $addOption[] = $value; - } + Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::options($xml, $options); } /** @@ -396,28 +389,11 @@ public static function xmlAddOptions(&$xml, $options = array()) * @param array $options The options to apply to the XML element * * @return object - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($attributes, $default, $options); */ public static function getFieldObject(&$attributes, $default = '', $options = null) { - // make sure we have attributes and a type value - if (self::checkArray($attributes) && isset($attributes['type'])) - { - // make sure the form helper class is loaded - if (!method_exists('JFormHelper', 'loadFieldType')) - { - jimport('joomla.form.form'); - } - // get field type - $field = JFormHelper::loadFieldType($attributes['type'], true); - // get field xml - $XML = self::getFieldXML($attributes, $options); - // setup the field - $field->setup($XML, $default); - // return the field object - return $field; - } - return false; + return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($attributes, $default, $options); } /** @@ -427,27 +403,11 @@ public static function getFieldObject(&$attributes, $default = '', $options = nu * @param array $options The options to apply to the XML element * * @return object - * + * @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::xml($attributes, $options); */ public static function getFieldXML(&$attributes, $options = null) { - // make sure we have attributes and a type value - if (self::checkArray($attributes)) - { - // start field xml - $XML = new SimpleXMLElement(''); - // load the attributes - self::xmlAddAttributes($XML, $attributes); - // check if we have options - if (self::checkArray($options)) - { - // load the options - self::xmlAddOptions($XML, $options); - } - // return the field xml - return $XML; - } - return false; + return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::xml($attributes, $options); } /** @@ -471,26 +431,78 @@ public static function renderBoolButton() // button attributes $buttonAttributes = array( 'type' => 'radio', - 'name' => isset($args[0]) ? self::htmlEscape($args[0]) : 'bool_button', - 'label' => isset($args[0]) ? self::safeString(self::htmlEscape($args[0]), 'Ww') : 'Bool Button', // not seen anyway + 'name' => isset($args[0]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[0]) : 'bool_button', + 'label' => isset($args[0]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[0]), 'Ww') : 'Bool Button', // not seen anyway 'class' => 'btn-group', 'filter' => 'INT', 'default' => isset($args[2]) ? (int) $args[2] : 0); // set the button options $buttonOptions = array( - '1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES', - '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); + '1' => isset($args[3]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[3]) : 'JYES', + '0' => isset($args[4]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[4]) : 'JNO'); // return the input - return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; + return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; }###HELPER_UIKIT######HELPER_CREATEUSER### + /** + * Get a variable + * + * @param string $table The table from which to get the variable + * @param string $where The value where + * @param string $whereString The target/field string where/name + * @param string $what The return field + * @param string $operator The operator between $whereString/field and $where/value + * @param string $main The component in which the table is found + * + * @return mix string/int/float + * @deprecated 3.3 Use Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var(...); + */ + public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = '###component###') + { + return Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var( + $table, + $where, + $whereString, + $what, + $operator, + $main + ); + } + + /** + * Get array of variables + * + * @param string $table The table from which to get the variables + * @param string $where The value where + * @param string $whereString The target/field string where/name + * @param string $what The return field + * @param string $operator The operator between $whereString/field and $where/value + * @param string $main The component in which the table is found + * @param bool $unique The switch to return a unique array + * + * @return array + * @deprecated 3.3 Use Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::vars(...); + */ + public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = '###component###', $unique = true) + { + return Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::vars( + $table, + $where, + $whereString, + $what, + $operator, + $main, + $unique + ); + } + public static function isPublished($id,$type) { if ($type == 'raw') { $type = 'item'; } - $db = JFactory::getDbo(); + $db = Factory::getContainer()->get(DatabaseInterface::class); $query = $db->getQuery(true); $query->select(array('a.published')); $query->from('#__###component###_'.$type.' AS a'); @@ -508,7 +520,7 @@ public static function isPublished($id,$type) public static function getGroupName($id) { - $db = JFactory::getDBO(); + $db = Factory::getContainer()->get(DatabaseInterface::class); $query = $db->getQuery(true); $query->select(array('a.title')); $query->from('#__usergroups AS a'); @@ -533,39 +545,39 @@ public static function getGroupName($id) * @param string $component The target component * @param object $user The user whose permissions we are loading * - * @return object The JObject of permission/authorised actions - * + * @return object The CMSObject of permission/authorised actions + * */ public static function getActions($view, &$record = null, $views = null, $target = null, $component = '###component###', $user = 'null') { // load the user if not given - if (!self::checkObject($user)) + if (!Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($user)) { // get the user object - $user = JFactory::getUser(); + $user = Factory::getApplication()->getIdentity(); } - // load the JObject - $result = new JObject; + // load the CMSObject + $result = new CMSObject; // make view name safe (just incase) - $view = self::safeString($view); - if (self::checkString($views)) + $view = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($view); + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($views)) { - $views = self::safeString($views); - } + $views = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($views); + } // get all actions from component - $actions = JAccess::getActionsFromFile( + $actions = Access::getActionsFromFile( JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', "/access/section[@name='component']/" ); - // if non found then return empty JObject + // if non found then return empty CMSObject if (empty($actions)) { return $result; } // get created by if not found - if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) + if (Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($record) && !isset($record->created_by) && isset($record->id)) { - $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); + $record->created_by = Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var($view, $record->id, 'id', 'created_by', '=', $component); } // set actions only set in component settings $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); @@ -574,12 +586,12 @@ public static function getActions($view, &$record = null, $views = null, $target if ($target) { // convert to an array - if (self::checkString($target)) + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($target)) { $target = array($target); } // check if we are good to go - if (self::checkArray($target)) + if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($target)) { $checkTarget = true; } @@ -600,7 +612,7 @@ public static function getActions($view, &$record = null, $views = null, $target // set area $area = 'comp'; // check if the record has an ID and the action is item related (not a component action) - if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && + if (Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) { // we are in item @@ -633,7 +645,7 @@ public static function getActions($view, &$record = null, $views = null, $target } } } - elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) + elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($views) && isset($record->catid) && $record->catid > 0) { // we are in item $area = 'category'; @@ -705,7 +717,7 @@ public static function getActions($view, &$record = null, $views = null, $target * @param array $targets The array of target actions * * @return boolean true if action should be filtered out - * + * */ protected static function filterActions(&$view, &$action, &$targets) { @@ -721,6 +733,58 @@ protected static function filterActions(&$view, &$action, &$targets) return true; } + /** + * Check if have an json string + * + * @input string The json string to check + * + * @returns bool true on success + * @deprecated 3.3 Use Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check($string); + */ + public static function checkJson($string) + { + return Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check($string); + } + + /** + * Check if have an object with a length + * + * @input object The object to check + * + * @returns bool true on success + * @deprecated 3.3 Use Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($object); + */ + public static function checkObject($object) + { + return Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($object); + } + + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns bool/int number of items in array on success + * @deprecated 3.3 Use Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($array, $removeEmptyString); + */ + public static function checkArray($array, $removeEmptyString = false) + { + return Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($array, $removeEmptyString); + } + + /** + * Check if have a string with a length + * + * @input string The string to check + * + * @returns bool true on success + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($string); + */ + public static function checkString($string) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($string); + } + /** * Check if we are connected * Thanks https://stackoverflow.com/a/4860432/1429677 @@ -730,8 +794,8 @@ protected static function filterActions(&$view, &$action, &$targets) public static function isConnected() { // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right? - $connected = @fsockopen("www.example.com", 80); - // website, port (try 80 or 443) + $connected = @fsockopen("www.example.com", 80); + // website, port (try 80 or 443) if ($connected) { //action when connected @@ -746,9 +810,122 @@ public static function isConnected() return $is_conn; } + /** + * Merge an array of array's + * + * @input array The arrays you would like to merge + * + * @returns array on success + * @deprecated 3.3 Use Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge($arrays); + */ + public static function mergeArrays($arrays) + { + return Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge($arrays); + } + // typo sorry! public static function sorten($string, $length = 40, $addTip = true) { return self::shorten($string, $length, $addTip); - }###HELPER_SITE_LICENSE_LOCK######GET_CRYPT_KEY### + } + + /** + * Shorten a string + * + * @input string The you would like to shorten + * + * @returns string on success + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::shorten(...); + */ + public static function shorten($string, $length = 40, $addTip = true) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::shorten($string, $length, $addTip); + } + + /** + * Making strings safe (various ways) + * + * @input string The you would like to make safe + * + * @returns string on success + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(...); + */ + public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe( + $string, + $type, + $spacer, + $replaceNumbers, + $keepOnlyCharacters + ); + } + + /** + * Convert none English strings to code usable string + * + * @input an string + * + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::transliterate($string); + */ + public static function transliterate($string) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::transliterate($string); + } + + /** + * make sure a string is HTML save + * + * @input an html string + * + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html(...); + */ + public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html( + $var, + $charset, + $shorten, + $length + ); + }###HELPER_SITE_LICENSE_LOCK### + + /** + * Convert all int in a string to an English word string + * + * @input an string with numbers + * + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::numbers($string); + */ + public static function replaceNumbers($string) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::numbers($string); + } + + /** + * Convert an integer into an English word string + * Thanks to Tom Nicholson + * + * @input an int + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::number($x); + */ + public static function numberToString($x) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::number($x); + } + + /** + * Random Key + * + * @returns a string + * @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::random($size); + */ + public static function randomkey($size) + { + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::random($size); + }###GET_CRYPT_KEY### } diff --git a/admin/compiler/joomla_4/SITE_HELPER_CONTROLLER.php b/admin/compiler/joomla_4/SITE_HELPER_CONTROLLER.php new file mode 100644 index 000000000..f4090b346 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_HELPER_CONTROLLER.php @@ -0,0 +1,129 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Controller; + +use Joomla\CMS\Factory; +use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\Database\DatabaseInterface; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Session\Session; +use Joomla\Utilities\ArrayHelper; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### Help Base Controller + * + * @since 1.6 + */ +class HelpController extends BaseController +{ + public function __construct($config) + { + parent::__construct($config); + // load the tasks + $this->registerTask('getText', 'help'); + } + + public function help() + { + $user = Factory::getApplication()->getIdentity(); + $jinput = Factory::getApplication()->input; + // Check Token! + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); + if($user->id != 0 && ($jinput->get($token, 0, 'ALNUM') || $token === $call_token)) + { + $task = $this->getTask(); + switch($task){ + case 'getText': + try + { + $idValue = $jinput->get('id', 0, 'INT'); + if($idValue) + { + $result = $this->getHelpDocumentText($idValue); + } + else + { + $result = ''; + } + echo $result; + // stop execution gracefully + jexit(); + } + catch(Exception $e) + { + // stop execution gracefully + jexit(); + } + break; + } + } + else + { + // stop execution gracefully + jexit(); + } + } + + protected function getHelpDocumentText($id) + { + $db = Factory::getContainer()->get(DatabaseInterface::class); + $query = $db->getQuery(true); + $query->select(array('a.title','a.content')); + $query->from('#__###component###_help_document AS a'); + $query->where('a.id = '.(int) $id); + $query->where('a.published = 1'); + $query->where('a.location = 2'); + $db->setQuery($query); + $db->execute(); + if($db->getNumRows()) + { + $text = []; + $document = $db->loadObject(); + // fix image issue + $images['src="images'] = 'src="'.Uri::root().'images'; + $images["src='images"] = "src='".Uri::root()."images"; + $images['src="/images'] = 'src="'.Uri::root().'images'; + $images["src='/images"] = "src='".Uri::root()."images"; + // set document template + $text[] = ""; + $text[] = ''; + $text[] = ""; + $text[] = ''; + $text[] = "".$document->title.""; + $text[] = ''; + $text[] = ''; + $text[] = ""; + $text[] = '
'; + $text[] = '
'; + $text[] = '
'; + // build the help text + $text[] = '

'.$document->title."

"; + $text[] = str_replace(array_keys($images),array_values($images),$document->content); + // end template + $text[] = '


'; + $text[] = '
'; + $text[] = ""; + $text[] = ""; + + return implode("\n",$text); + } + return false; + } +} diff --git a/admin/compiler/joomla_4/SITE_LAYOUT.php b/admin/compiler/joomla_4/SITE_LAYOUT.php new file mode 100644 index 000000000..4d22fd308 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_LAYOUT.php @@ -0,0 +1,22 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +###SITE_LAYOUT_HEADER### + +// No direct access to this file +defined('JPATH_BASE') or die;###SITE_LAYOUT_CODE### + +?>###SITE_LAYOUT_BODY### diff --git a/admin/compiler/joomla_4/SITE_ROUTER.php b/admin/compiler/joomla_4/SITE_ROUTER.php new file mode 100644 index 000000000..4cc195d94 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_ROUTER.php @@ -0,0 +1,97 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Service; + +###SITE_ROUTER_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * Router class for the ###Component_name### Component + * + * @since 3.10 + */ +class Router extends RouterView +{ + /** + * Flag to remove IDs + * + * @var boolean + * @since 4.0.0 + */ + protected $noIDs = false; + + /** + * The category factory + * + * @var CategoryFactoryInterface + * @since 4.0.0 + */ + private $categoryFactory; + + /** + * The category cache + * + * @var array + * @since 4.0.0 + */ + private $categoryCache = []; + + /** + * The db + * + * @var DatabaseInterface + * @since 4.0.0 + */ + private $db; + + /** + * The component params + * + * @var Registry + * @since 4.0.0 + */ + private $params; + + /** + * ###Component### Component router constructor + * + * @param SiteApplication $app The application object + * @param AbstractMenu $menu The menu object to work with + * @param CategoryFactoryInterface $categoryFactory The category object + * @param DatabaseInterface $db The database object + * + * @since 4.0.0 + */ + public function __construct( + SiteApplication $app, + AbstractMenu $menu, + CategoryFactoryInterface $categoryFactory, + DatabaseInterface $db) + { + $this->categoryFactory = $categoryFactory; + $this->db = $db; + $this->params = ComponentHelper::getParams('com_###component###'); + $this->noIDs = (bool) $this->params->get('sef_ids', false);###SITE_ROUTER_CONSTRUCTOR_BEFORE_PARENT### + + parent::__construct($app, $menu);###SITE_ROUTER_CONSTRUCTOR_AFTER_PARENT### + + $this->attachRule(new MenuRules($this)); + $this->attachRule(new StandardRules($this)); + $this->attachRule(new NomenuRules($this)); + }###SITE_ROUTER_METHODS### +} diff --git a/admin/compiler/joomla_4/SITE_ROUTE_HELPER.php b/admin/compiler/joomla_4/SITE_ROUTE_HELPER.php new file mode 100644 index 000000000..96fdd1822 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_ROUTE_HELPER.php @@ -0,0 +1,141 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Helper; + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Language\Multilanguage; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Categories\CategoryNode; +use Joomla\CMS\Categories\Categories; + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### Component Route Helper + * + * @since 1.5 + */ +abstract class RouteHelper +{ + protected static $lookup;###ROUTEHELPER### + + protected static function _findItem($needles = null,$type = null) + { + $app = Factory::getApplication(); + $menus = $app->getMenu('site'); + $language = isset($needles['language']) ? $needles['language'] : '*'; + + // Prepare the reverse lookup array. + if (!isset(self::$lookup[$language])) + { + self::$lookup[$language] = []; + + $component = ComponentHelper::getComponent('com_###component###'); + + $attributes = array('component_id'); + $values = array($component->id); + + if ($language != '*') + { + $attributes[] = 'language'; + $values[] = array($needles['language'], '*'); + } + + $items = $menus->getItems($attributes, $values); + + foreach ($items as $item) + { + if (isset($item->query) && isset($item->query['view'])) + { + $view = $item->query['view']; + + if (!isset(self::$lookup[$language][$view])) + { + self::$lookup[$language][$view] = []; + } + + if (isset($item->query['id'])) + { + /** + * Here it will become a bit tricky + * language != * can override existing entries + * language == * cannot override existing entries + */ + if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*') + { + self::$lookup[$language][$view][$item->query['id']] = $item->id; + } + } + else + { + self::$lookup[$language][$view][0] = $item->id; + } + } + } + } + + if ($needles) + { + foreach ($needles as $view => $ids) + { + if (isset(self::$lookup[$language][$view])) + { + if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($ids)) + { + foreach ($ids as $id) + { + if (isset(self::$lookup[$language][$view][(int) $id])) + { + return self::$lookup[$language][$view][(int) $id]; + } + } + } + elseif (isset(self::$lookup[$language][$view][0])) + { + return self::$lookup[$language][$view][0]; + } + } + } + } + + if ($type) + { + // Check if the global menu item has been set. + $params = ComponentHelper::getParams('com_###component###'); + if ($item = $params->get($type.'_menu', 0)) + { + return $item; + } + } + + // Check if the active menuitem matches the requested language + $active = $menus->getActive(); + + if ($active + && $active->component == 'com_###component###' + && ($language == '*' || in_array($active->language, array('*', $language)) || !Multilanguage::isEnabled())) + { + return $active->id; + } + + // If not found, return language specific home link + $default = $menus->getDefault($language); + + return !empty($default->id) ? $default->id : null; + } +} diff --git a/admin/compiler/joomla_4/SITE_VIEW.php b/admin/compiler/joomla_4/SITE_VIEW.php new file mode 100644 index 000000000..baa8a5f8b --- /dev/null +++ b/admin/compiler/joomla_4/SITE_VIEW.php @@ -0,0 +1,23 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +###SITE_VIEW_HEADER### + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED######SITE_CODE_BODY### + +?> +###SITE_TOP_FORM######SITE_TOP_BUTTON######SITE_BODY######SITE_BOTTOM_BUTTON######SITE_BOTTOM_FORM### diff --git a/admin/compiler/joomla_4/SITE_VIEWS.php b/admin/compiler/joomla_4/SITE_VIEWS.php new file mode 100644 index 000000000..c2efa4f45 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_VIEWS.php @@ -0,0 +1,23 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +###SITE_VIEWS_HEADER### + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED######SITE_CODE_BODY### + +?> +###SITE_TOP_FORM######SITE_TOP_BUTTON######SITE_BODY######SITE_BOTTOM_BUTTON######SITE_BOTTOM_FORM### diff --git a/admin/compiler/joomla_4/SITE_VIEWS_HTML.php b/admin/compiler/joomla_4/SITE_VIEWS_HTML.php new file mode 100644 index 000000000..7cf77c74c --- /dev/null +++ b/admin/compiler/joomla_4/SITE_VIEWS_HTML.php @@ -0,0 +1,108 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\View\###SViews###; + +###SITE_VIEWS_HTML_HEADER######SITE_GET_MODULE_JIMPORT### + +// No direct access to this file +\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +/** + * ###Component### Html View class for the ###SViews### + * + * @since 1.6 + */ +class HtmlView extends BaseHtmlView +{ + /** + * Display the view + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return void + * @since 1.6 + */ + public function display($tpl = null) + { + // get combined params of both component and menu + $this->app ??= Factory::getApplication(); + $this->params = $this->app->getParams(); + $this->menu = $this->app->getMenu()->getActive(); + $this->styles = $this->get('Styles'); + $this->scripts = $this->get('Scripts'); + // get the user object + $this->user ??= $this->app->getIdentity();###SITE_DIPLAY_METHOD### + }###SITE_EXTRA_DIPLAY_METHODS### + + /** + * Prepare some document related stuff. + * + * @return void + * @since 1.6 + */ + protected function _prepareDocument(): void + {###SITE_LIBRARIES_LOADER######SITE_UIKIT_LOADER######SITE_GOOGLECHART_LOADER######SITE_FOOTABLE_LOADER######SITE_DOCUMENT_METADATA######SITE_DOCUMENT_CUSTOM_PHP### + // add styles + foreach ($this->styles as $style) + { + Html::_('stylesheet', $style, ['version' => 'auto']); + }###SITE_DOCUMENT_CUSTOM_CSS### + // add scripts + foreach ($this->scripts as $script) + { + Html::_('script', $script, ['version' => 'auto']); + }###SITE_DOCUMENT_CUSTOM_JS######SITE_JAVASCRIPT_FOR_BUTTONS### + } + + /** + * Add the page title and toolbar. + * + * @return void + * @since 1.6 + */ + protected function addToolbar(): void + {###SITE_CUSTOM_BUTTONS### + + // set help url for this view if found + $this->help_url = ###Component###Helper::getHelpUrl('###sviews###'); + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) + { + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + } + // now initiate the toolbar + $this->toolbar = Toolbar::getInstance(); + }###SITE_GET_MODULE### + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * @param bool $shorten The switch to shorten. + * @param int $length The shorting length. + * + * @return mixed The escaped value. + * @since 1.6 + */ + public function escape($var, bool $shorten = false, int $length = 40) + { + if (!is_string($var)) + { + return $var; + } + + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length); + } +} diff --git a/admin/compiler/joomla_4/SITE_VIEWS_MODEL.php b/admin/compiler/joomla_4/SITE_VIEWS_MODEL.php new file mode 100644 index 000000000..20fa13ebd --- /dev/null +++ b/admin/compiler/joomla_4/SITE_VIEWS_MODEL.php @@ -0,0 +1,212 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Model; + +###SITE_VIEWS_MODEL_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### List Model for ###SViews### + * + * @since 1.6 + */ +class ###SViews###Model extends ListModel +{ + /** + * Represents the current user object. + * + * @var User The user object representing the current user. + * @since 3.2.0 + */ + protected User $user; + + /** + * The unique identifier of the current user. + * + * @var int|null The ID of the current user. + * @since 3.2.0 + */ + protected ?int $userId; + + /** + * Flag indicating whether the current user is a guest. + * + * @var int 1 if the user is a guest, 0 otherwise. + * @since 3.2.0 + */ + protected int $guest; + + /** + * An array of groups that the current user belongs to. + * + * @var array|null An array of user group IDs. + * @since 3.2.0 + */ + protected ?array $groups; + + /** + * An array of view access levels for the current user. + * + * @var array|null An array of access level IDs. + * @since 3.2.0 + */ + protected ?array $levels; + + /** + * The application object. + * + * @var CMSApplicationInterface The application instance. + * @since 3.2.0 + */ + protected CMSApplicationInterface $app; + + /** + * The input object, providing access to the request data. + * + * @var Input The input object. + * @since 3.2.0 + */ + protected Input $input; + + /** + * The styles array. + * + * @var array + * @since 4.3 + */ + protected array $styles = [ + 'components/com_###component###/assets/css/site.css', + 'components/com_###component###/assets/css/###sview###.css' + ]; + + /** + * The scripts array. + * + * @var array + * @since 4.3 + */ + protected array $scripts = [ + 'components/com_###component###/assets/js/site.js' + ]; + + /** + * A custom property for UIKit components. (not used unless you load v2) + */ + protected $uikitComp; + + /** + * Constructor + * + * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). + * @param ?MVCFactoryInterface $factory The factory. + * + * @since 1.6 + * @throws \Exception + */ + public function __construct($config = [], MVCFactoryInterface $factory = null) + { + parent::__construct($config, $factory); + + $this->app ??= Factory::getApplication(); + $this->input ??= $this->app->getInput(); + + // Set the current user for authorisation checks (for those calling this model directly) + $this->user ??= $this->getCurrentUser(); + $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(); + + // will be removed + $this->initSet = true; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + * @since 1.6 + */ + protected function getListQuery() + {###SITE_GET_LIST_QUERY### + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + * @since 1.6 + */ + public function getItems() + { + $user = $this->user;###USER_PERMISSION_CHECK_ACCESS######LICENSE_LOCKED_CHECK######SITE_BEFORE_GET_ITEMS### + // load parent items + $items = parent::getItems(); + + // Get the global params + $globalParams = ComponentHelper::getParams('com_###component###', true);###SITE_GET_ITEMS######SITE_AFTER_GET_ITEMS### + + // return items + return $items; + } + + /** + * Method to get the styles that have to be included on the view + * + * @return array styles files + * @since 4.3 + */ + public function getStyles(): array + { + return $this->styles; + } + + /** + * Method to set the styles that have to be included on the view + * + * @return void + * @since 4.3 + */ + public function setStyles(string $path): void + { + $this->styles[] = $path; + } + + /** + * Method to get the script that have to be included on the view + * + * @return array script files + * @since 4.3 + */ + public function getScripts(): array + { + return $this->scripts; + } + + /** + * Method to set the script that have to be included on the view + * + * @return void + * @since 4.3 + */ + public function setScript(string $path): void + { + $this->scripts[] = $path; + }###LICENSE_LOCKED_SET_BOOL######SITE_CUSTOM_METHODS######SITE_CUSTOM_BUTTONS_METHOD### +} diff --git a/admin/compiler/joomla_4/SITE_VIEW_CONTROLLER.php b/admin/compiler/joomla_4/SITE_VIEW_CONTROLLER.php new file mode 100644 index 000000000..3dd8a4f9f --- /dev/null +++ b/admin/compiler/joomla_4/SITE_VIEW_CONTROLLER.php @@ -0,0 +1,120 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Controller; + +###SITE_VIEW_CONTROLLER_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### ###SView### Form Controller + * + * @since 1.6 + */ +class ###SView###Controller extends FormController +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_###COMPONENT###'; + + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * The URL view list variable. + * + * @var string + * @since 1.6 + */ + protected $view_list = '###SITE_DEFAULT_VIEW###';###SITE_CUSTOM_BUTTONS_CONTROLLER### + + /** + * Method to check if you can edit an existing record. + * + * Extended classes can override this if necessary. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key; default is id. + * + * @return boolean + * + * @since 12.2 + */ + protected function allowEdit($data = [], $key = 'id') + { + // to insure no other tampering + return false; + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = []) + { + // to insure no other tampering + return false; + } + + /** + * Method to check if you can save a new or existing record. + * + * Extended classes can override this if necessary. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 12.2 + */ + protected function allowSave($data, $key = 'id') + { + // to insure no other tampering + return false; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModelLegacy $model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 12.2 + */ + protected function postSaveHook(JModelLegacy $model, $validData = []) + { + } +} diff --git a/admin/compiler/joomla_4/SITE_VIEW_HTML.php b/admin/compiler/joomla_4/SITE_VIEW_HTML.php new file mode 100644 index 000000000..56b208d85 --- /dev/null +++ b/admin/compiler/joomla_4/SITE_VIEW_HTML.php @@ -0,0 +1,108 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\View\###SView###; + +###SITE_VIEW_HTML_HEADER######SITE_GET_MODULE_JIMPORT### + +// No direct access to this file +\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +/** + * ###Component### Html View class for the ###SView### + * + * @since 1.6 + */ +class HtmlView extends BaseHtmlView +{ + /** + * Display the view + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return void + * @since 1.6 + */ + public function display($tpl = null) + { + // get combined params of both component and menu + $this->app ??= Factory::getApplication(); + $this->params = $this->app->getParams(); + $this->menu = $this->app->getMenu()->getActive(); + $this->styles = $this->get('Styles'); + $this->scripts = $this->get('Scripts'); + // get the user object + $this->user ??= $this->app->getIdentity();###SITE_DIPLAY_METHOD### + }###SITE_EXTRA_DIPLAY_METHODS### + + /** + * Prepare some document related stuff. + * + * @return void + * @since 1.6 + */ + protected function _prepareDocument(): void + {###SITE_LIBRARIES_LOADER######SITE_UIKIT_LOADER######SITE_GOOGLECHART_LOADER######SITE_FOOTABLE_LOADER######SITE_DOCUMENT_METADATA######SITE_DOCUMENT_CUSTOM_PHP### + // add styles + foreach ($this->styles as $style) + { + Html::_('stylesheet', $style, ['version' => 'auto']); + }###SITE_DOCUMENT_CUSTOM_CSS### + // add scripts + foreach ($this->scripts as $script) + { + Html::_('script', $script, ['version' => 'auto']); + }###SITE_DOCUMENT_CUSTOM_JS######SITE_JAVASCRIPT_FOR_BUTTONS### + } + + /** + * Add the page title and toolbar. + * + * @return void + * @since 1.6 + */ + protected function addToolbar(): void + {###SITE_CUSTOM_BUTTONS### + + // set help url for this view if found + $this->help_url = ###Component###Helper::getHelpUrl('###sview###'); + if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url)) + { + ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); + } + // now initiate the toolbar + $this->toolbar = Toolbar::getInstance(); + }###SITE_GET_MODULE### + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * @param bool $shorten The switch to shorten. + * @param int $length The shorting length. + * + * @return mixed The escaped value. + * @since 1.6 + */ + public function escape($var, bool $shorten = false, int $length = 40) + { + if (!is_string($var)) + { + return $var; + } + + return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length); + } +} diff --git a/admin/compiler/joomla_4/SITE_VIEW_MODEL.php b/admin/compiler/joomla_4/SITE_VIEW_MODEL.php new file mode 100644 index 000000000..e017632af --- /dev/null +++ b/admin/compiler/joomla_4/SITE_VIEW_MODEL.php @@ -0,0 +1,262 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### +namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Model; + +###SITE_VIEW_MODEL_HEADER### + +// No direct access to this file +\defined('_JEXEC') or die; + +/** + * ###Component### ###SView### Item Model + * + * @since 1.6 + */ +class ###SView###Model extends ItemModel +{ + /** + * Model context string. + * + * @var string + * @since 1.6 + */ + protected $_context = 'com_###component###.###sview###'; + + /** + * Represents the current user object. + * + * @var User The user object representing the current user. + * @since 3.2.0 + */ + protected User $user; + + /** + * The unique identifier of the current user. + * + * @var int|null The ID of the current user. + * @since 3.2.0 + */ + protected ?int $userId; + + /** + * Flag indicating whether the current user is a guest. + * + * @var int 1 if the user is a guest, 0 otherwise. + * @since 3.2.0 + */ + protected int $guest; + + /** + * An array of groups that the current user belongs to. + * + * @var array|null An array of user group IDs. + * @since 3.2.0 + */ + protected ?array $groups; + + /** + * An array of view access levels for the current user. + * + * @var array|null An array of access level IDs. + * @since 3.2.0 + */ + protected ?array $levels; + + /** + * The application object. + * + * @var CMSApplicationInterface The application instance. + * @since 3.2.0 + */ + protected CMSApplicationInterface $app; + + /** + * The input object, providing access to the request data. + * + * @var Input The input object. + * @since 3.2.0 + */ + protected Input $input; + + /** + * The styles array. + * + * @var array + * @since 4.3 + */ + protected array $styles = [ + 'components/com_###component###/assets/css/site.css', + 'components/com_###component###/assets/css/###sview###.css' + ]; + + /** + * The scripts array. + * + * @var array + * @since 4.3 + */ + protected array $scripts = [ + 'components/com_###component###/assets/js/site.js' + ]; + + /** + * A custom property for UI Kit components. + * + * @var array|null Property for storing UI Kit component-related data or objects. + * @since 3.2.0 + */ + protected ?array $uikitComp; + + /** + * @var object item + * @since 1.6 + */ + protected $item; + + /** + * Constructor + * + * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). + * @param ?MVCFactoryInterface $factory The factory. + * + * @since 3.0 + * @throws \Exception + */ + public function __construct($config = [], MVCFactoryInterface $factory = null) + { + parent::__construct($config, $factory); + + $this->app ??= Factory::getApplication(); + $this->input ??= $this->app->getInput(); + + // Set the current user for authorisation checks (for those calling this model directly) + $this->user ??= $this->getCurrentUser(); + $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(); + + // will be removed + $this->initSet = true; + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @return void + * @since 1.6 + */ + protected function populateState() + { + // Get the itme main id + $id = $this->input->getInt('id', null); + $this->setState('###sview###.id', $id); + + // Load the parameters. + $params = $this->app->getParams(); + $this->setState('params', $params); + + parent::populateState(); + } + + /** + * Method to get article data. + * + * @param integer $pk The id of the article. + * + * @return mixed Menu item data object on success, false on failure. + * @since 1.6 + */ + public function getItem($pk = null) + {###USER_PERMISSION_CHECK_ACCESS### + + $pk = (!empty($pk)) ? $pk : (int) $this->getState('###sview###.id');###SITE_BEFORE_GET_ITEM### + + if ($this->_item === null) + { + $this->_item = []; + }###LICENSE_LOCKED_CHECK### + + if (!isset($this->_item[$pk])) + { + try + {###SITE_GET_ITEM### + } + catch (\Exception $e) + { + if ($e->getCode() == 404) + { + // Need to go thru the error handler to allow Redirect to work. + throw $e; + } + else + { + $this->setError($e); + $this->_item[$pk] = false; + } + } + }###SITE_AFTER_GET_ITEM### + + return $this->_item[$pk]; + } + + /** + * Method to get the styles that have to be included on the view + * + * @return array styles files + * @since 4.3 + */ + public function getStyles(): array + { + return $this->styles; + } + + /** + * Method to set the styles that have to be included on the view + * + * @return void + * @since 4.3 + */ + public function setStyles(string $path): void + { + $this->styles[] = $path; + } + + /** + * Method to get the script that have to be included on the view + * + * @return array script files + * @since 4.3 + */ + public function getScripts(): array + { + return $this->scripts; + } + + /** + * Method to set the script that have to be included on the view + * + * @return void + * @since 4.3 + */ + public function setScript(string $path): void + { + $this->scripts[] = $path; + }###LICENSE_LOCKED_SET_BOOL######SITE_CUSTOM_METHODS######SITE_CUSTOM_BUTTONS_METHOD### +} diff --git a/admin/compiler/joomla_4/access.xml b/admin/compiler/joomla_4/access.xml new file mode 100644 index 000000000..95908e259 --- /dev/null +++ b/admin/compiler/joomla_4/access.xml @@ -0,0 +1,4 @@ + + + ###ACCESS_SECTIONS### + \ No newline at end of file diff --git a/admin/compiler/joomla_4/admin.css b/admin/compiler/joomla_4/admin.css new file mode 100644 index 000000000..589b9cd9b --- /dev/null +++ b/admin/compiler/joomla_4/admin.css @@ -0,0 +1,7 @@ +###BOM### + +/* CSS Document */ +.no-click { + pointer-events: none; +} +###ADMINCSS### diff --git a/admin/compiler/joomla_4/admin.js b/admin/compiler/joomla_4/admin.js new file mode 100644 index 000000000..9c701e5be --- /dev/null +++ b/admin/compiler/joomla_4/admin.js @@ -0,0 +1,4 @@ +###BOM### + +/* JS Document */ +###ADMINJS### \ No newline at end of file diff --git a/admin/compiler/joomla_4/component.xml b/admin/compiler/joomla_4/component.xml new file mode 100644 index 000000000..7e1fd7cba --- /dev/null +++ b/admin/compiler/joomla_4/component.xml @@ -0,0 +1,87 @@ + + + COM_###COMPONENT### + ###BUILDDATE### + ###AUTHOR### + ###AUTHOREMAIL### + ###AUTHORWEBSITE### + ###COPYRIGHT### + ###LICENSE### + ###ACTUALVERSION### + ###Component_name### (v.###ACTUALVERSION###) +
+

###DESCRIPTION###

+

Created by ###AUTHOR###
Development started ###CREATIONDATE###

+ ]]>
+ ###NAMESPACEPREFIX###\Component\###ComponentNamespace### + + + + + sql/install.mysql.utf8.sql + + + + + + + sql/uninstall.mysql.utf8.sql + + + + + ###Component###InstallerScript.php + + + index.html###EXSTRA_MEDIA_FILES### + js + css + images###EXSTRA_MEDIA_FOLDERS### + + + + + + sql/updates/mysql/ + + + + + index.html###EXSTRA_SITE_FILES### + assets + forms + layouts + src + tmpl###EXSTRA_SITE_FOLDERS### + + + + ###SITE_LANGUAGES### + + + + COM_###COMPONENT###_MENU + + ###MAINMENUS### + + + access.xml + config.xml + index.html###EXSTRA_ADMIN_FILES### + assets + forms + layouts + presets + services + sql + src + tmpl###EXSTRA_ADMIN_FOLDERS### + + + + ###ADMIN_LANGUAGES### + + + ###UPDATESERVER### +
\ No newline at end of file diff --git a/admin/compiler/joomla_4/config.xml b/admin/compiler/joomla_4/config.xml new file mode 100644 index 000000000..50b98e1fe --- /dev/null +++ b/admin/compiler/joomla_4/config.xml @@ -0,0 +1,19 @@ + + + ###CONFIG_FIELDSETS### +
+ +
+
\ No newline at end of file diff --git a/admin/compiler/joomla_4/dashboard.css b/admin/compiler/joomla_4/dashboard.css new file mode 100644 index 000000000..6502707ff --- /dev/null +++ b/admin/compiler/joomla_4/dashboard.css @@ -0,0 +1,155 @@ +###BOM### + +/* CSS Document */ + +.dashboard-container { + margin-left: 10px; + margin-top: 10px; + width: 100%; +} +.dashboard-container [class*="span"] { + display: block; + float: none; + margin-left: 0; + width: auto; +} +.dashboard-container:before, .dashboard-container:after { + content: ""; + display: table; +} +.dashboard-container:after { + clear: both; +} +.dashboard-container [class*="span"] { + box-sizing: border-box; + display: block; + float: left; + min-height: 145px; + min-width: 96px; + width: 100%; +} +.dashboard-container [class*="span"]:first-child { + margin-left: 0; +} +.dashboard-wraper { + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 5px; + float: left; + margin: 1%; + padding: 3px; + width: 17%; + min-height: 194px; + min-width: 96px; +} +.dashboard-content a { + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + min-height: 89px; + padding: 10px; + text-align: center; + text-decoration: none; +} +.dashboard-content a:hover { + background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + color: hsl(200, 100%, 30%); + text-decoration: none; +} +.dashboard-title { + display: block; + padding-top: 5px; +} +.dashboard-info { + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + font-size: 12px; + padding: 10px; + text-align: center; +} +.dashboard-info span { + display: block; + text-align: center; +} +.dashboard-info img { + margin: 0 auto; +} +.dashboard-table { + border-top: 1px solid hsl(0, 0%, 87%); + margin-top: 5px; + width: 100%; +} +.dashboard-info h5 { + font-size: 11px; + font-weight: bold; +} +.dashboard-block { + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 76%); + border-radius: 3px; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; + margin-bottom: 20px; +} +.dashboard-block .dashboard-block-head { + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border-bottom: 1px solid hsl(0, 0%, 76%); + border-radius: 3px 3px 0 0; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); + height: 40px; + position: relative; +} +.dashboard-block .dashboard-block-head h5 { + font-size: 12px; + margin: 0; + padding-left: 10px; + padding-top: 11px; + text-transform: uppercase; +} +.dashboard-block .dashboard-block-content { + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 0 0 3px 3px; +} +.dashboard-block .dashboard-block-box { + background: none repeat scroll 0 0 hsl(0, 0%, 100%); + border-top: 1px solid hsl(0, 0%, 82%); + box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; +} +.dashboard-block .dashboard-block-content .dashboard-block-box { + margin-top: 0 !important; +} +.dashboard-block .dashboard-block-content .dashboard-block-box .dashboard-block-table { + margin-bottom: 0 !important; +} +.dashboard-block-table { + background-color: hsla(0, 0%, 0%, 0); + border-collapse: collapse; + border-spacing: 0; + margin-bottom: 20px; + max-width: 100%; + width: 100%; +} +.dashboard-block-table th, .dashboard-block-table td { + border-top: 1px solid hsl(0, 0%, 87%); + line-height: 20px; + padding: 5px; + text-align: left; + vertical-align: middle; +} +.dashboard-badge { + background-color: hsl(0, 0%, 60%); + border-radius: 9px; + color: hsl(0, 0%, 100%); + font-size: 11.844px; + font-weight: bold; + line-height: 14px; + padding: 1px 9px 2px; + text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); + vertical-align: baseline; + white-space: nowrap; +} \ No newline at end of file diff --git a/admin/compiler/joomla_4/default.xml b/admin/compiler/joomla_4/default.xml new file mode 100644 index 000000000..10a8e4742 --- /dev/null +++ b/admin/compiler/joomla_4/default.xml @@ -0,0 +1 @@ +###SITE_MENU_XML### \ No newline at end of file diff --git a/admin/compiler/joomla_4/default_batch_body.php b/admin/compiler/joomla_4/default_batch_body.php new file mode 100644 index 000000000..6ca60b2b1 --- /dev/null +++ b/admin/compiler/joomla_4/default_batch_body.php @@ -0,0 +1,26 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/compiler/joomla_4/default_batch_footer.php b/admin/compiler/joomla_4/default_batch_footer.php new file mode 100644 index 000000000..701e3c69b --- /dev/null +++ b/admin/compiler/joomla_4/default_batch_footer.php @@ -0,0 +1,30 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Language\Text; + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +?> + + + + \ No newline at end of file diff --git a/admin/compiler/joomla_4/default_body.php b/admin/compiler/joomla_4/default_body.php new file mode 100644 index 000000000..573c50ac1 --- /dev/null +++ b/admin/compiler/joomla_4/default_body.php @@ -0,0 +1,28 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper\###Component###Helper; + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +$edit = "index.php?option=com_###component###&view=###views###&task=###view###.edit"; + +?> +###LISTBODY### \ No newline at end of file diff --git a/admin/compiler/joomla_4/default_custom_admin_template.php b/admin/compiler/joomla_4/default_custom_admin_template.php new file mode 100644 index 000000000..5601278f7 --- /dev/null +++ b/admin/compiler/joomla_4/default_custom_admin_template.php @@ -0,0 +1,24 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_TEMPLATE_CODE_BODY### + +?>###CUSTOM_ADMIN_TEMPLATE_BODY### diff --git a/admin/compiler/joomla_4/default_foot.php b/admin/compiler/joomla_4/default_foot.php new file mode 100644 index 000000000..b5c0121af --- /dev/null +++ b/admin/compiler/joomla_4/default_foot.php @@ -0,0 +1,23 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/compiler/joomla_4/default_head.php b/admin/compiler/joomla_4/default_head.php new file mode 100644 index 000000000..c21d39531 --- /dev/null +++ b/admin/compiler/joomla_4/default_head.php @@ -0,0 +1,24 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +?> +###LISTHEAD### \ No newline at end of file diff --git a/admin/compiler/joomla_4/default_import.php b/admin/compiler/joomla_4/default_import.php new file mode 100644 index 000000000..05ff76fe1 --- /dev/null +++ b/admin/compiler/joomla_4/default_import.php @@ -0,0 +1,199 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +Html::_('jquery.framework'); +Html::_('bootstrap.tooltip'); +Html::_('script', 'system/core.js', false, true); +Html::_('behavior.keepalive'); + +?> + + +
+
+
+ + hasPackage && Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($this->headerList) && Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($this->headers)) : ?> +
+ +
+ +
+ +
+
+ headerList as $name => $title): ?> +
+ +
+ +
+
+ +
+ +
+
+ + + 'upload')); ?> + + +
+ +
+ +
+ +
+
+
+     (.csv .xls .ods) +
+
+ + + +
+ +
+ +
+ +
+
+
+     (.csv .xls .ods) +
+
+ + + +
+ +
+ +
+ +
+
+
+     (.csv .xls .ods) +
+
+ + + + + + + +
\ No newline at end of file diff --git a/admin/compiler/joomla_4/default_import_custom.php b/admin/compiler/joomla_4/default_import_custom.php new file mode 100644 index 000000000..91b71fce6 --- /dev/null +++ b/admin/compiler/joomla_4/default_import_custom.php @@ -0,0 +1,30 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +Html::_('jquery.framework'); +Html::_('bootstrap.tooltip'); +Html::_('script', 'system/core.js', false, true); +Html::_('behavior.keepalive'); + +?>###IMPORT_DEFAULT_VIEW_CUSTOM### diff --git a/admin/compiler/joomla_4/default_list.xml b/admin/compiler/joomla_4/default_list.xml new file mode 100644 index 000000000..5f42db0d7 --- /dev/null +++ b/admin/compiler/joomla_4/default_list.xml @@ -0,0 +1,6 @@ + + + + COM_###COMPONENT###_MENU_###VIEWS###_DESC + + \ No newline at end of file diff --git a/admin/compiler/joomla_4/default_main.php b/admin/compiler/joomla_4/default_main.php new file mode 100644 index 000000000..91b3fcb0a --- /dev/null +++ b/admin/compiler/joomla_4/default_main.php @@ -0,0 +1,37 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Language\Text; + +// No direct access to this file +defined('_JEXEC') or die; + +?> +icons['main']) && is_array($this->icons['main'])) :?> + icons['main'] as $icon): ?> + + +
+ +

+ \ No newline at end of file diff --git a/admin/compiler/joomla_4/default_site_template.php b/admin/compiler/joomla_4/default_site_template.php new file mode 100644 index 000000000..13daeb11f --- /dev/null +++ b/admin/compiler/joomla_4/default_site_template.php @@ -0,0 +1,24 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED######SITE_TEMPLATE_CODE_BODY### + +?>###SITE_TEMPLATE_BODY### diff --git a/admin/compiler/joomla_4/default_toolbar.php b/admin/compiler/joomla_4/default_toolbar.php new file mode 100644 index 000000000..6fb862f1e --- /dev/null +++ b/admin/compiler/joomla_4/default_toolbar.php @@ -0,0 +1,53 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + +// No direct access to this file +defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED### + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/compiler/joomla_4/default_vdm.php b/admin/compiler/joomla_4/default_vdm.php new file mode 100644 index 000000000..2af4045b4 --- /dev/null +++ b/admin/compiler/joomla_4/default_vdm.php @@ -0,0 +1,45 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Language\Text; + +// No direct access to this file +defined('_JEXEC') or die; + +?> +<?php echo Text::_('COM_###COMPONENT###'); ?> + +
+contributors)): ?> + contributors) > 1): ?> +

+ +

+ +
    + contributors as $contributor): ?> +
  • :
  • + +
+
+ \ No newline at end of file diff --git a/admin/compiler/joomla_4/edit.xml b/admin/compiler/joomla_4/edit.xml new file mode 100644 index 000000000..10a8e4742 --- /dev/null +++ b/admin/compiler/joomla_4/edit.xml @@ -0,0 +1 @@ +###SITE_MENU_XML### \ No newline at end of file diff --git a/admin/compiler/joomla_4/en-GB.com_admin.ini b/admin/compiler/joomla_4/en-GB.com_admin.ini new file mode 100644 index 000000000..e5b382a4a --- /dev/null +++ b/admin/compiler/joomla_4/en-GB.com_admin.ini @@ -0,0 +1 @@ +###LANG_ADMIN### \ No newline at end of file diff --git a/admin/compiler/joomla_4/en-GB.com_admin.sys.ini b/admin/compiler/joomla_4/en-GB.com_admin.sys.ini new file mode 100644 index 000000000..fc07f9846 --- /dev/null +++ b/admin/compiler/joomla_4/en-GB.com_admin.sys.ini @@ -0,0 +1 @@ +###LANG_ADMIN_SYS### \ No newline at end of file diff --git a/admin/compiler/joomla_4/en-GB.com_site.ini b/admin/compiler/joomla_4/en-GB.com_site.ini new file mode 100644 index 000000000..7a78b98b2 --- /dev/null +++ b/admin/compiler/joomla_4/en-GB.com_site.ini @@ -0,0 +1 @@ +###LANG_SITE### \ No newline at end of file diff --git a/admin/compiler/joomla_4/en-GB.com_site.sys.ini b/admin/compiler/joomla_4/en-GB.com_site.sys.ini new file mode 100644 index 000000000..7e16bfbe8 --- /dev/null +++ b/admin/compiler/joomla_4/en-GB.com_site.sys.ini @@ -0,0 +1 @@ +###LANG_SITE_SYS### \ No newline at end of file diff --git a/admin/compiler/joomla_4/filter_forms.xml b/admin/compiler/joomla_4/filter_forms.xml new file mode 100644 index 000000000..62a188dfb --- /dev/null +++ b/admin/compiler/joomla_4/filter_forms.xml @@ -0,0 +1,9 @@ + +
+###FIELDFILTERSETS### + +###FIELDLISTSETS### +
\ No newline at end of file diff --git a/admin/compiler/joomla_4/import.gif b/admin/compiler/joomla_4/import.gif new file mode 100644 index 000000000..10bcb8569 Binary files /dev/null and b/admin/compiler/joomla_4/import.gif differ diff --git a/admin/helpers/compiler/index.html b/admin/compiler/joomla_4/index.html similarity index 100% rename from admin/helpers/compiler/index.html rename to admin/compiler/joomla_4/index.html diff --git a/admin/compiler/joomla_4/install.mysql.utf8.sql b/admin/compiler/joomla_4/install.mysql.utf8.sql new file mode 100644 index 000000000..50bd3de50 --- /dev/null +++ b/admin/compiler/joomla_4/install.mysql.utf8.sql @@ -0,0 +1 @@ +###INSTALL### diff --git a/admin/compiler/joomla_4/layout.php b/admin/compiler/joomla_4/layout.php new file mode 100644 index 000000000..e5970ef27 --- /dev/null +++ b/admin/compiler/joomla_4/layout.php @@ -0,0 +1,47 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +// No direct access to this file +defined('_JEXEC') or die; + +// 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( + ###LAYOUTITEMS### +); + +$hiddenFields = $displayData->get('hidden_fields') ?: []; + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/compiler/joomla_4/layoutfull.php b/admin/compiler/joomla_4/layoutfull.php new file mode 100644 index 000000000..695619600 --- /dev/null +++ b/admin/compiler/joomla_4/layoutfull.php @@ -0,0 +1,49 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +// No direct access to this file +defined('_JEXEC') or die; + +// 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( + ###LAYOUTITEMS### +); + +$hiddenFields = $displayData->get('hidden_fields') ?: []; + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/compiler/joomla_4/layoutitems.php b/admin/compiler/joomla_4/layoutitems.php new file mode 100644 index 000000000..e5970ef27 --- /dev/null +++ b/admin/compiler/joomla_4/layoutitems.php @@ -0,0 +1,47 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +// No direct access to this file +defined('_JEXEC') or die; + +// 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( + ###LAYOUTITEMS### +); + +$hiddenFields = $displayData->get('hidden_fields') ?: []; + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/compiler/joomla_4/layoutlinkedview.php b/admin/compiler/joomla_4/layoutlinkedview.php new file mode 100644 index 000000000..9617296d8 --- /dev/null +++ b/admin/compiler/joomla_4/layoutlinkedview.php @@ -0,0 +1,34 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator\Helper\###Component###Helper; + +// No direct access to this file +defined('_JEXEC') or die; + +// set the defaults +$items = $displayData->###LAYOUTITEMS###; +$user = Factory::getApplication()->getIdentity(); +$id = $displayData->item->id; +###LAYOUTITEMSHEADER### + +?> +
+###LAYOUTITEMSTABLE### +
diff --git a/admin/compiler/joomla_4/layoutmetadata.php b/admin/compiler/joomla_4/layoutmetadata.php new file mode 100644 index 000000000..80877adb6 --- /dev/null +++ b/admin/compiler/joomla_4/layoutmetadata.php @@ -0,0 +1,48 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +use Joomla\CMS\Language\Text; + +// No direct access to this file +defined('_JEXEC') or die; + +$form = $displayData->getForm(); + +// JLayout for standard handling of metadata fields in the administrator content edit screens. +$fieldSets = $form->getFieldsets('metadata'); +?> + + $fieldSet) : ?> + description) && trim($fieldSet->description)) : ?> +

escape(Text::_($fieldSet->description)); ?>

+ + + renderField('metadesc'); + echo $form->renderField('metakey'); + } + + foreach ($form->getFieldset($name) as $field) + { + if ($field->name != 'jform[metadata][tags][]') + { + echo $field->renderField(); + } + } ?> + diff --git a/admin/compiler/joomla_4/layoutpublished.php b/admin/compiler/joomla_4/layoutpublished.php new file mode 100644 index 000000000..e5970ef27 --- /dev/null +++ b/admin/compiler/joomla_4/layoutpublished.php @@ -0,0 +1,47 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +// No direct access to this file +defined('_JEXEC') or die; + +// 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( + ###LAYOUTITEMS### +); + +$hiddenFields = $displayData->get('hidden_fields') ?: []; + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/compiler/joomla_4/layouttitle.php b/admin/compiler/joomla_4/layouttitle.php new file mode 100644 index 000000000..becaaccda --- /dev/null +++ b/admin/compiler/joomla_4/layouttitle.php @@ -0,0 +1,57 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +// No direct access to this file +defined('_JEXEC') or die; + +// 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) ?: [ + ###LAYOUTITEMS### +]; + +// Ensure $fields is treated as an array and count its size. +$size = count((array) $fields); + +// Use a ternary operator to determine the class. +// If there are 1 to 4 fields, set the class to divide the 12-grid column equally among the fields. +// For more than 4 fields, default to four columns (3-grid each) for medium and larger screens. +$css_class = ($size > 0 && $size <= 4) ? 'col-12 col-md-' . round(12 / $size) : 'col-12 col-md-3'; + +$hiddenFields = $displayData->get('hidden_fields') ?: []; + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, ['class' => $css_class . ' control-wrapper-' . $field]); ?> + +
+ diff --git a/admin/compiler/joomla_4/module_forms.js b/admin/compiler/joomla_4/module_forms.js new file mode 100644 index 000000000..4bf5019bf --- /dev/null +++ b/admin/compiler/joomla_4/module_forms.js @@ -0,0 +1,3 @@ +###BOM### + +###VIEW_SCRIPT### diff --git a/admin/compiler/joomla_4/module_forms.xml b/admin/compiler/joomla_4/module_forms.xml new file mode 100644 index 000000000..029fa5197 --- /dev/null +++ b/admin/compiler/joomla_4/module_forms.xml @@ -0,0 +1,12 @@ + +
+ + + + ###FIELDSETS### + + ###ACCESSCONTROL### +
\ No newline at end of file diff --git a/admin/compiler/joomla_4/settings.json b/admin/compiler/joomla_4/settings.json new file mode 100644 index 000000000..a9e17839f --- /dev/null +++ b/admin/compiler/joomla_4/settings.json @@ -0,0 +1,838 @@ +{ + "create": { + "admin": { + "assets": { + "css": "css", + "images": { + "icons": "icons" + }, + "js": "js" + }, + "forms": "forms", + "language": { + "en-GB": "en-GB" + }, + "presets": "presets", + "services": "services", + "src": { + "Controller": "Controller", + "Extension": "Extension", + "Rule": "Rule", + "Field": "Field", + "Helper": "Helper", + "Model": "Model", + "Service": "Service", + "Table": "Table", + "View": "View" + }, + "sql": { + "updates": { + "mysql": "mysql" + }, + "xml": "xml" + }, + "tmpl": "tmpl" + }, + "site": { + "assets": { + "css": "css", + "images": "images", + "js": "js" + }, + "language": { + "en-GB": "en-GB" + }, + "forms": "forms", + "src": { + "Controller": "Controller", + "Dispatcher": "Dispatcher", + "Rule": "Rule", + "Field": "Field", + "Helper": "Helper", + "Model": "Model", + "Service": "Service", + "View": "View" + }, + "tmpl": "tmpl" + }, + "media": { + "css": "css", + "images": "images", + "js": "js" + } + }, + "move": { + "static": { + "ADMIN_PROVIDER.php": { + "naam": "ADMIN_PROVIDER.php", + "path": "c0mp0n3nt/admin/services", + "rename": "new", + "newName": "provider.php", + "type": "file" + }, + "ADMIN_EXTENSION_COMPONENT.php": { + "naam": "ADMIN_EXTENSION_COMPONENT.php", + "path": "c0mp0n3nt/admin/src/Extension", + "rename": "new", + "newName": "[[[Component]]]Component.php", + "type": "file" + }, + "ADMIN_DISPLAY_CONTROLLER.php": { + "naam": "ADMIN_DISPLAY_CONTROLLER.php", + "path": "c0mp0n3nt/admin/src/Controller", + "rename": "new", + "newName": "DisplayController.php", + "type": "file" + }, + "SITE_DISPLAY_CONTROLLER.php": { + "naam": "SITE_DISPLAY_CONTROLLER.php", + "path": "c0mp0n3nt/site/src/Controller", + "rename": "new", + "newName": "DisplayController.php", + "type": "file" + }, + "access.xml": { + "naam": "access.xml", + "path": "c0mp0n3nt/admin", + "rename": false, + "type": "file" + }, + "config.xml": { + "naam": "config.xml", + "path": "c0mp0n3nt/admin", + "rename": false, + "type": "file" + }, + "component.xml": { + "naam": "component.xml", + "path": "c0mp0n3nt/", + "rename": "component", + "type": "file" + }, + "admin.css": { + "naam": "admin.css", + "path": "c0mp0n3nt/admin/assets/css", + "rename": false, + "type": "file" + }, + "admin.js": { + "naam": "admin.js", + "path": "c0mp0n3nt/admin/assets/js", + "rename": false, + "type": "file" + }, + "site.css": { + "naam": "site.css", + "path": "c0mp0n3nt/site/assets/css", + "rename": false, + "type": "file" + }, + "site.js": { + "naam": "site.js", + "path": "c0mp0n3nt/site/assets/js", + "rename": false, + "type": "file" + }, + "SITE_ROUTER.php": { + "naam": "SITE_ROUTER.php", + "path": "c0mp0n3nt/site/src/Service", + "rename": "new", + "newName": "Router.php", + "type": "file" + }, + "SITE_ROUTE_HELPER.php": { + "naam": "SITE_ROUTE_HELPER.php", + "path": "c0mp0n3nt/site/src/Helper", + "rename": "new", + "newName": "RouteHelper.php", + "type": "file" + }, + "ADMIN_HELPER_CLASS.php": { + "naam": "ADMIN_HELPER_CLASS.php", + "path": "c0mp0n3nt/admin/src/Helper", + "rename": "new", + "newName": "[[[Component]]]Helper.php", + "type": "file" + }, + "SITE_HELPER_CLASS.php": { + "naam": "SITE_HELPER_CLASS.php", + "path": "c0mp0n3nt/site/src/Helper", + "rename": "new", + "newName": "[[[Component]]]Helper.php", + "type": "file" + }, + "ADMIN_AUTOLOADER_CLASS.php": { + "naam": "ADMIN_AUTOLOADER_CLASS.php", + "path": "c0mp0n3nt/admin/src/Helper", + "rename": "new", + "newName": "PowerloaderHelper.php", + "type": "file" + }, + "SITE_AUTOLOADER_CLASS.php": { + "naam": "SITE_AUTOLOADER_CLASS.php", + "path": "c0mp0n3nt/site/src/Helper", + "rename": "new", + "newName": "PowerloaderHelper.php", + "type": "file" + }, + "INSTALLER_SCRIPT.php": { + "naam": "INSTALLER_SCRIPT.php", + "path": "c0mp0n3nt/", + "rename": "new", + "newName": "[[[Component]]]InstallerScript.php", + "type": "file" + }, + "SITE_DISPATCHER.php": { + "naam": "SITE_DISPATCHER.php", + "path": "c0mp0n3nt/site/src/Dispatcher", + "rename": "new", + "newName": "Dispatcher.php", + "type": "file" + }, + "install.mysql.utf8.sql": { + "naam": "install.mysql.utf8.sql", + "path": "c0mp0n3nt/admin/sql", + "rename": false, + "type": "file" + }, + "uninstall.mysql.utf8.sql": { + "naam": "uninstall.mysql.utf8.sql", + "path": "c0mp0n3nt/admin/sql", + "rename": false, + "type": "file" + }, + "ADMIN_HEADERCHECK.php": { + "naam": "ADMIN_HEADERCHECK.php", + "path": "c0mp0n3nt/admin/src/Helper", + "rename": "new", + "newName": "HeaderCheck.php", + "type": "file" + }, + "LICENSE.txt": { + "naam": "LICENSE.txt", + "path": "c0mp0n3nt/", + "rename": false, + "type": "file" + }, + "README.txt": { + "naam": "README.txt", + "path": "c0mp0n3nt/admin", + "rename": false, + "type": "file" + }, + "README.md": { + "naam": "README.md", + "path": "c0mp0n3nt/", + "rename": false, + "type": "file" + }, + "CHANGELOG.md": { + "naam": "CHANGELOG.md", + "path": "c0mp0n3nt/", + "rename": false, + "type": "file" + }, + "SITE_HEADERCHECK.php": { + "naam": "SITE_HEADERCHECK.php", + "path": "c0mp0n3nt/site/src/Helper", + "rename": "new", + "newName": "HeaderCheck.php", + "type": "file" + }, + "import.gif": { + "naam": "import.gif", + "path": "c0mp0n3nt/admin/assets/images", + "rename": false, + "type": "file" + } + }, + "dynamic": { + "admin": { + "ADMIN_HELPER_EMAIL.php": { + "naam": "ADMIN_HELPER_EMAIL.php", + "path": "c0mp0n3nt/admin/src/Helper", + "rename": "new", + "newName": "[[[Component]]]Email.php", + "type": "emailer" + }, + "DASH_CONTROLLER.php": { + "path": "c0mp0n3nt/admin/src/Controller", + "rename": "new", + "newName": "[[[Component]]]Controller.php", + "type": "dashboard" + }, + "DASH_MODEL.php": { + "path": "c0mp0n3nt/admin/src/Model", + "rename": "new", + "newName": "[[[Component]]]Model.php", + "type": "dashboard" + }, + "DASH_VIEW_HTML.php": { + "path": "c0mp0n3nt/admin/src/View/[[[Component]]]", + "rename": "new", + "newName": "HtmlView.php", + "type": "dashboard" + }, + "default_vdm.php": { + "path": "c0mp0n3nt/admin/tmpl/[[[component]]]", + "rename": false, + "type": "dashboard" + }, + "default_main.php": { + "path": "c0mp0n3nt/admin/tmpl/[[[component]]]", + "rename": false, + "type": "dashboard" + }, + "DASH_VIEW.php": { + "path": "c0mp0n3nt/admin/tmpl/[[[component]]]", + "rename": "new", + "newName": "default.php", + "type": "dashboard" + }, + "dashboard.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": false, + "type": "dashboard" + }, + "filter_forms.xml": { + "path": "c0mp0n3nt/admin/forms", + "rename": "filter_forms", + "type": "filter" + }, + "module_forms.xml": { + "path": "c0mp0n3nt/admin/forms", + "rename": "module_forms", + "type": "single" + }, + "module_forms.js": { + "path": "c0mp0n3nt/media/js", + "rename": "module_forms", + "type": "single" + }, + "ADMIN_VIEW.php": { + "path": "c0mp0n3nt/admin/tmpl/[[[name]]]", + "rename": "new", + "newName": "default.php", + "type": "single" + }, + "ADMIN_VIEW_MODEL.php": { + "path": "c0mp0n3nt/admin/src/Model", + "rename": "new", + "newName": "[[[Name]]]Model.php", + "type": "single" + }, + "ADMIN_VIEW_CONTROLLER.php": { + "path": "c0mp0n3nt/admin/src/Controller", + "rename": "new", + "newName": "[[[Name]]]Controller.php", + "type": "single" + }, + "ADMIN_VIEW_TABLE.php": { + "path": "c0mp0n3nt/admin/src/Table", + "rename": "new", + "newName": "[[[Name]]]Table.php", + "type": "single" + }, + "ADMIN_VIEW_HTML.php": { + "path": "c0mp0n3nt/admin/src/View/[[[Name]]]", + "rename": "new", + "newName": "HtmlView.php", + "type": "single" + }, + "view.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": "view", + "type": "single" + }, + "ADMIN_VIEWS_CONTROLLER.php": { + "path": "c0mp0n3nt/admin/src/Controller", + "rename": "new", + "newName": "[[[Name]]]Controller.php", + "type": "list" + }, + "ADMIN_VIEWS_MODEL.php": { + "path": "c0mp0n3nt/admin/src/Model", + "rename": "new", + "newName": "[[[Name]]]Model.php", + "type": "list" + }, + "views.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": "views", + "type": "list" + }, + "ADMIN_VIEWS_HTML.php": { + "path": "c0mp0n3nt/admin/src/View/[[[Name]]]", + "rename": "new", + "newName": "HtmlView.php", + "type": "list" + }, + "ADMIN_VIEWS.php": { + "path": "c0mp0n3nt/admin/tmpl/[[[name]]]", + "rename": "new", + "newName": "default.php", + "type": "list" + }, + "ADMIN_VIEWS_EMPTYSTATE.php": { + "path": "c0mp0n3nt/admin/tmpl/[[[name]]]", + "rename": "new", + "newName": "emptystate.php", + "type": "list" + }, + "default_toolbar.php": { + "path": "c0mp0n3nt/admin/tmpl/[[[name]]]", + "rename": false, + "type": "list" + }, + "default_head.php": { + "path": "c0mp0n3nt/admin/tmpl/[[[name]]]", + "rename": false, + "type": "list" + }, + "default_body.php": { + "path": "c0mp0n3nt/admin/tmpl/[[[name]]]", + "rename": false, + "type": "list" + }, + "default_foot.php": { + "path": "c0mp0n3nt/admin/tmpl/[[[name]]]", + "rename": false, + "type": "list" + }, + "FORM_RULE.php": { + "path": "c0mp0n3nt/admin/src/Rule", + "rename": "new", + "newName": "[[[Key]]]Rule.php", + "type": "rule" + }, + "ADMIN_LAYOUT.php": { + "path": "c0mp0n3nt/admin/layouts", + "rename": "ADMIN_LAYOUT", + "type": "layout" + }, + "LAYOUT_OVERRIDE.php": { + "path": "c0mp0n3nt/admin/layouts/[[[name]]]", + "rename": "LAYOUT_OVERRIDE", + "type": "layoutoverride" + }, + "layoutitems.php": { + "path": "c0mp0n3nt/admin/layouts/[[[name]]]", + "rename": "layoutitems", + "type": "layoutitems" + }, + "layoutfull.php": { + "path": "c0mp0n3nt/admin/layouts/[[[name]]]", + "rename": "layoutfull", + "type": "layoutfull" + }, + "layoutlinkedview.php": { + "path": "c0mp0n3nt/admin/layouts/[[[name]]]", + "rename": "layoutlinkedview", + "type": "layoutlinkedview" + }, + "layouttitle.php": { + "path": "c0mp0n3nt/admin/layouts/[[[name]]]", + "rename": "layouttitle", + "type": "layouttitle" + }, + "layoutpublished.php": { + "path": "c0mp0n3nt/admin/layouts/[[[name]]]", + "rename": "layoutpublished", + "type": "layoutpublished" + }, + "layoutmetadata.php": { + "path": "c0mp0n3nt/admin/layouts/[[[name]]]", + "rename": "layoutmetadata", + "type": "layoutmetadata" + }, + "FORM_CUSTOM_FIELD.php": { + "path": "c0mp0n3nt/admin/src/Field", + "rename": "new", + "newName": "[[[Key]]]Field.php", + "type": "fieldcustom" + }, + "FORM_LIST_FIELD.php": { + "path": "c0mp0n3nt/admin/src/Field", + "rename": "new", + "newName": "[[[Key]]]Field.php", + "type": "fieldlist" + }, + "FORM_RADIO_FIELD.php": { + "path": "c0mp0n3nt/admin/src/Field", + "rename": "new", + "newName": "[[[Key]]]Field.php", + "type": "fieldradio" + }, + "FORM_CHECKBOXES_FIELD.php": { + "path": "c0mp0n3nt/admin/src/Field", + "rename": "new", + "newName": "[[[Key]]]Field.php", + "type": "fieldcheckboxes" + }, + "FORM_USER_FIELD.php": { + "path": "c0mp0n3nt/admin/src/Field", + "rename": "new", + "newName": "[[[Key]]]Field.php", + "type": "fielduser" + }, + "ADMIN_AJAX_CONTROLLER.php": { + "path": "c0mp0n3nt/admin/src/Controller", + "rename": "new", + "newName": "AjaxController.php", + "type": "ajax" + }, + "ADMIN_AJAX_MODEL.php": { + "path": "c0mp0n3nt/admin/src/Model", + "rename": "new", + "newName": "AjaxModel.php", + "type": "ajax" + }, + "ADMIN_IMPORT_CONTROLLER.php": { + "path": "c0mp0n3nt/admin/src/Controller", + "rename": "new", + "newName": "ImportController.php", + "type": "import" + }, + "ADMIN_IMPORT_MODEL.php": { + "path": "c0mp0n3nt/admin/src/Model", + "rename": "new", + "newName": "ImportModel.php", + "type": "import" + }, + "ADMIN_IMPORT_HTML.php": { + "path": "c0mp0n3nt/admin/src/View/Import", + "rename": "new", + "newName": "HtmlView.php", + "type": "import" + }, + "default_import.php": { + "path": "c0mp0n3nt/admin/tmpl/import", + "rename": "new", + "newName": "default.php", + "type": "import" + }, + "ADMIN_IMPORT_CONTROLLER_CUSTOM.php": { + "path": "c0mp0n3nt/admin/src/Controller", + "rename": "new", + "newName": "[[[Name]]]importController.php", + "type": "customimport" + }, + "ADMIN_IMPORT_MODEL_CUSTOM.php": { + "path": "c0mp0n3nt/admin/src/Model", + "rename": "new", + "newName": "[[[Name]]]importModel.php", + "type": "customimport" + }, + "ADMIN_IMPORT_HTML_CUSTOM.php": { + "path": "c0mp0n3nt/admin/src/View/[[[Name]]]import", + "rename": "new", + "newName": "HtmlView.php", + "type": "customimport" + }, + "default_import_custom.php": { + "path": "c0mp0n3nt/admin/tmpl/[[[name]]]import", + "rename": "new", + "newName": "default.php", + "type": "customimport" + }, + "ADMIN_HELPER_CONTROLLER.php": { + "path": "c0mp0n3nt/admin/src/Controller", + "rename": "new", + "newName": "HelpController.php", + "type": "help" + }, + "1.0.0.sql": { + "path": "c0mp0n3nt/admin/sql/updates/mysql", + "rename": "1.0.0", + "type": "sql_update" + }, + "update_server.xml": { + "path": "c0mp0n3nt/", + "rename": "update_server", + "type": "update_server" + }, + "viewFile.js": { + "path": "c0mp0n3nt/admin/assets/js", + "rename": "viewFile", + "type": "javascript_file" + } + }, + "site": { + "SITE_VIEWS_HTML.php": { + "path": "c0mp0n3nt/site/src/View/[[[Name]]]", + "rename": "new", + "newName": "HtmlView.php", + "type": "list" + }, + "SITE_VIEWS_MODEL.php": { + "path": "c0mp0n3nt/site/src/Model", + "rename": "new", + "newName": "[[[Name]]]Model.php", + "type": "list" + }, + "views_site.css": { + "path": "c0mp0n3nt/site/assets/css", + "rename": "views_site", + "type": "list" + }, + "SITE_VIEWS.php": { + "path": "c0mp0n3nt/site/tmpl/[[[name]]]", + "rename": "new", + "newName": "default.php", + "type": "list" + }, + "SITE_VIEW_HTML.php": { + "path": "c0mp0n3nt/site/src/View/[[[Name]]]", + "rename": "new", + "newName": "HtmlView.php", + "type": "single" + }, + "view_site.css": { + "path": "c0mp0n3nt/site/assets/css", + "rename": "view_site", + "type": "single" + }, + "SITE_VIEW_MODEL.php": { + "path": "c0mp0n3nt/site/src/Model", + "rename": "new", + "newName": "[[[Name]]]Model.php", + "type": "single" + }, + "SITE_VIEW.php": { + "path": "c0mp0n3nt/site/tmpl/[[[name]]]", + "rename": "new", + "newName": "default.php", + "type": "single" + }, + "default_site_template.php": { + "path": "c0mp0n3nt/site/tmpl/[[[name]]]", + "rename": "site_template", + "type": "template" + }, + "SITE_LAYOUT.php": { + "path": "c0mp0n3nt/site/layouts", + "rename": "SITE_LAYOUT", + "type": "layout" + }, + "LAYOUT_OVERRIDE.php": { + "path": "c0mp0n3nt/site/layouts/[[[name]]]", + "rename": "LAYOUT_OVERRIDE", + "type": "layoutoverride" + }, + "layoutitems.php": { + "path": "c0mp0n3nt/site/layouts/[[[name]]]", + "rename": "layoutitems", + "type": "layoutitems" + }, + "layoutfull.php": { + "path": "c0mp0n3nt/site/layouts/[[[name]]]", + "rename": "layoutfull", + "type": "layoutfull" + }, + "layoutlinkedview.php": { + "path": "c0mp0n3nt/site/layouts/[[[name]]]", + "rename": "layoutlinkedview", + "type": "layoutlinkedview" + }, + "layouttitle.php": { + "path": "c0mp0n3nt/site/layouts/[[[name]]]", + "rename": "layouttitle", + "type": "layouttitle" + }, + "layoutpublished.php": { + "path": "c0mp0n3nt/site/layouts/[[[name]]]", + "rename": "layoutpublished", + "type": "layoutpublished" + }, + "layoutmetadata.php": { + "path": "c0mp0n3nt/site/layouts/[[[name]]]", + "rename": "layoutmetadata", + "type": "layoutmetadata" + }, + "default.xml": { + "path": "c0mp0n3nt/site/tmpl/[[[name]]]", + "rename": false, + "type": "menu" + }, + "edit.xml": { + "path": "c0mp0n3nt/site/tmpl/[[[name]]]", + "rename": false, + "type": "admin_menu" + }, + "module_forms.xml": { + "path": "c0mp0n3nt/site/forms", + "rename": "module_forms", + "type": "edit" + }, + "module_forms.js": { + "path": "c0mp0n3nt/site/forms", + "rename": "module_forms", + "type": "edit" + }, + "SITE_ADMIN_VIEW.php": { + "path": "c0mp0n3nt/site/tmpl/[[[name]]]", + "rename": "new", + "newName": "edit.php", + "type": "edit" + }, + "SITE_ADMIN_VIEW_MODEL.php": { + "path": "c0mp0n3nt/site/src/Model", + "rename": "new", + "newName": "[[[Name]]]Model.php", + "type": "edit" + }, + "SITE_ADMIN_VIEW_CONTROLLER.php": { + "path": "c0mp0n3nt/site/src/Controller", + "rename": "new", + "newName": "[[[Name]]]Controller.php", + "type": "edit" + }, + "SITE_ADMIN_VIEW_HTML.php": { + "path": "c0mp0n3nt/site/src/View/[[[Name]]]", + "rename": "new", + "newName": "HtmlView.php", + "type": "edit" + }, + "view_site_edit.css": { + "path": "c0mp0n3nt/site/assets/css", + "rename": "view_site_edit", + "type": "edit" + }, + "SITE_FORM_CUSTOM_FIELD.php": { + "path": "c0mp0n3nt/site/src/Field", + "rename": "new", + "newName": "[[[Key]]]Field.php", + "type": "fieldcustom" + }, + "SITE_FORM_LIST_FIELD.php": { + "path": "c0mp0n3nt/site/src/Field", + "rename": "new", + "newName": "[[[Key]]]Field.php", + "type": "fieldlist" + }, + "SITE_FORM_RADIO_FIELD.php": { + "path": "c0mp0n3nt/site/src/Field", + "rename": "new", + "newName": "[[[Key]]]Field.php", + "type": "fieldradio" + }, + "SITE_FORM_CHECKBOXES_FIELD.php": { + "path": "c0mp0n3nt/site/src/Field", + "rename": "new", + "newName": "[[[Key]]]Field.php", + "type": "fieldcheckboxes" + }, + "SITE_FORM_USER_FIELD.php": { + "path": "c0mp0n3nt/site/src/Field", + "rename": "new", + "newName": "[[[Key]]]Field.php", + "type": "fielduser" + }, + "SITE_AJAX_CONTROLLER.php": { + "path": "c0mp0n3nt/site/src/Controller", + "rename": "new", + "newName": "AjaxController.php", + "type": "ajax" + }, + "SITE_AJAX_MODEL.php": { + "path": "c0mp0n3nt/site/src/Model", + "rename": "new", + "newName": "AjaxModel.php", + "type": "ajax" + }, + "SITE_HELPER_CONTROLLER.php": { + "path": "c0mp0n3nt/site/src/Controller", + "rename": "new", + "newName": "HelpController.php", + "type": "help" + }, + "SITE_VIEW_CONTROLLER.php": { + "path": "c0mp0n3nt/site/src/Controller", + "rename": "new", + "newName": "[[[Name]]]Controller.php", + "type": "custom_form" + }, + "viewFileSite.js": { + "path": "c0mp0n3nt/site/assets/js", + "rename": "viewFileSite", + "type": "javascript_file" + } + }, + "custom_admin": { + "CUSTOM_ADMIN_VIEWS_HTML.php": { + "path": "c0mp0n3nt/admin/src/View/[[[Name]]]", + "rename": "new", + "newName": "HtmlView.php", + "type": "list" + }, + "CUSTOM_ADMIN_VIEWS_MODEL.php": { + "path": "c0mp0n3nt/admin/src/Model", + "rename": "new", + "newName": "[[[Name]]]Model.php", + "type": "list" + }, + "CUSTOM_ADMIN_VIEWS.php": { + "path": "c0mp0n3nt/admin/tmpl/[[[name]]]", + "rename": "new", + "newName": "default.php", + "type": "list" + }, + "CUSTOM_ADMIN_VIEWS_CONTROLLER.php": { + "path": "c0mp0n3nt/admin/src/Controller", + "rename": "new", + "newName": "[[[Name]]]Controller.php", + "type": "list" + }, + "views_custom_admin.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": "views_custom_admin", + "type": "list" + }, + "view_custom_admin.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": "view_custom_admin", + "type": "single" + }, + "CUSTOM_ADMIN_VIEW_HTML.php": { + "path": "c0mp0n3nt/admin/src/View/[[[Name]]]", + "rename": "new", + "newName": "HtmlView.php", + "type": "single" + }, + "CUSTOM_ADMIN_VIEW_MODEL.php": { + "path": "c0mp0n3nt/admin/src/Model", + "rename": "new", + "newName": "[[[Name]]]Model.php", + "type": "single" + }, + "CUSTOM_ADMIN_VIEW.php": { + "path": "c0mp0n3nt/admin/tmpl/[[[name]]]", + "rename": "new", + "newName": "default.php", + "type": "single" + }, + "CUSTOM_ADMIN_VIEW_CONTROLLER.php": { + "path": "c0mp0n3nt/admin/src/Controller", + "rename": "new", + "newName": "[[[Name]]]Controller.php", + "type": "single" + }, + "default_custom_admin_template.php": { + "path": "c0mp0n3nt/admin/tmpl/[[[name]]]", + "rename": "custom_admin_template", + "type": "template" + }, + "CUSTOM_ADMIN_LAYOUT.php": { + "path": "c0mp0n3nt/admin/layouts", + "rename": "CUSTOM_ADMIN_LAYOUT", + "type": "layout" + }, + "viewFileCustomAdmin.js": { + "path": "c0mp0n3nt/admin/assets/js", + "rename": "viewFileCustomAdmin", + "type": "javascript_file" + } + } + } + } +} \ No newline at end of file diff --git a/admin/compiler/joomla_4/site.css b/admin/compiler/joomla_4/site.css new file mode 100644 index 000000000..b26522089 --- /dev/null +++ b/admin/compiler/joomla_4/site.css @@ -0,0 +1,7 @@ +###BOM### + +/* CSS Document */ +.no-click { + pointer-events: none; +} +###SITECSS### diff --git a/admin/compiler/joomla_4/site.js b/admin/compiler/joomla_4/site.js new file mode 100644 index 000000000..813632b9a --- /dev/null +++ b/admin/compiler/joomla_4/site.js @@ -0,0 +1,4 @@ +###BOM### + +/* JS Document */ +###SITEJS### \ No newline at end of file diff --git a/admin/compiler/joomla_4/submitbutton.js b/admin/compiler/joomla_4/submitbutton.js new file mode 100644 index 000000000..cd10493cd --- /dev/null +++ b/admin/compiler/joomla_4/submitbutton.js @@ -0,0 +1,17 @@ +###BOM### + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('###view###, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/compiler/joomla_4/submitbutton_site.js b/admin/compiler/joomla_4/submitbutton_site.js new file mode 100644 index 000000000..40938b445 --- /dev/null +++ b/admin/compiler/joomla_4/submitbutton_site.js @@ -0,0 +1,17 @@ +###BOM### + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('###sview###, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/compiler/joomla_4/uninstall.mysql.utf8.sql b/admin/compiler/joomla_4/uninstall.mysql.utf8.sql new file mode 100644 index 000000000..b8b61a080 --- /dev/null +++ b/admin/compiler/joomla_4/uninstall.mysql.utf8.sql @@ -0,0 +1 @@ +###UNINSTALL### diff --git a/admin/compiler/joomla_4/update_server.xml b/admin/compiler/joomla_4/update_server.xml new file mode 100644 index 000000000..8120c1923 --- /dev/null +++ b/admin/compiler/joomla_4/update_server.xml @@ -0,0 +1 @@ +###UPDATE_SERVER_XML### \ No newline at end of file diff --git a/admin/compiler/joomla_4/view.css b/admin/compiler/joomla_4/view.css new file mode 100644 index 000000000..4144e5a3c --- /dev/null +++ b/admin/compiler/joomla_4/view.css @@ -0,0 +1,5 @@ +###BOM### + +/* CSS Document */ + +###VIEWCSS### diff --git a/admin/compiler/joomla_4/viewFile.js b/admin/compiler/joomla_4/viewFile.js new file mode 100644 index 000000000..d855708a8 --- /dev/null +++ b/admin/compiler/joomla_4/viewFile.js @@ -0,0 +1,4 @@ +###BOM### + +/* JS Document */ +###ADMIN_JAVASCRIPT_FILE### \ No newline at end of file diff --git a/admin/compiler/joomla_4/viewFileCustomAdmin.js b/admin/compiler/joomla_4/viewFileCustomAdmin.js new file mode 100644 index 000000000..8abce3885 --- /dev/null +++ b/admin/compiler/joomla_4/viewFileCustomAdmin.js @@ -0,0 +1,4 @@ +###BOM### + +/* JS Document */ +###CUSTOM_ADMIN_JAVASCRIPT_FILE### \ No newline at end of file diff --git a/admin/compiler/joomla_4/viewFileSite.js b/admin/compiler/joomla_4/viewFileSite.js new file mode 100644 index 000000000..12ed97db2 --- /dev/null +++ b/admin/compiler/joomla_4/viewFileSite.js @@ -0,0 +1,4 @@ +###BOM### + +/* JS Document */ +###SITE_JAVASCRIPT_FILE### \ No newline at end of file diff --git a/admin/compiler/joomla_4/view_custom_admin.css b/admin/compiler/joomla_4/view_custom_admin.css new file mode 100644 index 000000000..291066442 --- /dev/null +++ b/admin/compiler/joomla_4/view_custom_admin.css @@ -0,0 +1,5 @@ +###BOM### + +/* CSS Document */ + +###CUSTOM_ADMIN_VIEWCSS### diff --git a/admin/compiler/joomla_4/view_site.css b/admin/compiler/joomla_4/view_site.css new file mode 100644 index 000000000..17a8824ae --- /dev/null +++ b/admin/compiler/joomla_4/view_site.css @@ -0,0 +1,5 @@ +###BOM### + +/* CSS Document */ + +###SITE_VIEWCSS### diff --git a/admin/compiler/joomla_4/view_site_edit.css b/admin/compiler/joomla_4/view_site_edit.css new file mode 100644 index 000000000..17a8824ae --- /dev/null +++ b/admin/compiler/joomla_4/view_site_edit.css @@ -0,0 +1,5 @@ +###BOM### + +/* CSS Document */ + +###SITE_VIEWCSS### diff --git a/admin/compiler/joomla_4/views.css b/admin/compiler/joomla_4/views.css new file mode 100644 index 000000000..d79fcb92b --- /dev/null +++ b/admin/compiler/joomla_4/views.css @@ -0,0 +1,5 @@ +###BOM### + +/* CSS Document */ + +###VIEWSCSS### diff --git a/admin/compiler/joomla_4/views_custom_admin.css b/admin/compiler/joomla_4/views_custom_admin.css new file mode 100644 index 000000000..291066442 --- /dev/null +++ b/admin/compiler/joomla_4/views_custom_admin.css @@ -0,0 +1,5 @@ +###BOM### + +/* CSS Document */ + +###CUSTOM_ADMIN_VIEWCSS### diff --git a/admin/compiler/joomla_4/views_site.css b/admin/compiler/joomla_4/views_site.css new file mode 100644 index 000000000..17a8824ae --- /dev/null +++ b/admin/compiler/joomla_4/views_site.css @@ -0,0 +1,5 @@ +###BOM### + +/* CSS Document */ + +###SITE_VIEWCSS### diff --git a/admin/compiler/joomla_4/whmcs.php b/admin/compiler/joomla_4/whmcs.php new file mode 100644 index 000000000..ac7524f0e --- /dev/null +++ b/admin/compiler/joomla_4/whmcs.php @@ -0,0 +1,20 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this JCB template file (EVER) +defined('_JCB_TEMPLATE') or die; +?> +###BOM### + +// No direct access to this file +defined('_JEXEC') or die; + +// NO MORE... \ No newline at end of file diff --git a/admin/componentbuilder.php b/admin/componentbuilder.php index 0fcdaa5eb..73a661884 100644 --- a/admin/componentbuilder.php +++ b/admin/componentbuilder.php @@ -12,32 +12,42 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +// The power autoloader for this project admin area. +$power_autoloader = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/powerloader.php'; +if (file_exists($power_autoloader)) +{ + require_once $power_autoloader; +} +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Access\Exception\NotAllowed; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\MVC\Controller\BaseController; // Access check. -if (!JFactory::getUser()->authorise('core.manage', 'com_componentbuilder')) +if (!Factory::getUser()->authorise('core.manage', 'com_componentbuilder')) { - throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); -}; + throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403); +} // Add CSS file for all pages -$document = JFactory::getDocument(); -$document->addStyleSheet('components/com_componentbuilder/assets/css/admin.css'); -$document->addScript('components/com_componentbuilder/assets/js/admin.js'); +Html::_('stylesheet', 'components/com_componentbuilder/assets/css/admin.css', ['version' => 'auto']); +Html::_('script', 'components/com_componentbuilder/assets/js/admin.js', ['version' => 'auto']); // require helper files JLoader::register('ComponentbuilderHelper', __DIR__ . '/helpers/componentbuilder.php'); -JLoader::register('ComponentbuilderEmail', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/componentbuilderemail.php'); +\JLoader::register('ComponentbuilderEmail', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/componentbuilderemail.php'); JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php'); // Trigger the Global Admin Event -ComponentbuilderHelper::globalEvent($document); +ComponentbuilderHelper::globalEvent(Factory::getDocument()); // Get an instance of the controller prefixed by Componentbuilder -$controller = JControllerLegacy::getInstance('Componentbuilder'); +$controller = BaseController::getInstance('Componentbuilder'); // Perform the Request task -$controller->execute(JFactory::getApplication()->input->get('task')); +$controller->execute(Factory::getApplication()->input->get('task')); // Redirect if set by the controller $controller->redirect(); diff --git a/admin/config.xml b/admin/config.xml index 974a94e8f..3d3631f7b 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -289,6 +289,18 @@ name="uikit_config" label="COM_COMPONENTBUILDER_CONFIG_UIKIT_LABEL" description="COM_COMPONENTBUILDER_CONFIG_UIKIT_DESC"> + + + " + " + - - +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + COM_COMPONENTBUILDER_CONFIG_NO - - + + @@ -779,6 +1010,7 @@ name="language" label="COM_COMPONENTBUILDER_CONFIG_LANGUAGE_LABEL" class="list_class" + layout="joomla.form.field.list-fancy-select" multiple="false" default="en-GB" required="true" @@ -797,8 +1029,8 @@ max="100" step="10" /> - - + + input->getCmd('view', 'componentbuilder'); - $data = $this->getViewRelation($view); - $layout = $this->input->get('layout', null, 'WORD'); - $id = $this->input->getInt('id'); + $view = $this->input->getCmd('view', 'componentbuilder'); + $data = $this->getViewRelation($view); + $layout = $this->input->get('layout', null, 'WORD'); + $id = $this->input->getInt('id'); // Check for edit form. - if(ComponentbuilderHelper::checkArray($data)) + if(UtilitiesArrayHelper::check($data)) { if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_componentbuilder.edit.'.$data['view'], $id)) { // Somehow the person just went to the form - we don't allow that. - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); // check if item was opend from other then its own list view - $ref = $this->input->getCmd('ref', 0); - $refid = $this->input->getInt('refid', 0); + $ref = $this->input->getCmd('ref', 0); + $refid = $this->input->getInt('refid', 0); // set redirect - if ($refid > 0 && ComponentbuilderHelper::checkString($ref)) + if ($refid > 0 && StringHelper::check($ref)) { // redirect to item of ref - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); } - elseif (ComponentbuilderHelper::checkString($ref)) + elseif (StringHelper::check($ref)) { // redirect to ref - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view='.(string)$ref, false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view='.(string)$ref, false)); } else { // normal redirect back to the list view - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view='.$data['views'], false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view='.$data['views'], false)); } return false; @@ -89,13 +93,14 @@ function display($cachable = false, $urlparams = false) protected function getViewRelation($view) { // check the we have a value - if (ComponentbuilderHelper::checkString($view)) + if (StringHelper::check($view)) { // the view relationships $views = array( 'joomla_component' => 'joomla_components', 'joomla_module' => 'joomla_modules', 'joomla_plugin' => 'joomla_plugins', + 'joomla_power' => 'joomla_powers', 'power' => 'powers', 'admin_view' => 'admin_views', 'custom_admin_view' => 'custom_admin_views', @@ -126,6 +131,7 @@ protected function getViewRelation($view) 'component_updates' => 'components_updates', 'component_mysql_tweaks' => 'components_mysql_tweaks', 'component_custom_admin_menus' => 'components_custom_admin_menus', + 'component_router' => 'components_routers', 'component_config' => 'components_config', 'component_dashboard' => 'components_dashboard', 'component_files_folders' => 'components_files_folders', diff --git a/admin/controllers/admin_custom_tabs.php b/admin/controllers/admin_custom_tabs.php index f8877a166..7f6e4bfce 100644 --- a/admin/controllers/admin_custom_tabs.php +++ b/admin/controllers/admin_custom_tabs.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Admin_custom_tabs Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerAdmin_custom_tabs extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Admins_custom_tabs'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('admin_custom_tabs.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('admin_custom_tabs.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('admin_custom_tabs.access', 'com_componentbuilder.admin_custom_tabs.' . (int) $recordId) && $user->authorise('admin_custom_tabs.access', 'com_componentbuilder')); + $access = ($user->authorise('admin_custom_tabs.access', 'com_componentbuilder.admin_custom_tabs.' . (int) $recordId) && $user->authorise('admin_custom_tabs.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Admin_custom_tabs', '', array()); + $model = $this->getModel('Admin_custom_tabs', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=admins_custom_tabs' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=admins_custom_tabs' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/admin_fields.php b/admin/controllers/admin_fields.php index c30defa73..98309de8b 100644 --- a/admin/controllers/admin_fields.php +++ b/admin/controllers/admin_fields.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Admin_fields Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerAdmin_fields extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Admins_fields'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('admin_fields.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('admin_fields.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('admin_fields.access', 'com_componentbuilder.admin_fields.' . (int) $recordId) && $user->authorise('admin_fields.access', 'com_componentbuilder')); + $access = ($user->authorise('admin_fields.access', 'com_componentbuilder.admin_fields.' . (int) $recordId) && $user->authorise('admin_fields.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Admin_fields', '', array()); + $model = $this->getModel('Admin_fields', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=admins_fields' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=admins_fields' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/admin_fields_conditions.php b/admin/controllers/admin_fields_conditions.php index 00c75f837..361a81a0e 100644 --- a/admin/controllers/admin_fields_conditions.php +++ b/admin/controllers/admin_fields_conditions.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Admin_fields_conditions Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerAdmin_fields_conditions extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Admins_fields_conditions'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('admin_fields_conditions.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('admin_fields_conditions.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('admin_fields_conditions.access', 'com_componentbuilder.admin_fields_conditions.' . (int) $recordId) && $user->authorise('admin_fields_conditions.access', 'com_componentbuilder')); + $access = ($user->authorise('admin_fields_conditions.access', 'com_componentbuilder.admin_fields_conditions.' . (int) $recordId) && $user->authorise('admin_fields_conditions.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Admin_fields_conditions', '', array()); + $model = $this->getModel('Admin_fields_conditions', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=admins_fields_conditions' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=admins_fields_conditions' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/admin_fields_relations.php b/admin/controllers/admin_fields_relations.php index d16406cf9..b775c6e7e 100644 --- a/admin/controllers/admin_fields_relations.php +++ b/admin/controllers/admin_fields_relations.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Admin_fields_relations Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerAdmin_fields_relations extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Admins_fields_relations'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('admin_fields_relations.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('admin_fields_relations.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('admin_fields_relations.access', 'com_componentbuilder.admin_fields_relations.' . (int) $recordId) && $user->authorise('admin_fields_relations.access', 'com_componentbuilder')); + $access = ($user->authorise('admin_fields_relations.access', 'com_componentbuilder.admin_fields_relations.' . (int) $recordId) && $user->authorise('admin_fields_relations.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Admin_fields_relations', '', array()); + $model = $this->getModel('Admin_fields_relations', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=admins_fields_relations' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=admins_fields_relations' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/admin_view.php b/admin/controllers/admin_view.php index f1f68d7c6..1359388c3 100644 --- a/admin/controllers/admin_view.php +++ b/admin/controllers/admin_view.php @@ -12,8 +12,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use VDM\Joomla\Utilities\GetHelper; /** * Admin_view Form Controller @@ -36,13 +43,13 @@ class ComponentbuilderControllerAdmin_view extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Admin_views'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +58,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('admin_view.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +69,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('admin_view.create', $this->option); } @@ -76,16 +83,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('admin_view.access', 'com_componentbuilder.admin_view.' . (int) $recordId) && $user->authorise('admin_view.access', 'com_componentbuilder')); + $access = ($user->authorise('admin_view.access', 'com_componentbuilder.admin_view.' . (int) $recordId) && $user->authorise('admin_view.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +157,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +179,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Admin_view', '', array()); + $model = $this->getModel('Admin_view', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=admin_views' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=admin_views' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +210,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +227,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +238,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +264,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +282,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,14 +316,14 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { // get the state object (Joomla\CMS\Object\CMSObject) $state = $model->get('state'); @@ -337,7 +344,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array()) foreach($_tablesArray as $_updateTable) { // get the linked ID - if ($_value = ComponentbuilderHelper::getVar($_updateTable, $oldID, 'admin_view', 'id')) + if ($_value = GetHelper::var($_updateTable, $oldID, 'admin_view', 'id')) { // copy fields to new admin view ComponentbuilderHelper::copyItem(/*id->*/ $_value, /*table->*/ $_updateTable, /*change->*/ array('admin_view' => $newID)); @@ -347,5 +354,4 @@ protected function postSaveHook(JModelLegacy $model, $validData = array()) return; } - } diff --git a/admin/controllers/admin_views.php b/admin/controllers/admin_views.php index d619a88ff..8b95dbb06 100644 --- a/admin/controllers/admin_views.php +++ b/admin/controllers/admin_views.php @@ -12,8 +12,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Admin_views Admin Controller @@ -47,13 +54,13 @@ public function getModel($name = 'Admin_view', $prefix = 'ComponentbuilderModel' public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('admin_view.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +68,16 @@ public function exportData() $model = $this->getModel('Admin_views'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Admin_views_'.$date->format('jS_F_Y'),'Admin views exported ('.$date->format('jS F, Y').')','admin views'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=admin_views', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=admin_views', false), $message, 'error'); return; } @@ -78,32 +85,32 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('admin_view.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Admin_views'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('admin_view_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'admin_views'); $session->set('dataType_VDM_IMPORTINTO', 'admin_view'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_ADMIN_VIEWS'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_ADMIN_VIEWS'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=admin_views', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=admin_views', false), $message, 'error'); return; } @@ -116,29 +123,29 @@ public function importData() public function runExpansion() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=admin_views', false); + $redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=admin_views', false); // set massage - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); // check if this user has the right to run expansion if($user->authorise('admin_views.run_expansion', 'com_componentbuilder')) { // set massage - $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + $message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); // run expansion via API - $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + $result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand'); // is there a message returned - if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + if (!is_numeric($result) && StringHelper::check($result)) { $this->setRedirect($redirect_url, $result); return true; } elseif (is_numeric($result) && 1 == $result) { - $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); $this->setRedirect($redirect_url, $message, 'message'); return true; } @@ -147,4 +154,4 @@ public function runExpansion() return false; } -} +} \ No newline at end of file diff --git a/admin/controllers/admins_custom_tabs.php b/admin/controllers/admins_custom_tabs.php index 8ba6143b8..61e43cc65 100644 --- a/admin/controllers/admins_custom_tabs.php +++ b/admin/controllers/admins_custom_tabs.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Admins_custom_tabs Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Admin_custom_tabs', $prefix = 'Componentbuilde { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/admins_fields.php b/admin/controllers/admins_fields.php index 0743816d5..d8c328777 100644 --- a/admin/controllers/admins_fields.php +++ b/admin/controllers/admins_fields.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Admins_fields Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Admin_fields', $prefix = 'ComponentbuilderMode { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/admins_fields_conditions.php b/admin/controllers/admins_fields_conditions.php index 15ab90018..a832d2864 100644 --- a/admin/controllers/admins_fields_conditions.php +++ b/admin/controllers/admins_fields_conditions.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Admins_fields_conditions Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Admin_fields_conditions', $prefix = 'Component { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/admins_fields_relations.php b/admin/controllers/admins_fields_relations.php index 44524263c..c14541e43 100644 --- a/admin/controllers/admins_fields_relations.php +++ b/admin/controllers/admins_fields_relations.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Admins_fields_relations Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Admin_fields_relations', $prefix = 'Componentb { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index 0d831e5ec..2ae49345c 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -12,7 +12,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Session\Session; use Joomla\Utilities\ArrayHelper; /** @@ -24,9 +26,9 @@ public function __construct($config) { parent::__construct($config); // make sure all json stuff are set - JFactory::getDocument()->setMimeEncoding( 'application/json' ); + Factory::getDocument()->setMimeEncoding( 'application/json' ); // get the application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $app->setHeader('Content-Disposition','attachment;filename="getajax.json"'); $app->setHeader('Access-Control-Allow-Origin', '*'); // load the tasks @@ -67,6 +69,11 @@ public function __construct($config) $this->registerTask('fieldTypeProperties', 'ajax'); $this->registerTask('getFieldPropertyDesc', 'ajax'); $this->registerTask('getCodeGlueOptions', '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'); @@ -75,16 +82,16 @@ public function __construct($config) public function ajax() { // get the user for later use - $user = JFactory::getUser(); + $user = Factory::getUser(); // get the input values - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // check if we should return raw - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); // return to a callback function - $callback = $jinput->get('callback', null, 'CMD'); + $callback = $jinput->get('callback', null, 'CMD'); // Check Token! - $token = JSession::getFormToken(); - $call_token = $jinput->get('token', 0, 'ALNUM'); + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { // get the task @@ -97,7 +104,15 @@ public function ajax() $noticeValue = $jinput->get('notice', NULL, 'STRING'); if($noticeValue && $user->id != 0) { - $result = $this->getModel('ajax')->isNew($noticeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->isNew($noticeValue); + } + else + { + $result = false; + } } else { @@ -116,7 +131,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -138,7 +153,15 @@ public function ajax() $noticeValue = $jinput->get('notice', NULL, 'STRING'); if($noticeValue && $user->id != 0) { - $result = $this->getModel('ajax')->isRead($noticeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->isRead($noticeValue); + } + else + { + $result = false; + } } else { @@ -157,7 +180,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -179,7 +202,15 @@ public function ajax() $idValue = $jinput->get('id', NULL, 'INT'); if($idValue && $user->id != 0) { - $result = $this->getModel('ajax')->getComponentDetails($idValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getComponentDetails($idValue); + } + else + { + $result = false; + } } else { @@ -198,7 +229,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -220,7 +251,15 @@ public function ajax() $getTypeValue = $jinput->get('getType', NULL, 'WORD'); if($getTypeValue && $user->id != 0) { - $result = $this->getModel('ajax')->getCronPath($getTypeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getCronPath($getTypeValue); + } + else + { + $result = false; + } } else { @@ -239,7 +278,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -261,7 +300,15 @@ public function ajax() $nameValue = $jinput->get('name', NULL, 'WORD'); if($nameValue && $user->id != 0) { - $result = $this->getModel('ajax')->getWiki($nameValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getWiki($nameValue); + } + else + { + $result = false; + } } else { @@ -280,7 +327,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -302,7 +349,15 @@ public function ajax() $versionValue = $jinput->get('version', NULL, 'INT'); if($versionValue && $user->id != 0) { - $result = $this->getModel('ajax')->getVersion($versionValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getVersion($versionValue); + } + else + { + $result = false; + } } else { @@ -321,7 +376,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -343,7 +398,15 @@ public function ajax() $packageValue = $jinput->get('package', NULL, 'BASE64'); if($packageValue && $user->id != 0) { - $result = $this->getModel('ajax')->getJCBpackageInfo($packageValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getJCBpackageInfo($packageValue); + } + else + { + $result = false; + } } else { @@ -362,7 +425,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -385,7 +448,15 @@ public function ajax() $keyValue = $jinput->get('key', NULL, 'ALNUM'); if($identifierValue && $user->id != 0 && $keyValue) { - $result = $this->getModel('ajax')->getCrowdinDetails($identifierValue, $keyValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getCrowdinDetails($identifierValue, $keyValue); + } + else + { + $result = false; + } } else { @@ -404,7 +475,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -426,7 +497,15 @@ public function ajax() $dataValue = $jinput->get('data', NULL, 'STRING'); if($dataValue && $user->id != 0) { - $result = $this->getModel('ajax')->getModuleCode($dataValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getModuleCode($dataValue); + } + else + { + $result = false; + } } else { @@ -445,7 +524,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -468,7 +547,15 @@ public function ajax() $typeValue = $jinput->get('type', NULL, 'WORD'); if($idValue && $user->id != 0 && $typeValue) { - $result = $this->getModel('ajax')->getClassCode($idValue, $typeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getClassCode($idValue, $typeValue); + } + else + { + $result = false; + } } else { @@ -487,7 +574,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -511,7 +598,15 @@ public function ajax() $keyValue = $jinput->get('key', 1, 'INT'); if($idValue && $user->id != 0 && $typeValue) { - $result = $this->getModel('ajax')->getClassCodeIds($idValue, $typeValue, $keyValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getClassCodeIds($idValue, $typeValue, $keyValue); + } + else + { + $result = false; + } } else { @@ -530,7 +625,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -553,7 +648,15 @@ public function ajax() $typeValue = $jinput->get('type', NULL, 'WORD'); if($idValue && $user->id != 0 && $typeValue) { - $result = $this->getModel('ajax')->getClassHeaderCode($idValue, $typeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getClassHeaderCode($idValue, $typeValue); + } + else + { + $result = false; + } } else { @@ -572,7 +675,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -594,7 +697,15 @@ public function ajax() $tableValue = $jinput->get('table', NULL, 'WORD'); if($tableValue && $user->id != 0) { - $result = $this->getModel('ajax')->getTableColumns($tableValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getTableColumns($tableValue); + } + else + { + $result = false; + } } else { @@ -613,7 +724,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -635,7 +746,15 @@ public function ajax() $idValue = $jinput->get('id', NULL, 'INT'); if($idValue && $user->id != 0) { - $result = $this->getModel('ajax')->getFieldSelectOptions($idValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getFieldSelectOptions($idValue); + } + else + { + $result = false; + } } else { @@ -654,7 +773,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -676,7 +795,15 @@ public function ajax() $typeValue = $jinput->get('type', NULL, 'WORD'); if($typeValue && $user->id != 0) { - $result = $this->getModel('ajax')->getDynamicScripts($typeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getDynamicScripts($typeValue); + } + else + { + $result = false; + } } else { @@ -695,7 +822,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -718,7 +845,15 @@ public function ajax() $sizeValue = $jinput->get('size', NULL, 'INT'); if($typeValue && $user->id != 0 && $sizeValue) { - $result = $this->getModel('ajax')->getButton($typeValue, $sizeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getButton($typeValue, $sizeValue); + } + else + { + $result = false; + } } else { @@ -737,7 +872,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -760,7 +895,15 @@ public function ajax() $sizeValue = $jinput->get('size', NULL, 'INT'); if($typeValue && $user->id != 0 && $sizeValue) { - $result = $this->getModel('ajax')->getButtonID($typeValue, $sizeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getButtonID($typeValue, $sizeValue); + } + else + { + $result = false; + } } else { @@ -779,7 +922,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -801,7 +944,15 @@ public function ajax() $typeValue = $jinput->get('type', NULL, 'WORD'); if($typeValue && $user->id != 0) { - $result = $this->getModel('ajax')->getAjaxDisplay($typeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getAjaxDisplay($typeValue); + } + else + { + $result = false; + } } else { @@ -820,7 +971,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -842,7 +993,15 @@ public function ajax() $typeValue = $jinput->get('type', NULL, 'ALNUM'); if($typeValue && $user->id != 0) { - $result = $this->getModel('ajax')->getLinked($typeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getLinked($typeValue); + } + else + { + $result = false; + } } else { @@ -861,7 +1020,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -883,7 +1042,15 @@ public function ajax() $typeValue = $jinput->get('type', NULL, 'ALNUM'); if($typeValue && $user->id != 0) { - $result = $this->getModel('ajax')->checkAliasField($typeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->checkAliasField($typeValue); + } + else + { + $result = false; + } } else { @@ -902,7 +1069,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -924,7 +1091,15 @@ public function ajax() $typeValue = $jinput->get('type', NULL, 'ALNUM'); if($typeValue && $user->id != 0) { - $result = $this->getModel('ajax')->checkCategoryField($typeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->checkCategoryField($typeValue); + } + else + { + $result = false; + } } else { @@ -943,7 +1118,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -965,7 +1140,15 @@ public function ajax() $idValue = $jinput->get('id', null, 'INT'); if($idValue && $user->id != 0) { - $result = $this->getModel('ajax')->getTemplateDetails($idValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getTemplateDetails($idValue); + } + else + { + $result = false; + } } else { @@ -984,7 +1167,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1006,7 +1189,15 @@ public function ajax() $idValue = $jinput->get('id', NULL, 'INT'); if($idValue && $user->id != 0) { - $result = $this->getModel('ajax')->getLayoutDetails($idValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getLayoutDetails($idValue); + } + else + { + $result = false; + } } else { @@ -1025,7 +1216,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1049,7 +1240,15 @@ public function ajax() $typeValue = $jinput->get('type', NULL, 'INT'); if($nameValue && $user->id != 0 && $asValue && $typeValue) { - $result = $this->getModel('ajax')->getDbTableColumns($nameValue, $asValue, $typeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getDbTableColumns($nameValue, $asValue, $typeValue); + } + else + { + $result = false; + } } else { @@ -1068,7 +1267,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1092,7 +1291,15 @@ public function ajax() $typeValue = $jinput->get('type', NULL, 'INT'); if($idValue && $user->id != 0 && $asValue && $typeValue) { - $result = $this->getModel('ajax')->getViewTableColumns($idValue, $asValue, $typeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getViewTableColumns($idValue, $asValue, $typeValue); + } + else + { + $result = false; + } } else { @@ -1111,7 +1318,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1134,7 +1341,15 @@ public function ajax() $viewValue = $jinput->get('view', NULL, 'WORD'); if($idValue && $user->id != 0 && $viewValue) { - $result = $this->getModel('ajax')->getDynamicValues($idValue, $viewValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getDynamicValues($idValue, $viewValue); + } + else + { + $result = false; + } } else { @@ -1153,7 +1368,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1176,7 +1391,15 @@ public function ajax() $idValue = $jinput->get('id', NULL, 'INT'); if($functioNameValue && $user->id != 0 && $idValue) { - $result = $this->getModel('ajax')->checkFunctionName($functioNameValue, $idValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->checkFunctionName($functioNameValue, $idValue); + } + else + { + $result = false; + } } else { @@ -1195,7 +1418,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1219,7 +1442,15 @@ public function ajax() $targetValue = $jinput->get('target', NULL, 'WORD'); if($functioNameValue && $user->id != 0 && $idValue && $targetValue) { - $result = $this->getModel('ajax')->usedin($functioNameValue, $idValue, $targetValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->usedin($functioNameValue, $idValue, $targetValue); + } + else + { + $result = false; + } } else { @@ -1238,7 +1469,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1260,7 +1491,15 @@ public function ajax() $idValue = $jinput->get('id', NULL, 'INT'); if($idValue && $user->id != 0) { - $result = $this->getModel('ajax')->getEditCustomCodeButtons($idValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getEditCustomCodeButtons($idValue); + } + else + { + $result = false; + } } else { @@ -1279,7 +1518,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1303,7 +1542,15 @@ public function ajax() $targetValue = $jinput->get('target', NULL, 'WORD'); if($placeholderValue && $user->id != 0 && $idValue && $targetValue) { - $result = $this->getModel('ajax')->placedin($placeholderValue, $idValue, $targetValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->placedin($placeholderValue, $idValue, $targetValue); + } + else + { + $result = false; + } } else { @@ -1322,7 +1569,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1345,7 +1592,15 @@ public function ajax() $placeholderNameValue = $jinput->get('placeholderName', NULL, 'STRING'); if($idValue && $user->id != 0 && $placeholderNameValue) { - $result = $this->getModel('ajax')->checkPlaceholderName($idValue, $placeholderNameValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->checkPlaceholderName($idValue, $placeholderNameValue); + } + else + { + $result = false; + } } else { @@ -1364,7 +1619,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1386,7 +1641,15 @@ public function ajax() $nameValue = $jinput->get('name', NULL, 'WORD'); if($nameValue && $user->id != 0) { - $result = $this->getModel('ajax')->getExistingValidationRuleCode($nameValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getExistingValidationRuleCode($nameValue); + } + else + { + $result = false; + } } else { @@ -1405,7 +1668,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1427,7 +1690,15 @@ public function ajax() $idValue = $jinput->get('id', NULL, 'INT'); if($idValue && $user->id != 0) { - $result = $this->getModel('ajax')->getValidationRulesTable($idValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getValidationRulesTable($idValue); + } + else + { + $result = false; + } } else { @@ -1446,7 +1717,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1469,7 +1740,15 @@ public function ajax() $idValue = $jinput->get('id', NULL, 'INT'); if($nameValue && $user->id != 0 && $idValue) { - $result = $this->getModel('ajax')->checkRuleName($nameValue, $idValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->checkRuleName($nameValue, $idValue); + } + else + { + $result = false; + } } else { @@ -1488,7 +1767,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1510,7 +1789,15 @@ public function ajax() $idValue = $jinput->get('id', NULL, 'INT'); if($idValue) { - $result = $this->getModel('ajax')->getFieldTypeProperties($idValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getFieldTypeProperties($idValue); + } + else + { + $result = false; + } } else { @@ -1529,7 +1816,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1552,7 +1839,15 @@ public function ajax() $fieldtypeValue = $jinput->get('fieldtype', NULL, 'ALNUM'); if($propertyValue && $user->id != 0 && $fieldtypeValue) { - $result = $this->getModel('ajax')->getFieldPropertyDesc($propertyValue, $fieldtypeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getFieldPropertyDesc($propertyValue, $fieldtypeValue); + } + else + { + $result = false; + } } else { @@ -1571,7 +1866,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1596,7 +1891,15 @@ public function ajax() $areaValue = $jinput->get('area', NULL, 'INT'); if($listfieldValue && $user->id != 0 && $joinfieldsValue && $typeValue && $areaValue) { - $result = $this->getModel('ajax')->getCodeGlueOptions($listfieldValue, $joinfieldsValue, $typeValue, $areaValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getCodeGlueOptions($listfieldValue, $joinfieldsValue, $typeValue, $areaValue); + } + else + { + $result = false; + } } else { @@ -1615,7 +1918,282 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) + { + if($callback) + { + echo $callback."(".json_encode($e).");"; + } + elseif($returnRaw) + { + echo json_encode($e); + } + else + { + echo "(".json_encode($e).");"; + } + } + break; + 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 && $type_searchValue && $search_valueValue) + { + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->doSearch($table_nameValue, $type_searchValue, $search_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue); + } + else + { + $result = false; + } + } + 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 'replaceAll': + try + { + $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'); + $component_idValue = $jinput->get('component_id', 0, 'INT'); + if($table_nameValue && $user->id != 0 && $search_valueValue) + { + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->replaceAll($table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue); + } + else + { + $result = false; + } + } + 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) + { + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getSearchValue($field_nameValue, $row_idValue, $table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue); + } + else + { + $result = false; + } + } + 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) + { + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getReplaceValue($field_nameValue, $row_idValue, $line_nrValue, $table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue); + } + else + { + $result = false; + } + } + 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) + { + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->setValue($valueValue, $row_idValue, $field_nameValue, $table_nameValue); + } + else + { + $result = false; + } + } + 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) { @@ -1637,7 +2215,15 @@ public function ajax() $idValue = $jinput->get('id', NULL, 'INT'); if($idValue && $user->id != 0) { - $result = $this->getModel('ajax')->getSnippetDetails($idValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getSnippetDetails($idValue); + } + else + { + $result = false; + } } else { @@ -1656,7 +2242,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1679,7 +2265,15 @@ public function ajax() $statusValue = $jinput->get('status', NULL, 'WORD'); if($pathValue && $user->id != 0 && $statusValue) { - $result = $this->getModel('ajax')->setSnippetGithub($pathValue, $statusValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->setSnippetGithub($pathValue, $statusValue); + } + else + { + $result = false; + } } else { @@ -1698,7 +2292,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -1720,7 +2314,15 @@ public function ajax() $librariesValue = $jinput->get('libraries', NULL, 'STRING'); if($librariesValue && $user->id != 0) { - $result = $this->getModel('ajax')->getSnippets($librariesValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getSnippets($librariesValue); + } + else + { + $result = false; + } } else { @@ -1739,7 +2341,7 @@ public function ajax() echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { diff --git a/admin/controllers/class_extendings.php b/admin/controllers/class_extendings.php index 0506656fb..d5487f11f 100644 --- a/admin/controllers/class_extendings.php +++ b/admin/controllers/class_extendings.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Class_extendings Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Class_extends', $prefix = 'ComponentbuilderMod { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/class_extends.php b/admin/controllers/class_extends.php index ebd3462df..7308076f2 100644 --- a/admin/controllers/class_extends.php +++ b/admin/controllers/class_extends.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Class_extends Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerClass_extends extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Class_extendings'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('class_extends.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('class_extends.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('class_extends.access', 'com_componentbuilder.class_extends.' . (int) $recordId) && $user->authorise('class_extends.access', 'com_componentbuilder')); + $access = ($user->authorise('class_extends.access', 'com_componentbuilder.class_extends.' . (int) $recordId) && $user->authorise('class_extends.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Class_extends', '', array()); + $model = $this->getModel('Class_extends', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_extendings' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=class_extendings' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/class_method.php b/admin/controllers/class_method.php index b5f24ec8b..467e1839e 100644 --- a/admin/controllers/class_method.php +++ b/admin/controllers/class_method.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Class_method Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerClass_method extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Class_methods'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('class_method.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('class_method.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('class_method.access', 'com_componentbuilder.class_method.' . (int) $recordId) && $user->authorise('class_method.access', 'com_componentbuilder')); + $access = ($user->authorise('class_method.access', 'com_componentbuilder.class_method.' . (int) $recordId) && $user->authorise('class_method.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Class_method', '', array()); + $model = $this->getModel('Class_method', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_methods' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=class_methods' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/class_methods.php b/admin/controllers/class_methods.php index c6d16c420..274d4cf16 100644 --- a/admin/controllers/class_methods.php +++ b/admin/controllers/class_methods.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Class_methods Admin Controller @@ -47,13 +53,13 @@ public function getModel($name = 'Class_method', $prefix = 'ComponentbuilderMode public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('class_method.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +67,16 @@ public function exportData() $model = $this->getModel('Class_methods'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Class_methods_'.$date->format('jS_F_Y'),'Class methods exported ('.$date->format('jS F, Y').')','class methods'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_methods', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=class_methods', false), $message, 'error'); return; } @@ -78,32 +84,32 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('class_method.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Class_methods'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('class_method_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'class_methods'); $session->set('dataType_VDM_IMPORTINTO', 'class_method'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CLASS_METHODS'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CLASS_METHODS'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_methods', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=class_methods', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/class_properties.php b/admin/controllers/class_properties.php index 637519a61..3b3a5fd32 100644 --- a/admin/controllers/class_properties.php +++ b/admin/controllers/class_properties.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Class_properties Admin Controller @@ -47,13 +53,13 @@ public function getModel($name = 'Class_property', $prefix = 'ComponentbuilderMo public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('class_property.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +67,16 @@ public function exportData() $model = $this->getModel('Class_properties'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Class_properties_'.$date->format('jS_F_Y'),'Class properties exported ('.$date->format('jS F, Y').')','class properties'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_properties', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=class_properties', false), $message, 'error'); return; } @@ -78,32 +84,32 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('class_property.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Class_properties'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('class_property_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'class_properties'); $session->set('dataType_VDM_IMPORTINTO', 'class_property'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CLASS_PROPERTIES'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CLASS_PROPERTIES'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_properties', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=class_properties', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/class_property.php b/admin/controllers/class_property.php index 7b4601c64..098d702ee 100644 --- a/admin/controllers/class_property.php +++ b/admin/controllers/class_property.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Class_property Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerClass_property extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Class_properties'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('class_property.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('class_property.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('class_property.access', 'com_componentbuilder.class_property.' . (int) $recordId) && $user->authorise('class_property.access', 'com_componentbuilder')); + $access = ($user->authorise('class_property.access', 'com_componentbuilder.class_property.' . (int) $recordId) && $user->authorise('class_property.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Class_property', '', array()); + $model = $this->getModel('Class_property', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_properties' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=class_properties' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/compiler.php b/admin/controllers/compiler.php index e4411c370..e46145a32 100644 --- a/admin/controllers/compiler.php +++ b/admin/controllers/compiler.php @@ -12,9 +12,16 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory; +use Joomla\CMS\Version; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Compiler Admin Controller @@ -31,9 +38,9 @@ class ComponentbuilderControllerCompiler extends AdminController /** * Proxy for getModel. - * @since 2.5 + * @since 2.5 */ - public function getModel($name = 'Compiler', $prefix = 'ComponentbuilderModel', $config = array()) + public function getModel($name = 'Compiler', $prefix = 'ComponentbuilderModel', $config = []) { $model = parent::getModel($name, $prefix, array('ignore_request' => true)); @@ -42,7 +49,7 @@ public function getModel($name = 'Compiler', $prefix = 'ComponentbuilderModel', public function dashboard() { - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder', false)); return; } @@ -51,23 +58,23 @@ public function dashboard() * * @return true on success */ - public function getCompilerAnimations() + public function getDynamicContent() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_DOWNLOAD_THE_COMPILER_ANIMATIONS'); + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_DOWNLOAD_THE_COMPILER_ANIMATIONS'); // currently only those with permissions can get these images if($user->authorise('compiler.compiler_animations', 'com_componentbuilder')) { // 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'); + $message = Text::_('COM_COMPONENTBUILDER_BALL_THE_COMPILER_ANIMATIONS_WERE_SUCCESSFULLY_DOWNLOADED_TO_THIS_JOOMLA_INSTALLB'); $this->setRedirect($redirect_url, $message, 'message'); return true; } @@ -84,18 +91,16 @@ public function getCompilerAnimations() public function compiler() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // currently only those with admin access can compile a component if($user->authorise('core.manage', 'com_componentbuilder')) { - // include component compiler - require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/compiler.php'; $model = $this->getModel('compiler'); if ($model->builder()) { - $cache = JFactory::getCache('mod_menu'); + $cache = Factory::getCache('mod_menu'); $cache->clean(); // TODO: Reset the users acl here as well to kill off any missing bits } @@ -109,7 +114,7 @@ public function compiler() $add_plugin_install = false; $add_module_install = false; // get application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // set redirection URL $redirect_url = $app->getUserState('com_componentbuilder.redirect_url'); // get system messages @@ -119,15 +124,15 @@ public function compiler() // start new message $message = array(); // update the redirection URL - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false); if (($pos = strpos($model->compiler->filepath['component'], "/tmp/")) !== FALSE) { - $url = JURI::root() . substr($model->compiler->filepath['component'], $pos + 1); + $url = \JUri::root() . substr($model->compiler->filepath['component'], $pos + 1); } // check if we have plugins - $add_plugin_install = ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins'], true); + $add_plugin_install = UtilitiesArrayHelper::check($model->compiler->filepath['plugins'], true); // check if we have modules - $add_module_install = ComponentbuilderHelper::checkArray($model->compiler->filepath['modules'], true); + $add_module_install = UtilitiesArrayHelper::check($model->compiler->filepath['modules'], true); // if a multi install we set another kind of header if ($add_plugin_install || $add_module_install) { @@ -142,48 +147,52 @@ public function compiler() // Message of successful build $message[] = '

The (' . $model->compiler->filepath['component-folder'] . ') was Successfully Compiled!

'; } - $message[] = '

'; - // check if we have modules - if ($add_module_install) + + if (CFactory::_('Config')->joomla_version == Version::MAJOR_VERSION) { - foreach ($model->compiler->filepath['modules-folder'] as $module_id => $module_folder) + $message[] = '

'; + // check if we have modules + if ($add_module_install) { - $message[] = '

'; + foreach ($model->compiler->filepath['modules-folder'] as $module_id => $module_folder) + { + $message[] = '

'; + } } - } - // check if we have plugins - if ($add_plugin_install) - { - foreach ($model->compiler->filepath['plugins-folder'] as $plugin_id => $plugin_folder) + // check if we have plugins + if ($add_plugin_install) { - $message[] = '

'; + foreach ($model->compiler->filepath['plugins-folder'] as $plugin_id => $plugin_folder) + { + $message[] = '

'; + } + } + // set multi install button + if ($add_multi_install) + { + $message[] = '

You can install all compiled extensions!

'; + $message[] = '

'; } - } - // set multi install button - if ($add_multi_install) - { - $message[] = '

You can install all compiled extensions!

'; - $message[] = '

'; } $message[] = '

Total time saved

'; $message[] = '
    '; - $message[] = '
  • Total folders created: '.$model->compiler->folderCount.'
  • '; - $message[] = '
  • Total files created: '.$model->compiler->fileCount.'
  • '; - $message[] = '
  • Total fields created: '.$model->compiler->fieldCount.'
  • '; - $message[] = '
  • Total lines written: '.$model->compiler->lineCount.'
  • '; - $message[] = '
  • A4 Book of: '.$model->compiler->pageCount.' pages
  • '; + $message[] = '
  • Total folders created: #'.'##FOLDER_COUNT##'.'#
  • '; + $message[] = '
  • Total files created: #'.'##FILE_COUNT##'.'#
  • '; + $message[] = '
  • Total fields created: #'.'##FIELD_COUNT##'.'#
  • '; + $message[] = '
  • Total lines written: #'.'##LINE_COUNT##'.'#
  • '; + $message[] = '
  • A4 Book of: #'.'##PAGE_COUNT##'.'# pages
  • '; $message[] = '
'; - $message[] = '

'.$model->compiler->totalHours.' Hours or '.$model->compiler->totalDays.' Eight Hour Days (actual time you saved)
'; + $message[] = '

#'.'##totalHours##'.'# Hours or #'.'##totalDays##'.'# Eight Hour Days (actual time you saved)
'; $message[] = '(if creating a folder and file took 5 seconds and writing one line of code took 10 seconds, never making one mistake or taking any coffee break.)
'; - $message[] = ''.$model->compiler->actualHoursSpent.' Hours or '.$model->compiler->actualDaysSpent.' Eight Hour Days (the actual time you spent)
'; - $message[] = '(with the following break down: debugging @'.$model->compiler->debuggingHours.'hours = codingtime / 4; planning @'.$model->compiler->planningHours.'hours = codingtime / 7; mapping @'.$model->compiler->mappingHours.'hours = codingtime / 10; office @'.$model->compiler->officeHours.'hours = codingtime / 6;)

'; - $message[] = '

'.$model->compiler->actualTotalHours.' Hours or '.$model->compiler->actualTotalDays.' Eight Hour Days (a total of the realistic time frame for this project)
'; + $message[] = '#'.'##actualHoursSpent##'.'# Hours or #'.'##actualDaysSpent##'.'# Eight Hour Days (the actual time you spent)
'; + $message[] = '(with the following break down: debugging @#'.'##debuggingHours##'.'#hours = codingtime / 4; planning @#'.'##planningHours##'.'#hours = codingtime / 7; mapping @#'.'##mappingHours##'.'#hours = codingtime / 10; office @#'.'##officeHours##'.'#hours = codingtime / 6;)

'; + $message[] = '

#'.'##actualTotalHours##'.'# Hours or #'.'##actualTotalDays##'.'# Eight Hour Days (a total of the realistic time frame for this project)
'; $message[] = '(if creating a folder and file took 5 seconds and writing one line of code took 10 seconds, with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)

'; - $message[] = '

Project duration: '.$model->compiler->projectWeekTime. ' weeks or '.$model->compiler->projectMonthTime.' months

'; + $message[] = '

Project duration: '.$model->compiler->projectWeekTime. ' weeks or #'.'##projectMonthTime##'.'# months

'; // check if we have modules or plugins if ($add_multi_install) { @@ -201,7 +210,7 @@ public function compiler() $message[] = 'Module Path: ' . $module_path . '
'; if (($pos = strpos($module_path, "/tmp/")) !== FALSE) { - $module_urls[$module_id] = JURI::root() . substr($module_path, $pos + 1); + $module_urls[$module_id] = \JUri::root() . substr($module_path, $pos + 1); $message[] = 'Module URL: ' . $module_urls[$module_id] . '
'; } } @@ -217,7 +226,7 @@ public function compiler() $message[] = 'Plugin Path: ' . $plugin_path . '
'; if (($pos = strpos($plugin_path, "/tmp/")) !== FALSE) { - $plugin_urls[$plugin_id] = JURI::root() . substr($plugin_path, $pos + 1); + $plugin_urls[$plugin_id] = \JUri::root() . substr($plugin_path, $pos + 1); $message[] = 'Plugin URL: ' . $plugin_urls[$plugin_id] . '
'; } } @@ -225,7 +234,7 @@ public function compiler() $message[] = '
Hey! you can also download these zip files right now!
'; $message[] = 'Download Component  '; // load the module download URL's - if (isset($module_urls) && ComponentbuilderHelper::checkArray($module_urls)) + if (isset($module_urls) && UtilitiesArrayHelper::check($module_urls)) { foreach ($module_urls as $module_id => $module_url) { @@ -234,7 +243,7 @@ public function compiler() } } // load the plugin download URL's - if (isset($plugin_urls) && ComponentbuilderHelper::checkArray($plugin_urls)) + if (isset($plugin_urls) && UtilitiesArrayHelper::check($plugin_urls)) { foreach ($plugin_urls as $plugin_id => $plugin_url) { @@ -254,9 +263,14 @@ public function compiler() $message[] = 'Download

'; $message[] = '

Remember! This zip file is in your tmp folder and therefore publicly accessible until you click [Clear tmp]!

'; } - $message[] = '

Compilation took '.$model->compiler->secondsCompiled.' seconds to complete.

'; + $message[] = '

Compilation took #'.'##COMPILER_TIMER##'.'# seconds to complete.

'; // 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::_('Compiler.Builder.Content.One')->allActive() + ) + ); // set redirect $this->setRedirect($redirect_url, '

Successful Build!

', 'message'); $app->setUserState('com_componentbuilder.component_folder_name', $model->compiler->filepath['component-folder']); @@ -297,25 +311,25 @@ public function compiler() public function installCompiledExtensions() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THESE_EXTENSIONS'); + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THESE_EXTENSIONS'); // currently only those with admin access can install a component via JCB if($user->authorise('core.manage')) { - $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_EXTENSIONS'); + $message = Text::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_EXTENSIONS'); $_message = array('success' => array(), 'error' => array()); - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // start file name array $fileNames = array(); $fileNames[] = $app->getUserState('com_componentbuilder.component_folder_name', null); // check if we have modules - $fileNames = ComponentbuilderHelper::mergeArrays(array($fileNames, $app->getUserState('com_componentbuilder.modules_folder_name', array()) )); + $fileNames = UtilitiesArrayHelper::merge(array($fileNames, $app->getUserState('com_componentbuilder.modules_folder_name', array()) )); // check if we have plugins - $fileNames = ComponentbuilderHelper::mergeArrays(array($fileNames, $app->getUserState('com_componentbuilder.plugins_folder_name', array()) )); + $fileNames = UtilitiesArrayHelper::merge(array($fileNames, $app->getUserState('com_componentbuilder.plugins_folder_name', array()) )); // wipe out the user c-m-p since we are done with them all $app->setUserState('com_componentbuilder.component_folder_name', ''); @@ -328,20 +342,20 @@ public function installCompiledExtensions() { if ($this->installExtension($fileName)) { - $_message['success'][] = JText::sprintf('COM_COMPONENTBUILDER_SZIP_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileName); + $_message['success'][] = Text::sprintf('COM_COMPONENTBUILDER_SZIP_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileName); } else { - $_message['error'][] = JText::sprintf('COM_COMPONENTBUILDER_SZIP_COULD_NOT_BE_INSTALLED', $fileName); + $_message['error'][] = Text::sprintf('COM_COMPONENTBUILDER_SZIP_COULD_NOT_BE_INSTALLED', $fileName); } } // catch errors - if (ComponentbuilderHelper::checkArray($_message['error'])) + if (UtilitiesArrayHelper::check($_message['error'])) { $app->enqueueMessage(implode('
', $_message['error']), 'Error'); } // build success message - if (ComponentbuilderHelper::checkArray($_message['success'])) + if (UtilitiesArrayHelper::check($_message['success'])) { $this->setRedirect($redirect_url, implode('
', $_message['success']), 'message'); return true; @@ -359,17 +373,17 @@ public function installCompiledExtensions() public function installCompiledComponent() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_COMPONENT'); + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_COMPONENT'); // currently only those with admin access can install a component via JCB if($user->authorise('core.manage')) { - $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_COMPONENT'); - $app = JFactory::getApplication(); + $message = Text::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_COMPONENT'); + $app = Factory::getApplication(); $fileName = $app->getUserState('com_componentbuilder.component_folder_name'); // wipe out the user c-m-p since we are done with them all @@ -380,7 +394,7 @@ public function installCompiledComponent() if ($this->installExtension($fileName)) { - $message = JText::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileName); + $message = Text::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileName); $this->setRedirect($redirect_url, $message, 'message'); return true; } @@ -397,17 +411,17 @@ public function installCompiledComponent() public function installCompiledModule() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_MODULE'); + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_MODULE'); // currently only those with admin access can install a molule via JCB if($user->authorise('core.manage')) { - $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_MODULE'); - $app = JFactory::getApplication(); + $message = Text::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_MODULE'); + $app = Factory::getApplication(); $fileNames = $app->getUserState('com_componentbuilder.modules_folder_name'); // wipe out the user c-m-p since we are done with them all @@ -416,13 +430,13 @@ public function installCompiledModule() $app->setUserState('com_componentbuilder.plugins_folder_name', ''); $app->setUserState('com_componentbuilder.success_message', ''); - if (ComponentbuilderHelper::checkArray($fileNames)) + if (UtilitiesArrayHelper::check($fileNames)) { - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $moduleId = $jinput->post->get('install_item_id', 0, 'INT'); if ($moduleId > 0 && isset($fileNames[$moduleId]) && $this->installExtension($fileNames[$moduleId])) { - $message = JText::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileNames[$moduleId]); + $message = Text::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileNames[$moduleId]); $this->setRedirect($redirect_url, $message, 'message'); return true; } @@ -440,17 +454,17 @@ public function installCompiledModule() public function installCompiledPlugin() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_PLUGIN'); + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_PLUGIN'); // currently only those with admin access can install a plugin via JCB if($user->authorise('core.manage')) { - $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_PLUGIN'); - $app = JFactory::getApplication(); + $message = Text::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_PLUGIN'); + $app = Factory::getApplication(); $fileNames = $app->getUserState('com_componentbuilder.plugins_folder_name'); // wipe out the user c-m-p since we are done with them all @@ -459,13 +473,13 @@ public function installCompiledPlugin() $app->setUserState('com_componentbuilder.plugins_folder_name', ''); $app->setUserState('com_componentbuilder.success_message', ''); - if (ComponentbuilderHelper::checkArray($fileNames)) + if (UtilitiesArrayHelper::check($fileNames)) { - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $pluginId = $jinput->post->get('install_item_id', 0, 'INT'); if ($pluginId > 0 && isset($fileNames[$pluginId]) && $this->installExtension($fileNames[$pluginId])) { - $message = JText::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileNames[$pluginId]); + $message = Text::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileNames[$pluginId]); $this->setRedirect($redirect_url, $message, 'message'); return true; } @@ -491,7 +505,7 @@ protected function installExtension($fileName) // set the language if not set if (!isset($this->_installer_lang)) { - $this->_installer_lang = JFactory::getLanguage(); + $this->_installer_lang = Factory::getLanguage(); $extension = 'com_installer'; $base_dir = JPATH_ADMINISTRATOR; $language_tag = 'en-GB'; @@ -499,7 +513,7 @@ protected function installExtension($fileName) $this->_installer_lang->load($extension, $base_dir, $language_tag, $reload); } // make sure we have a string - if (ComponentbuilderHelper::checkString($fileName)) + if (StringHelper::check($fileName)) { return $this->_compiler_model->install($fileName.'.zip'); } @@ -514,29 +528,29 @@ protected function installExtension($fileName) public function runExpansion() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); + $redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); // set massage - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); // check if this user has the right to run expansion if($user->authorise('compiler.run_expansion', 'com_componentbuilder')) { // set massage - $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + $message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); // run expansion via API - $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + $result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand'); // is there a message returned - if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + if (!is_numeric($result) && StringHelper::check($result)) { $this->setRedirect($redirect_url, $result); return true; } elseif (is_numeric($result) && 1 == $result) { - $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); $this->setRedirect($redirect_url, $message, 'message'); return true; } @@ -554,25 +568,25 @@ public function runExpansion() public function clearTmp() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); - $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_CLEAR_THE_TMP_FOLDER'); + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false); + $message = Text::_('COM_COMPONENTBUILDER_COULD_NOT_CLEAR_THE_TMP_FOLDER'); if($user->authorise('compiler.clear_tmp', 'com_componentbuilder') && $user->authorise('core.manage', 'com_componentbuilder')) { // get the model $model = $this->getModel('compiler'); // get tmp folder - $comConfig = JFactory::getConfig(); + $comConfig = Factory::getConfig(); $tmp = $comConfig->get('tmp_path'); if ($model->emptyFolder($tmp)) { - $message = JText::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB'); + $message = Text::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB'); $this->setRedirect($redirect_url, $message, 'message'); // get application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // wipe out the user c-m-p since we are done with them all $app->setUserState('com_componentbuilder.component_folder_name', ''); $app->setUserState('com_componentbuilder.modules_folder_name', ''); @@ -595,22 +609,22 @@ public function clearTmp() public function runTranslator() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false); // set massage - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_TRANSLATOR_MODULE'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_TRANSLATOR_MODULE'); // check if this user has the right to run expansion if($user->authorise('compiler.run_translator', 'com_componentbuilder')) { // set massage - $message = JText::_('COM_COMPONENTBUILDER_TRANSLATION_FAILED_SINCE_THERE_ARE_NO_COMPONENTS_LINKED_WITH_TRANSLATION_TOOLS'); + $message = Text::_('COM_COMPONENTBUILDER_TRANSLATION_FAILED_SINCE_THERE_ARE_NO_COMPONENTS_LINKED_WITH_TRANSLATION_TOOLS'); // run translator via API - $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.translator'); + $result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.translator'); // is there a message returned - if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + if (!is_numeric($result) && StringHelper::check($result)) { $this->setRedirect($redirect_url, $result); return true; diff --git a/admin/controllers/component_admin_views.php b/admin/controllers/component_admin_views.php index a307ce06d..849782168 100644 --- a/admin/controllers/component_admin_views.php +++ b/admin/controllers/component_admin_views.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Component_admin_views Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerComponent_admin_views extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Components_admin_views'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('component_admin_views.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_admin_views.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('component_admin_views.access', 'com_componentbuilder.component_admin_views.' . (int) $recordId) && $user->authorise('component_admin_views.access', 'com_componentbuilder')); + $access = ($user->authorise('component_admin_views.access', 'com_componentbuilder.component_admin_views.' . (int) $recordId) && $user->authorise('component_admin_views.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Component_admin_views', '', array()); + $model = $this->getModel('Component_admin_views', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components_admin_views' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=components_admin_views' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/component_config.php b/admin/controllers/component_config.php index a5a663ab0..b2eda749d 100644 --- a/admin/controllers/component_config.php +++ b/admin/controllers/component_config.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Component_config Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerComponent_config extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Components_config'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('component_config.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_config.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('component_config.access', 'com_componentbuilder.component_config.' . (int) $recordId) && $user->authorise('component_config.access', 'com_componentbuilder')); + $access = ($user->authorise('component_config.access', 'com_componentbuilder.component_config.' . (int) $recordId) && $user->authorise('component_config.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Component_config', '', array()); + $model = $this->getModel('Component_config', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components_config' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=components_config' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/component_custom_admin_menus.php b/admin/controllers/component_custom_admin_menus.php index 164638899..984002456 100644 --- a/admin/controllers/component_custom_admin_menus.php +++ b/admin/controllers/component_custom_admin_menus.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Component_custom_admin_menus Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerComponent_custom_admin_menus extends FormControl * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Components_custom_admin_menus'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('component_custom_admin_menus.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_custom_admin_menus.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('component_custom_admin_menus.access', 'com_componentbuilder.component_custom_admin_menus.' . (int) $recordId) && $user->authorise('component_custom_admin_menus.access', 'com_componentbuilder')); + $access = ($user->authorise('component_custom_admin_menus.access', 'com_componentbuilder.component_custom_admin_menus.' . (int) $recordId) && $user->authorise('component_custom_admin_menus.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Component_custom_admin_menus', '', array()); + $model = $this->getModel('Component_custom_admin_menus', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components_custom_admin_menus' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=components_custom_admin_menus' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/component_custom_admin_views.php b/admin/controllers/component_custom_admin_views.php index 8b9ce4dbc..de68e7781 100644 --- a/admin/controllers/component_custom_admin_views.php +++ b/admin/controllers/component_custom_admin_views.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Component_custom_admin_views Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerComponent_custom_admin_views extends FormControl * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Components_custom_admin_views'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('component_custom_admin_views.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_custom_admin_views.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('component_custom_admin_views.access', 'com_componentbuilder.component_custom_admin_views.' . (int) $recordId) && $user->authorise('component_custom_admin_views.access', 'com_componentbuilder')); + $access = ($user->authorise('component_custom_admin_views.access', 'com_componentbuilder.component_custom_admin_views.' . (int) $recordId) && $user->authorise('component_custom_admin_views.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Component_custom_admin_views', '', array()); + $model = $this->getModel('Component_custom_admin_views', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components_custom_admin_views' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=components_custom_admin_views' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/component_dashboard.php b/admin/controllers/component_dashboard.php index fc3e14dd3..64ad4706b 100644 --- a/admin/controllers/component_dashboard.php +++ b/admin/controllers/component_dashboard.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Component_dashboard Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerComponent_dashboard extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Components_dashboard'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('component_dashboard.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_dashboard.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('component_dashboard.access', 'com_componentbuilder.component_dashboard.' . (int) $recordId) && $user->authorise('component_dashboard.access', 'com_componentbuilder')); + $access = ($user->authorise('component_dashboard.access', 'com_componentbuilder.component_dashboard.' . (int) $recordId) && $user->authorise('component_dashboard.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Component_dashboard', '', array()); + $model = $this->getModel('Component_dashboard', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components_dashboard' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=components_dashboard' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/component_files_folders.php b/admin/controllers/component_files_folders.php index 789b7b030..45aa98fe0 100644 --- a/admin/controllers/component_files_folders.php +++ b/admin/controllers/component_files_folders.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Component_files_folders Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerComponent_files_folders extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Components_files_folders'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('component_files_folders.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_files_folders.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('component_files_folders.access', 'com_componentbuilder.component_files_folders.' . (int) $recordId) && $user->authorise('component_files_folders.access', 'com_componentbuilder')); + $access = ($user->authorise('component_files_folders.access', 'com_componentbuilder.component_files_folders.' . (int) $recordId) && $user->authorise('component_files_folders.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Component_files_folders', '', array()); + $model = $this->getModel('Component_files_folders', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components_files_folders' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=components_files_folders' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/component_modules.php b/admin/controllers/component_modules.php index 3e3778ad5..39c166696 100644 --- a/admin/controllers/component_modules.php +++ b/admin/controllers/component_modules.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Component_modules Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerComponent_modules extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Components_modules'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('component_modules.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_modules.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('component_modules.access', 'com_componentbuilder.component_modules.' . (int) $recordId) && $user->authorise('component_modules.access', 'com_componentbuilder')); + $access = ($user->authorise('component_modules.access', 'com_componentbuilder.component_modules.' . (int) $recordId) && $user->authorise('component_modules.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Component_modules', '', array()); + $model = $this->getModel('Component_modules', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components_modules' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=components_modules' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/component_mysql_tweaks.php b/admin/controllers/component_mysql_tweaks.php index 044bbd989..b15bc8f42 100644 --- a/admin/controllers/component_mysql_tweaks.php +++ b/admin/controllers/component_mysql_tweaks.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Component_mysql_tweaks Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerComponent_mysql_tweaks extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Components_mysql_tweaks'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('component_mysql_tweaks.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_mysql_tweaks.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('component_mysql_tweaks.access', 'com_componentbuilder.component_mysql_tweaks.' . (int) $recordId) && $user->authorise('component_mysql_tweaks.access', 'com_componentbuilder')); + $access = ($user->authorise('component_mysql_tweaks.access', 'com_componentbuilder.component_mysql_tweaks.' . (int) $recordId) && $user->authorise('component_mysql_tweaks.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Component_mysql_tweaks', '', array()); + $model = $this->getModel('Component_mysql_tweaks', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components_mysql_tweaks' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=components_mysql_tweaks' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/component_placeholders.php b/admin/controllers/component_placeholders.php index 846454a46..6b0b6afbf 100644 --- a/admin/controllers/component_placeholders.php +++ b/admin/controllers/component_placeholders.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Component_placeholders Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerComponent_placeholders extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Components_placeholders'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('component_placeholders.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_placeholders.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('component_placeholders.access', 'com_componentbuilder.component_placeholders.' . (int) $recordId) && $user->authorise('component_placeholders.access', 'com_componentbuilder')); + $access = ($user->authorise('component_placeholders.access', 'com_componentbuilder.component_placeholders.' . (int) $recordId) && $user->authorise('component_placeholders.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Component_placeholders', '', array()); + $model = $this->getModel('Component_placeholders', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components_placeholders' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=components_placeholders' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/component_plugins.php b/admin/controllers/component_plugins.php index a886b89e5..90d60dda1 100644 --- a/admin/controllers/component_plugins.php +++ b/admin/controllers/component_plugins.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Component_plugins Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerComponent_plugins extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Components_plugins'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('component_plugins.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_plugins.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('component_plugins.access', 'com_componentbuilder.component_plugins.' . (int) $recordId) && $user->authorise('component_plugins.access', 'com_componentbuilder')); + $access = ($user->authorise('component_plugins.access', 'com_componentbuilder.component_plugins.' . (int) $recordId) && $user->authorise('component_plugins.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Component_plugins', '', array()); + $model = $this->getModel('Component_plugins', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components_plugins' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=components_plugins' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/component_router.php b/admin/controllers/component_router.php new file mode 100644 index 000000000..6598f476c --- /dev/null +++ b/admin/controllers/component_router.php @@ -0,0 +1,329 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; + +/** + * Component_router Form Controller + */ +class ComponentbuilderControllerComponent_router extends FormController +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = []) + { + $this->view_list = 'Components_routers'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = []) + { + // Get user object. + $user = Factory::getUser(); + // Access check. + $access = $user->authorise('component_router.access', 'com_componentbuilder'); + if (!$access) + { + return false; + } + + // In the absence of better information, revert to the component permissions. + return $user->authorise('component_router.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = [], $key = 'id') + { + // get user object. + $user = Factory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('component_router.access', 'com_componentbuilder.component_router.' . (int) $recordId) && $user->authorise('component_router.access', 'com_componentbuilder')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('component_router.edit', 'com_componentbuilder.component_router.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('component_router.edit.own', 'com_componentbuilder.component_router.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('component_router.edit.own', 'com_componentbuilder')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('component_router.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string) $ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Component_router', '', []); + + // Preset the redirect + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=components_routers' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && Uri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + Route::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + Route::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; + + // Redirect to the item screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string) $this->ref; + + // Redirect to the list screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) + { + return; + } +} diff --git a/admin/controllers/component_site_views.php b/admin/controllers/component_site_views.php index 9ad82c56f..8ea494663 100644 --- a/admin/controllers/component_site_views.php +++ b/admin/controllers/component_site_views.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Component_site_views Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerComponent_site_views extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Components_site_views'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('component_site_views.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_site_views.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('component_site_views.access', 'com_componentbuilder.component_site_views.' . (int) $recordId) && $user->authorise('component_site_views.access', 'com_componentbuilder')); + $access = ($user->authorise('component_site_views.access', 'com_componentbuilder.component_site_views.' . (int) $recordId) && $user->authorise('component_site_views.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Component_site_views', '', array()); + $model = $this->getModel('Component_site_views', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components_site_views' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=components_site_views' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/component_updates.php b/admin/controllers/component_updates.php index 56e5bac16..6b6767be7 100644 --- a/admin/controllers/component_updates.php +++ b/admin/controllers/component_updates.php @@ -12,8 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Component_updates Form Controller @@ -36,13 +45,13 @@ class ComponentbuilderControllerComponent_updates extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Components_updates'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +60,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('component_updates.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +71,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_updates.create', $this->option); } @@ -76,16 +85,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('component_updates.access', 'com_componentbuilder.component_updates.' . (int) $recordId) && $user->authorise('component_updates.access', 'com_componentbuilder')); + $access = ($user->authorise('component_updates.access', 'com_componentbuilder.component_updates.' . (int) $recordId) && $user->authorise('component_updates.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +159,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +181,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Component_updates', '', array()); + $model = $this->getModel('Component_updates', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components_updates' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=components_updates' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +212,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +229,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +240,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +266,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +284,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,20 +318,20 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { // update the component version to match the updated last version if (isset($validData['joomla_component']) && is_numeric($validData['joomla_component']) && $validData['joomla_component'] > 0) { // we must load the data (since if changed in the saved method, the $validData will not reflect this change) - if (($version_update = ComponentbuilderHelper::getVar( + if (($version_update = GetHelper::var( 'component_updates', $validData['joomla_component'], 'joomla_component', @@ -330,23 +339,22 @@ protected function postSaveHook(JModelLegacy $model, $validData = array()) { $version_update = json_decode($version_update, true); - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $validData['joomla_component']; - if (ComponentbuilderHelper::checkArray($version_update) + if (UtilitiesArrayHelper::check($version_update) && ($component_version = end($version_update)['version']) - && ComponentbuilderHelper::checkString($component_version)) + && StringHelper::check($component_version)) { $objectUpdate->component_version = $component_version; } // be sure to update the table if we have a value if (isset($objectUpdate->component_version)) { - JFactory::getDbo()->updateObject('#__componentbuilder_joomla_component', $objectUpdate, 'id'); + Factory::getDbo()->updateObject('#__componentbuilder_joomla_component', $objectUpdate, 'id'); } } } return; } - } diff --git a/admin/controllers/componentbuilder.php b/admin/controllers/componentbuilder.php index 9c3e5cc7c..15f0eb8c7 100644 --- a/admin/controllers/componentbuilder.php +++ b/admin/controllers/componentbuilder.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Componentbuilder Admin Controller diff --git a/admin/controllers/components_admin_views.php b/admin/controllers/components_admin_views.php index 528cd5bac..849100b6e 100644 --- a/admin/controllers/components_admin_views.php +++ b/admin/controllers/components_admin_views.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Components_admin_views Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Component_admin_views', $prefix = 'Componentbu { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/components_config.php b/admin/controllers/components_config.php index f2bf7d711..3a60bdb63 100644 --- a/admin/controllers/components_config.php +++ b/admin/controllers/components_config.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Components_config Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Component_config', $prefix = 'Componentbuilder { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/components_custom_admin_menus.php b/admin/controllers/components_custom_admin_menus.php index 57e553128..fc762a335 100644 --- a/admin/controllers/components_custom_admin_menus.php +++ b/admin/controllers/components_custom_admin_menus.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Components_custom_admin_menus Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Component_custom_admin_menus', $prefix = 'Comp { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/components_custom_admin_views.php b/admin/controllers/components_custom_admin_views.php index 67a4a9a94..5930a193e 100644 --- a/admin/controllers/components_custom_admin_views.php +++ b/admin/controllers/components_custom_admin_views.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Components_custom_admin_views Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Component_custom_admin_views', $prefix = 'Comp { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/components_dashboard.php b/admin/controllers/components_dashboard.php index 75706d54b..7fba49bae 100644 --- a/admin/controllers/components_dashboard.php +++ b/admin/controllers/components_dashboard.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Components_dashboard Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Component_dashboard', $prefix = 'Componentbuil { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/components_files_folders.php b/admin/controllers/components_files_folders.php index fd5fcc9a8..ca0d9eaa4 100644 --- a/admin/controllers/components_files_folders.php +++ b/admin/controllers/components_files_folders.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Components_files_folders Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Component_files_folders', $prefix = 'Component { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/components_modules.php b/admin/controllers/components_modules.php index c3af1b5ad..2177bf5cb 100644 --- a/admin/controllers/components_modules.php +++ b/admin/controllers/components_modules.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Components_modules Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Component_modules', $prefix = 'Componentbuilde { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/components_mysql_tweaks.php b/admin/controllers/components_mysql_tweaks.php index 46f072ec9..0b4022c63 100644 --- a/admin/controllers/components_mysql_tweaks.php +++ b/admin/controllers/components_mysql_tweaks.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Components_mysql_tweaks Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Component_mysql_tweaks', $prefix = 'Componentb { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/components_placeholders.php b/admin/controllers/components_placeholders.php index 4ae57667e..e795ec55e 100644 --- a/admin/controllers/components_placeholders.php +++ b/admin/controllers/components_placeholders.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Components_placeholders Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Component_placeholders', $prefix = 'Componentb { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/components_plugins.php b/admin/controllers/components_plugins.php index 60466495d..5374ba57c 100644 --- a/admin/controllers/components_plugins.php +++ b/admin/controllers/components_plugins.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Components_plugins Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Component_plugins', $prefix = 'Componentbuilde { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/components_routers.php b/admin/controllers/components_routers.php new file mode 100644 index 000000000..8dc0a851b --- /dev/null +++ b/admin/controllers/components_routers.php @@ -0,0 +1,50 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\MVC\Controller\AdminController; +use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; + +/** + * Components_routers Admin Controller + */ +class ComponentbuilderControllerComponents_routers extends AdminController +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_ROUTERS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Component_router', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } +} \ No newline at end of file diff --git a/admin/controllers/components_site_views.php b/admin/controllers/components_site_views.php index 4a9a261dd..3b49a8a52 100644 --- a/admin/controllers/components_site_views.php +++ b/admin/controllers/components_site_views.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Components_site_views Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Component_site_views', $prefix = 'Componentbui { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/components_updates.php b/admin/controllers/components_updates.php index b5f943943..a48749ac1 100644 --- a/admin/controllers/components_updates.php +++ b/admin/controllers/components_updates.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Components_updates Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Component_updates', $prefix = 'Componentbuilde { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/custom_admin_view.php b/admin/controllers/custom_admin_view.php index f3bbcf437..8eea4f9d8 100644 --- a/admin/controllers/custom_admin_view.php +++ b/admin/controllers/custom_admin_view.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Custom_admin_view Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerCustom_admin_view extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Custom_admin_views'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('custom_admin_view.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return parent::allowAdd($data); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('custom_admin_view.access', 'com_componentbuilder.custom_admin_view.' . (int) $recordId) && $user->authorise('custom_admin_view.access', 'com_componentbuilder')); + $access = ($user->authorise('custom_admin_view.access', 'com_componentbuilder.custom_admin_view.' . (int) $recordId) && $user->authorise('custom_admin_view.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Custom_admin_view', '', array()); + $model = $this->getModel('Custom_admin_view', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=custom_admin_views' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=custom_admin_views' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/custom_admin_views.php b/admin/controllers/custom_admin_views.php index a769073de..d0cbb28d7 100644 --- a/admin/controllers/custom_admin_views.php +++ b/admin/controllers/custom_admin_views.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Custom_admin_views Admin Controller @@ -47,13 +53,13 @@ public function getModel($name = 'Custom_admin_view', $prefix = 'Componentbuilde public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('custom_admin_view.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +67,16 @@ public function exportData() $model = $this->getModel('Custom_admin_views'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Custom_admin_views_'.$date->format('jS_F_Y'),'Custom admin views exported ('.$date->format('jS F, Y').')','custom admin views'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=custom_admin_views', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=custom_admin_views', false), $message, 'error'); return; } @@ -78,41 +84,41 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('custom_admin_view.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Custom_admin_views'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('custom_admin_view_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'custom_admin_views'); $session->set('dataType_VDM_IMPORTINTO', 'custom_admin_view'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CUSTOM_ADMIN_VIEWS'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CUSTOM_ADMIN_VIEWS'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=custom_admin_views', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=custom_admin_views', false), $message, 'error'); return; } public function getSnippets() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the import snippets custom admin view - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=get_snippets', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=get_snippets', false)); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/custom_code.php b/admin/controllers/custom_code.php index 42b5ebdbd..e36a7b905 100644 --- a/admin/controllers/custom_code.php +++ b/admin/controllers/custom_code.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Custom_code Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerCustom_code extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Custom_codes'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('custom_code.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('custom_code.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('custom_code.access', 'com_componentbuilder.custom_code.' . (int) $recordId) && $user->authorise('custom_code.access', 'com_componentbuilder')); + $access = ($user->authorise('custom_code.access', 'com_componentbuilder.custom_code.' . (int) $recordId) && $user->authorise('custom_code.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Custom_code', '', array()); + $model = $this->getModel('Custom_code', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=custom_codes' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=custom_codes' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/custom_codes.php b/admin/controllers/custom_codes.php index ef3d179cc..efa3af237 100644 --- a/admin/controllers/custom_codes.php +++ b/admin/controllers/custom_codes.php @@ -12,8 +12,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Custom_codes Admin Controller @@ -47,13 +54,13 @@ public function getModel($name = 'Custom_code', $prefix = 'ComponentbuilderModel public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('custom_code.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +68,16 @@ public function exportData() $model = $this->getModel('Custom_codes'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Custom_codes_'.$date->format('jS_F_Y'),'Custom codes exported ('.$date->format('jS F, Y').')','custom codes'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=custom_codes', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=custom_codes', false), $message, 'error'); return; } @@ -78,32 +85,32 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('custom_code.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Custom_codes'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('custom_code_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'custom_codes'); $session->set('dataType_VDM_IMPORTINTO', 'custom_code'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CUSTOM_CODES'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CUSTOM_CODES'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=custom_codes', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=custom_codes', false), $message, 'error'); return; } @@ -116,29 +123,29 @@ public function importData() public function runExpansion() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=custom_codes', false); + $redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=custom_codes', false); // set massage - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); // check if this user has the right to run expansion if($user->authorise('custom_codes.run_expansion', 'com_componentbuilder')) { // set massage - $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + $message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); // run expansion via API - $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + $result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand'); // is there a message returned - if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + if (!is_numeric($result) && StringHelper::check($result)) { $this->setRedirect($redirect_url, $result); return true; } elseif (is_numeric($result) && 1 == $result) { - $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); $this->setRedirect($redirect_url, $message, 'message'); return true; } @@ -147,4 +154,4 @@ public function runExpansion() return false; } -} +} \ No newline at end of file diff --git a/admin/controllers/dynamic_get.php b/admin/controllers/dynamic_get.php index a1d95ea86..2588bf32a 100644 --- a/admin/controllers/dynamic_get.php +++ b/admin/controllers/dynamic_get.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Dynamic_get Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerDynamic_get extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Dynamic_gets'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('dynamic_get.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('dynamic_get.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('dynamic_get.access', 'com_componentbuilder.dynamic_get.' . (int) $recordId) && $user->authorise('dynamic_get.access', 'com_componentbuilder')); + $access = ($user->authorise('dynamic_get.access', 'com_componentbuilder.dynamic_get.' . (int) $recordId) && $user->authorise('dynamic_get.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Dynamic_get', '', array()); + $model = $this->getModel('Dynamic_get', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=dynamic_gets' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=dynamic_gets' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/dynamic_gets.php b/admin/controllers/dynamic_gets.php index 3f5aa3de2..8c49894be 100644 --- a/admin/controllers/dynamic_gets.php +++ b/admin/controllers/dynamic_gets.php @@ -12,8 +12,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Dynamic_gets Admin Controller @@ -47,13 +54,13 @@ public function getModel($name = 'Dynamic_get', $prefix = 'ComponentbuilderModel public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('dynamic_get.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +68,16 @@ public function exportData() $model = $this->getModel('Dynamic_gets'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Dynamic_gets_'.$date->format('jS_F_Y'),'Dynamic gets exported ('.$date->format('jS F, Y').')','dynamic gets'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=dynamic_gets', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=dynamic_gets', false), $message, 'error'); return; } @@ -78,32 +85,32 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('dynamic_get.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Dynamic_gets'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('dynamic_get_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'dynamic_gets'); $session->set('dataType_VDM_IMPORTINTO', 'dynamic_get'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_DYNAMIC_GETS'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_DYNAMIC_GETS'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=dynamic_gets', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=dynamic_gets', false), $message, 'error'); return; } @@ -116,29 +123,29 @@ public function importData() public function runExpansion() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=dynamic_gets', false); + $redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=dynamic_gets', false); // set massage - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); // check if this user has the right to run expansion if($user->authorise('dynamic_gets.run_expansion', 'com_componentbuilder')) { // set massage - $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + $message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); // run expansion via API - $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + $result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand'); // is there a message returned - if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + if (!is_numeric($result) && StringHelper::check($result)) { $this->setRedirect($redirect_url, $result); return true; } elseif (is_numeric($result) && 1 == $result) { - $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); $this->setRedirect($redirect_url, $message, 'message'); return true; } @@ -147,4 +154,4 @@ public function runExpansion() return false; } -} +} \ No newline at end of file diff --git a/admin/controllers/field.php b/admin/controllers/field.php index 0200cf68b..29ddf3f36 100644 --- a/admin/controllers/field.php +++ b/admin/controllers/field.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Field Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerField extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Fields'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('field.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('field.create', $this->option); } @@ -76,9 +82,9 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -149,12 +155,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -171,13 +177,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Field', '', array()); + $model = $this->getModel('Field', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=fields' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=fields' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -202,13 +208,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -219,7 +225,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -230,7 +236,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -256,7 +262,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -274,29 +280,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -308,16 +314,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/fields.php b/admin/controllers/fields.php index 98ea949a2..acaa65876 100644 --- a/admin/controllers/fields.php +++ b/admin/controllers/fields.php @@ -12,8 +12,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Fields Admin Controller @@ -47,13 +54,13 @@ public function getModel($name = 'Field', $prefix = 'ComponentbuilderModel', $co public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('field.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +68,16 @@ public function exportData() $model = $this->getModel('Fields'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Fields_'.$date->format('jS_F_Y'),'Fields exported ('.$date->format('jS F, Y').')','fields'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=fields', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=fields', false), $message, 'error'); return; } @@ -78,32 +85,32 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('field.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Fields'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('field_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'fields'); $session->set('dataType_VDM_IMPORTINTO', 'field'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_FIELDS'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_FIELDS'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=fields', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=fields', false), $message, 'error'); return; } @@ -116,29 +123,29 @@ public function importData() public function runExpansion() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=fields', false); + $redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=fields', false); // set massage - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); // check if this user has the right to run expansion if($user->authorise('fields.run_expansion', 'com_componentbuilder')) { // set massage - $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + $message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); // run expansion via API - $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + $result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand'); // is there a message returned - if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + if (!is_numeric($result) && StringHelper::check($result)) { $this->setRedirect($redirect_url, $result); return true; } elseif (is_numeric($result) && 1 == $result) { - $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); $this->setRedirect($redirect_url, $message, 'message'); return true; } @@ -147,4 +154,4 @@ public function runExpansion() return false; } -} +} \ No newline at end of file diff --git a/admin/controllers/fieldtype.php b/admin/controllers/fieldtype.php index 96933d9e0..8823ffe89 100644 --- a/admin/controllers/fieldtype.php +++ b/admin/controllers/fieldtype.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Fieldtype Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerFieldtype extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Fieldtypes'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('fieldtype.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('fieldtype.create', $this->option); } @@ -76,9 +82,9 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -149,12 +155,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -171,13 +177,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Fieldtype', '', array()); + $model = $this->getModel('Fieldtype', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=fieldtypes' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=fieldtypes' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -202,13 +208,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -219,7 +225,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -230,7 +236,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -256,7 +262,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -274,29 +280,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -308,16 +314,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/fieldtypes.php b/admin/controllers/fieldtypes.php index dfbd81027..aa23f161b 100644 --- a/admin/controllers/fieldtypes.php +++ b/admin/controllers/fieldtypes.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Fieldtypes Admin Controller @@ -47,13 +53,13 @@ public function getModel($name = 'Fieldtype', $prefix = 'ComponentbuilderModel', public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('fieldtype.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +67,16 @@ public function exportData() $model = $this->getModel('Fieldtypes'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Fieldtypes_'.$date->format('jS_F_Y'),'Fieldtypes exported ('.$date->format('jS F, Y').')','fieldtypes'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=fieldtypes', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false), $message, 'error'); return; } @@ -78,32 +84,32 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('fieldtype.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Fieldtypes'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('fieldtype_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'fieldtypes'); $session->set('dataType_VDM_IMPORTINTO', 'fieldtype'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_FIELDTYPES'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_FIELDTYPES'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=fieldtypes', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/get_snippets.php b/admin/controllers/get_snippets.php index 3761e39e9..ef8c41611 100644 --- a/admin/controllers/get_snippets.php +++ b/admin/controllers/get_snippets.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Get_snippets Admin Controller @@ -30,9 +34,9 @@ class ComponentbuilderControllerGet_snippets extends AdminController /** * Proxy for getModel. - * @since 2.5 + * @since 2.5 */ - public function getModel($name = 'Get_snippets', $prefix = 'ComponentbuilderModel', $config = array()) + public function getModel($name = 'Get_snippets', $prefix = 'ComponentbuilderModel', $config = []) { $model = parent::getModel($name, $prefix, array('ignore_request' => true)); @@ -41,61 +45,61 @@ public function getModel($name = 'Get_snippets', $prefix = 'ComponentbuilderMode public function dashboard() { - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder', false)); return; } public function openLibraries() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the libraries - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=libraries', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=libraries', false)); return; } public function openSnippets() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the snippets - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=snippets', false)); return; } public function openSiteViews() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the site views - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=site_views', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=site_views', false)); return; } public function openCustomAdminViews() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the custom admin views - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=custom_admin_views', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=custom_admin_views', false)); return; } public function openTemplates() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the templates - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=templates', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=templates', false)); return; } public function openLayouts() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the layouts - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=layouts', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=layouts', false)); return; } } diff --git a/admin/controllers/help.php b/admin/controllers/help.php index c917da3fa..185ce0acd 100644 --- a/admin/controllers/help.php +++ b/admin/controllers/help.php @@ -12,7 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Session\Session; use Joomla\Utilities\ArrayHelper; /** @@ -29,12 +32,12 @@ public function __construct($config) public function help() { - $user = JFactory::getUser(); - $jinput = JFactory::getApplication()->input; + $user = Factory::getUser(); + $jinput = Factory::getApplication()->input; // Check Token! - $token = JSession::getFormToken(); - $call_token = $jinput->get('token', 0, 'ALNUM'); - if($user->id != 0 && $token == $call_token) + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); + if($user->id != 0 && ($jinput->get($token, 0, 'ALNUM') || $token === $call_token)) { $task = $this->getTask(); switch($task){ @@ -62,7 +65,7 @@ public function help() break; } } - else + else { // stop execution gracefully jexit(); @@ -71,8 +74,8 @@ public function help() protected function getHelpDocumentText($id) { - $db = JFactory::getDbo(); - $query = $db->getQuery(true); + $db = Factory::getDbo(); + $query = $db->getQuery(true); $query->select(array('a.title','a.content')); $query->from('#__componentbuilder_help_document AS a'); $query->where('a.id = '.(int) $id); @@ -81,21 +84,21 @@ protected function getHelpDocumentText($id) $db->execute(); if($db->getNumRows()) { - $text = array(); + $text = []; $document = $db->loadObject(); // fix image issue - $images['src="images'] = 'src="'.JURI::root().'images'; - $images["src='images"] = "src='".JURI::root()."images"; - $images['src="/images'] = 'src="'.JURI::root().'images'; - $images["src='/images"] = "src='".JURI::root()."images"; + $images['src="images'] = 'src="'.Uri::root().'images'; + $images["src='images"] = "src='".Uri::root()."images"; + $images['src="/images'] = 'src="'.Uri::root().'images'; + $images["src='/images"] = "src='".Uri::root()."images"; // set document template $text[] = ""; $text[] = ''; $text[] = ""; $text[] = ''; $text[] = "".$document->title.""; - $text[] = ''; - $text[] = ''; + $text[] = ''; + $text[] = ''; $text[] = ""; $text[] = '
'; $text[] = '
'; diff --git a/admin/controllers/help_document.php b/admin/controllers/help_document.php index 8c08eb2f8..c9d1c5f29 100644 --- a/admin/controllers/help_document.php +++ b/admin/controllers/help_document.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Help_document Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerHelp_document extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Help_documents'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('help_document.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('help_document.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('help_document.access', 'com_componentbuilder.help_document.' . (int) $recordId) && $user->authorise('help_document.access', 'com_componentbuilder')); + $access = ($user->authorise('help_document.access', 'com_componentbuilder.help_document.' . (int) $recordId) && $user->authorise('help_document.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Help_document', '', array()); + $model = $this->getModel('Help_document', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=help_documents' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=help_documents' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/help_documents.php b/admin/controllers/help_documents.php index c59089bcf..8d4157993 100644 --- a/admin/controllers/help_documents.php +++ b/admin/controllers/help_documents.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Help_documents Admin Controller @@ -47,13 +53,13 @@ public function getModel($name = 'Help_document', $prefix = 'ComponentbuilderMod public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('help_document.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +67,16 @@ public function exportData() $model = $this->getModel('Help_documents'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Help_documents_'.$date->format('jS_F_Y'),'Help documents exported ('.$date->format('jS F, Y').')','help documents'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=help_documents', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=help_documents', false), $message, 'error'); return; } @@ -78,32 +84,32 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('help_document.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Help_documents'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('help_document_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'help_documents'); $session->set('dataType_VDM_IMPORTINTO', 'help_document'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_HELP_DOCUMENTS'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_HELP_DOCUMENTS'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=help_documents', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=help_documents', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/import.php b/admin/controllers/import.php index 61cf94794..537e57eca 100644 --- a/admin/controllers/import.php +++ b/admin/controllers/import.php @@ -12,7 +12,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; use Joomla\Utilities\ArrayHelper; /** @@ -28,21 +32,21 @@ class ComponentbuilderControllerImport extends BaseController public function import() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $model = $this->getModel('import'); if ($model->import()) { - $cache = JFactory::getCache('mod_menu'); + $cache = Factory::getCache('mod_menu'); $cache->clean(); // TODO: Reset the users acl here as well to kill off any missing bits } - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $redirect_url = $app->getUserState('com_componentbuilder.redirect_url'); if (empty($redirect_url)) { - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=import', false); + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=import', false); } else { diff --git a/admin/controllers/import_joomla_components.php b/admin/controllers/import_joomla_components.php index 5f16168ab..cde528a4d 100644 --- a/admin/controllers/import_joomla_components.php +++ b/admin/controllers/import_joomla_components.php @@ -12,8 +12,13 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory; /** * Componentbuilder Import_joomla_components Base Controller @@ -28,21 +33,21 @@ class ComponentbuilderControllerImport_joomla_components extends BaseController public function import() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $model = $this->getModel('Import_joomla_components'); if ($model->import()) { - $cache = JFactory::getCache('mod_menu'); + $cache = Factory::getCache('mod_menu'); $cache->clean(); // TODO: Reset the users acl here as well to kill off any missing bits } - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $redirect_url = $app->getUserState('com_componentbuilder.redirect_url'); if (empty($redirect_url)) { - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components', false); + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=import_joomla_components', false); } else { diff --git a/admin/controllers/import_language_translations.php b/admin/controllers/import_language_translations.php index b01381ec9..c907d8efe 100644 --- a/admin/controllers/import_language_translations.php +++ b/admin/controllers/import_language_translations.php @@ -12,7 +12,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; use Joomla\Utilities\ArrayHelper; /** @@ -28,21 +32,21 @@ class ComponentbuilderControllerImport_language_translations extends BaseControl public function import() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $model = $this->getModel('Import_language_translations'); if ($model->import()) { - $cache = JFactory::getCache('mod_menu'); + $cache = Factory::getCache('mod_menu'); $cache->clean(); // TODO: Reset the users acl here as well to kill off any missing bits } - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $redirect_url = $app->getUserState('com_componentbuilder.redirect_url'); if (empty($redirect_url)) { - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=import_language_translations', false); + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=import_language_translations', false); } else { diff --git a/admin/controllers/joomla_component.php b/admin/controllers/joomla_component.php index 0e4eece42..6283588d9 100644 --- a/admin/controllers/joomla_component.php +++ b/admin/controllers/joomla_component.php @@ -12,8 +12,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use VDM\Joomla\Utilities\GetHelper; /** * Joomla_component Form Controller @@ -36,7 +43,7 @@ class ComponentbuilderControllerJoomla_component extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Joomla_components'; // safeguard for setting the return view listing to the main view. parent::__construct($config); @@ -45,29 +52,29 @@ public function __construct($config = array()) public function refresh() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('joomla_component.import_jcb_packages', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { - $session = JFactory::getSession(); + $session = Factory::getSession(); $session->set('backto_VDM_IMPORT', 'joomla_components'); $session->set('dataType_VDM_IMPORTINTO', 'smart_package'); // clear the session ComponentbuilderHelper::set('vdmGithubPackages', null); ComponentbuilderHelper::set('communityGithubPackages', null); // 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'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components&target=smartPackage', false), $message); + $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(Route::_('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'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); return; } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -76,10 +83,10 @@ public function refresh() * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('joomla_component.access', 'com_componentbuilder'); if (!$access) @@ -87,7 +94,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('joomla_component.create', $this->option); } @@ -101,16 +108,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $recordId) && $user->authorise('joomla_component.access', 'com_componentbuilder')); + $access = ($user->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $recordId) && $user->authorise('joomla_component.access', 'com_componentbuilder')); if (!$access) { return false; @@ -175,12 +182,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -197,13 +204,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Joomla_component', '', array()); + $model = $this->getModel('Joomla_component', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -228,13 +235,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -245,7 +252,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -256,7 +263,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -282,7 +289,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -300,29 +307,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -334,14 +341,14 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { // get the state object (Joomla\CMS\Object\CMSObject) $state = $model->get('state'); @@ -364,12 +371,13 @@ protected function postSaveHook(JModelLegacy $model, $validData = array()) 'component_dashboard' => 'joomla_component', 'component_files_folders' => 'joomla_component', 'component_placeholders' => 'joomla_component', - 'custom_code' => 'component' + 'custom_code' => 'component', + 'component_router' => 'joomla_component' ); foreach($_tablesArray as $_updateTable => $_key) { // get the linked ID - if ($_value = ComponentbuilderHelper::getVar($_updateTable, $oldID, $_key, 'id')) + if ($_value = GetHelper::var($_updateTable, $oldID, $_key, 'id')) { // copy fields to new linked table ComponentbuilderHelper::copyItem(/*id->*/ $_value, /*table->*/ $_updateTable, /*change->*/ array($_key => $newID)); @@ -379,5 +387,4 @@ protected function postSaveHook(JModelLegacy $model, $validData = array()) return; } - } diff --git a/admin/controllers/joomla_components.php b/admin/controllers/joomla_components.php index d61a78569..42091f0b5 100644 --- a/admin/controllers/joomla_components.php +++ b/admin/controllers/joomla_components.php @@ -12,8 +12,16 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Joomla_components Admin Controller @@ -47,13 +55,13 @@ public function getModel($name = 'Joomla_component', $prefix = 'Componentbuilder public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('joomla_component.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +69,16 @@ public function exportData() $model = $this->getModel('Joomla_components'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Joomla_components_'.$date->format('jS_F_Y'),'Joomla components exported ('.$date->format('jS F, Y').')','joomla components'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); return; } @@ -78,32 +86,32 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('joomla_component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Joomla_components'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('joomla_component_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'joomla_components'); $session->set('dataType_VDM_IMPORTINTO', 'joomla_component'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_JOOMLA_COMPONENTS'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_JOOMLA_COMPONENTS'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import_joomla_components', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); return; } @@ -116,29 +124,29 @@ public function importData() public function runExpansion() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false); + $redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false); // set massage - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); // check if this user has the right to run expansion if($user->authorise('joomla_components.run_expansion', 'com_componentbuilder')) { // set massage - $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + $message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); // run expansion via API - $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + $result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand'); // is there a message returned - if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + if (!is_numeric($result) && StringHelper::check($result)) { $this->setRedirect($redirect_url, $result); return true; } elseif (is_numeric($result) && 1 == $result) { - $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); $this->setRedirect($redirect_url, $message, 'message'); return true; } @@ -156,25 +164,25 @@ public function runExpansion() public function clearTmp() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false); - $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_CLEAR_THE_TMP_FOLDER'); + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_components', false); + $message = Text::_('COM_COMPONENTBUILDER_COULD_NOT_CLEAR_THE_TMP_FOLDER'); if($user->authorise('joomla_components.clear_tmp', 'com_componentbuilder') && $user->authorise('core.manage', 'com_componentbuilder')) { // get the model $model = $this->getModel('compiler'); // get tmp folder - $comConfig = JFactory::getConfig(); + $comConfig = Factory::getConfig(); $tmp = $comConfig->get('tmp_path'); if ($model->emptyFolder($tmp)) { - $message = JText::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB'); + $message = Text::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB'); $this->setRedirect($redirect_url, $message, 'message'); // get application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // wipe out the user c-m-p since we are done with them all $app->setUserState('com_componentbuilder.component_folder_name', ''); $app->setUserState('com_componentbuilder.modules_folder_name', ''); @@ -191,44 +199,44 @@ public function clearTmp() public function smartImport() { // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('joomla_component.import_jcb_packages', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { - $session = JFactory::getSession(); + $session = Factory::getSession(); $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'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components&target=smartPackage', false), $message); + $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(Route::_('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'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); return; } public function smartExport() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // Get the model $model = $this->getModel('Joomla_components'); // check if export is allowed for this user. - $model->user = JFactory::getUser(); + $model->user = Factory::getUser(); if ($model->user->authorise('joomla_component.export_jcb_packages', 'com_componentbuilder') && $model->user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - JArrayHelper::toInteger($pks); + ArrayHelper::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'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_NO_COMPONENTS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); return; } // set auto loader @@ -237,61 +245,62 @@ public function smartExport() 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 = '

' . JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $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') . ''; + $keyNotice = '

' . Text::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '

'; + $keyNotice .= '

' . Text::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_TWO_HUNDRED_AND_FIFTY_SIX_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY') . '

'; + // 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 = '

' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') . '

'; - $ownerDetails .= '

' . 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') . '

'; - $ownerDetails .= '

' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS') . '

'; - $ownerDetails .= '

' . 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') . '

'; + $ownerDetails = '

' . Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') . '

'; + $ownerDetails .= '

' . 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') . '

'; + $ownerDetails .= '

' . Text::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS') . '

'; + $ownerDetails .= '

' . 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') . '

'; } } else { - $keyNotice = '

' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') . '

'; - $ownerDetails = '

' . 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') . '

'; + $keyNotice = '

' . Text::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') . '

'; + $ownerDetails = '

' . 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') . '

'; } // Redirect to the list screen with success. $message = array(); - $message[] = '

' . JText::_('COM_COMPONENTBUILDER_EXPORT_COMPLETED') . '

'; - $message[] = '

' . JText::sprintf('COM_COMPONENTBUILDER_PATH_TO_THE_ZIPPED_PACKAGE_IS_CODESCODE_BR_S_S', $model->zipPath, $keyNotice, $ownerDetails) . '

'; - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), implode('', $message), 'Success'); + $message[] = '

' . Text::_('COM_COMPONENTBUILDER_EXPORT_COMPLETED') . '

'; + $message[] = '

' . Text::sprintf('COM_COMPONENTBUILDER_PATH_TO_THE_ZIPPED_PACKAGE_IS_CODESCODE_BR_S_S', $model->zipPath, $keyNotice, $ownerDetails) . '

'; + $this->setRedirect(Route::_('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); + File::delete($model->zipPath); } } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED_PLEASE_TRY_AGAIN_LATTER'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED_PLEASE_TRY_AGAIN_LATTER'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); return; } public function backup() { // get params first - if (!isset($this->params) || !ComponentbuilderHelper::checkObject($this->params)) + if (!isset($this->params) || !ObjectHelper::check($this->params)) { - $this->params = JComponentHelper::getParams('com_componentbuilder'); + $this->params = ComponentHelper::getParams('com_componentbuilder'); } // Get the model $model = componentbuilderHelper::getModel('joomla_components', JPATH_ADMINISTRATOR . '/components/com_componentbuilder'); @@ -307,83 +316,83 @@ public function backup() // set auto loader ComponentbuilderHelper::autoLoader('smart'); // manual backup message - $backupNotice = array(); + $backupNotice = []; // get the data to export - if (ComponentbuilderHelper::checkArray($pks) && $model->getSmartExport($pks)) + if (UtilitiesArrayHelper::check($pks) && $model->getSmartExport($pks)) { - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_BACKUP_WAS_DONE_SUCCESSFULLY'); + $backupNotice[] = Text::_('COM_COMPONENTBUILDER_BACKUP_WAS_DONE_SUCCESSFULLY'); $backupNoticeStatus = 'Success'; // set the key string - if (componentbuilderHelper::checkString($model->key) && strlen($model->key) == 32) + if (StringHelper::check($model->key) && strlen($model->key) == 32) { $textNotice = array(); - $keyNotice = '

' . JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '

'; - $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') . '
'; + $keyNotice = '

' . Text::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '

'; + $keyNotice .= '

' . Text::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_TWO_HUNDRED_AND_FIFTY_SIX_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY') . '

'; + $textNotice[] = Text::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S', $model->key); // 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']))) + if ((isset($model->info['getKeyFrom']['company']) && StringHelper::check($model->info['getKeyFrom']['company'])) || (isset($model->info['getKeyFrom']['owner']) && StringHelper::check($model->info['getKeyFrom']['owner']))) { - $ownerDetails = '

' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') . '

'; - $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS'); + $ownerDetails = '

' . Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') . '

'; + $textNotice[] = '# ' . Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS'); $ownerDetails .= '
    '; - if (isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company'])) + if (isset($model->info['getKeyFrom']['company']) && StringHelper::check($model->info['getKeyFrom']['company'])) { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMCOMPANYEM_BSB', $model->info['getKeyFrom']['company']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_COMPANY_S', $model->info['getKeyFrom']['company']); + $ownerDetails .= '
  • ' . Text::sprintf('COM_COMPONENTBUILDER_EMCOMPANYEM_BSB', $model->info['getKeyFrom']['company']) . '
  • '; + $textNotice[] = '- ' . Text::sprintf('COM_COMPONENTBUILDER_COMPANY_S', $model->info['getKeyFrom']['company']); } // add value only if set - if (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner'])) + if (isset($model->info['getKeyFrom']['owner']) && StringHelper::check($model->info['getKeyFrom']['owner'])) { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMOWNEREM_BSB', $model->info['getKeyFrom']['owner']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_OWNER_S', $model->info['getKeyFrom']['owner']); + $ownerDetails .= '
  • ' . Text::sprintf('COM_COMPONENTBUILDER_EMOWNEREM_BSB', $model->info['getKeyFrom']['owner']) . '
  • '; + $textNotice[] = '- ' . Text::sprintf('COM_COMPONENTBUILDER_OWNER_S', $model->info['getKeyFrom']['owner']); } // add value only if set - if (isset($model->info['getKeyFrom']['website']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['website'])) + if (isset($model->info['getKeyFrom']['website']) && StringHelper::check($model->info['getKeyFrom']['website'])) { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $model->info['getKeyFrom']['website']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_WEBSITE_S', $model->info['getKeyFrom']['website']); + $ownerDetails .= '
  • ' . Text::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $model->info['getKeyFrom']['website']) . '
  • '; + $textNotice[] = '- ' . Text::sprintf('COM_COMPONENTBUILDER_WEBSITE_S', $model->info['getKeyFrom']['website']); } // add value only if set - if (isset($model->info['getKeyFrom']['email']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['email'])) + if (isset($model->info['getKeyFrom']['email']) && StringHelper::check($model->info['getKeyFrom']['email'])) { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $model->info['getKeyFrom']['email']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_EMAIL_S', $model->info['getKeyFrom']['email']); + $ownerDetails .= '
  • ' . Text::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $model->info['getKeyFrom']['email']) . '
  • '; + $textNotice[] = '- ' . Text::sprintf('COM_COMPONENTBUILDER_EMAIL_S', $model->info['getKeyFrom']['email']); } // add value only if set - if (isset($model->info['getKeyFrom']['license']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['license'])) + if (isset($model->info['getKeyFrom']['license']) && StringHelper::check($model->info['getKeyFrom']['license'])) { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMLICENSEEM_BSB', $model->info['getKeyFrom']['license']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_LICENSE_S', $model->info['getKeyFrom']['license']); + $ownerDetails .= '
  • ' . Text::sprintf('COM_COMPONENTBUILDER_EMLICENSEEM_BSB', $model->info['getKeyFrom']['license']) . '
  • '; + $textNotice[] = '- ' . Text::sprintf('COM_COMPONENTBUILDER_LICENSE_S', $model->info['getKeyFrom']['license']); } // add value only if set - if (isset($model->info['getKeyFrom']['copyright']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['copyright'])) + if (isset($model->info['getKeyFrom']['copyright']) && StringHelper::check($model->info['getKeyFrom']['copyright'])) { - $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB', $model->info['getKeyFrom']['copyright']) . '
  • '; - $textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_COPYRIGHT_S', $model->info['getKeyFrom']['copyright']); + $ownerDetails .= '
  • ' . Text::sprintf('COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB', $model->info['getKeyFrom']['copyright']) . '
  • '; + $textNotice[] = '- ' . Text::sprintf('COM_COMPONENTBUILDER_COPYRIGHT_S', $model->info['getKeyFrom']['copyright']); } $ownerDetails .= '
'; - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET'); + $backupNotice[] = Text::_('COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET'); } else { - $ownerDetails = '

' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') . '

'; - $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS'); - $ownerDetails .= 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') . '
'; - $textNotice[] = JText::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE'); - $ownerDetails .= '

' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS') . '

'; - $textNotice[] = '## ' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS'); - $ownerDetails .= 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') . '
'; - $textNotice[] = JText::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_IMPORT_PROCESS_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_DOES_NOT_HAVE_THE_KEY_THEY_CAN_SEE_WHERE_TO_GET_IT'); - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_CHECK_YOUR_OWNER_DETAILS_IT_HAS_NOT_BEEN_SET_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE'); + $ownerDetails = '

' . Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') . '

'; + $textNotice[] = '# ' . Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS'); + $ownerDetails .= 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') . '
'; + $textNotice[] = Text::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE'); + $ownerDetails .= '

' . Text::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS') . '

'; + $textNotice[] = '## ' . Text::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS'); + $ownerDetails .= 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') . '
'; + $textNotice[] = Text::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_IMPORT_PROCESS_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_DOES_NOT_HAVE_THE_KEY_THEY_CAN_SEE_WHERE_TO_GET_IT'); + $backupNotice[] = Text::_('COM_COMPONENTBUILDER_CHECK_YOUR_OWNER_DETAILS_IT_HAS_NOT_BEEN_SET_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE'); } } else { - $keyNotice = '

' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') . '

'; - $textNotice[] = '# ' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY'); - $ownerDetails = 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') . '
'; - $textNotice[] = 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_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY'); - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY'); + $keyNotice = '

' . Text::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') . '

'; + $textNotice[] = '# ' . Text::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY'); + $ownerDetails = 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') . '
'; + $textNotice[] = 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_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY'); + $backupNotice[] = Text::_('COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY'); } // get email if ($email = $this->params->get('backup_email', null)) @@ -397,30 +406,30 @@ public function backup() // Build final massage. $message = $keyNotice . $ownerDetails . '
HASH: ' . $hashTracker . ''; // set the subject - $subject = JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY'); + $subject = Text::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY'); // email the message componentbuilderEmail::send($email, $subject, componentbuilderEmail::setTableBody($message, $subject), $plainText, 1); - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SENT'); + $backupNotice[] = Text::_('COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SENT'); } else { - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_KEY_HAS_NOT_CHANGED'); + $backupNotice[] = Text::_('COM_COMPONENTBUILDER_KEY_HAS_NOT_CHANGED'); } } } else { - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_BACKUP_FAILED_PLEASE_TRY_AGAIN_IF_THE_ERROR_CONTINUE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR'); + $backupNotice[] = Text::_('COM_COMPONENTBUILDER_BACKUP_FAILED_PLEASE_TRY_AGAIN_IF_THE_ERROR_CONTINUE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR'); $backupNoticeStatus = 'Error'; - 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); + File::delete($model->zipPath); } } // quite only if auto backup (adding this script from custom code :) @@ -428,53 +437,53 @@ public function backup() { echo "# " . $backupNoticeStatus . "\n" .implode("\n", $backupNotice); // clear session - JFactory::getApplication()->getSession()->destroy(); + Factory::getApplication()->getSession()->destroy(); jexit(); } - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), implode("
", $backupNotice), $backupNoticeStatus); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components', false), implode("
", $backupNotice), $backupNoticeStatus); return; } // quite only if auto backup (adding this script from custom code :) if ('backup' === $model->activeType) { - echo "# Error\n" . JText::_('COM_COMPONENTBUILDER_ACCESS_DENIED'); + echo "# Error\n" . Text::_('COM_COMPONENTBUILDER_ACCESS_DENIED'); // clear session - JFactory::getApplication()->getSession()->destroy(); + Factory::getApplication()->getSession()->destroy(); jexit(); } - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), JText::_('COM_COMPONENTBUILDER_ACCESS_DENIED'), 'Error'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components', false), Text::_('COM_COMPONENTBUILDER_ACCESS_DENIED'), 'Error'); return; } public function cloner() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // Get the model $model = $this->getModel('Joomla_components'); // check if export is allowed for this user. - $model->user = JFactory::getUser(); + $model->user = Factory::getUser(); if ($model->user->authorise('joomla_component.clone', 'com_componentbuilder') && $model->user->authorise('core.copy', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - JArrayHelper::toInteger($pks); + ArrayHelper::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'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_NO_COMPONENT_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_OF_ONE_COMPONENT_AND_TRY_AGAIN'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); return; } // only one component allowed at this time 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'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_ONLY_ONE_COMPONENT_CAN_BE_CLONED_AT_A_TIME_PLEASE_SELECT_ONE_AND_TRY_AGAIN'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); return; } // set the active type @@ -483,24 +492,25 @@ public function cloner() 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'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message); + $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(Route::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message); return; } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_CLONE_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_CLONE_FAILED'); + $this->setRedirect(Route::_('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'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_CLONE_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); return; } protected function getApiUser() { // admin area does not have API user, only front-end (so we fallback on login user) - return JFactory::getUser(); - } -} + return Factory::getUser(); + } + +} \ No newline at end of file diff --git a/admin/controllers/joomla_module.php b/admin/controllers/joomla_module.php index 2f35cc62a..5d9744fc6 100644 --- a/admin/controllers/joomla_module.php +++ b/admin/controllers/joomla_module.php @@ -12,8 +12,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use VDM\Joomla\Utilities\GetHelper; /** * Joomla_module Form Controller @@ -36,13 +43,13 @@ class ComponentbuilderControllerJoomla_module extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Joomla_modules'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +58,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('joomla_module.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +69,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('joomla_module.create', $this->option); } @@ -76,16 +83,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('joomla_module.access', 'com_componentbuilder.joomla_module.' . (int) $recordId) && $user->authorise('joomla_module.access', 'com_componentbuilder')); + $access = ($user->authorise('joomla_module.access', 'com_componentbuilder.joomla_module.' . (int) $recordId) && $user->authorise('joomla_module.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +157,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +179,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Joomla_module', '', array()); + $model = $this->getModel('Joomla_module', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_modules' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_modules' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +210,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +227,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +238,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +264,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +282,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,14 +316,14 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { // get the state object (Joomla\CMS\Object\CMSObject) $state = $model->get('state'); @@ -335,7 +342,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array()) foreach($_tablesArray as $_updateTable => $_key) { // get the linked ID - if ($_value = ComponentbuilderHelper::getVar($_updateTable, $oldID, $_key, 'id')) + if ($_value = GetHelper::var($_updateTable, $oldID, $_key, 'id')) { // copy fields to new linked table ComponentbuilderHelper::copyItem(/*id->*/ $_value, /*table->*/ $_updateTable, /*change->*/ array($_key => $newID)); @@ -346,5 +353,4 @@ protected function postSaveHook(JModelLegacy $model, $validData = array()) return; } - } diff --git a/admin/controllers/joomla_module_files_folders_urls.php b/admin/controllers/joomla_module_files_folders_urls.php index 5f4048074..071c10a6b 100644 --- a/admin/controllers/joomla_module_files_folders_urls.php +++ b/admin/controllers/joomla_module_files_folders_urls.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Joomla_module_files_folders_urls Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerJoomla_module_files_folders_urls extends FormCon * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Joomla_modules_files_folders_urls'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('joomla_module_files_folders_urls.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('joomla_module_files_folders_urls.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('joomla_module_files_folders_urls.access', 'com_componentbuilder.joomla_module_files_folders_urls.' . (int) $recordId) && $user->authorise('joomla_module_files_folders_urls.access', 'com_componentbuilder')); + $access = ($user->authorise('joomla_module_files_folders_urls.access', 'com_componentbuilder.joomla_module_files_folders_urls.' . (int) $recordId) && $user->authorise('joomla_module_files_folders_urls.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Joomla_module_files_folders_urls', '', array()); + $model = $this->getModel('Joomla_module_files_folders_urls', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_modules_files_folders_urls' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_modules_files_folders_urls' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/joomla_module_updates.php b/admin/controllers/joomla_module_updates.php index ff3cfb63f..832fd538f 100644 --- a/admin/controllers/joomla_module_updates.php +++ b/admin/controllers/joomla_module_updates.php @@ -12,8 +12,16 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Joomla_module_updates Form Controller @@ -36,13 +44,13 @@ class ComponentbuilderControllerJoomla_module_updates extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Joomla_modules_updates'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +59,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('joomla_module_updates.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +70,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('joomla_module_updates.create', $this->option); } @@ -76,16 +84,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('joomla_module_updates.access', 'com_componentbuilder.joomla_module_updates.' . (int) $recordId) && $user->authorise('joomla_module_updates.access', 'com_componentbuilder')); + $access = ($user->authorise('joomla_module_updates.access', 'com_componentbuilder.joomla_module_updates.' . (int) $recordId) && $user->authorise('joomla_module_updates.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +158,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +180,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Joomla_module_updates', '', array()); + $model = $this->getModel('Joomla_module_updates', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_modules_updates' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_modules_updates' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +211,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +228,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +239,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +265,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +283,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,34 +317,33 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { // update the component version to match the updated last version if (isset($validData['joomla_plugin']) && is_numeric($validData['joomla_plugin']) && $validData['joomla_plugin'] > 0) { - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $validData['joomla_plugin']; - if (isset($validData['version_update']) && ComponentbuilderHelper::checkArray($validData['version_update']) + if (isset($validData['version_update']) && UtilitiesArrayHelper::check($validData['version_update']) && ($plugin_version = end($validData['version_update'])['version']) - && ComponentbuilderHelper::checkString($plugin_version)) + && StringHelper::check($plugin_version)) { $objectUpdate->plugin_version = $plugin_version; } // be sure to update the table if we have a value if (isset($objectUpdate->plugin_version)) { - JFactory::getDbo()->updateObject('#__componentbuilder_joomla_plugin', $objectUpdate, 'id'); + Factory::getDbo()->updateObject('#__componentbuilder_joomla_plugin', $objectUpdate, 'id'); } } return; } - } diff --git a/admin/controllers/joomla_modules.php b/admin/controllers/joomla_modules.php index 296a0f0aa..fe221da9f 100644 --- a/admin/controllers/joomla_modules.php +++ b/admin/controllers/joomla_modules.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Joomla_modules Admin Controller @@ -47,13 +53,13 @@ public function getModel($name = 'Joomla_module', $prefix = 'ComponentbuilderMod public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('joomla_module.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +67,16 @@ public function exportData() $model = $this->getModel('Joomla_modules'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Joomla_modules_'.$date->format('jS_F_Y'),'Joomla modules exported ('.$date->format('jS F, Y').')','joomla modules'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_modules', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_modules', false), $message, 'error'); return; } @@ -78,41 +84,41 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('joomla_module.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Joomla_modules'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('joomla_module_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'joomla_modules'); $session->set('dataType_VDM_IMPORTINTO', 'joomla_module'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_JOOMLA_MODULES'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_JOOMLA_MODULES'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_modules', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_modules', false), $message, 'error'); return; } public function getSnippets() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the import snippets custom admin view - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=get_snippets', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=get_snippets', false)); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/joomla_modules_files_folders_urls.php b/admin/controllers/joomla_modules_files_folders_urls.php index 2db04db24..35d70ba08 100644 --- a/admin/controllers/joomla_modules_files_folders_urls.php +++ b/admin/controllers/joomla_modules_files_folders_urls.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Joomla_modules_files_folders_urls Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Joomla_module_files_folders_urls', $prefix = ' { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/joomla_modules_updates.php b/admin/controllers/joomla_modules_updates.php index ae991b5e4..f51c39553 100644 --- a/admin/controllers/joomla_modules_updates.php +++ b/admin/controllers/joomla_modules_updates.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Joomla_modules_updates Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Joomla_module_updates', $prefix = 'Componentbu { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/joomla_plugin.php b/admin/controllers/joomla_plugin.php index 75f9d7071..2282b33da 100644 --- a/admin/controllers/joomla_plugin.php +++ b/admin/controllers/joomla_plugin.php @@ -12,8 +12,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use VDM\Joomla\Utilities\GetHelper; /** * Joomla_plugin Form Controller @@ -36,13 +43,13 @@ class ComponentbuilderControllerJoomla_plugin extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Joomla_plugins'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +58,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('joomla_plugin.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +69,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('joomla_plugin.create', $this->option); } @@ -76,16 +83,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('joomla_plugin.access', 'com_componentbuilder.joomla_plugin.' . (int) $recordId) && $user->authorise('joomla_plugin.access', 'com_componentbuilder')); + $access = ($user->authorise('joomla_plugin.access', 'com_componentbuilder.joomla_plugin.' . (int) $recordId) && $user->authorise('joomla_plugin.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +157,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +179,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Joomla_plugin', '', array()); + $model = $this->getModel('Joomla_plugin', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_plugins' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +210,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +227,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +238,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +264,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +282,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,14 +316,14 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { // get the state object (Joomla\CMS\Object\CMSObject) $state = $model->get('state'); @@ -335,7 +342,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array()) foreach($_tablesArray as $_updateTable => $_key) { // get the linked ID - if ($_value = ComponentbuilderHelper::getVar($_updateTable, $oldID, $_key, 'id')) + if ($_value = GetHelper::var($_updateTable, $oldID, $_key, 'id')) { // copy fields to new linked table ComponentbuilderHelper::copyItem(/*id->*/ $_value, /*table->*/ $_updateTable, /*change->*/ array($_key => $newID)); @@ -346,5 +353,4 @@ protected function postSaveHook(JModelLegacy $model, $validData = array()) return; } - } diff --git a/admin/controllers/joomla_plugin_files_folders_urls.php b/admin/controllers/joomla_plugin_files_folders_urls.php index b3e9a02d8..e3c7e0897 100644 --- a/admin/controllers/joomla_plugin_files_folders_urls.php +++ b/admin/controllers/joomla_plugin_files_folders_urls.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Joomla_plugin_files_folders_urls Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerJoomla_plugin_files_folders_urls extends FormCon * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Joomla_plugins_files_folders_urls'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('joomla_plugin_files_folders_urls.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('joomla_plugin_files_folders_urls.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('joomla_plugin_files_folders_urls.access', 'com_componentbuilder.joomla_plugin_files_folders_urls.' . (int) $recordId) && $user->authorise('joomla_plugin_files_folders_urls.access', 'com_componentbuilder')); + $access = ($user->authorise('joomla_plugin_files_folders_urls.access', 'com_componentbuilder.joomla_plugin_files_folders_urls.' . (int) $recordId) && $user->authorise('joomla_plugin_files_folders_urls.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Joomla_plugin_files_folders_urls', '', array()); + $model = $this->getModel('Joomla_plugin_files_folders_urls', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins_files_folders_urls' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_plugins_files_folders_urls' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/joomla_plugin_group.php b/admin/controllers/joomla_plugin_group.php index 5df0bf684..236866595 100644 --- a/admin/controllers/joomla_plugin_group.php +++ b/admin/controllers/joomla_plugin_group.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Joomla_plugin_group Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerJoomla_plugin_group extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Joomla_plugin_groups'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('joomla_plugin_group.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return parent::allowAdd($data); } @@ -76,10 +82,10 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -143,12 +149,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -165,13 +171,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Joomla_plugin_group', '', array()); + $model = $this->getModel('Joomla_plugin_group', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugin_groups' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_plugin_groups' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -196,13 +202,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -213,7 +219,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -224,7 +230,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -250,7 +256,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -268,29 +274,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -302,16 +308,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/joomla_plugin_groups.php b/admin/controllers/joomla_plugin_groups.php index 8301f15ab..28fba99ac 100644 --- a/admin/controllers/joomla_plugin_groups.php +++ b/admin/controllers/joomla_plugin_groups.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Joomla_plugin_groups Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Joomla_plugin_group', $prefix = 'Componentbuil { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/joomla_plugin_updates.php b/admin/controllers/joomla_plugin_updates.php index 7a0fe5482..c2fed92dc 100644 --- a/admin/controllers/joomla_plugin_updates.php +++ b/admin/controllers/joomla_plugin_updates.php @@ -12,8 +12,16 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Joomla_plugin_updates Form Controller @@ -36,13 +44,13 @@ class ComponentbuilderControllerJoomla_plugin_updates extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Joomla_plugins_updates'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +59,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('joomla_plugin_updates.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +70,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('joomla_plugin_updates.create', $this->option); } @@ -76,16 +84,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('joomla_plugin_updates.access', 'com_componentbuilder.joomla_plugin_updates.' . (int) $recordId) && $user->authorise('joomla_plugin_updates.access', 'com_componentbuilder')); + $access = ($user->authorise('joomla_plugin_updates.access', 'com_componentbuilder.joomla_plugin_updates.' . (int) $recordId) && $user->authorise('joomla_plugin_updates.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +158,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +180,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Joomla_plugin_updates', '', array()); + $model = $this->getModel('Joomla_plugin_updates', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins_updates' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_plugins_updates' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +211,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +228,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +239,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +265,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +283,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,34 +317,33 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { // update the component version to match the updated last version if (isset($validData['joomla_plugin']) && is_numeric($validData['joomla_plugin']) && $validData['joomla_plugin'] > 0) { - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $validData['joomla_plugin']; - if (isset($validData['version_update']) && ComponentbuilderHelper::checkArray($validData['version_update']) + if (isset($validData['version_update']) && UtilitiesArrayHelper::check($validData['version_update']) && ($plugin_version = end($validData['version_update'])['version']) - && ComponentbuilderHelper::checkString($plugin_version)) + && StringHelper::check($plugin_version)) { $objectUpdate->plugin_version = $plugin_version; } // be sure to update the table if we have a value if (isset($objectUpdate->plugin_version)) { - JFactory::getDbo()->updateObject('#__componentbuilder_joomla_plugin', $objectUpdate, 'id'); + Factory::getDbo()->updateObject('#__componentbuilder_joomla_plugin', $objectUpdate, 'id'); } } return; } - } diff --git a/admin/controllers/joomla_plugins.php b/admin/controllers/joomla_plugins.php index 390378c5b..bdc218298 100644 --- a/admin/controllers/joomla_plugins.php +++ b/admin/controllers/joomla_plugins.php @@ -12,8 +12,13 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\StringHelper; /** * Joomla_plugins Admin Controller @@ -53,29 +58,29 @@ public function getModel($name = 'Joomla_plugin', $prefix = 'ComponentbuilderMod public function runExpansion() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins', false); + $redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins', false); // set massage - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); // check if this user has the right to run expansion if($user->authorise('joomla_plugins.run_expansion', 'com_componentbuilder')) { // set massage - $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + $message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); // run expansion via API - $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + $result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand'); // is there a message returned - if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + if (!is_numeric($result) && StringHelper::check($result)) { $this->setRedirect($redirect_url, $result); return true; } elseif (is_numeric($result) && 1 == $result) { - $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); $this->setRedirect($redirect_url, $message, 'message'); return true; } @@ -93,24 +98,24 @@ public function runExpansion() public function getBoilerplate() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins', false); + $redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins', false); // set massage - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_GET_BOILERPLATE_MODULE'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_GET_BOILERPLATE_MODULE'); // check if this user has the right to run expansion if($user->authorise('joomla_plugin.get_boilerplate', 'com_componentbuilder')) { // set massage - $message = JText::_('COM_COMPONENTBUILDER_GETTING_JOOMLA_PLUGIN_BOILERPLATE_FAILED_IF_THE_ISSUE_CONTINUES_INFORM_YOUR_SYSTEM_ADMINISTRATOR'); + $message = Text::_('COM_COMPONENTBUILDER_GETTING_JOOMLA_PLUGIN_BOILERPLATE_FAILED_IF_THE_ISSUE_CONTINUES_INFORM_YOUR_SYSTEM_ADMINISTRATOR'); // Get the model $model = $this->getModel('joomla_plugins'); // check if there is any selections if (!$model->getBoilerplate()) { - $message = '' . JText::_('COM_COMPONENTBUILDER_GETTING_JOOMLA_PLUGIN_BOILERPLATE_WAS_SUCCESSFULLY') . ''; + $message = '' . Text::_('COM_COMPONENTBUILDER_GETTING_JOOMLA_PLUGIN_BOILERPLATE_WAS_SUCCESSFULLY') . ''; $this->setRedirect($redirect_url, $message, 'message'); return true; } @@ -122,18 +127,18 @@ public function getBoilerplate() public function openClassMethods() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the libraries - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_methods', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=class_methods', false)); return; } public function openClassProperties() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the libraries - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=class_properties', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=class_properties', false)); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/joomla_plugins_files_folders_urls.php b/admin/controllers/joomla_plugins_files_folders_urls.php index cd3919bae..b2dc26860 100644 --- a/admin/controllers/joomla_plugins_files_folders_urls.php +++ b/admin/controllers/joomla_plugins_files_folders_urls.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Joomla_plugins_files_folders_urls Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Joomla_plugin_files_folders_urls', $prefix = ' { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/joomla_plugins_updates.php b/admin/controllers/joomla_plugins_updates.php index 6b3fffba9..bfb00f0fe 100644 --- a/admin/controllers/joomla_plugins_updates.php +++ b/admin/controllers/joomla_plugins_updates.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Joomla_plugins_updates Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Joomla_plugin_updates', $prefix = 'Componentbu { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/joomla_power.php b/admin/controllers/joomla_power.php new file mode 100644 index 000000000..f4160fb38 --- /dev/null +++ b/admin/controllers/joomla_power.php @@ -0,0 +1,386 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use VDM\Joomla\Componentbuilder\JoomlaPower\Factory as JoomlaPowerFactory; + +/** + * Joomla_power Form Controller + */ +class ComponentbuilderControllerJoomla_power extends FormController +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = []) + { + $this->view_list = 'Joomla_powers'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + public function resetPowers() + { + // Check for request forgeries + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); + + // get Item posted + $item = $this->input->post->get('jform', array(), 'array'); + + // check if user has the right + $user = Factory::getUser(); + + // set default error message + $message = '

' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RESET_THIS_JOOMLA_POWER') . '

'; + $status = 'error'; + $success = false; + + // load the ID + $id = $item['id'] ?? null; + $guid = $item['guid'] ?? null; + + // check if there is any selections + if ($id === null || $guid === null) + { + // set error message + $message = '

' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_JOOMLA_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '

'; + } + elseif($user->authorise('power.reset', 'com_componentbuilder')) + { + if (JoomlaPowerFactory::_('Joomlapower')->reset([$guid])) + { + // set success message + $message = '

'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'

'; + $message .= '

'.Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_POWER_HAS_SUCCESSFULLY_BEEN_RESET').'

'; + $status = 'success'; + $success = true; + } + else + { + $message = '

' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_JOOMLA_POWER_HAS_FAILED') . '

'; + } + } + + // set redirect + $redirect_url = Route::_( + 'index.php?option=com_componentbuilder&view=joomla_power' + . $this->getRedirectToItemAppend($id), $success + ); + + $this->setRedirect($redirect_url, $message, $status); + + return $success; + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = []) + { + // Get user object. + $user = Factory::getUser(); + // Access check. + $access = $user->authorise('joomla_power.access', 'com_componentbuilder'); + if (!$access) + { + return false; + } + + // In the absence of better information, revert to the component permissions. + return $user->authorise('joomla_power.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = [], $key = 'id') + { + // get user object. + $user = Factory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('joomla_power.access', 'com_componentbuilder.joomla_power.' . (int) $recordId) && $user->authorise('joomla_power.access', 'com_componentbuilder')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('joomla_power.edit', 'com_componentbuilder.joomla_power.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('joomla_power.edit.own', 'com_componentbuilder.joomla_power.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('joomla_power.edit.own', 'com_componentbuilder')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('joomla_power.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string) $ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Joomla_power', '', []); + + // Preset the redirect + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_powers' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && Uri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + Route::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + Route::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; + + // Redirect to the item screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string) $this->ref; + + // Redirect to the list screen. + $this->setRedirect( + Route::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) + { + return; + } +} diff --git a/admin/controllers/joomla_powers.php b/admin/controllers/joomla_powers.php new file mode 100644 index 000000000..4f8b853d9 --- /dev/null +++ b/admin/controllers/joomla_powers.php @@ -0,0 +1,150 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\MVC\Controller\AdminController; +use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Componentbuilder\JoomlaPower\Factory as JoomlaPowerFactory; +use VDM\Joomla\Utilities\GetHelper; + +/** + * Joomla_powers Admin Controller + */ +class ComponentbuilderControllerJoomla_powers extends AdminController +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER_JOOMLA_POWERS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Joomla_power', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function initPowers() + { + // Check for request forgeries + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); + + // check if user has the right + $user = Factory::getUser(); + + // set default error message + $message = '

' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INITIALIZE_JOOMLA_POWERS') . '

'; + $status = 'error'; + $success = false; + + if($user->authorise('power.init', 'com_componentbuilder')) + { + if (JoomlaPowerFactory::_('Joomlapower')->init()) + { + // set success message + $message = '

' . Text::_('COM_COMPONENTBUILDER_SUCCESSFULLY_INITIALIZED_ALL_REMOTE_JOOMLA_POWERS') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_THE_LOCAL_DATABASE_JOOMLA_POWERS_HAS_SUCCESSFULLY_BEEN_SYNCED_WITH_THE_REMOTE_REPOSITORIES') . '

'; + + $status = 'success'; + $success = true; + } + else + { + $message = '

' . Text::_('COM_COMPONENTBUILDER_INITIALIZATION_FAILED') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_THE_INITIALIZATION_OF_THIS_JOOMLA_POWERS_HAS_FAILED') . '

'; + } + } + + // set redirect + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', $success); + $this->setRedirect($redirect_url, $message, $status); + + return $success; + } + + public function resetPowers() + { + // Check for request forgeries + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); + + // get IDS of the selected powers + $pks = $this->input->post->get('cid', [], 'array'); + + // Sanitize the input + ArrayHelper::toInteger($pks); + + // check if there is any selections + if ($pks === []) + { + // set error message + $message = '

'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'

'; + $message .= '

'.Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'

'; + // set redirect + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', false); + $this->setRedirect($redirect_url, $message, 'error'); + return false; + } + + $status = 'error'; + $success = false; + + // check if user has the right + $user = Factory::getUser(); + if($user->authorise('power.reset', 'com_componentbuilder')) + { + $guids = GetHelper::vars('joomla_power', $pks, 'id', 'guid'); + + if (JoomlaPowerFactory::_('Joomlapower')->reset($guids)) + { + // set success message + $message = '

'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'

'; + $message .= '

'.Text::_('COM_COMPONENTBUILDER_THESE_JOOMLA_POWERS_HAVE_SUCCESSFULLY_BEEN_RESET').'

'; + $status = 'success'; + $success = true; + } + else + { + $message = '

' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THESE_JOOMLA_POWERS_HAS_FAILED') . '

'; + } + + // set redirect + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', $success); + $this->setRedirect($redirect_url, $message, $status); + + return $success; + } + + // set redirect + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', false); + $this->setRedirect($redirect_url); + return $success; + } +} \ No newline at end of file diff --git a/admin/controllers/language.php b/admin/controllers/language.php index 84225c242..57dc4a8bb 100644 --- a/admin/controllers/language.php +++ b/admin/controllers/language.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Language Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerLanguage extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Languages'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('language.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('language.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('language.access', 'com_componentbuilder.language.' . (int) $recordId) && $user->authorise('language.access', 'com_componentbuilder')); + $access = ($user->authorise('language.access', 'com_componentbuilder.language.' . (int) $recordId) && $user->authorise('language.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Language', '', array()); + $model = $this->getModel('Language', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=languages' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=languages' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/language_translation.php b/admin/controllers/language_translation.php index 24af02ea2..621a8ba84 100644 --- a/admin/controllers/language_translation.php +++ b/admin/controllers/language_translation.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Language_translation Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerLanguage_translation extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Language_translations'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('language_translation.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('language_translation.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('language_translation.access', 'com_componentbuilder.language_translation.' . (int) $recordId) && $user->authorise('language_translation.access', 'com_componentbuilder')); + $access = ($user->authorise('language_translation.access', 'com_componentbuilder.language_translation.' . (int) $recordId) && $user->authorise('language_translation.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Language_translation', '', array()); + $model = $this->getModel('Language_translation', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=language_translations' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=language_translations' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/language_translations.php b/admin/controllers/language_translations.php index bc86c2b2f..a2d9af457 100644 --- a/admin/controllers/language_translations.php +++ b/admin/controllers/language_translations.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Language_translations Admin Controller @@ -47,13 +53,13 @@ public function getModel($name = 'Language_translation', $prefix = 'Componentbui public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('language_translation.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +67,16 @@ public function exportData() $model = $this->getModel('Language_translations'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Language_translations_'.$date->format('jS_F_Y'),'Language translations exported ('.$date->format('jS F, Y').')','language translations'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=language_translations', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=language_translations', false), $message, 'error'); return; } @@ -78,32 +84,32 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('language_translation.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Language_translations'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('language_translation_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'language_translations'); $session->set('dataType_VDM_IMPORTINTO', 'language_translation'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_LANGUAGE_TRANSLATIONS'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import_language_translations', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_LANGUAGE_TRANSLATIONS'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import_language_translations', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=language_translations', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=language_translations', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/languages.php b/admin/controllers/languages.php index bf029787e..4da4d46a6 100644 --- a/admin/controllers/languages.php +++ b/admin/controllers/languages.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Languages Admin Controller @@ -47,13 +53,13 @@ public function getModel($name = 'Language', $prefix = 'ComponentbuilderModel', public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('language.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +67,16 @@ public function exportData() $model = $this->getModel('Languages'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Languages_'.$date->format('jS_F_Y'),'Languages exported ('.$date->format('jS F, Y').')','languages'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=languages', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=languages', false), $message, 'error'); return; } @@ -78,41 +84,41 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('language.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Languages'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('language_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'languages'); $session->set('dataType_VDM_IMPORTINTO', 'language'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_LANGUAGES'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_LANGUAGES'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=languages', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=languages', false), $message, 'error'); return; } public function buildLanguages() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); if($user->authorise('core.create', 'com_componentbuilder')) { // get the model @@ -120,17 +126,17 @@ public function buildLanguages() if ($model->buildLanguages()) { // set success message - $message = '

'.JText::_('COM_COMPONENTBUILDER_IMPORT_SUCCESS').'

'; - $message .= '

'.JText::_('COM_COMPONENTBUILDER_ALL_THE_LANGUAGES_FOUND_IN_JOOMLA_WERE_SUCCESSFULLY_IMPORTED').'

'; + $message = '

'.Text::_('COM_COMPONENTBUILDER_IMPORT_SUCCESS').'

'; + $message .= '

'.Text::_('COM_COMPONENTBUILDER_ALL_THE_LANGUAGES_FOUND_IN_JOOMLA_WERE_SUCCESSFULLY_IMPORTED').'

'; // set redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=languages', false); + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=languages', false); $this->setRedirect($redirect_url, $message); return true; } } // set redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=languages', false); + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=languages', false); $this->setRedirect($redirect_url); return false; } -} +} \ No newline at end of file diff --git a/admin/controllers/layout.php b/admin/controllers/layout.php index 1ea8272d5..b3acdcc5a 100644 --- a/admin/controllers/layout.php +++ b/admin/controllers/layout.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Layout Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerLayout extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Layouts'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('layout.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return parent::allowAdd($data); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('layout.access', 'com_componentbuilder.layout.' . (int) $recordId) && $user->authorise('layout.access', 'com_componentbuilder')); + $access = ($user->authorise('layout.access', 'com_componentbuilder.layout.' . (int) $recordId) && $user->authorise('layout.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Layout', '', array()); + $model = $this->getModel('Layout', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=layouts' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=layouts' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/layouts.php b/admin/controllers/layouts.php index cf21ecfcf..518c0fe03 100644 --- a/admin/controllers/layouts.php +++ b/admin/controllers/layouts.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Layouts Admin Controller @@ -47,13 +53,13 @@ public function getModel($name = 'Layout', $prefix = 'ComponentbuilderModel', $c public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('layout.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +67,16 @@ public function exportData() $model = $this->getModel('Layouts'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Layouts_'.$date->format('jS_F_Y'),'Layouts exported ('.$date->format('jS F, Y').')','layouts'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=layouts', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=layouts', false), $message, 'error'); return; } @@ -78,41 +84,41 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('layout.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Layouts'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('layout_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'layouts'); $session->set('dataType_VDM_IMPORTINTO', 'layout'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_LAYOUTS'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_LAYOUTS'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=layouts', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=layouts', false), $message, 'error'); return; } public function getSnippets() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the import snippets custom admin view - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=get_snippets', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=get_snippets', false)); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/libraries.php b/admin/controllers/libraries.php index fc1731334..40bb378f2 100644 --- a/admin/controllers/libraries.php +++ b/admin/controllers/libraries.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Libraries Admin Controller @@ -47,9 +51,9 @@ public function getModel($name = 'Library', $prefix = 'ComponentbuilderModel', $ public function getSnippets() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the import snippets custom admin view - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=get_snippets', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=get_snippets', false)); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/libraries_config.php b/admin/controllers/libraries_config.php index 5bf71ecb0..12ea4ecae 100644 --- a/admin/controllers/libraries_config.php +++ b/admin/controllers/libraries_config.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Libraries_config Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Library_config', $prefix = 'ComponentbuilderMo { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/libraries_files_folders_urls.php b/admin/controllers/libraries_files_folders_urls.php index a4e48d2e6..66f309580 100644 --- a/admin/controllers/libraries_files_folders_urls.php +++ b/admin/controllers/libraries_files_folders_urls.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Libraries_files_folders_urls Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Library_files_folders_urls', $prefix = 'Compon { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/library.php b/admin/controllers/library.php index 71eae10c0..19befdc49 100644 --- a/admin/controllers/library.php +++ b/admin/controllers/library.php @@ -12,8 +12,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use VDM\Joomla\Utilities\GetHelper; /** * Library Form Controller @@ -36,13 +43,13 @@ class ComponentbuilderControllerLibrary extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Libraries'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +58,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('library.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +69,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('library.create', $this->option); } @@ -76,16 +83,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('library.access', 'com_componentbuilder.library.' . (int) $recordId) && $user->authorise('library.access', 'com_componentbuilder')); + $access = ($user->authorise('library.access', 'com_componentbuilder.library.' . (int) $recordId) && $user->authorise('library.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +157,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +179,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Library', '', array()); + $model = $this->getModel('Library', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=libraries' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=libraries' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +210,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +227,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +238,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +264,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +282,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,14 +316,14 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { // get the state object (Joomla\CMS\Object\CMSObject) $state = $model->get('state'); @@ -335,7 +342,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array()) foreach($_tablesArray as $_updateTable) { // get the linked ID - if ($_value = ComponentbuilderHelper::getVar($_updateTable, $oldID, 'library', 'id')) + if ($_value = GetHelper::var($_updateTable, $oldID, 'library', 'id')) { // copy fields to new linked table ComponentbuilderHelper::copyItem(/*id->*/ $_value, /*table->*/ $_updateTable, /*change->*/ array('library' => $newID)); @@ -345,5 +352,4 @@ protected function postSaveHook(JModelLegacy $model, $validData = array()) return; } - } diff --git a/admin/controllers/library_config.php b/admin/controllers/library_config.php index 0168bdc0c..9a6d06398 100644 --- a/admin/controllers/library_config.php +++ b/admin/controllers/library_config.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Library_config Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerLibrary_config extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Libraries_config'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('library_config.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('library_config.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('library_config.access', 'com_componentbuilder.library_config.' . (int) $recordId) && $user->authorise('library_config.access', 'com_componentbuilder')); + $access = ($user->authorise('library_config.access', 'com_componentbuilder.library_config.' . (int) $recordId) && $user->authorise('library_config.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Library_config', '', array()); + $model = $this->getModel('Library_config', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=libraries_config' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=libraries_config' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/library_files_folders_urls.php b/admin/controllers/library_files_folders_urls.php index ae1fc5af1..635ac12ea 100644 --- a/admin/controllers/library_files_folders_urls.php +++ b/admin/controllers/library_files_folders_urls.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Library_files_folders_urls Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerLibrary_files_folders_urls extends FormControlle * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Libraries_files_folders_urls'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('library_files_folders_urls.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('library_files_folders_urls.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('library_files_folders_urls.access', 'com_componentbuilder.library_files_folders_urls.' . (int) $recordId) && $user->authorise('library_files_folders_urls.access', 'com_componentbuilder')); + $access = ($user->authorise('library_files_folders_urls.access', 'com_componentbuilder.library_files_folders_urls.' . (int) $recordId) && $user->authorise('library_files_folders_urls.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Library_files_folders_urls', '', array()); + $model = $this->getModel('Library_files_folders_urls', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=libraries_files_folders_urls' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=libraries_files_folders_urls' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/placeholder.php b/admin/controllers/placeholder.php index 6bef4da90..f0cb767aa 100644 --- a/admin/controllers/placeholder.php +++ b/admin/controllers/placeholder.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Placeholder Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerPlaceholder extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Placeholders'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('placeholder.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('placeholder.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('placeholder.access', 'com_componentbuilder.placeholder.' . (int) $recordId) && $user->authorise('placeholder.access', 'com_componentbuilder')); + $access = ($user->authorise('placeholder.access', 'com_componentbuilder.placeholder.' . (int) $recordId) && $user->authorise('placeholder.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Placeholder', '', array()); + $model = $this->getModel('Placeholder', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=placeholders' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=placeholders' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/placeholders.php b/admin/controllers/placeholders.php index 6cc1d6071..f55a0fed3 100644 --- a/admin/controllers/placeholders.php +++ b/admin/controllers/placeholders.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Placeholders Admin Controller @@ -47,13 +53,13 @@ public function getModel($name = 'Placeholder', $prefix = 'ComponentbuilderModel public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('placeholder.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +67,16 @@ public function exportData() $model = $this->getModel('Placeholders'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Placeholders_'.$date->format('jS_F_Y'),'Placeholders exported ('.$date->format('jS F, Y').')','placeholders'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=placeholders', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=placeholders', false), $message, 'error'); return; } @@ -78,32 +84,32 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('placeholder.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Placeholders'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('placeholder_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'placeholders'); $session->set('dataType_VDM_IMPORTINTO', 'placeholder'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_PLACEHOLDERS'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_PLACEHOLDERS'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=placeholders', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=placeholders', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/power.php b/admin/controllers/power.php index 6124827f7..bec57a81d 100644 --- a/admin/controllers/power.php +++ b/admin/controllers/power.php @@ -12,8 +12,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use VDM\Joomla\Componentbuilder\Power\Factory as PowerFactory; /** * Power Form Controller @@ -36,13 +43,69 @@ class ComponentbuilderControllerPower extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Powers'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + public function resetPowers() + { + // Check for request forgeries + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); + + // get Item posted + $item = $this->input->post->get('jform', array(), 'array'); + + // check if user has the right + $user = Factory::getUser(); + + // set default error message + $message = '

' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RESET_THIS_POWER') . '

'; + $status = 'error'; + $success = false; + + // load the ID + $id = $item['id'] ?? null; + $guid = $item['guid'] ?? null; + + // check if there is any selections + if ($id === null || $guid === null) + { + // set error message + $message = '

' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '

'; + } + elseif($user->authorise('power.reset', 'com_componentbuilder')) + { + if (PowerFactory::_('Superpower')->reset([$guid])) + { + // set success message + $message = '

'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'

'; + $message .= '

'.Text::_('COM_COMPONENTBUILDER_THE_POWER_HAS_SUCCESSFULLY_BEEN_RESET').'

'; + $status = 'success'; + $success = true; + } + else + { + $message = '

' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_POWER_HAS_FAILED') . '

'; + } + } + + // set redirect + $redirect_url = Route::_( + 'index.php?option=com_componentbuilder&view=power' + . $this->getRedirectToItemAppend($id), $success + ); + + $this->setRedirect($redirect_url, $message, $status); + + return $success; + } + + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +114,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('power.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +125,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('power.create', $this->option); } @@ -76,16 +139,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('power.access', 'com_componentbuilder.power.' . (int) $recordId) && $user->authorise('power.access', 'com_componentbuilder')); + $access = ($user->authorise('power.access', 'com_componentbuilder.power.' . (int) $recordId) && $user->authorise('power.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +213,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +235,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Power', '', array()); + $model = $this->getModel('Power', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=powers' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=powers' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +266,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +283,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +294,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +320,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +338,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +372,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/powers.php b/admin/controllers/powers.php index a5d82dee5..15907cc25 100644 --- a/admin/controllers/powers.php +++ b/admin/controllers/powers.php @@ -12,8 +12,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Componentbuilder\Power\Factory as PowerFactory; +use VDM\Joomla\Utilities\GetHelper; /** * Powers Admin Controller @@ -53,29 +60,29 @@ public function getModel($name = 'Power', $prefix = 'ComponentbuilderModel', $co public function runExpansion() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false); + $redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=powers', false); // set massage - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); // check if this user has the right to run expansion if($user->authorise('powers.run_expansion', 'com_componentbuilder')) { // set massage - $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + $message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); // run expansion via API - $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + $result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand'); // is there a message returned - if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + if (!is_numeric($result) && StringHelper::check($result)) { $this->setRedirect($redirect_url, $result); return true; } elseif (is_numeric($result) && 1 == $result) { - $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); $this->setRedirect($redirect_url, $message, 'message'); return true; } @@ -83,5 +90,102 @@ public function runExpansion() $this->setRedirect($redirect_url, $message, 'error'); return false; } - -} + + public function initPowers() + { + // Check for request forgeries + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); + + // check if user has the right + $user = Factory::getUser(); + + // set default error message + $message = '

' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INITIALIZE_POWERS') . '

'; + $status = 'error'; + $success = false; + + if($user->authorise('power.init', 'com_componentbuilder')) + { + if (PowerFactory::_('Superpower')->init()) + { + // set success message + $message = '

' . Text::_('COM_COMPONENTBUILDER_SUCCESSFULLY_INITIALIZED_ALL_REMOTE_POWERS') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_THE_LOCAL_DATABASE_POWERS_HAS_SUCCESSFULLY_BEEN_SYNCED_WITH_THE_REMOTE_REPOSITORIES') . '

'; + + $status = 'success'; + $success = true; + } + else + { + $message = '

' . Text::_('COM_COMPONENTBUILDER_INITIALIZATION_FAILED') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_THE_INITIALIZATION_OF_THIS_POWERS_HAS_FAILED') . '

'; + } + } + + // set redirect + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', $success); + $this->setRedirect($redirect_url, $message, $status); + + return $success; + } + + public function resetPowers() + { + // Check for request forgeries + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); + + // get IDS of the selected powers + $pks = $this->input->post->get('cid', [], 'array'); + + // Sanitize the input + ArrayHelper::toInteger($pks); + + // check if there is any selections + if ($pks === []) + { + // set error message + $message = '

'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'

'; + $message .= '

'.Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'

'; + // set redirect + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false); + $this->setRedirect($redirect_url, $message, 'error'); + return false; + } + + $status = 'error'; + $success = false; + + // check if user has the right + $user = Factory::getUser(); + if($user->authorise('power.reset', 'com_componentbuilder')) + { + $guids = GetHelper::vars('power', $pks, 'id', 'guid'); + + if (PowerFactory::_('Superpower')->reset($guids)) + { + // set success message + $message = '

'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'

'; + $message .= '

'.Text::_('COM_COMPONENTBUILDER_THESE_POWERS_HAVE_SUCCESSFULLY_BEEN_RESET').'

'; + $status = 'success'; + $success = true; + } + else + { + $message = '

' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THESE_POWERS_HAS_FAILED') . '

'; + } + + // set redirect + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', $success); + $this->setRedirect($redirect_url, $message, $status); + + return $success; + } + + // set redirect + $redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false); + $this->setRedirect($redirect_url); + return $success; + } +} \ No newline at end of file diff --git a/admin/controllers/search.php b/admin/controllers/search.php new file mode 100644 index 000000000..0a2009ebc --- /dev/null +++ b/admin/controllers/search.php @@ -0,0 +1,46 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\Utilities\ArrayHelper; + +/** + * Componentbuilder Search Base Controller + */ +class ComponentbuilderControllerSearch extends BaseController +{ + public function __construct($config) + { + parent::__construct($config); + } + + public function dashboard() + { + $this->setRedirect(Route::_('index.php?option=com_componentbuilder', false)); + return; + } + + public function openCompiler() + { + // Check for request forgeries + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); + // redirect to the libraries + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=compiler', false)); + return; + } +} diff --git a/admin/controllers/server.php b/admin/controllers/server.php index a43fa7e49..146952d2f 100644 --- a/admin/controllers/server.php +++ b/admin/controllers/server.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Server Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerServer extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Servers'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('server.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('server.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('server.access', 'com_componentbuilder.server.' . (int) $recordId) && $user->authorise('server.access', 'com_componentbuilder')); + $access = ($user->authorise('server.access', 'com_componentbuilder.server.' . (int) $recordId) && $user->authorise('server.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Server', '', array()); + $model = $this->getModel('Server', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=servers' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=servers' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/servers.php b/admin/controllers/servers.php index 5a4bdac5b..64bdcb258 100644 --- a/admin/controllers/servers.php +++ b/admin/controllers/servers.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Servers Admin Controller @@ -47,13 +53,13 @@ public function getModel($name = 'Server', $prefix = 'ComponentbuilderModel', $c public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('server.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +67,16 @@ public function exportData() $model = $this->getModel('Servers'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Servers_'.$date->format('jS_F_Y'),'Servers exported ('.$date->format('jS F, Y').')','servers'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=servers', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=servers', false), $message, 'error'); return; } @@ -78,32 +84,32 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('server.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Servers'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('server_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'servers'); $session->set('dataType_VDM_IMPORTINTO', 'server'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_SERVERS'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_SERVERS'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=servers', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=servers', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/site_view.php b/admin/controllers/site_view.php index 0b0c09199..34ee5d62f 100644 --- a/admin/controllers/site_view.php +++ b/admin/controllers/site_view.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Site_view Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerSite_view extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Site_views'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('site_view.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return parent::allowAdd($data); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('site_view.access', 'com_componentbuilder.site_view.' . (int) $recordId) && $user->authorise('site_view.access', 'com_componentbuilder')); + $access = ($user->authorise('site_view.access', 'com_componentbuilder.site_view.' . (int) $recordId) && $user->authorise('site_view.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Site_view', '', array()); + $model = $this->getModel('Site_view', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=site_views' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=site_views' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/site_views.php b/admin/controllers/site_views.php index cca006cda..c98a8db08 100644 --- a/admin/controllers/site_views.php +++ b/admin/controllers/site_views.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Site_views Admin Controller @@ -47,13 +53,13 @@ public function getModel($name = 'Site_view', $prefix = 'ComponentbuilderModel', public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('site_view.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +67,16 @@ public function exportData() $model = $this->getModel('Site_views'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Site_views_'.$date->format('jS_F_Y'),'Site views exported ('.$date->format('jS F, Y').')','site views'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=site_views', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=site_views', false), $message, 'error'); return; } @@ -78,41 +84,41 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('site_view.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Site_views'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('site_view_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'site_views'); $session->set('dataType_VDM_IMPORTINTO', 'site_view'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_SITE_VIEWS'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_SITE_VIEWS'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=site_views', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=site_views', false), $message, 'error'); return; } public function getSnippets() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the import snippets custom admin view - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=get_snippets', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=get_snippets', false)); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/snippet.php b/admin/controllers/snippet.php index ff311a80d..23aeb0363 100644 --- a/admin/controllers/snippet.php +++ b/admin/controllers/snippet.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Snippet Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerSnippet extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Snippets'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('snippet.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return parent::allowAdd($data); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('snippet.access', 'com_componentbuilder.snippet.' . (int) $recordId) && $user->authorise('snippet.access', 'com_componentbuilder')); + $access = ($user->authorise('snippet.access', 'com_componentbuilder.snippet.' . (int) $recordId) && $user->authorise('snippet.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Snippet', '', array()); + $model = $this->getModel('Snippet', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=snippets' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/snippet_type.php b/admin/controllers/snippet_type.php index 62d99e746..a9f3be233 100644 --- a/admin/controllers/snippet_type.php +++ b/admin/controllers/snippet_type.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Snippet_type Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerSnippet_type extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Snippet_types'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('snippet_type.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('snippet_type.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('snippet_type.access', 'com_componentbuilder.snippet_type.' . (int) $recordId) && $user->authorise('snippet_type.access', 'com_componentbuilder')); + $access = ($user->authorise('snippet_type.access', 'com_componentbuilder.snippet_type.' . (int) $recordId) && $user->authorise('snippet_type.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Snippet_type', '', array()); + $model = $this->getModel('Snippet_type', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippet_types' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=snippet_types' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/snippet_types.php b/admin/controllers/snippet_types.php index 3b2275d32..6d24ce438 100644 --- a/admin/controllers/snippet_types.php +++ b/admin/controllers/snippet_types.php @@ -12,8 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Snippet_types Admin Controller @@ -43,4 +47,4 @@ public function getModel($name = 'Snippet_type', $prefix = 'ComponentbuilderMode { return parent::getModel($name, $prefix, $config); } -} +} \ No newline at end of file diff --git a/admin/controllers/snippets.php b/admin/controllers/snippets.php index 3df7e65b5..8bf46a20c 100644 --- a/admin/controllers/snippets.php +++ b/admin/controllers/snippets.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Snippets Admin Controller @@ -47,13 +53,13 @@ public function getModel($name = 'Snippet', $prefix = 'ComponentbuilderModel', $ public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('snippet.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +67,16 @@ public function exportData() $model = $this->getModel('Snippets'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Snippets_'.$date->format('jS_F_Y'),'Snippets exported ('.$date->format('jS F, Y').')','snippets'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error'); return; } @@ -78,65 +84,65 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('snippet.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Snippets'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('snippet_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'snippets'); $session->set('dataType_VDM_IMPORTINTO', 'snippet'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_SNIPPETS'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_SNIPPETS'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error'); return; } public function getSnippets() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the import snippets custom admin view - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=get_snippets', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=get_snippets', false)); return; } public function shareSnippets() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // Get the model $model = $this->getModel('snippets'); // check if import is allowed for this user. - $model->user = JFactory::getUser(); + $model->user = Factory::getUser(); if ($model->user->authorise('snippet.import', 'com_componentbuilder') && $model->user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input JArrayHelper::toInteger($pks); // check if there is any selections - if (!ComponentbuilderHelper::checkArray($pks)) + if (!UtilitiesArrayHelper::check($pks)) { // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_NO_SNIPPETS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_NO_SNIPPETS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error'); return; } // set auto loader @@ -147,36 +153,36 @@ public function shareSnippets() // Message of successful build if (count($pks) > 1) { - $message = '

' . JText::_('COM_COMPONENTBUILDER_THE_SNIPPETS_WERE_SUCCESSFULLY_EXPORTED') . '

'; - $message .= '

' . JText::sprintf('COM_COMPONENTBUILDER_TO_SHARE_THESE_SNIPPETS_WITH_THE_REST_OF_THE_JCB_COMMUNITY'); + $message = '

' . Text::_('COM_COMPONENTBUILDER_THE_SNIPPETS_WERE_SUCCESSFULLY_EXPORTED') . '

'; + $message .= '

' . Text::sprintf('COM_COMPONENTBUILDER_TO_SHARE_THESE_SNIPPETS_WITH_THE_REST_OF_THE_JCB_COMMUNITY'); } else { - $message = '

' . JText::_('COM_COMPONENTBUILDER_THE_SNIPPET_WAS_SUCCESSFULLY_EXPORTED') . '

'; - $message .= '

' . JText::sprintf('COM_COMPONENTBUILDER_TO_SHARE_THIS_SNIPPET_WITH_THE_REST_OF_THE_JCB_COMMUNITY'); + $message = '

' . Text::_('COM_COMPONENTBUILDER_THE_SNIPPET_WAS_SUCCESSFULLY_EXPORTED') . '

'; + $message .= '

' . Text::sprintf('COM_COMPONENTBUILDER_TO_SHARE_THIS_SNIPPET_WITH_THE_REST_OF_THE_JCB_COMMUNITY'); } - $message .= JText::sprintf('COM_COMPONENTBUILDER_YOU_WILL_NEED_TO_KNOW_HOW_S_WORKS_BASIC_YOU_WILL_ALSO_NEED_A_S_ACCOUNT_AND_KNOW_HOW_TO_MAKE_A_PULL_REQUEST_ON_GITHUB', + $message .= Text::sprintf('COM_COMPONENTBUILDER_YOU_WILL_NEED_TO_KNOW_HOW_S_WORKS_BASIC_YOU_WILL_ALSO_NEED_A_S_ACCOUNT_AND_KNOW_HOW_TO_MAKE_A_PULL_REQUEST_ON_GITHUB', 'git', 'github.com') . '

'; - $message .= '

' . JText::_('COM_COMPONENTBUILDER_NEED_HELP') . '

'; + $message .= '

' . Text::_('COM_COMPONENTBUILDER_NEED_HELP') . '

'; $message .= ''; - $message .= '

' . JText::_('COM_COMPONENTBUILDER_ZIPPED_FILE_LOCATION') . '

'; - $message .= '

' . JText::sprintf('COM_COMPONENTBUILDER_PATH_CODESCODE', $model->zipPath). '

'; - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message); + $message .= '

' . Text::_('COM_COMPONENTBUILDER_ZIPPED_FILE_LOCATION') . '

'; + $message .= '

' . Text::sprintf('COM_COMPONENTBUILDER_PATH_CODESCODE', $model->zipPath). '

'; + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=snippets', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_SHARE_THE_SNIPPETS_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_SHARE_THE_SNIPPETS_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/template.php b/admin/controllers/template.php index b52ee2ab5..b8aca99e2 100644 --- a/admin/controllers/template.php +++ b/admin/controllers/template.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Template Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerTemplate extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Templates'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('template.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return parent::allowAdd($data); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('template.access', 'com_componentbuilder.template.' . (int) $recordId) && $user->authorise('template.access', 'com_componentbuilder')); + $access = ($user->authorise('template.access', 'com_componentbuilder.template.' . (int) $recordId) && $user->authorise('template.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Template', '', array()); + $model = $this->getModel('Template', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=templates' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=templates' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/templates.php b/admin/controllers/templates.php index 711d9da98..2bf65c8e1 100644 --- a/admin/controllers/templates.php +++ b/admin/controllers/templates.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Templates Admin Controller @@ -47,13 +53,13 @@ public function getModel($name = 'Template', $prefix = 'ComponentbuilderModel', public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('template.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +67,16 @@ public function exportData() $model = $this->getModel('Templates'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Templates_'.$date->format('jS_F_Y'),'Templates exported ('.$date->format('jS F, Y').')','templates'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=templates', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=templates', false), $message, 'error'); return; } @@ -78,41 +84,41 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('template.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Templates'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('template_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'templates'); $session->set('dataType_VDM_IMPORTINTO', 'template'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_TEMPLATES'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_TEMPLATES'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=templates', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=templates', false), $message, 'error'); return; } public function getSnippets() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // redirect to the import snippets custom admin view - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=get_snippets', false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=get_snippets', false)); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/validation_rule.php b/admin/controllers/validation_rule.php index 58cf192ad..638eee596 100644 --- a/admin/controllers/validation_rule.php +++ b/admin/controllers/validation_rule.php @@ -12,8 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Validation_rule Form Controller @@ -36,13 +42,13 @@ class ComponentbuilderControllerValidation_rule extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Validation_rules'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -51,10 +57,10 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('validation_rule.access', 'com_componentbuilder'); if (!$access) @@ -62,7 +68,7 @@ protected function allowAdd($data = array()) return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('validation_rule.create', $this->option); } @@ -76,16 +82,16 @@ protected function allowAdd($data = array()) * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('validation_rule.access', 'com_componentbuilder.validation_rule.' . (int) $recordId) && $user->authorise('validation_rule.access', 'com_componentbuilder')); + $access = ($user->authorise('validation_rule.access', 'com_componentbuilder.validation_rule.' . (int) $recordId) && $user->authorise('validation_rule.access', 'com_componentbuilder')); if (!$access) { return false; @@ -150,12 +156,12 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -172,13 +178,13 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Validation_rule', '', array()); + $model = $this->getModel('Validation_rule', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=validation_rules' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=validation_rules' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -203,13 +209,13 @@ public function cancel($key = null) $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -220,7 +226,7 @@ public function cancel($key = null) // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -231,7 +237,7 @@ public function cancel($key = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -257,7 +263,7 @@ public function save($key = null, $urlVar = null) // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -275,29 +281,29 @@ public function save($key = null, $urlVar = null) // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -309,16 +315,15 @@ public function save($key = null, $urlVar = null) * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/validation_rules.php b/admin/controllers/validation_rules.php index 13da517e5..69c81f4d9 100644 --- a/admin/controllers/validation_rules.php +++ b/admin/controllers/validation_rules.php @@ -12,8 +12,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Validation_rules Admin Controller @@ -47,13 +54,13 @@ public function getModel($name = 'Validation_rule', $prefix = 'ComponentbuilderM public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('validation_rule.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -61,16 +68,16 @@ public function exportData() $model = $this->getModel('Validation_rules'); // get the data to export $data = $model->getExportData($pks); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); ComponentbuilderHelper::xls($data,'Validation_rules_'.$date->format('jS_F_Y'),'Validation rules exported ('.$date->format('jS F, Y').')','validation rules'); } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=validation_rules', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=validation_rules', false), $message, 'error'); return; } @@ -78,32 +85,32 @@ public function exportData() public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('validation_rule.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // Get the import model $model = $this->getModel('Validation_rules'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('validation_rule_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'validation_rules'); $session->set('dataType_VDM_IMPORTINTO', 'validation_rule'); // Redirect to import view. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_VALIDATION_RULES'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_VALIDATION_RULES'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=validation_rules', false), $message, 'error'); + $message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=validation_rules', false), $message, 'error'); return; } @@ -116,29 +123,29 @@ public function importData() public function runExpansion() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN')); // check if user has the right - $user = JFactory::getUser(); + $user = Factory::getUser(); // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=validation_rules', false); + $redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=validation_rules', false); // set massage - $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + $message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); // check if this user has the right to run expansion if($user->authorise('validation_rules.run_expansion', 'com_componentbuilder')) { // set massage - $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + $message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); // run expansion via API - $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + $result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand'); // is there a message returned - if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + if (!is_numeric($result) && StringHelper::check($result)) { $this->setRedirect($redirect_url, $result); return true; } elseif (is_numeric($result) && 1 == $result) { - $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); $this->setRedirect($redirect_url, $message, 'message'); return true; } @@ -147,4 +154,4 @@ public function runExpansion() return false; } -} +} \ No newline at end of file diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php deleted file mode 100644 index bafeb57cf..000000000 --- a/admin/helpers/compiler/a_Get.php +++ /dev/null @@ -1,10567 +0,0 @@ - - * @gitea Joomla Component Builder - * @github 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'); - -use Joomla\CMS\Filesystem\File; -use Joomla\CMS\Filesystem\Folder; -use VDM\Joomla\Utilities\GuidHelper; -use VDM\Joomla\Utilities\StringHelper; -use VDM\Joomla\Utilities\JsonHelper; -use VDM\Joomla\Utilities\ArrayHelper; -use VDM\Joomla\Utilities\ObjectHelper; -use VDM\Joomla\Utilities\GetHelper; -use VDM\Joomla\Utilities\FileHelper; -use VDM\Joomla\Utilities\String\FieldHelper; -use VDM\Joomla\Utilities\String\TypeHelper; -use VDM\Joomla\Utilities\String\ClassfunctionHelper; -use VDM\Joomla\Utilities\String\NamespaceHelper; -use VDM\Joomla\Utilities\String\PluginHelper; -use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory; -use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix; -use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; -use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; - -/** - * Get class as the main compilers class - */ -class Get -{ - - /** - * The Joomla Version - * - * @var string - * @deprecated 3.3 Use CFactory::_('Config')->joomla_version; - */ - public $joomlaVersion; - - /** - * The Joomla Versions - * - * @var array - */ - public $joomlaVersions = array( - 3 => array('folder_key' => 3, 'xml_version' => 3.9), // only joomla 3 - 3.10 => array('folder_key' => 3, 'xml_version' => 4.0) // legacy joomla 4 - ); - - /** - * The hash placeholder - * - * @var string - * @deprecated 3.3 Use Placefix::h(); - */ - public $hhh = '#' . '#' . '#'; - - /** - * The open bracket placeholder - * - * @var string - * @deprecated 3.3 Use Placefix::b(); - */ - public $bbb = '[' . '[' . '['; - - /** - * The close bracket placeholder - * - * @var string - * @deprecated 3.3 Use Placefix::d(); - */ - public $ddd = ']' . ']' . ']'; - - /** - * The app - * - * @var object - */ - public $app; - - /** - * The Params - * - * @var object - */ - public $params; - - /** - * Add strict field export permissions - * - * @var boolean - */ - public $strictFieldExportPermissions = false; - - /** - * Add text only export options - * - * @var boolean - */ - public $exportTextOnly = false; - - /** - * The global placeholders - * - * @var array - * @deprecated 3.3 Use CFactory::_('Component.Placeholder')->get(); - */ - public $globalPlaceholders = array(); - - /** - * The placeholders - * - * @var array - * @deprecated 3.3 Use CFactory::_('Placeholder')->active[]; - */ - public $placeholders = array(); - - /** - * The Compiler Path - * - * @var object - * @deprecated 3.3 Use CFactory::_('Config')->compiler_path; - */ - public $compilerPath; - - /** - * The JCB Powers Path - * - * @var object - * @deprecated 3.3 Use CFactory::_('Config')->jcb_powers_path; - */ - public $jcbPowersPath; - - /** - * Switch to add assets table fix - * - * @var int - * @deprecated 3.3 Use CFactory::_('Config')->add_assets_table_fix; - */ - public $addAssetsTableFix = 1; - - /** - * Assets table worse case - * - * @var int - */ - public $accessWorseCase; - - /** - * Switch to add assets table name fix - * - * @var bool - */ - public $addAssetsTableNameFix = false; - - /** - * Switch to add custom code placeholders - * - * @var bool - * @deprecated 3.3 Use CFactory::_('Config')->add_placeholders; - */ - public $addPlaceholders = false; - - /** - * Switch to remove line breaks from language strings - * - * @var bool - * @deprecated 3.3 Use CFactory::_('Config')->remove_line_breaks; - */ - public $removeLineBreaks = false; - - /** - * The placeholders for custom code keys - * - * @var array - * @deprecated 3.3 - */ - protected $customCodeKeyPlacholders - = array( - '[' => '[', - ']' => ']', - ',' => ',', - '+' => '+', - '=' => '=' - ); - - /** - * The Component data - * - * @var object - */ - public $componentData; - - /** - * The Switch to add Powers data - * - * @var boolean - * @deprecated 3.3 Use CFactory::_('Config')->add_power; - */ - public $addPower; - - /** - * The Powers data - * - * @var array - * @deprecated 3.3 Use CFactory::_('Power')->active; - */ - public $powers = array(); - - /** - * The state of all Powers - * - * @var array - * @deprecated 3.3 - */ - public $statePowers = array(); - - /** - * The linked Powers - * - * @var array - */ - public $linkedPowers = array(); - - /** - * The Plugins data - * - * @var array - */ - public $joomlaPlugins = array(); - - /** - * The Modules data - * - * @var array - */ - public $joomlaModules = array(); - - /** - * The custom script placeholders - we use the (xxx) to avoid detection it should be (***) - * ##################################---> PHP/JS <---#################################### - * - * New Insert Code = /xxx[INSERT<>$$$$]xxx/ /xxx[/INSERT<>$$$$]xxx/ - * New Replace Code = /xxx[REPLACE<>$$$$]xxx/ /xxx[/REPLACE<>$$$$]xxx/ - * - * //////////////////////////////// when JCB adds it back ////////////////////////////////// - * JCB Add Inserted Code = /xxx[INSERTED$$$$]xxx//xx23xx/ /xxx[/INSERTED$$$$]xxx/ - * JCB Add Replaced Code = /xxx[REPLACED$$$$]xxx//xx25xx/ /xxx[/REPLACED$$$$]xxx/ - * - * /////////////////////////////// changeing existing custom code ///////////////////////// - * Update Inserted Code = /xxx[INSERTED<>$$$$]xxx//xx23xx/ /xxx[/INSERTED<>$$$$]xxx/ - * Update Replaced Code = /xxx[REPLACED<>$$$$]xxx//xx25xx/ /xxx[/REPLACED<>$$$$]xxx/ - * - * The custom script placeholders - we use the (==) to avoid detection it should be (--) - * ###################################---> HTML <---##################################### - * - * New Insert Code = $$$$]==> $$$$]==> - * New Replace Code = $$$$]==> $$$$]==> - * - * ///////////////////////////////// when JCB adds it back /////////////////////////////// - * JCB Add Inserted Code = - * JCB Add Replaced Code = - * - * //////////////////////////// changeing existing custom code /////////////////////////// - * Update Inserted Code = $$$$]==> $$$$]==> - * Update Replaced Code = $$$$]==> $$$$]==> - * - * ////////23 is the ID of the code in the system don't change it!!!!!!!!!!!!!!!!!!!!!!!!!! - * - * @var array - */ - protected $customCodePlaceholders - = array( - 1 => 'REPLACE<>$$$$]', - 2 => 'INSERT<>$$$$]', - 3 => 'REPLACED<>$$$$]', - 4 => 'INSERTED<>$$$$]' - ); - - /** - * The custom code to be added - * - * @var array - * @deprecated 3.3 Use CFactory::_('Customcode')->active - */ - public $customCode; - - /** - * The custom code to be added - * - * @var array - * @deprecated 3.3 - */ - protected $customCodeData = array(); - - /** - * The function name memory ids - * - * @var array - * @deprecated 3.3 Use CFactory::_('Customcode')->functionNameMemory - */ - public $functionNameMemory = array(); - - /** - * The custom code for local memory - * - * @var array - * @deprecated 3.3 Use CFactory::_('Customcode')->memory - */ - public $customCodeMemory = array(); - - /** - * The custom code in local files that already exist in system - * - * @var array - */ - protected $existingCustomCode = array(); - - /** - * The custom code in local files this are new - * - * @var array - */ - protected $newCustomCode = array(); - - /** - * The index of code already loaded - * - * @var array - */ - protected $codeAreadyDone = array(); - - /** - * The external code/string to be added - * - * @var array - * @deprecated 3.3 - */ - protected $externalCodeString = array(); - - /** - * The external code/string cutter - * - * @var array - * @deprecated 3.3 - */ - protected $externalCodeCutter = array(); - - /* - * The line numbers Switch - * - * @var boolean - * @deprecated 3.3 Use CFactory::_('Config')->debug_line_nr; - */ - public $debugLinenr = false; - - /* - * The percentage when a language should be added - * - * @var boolean - */ - public $percentageLanguageAdd = 0; - - /** - * The Placholder Language prefix - * - * @var string - * @deprecated 3.3 Use CFactory::_('Config')->lang_prefix; - */ - public $langPrefix; - - /** - * The Language content - * - * @var array - * @deprecated 3.3 - */ - public $langContent = array(); - - /** - * The Languages bucket - * - * @var array - */ - public $languages - = array('components' => array(), 'modules' => array(), - 'plugins' => array()); - - /** - * The Main Languages - * - * @var string - * @deprecated 3.3 Use CFactory::_('Config')->lang_tag; - */ - public $langTag = 'en-GB'; - - /** - * The Multi Languages bucket - * - * @var array - */ - public $multiLangString = array(); - - /** - * The new lang to add - * - * @var array - */ - protected $newLangStrings = array(); - - /** - * The existing lang to update - * - * @var array - */ - protected $existingLangStrings = array(); - - /** - * The Language JS matching check - * - * @var array - * @deprecated 3.3 Use CFactory::_('Language.Extractor')->langMismatch; - */ - public $langMismatch = array(); - - /** - * The Language SC matching check - * - * @var array - * @deprecated 3.3 Use CFactory::_('Language.Extractor')->langMatch; - */ - public $langMatch = array(); - - /** - * The Language string targets - * - * @var array - * @deprecated 3.3 Use CFactory::_('Config')->lang_string_targets; - */ - public $langStringTargets - = array( - 'Joomla' . '.JText._(', - 'JText:' . ':script(', - 'Text:' . ':_(', // namespace and J version will be found - 'Text:' . ':sprintf(', // namespace and J version will be found - 'JustTEXT:' . ':_(' - ); - - /** - * The Component Code Name - * - * @var string - * @deprecated 3.3 Use CFactory::_('Config')->component_code_name; - */ - public $componentCodeName; - - /** - * The Component Context - * - * @var string - * @deprecated 3.3 Use CFactory::_('Config')->component_context; - */ - public $componentContext; - - /** - * The Component Code Name Length - * - * @var int - * @deprecated 3.3 Use CFactory::_('Config')->component_code_name_length; - */ - public $componentCodeNameLength; - - /** - * The Component ID - * - * @var int - * @deprecated 3.3 Use CFactory::_('Config')->component_id; - */ - public $componentID; - - /** - * The current user - * - * @var array - */ - public $user; - - /** - * The database object - * - * @var array - */ - public $db; - - /** - * The Component version - * - * @var string - */ - public $component_version; - - /** - * The UIKIT Switch - * - * @var boolean - */ - public $uikit = 0; - - /** - * The UIKIT component checker - * - * @var array - */ - public $uikitComp = array(); - - /** - * The FOOTABLE Switch - * - * @var boolean - */ - public $footable = false; - - /** - * The FOOTABLE Version - * - * @var int - */ - public $footableVersion; - - /** - * The Google Chart Switch per view - * - * @var array - */ - public $googleChart = array(); - - /** - * The Google Chart Switch - * - * @var boolean - */ - public $googlechart = false; - - /** - * The Import & Export Switch - * - * @var boolean - */ - public $addEximport = false; - - /** - * The Import & Export View - * - * @var array - */ - public $eximportView = array(); - - /** - * The Import & Export Custom Script - * - * @var array - */ - public $importCustomScripts = array(); - - /** - * The Tag & History Switch - * - * @var boolean - */ - public $setTagHistory = false; - - /** - * The Joomla Fields Switch - * - * @var boolean - */ - public $setJoomlaFields = false; - - /** - * The site edit views - * - * @var array - */ - public $siteEditView = array(); - - /** - * The admin list view filter type - * - * @var array - */ - public $adminFilterType = array(); - - /** - * The Language target - * - * @var string - * @deprecated 3.3 Use CFactory::_('Config')->lang_target; - */ - public $lang = 'admin'; - - /** - * The lang keys for extentions - * - * @var array - * @deprecated 3.3 Use CFactory::_('Language.Extractor')->langKeys; - */ - public $langKeys = array(); - - /** - * The Build target Switch - * - * @var string - * @deprecated 3.3 Use CFactory::_('Config')->build_target; - */ - public $target; - - /** - * The unique codes - * - * @var array - */ - public $uniquecodes = array(); - - /** - * The unique keys - * - * @var array - */ - public $uniquekeys = array(); - - /** - * The Ad contributors Switch - * - * @var boolean - */ - public $addContributors = false; - - /** - * The Custom Script Builder - * - * @var array - * @deprecated 3.3 Use CFactory::_('Customcode.Dispenser')->hub; - */ - public $customScriptBuilder = array(); - - /** - * The Footable Script Builder - * - * @var array - */ - public $footableScripts = array(); - - /** - * The pathe to the bom file to be used - * - * @var string - */ - public $bomPath; - - /** - * The SQL Tweak of admin views - * - * @var array - */ - public $sqlTweak = array(); - - /** - * The validation rules that should be added - * - * @var array - */ - public $validationRules = array(); - - /** - * The validation linked to fields - * - * @var array - */ - public $validationLinkedFields = array(); - - /** - * The admin views data array - * - * @var array - */ - private $_adminViewData = array(); - - /** - * The field data array - * - * @var array - */ - private $_fieldData = array(); - - /** - * The custom alias builder - * - * @var array - */ - public $customAliasBuilder = array(); - - /** - * The field builder type - * - * 1 = StringManipulation - * 2 = SimpleXMLElement - * - * @var int - * @deprecated 3.3 Use CFactory::_('Config')->field_builder_type; - */ - public $fieldBuilderType; - - /** - * Set unique Names - * - * @var array - */ - public $uniqueNames = array(); - - /** - * Set unique Names - * - * @var array - */ - protected $uniqueFieldNames = array(); - - /** - * Category other name bucket - * - * @var array - */ - public $catOtherName = array(); - - /** - * The field relations values - * - * @var array - */ - public $fieldRelations = array(); - - /** - * The views default ordering - * - * @var array - */ - public $viewsDefaultOrdering = array(); - - /** - * Default Fields - * - * @var array - */ - public $defaultFields - = array('created', 'created_by', 'modified', 'modified_by', 'published', - 'ordering', 'access', 'version', 'hits', 'id'); - - /** - * The list join fields - * - * @var array - */ - public $listJoinBuilder = array(); - - /** - * The list head over ride - * - * @var array - */ - public $listHeadOverRide = array(); - - /** - * The linked admin view tabs - * - * @var array - */ - public $linkedAdminViews = array(); - - /** - * The custom admin view tabs - * - * @var array - */ - public $customTabs = array(); - - /** - * The Add Ajax Switch - * - * @var boolean - */ - public $addAjax = false; - - /** - * The Add Site Ajax Switch - * - * @var boolean - */ - public $addSiteAjax = false; - - /** - * The get Module Script Switch - * - * @var array - */ - public $getModule = array(); - - /** - * The template data - * - * @var array - */ - public $templateData = array(); - - /** - * The layout data - * - * @var array - */ - public $layoutData = array(); - - /** - * The Encryption Types - * - * @var array - */ - public $cryptionTypes = array('basic', 'medium', 'whmcs', 'expert'); - - /** - * The WHMCS Encryption Switch - * - * @var boolean - */ - public $whmcsEncryption = false; - - /** - * The Basic Encryption Switch - * - * @var boolean - */ - public $basicEncryption = false; - - /** - * The Medium Encryption Switch - * - * @var boolean - */ - public $mediumEncryption = false; - - /** - * The Custom field Switch per view - * - * @var array - */ - public $customFieldScript = array(); - - /** - * The site main get - * - * @var array - */ - public $siteMainGet = array(); - - /** - * The site dynamic get - * - * @var array - */ - public $siteDynamicGet = array(); - - /** - * The get AS lookup - * - * @var array - */ - public $getAsLookup = array(); - - /** - * The site fields - * - * @var array - */ - public $siteFields = array(); - - /** - * The add SQL - * - * @var array - */ - public $addSQL = array(); - - /** - * The update SQL - * - * @var array - */ - public $updateSQL = array(); - - /** - * The data by alias keys - * - * @var array - */ - protected $dataWithAliasKeys = array(); - - /** - * The Library Manager - * - * @var array - */ - public $libManager = array(); - - /** - * The Libraries - * - * @var array - */ - public $libraries = array(); - - /** - * Is minify Enabled - * - * @var int - * @deprecated 3.3 Use CFactory::_('Config')->minify; - */ - public $minify = 0; - - /** - * Is Tidy Enabled - * - * @var bool - * @deprecated 3.3 Use CFactory::_('Config')->tidy; - */ - public $tidy = false; - - /** - * Set Tidy warning once switch - * - * @var bool - */ - public $setTidyWarning = false; - - /** - * mysql table setting keys - * - * @var array - */ - public $mysqlTableKeys - = array( - 'engine' => array('default' => 'MyISAM'), - 'charset' => array('default' => 'utf8'), - 'collate' => array('default' => 'utf8_general_ci'), - 'row_format' => array('default' => '') - ); - - /** - * mysql table settings - * - * @var array - */ - public $mysqlTableSetting = array(); - - /** - * Constructor - */ - public function __construct() - { - echo '
';
-		// we do not yet have this set as an option
-		$config['remove_line_breaks']
-			= 2; // 2 is global (use the components value)
-		// load application
-		$this->app = JFactory::getApplication();
-		// Set the params
-		$this->params = JComponentHelper::getParams('com_componentbuilder');
-		// Trigger Event: jcb_ce_onBeforeGet
-		CFactory::_J('Event')->trigger('jcb_ce_onBeforeGet', array(&$config, &$this));
-		// set the Joomla version @deprecated
-		$this->joomlaVersion = CFactory::_('Config')->joomla_version;
-		// set the minfy switch of the JavaScript @deprecated
-		$this->minify = CFactory::_('Config')->get('minify', 0);
-		// set the global language @deprecated @deprecated
-		$this->langTag = CFactory::_('Config')->get('lang_tag', 'en-GB');
-		// also set the helper class langTag (for safeStrings)
-		ComponentbuilderHelper::$langTag = CFactory::_('Config')->get('lang_tag', 'en-GB');
-		// setup the main language array
-		$this->languages['components'][CFactory::_('Config')->get('lang_tag', 'en-GB')] = array();
-		// check if we have Tidy enabled @deprecated
-		$this->tidy = CFactory::_('Config')->get('tidy', false);
-		// set the field type builder @deprecated
-		$this->fieldBuilderType = CFactory::_('Config')->get('field_builder_type', 2);
-		// check the field builder type logic
-		if (!CFactory::_('Config')->get('tidy', false) && CFactory::_('Config')->get('field_builder_type', 2) == 2)
-		{
-			// we do not have the tidy extension set fall back to StringManipulation
-			$this->fieldBuilderType = 1;
-			// load the sugestion to use string manipulation
-			$this->app->enqueueMessage(
-				JText::_('

Field Notice

'), 'Notice' - ); - $this->app->enqueueMessage( - JText::_( - 'Since you do not have Tidy extentsion setup on your system, we could not use the SimpleXMLElement class. We instead used string manipulation to build all your fields, this is a faster method, you must inspect the xml files in your component package to see if you are satisfied with the result.
You can make this method your default by opening the global options of JCB and under the Global tab set the Field Builder Type to string manipulation.' - ), 'Notice' - ); - } - CFactory::_('Config')->set('field_builder_type', $this->fieldBuilderType); - // load the compiler path @deprecated - $this->compilerPath = CFactory::_('Config')->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler'); - // load the jcb powers path @deprecated - $this->jcbPowersPath = CFactory::_('Config')->get('jcb_powers_path', 'libraries/jcb_powers'); - // set the component ID @deprecated - $this->componentID = CFactory::_('Config')->component_id; - // set lang prefix @deprecated - $this->langPrefix = CFactory::_('Config')->lang_prefix; - // set component code name @deprecated - $this->componentCodeName = CFactory::_('Config')->component_code_name; - // set component context @deprecated - $this->componentContext = CFactory::_('Config')->component_context; - // set the component name length @deprecated - $this->componentCodeNameLength = CFactory::_('Config')->component_code_name_length; - // add assets table fix @deprecated - $this->addAssetsTableFix = CFactory::_('Config')->add_assets_table_fix; - // set if language strings line breaks should be removed @deprecated - $this->removeLineBreaks = CFactory::_('Config')->remove_line_breaks; - // set if placeholders should be added to customcode @deprecated - $this->addPlaceholders = CFactory::_('Config')->get('add_placeholders', false); - // set if line numbers should be added to comments @deprecated - $this->debugLinenr = CFactory::_('Config')->get('debug_line_nr', false); - // set if powers should be added to component (default is true) @deprecated - $this->addPower = CFactory::_('Config')->get('add_power', true); - // set the current user - $this->user = JFactory::getUser(); - // Get a db connection. - $this->db = JFactory::getDbo(); - // get global placeholders @deprecated - $this->globalPlaceholders = CFactory::_('Component.Placeholder')->get(); - // check if this component is installed on the current website - if ($paths = $this->getLocalInstallPaths()) - { - // start Automatic import of custom code - $today = JFactory::getDate()->toSql(); - // get the custom code from installed files - $this->customCodeFactory($paths, $today); - } - // Trigger Event: jcb_ce_onBeforeGetComponentData - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeGetComponentData', - array(&$this->componentContext, &$this) - ); - // get the component data - $this->componentData = $this->getComponentData(); - // Trigger Event: jcb_ce_onAfterGetComponentData - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterGetComponentData', - array(&$this->componentContext, &$this) - ); - // make sure we have a version - if (strpos($this->componentData->component_version, '.') - === false) - { - $this->componentData->component_version = '1.0.0'; - } - // update the version - if (!isset($this->componentData->old_component_version) - && (ArrayHelper::check($this->addSQL) - || ArrayHelper::check( - $this->updateSQL - ))) - { - // set the new version - $version = (array) explode( - '.', $this->componentData->component_version - ); - // get last key - end($version); - $key = key($version); - // just increment the last - $version[$key]++; - // set the old version - $this->componentData->old_component_version - = $this->componentData->component_version; - // set the new version, and set update switch - $this->componentData->component_version = implode( - '.', $version - ); - } - // get powers *+*+*+*+*+*+*+*PRO - CFactory::_('Power')->load($this->linkedPowers); - // set the percentage when a language can be added - $this->percentageLanguageAdd = (int) $this->params->get( - 'percentagelanguageadd', 50 - ); - - // Trigger Event: jcb_ce_onBeforeGet - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterGet', array(&$this->componentContext, &$this) - ); - - return true; - } - - /** - * Set the tab/space - * - * @param int $nr The number of tag/space - * - * @return string - * - */ - public function _t($nr) - { - // use global method for conformity - return ComponentbuilderHelper::_t($nr); - } - - /** - * Trigger events - * - * @param string $event The event to trigger - * @param mix $data The values to pass to the event/plugin - * - * @return void - * @deprecated 3.3 Use CFactory::_J('Event')->trigger($event, $data); - */ - public function triggerEvent($event, $data) - { - return CFactory::_J('Event')->trigger($event, $data); - } - - /** - * get all System Placeholders - * - * @return array The global placeholders - * @deprecated 3.3 Use CFactory::_('Component.Placeholder')->get(); - */ - public function getGlobalPlaceholders() - { - return CFactory::_('Component.Placeholder')->get(); - } - - /** - * get all Component Data - * - * @param int $id The component ID - * - * @return oject The component data - * - */ - public function getComponentData() - { - // Create a new query object. - $query = $this->db->getQuery(true); - // selection - $selection = array( - 'b.addadmin_views' => 'addadmin_views', - 'b.id' => 'addadmin_views_id', - 'h.addconfig' => 'addconfig', - 'd.addcustom_admin_views' => 'addcustom_admin_views', - 'g.addcustommenus' => 'addcustommenus', - 'j.addfiles' => 'addfiles', - 'j.addfolders' => 'addfolders', - 'j.addfilesfullpath' => 'addfilesfullpath', - 'j.addfoldersfullpath' => 'addfoldersfullpath', - 'c.addsite_views' => 'addsite_views', - 'l.addjoomla_plugins' => 'addjoomla_plugins', - 'k.addjoomla_modules' => 'addjoomla_modules', - 'i.dashboard_tab' => 'dashboard_tab', - 'i.php_dashboard_methods' => 'php_dashboard_methods', - 'i.params' => 'dashboard_params', - 'i.id' => 'component_dashboard_id', - 'f.sql_tweak' => 'sql_tweak', - 'e.version_update' => 'version_update', - 'e.id' => 'version_update_id' - ); - $query->select('a.*'); - $query->select( - $this->db->quoteName( - array_keys($selection), array_values($selection) - ) - ); - // from this table - $query->from('#__componentbuilder_joomla_component AS a'); - // jointer-map - $joiners = array( - 'b' => 'component_admin_views', - 'c' => 'component_site_views', - 'd' => 'component_custom_admin_views', - 'e' => 'component_updates', - 'f' => 'component_mysql_tweaks', - 'g' => 'component_custom_admin_menus', - 'h' => 'component_config', - 'i' => 'component_dashboard', - 'j' => 'component_files_folders', - 'l' => 'component_plugins', - 'k' => 'component_modules' - ); - // load the joins - foreach ($joiners as $as => $join) - { - $query->join( - 'LEFT', - $this->db->quoteName('#__componentbuilder_' . $join, $as) - . ' ON (' . $this->db->quoteName('a.id') . ' = ' - . $this->db->quoteName($as . '.joomla_component') . ')' - ); - } - $query->where( - $this->db->quoteName('a.id') . ' = ' . (int) CFactory::_('Config')->component_id - ); - - // Trigger Event: jcb_ce_onBeforeQueryComponentData - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeQueryComponentData', - array(&$this->componentContext, &$this->componentID, &$query, - &$this->db) - ); - - // Reset the query using our newly populated query object. - $this->db->setQuery($query); - - // Load the results as a list of stdClass objects - $component = $this->db->loadObject(); - - // Trigger Event: jcb_ce_onBeforeModelComponentData - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeModelComponentData', - array(&$this->componentContext, &$component) - ); - - // set updater - $updater = array( - 'unique' => array( - 'addadmin_views' => array('table' => 'component_admin_views', - 'val' => (int) $component->addadmin_views_id, - 'key' => 'id'), - 'addconfig' => array('table' => 'component_config', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'addcustom_admin_views' => array('table' => 'component_custom_admin_views', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'addcustommenus' => array('table' => 'component_custom_admin_menus', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'addfiles' => array('table' => 'component_files_folders', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'addfolders' => array('table' => 'component_files_folders', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'addsite_views' => array('table' => 'component_site_views', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'dashboard_tab' => array('table' => 'component_dashboard', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'sql_tweak' => array('table' => 'component_mysql_tweaks', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component'), - 'version_update' => array('table' => 'component_updates', - 'val' => (int) CFactory::_('Config')->component_id, - 'key' => 'joomla_component') - ), - 'table' => 'joomla_component', - 'key' => 'id', - 'val' => (int) CFactory::_('Config')->component_id - ); - // repeatable fields to update - $searchRepeatables = array( - // repeatablefield => checker - 'addadmin_views' => 'adminview', - 'addconfig' => 'field', - 'addcontributors' => 'name', - 'addcustom_admin_views' => 'customadminview', - 'addcustommenus' => 'name', - 'addfiles' => 'file', - 'addfolders' => 'folder', - 'addsite_views' => 'siteview', - 'dashboard_tab' => 'name', - 'sql_tweak' => 'adminview', - 'version_update' => 'version' - ); - // update the repeatable fields - $component = ComponentbuilderHelper::convertRepeatableFields( - $component, $searchRepeatables, $updater - ); - - // load the global placeholders - if (ArrayHelper::check($this->globalPlaceholders)) - { - CFactory::_('Placeholder')->active = $this->globalPlaceholders; - } - - // set component sales name - $component->sales_name = StringHelper::safe( - $component->system_name - ); - - // set the component name_code - $component->name_code = StringHelper::safe( - $component->name_code - ); - - // ensure version naming is correct - $this->component_version = preg_replace( - '/[^0-9.]+/', '', $component->component_version - ); - - // set the add targets - $addArrayF = array('files' => 'files', - 'folders' => 'folders', - 'filesfullpath' => 'files', - 'foldersfullpath' => 'folders'); - foreach ($addArrayF as $addTarget => $targetHere) - { - // set the add target data - $component->{'add' . $addTarget} = (isset( - $component->{'add' . $addTarget} - ) - && JsonHelper::check( - $component->{'add' . $addTarget} - )) ? json_decode($component->{'add' . $addTarget}, true) : null; - if (ArrayHelper::check( - $component->{'add' . $addTarget} - )) - { - if (isset($component->{$targetHere}) - && ArrayHelper::check( - $component->{$targetHere} - )) - { - foreach ($component->{'add' . $addTarget} as $taget) - { - $component->{$targetHere}[] = $taget; - } - } - else - { - $component->{$targetHere} = array_values( - $component->{'add' . $addTarget} - ); - } - } - unset($component->{'add' . $addTarget}); - } - - // set the uikit switch - $this->uikit = $component->adduikit; - - // set whmcs links if needed - if (1 == $component->add_license - && (!isset($component->whmcs_buy_link) - || !StringHelper::check( - $component->whmcs_buy_link - ))) - { - // update with the whmcs url - if (isset($component->whmcs_url) - && StringHelper::check($component->whmcs_url)) - { - $component->whmcs_buy_link = $component->whmcs_url; - } - // use the company website - elseif (isset($component->website) - && StringHelper::check($component->website)) - { - $component->whmcs_buy_link = $component->website; - $component->whmcs_url = rtrim($component->website, '/') - . '/whmcs'; - } - // none set - else - { - $component->whmcs_buy_link = '#'; - $component->whmcs_url = '#'; - } - } - // since the license details are not set clear - elseif (0 == $component->add_license) - { - $component->whmcs_key = ''; - $component->whmcs_buy_link = ''; - $component->whmcs_url = ''; - } - - // set the footable switch - if ($component->addfootable) - { - $this->footable = true; - // add the version - $this->footableVersion = (1 == $component->addfootable - || 2 == $component->addfootable) ? 2 : $component->addfootable; - } - - // set the addcustommenus data - $component->addcustommenus = (isset($component->addcustommenus) - && JsonHelper::check($component->addcustommenus)) - ? json_decode($component->addcustommenus, true) : null; - if (ArrayHelper::check($component->addcustommenus)) - { - $component->custommenus = array_values($component->addcustommenus); - } - unset($component->addcustommenus); - - // set the sql_tweak data - $component->sql_tweak = (isset($component->sql_tweak) - && JsonHelper::check($component->sql_tweak)) - ? json_decode($component->sql_tweak, true) : null; - if (ArrayHelper::check($component->sql_tweak)) - { - // build the tweak settings - $this->setSqlTweaking( - array_map( - function ($array) { - return array_map( - function ($value) { - if (!ArrayHelper::check($value) - && !ObjectHelper::check( - $value - ) - && strval($value) === strval( - intval($value) - )) - { - return (int) $value; - } - - return $value; - }, $array - ); - }, array_values($component->sql_tweak) - ) - ); - } - unset($component->sql_tweak); - - // set the admin_view data - $component->addadmin_views = (isset($component->addadmin_views) - && JsonHelper::check($component->addadmin_views)) - ? json_decode($component->addadmin_views, true) : null; - if (ArrayHelper::check($component->addadmin_views)) - { - CFactory::_('Config')->lang_target = 'admin'; - CFactory::_('Config')->build_target = 'admin'; - // sort the views according to order - usort( - $component->addadmin_views, function ($a, $b) { - if ($a['order'] != 0 && $b['order'] != 0) - { - return $a['order'] - $b['order']; - } - elseif ($b['order'] != 0 && $a['order'] == 0) - { - return 1; - } - elseif ($a['order'] != 0 && $b['order'] == 0) - { - return 0; - } - - return 1; - } - ); - // build the admin_views settings - $component->admin_views = array_map( - function ($array) { - $array = array_map( - function ($value) { - if (!ArrayHelper::check($value) - && !ObjectHelper::check($value) - && strval($value) === strval(intval($value))) - { - return (int) $value; - } - - return $value; - }, $array - ); - // check if we must add to site - if (isset($array['edit_create_site_view']) - && is_numeric( - $array['edit_create_site_view'] - ) - && $array['edit_create_site_view'] > 0) - { - $this->siteEditView[$array['adminview']] = true; - CFactory::_('Config')->lang_target = 'both'; - } - // set the import/export option for this view - if (isset($array['port']) && $array['port'] - && !$this->addEximport) - { - $this->addEximport = true; - } - // set the history tracking option for this view - if (isset($array['history']) && $array['history'] - && !$this->setTagHistory) - { - $this->setTagHistory = true; - } - // set the custom field integration for this view - if (isset($array['joomla_fields']) - && $array['joomla_fields'] - && !$this->setJoomlaFields) - { - $this->setJoomlaFields = true; - } - // has become a legacy issue, can't remove this - $array['view'] = $array['adminview']; - // get the admin settings/data - $array['settings'] = $this->getAdminViewData( - $array['view'] - ); - // set the filter option for this view - $this->adminFilterType[$array['settings']->name_list_code] - = 1; // Side (old) [default for now] - if (isset($array['filter']) - && is_numeric( - $array['filter'] - ) - && $array['filter'] > 0) - { - $this->adminFilterType[$array['settings']->name_list_code] - = (int) $array['filter']; - } - - return $array; - }, array_values($component->addadmin_views) - ); - } - // set the site_view data - $component->addsite_views = (isset($component->addsite_views) - && JsonHelper::check($component->addsite_views)) - ? json_decode($component->addsite_views, true) : null; - if (ArrayHelper::check($component->addsite_views)) - { - CFactory::_('Config')->lang_target = 'site'; - CFactory::_('Config')->build_target = 'site'; - // build the site_views settings - $component->site_views = array_map( - function ($array) { - // has become a lacacy issue, can't remove this - $array['view'] = $array['siteview']; - $array['settings'] = $this->getCustomViewData( - $array['view'] - ); - - return array_map( - function ($value) { - if (!ArrayHelper::check($value) - && !ObjectHelper::check($value) - && strval($value) === strval(intval($value))) - { - return (int) $value; - } - - return $value; - }, $array - ); - }, array_values($component->addsite_views) - ); - // unset original value - unset($component->addsite_views); - } - - // set the custom_admin_views data - $component->addcustom_admin_views - = (isset($component->addcustom_admin_views) - && JsonHelper::check( - $component->addcustom_admin_views - )) ? json_decode($component->addcustom_admin_views, true) : null; - if (ArrayHelper::check( - $component->addcustom_admin_views - )) - { - CFactory::_('Config')->lang_target = 'admin'; - CFactory::_('Config')->build_target = 'custom_admin'; - // build the custom_admin_views settings - $component->custom_admin_views = array_map( - function ($array) { - // has become a lacacy issue, can't remove this - $array['view'] = $array['customadminview']; - $array['settings'] = $this->getCustomViewData( - $array['view'], 'custom_admin_view' - ); - - return array_map( - function ($value) { - if (!ArrayHelper::check($value) - && !ObjectHelper::check($value) - && strval($value) === strval(intval($value))) - { - return (int) $value; - } - - return $value; - }, $array - ); - }, array_values($component->addcustom_admin_views) - ); - // unset original value - unset($component->addcustom_admin_views); - } - - // set the config data - $component->addconfig = (isset($component->addconfig) - && JsonHelper::check($component->addconfig)) - ? json_decode($component->addconfig, true) : null; - if (ArrayHelper::check($component->addconfig)) - { - $component->config = array_map( - function ($field) { - // make sure the alias and title is 0 - $field['alias'] = 0; - $field['title'] = 0; - // set the field details - $this->setFieldDetails($field); - // set unique name counter - $this->setUniqueNameCounter($field['base_name'], 'configs'); - - // return field - return $field; - }, array_values($component->addconfig) - ); - - // do some house cleaning (for fields) - foreach ($component->config as $field) - { - // so first we lock the field name in - $this->getFieldName($field, 'configs'); - } - // unset original value - unset($component->addconfig); - } - - // set the addcustommenus data - $component->addcontributors = (isset($component->addcontributors) - && JsonHelper::check($component->addcontributors)) - ? json_decode($component->addcontributors, true) : null; - if (ArrayHelper::check($component->addcontributors)) - { - $this->addContributors = true; - $component->contributors = array_values( - $component->addcontributors - ); - } - unset($component->addcontributors); - - // set the addcustommenus data - $component->version_update = (isset($component->version_update) - && JsonHelper::check($component->version_update)) - ? json_decode($component->version_update, true) : null; - if (ArrayHelper::check($component->version_update)) - { - $component->version_update = array_values( - $component->version_update - ); - } - - // build update SQL - $old_admin_views = $this->getHistoryWatch( - 'component_admin_views', $component->addadmin_views_id - ); - $old_component = $this->getHistoryWatch( - 'joomla_component', CFactory::_('Config')->component_id - ); - if ($old_component || $old_admin_views) - { - if (ObjectHelper::check($old_admin_views)) - { - // add new views if found - if (isset($old_admin_views->addadmin_views) - && JsonHelper::check( - $old_admin_views->addadmin_views - )) - { - $this->setUpdateSQL( - json_decode($old_admin_views->addadmin_views, true), - $component->addadmin_views, 'adminview' - ); - } - // check if a new version was manualy set - if (ObjectHelper::check($old_component)) - { - $old_component_version = preg_replace( - '/[^0-9.]+/', '', $old_component->component_version - ); - if ($old_component_version != $this->component_version) - { - // yes, this is a new version, this mean there may be manual sql and must be checked and updated - $component->old_component_version - = $old_component_version; - } - // clear this data - unset($old_component); - } - // clear this data - unset($old_admin_views); - } - } - // unset original value - unset($component->addadmin_views); - - // set GUI mapper - $guiMapper = array('table' => 'joomla_component', - 'id' => (int) CFactory::_('Config')->component_id, - 'field' => 'javascript', 'type' => 'js'); - - // add_javascript - if ($component->add_javascript == 1) - { - CFactory::_('Customcode.Dispenser')->set( - $component->javascript, - 'component_js', - null, - null, - $guiMapper - ); - } - else - { - CFactory::_('Customcode.Dispenser')->hub['component_js'] = ''; - } - unset($component->javascript); - - // add global CSS - $addGlobalCss = array('admin', 'site'); - foreach ($addGlobalCss as $area) - { - // add_css if found - if (isset($component->{'add_css_' . $area}) - && $component->{'add_css_' . $area} == 1 - && isset($component->{'css_' . $area}) - && StringHelper::check( - $component->{'css_' . $area} - )) - { - CFactory::_('Customcode.Dispenser')->set( - $component->{'css_' . $area}, - 'component_css_' . $area - ); - } - else - { - CFactory::_('Customcode.Dispenser')->hub['component_css_' . $area] = ''; - } - unset($component->{'css_' . $area}); - } - // set the lang target - CFactory::_('Config')->lang_target = 'admin'; - // add PHP in ADMIN - $addScriptMethods = array('php_preflight', 'php_postflight', - 'php_method'); - $addScriptTypes = array('install', 'update', 'uninstall'); - // update GUI mapper - $guiMapper['type'] = 'php'; - foreach ($addScriptMethods as $scriptMethod) - { - foreach ($addScriptTypes as $scriptType) - { - if (isset( - $component->{'add_' . $scriptMethod . '_' . $scriptType} - ) - && $component->{'add_' . $scriptMethod . '_' . $scriptType} - == 1 - && StringHelper::check( - $component->{$scriptMethod . '_' . $scriptType} - )) - { - // set GUI mapper field - $guiMapper['field'] = $scriptMethod . '_' . $scriptType; - CFactory::_('Customcode.Dispenser')->set( - $component->{$scriptMethod . '_' . $scriptType}, - $scriptMethod, - $scriptType, - null, - $guiMapper - ); - } - else - { - CFactory::_('Customcode.Dispenser')->hub[$scriptMethod][$scriptType] = ''; - } - unset($component->{$scriptMethod . '_' . $scriptType}); - } - } - // add_php_helper - if ($component->add_php_helper_admin == 1 - && StringHelper::check( - $component->php_helper_admin - )) - { - CFactory::_('Config')->lang_target = 'admin'; - // update GUI mapper - $guiMapper['field'] = 'php_helper_admin'; - $guiMapper['prefix'] = PHP_EOL . PHP_EOL; - CFactory::_('Customcode.Dispenser')->set( - $component->php_helper_admin, - 'component_php_helper_admin', - null, - null, - $guiMapper - ); - unset($guiMapper['prefix']); - } - else - { - CFactory::_('Customcode.Dispenser')->hub['component_php_helper_admin'] = ''; - } - unset($component->php_helper); - // add_admin_event - if ($component->add_admin_event == 1 - && StringHelper::check($component->php_admin_event)) - { - CFactory::_('Config')->lang_target = 'admin'; - // update GUI mapper field - $guiMapper['field'] = 'php_admin_event'; - CFactory::_('Customcode.Dispenser')->set( - $component->php_admin_event, - 'component_php_admin_event', - null, - null, - $guiMapper - ); - } - else - { - CFactory::_('Customcode.Dispenser')->hub['component_php_admin_event'] = ''; - } - unset($component->php_admin_event); - // add_php_helper_both - if ($component->add_php_helper_both == 1 - && StringHelper::check($component->php_helper_both)) - { - CFactory::_('Config')->lang_target = 'both'; - // update GUI mapper field - $guiMapper['field'] = 'php_helper_both'; - $guiMapper['prefix'] = PHP_EOL . PHP_EOL; - CFactory::_('Customcode.Dispenser')->set( - $component->php_helper_both, - 'component_php_helper_both', - null, - null, - $guiMapper - ); - unset($guiMapper['prefix']); - } - else - { - CFactory::_('Customcode.Dispenser')->hub['component_php_helper_both'] = ''; - } - // add_php_helper_site - if ($component->add_php_helper_site == 1 - && StringHelper::check($component->php_helper_site)) - { - CFactory::_('Config')->lang_target = 'site'; - // update GUI mapper field - $guiMapper['field'] = 'php_helper_site'; - $guiMapper['prefix'] = PHP_EOL . PHP_EOL; - CFactory::_('Customcode.Dispenser')->set( - $component->php_helper_site, - 'component_php_helper_site', - null, - null, - $guiMapper - ); - unset($guiMapper['prefix']); - } - else - { - CFactory::_('Customcode.Dispenser')->hub['component_php_helper_site'] = ''; - } - unset($component->php_helper); - // add_site_event - if ($component->add_site_event == 1 - && StringHelper::check($component->php_site_event)) - { - CFactory::_('Config')->lang_target = 'site'; - // update GUI mapper field - $guiMapper['field'] = 'php_site_event'; - CFactory::_('Customcode.Dispenser')->set( - $component->php_site_event, - 'component_php_site_event', - null, - null, - $guiMapper - ); - } - else - { - CFactory::_('Customcode.Dispenser')->hub['component_php_site_event'] = ''; - } - unset($component->php_site_event); - // add_sql - if ($component->add_sql == 1) - { - CFactory::_('Customcode.Dispenser')->set( - $component->sql, - 'sql', - 'component_sql' - ); - } - unset($component->sql); - // add_sql_uninstall - if ($component->add_sql_uninstall == 1) - { - CFactory::_('Customcode.Dispenser')->set( - $component->sql_uninstall, - 'sql_uninstall' - ); - } - unset($component->sql_uninstall); - // bom - if (StringHelper::check($component->bom)) - { - $this->bomPath = CFactory::_('Config')->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/' . $component->bom; - } - else - { - $this->bomPath = CFactory::_('Config')->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/default.txt'; - } - unset($component->bom); - // README - if ($component->addreadme) - { - $component->readme = CFactory::_('Customcode')->add( - base64_decode($component->readme) - ); - } - else - { - $component->readme = ''; - } - - // set lang now - $nowLang = CFactory::_('Config')->lang_target; - CFactory::_('Config')->lang_target = 'admin'; - // dashboard methods - $component->dashboard_tab = (isset($component->dashboard_tab) - && JsonHelper::check($component->dashboard_tab)) - ? json_decode($component->dashboard_tab, true) : null; - if (ArrayHelper::check($component->dashboard_tab)) - { - $component->dashboard_tab = array_map( - function ($array) { - $array['html'] = CFactory::_('Customcode')->add($array['html']); - - return $array; - }, array_values($component->dashboard_tab) - ); - } - else - { - $component->dashboard_tab = ''; - } - // add the php of the dashboard if set - if (isset($component->php_dashboard_methods) - && StringHelper::check( - $component->php_dashboard_methods - )) - { - // load the php for the dashboard model - $component->php_dashboard_methods = CFactory::_('Customcode.Gui')->set( - CFactory::_('Customcode')->add( - base64_decode($component->php_dashboard_methods) - ), - array( - 'table' => 'component_dashboard', - 'field' => 'php_dashboard_methods', - 'id' => (int) $component->component_dashboard_id, - 'type' => 'php') - ); - } - else - { - $component->php_dashboard_methods = ''; - } - // reset back to nowlang - CFactory::_('Config')->lang_target = $nowLang; - - // add the update/sales server FTP details if that is the expected protocol - $serverArray = array('update_server', 'sales_server'); - foreach ($serverArray as $server) - { - if ($component->{'add_' . $server} == 1 - && is_numeric( - $component->{$server} - ) - && $component->{$server} > 0) - { - // get the server protocol - $component->{$server . '_protocol'} - = GetHelper::var( - 'server', (int) $component->{$server}, 'id', 'protocol' - ); - } - else - { - $component->{$server} = 0; - // only change this for sales server (update server can be added loacaly to the zip file) - if ('sales_server' === $server) - { - $component->{'add_' . $server} = 0; - } - $component->{$server . '_protocol'} = 0; - } - } - // set the ignore folders for repo if found - if (isset($component->toignore) - && StringHelper::check( - $component->toignore - )) - { - if (strpos($component->toignore, ',') !== false) - { - $component->toignore = array_map( - 'trim', (array) explode(',', $component->toignore) - ); - } - else - { - $component->toignore = array(trim($component->toignore)); - } - } - else - { - // the default is to ignore the repo folder - $component->toignore = array('.git'); - } - // get all modules - $component->addjoomla_modules = (isset($component->addjoomla_modules) - && JsonHelper::check($component->addjoomla_modules)) - ? json_decode($component->addjoomla_modules, true) : null; - if (ArrayHelper::check($component->addjoomla_modules)) - { - $joomla_modules = array_map( - function ($array) use (&$component) { - // only load the modules whose target association calls for it - if (!isset($array['target']) || $array['target'] != 2) - { - return $this->setJoomlaModule( - $array['module'], $component - ); - } - - return null; - }, array_values($component->addjoomla_modules) - ); - } - unset($component->addjoomla_modules); - // get all plugins - $component->addjoomla_plugins = (isset($component->addjoomla_plugins) - && JsonHelper::check($component->addjoomla_plugins)) - ? json_decode($component->addjoomla_plugins, true) : null; - if (ArrayHelper::check($component->addjoomla_plugins)) - { - $joomla_plugins = array_map( - function ($array) use (&$component) { - // only load the plugins whose target association calls for it - if (!isset($array['target']) || $array['target'] != 2) - { - return $this->setJoomlaPlugin( - $array['plugin'], $component - ); - } - - return null; - }, array_values($component->addjoomla_plugins) - ); - } - unset($component->addjoomla_plugins); - - // Trigger Event: jcb_ce_onAfterModelComponentData - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterModelComponentData', - array(&$this->componentContext, &$component) - ); - - // return the found component data - return $component; - } - - /** - * set the language content values to language content array - * - * @param string $target The target area for the language string - * @param string $language The language key string - * @param string $string The language string - * @param boolean $addPrefix The switch to add langPrefix - * - * @return void - * @deprecated 3.3 Use CFactory::_('Language')->set($target, $language, $string, $addPrefix); - * - */ - public function setLangContent($target, $language, $string, - $addPrefix = false - ) - { - CFactory::_('Language')->set($target, $language, $string, $addPrefix); - } - - /** - * We need to remove all text breaks from all language strings - * - * @param string $string The language string - * - * @return string - * @deprecated 3.3 - * - */ - public function fixLangString(&$string) - { - if (CFactory::_('Config')->remove_line_breaks) - { - return trim(str_replace(array(PHP_EOL, "\r", "\n"), '', $string)); - } - - return trim($string); - } - - /** - * Get all Admin View Data - * - * @param int $id The view ID - * - * @return oject The view data - * - */ - public function getAdminViewData($id) - { - if (!isset($this->_adminViewData[$id])) - { - // Create a new query object. - $query = $this->db->getQuery(true); - - $query->select('a.*'); - $query->select( - $this->db->quoteName( - array( - 'b.addfields', - 'b.id', - 'c.addconditions', - 'c.id', - 'r.addrelations', - 't.tabs' - ), array( - 'addfields', - 'addfields_id', - 'addconditions', - 'addconditions_id', - 'addrelations', - 'customtabs' - ) - ) - ); - $query->from('#__componentbuilder_admin_view AS a'); - $query->join( - 'LEFT', - $this->db->quoteName('#__componentbuilder_admin_fields', 'b') - . ' ON (' . $this->db->quoteName('a.id') . ' = ' - . $this->db->quoteName('b.admin_view') . ')' - ); - $query->join( - 'LEFT', $this->db->quoteName( - '#__componentbuilder_admin_fields_conditions', 'c' - ) . ' ON (' . $this->db->quoteName('a.id') . ' = ' - . $this->db->quoteName('c.admin_view') . ')' - ); - $query->join( - 'LEFT', $this->db->quoteName( - '#__componentbuilder_admin_fields_relations', 'r' - ) . ' ON (' . $this->db->quoteName('a.id') . ' = ' - . $this->db->quoteName('r.admin_view') . ')' - ); - $query->join( - 'LEFT', $this->db->quoteName( - '#__componentbuilder_admin_custom_tabs', 't' - ) . ' ON (' . $this->db->quoteName('a.id') . ' = ' - . $this->db->quoteName('t.admin_view') . ')' - ); - $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); - - // Trigger Event: jcb_ce_onBeforeQueryViewData - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeQueryViewData', - array(&$this->componentContext, &$id, &$query, &$this->db) - ); - - // Reset the query using our newly populated query object. - $this->db->setQuery($query); - - // Load the results as a list of stdClass objects (see later for more options on retrieving data). - $view = $this->db->loadObject(); - - // setup single view code names to use in storing the data - $view->name_single_code = 'oops_hmm_' . $id; - if (isset($view->name_single) && $view->name_single != 'null') - { - $view->name_single_code = StringHelper::safe( - $view->name_single - ); - } - - // setup list view code name to use in storing the data - $view->name_list_code = 'oops_hmmm_' . $id; - if (isset($view->name_list) && $view->name_list != 'null') - { - $view->name_list_code = StringHelper::safe( - $view->name_list - ); - } - - // check the length of the view name (+5 for com_ and _) - $name_length = CFactory::_('Config')->component_code_name_length + strlen( - $view->name_single_code - ) + 5; - // when the name is larger then 49 we need to add the assets table name fix - if ($name_length > 49) - { - $this->addAssetsTableNameFix = true; - } - - // set updater - $updater = array( - 'unique' => array( - 'addfields' => array('table' => 'admin_fields', - 'val' => (int) $view->addfields_id, - 'key' => 'id'), - 'addconditions' => array('table' => 'admin_fields_conditions', - 'val' => (int) $view->addconditions_id, - 'key' => 'id') - ), - 'table' => 'admin_view', - 'key' => 'id', - 'val' => (int) $id - ); - // repeatable fields to update - $searchRepeatables = array( - // repeatablefield => checker - 'addfields' => 'field', - 'addconditions' => 'target_field', - 'ajax_input' => 'value_name', - 'custom_button' => 'name', - 'addlinked_views' => 'adminview', - 'addtables' => 'table', - 'addtabs' => 'name', - 'addpermissions' => 'action' - ); - // update the repeatable fields - $view = ComponentbuilderHelper::convertRepeatableFields( - $view, $searchRepeatables, $updater - ); - - // setup token check - if (!isset(CFactory::_('Customcode.Dispenser')->hub['token'])) - { - CFactory::_('Customcode.Dispenser')->hub['token'] = []; - } - CFactory::_('Customcode.Dispenser')->hub['token'][$view->name_single_code] - = false; - CFactory::_('Customcode.Dispenser')->hub['token'][$view->name_list_code] = false; - // set some placeholders - CFactory::_('Placeholder')->active[Placefix::_h('view')] - = $view->name_single_code; - CFactory::_('Placeholder')->active[Placefix::_h('views')] - = $view->name_list_code; - CFactory::_('Placeholder')->active[Placefix::_h('View')] - = StringHelper::safe( - $view->name_single, 'F' - ); - CFactory::_('Placeholder')->active[Placefix::_h('Views')] - = StringHelper::safe( - $view->name_list, 'F' - ); - CFactory::_('Placeholder')->active[Placefix::_h('VIEW')] - = StringHelper::safe( - $view->name_single, 'U' - ); - CFactory::_('Placeholder')->active[Placefix::_h('VIEWS')] - = StringHelper::safe( - $view->name_list, 'U' - ); - CFactory::_('Placeholder')->active[Placefix::_('view')] - = CFactory::_('Placeholder')->active[Placefix::_h('view')]; - CFactory::_('Placeholder')->active[Placefix::_('views')] - = CFactory::_('Placeholder')->active[Placefix::_h('views')]; - CFactory::_('Placeholder')->active[Placefix::_('View')] - = CFactory::_('Placeholder')->active[Placefix::_h('View')]; - CFactory::_('Placeholder')->active[Placefix::_('Views')] - = CFactory::_('Placeholder')->active[Placefix::_h('Views')]; - CFactory::_('Placeholder')->active[Placefix::_('VIEW')] - = CFactory::_('Placeholder')->active[Placefix::_h('VIEW')]; - CFactory::_('Placeholder')->active[Placefix::_('VIEWS')] - = CFactory::_('Placeholder')->active[Placefix::_h('VIEWS')]; - - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onBeforeModelViewData - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeModelViewData', - array(&$this->componentContext, &$view, &$this->placeholders) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - - // add the tables - $view->addtables = (isset($view->addtables) - && JsonHelper::check($view->addtables)) - ? json_decode($view->addtables, true) : null; - if (ArrayHelper::check($view->addtables)) - { - $view->tables = array_values($view->addtables); - } - unset($view->addtables); - - // set custom tabs - $this->customTabs[$view->name_single_code] = null; - $view->customtabs - = (isset($view->customtabs) - && JsonHelper::check($view->customtabs)) - ? json_decode($view->customtabs, true) : null; - if (ArrayHelper::check($view->customtabs)) - { - // setup custom tabs to global data sets - $this->customTabs[$view->name_single_code] = array_map( - function ($tab) use (&$view) { - // set the view name - $tab['view'] = $view->name_single_code; - // load the dynamic data - $tab['html'] = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add($tab['html']), - CFactory::_('Placeholder')->active - ); - // set the tab name - $tab['name'] = (isset($tab['name']) - && StringHelper::check( - $tab['name'] - )) ? $tab['name'] : 'Tab'; - // set lang - $tab['lang'] = CFactory::_('Config')->lang_prefix . '_' - . StringHelper::safe( - $tab['view'], 'U' - ) . '_' . StringHelper::safe( - $tab['name'], 'U' - ); - CFactory::_('Language')->set( - 'both', $tab['lang'], $tab['name'] - ); - // set code name - $tab['code'] = StringHelper::safe( - $tab['name'] - ); - // check if the permissions for the tab should be added - $_tab = ''; - if (isset($tab['permission']) - && $tab['permission'] == 1) - { - $_tab = Indent::_(1); - } - // check if the php of the tab is set, if not load it now - if (strpos($tab['html'], 'bootstrap.addTab') === false - && strpos($tab['html'], 'bootstrap.endTab') - === false) - { - // add the tab - $tmp = PHP_EOL . $_tab . Indent::_(1) - . ""; - $tmp .= PHP_EOL . $_tab . Indent::_(2) - . '
'; - $tmp .= PHP_EOL . $_tab . Indent::_(3) - . '
'; - $tmp .= PHP_EOL . $_tab . Indent::_(4) . implode( - PHP_EOL . $_tab . Indent::_(4), - (array) explode(PHP_EOL, trim($tab['html'])) - ); - $tmp .= PHP_EOL . $_tab . Indent::_(3) . '
'; - $tmp .= PHP_EOL . $_tab . Indent::_(2) . '
'; - $tmp .= PHP_EOL . $_tab . Indent::_(1) - . ""; - // update html - $tab['html'] = $tmp; - } - else - { - $tab['html'] = PHP_EOL . $_tab . Indent::_(1) - . implode( - PHP_EOL . $_tab . Indent::_(1), - (array) explode(PHP_EOL, trim($tab['html'])) - ); - } - // add the permissions if needed - if (isset($tab['permission']) - && $tab['permission'] == 1) - { - $tmp = PHP_EOL . Indent::_(1) - . "canDo->get('" - . $tab['view'] . "." . $tab['code'] - . ".viewtab')) : ?>"; - $tmp .= $tab['html']; - $tmp .= PHP_EOL . Indent::_(1) . ""; - // update html - $tab['html'] = $tmp; - // set lang for permissions - $tab['lang_permission'] = $tab['lang'] - . '_TAB_PERMISSION'; - $tab['lang_permission_desc'] = $tab['lang'] - . '_TAB_PERMISSION_DESC'; - $tab['lang_permission_title'] - = CFactory::_('Placeholder')->active[Placefix::_h('Views')] . ' View ' - . $tab['name'] . ' Tab'; - CFactory::_('Language')->set( - 'both', $tab['lang_permission'], - $tab['lang_permission_title'] - ); - CFactory::_('Language')->set( - 'both', $tab['lang_permission_desc'], - 'Allow the users in this group to view ' - . $tab['name'] . ' Tab of ' - . CFactory::_('Placeholder')->active[Placefix::_h('views')] - ); - // set the sort key - $tab['sortKey'] - = StringHelper::safe( - $tab['lang_permission_title'] - ); - } - - // return tab - return $tab; - }, array_values($view->customtabs) - ); - } - unset($view->customtabs); - - // add the local tabs - $view->addtabs = (isset($view->addtabs) - && JsonHelper::check($view->addtabs)) - ? json_decode($view->addtabs, true) : null; - if (ArrayHelper::check($view->addtabs)) - { - $nr = 1; - foreach ($view->addtabs as $tab) - { - $view->tabs[$nr] = trim($tab['name']); - $nr++; - } - } - // if Details tab is not set, then set it here - if (!isset($view->tabs[1])) - { - $view->tabs[1] = 'Details'; - } - // always make sure that publishing is lowercase - if (($removeKey = array_search( - 'publishing', array_map('strtolower', $view->tabs) - )) !== false) - { - $view->tabs[$removeKey] = 'publishing'; - } - // make sure to set the publishing tab (just incase we need it) - $view->tabs[15] = 'publishing'; - unset($view->addtabs); - // add permissions - $view->addpermissions = (isset($view->addpermissions) - && JsonHelper::check($view->addpermissions)) - ? json_decode($view->addpermissions, true) : null; - if (ArrayHelper::check($view->addpermissions)) - { - $view->permissions = array_values($view->addpermissions); - } - unset($view->addpermissions); - // reset fields - $view->fields = array(); - // set fields - $view->addfields = (isset($view->addfields) - && JsonHelper::check($view->addfields)) - ? json_decode($view->addfields, true) : null; - if (ArrayHelper::check($view->addfields)) - { - $ignoreFields = array(); - // load the field data - $view->fields = array_map( - function ($field) use ( - &$view, &$ignoreFields - ) { - // set the field details - $this->setFieldDetails( - $field, $view->name_single_code, - $view->name_list_code - ); - // check if this field is a default field OR - // check if this is none database related field - if (in_array($field['base_name'], $this->defaultFields) - || ComponentbuilderHelper::fieldCheck( - $field['type_name'], 'spacer' - ) - || (isset($field['list']) - && $field['list'] == 2)) // 2 = none database - { - $ignoreFields[$field['field']] = $field['field']; - } - - // return field - return $field; - }, array_values($view->addfields) - ); - // build update SQL - if ($old_view = $this->getHistoryWatch( - 'admin_fields', $view->addfields_id - )) - { - // add new fields were added - if (isset($old_view->addfields) - && JsonHelper::check( - $old_view->addfields - )) - { - $this->setUpdateSQL( - json_decode($old_view->addfields, true), - $view->addfields, 'field', $view->name_single_code, - $ignoreFields - ); - } - // clear this data - unset($old_view); - } - // sort the fields according to order - usort( - $view->fields, function ($a, $b) { - if (isset($a['order_list']) && isset($b['order_list'])) - { - if ($a['order_list'] != 0 && $b['order_list'] != 0) - { - return $a['order_list'] - $b['order_list']; - } - elseif ($b['order_list'] != 0 && $a['order_list'] == 0) - { - return 1; - } - elseif ($a['order_list'] != 0 && $b['order_list'] == 0) - { - return 0; - } - - return 1; - } - - return 0; - } - ); - // do some house cleaning (for fields) - foreach ($view->fields as $field) - { - // so first we lock the field name in - $field_name = $this->getFieldName( - $field, $view->name_list_code - ); - // check if the field changed since the last compilation (default fields never change and are always added) - if (!isset($ignoreFields[$field['field']]) - && ObjectHelper::check( - $field['settings']->history - )) - { - // check if the datatype changed - if (isset($field['settings']->history->datatype)) - { - $this->setUpdateSQL( - $field['settings']->history->datatype, - $field['settings']->datatype, 'field.datatype', - $view->name_single_code . '.' . $field_name - ); - } - // check if the datatype lenght changed - if (isset($field['settings']->history->datalenght) - && isset($field['settings']->history->datalenght_other)) - { - $this->setUpdateSQL( - $field['settings']->history->datalenght - . $field['settings']->history->datalenght_other, - $field['settings']->datalenght - . $field['settings']->datalenght_other, - 'field.lenght', - $view->name_single_code . '.' . $field_name - ); - } - // check if the name changed - if (isset($field['settings']->history->xml) - && JsonHelper::check( - $field['settings']->history->xml - )) - { - // only run if this is not an alias or a tag - if ((!isset($field['alias']) || !$field['alias']) - && 'tag' !== $field['settings']->type_name) - { - // build temp field bucket - $tmpfield = array(); - $tmpfield['settings'] = new stdClass(); - // convert the xml json string to normal string - $tmpfield['settings']->xml - = CFactory::_('Customcode')->add( - json_decode( - $field['settings']->history->xml - ) - ); - // add properties from current field as it is generic - $tmpfield['settings']->properties - = $field['settings']->properties; - // add the old name - $tmpfield['settings']->name - = $field['settings']->history->name; - // add the field type from current field since it is generic - $tmpfield['settings']->type_name - = $field['settings']->type_name; - // get the old name - $old_field_name = $this->getFieldName( - $tmpfield - ); - - // only run this if not a multi field - if (!isset($this->uniqueNames[$view->name_list_code]['names'][$field_name])) - { - // this only works when the field is not multiple of the same field - $this->setUpdateSQL( - $old_field_name, $field_name, - 'field.name', - $view->name_single_code . '.' - . $field_name - ); - } - elseif ($old_field_name !== $field_name) - { - // give a notice atleast that the multi fields could have changed and no DB update was done - $this->app->enqueueMessage( - JText::_('

Field Notice

'), - 'Notice' - ); - $this->app->enqueueMessage( - JText::sprintf( - 'You have a field called %s that has been added multiple times to the %s view, the name of that field has changed to %s. Normaly we would automaticly add the update SQL to your component, but with multiple fields this does not work automaticly since it could be that noting changed and it just seems like it did. Therefore you will have to do this manualy if it actualy did change!', - $field_name, - $view->name_single_code, - $old_field_name - ), 'Notice' - ); - } - // remove tmp - unset($tmpfield); - } - } - } - } - } - unset($view->addfields); - // build update SQL - if ($old_view = $this->getHistoryWatch('admin_view', $id)) - { - // check if the view name changed - if (StringHelper::check($old_view->name_single)) - { - $this->setUpdateSQL( - StringHelper::safe( - $old_view->name_single - ), $view->name_single_code, 'table_name', - $view->name_single_code - ); - } - // loop the mysql table settings - foreach ( - $this->mysqlTableKeys as $_mysqlTableKey => $_mysqlTableVal - ) - { - // check if the table engine changed - if (isset($old_view->{'mysql_table_' . $_mysqlTableKey}) - && isset($view->{'mysql_table_' . $_mysqlTableKey})) - { - $this->setUpdateSQL( - $old_view->{'mysql_table_' . $_mysqlTableKey}, - $view->{'mysql_table_' . $_mysqlTableKey}, - 'table_' . $_mysqlTableKey, $view->name_single_code - ); - } - // check if there is no history on table engine, and it changed from the default/global - elseif (isset($view->{'mysql_table_' . $_mysqlTableKey}) - && StringHelper::check( - $view->{'mysql_table_' . $_mysqlTableKey} - ) - && !is_numeric( - $view->{'mysql_table_' . $_mysqlTableKey} - )) - { - $this->setUpdateSQL( - $_mysqlTableVal['default'], - $view->{'mysql_table_' . $_mysqlTableKey}, - 'table_' . $_mysqlTableKey, $view->name_single_code - ); - } - } - // clear this data - unset($old_view); - } - // set the conditions - $view->addconditions = (isset($view->addconditions) - && JsonHelper::check($view->addconditions)) - ? json_decode($view->addconditions, true) : null; - if (ArrayHelper::check($view->addconditions)) - { - $view->conditions = array(); - $ne = 0; - foreach ($view->addconditions as $nr => $conditionValue) - { - if (ArrayHelper::check( - $conditionValue['target_field'] - ) - && ArrayHelper::check($view->fields)) - { - foreach ( - $conditionValue['target_field'] as $fieldKey => - $fieldId - ) - { - foreach ($view->fields as $fieldValues) - { - if ((int) $fieldValues['field'] - == (int) $fieldId) - { - // load the field details - $required - = GetHelper::between( - $fieldValues['settings']->xml, - 'required="', '"' - ); - $required = ($required === 'true' - || $required === '1') ? 'yes' : 'no'; - $filter - = GetHelper::between( - $fieldValues['settings']->xml, - 'filter="', '"' - ); - $filter - = StringHelper::check( - $filter - ) ? $filter : 'none'; - // set the field name - $conditionValue['target_field'][$fieldKey] - = array( - 'name' => $this->getFieldName( - $fieldValues, $view->name_list_code - ), - 'type' => $this->getFieldType( - $fieldValues - ), - 'required' => $required, - 'filter' => $filter - ); - break; - } - } - } - } - - // load match field - if (ArrayHelper::check($view->fields) - && isset($conditionValue['match_field'])) - { - foreach ($view->fields as $fieldValue) - { - if ((int) $fieldValue['field'] - == (int) $conditionValue['match_field']) - { - // set the type - $type = $this->getFieldType($fieldValue); - // set the field details - $conditionValue['match_name'] - = $this->getFieldName( - $fieldValue, $view->name_list_code - ); - $conditionValue['match_type'] = $type; - $conditionValue['match_xml'] - = $fieldValue['settings']->xml; - // if custom field load field being extended - if (!ComponentbuilderHelper::fieldCheck($type)) - { - $conditionValue['match_extends'] - = GetHelper::between( - $fieldValue['settings']->xml, - 'extends="', '"' - ); - } - else - { - $conditionValue['match_extends'] = ''; - } - break; - } - } - } - // set condition values - $view->conditions[$ne] = $conditionValue; - $ne++; - } - } - unset($view->addconditions); - - // prep the buckets - $this->fieldRelations[$view->name_list_code] = array(); - $this->listJoinBuilder[$view->name_list_code] = array(); - $this->listHeadOverRide[$view->name_list_code] = array(); - // set the relations - $view->addrelations = (isset($view->addrelations) - && JsonHelper::check($view->addrelations)) - ? json_decode($view->addrelations, true) : null; - if (ArrayHelper::check($view->addrelations)) - { - foreach ($view->addrelations as $nr => $relationsValue) - { - // only add if list view field is selected and joind fields are set - if (isset($relationsValue['listfield']) - && is_numeric( - $relationsValue['listfield'] - ) - && $relationsValue['listfield'] > 0 - && isset($relationsValue['area']) - && is_numeric($relationsValue['area']) - && $relationsValue['area'] > 0) - { - // do a dynamic update on the set values - if (isset($relationsValue['set']) - && StringHelper::check( - $relationsValue['set'] - )) - { - $relationsValue['set'] = CFactory::_('Customcode')->add( - $relationsValue['set'] - ); - } - // check that the arrays are set - if (!isset($this->fieldRelations[$view->name_list_code][(int) $relationsValue['listfield']]) - || !ArrayHelper::check( - $this->fieldRelations[$view->name_list_code][(int) $relationsValue['listfield']] - )) - { - $this->fieldRelations[$view->name_list_code][(int) $relationsValue['listfield']] - = array(); - } - // load the field relations - $this->fieldRelations[$view->name_list_code][(int) $relationsValue['listfield']][(int) $relationsValue['area']] - = $relationsValue; - // load the list joints - if (isset($relationsValue['joinfields']) - && ArrayHelper::check( - $relationsValue['joinfields'] - )) - { - foreach ($relationsValue['joinfields'] as $join) - { - $this->listJoinBuilder[$view->name_list_code][(int) $join] - = (int) $join; - } - } - // set header over-ride - if (isset($relationsValue['column_name']) - && StringHelper::check( - $relationsValue['column_name'] - )) - { - $check_column_name = trim( - strtolower($relationsValue['column_name']) - ); - // confirm it should really make the over ride - if ('default' !== $check_column_name) - { - $column_name_lang = CFactory::_('Config')->lang_prefix . '_' - . StringHelper::safe( - $view->name_list_code, 'U' - ) . '_' - . StringHelper::safe( - $relationsValue['column_name'], 'U' - ); - CFactory::_('Language')->set( - 'admin', $column_name_lang, - $relationsValue['column_name'] - ); - $this->listHeadOverRide[$view->name_list_code][(int) $relationsValue['listfield']] - = $column_name_lang; - } - } - } - } - } - unset($view->addrelations); - - // set linked views - $this->linkedAdminViews[$view->name_single_code] = null; - $view->addlinked_views - = (isset($view->addlinked_views) - && JsonHelper::check($view->addlinked_views)) - ? json_decode($view->addlinked_views, true) : null; - if (ArrayHelper::check($view->addlinked_views)) - { - // setup linked views to global data sets - $this->linkedAdminViews[$view->name_single_code] = array_values( - $view->addlinked_views - ); - } - unset($view->addlinked_views); - // set the lang target - CFactory::_('Config')->lang_target = 'admin'; - if (isset($this->siteEditView[$id])) - { - CFactory::_('Config')->lang_target = 'both'; - } - // set GUI mapper - $guiMapper = array('table' => 'admin_view', 'id' => (int) $id, - 'type' => 'js'); - // add_javascript - $addArrayJ = array('javascript_view_file', 'javascript_view_footer', - 'javascript_views_file', - 'javascript_views_footer'); - // update GUI mapper - $guiMapper['prefix'] = PHP_EOL; - foreach ($addArrayJ as $scripter) - { - if (isset($view->{'add_' . $scripter}) - && $view->{'add_' . $scripter} == 1 - && StringHelper::check($view->$scripter)) - { - $scripter_target = str_replace( - 'javascript_', '', $scripter - ); - // update GUI mapper field - $guiMapper['field'] = $scripter; - CFactory::_('Customcode.Dispenser')->set( - $view->{$scripter}, - $scripter_target, - $view->name_single_code, - null, - $guiMapper, - true, - true, - true - ); - // check if a token must be set - if (strpos($view->$scripter, "token") !== false - || strpos( - $view->$scripter, "task=ajax" - ) !== false) - { - if (!CFactory::_('Customcode.Dispenser')->hub['token'][$view->name_single_code]) - { - CFactory::_('Customcode.Dispenser')->hub['token'][$view->name_single_code] - = true; - } - } - unset($view->{$scripter}); - } - } - unset($guiMapper['prefix']); - // add_css - $addArrayC = array('css_view', 'css_views'); - foreach ($addArrayC as $scripter) - { - if (isset($view->{'add_' . $scripter}) - && $view->{'add_' . $scripter} == 1 - && StringHelper::check($view->{$scripter})) - { - CFactory::_('Customcode.Dispenser')->set( - $view->{$scripter}, - $scripter, - $view->name_single_code, - null, - array('prefix' => PHP_EOL), - true, - true, - true - ); - unset($view->{$scripter}); - } - } - // update GUI mapper - $guiMapper['type'] = 'php'; - // add_php - $addArrayP = array('php_getitem', 'php_before_save', 'php_save', - 'php_getform', 'php_postsavehook', - 'php_getitems', 'php_getitems_after_all', - 'php_getlistquery', 'php_allowadd', - 'php_allowedit', 'php_before_cancel', - 'php_after_cancel', 'php_before_delete', - 'php_after_delete', 'php_before_publish', - 'php_after_publish', 'php_batchcopy', - 'php_batchmove', 'php_document'); - foreach ($addArrayP as $scripter) - { - if (isset($view->{'add_' . $scripter}) - && $view->{'add_' . $scripter} == 1) - { - // update GUI mapper field - $guiMapper['field'] = $scripter; - CFactory::_('Customcode.Dispenser')->set( - $view->{$scripter}, - $scripter, - $view->name_single_code, - null, - $guiMapper - ); - - // check if we have template or layouts to load - $this->setTemplateAndLayoutData( - $view->{$scripter}, $view->name_single_code - ); - - unset($view->{$scripter}); - } - } - // add the custom buttons - if (isset($view->add_custom_button) - && $view->add_custom_button == 1) - { - $button_code_array = array( - 'php_model', - 'php_controller', - 'php_model_list', - 'php_controller_list' - ); - // set for the code - foreach ($button_code_array as $button_code_field) - { - if (isset($view->{$button_code_field}) - && StringHelper::check( - $view->{$button_code_field} - )) - { - // set field - $guiMapper['field'] = $button_code_field; - $view->{$button_code_field} - = CFactory::_('Customcode.Gui')->set( - CFactory::_('Customcode')->add( - base64_decode($view->{$button_code_field}) - ), - $guiMapper - ); - - // check if we have template or layouts to load - $this->setTemplateAndLayoutData( - $view->{$button_code_field}, $view->name_single_code - ); - } - } - // set the button array - $view->custom_button = (isset($view->custom_button) - && JsonHelper::check($view->custom_button)) - ? json_decode($view->custom_button, true) : null; - if (ArrayHelper::check($view->custom_button)) - { - $view->custom_buttons = array_values($view->custom_button); - } - unset($view->custom_button); - } - // set custom import scripts - if (isset($view->add_custom_import) - && $view->add_custom_import == 1) - { - $addImportArray = array('php_import_ext', 'php_import_display', - 'php_import', 'php_import_setdata', - 'php_import_save', 'php_import_headers', - 'html_import_view'); - foreach ($addImportArray as $importScripter) - { - if (isset($view->$importScripter) - && strlen( - $view->$importScripter - ) > 0) - { - // update GUI mapper field - $guiMapper['field'] = $importScripter; - $guiMapper['type'] = 'php'; - // Make sure html gets HTML comment for placeholder - if ('html_import_view' === $importScripter) - { - $guiMapper['type'] = 'html'; - } - CFactory::_('Customcode.Dispenser')->set( - $view->$importScripter, - $importScripter, - 'import_' . $view->name_list_code, - null, - $guiMapper - ); - unset($view->$importScripter); - } - else - { - // load the default - CFactory::_('Customcode.Dispenser')->hub[$importScripter]['import_' - . $view->name_list_code] - = ComponentbuilderHelper::getDynamicScripts( - $importScripter, true - ); - } - } - } - // add_Ajax for this view - if (isset($view->add_php_ajax) && $view->add_php_ajax == 1) - { - // insure the token is added to edit view atleast - CFactory::_('Customcode.Dispenser')->hub['token'][$view->name_single_code] - = true; - $addAjaxSite = false; - if (isset($this->siteEditView[$id]) && $this->siteEditView[$id]) - { - // we should add this site ajax to front ajax - $addAjaxSite = true; - if (!isset($this->addSiteAjax) || !$this->addSiteAjax) - { - $this->addSiteAjax = true; - } - } - // check if controller input as been set - $view->ajax_input = (isset($view->ajax_input) - && JsonHelper::check($view->ajax_input)) - ? json_decode($view->ajax_input, true) : null; - if (ArrayHelper::check($view->ajax_input)) - { - if ($addAjaxSite) - { - CFactory::_('Customcode.Dispenser')->hub['site']['ajax_controller'][$view->name_single_code] - = array_values($view->ajax_input); - } - CFactory::_('Customcode.Dispenser')->hub['admin']['ajax_controller'][$view->name_single_code] - = array_values($view->ajax_input); - $this->addAjax = true; - unset($view->ajax_input); - } - if (StringHelper::check($view->php_ajaxmethod)) - { - // make sure we are still in PHP - $guiMapper['type'] = 'php'; - // update GUI mapper field - $guiMapper['field'] = 'php_ajaxmethod'; - CFactory::_('Customcode.Dispenser')->set( - $view->php_ajaxmethod, - 'admin', - 'ajax_model', - $view->name_single_code, - $guiMapper - ); - - if ($addAjaxSite) - { - CFactory::_('Customcode.Dispenser')->set( - $view->php_ajaxmethod, - 'site', - 'ajax_model', - $view->name_single_code, - $guiMapper, - false, - false - ); - } - // unset anyway - unset($view->php_ajaxmethod); - $this->addAjax = true; - } - } - // activate alias builder - if (!isset($this->customAliasBuilder[$view->name_single_code]) - && isset($view->alias_builder_type) - && 2 == $view->alias_builder_type - && isset($view->alias_builder) - && JsonHelper::check($view->alias_builder)) - { - // get the aliasFields - $alias_fields = (array) json_decode($view->alias_builder, true); - // get the active fields - $alias_fields = (array) array_filter( - $view->fields, function ($field) use ($alias_fields) { - // check if field is in view fields - if (in_array($field['field'], $alias_fields)) - { - return true; - } - - return false; - } - ); - // check if all is well - if (ArrayHelper::check($alias_fields)) - { - // load the field names - $this->customAliasBuilder[$view->name_single_code] - = (array) array_map( - function ($field) use (&$view) { - return $this->getFieldName( - $field, $view->name_list_code - ); - }, $alias_fields - ); - } - } - // unset - unset($view->alias_builder); - // add_sql - if ($view->add_sql == 1) - { - if ($view->source == 1 && isset($view->tables)) - { - // build and add the SQL dump - CFactory::_('Customcode.Dispenser')->hub['sql'][$view->name_single_code] - = $this->buildSqlDump( - $view->tables, $view->name_single_code, $id - ); - unset($view->tables); - } - elseif ($view->source == 2 && isset($view->sql)) - { - // add the SQL dump string - CFactory::_('Customcode.Dispenser')->set( - $view->sql, - 'sql', - $view->name_single_code - ); - unset($view->sql); - } - } - // load table settings - if (!isset($this->mysqlTableSetting[$view->name_single_code])) - { - $this->mysqlTableSetting[$view->name_single_code] = array(); - } - // set mySql Table Settings - foreach ( - $this->mysqlTableKeys as $_mysqlTableKey => $_mysqlTableVal - ) - { - if (isset($view->{'mysql_table_' . $_mysqlTableKey}) - && StringHelper::check( - $view->{'mysql_table_' . $_mysqlTableKey} - ) - && !is_numeric($view->{'mysql_table_' . $_mysqlTableKey})) - { - $this->mysqlTableSetting[$view->name_single_code][$_mysqlTableKey] - = $view->{'mysql_table_' . $_mysqlTableKey}; - } - else - { - $this->mysqlTableSetting[$view->name_single_code][$_mysqlTableKey] - = $_mysqlTableVal['default']; - } - // remove the table values since we moved to another object - unset($view->{'mysql_table_' . $_mysqlTableKey}); - } - - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onAfterModelViewData - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterModelViewData', - array(&$this->componentContext, &$view, &$this->placeholders) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - - // clear placeholders - unset(CFactory::_('Placeholder')->active[Placefix::_h('view')]); - unset(CFactory::_('Placeholder')->active[Placefix::_h('views')]); - unset(CFactory::_('Placeholder')->active[Placefix::_h('View')]); - unset(CFactory::_('Placeholder')->active[Placefix::_h('Views')]); - unset(CFactory::_('Placeholder')->active[Placefix::_h('VIEW')]); - unset(CFactory::_('Placeholder')->active[Placefix::_h('VIEWS')]); - unset(CFactory::_('Placeholder')->active[Placefix::_('view')]); - unset(CFactory::_('Placeholder')->active[Placefix::_('views')]); - unset(CFactory::_('Placeholder')->active[Placefix::_('View')]); - unset(CFactory::_('Placeholder')->active[Placefix::_('Views')]); - unset(CFactory::_('Placeholder')->active[Placefix::_('VIEW')]); - unset(CFactory::_('Placeholder')->active[Placefix::_('VIEWS')]); - - // store this view to class object - $this->_adminViewData[$id] = $view; - } - - // return the found view data - return $this->_adminViewData[$id]; - } - - /** - * Get all Custom View Data - * - * @param int $id The view ID - * @param string $table The view table - * - * @return oject The view data - * - */ - public function getCustomViewData($id, $table = 'site_view') - { - // Create a new query object. - $query = $this->db->getQuery(true); - - $query->select('a.*'); - $query->from('#__componentbuilder_' . $table . ' AS a'); - $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); - - // Trigger Event: jcb_ce_onBeforeQueryCustomViewData - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeQueryCustomViewData', - array(&$this->componentContext, &$id, &$table, &$query, &$this->db) - ); - - // Reset the query using our newly populated query object. - $this->db->setQuery($query); - - // Load the results as a list of stdClass objects (see later for more options on retrieving data). - $view = $this->db->loadObject(); - // fix alias to use in code - $view->code = $this->uniqueCode( - StringHelper::safe($view->codename) - ); - $view->Code = StringHelper::safe($view->code, 'F'); - $view->CODE = StringHelper::safe($view->code, 'U'); - // Trigger Event: jcb_ce_onBeforeModelCustomViewData - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeModelCustomViewData', - array(&$this->componentContext, &$view, &$id, &$table) - ); - - if ($table === 'site_view') - { - CFactory::_('Config')->lang_target = 'site'; - // repeatable fields to update - $searchRepeatables = array( - // repeatablefield => checker - 'ajax_input' => 'value_name', - 'custom_button' => 'name' - ); - } - else - { - CFactory::_('Config')->lang_target = 'admin'; - // repeatable fields to update - $searchRepeatables = array( - // repeatablefield => checker - 'custom_button' => 'name' - ); - } - // set upater - $updater = array( - 'table' => $table, - 'key' => 'id', - 'val' => (int) $id - ); - // update the repeatable fields - $view = ComponentbuilderHelper::convertRepeatableFields( - $view, $searchRepeatables, $updater - ); - - // set GUI mapper - $guiMapper = array('table' => $table, 'id' => (int) $id, - 'field' => 'default', 'type' => 'html'); - - // set the default data - $view->default = CFactory::_('Customcode.Gui')->set( - CFactory::_('Customcode')->add(base64_decode($view->default)), - $guiMapper - ); - // load context if not set - if (!isset($view->context) - || !StringHelper::check( - $view->context - )) - { - $view->context = $view->code; - } - else - { - // always make sure context is a safe string - $view->context = StringHelper::safe($view->context); - } - // load the library - if (!isset($this->libManager[CFactory::_('Config')->build_target])) - { - $this->libManager[CFactory::_('Config')->build_target] = array(); - } - if (!isset($this->libManager[CFactory::_('Config')->build_target][$view->code])) - { - $this->libManager[CFactory::_('Config')->build_target][$view->code] = array(); - } - // make sure json become array - if (JsonHelper::check($view->libraries)) - { - $view->libraries = json_decode($view->libraries, true); - } - // if we have an array add it - if (ArrayHelper::check($view->libraries)) - { - foreach ($view->libraries as $library) - { - if (!isset($this->libManager[CFactory::_('Config')->build_target][$view->code][$library])) - { - if ($this->getMediaLibrary((int) $library)) - { - $this->libManager[CFactory::_('Config')->build_target][$view->code][(int) $library] - = true; - } - } - } - } - elseif (is_numeric($view->libraries) - && !isset($this->libManager[CFactory::_('Config')->build_target][$view->code][(int) $view->libraries])) - { - if ($this->getMediaLibrary((int) $view->libraries)) - { - $this->libManager[CFactory::_('Config')->build_target][$view->code][(int) $view->libraries] - = true; - } - } - // setup template array - $this->templateData[CFactory::_('Config')->build_target][$view->code] = array(); - // setup template and layout data - $this->setTemplateAndLayoutData($view->default, $view->code); - // insure the uikit components are loaded - if (2 == $this->uikit || 1 == $this->uikit) - { - if (!isset($this->uikitComp[$view->code])) - { - $this->uikitComp[$view->code] = array(); - } - $this->uikitComp[$view->code] - = ComponentbuilderHelper::getUikitComp( - $view->default, $this->uikitComp[$view->code] - ); - } - // check for footable - if (!isset($this->footableScripts[CFactory::_('Config')->build_target][$view->code]) - || !$this->footableScripts[CFactory::_('Config')->build_target][$view->code]) - { - $foundFoo = $this->getFootableScripts($view->default); - if ($foundFoo) - { - $this->footableScripts[CFactory::_('Config')->build_target][$view->code] = true; - } - if ($foundFoo && !$this->footableScripts) - { - $this->footable = true; - } - } - // check for get module - if (!isset($this->getModule[CFactory::_('Config')->build_target][$view->code]) - || !$this->getModule[CFactory::_('Config')->build_target][$view->code]) - { - $found = $this->getGetModule($view->default); - if ($found) - { - $this->getModule[CFactory::_('Config')->build_target][$view->code] = true; - } - } - // set the main get data - $main_get = $this->setGetData( - array($view->main_get), $view->code, $view->context - ); - $view->main_get = $main_get[0]; - // set the custom_get data - $view->custom_get = $this->setGetData( - json_decode($view->custom_get, true), $view->code, $view->context - ); - // set array adding array of scripts - $addArray = array('php_view', 'php_jview', 'php_jview_display', - 'php_document', 'javascript_file', 'js_document', - 'css_document', 'css'); - // set GUI mapper - $guiMapper['type'] = 'php'; - foreach ($addArray as $scripter) - { - if (isset($view->{'add_' . $scripter}) - && $view->{'add_' . $scripter} == 1 - && StringHelper::check($view->$scripter)) - { - // css does not get placholders yet - if (strpos($scripter, 'css') === false) - { - // set field - $guiMapper['field'] = $scripter; - $view->$scripter = CFactory::_('Customcode.Gui')->set( - CFactory::_('Customcode')->add( - base64_decode($view->$scripter) - ), - $guiMapper - ); - } - else - { - $view->$scripter = CFactory::_('Customcode')->add( - base64_decode($view->$scripter) - ); - } - if (2 == $this->uikit || 1 == $this->uikit) - { - if (!isset($this->uikitComp[$view->code])) - { - $this->uikitComp[$view->code] = array(); - } - // set uikit to views - $this->uikitComp[$view->code] - = ComponentbuilderHelper::getUikitComp( - $view->$scripter, $this->uikitComp[$view->code] - ); - } - - $this->setTemplateAndLayoutData($view->$scripter, $view->code); - - // check for footable - if (!isset($this->footableScripts[CFactory::_('Config')->build_target][$view->code]) - || !$this->footableScripts[CFactory::_('Config')->build_target][$view->code]) - { - $foundFoo = $this->getFootableScripts($view->$scripter); - if ($foundFoo) - { - $this->footableScripts[CFactory::_('Config')->build_target][$view->code] - = true; - } - if ($foundFoo && !$this->footable) - { - $this->footable = true; - } - } - // check for google chart - if (!isset($this->googleChart[CFactory::_('Config')->build_target][$view->code]) - || !$this->googleChart[CFactory::_('Config')->build_target][$view->code]) - { - $found = $this->getGoogleChart($view->$scripter); - if ($found) - { - $this->googleChart[CFactory::_('Config')->build_target][$view->code] = true; - } - if ($found && !$this->googlechart) - { - $this->googlechart = true; - } - } - // check for get module - if (!isset($this->getModule[CFactory::_('Config')->build_target][$view->code]) - || !$this->getModule[CFactory::_('Config')->build_target][$view->code]) - { - $found = $this->getGetModule($view->$scripter); - if ($found) - { - $this->getModule[CFactory::_('Config')->build_target][$view->code] = true; - } - } - } - } - // add_Ajax for this view - if (isset($view->add_php_ajax) && $view->add_php_ajax == 1) - { - // ajax target (since we only have two options really) - if ('site' === CFactory::_('Config')->build_target) - { - $target = 'site'; - } - else - { - $target = 'admin'; - } - $setAjax = false; - // check if controller input as been set - $view->ajax_input = (isset($view->ajax_input) - && JsonHelper::check($view->ajax_input)) - ? json_decode($view->ajax_input, true) : null; - if (ArrayHelper::check($view->ajax_input)) - { - CFactory::_('Customcode.Dispenser')->hub[$target]['ajax_controller'][$view->code] - = array_values($view->ajax_input); - $setAjax = true; - } - unset($view->ajax_input); - // load the ajax class mathods (if set) - if (StringHelper::check($view->php_ajaxmethod)) - { - // set field - $guiMapper['field'] = 'php_ajaxmethod'; - CFactory::_('Customcode.Dispenser')->set( - $view->php_ajaxmethod, - $target, - 'ajax_model', - $view->code, - $guiMapper - ); - $setAjax = true; - } - // unset anyway - unset($view->php_ajaxmethod); - // should ajax be set - if ($setAjax) - { - // turn on ajax area - if ('site' === CFactory::_('Config')->build_target) - { - $this->addSiteAjax = true; - } - else - { - $this->addAjax = true; - } - } - } - // add the custom buttons - if (isset($view->add_custom_button) && $view->add_custom_button == 1) - { - $button_code_array = array( - 'php_model', - 'php_controller' - ); - // set for the code - foreach ($button_code_array as $button_code_field) - { - if (isset($view->{$button_code_field}) - && StringHelper::check( - $view->{$button_code_field} - )) - { - // set field - $guiMapper['field'] = $button_code_field; - $view->{$button_code_field} = CFactory::_('Customcode.Gui')->set( - CFactory::_('Customcode')->add( - base64_decode($view->{$button_code_field}) - ), - $guiMapper - ); - } - } - // set the button array - $view->custom_button = (isset($view->custom_button) - && JsonHelper::check($view->custom_button)) - ? json_decode($view->custom_button, true) : null; - if (ArrayHelper::check($view->custom_button)) - { - $view->custom_buttons = array_values($view->custom_button); - } - unset($view->custom_button); - } - - // Trigger Event: jcb_ce_onAfterModelCustomViewData - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterModelCustomViewData', - array(&$this->componentContext, &$view) - ); - - // return the found view data - return $view; - } - - /** - * Get all Field Data - * - * @param int $id The field ID - * @param string $name_single The view edit or single name - * @param string $name_list The view list name - * - * @return oject The field data - * - */ - public function getFieldData($id, $name_single = null, $name_list = null) - { - if ($id > 0 && !isset($this->_fieldData[$id])) - { - // Create a new query object. - $query = $this->db->getQuery(true); - - // Select all the values in the field - $query->select('a.*'); - $query->select( - $this->db->quoteName( - array('c.name', 'c.properties'), - array('type_name', 'properties') - ) - ); - $query->from('#__componentbuilder_field AS a'); - $query->join( - 'LEFT', - $this->db->quoteName('#__componentbuilder_fieldtype', 'c') - . ' ON (' . $this->db->quoteName('a.fieldtype') . ' = ' - . $this->db->quoteName('c.id') . ')' - ); - $query->where( - $this->db->quoteName('a.id') . ' = ' . $this->db->quote($id) - ); - - // Trigger Event: jcb_ce_onBeforeQueryFieldData - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeQueryFieldData', - array(&$this->componentContext, &$id, &$query, &$this->db) - ); - - // Reset the query using our newly populated query object. - $this->db->setQuery($query); - $this->db->execute(); - if ($this->db->getNumRows()) - { - // Load the results as a list of stdClass objects (see later for more options on retrieving data). - $field = $this->db->loadObject(); - - // Trigger Event: jcb_ce_onBeforeModelFieldData - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeModelFieldData', - array(&$this->componentContext, &$field) - ); - - // adding a fix for the changed name of type to fieldtype - $field->type = $field->fieldtype; - - // repeatable fields to update - $searchRepeatables = array( - // repeatablefield => checker - 'properties' => 'name' - ); - // set upater - $updater = array( - 'table' => 'fieldtype', - 'key' => 'id', - 'val' => (int) $id - ); - // update the repeatable fields - $field = ComponentbuilderHelper::convertRepeatableFields( - $field, $searchRepeatables, $updater - ); - - // load the values form params - $field->xml = CFactory::_('Customcode')->add(json_decode($field->xml)); - - // check if we have validate (validation rule set) - $validationRule = GetHelper::between( - $field->xml, 'validate="', '"' - ); - if (StringHelper::check($validationRule)) - { - // make sure it is lowercase - $validationRule = StringHelper::safe( - $validationRule - ); - // link this field to this validation - $this->validationLinkedFields[$id] = $validationRule; - // make sure it is not already set - if (!isset($this->validationRules[$validationRule])) - { - // get joomla core validation names - if ($coreValidationRules - = ComponentbuilderHelper::getExistingValidationRuleNames( - true - )) - { - // make sure this rule is not a core validation rule - if (!in_array( - $validationRule, (array) $coreValidationRules - )) - { - // get the class methods for this rule if it exists - if ($this->validationRules[$validationRule] - = GetHelper::var( - 'validation_rule', $validationRule, 'name', - 'php' - )) - { - // open and set the validation rule - $this->validationRules[$validationRule] - = CFactory::_('Customcode.Gui')->set( - CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode( - $this->validationRules[$validationRule] - ) - ), CFactory::_('Placeholder')->active - ), - array( - 'table' => 'validation_rule', - 'field' => 'php', - 'id' => GetHelper::var( - 'validation_rule', - $validationRule, 'name', 'id' - ), - 'type' => 'php') - ); - } - else - { - // set the notice that this validation rule is custom and was not found (TODO) - unset($this->validationLinkedFields[$id], $this->validationRules[$validationRule]); - } - } - else - { - // remove link (we only want custom validations linked) - unset($this->validationLinkedFields[$id]); - } - } - } - } - - // load the type values form type params - $field->properties = (isset($field->properties) - && JsonHelper::check($field->properties)) - ? json_decode($field->properties, true) : null; - if (ArrayHelper::check($field->properties)) - { - $field->properties = array_values($field->properties); - } - // check if we have WHMCS encryption - if (4 == $field->store - && (!isset($this->whmcsEncryption) - || !$this->whmcsEncryption)) - { - $this->whmcsEncryption = true; - } - // check if we have basic encryption - elseif (3 == $field->store - && (!isset($this->basicEncryption) - || !$this->basicEncryption)) - { - $this->basicEncryption = true; - } - // check if we have better encryption - elseif (5 == $field->store - && (!isset($this->mediumEncryption) - || !$this->mediumEncryption)) - { - $this->mediumEncryption = true; - } - // check if we have better encryption - elseif (6 == $field->store - && StringHelper::check( - $field->on_get_model_field - ) - && StringHelper::check( - $field->on_save_model_field - )) - { - // add only if string lenght found - if (StringHelper::check( - $field->initiator_on_save_model - )) - { - $field->initiator_save_key = md5( - $field->initiator_on_save_model - ); - $field->initiator_save = explode( - PHP_EOL, CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode( - $field->initiator_on_save_model - ) - ), CFactory::_('Placeholder')->active - ) - ); - } - if (StringHelper::check( - $field->initiator_on_save_model - )) - { - $field->initiator_get_key = md5( - $field->initiator_on_get_model - ); - $field->initiator_get = explode( - PHP_EOL, CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode( - $field->initiator_on_get_model - ) - ), CFactory::_('Placeholder')->active - ) - ); - } - // set the field modeling - $field->model_field['save'] = explode( - PHP_EOL, CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode($field->on_save_model_field) - ), CFactory::_('Placeholder')->active - ) - ); - $field->model_field['get'] = explode( - PHP_EOL, CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode($field->on_get_model_field) - ), CFactory::_('Placeholder')->active - ) - ); - // remove the original values - unset($field->on_save_model_field, $field->on_get_model_field, $field->initiator_on_save_model, $field->initiator_on_get_model); - } - - // get the last used version - $field->history = $this->getHistoryWatch('field', $id); - - // Trigger Event: jcb_ce_onAfterModelFieldData - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterModelFieldData', - array(&$this->componentContext, &$field) - ); - - $this->_fieldData[$id] = $field; - } - else - { - return false; - } - } - // check if the script should be added to the view each time this field is called - if ($id > 0 && isset($this->_fieldData[$id])) - { - // check if we should load scripts for single view - if (StringHelper::check($name_single) - && !isset($this->customFieldScript[$name_single][$id])) - { - // add_javascript_view_footer - if ($this->_fieldData[$id]->add_javascript_view_footer == 1 - && StringHelper::check( - $this->_fieldData[$id]->javascript_view_footer - )) - { - $convert__ = true; - if (isset($this->_fieldData[$id]->javascript_view_footer_decoded) - && $this->_fieldData[$id]->javascript_view_footer_decoded) - { - $convert__ = false; - } - CFactory::_('Customcode.Dispenser')->set( - $this->_fieldData[$id]->javascript_view_footer, - 'view_footer', - $name_single, - null, - array( - 'table' => 'field', - 'id' => (int) $id, - 'field' => 'javascript_view_footer', - 'type' => 'js', - 'prefix' => PHP_EOL), - $convert__, - $convert__, - true - ); - if (!isset($this->_fieldData[$id]->javascript_view_footer_decoded)) - { - $this->_fieldData[$id]->javascript_view_footer_decoded - = true; - } - if (strpos( - $this->_fieldData[$id]->javascript_view_footer, - "token" - ) !== false - || strpos( - $this->_fieldData[$id]->javascript_view_footer, - "task=ajax" - ) !== false) - { - if (!isset(CFactory::_('Customcode.Dispenser')->hub['token'])) - { - CFactory::_('Customcode.Dispenser')->hub['token'] = []; - } - if (!isset(CFactory::_('Customcode.Dispenser')->hub['token'][$name_single]) - || !CFactory::_('Customcode.Dispenser')->hub['token'][$name_single]) - { - CFactory::_('Customcode.Dispenser')->hub['token'][$name_single] - = true; - } - } - } - - // add_css_view - if ($this->_fieldData[$id]->add_css_view == 1) - { - $convert__ = true; - if (isset($this->_fieldData[$id]->css_view_decoded) - && $this->_fieldData[$id]->css_view_decoded) - { - $convert__ = false; - } - CFactory::_('Customcode.Dispenser')->set( - $this->_fieldData[$id]->css_view, - 'css_view', - $name_single, - null, - array('prefix' => PHP_EOL), - $convert__, - $convert__, - true - ); - if (!isset($this->_fieldData[$id]->css_view_decoded)) - { - $this->_fieldData[$id]->css_view_decoded = true; - } - } - } - // check if we should load scripts for list views - if (StringHelper::check($name_list) - && !isset($this->customFieldScript[$name_list][$id])) - { - // add_javascript_views_footer - if ($this->_fieldData[$id]->add_javascript_views_footer == 1 - && StringHelper::check( - $this->_fieldData[$id]->javascript_views_footer - )) - { - $convert__ = true; - if (isset($this->_fieldData[$id]->javascript_views_footer_decoded) - && $this->_fieldData[$id]->javascript_views_footer_decoded) - { - $convert__ = false; - } - CFactory::_('Customcode.Dispenser')->set( - $this->_fieldData[$id]->javascript_views_footer, - 'views_footer', - $name_single, - null, - array( - 'table' => 'field', - 'id' => (int) $id, - 'field' => 'javascript_views_footer', - 'type' => 'js', - 'prefix' => PHP_EOL), - $convert__, - $convert__, - true - ); - if (!isset($this->_fieldData[$id]->javascript_views_footer_decoded)) - { - $this->_fieldData[$id]->javascript_views_footer_decoded - = true; - } - if (strpos( - $this->_fieldData[$id]->javascript_views_footer, - "token" - ) !== false - || strpos( - $this->_fieldData[$id]->javascript_views_footer, - "task=ajax" - ) !== false) - { - if (!isset(CFactory::_('Customcode.Dispenser')->hub['token'])) - { - CFactory::_('Customcode.Dispenser')->hub['token'] = []; - } - if (!isset(CFactory::_('Customcode.Dispenser')->hub['token'][$name_list]) - || !CFactory::_('Customcode.Dispenser')->hub['token'][$name_list]) - { - CFactory::_('Customcode.Dispenser')->hub['token'][$name_list] - = true; - } - } - } - // add_css_views - if ($this->_fieldData[$id]->add_css_views == 1) - { - $convert__ = true; - if (isset($this->_fieldData[$id]->css_views_decoded) - && $this->_fieldData[$id]->css_views_decoded) - { - $convert__ = false; - } - CFactory::_('Customcode.Dispenser')->set( - $this->_fieldData[$id]->css_views, - 'css_views', - $name_single, - null, - array('prefix' => PHP_EOL), - $convert__, - $convert__, - true - ); - if (!isset($this->_fieldData[$id]->css_views_decoded)) - { - $this->_fieldData[$id]->css_views_decoded = true; - } - } - } - // add this only once to single view. - $this->customFieldScript[$name_single][$id] = true; - // add this only once to list view. - $this->customFieldScript[$name_list][$id] = true; - } - if ($id > 0 && isset($this->_fieldData[$id])) - { - // return the found field data - return $this->_fieldData[$id]; - } - - return false; - } - - /** - * set Field details - * - * @param object $field The field object - * @param string $singleViewName The single view name - * @param string $listViewName The list view name - * @param string $amicably The peaceful resolve - * - * @return void - * - */ - public function setFieldDetails(&$field, $singleViewName = null, - $listViewName = null, $amicably = '' - ) - { - // set hash - static $hash = 123467890; - // load hash if not found - if (!isset($field['hash'])) - { - $field['hash'] = md5($field['field'] . $hash); - // increment hash - $hash++; - } - // set the settings - if (!isset($field['settings'])) - { - $field['settings'] = $this->getFieldData( - $field['field'], $singleViewName, $listViewName - ); - } - // set real field name - if (!isset($field['base_name'])) - { - $field['base_name'] = $this->getFieldName($field); - } - // set code name for field type - if (!isset($field['type_name'])) - { - $field['type_name'] = $this->getFieldType($field); - } - // check if value is array - if (isset($field['permission']) - && !ArrayHelper::check( - $field['permission'] - ) - && is_numeric($field['permission']) - && $field['permission'] > 0) - { - $field['permission'] = array($field['permission']); - } - // set unique name keeper - if ($listViewName) - { - $this->setUniqueNameCounter( - $field['base_name'], $listViewName . $amicably - ); - } - } - - /** - * get the list default ordering values - * - * @param string $nameListCode The list view name - * - * @return array - * - */ - public function getListViewDefaultOrdering(&$nameListCode) - { - if (isset($this->viewsDefaultOrdering[$nameListCode]) - && $this->viewsDefaultOrdering[$nameListCode]['add_admin_ordering'] - == 1) - { - foreach ( - $this->viewsDefaultOrdering[$nameListCode]['admin_ordering_fields'] - as $order_field - ) - { - if (($order_field_name = $this->getFieldDatabaseName( - $nameListCode, $order_field['field'] - )) !== false) - { - // just the first field is the based ordering state - return array( - 'name' => $order_field_name, - 'direction' => $order_field['direction'] - ); - } - } - } - - // the default - return array( - 'name' => 'a.id', - 'direction' => 'DESC' - ); - } - - /** - * get the field database name and AS prefix - * - * @param string $nameListCode The list view name - * @param int $fieldId The field ID - * @param string $targetArea The area being targeted - * - * @return string - * - */ - public function getFieldDatabaseName($nameListCode, int $fieldId, - $targetArea = 'listBuilder' - ) - { - if (isset($this->{$targetArea}[$nameListCode])) - { - if ($fieldId < 0) - { - switch ($fieldId) - { - case -1: - return 'a.id'; - case -2: - return 'a.ordering'; - case -3: - return 'a.published'; - } - } - foreach ($this->{$targetArea}[$nameListCode] as $field) - { - if ($field['id'] == $fieldId) - { - // now check if this is a category - if ($field['type'] === 'category') - { - return 'c.title'; - } - // set the custom code - elseif (ArrayHelper::check( - $field['custom'] - )) - { - return $field['custom']['db'] . "." - . $field['custom']['text']; - } - else - { - return 'a.' . $field['code']; - } - } - } - } - - return false; - } - - /** - * Get the field's actual type - * - * @param object $field The field object - * - * @return string Success returns field type - * - */ - public function getFieldType(&$field) - { - // check if we have done this already - if (isset($field['type_name'])) - { - return $field['type_name']; - } - // check that we have the poperties - if (isset($field['settings']) - && ObjectHelper::check( - $field['settings'] - ) - && isset($field['settings']->properties) - && ArrayHelper::check( - $field['settings']->properties - )) - { - // search for own custom fields - if (strpos($field['settings']->type_name, '@') !== false) - { - // set own custom field - $field['settings']->own_custom = $field['settings']->type_name; - $field['settings']->type_name = 'Custom'; - } - // set the type name - $type_name = TypeHelper::safe( - $field['settings']->type_name - ); - // if custom (we must use the xml value) - if (strtolower($type_name) === 'custom' - || strtolower($type_name) === 'customuser') - { - $type = TypeHelper::safe( - GetHelper::between( - $field['settings']->xml, 'type="', '"' - ) - ); - } - else - { - // loop over properties looking for the type value - foreach ($field['settings']->properties as $property) - { - if ($property['name'] - === 'type') // type field is never ajustable (unless custom) - { - // force the default value - if (isset($property['example']) - && StringHelper::check( - $property['example'] - )) - { - $type = TypeHelper::safe( - $property['example'] - ); - } - // fall back on the xml settings (not ideal) - else - { - $type = TypeHelper::safe( - GetHelper::between( - $field['settings']->xml, 'type="', '"' - ) - ); - } - // exit foreach loop - break; - } - } - } - // check if the value is set - if (isset($type) && StringHelper::check($type)) - { - return $type; - } - // fallback on type name set in name field (not ideal) - else - { - return $type_name; - } - } - - // fall back to text - return 'text'; - } - - /** - * Get the field's actual name - * - * @param object $field The field object - * @param string $listViewName The list view name - * @param string $amicably The peaceful resolve (for fields in subforms in same view :) - * - * @return string Success returns field name - * - */ - public function getFieldName(&$field, $listViewName = null, $amicably = '') - { - // return the unique name if already set - if (StringHelper::check($listViewName) - && isset($field['hash']) - && isset( - $this->uniqueFieldNames[$listViewName . $amicably - . $field['hash']] - )) - { - return $this->uniqueFieldNames[$listViewName . $amicably - . $field['hash']]; - } - // always make sure we have a field name and type - if (!isset($field['settings']) || !isset($field['settings']->type_name) - || !isset($field['settings']->name)) - { - return 'error'; - } - // set the type name - $type_name = TypeHelper::safe( - $field['settings']->type_name - ); - // set the name of the field - $name = FieldHelper::safe($field['settings']->name); - // check that we have the properties - if (ArrayHelper::check($field['settings']->properties)) - { - foreach ($field['settings']->properties as $property) - { - if ($property['name'] === 'name') - { - // if category then name must be catid (only one per view) - if ($type_name === 'category') - { - // quick check if this is a category linked to view page - $requeSt_id = GetHelper::between( - $field['settings']->xml, 'name="', '"' - ); - if (strpos($requeSt_id, '_request_id') !== false - || strpos($requeSt_id, '_request_catid') !== false) - { - // keep it then, don't change - $name = CFactory::_('Placeholder')->update( - $requeSt_id, CFactory::_('Placeholder')->active - ); - } - else - { - $name = 'catid'; - } - // if list view name is set - if (StringHelper::check($listViewName)) - { - // check if we should use another Text Name as this views name - $otherName = CFactory::_('Placeholder')->update( - GetHelper::between( - $field['settings']->xml, 'othername="', '"' - ), CFactory::_('Placeholder')->active - ); - $otherViews = CFactory::_('Placeholder')->update( - GetHelper::between( - $field['settings']->xml, 'views="', '"' - ), CFactory::_('Placeholder')->active - ); - $otherView = CFactory::_('Placeholder')->update( - GetHelper::between( - $field['settings']->xml, 'view="', '"' - ), CFactory::_('Placeholder')->active - ); - // This is to link other view category - if (StringHelper::check($otherName) - && StringHelper::check( - $otherViews - ) - && StringHelper::check( - $otherView - )) - { - // set other category details - $this->catOtherName[$listViewName] = array( - 'name' => FieldHelper::safe( - $otherName - ), - 'views' => StringHelper::safe( - $otherViews - ), - 'view' => StringHelper::safe( - $otherView - ) - ); - } - } - } - // if tag is set then enable all tag options for this view (only one per view) - elseif ($type_name === 'tag') - { - $name = 'tags'; - } - // if the field is set as alias it must be called alias - elseif (isset($field['alias']) && $field['alias']) - { - $name = 'alias'; - } - else - { - // get value from xml - $xml = FieldHelper::safe( - CFactory::_('Placeholder')->update( - GetHelper::between( - $field['settings']->xml, 'name="', '"' - ), CFactory::_('Placeholder')->active - ) - ); - // check if a value was found - if (StringHelper::check($xml)) - { - $name = $xml; - } - } - // exit foreach loop - break; - } - } - } - // return the value unique - if (StringHelper::check($listViewName) - && isset($field['hash'])) - { - $this->uniqueFieldNames[$listViewName . $amicably . $field['hash']] - = $this->uniqueName($name, $listViewName . $amicably); - - // now return the unique name - return $this->uniqueFieldNames[$listViewName . $amicably - . $field['hash']]; - } - - // fall back to global - return $name; - } - - /** - * Count how many times the same field is used per view - * - * @param string $name The name of the field - * @param string $view The name of the view - * - * @return void - * - */ - protected function setUniqueNameCounter($name, $view) - { - if (!isset($this->uniqueNames[$view])) - { - $this->uniqueNames[$view] = array(); - $this->uniqueNames[$view]['counter'] = array(); - $this->uniqueNames[$view]['names'] = array(); - } - if (!isset($this->uniqueNames[$view]['counter'][$name])) - { - $this->uniqueNames[$view]['counter'][$name] = 1; - - return; - } - // count how many times the field is used - $this->uniqueNames[$view]['counter'][$name]++; - - return; - } - - /** - * Naming each field with an unique name - * - * @param string $name The name of the field - * @param string $view The name of the view - * - * @return string the name - * - */ - protected function uniqueName($name, $view) - { - // only increment if the field name is used multiple times - if (isset($this->uniqueNames[$view]['counter'][$name]) - && $this->uniqueNames[$view]['counter'][$name] > 1) - { - $counter = 1; - // set the unique name - $uniqueName = FieldHelper::safe( - $name . '_' . $counter - ); - while (isset($this->uniqueNames[$view]['names'][$uniqueName])) - { - // increment the number - $counter++; - // try again - $uniqueName = FieldHelper::safe( - $name . '_' . $counter - ); - } - // set the new name number - $this->uniqueNames[$view]['names'][$uniqueName] = $counter; - - // return the unique name - return $uniqueName; - } - - return $name; - } - - /** - * Set get Data - * - * @param array $ids The ids of the dynamic get - * @param string $view_code The view code name - * @param string $context The context for events - * - * @return oject the get dynamicGet data - * - */ - public function setGetData($ids, $view_code, $context) - { - if (ArrayHelper::check($ids)) - { - $ids = implode(',', $ids); - if (StringHelper::check($ids)) - { - // Create a new query object. - $query = $this->db->getQuery(true); - $query->select('a.*'); - $query->from('#__componentbuilder_dynamic_get AS a'); - $query->where('a.id IN (' . $ids . ')'); - $this->db->setQuery($query); - $this->db->execute(); - if ($this->db->getNumRows()) - { - $results = $this->db->loadObjectList(); - $typeArray = array(1 => 'LEFT', 2 => 'LEFT OUTER', - 3 => 'INNER', 4 => 'RIGHT', - 5 => 'RIGHT OUTER'); - $operatorArray = array(1 => '=', 2 => '!=', 3 => '<>', - 4 => '>', 5 => '<', 6 => '>=', - 7 => '<=', 8 => '!<', 9 => '!>', - 10 => 'IN', 11 => 'NOT IN'); - $guiMapper = array('table' => 'dynamic_get', - 'type' => 'php'); - foreach ($results as $_nr => &$result) - { - // Trigger Event: jcb_ce_onBeforeModelDynamicGetData - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeModelDynamicGetData', - array(&$this->componentContext, &$result, &$result->id, &$view_code, &$context) - ); - // set GUI mapper id - $guiMapper['id'] = (int) $result->id; - // add calculations if set - if ($result->addcalculation == 1 - && StringHelper::check( - $result->php_calculation - )) - { - // set GUI mapper field - $guiMapper['field'] = 'php_calculation'; - $result->php_calculation - = CFactory::_('Customcode.Gui')->set( - CFactory::_('Customcode')->add( - base64_decode($result->php_calculation) - ), - $guiMapper - ); - } - // setup the router parse - if (isset($result->add_php_router_parse) - && $result->add_php_router_parse == 1 - && isset($result->php_router_parse) - && StringHelper::check( - $result->php_router_parse - )) - { - // set GUI mapper field - $guiMapper['field'] = 'php_router_parse'; - $result->php_router_parse - = CFactory::_('Customcode.Gui')->set( - CFactory::_('Customcode')->add( - base64_decode($result->php_router_parse) - ), - $guiMapper - ); - } - else - { - $result->add_php_router_parse = 0; - } - // The array of the php scripts that should be added to the script builder - $phpSripts = array('php_before_getitem', - 'php_after_getitem', - 'php_before_getitems', - 'php_after_getitems', - 'php_getlistquery'); - // load the php scripts - foreach ($phpSripts as $script) - { - // add php script to the script builder - if (isset($result->{'add_' . $script}) - && $result->{'add_' . $script} == 1 - && isset($result->{$script}) - && StringHelper::check( - $result->{$script} - )) - { - // move all main gets out to the customscript builder - if ($result->gettype <= 2) - { - // set GUI mapper field - $guiMapper['field'] = $script; - $guiMapper['prefix'] = PHP_EOL . PHP_EOL; - CFactory::_('Customcode.Dispenser')->set( - $result->{$script}, - CFactory::_('Config')->build_target . '_' . $script, - $view_code, - null, - $guiMapper, - true, - true, - true - ); - unset($guiMapper['prefix']); - // remove from local item - unset($result->{$script}); - unset($result->{'add_' . $script}); - } - else - { - // set GUI mapper field - $guiMapper['field'] = $script; - $guiMapper['prefix'] = PHP_EOL; - // only for custom gets - $result->{$script} - = CFactory::_('Customcode.Gui')->set( - CFactory::_('Customcode')->add( - base64_decode($result->{$script}) - ), - $guiMapper - ); - unset($guiMapper['prefix']); - } - } - else - { - // remove from local item - unset($result->{$script}); - unset($result->{'add_' . $script}); - } - } - // set the getmethod code name - $result->key = StringHelper::safe( - $view_code . ' ' . $result->name . ' ' . $result->id - ); - // reset buckets - $result->main_get = array(); - $result->custom_get = array(); - // should joineds and other weaks be added - $addDynamicTweaksJoints = true; - // set source data - switch ($result->main_source) - { - case 1: - // check if auto sync is set - if ($result->select_all == 1) - { - $result->view_selection = '*'; - } - // set the view data - $result->main_get[0]['selection'] - = $this->setDataSelection( - $result->key, $view_code, - $result->view_selection, - $result->view_table_main, 'a', null, 'view' - ); - $result->main_get[0]['as'] = 'a'; - $result->main_get[0]['key'] = $result->key; - $result->main_get[0]['context'] = $context; - unset($result->view_selection); - break; - case 2: - // check if auto sync is set - if ($result->select_all == 1) - { - $result->db_selection = '*'; - } - // set the database data - $result->main_get[0]['selection'] - = $this->setDataSelection( - $result->key, $view_code, - $result->db_selection, - $result->db_table_main, 'a', null, 'db' - ); - $result->main_get[0]['as'] = 'a'; - $result->main_get[0]['key'] = $result->key; - $result->main_get[0]['context'] = $context; - unset($result->db_selection); - break; - case 3: - // set GUI mapper field - $guiMapper['field'] = 'php_custom_get'; - // get the custom query - $customQueryString - = CFactory::_('Customcode.Gui')->set( - CFactory::_('Customcode')->add( - base64_decode($result->php_custom_get) - ), - $guiMapper - ); - // get the table name - $_searchQuery - = GetHelper::between( - $customQueryString, '$query->from(', ')' - ); - if (StringHelper::check( - $_searchQuery - ) - && strpos($_searchQuery, '#__') !== false) - { - $_queryName - = GetHelper::between( - $_searchQuery, '#__', "'" - ); - if (!StringHelper::check( - $_queryName - )) - { - $_queryName - = GetHelper::between( - $_searchQuery, '#__', '"' - ); - } - } - // set to blank if not found - if (!isset($_queryName) - || !StringHelper::check( - $_queryName - )) - { - $_queryName = ''; - } - // set custom script - $result->main_get[0]['selection'] = array( - 'select' => $customQueryString, - 'from' => '', 'table' => '', 'type' => '', - 'name' => $_queryName); - $result->main_get[0]['as'] = 'a'; - $result->main_get[0]['key'] - = $result->key; - $result->main_get[0]['context'] = $context; - // do not add - $addDynamicTweaksJoints = false; - break; - } - // only add if main source is not custom - if ($addDynamicTweaksJoints) - { - // set join_view_table details - $result->join_view_table = json_decode( - $result->join_view_table, true - ); - if (ArrayHelper::check( - $result->join_view_table - )) - { - // start the part of a table bucket - $_part_of_a = array(); - // build relationship - $_relationship = array_map( - function ($op) use (&$_part_of_a) { - $bucket = array(); - // array(on_field_as, on_field) - $bucket['on_field'] = array_map( - 'trim', - explode('.', $op['on_field']) - ); - // array(join_field_as, join_field) - $bucket['join_field'] = array_map( - 'trim', - explode('.', $op['join_field']) - ); - // triget filed that has table a relationship - if ($op['row_type'] == 1 - && ($bucket['on_field'][0] === 'a' - || isset($_part_of_a[$bucket['on_field'][0]]) - || isset($_part_of_a[$bucket['join_field'][0]]))) - { - $_part_of_a[$op['as']] = $op['as']; - } - - return $bucket; - }, $result->join_view_table - ); - // loop joints - foreach ( - $result->join_view_table as $nr => &$option - ) - { - if (StringHelper::check( - $option['selection'] - )) - { - // convert the type - $option['type'] - = $typeArray[$option['type']]; - // convert the operator - $option['operator'] - = $operatorArray[$option['operator']]; - // get the on field values - $on_field - = $_relationship[$nr]['on_field']; - // get the join field values - $join_field - = $_relationship[$nr]['join_field']; - // set selection - $option['selection'] - = $this->setDataSelection( - $result->key, $view_code, - $option['selection'], - $option['view_table'], - $option['as'], $option['row_type'], - 'view' - ); - $option['key'] = $result->key; - $option['context'] = $context; - // load to the getters - if ($option['row_type'] == 1) - { - $result->main_get[] = $option; - if ($on_field[0] === 'a' - || isset($_part_of_a[$join_field[0]]) - || isset($_part_of_a[$on_field[0]])) - { - $this->siteMainGet[CFactory::_('Config')->build_target][$view_code][$option['as']] - = $option['as']; - } - else - { - $this->siteDynamicGet[CFactory::_('Config')->build_target][$view_code][$option['as']][$join_field[1]] - = $on_field[0]; - } - } - elseif ($option['row_type'] == 2) - { - $result->custom_get[] = $option; - if ($on_field[0] != 'a') - { - $this->siteDynamicGet[CFactory::_('Config')->build_target][$view_code][$option['as']][$join_field[1]] - = $on_field[0]; - } - } - } - unset($result->join_view_table[$nr]); - } - } - unset($result->join_view_table); - // set join_db_table details - $result->join_db_table = json_decode( - $result->join_db_table, true - ); - if (ArrayHelper::check( - $result->join_db_table - )) - { - // start the part of a table bucket - $_part_of_a = array(); - // build relationship - $_relationship = array_map( - function ($op) use (&$_part_of_a) { - $bucket = array(); - // array(on_field_as, on_field) - $bucket['on_field'] = array_map( - 'trim', - explode('.', $op['on_field']) - ); - // array(join_field_as, join_field) - $bucket['join_field'] = array_map( - 'trim', - explode('.', $op['join_field']) - ); - // triget filed that has table a relationship - if ($op['row_type'] == 1 - && ($bucket['on_field'][0] === 'a' - || isset($_part_of_a[$bucket['on_field'][0]]) - || isset($_part_of_a[$bucket['join_field'][0]]))) - { - $_part_of_a[$op['as']] = $op['as']; - } - - return $bucket; - }, $result->join_db_table - ); - - // loop joints - foreach ( - $result->join_db_table as $nr => &$option1 - ) - { - if (StringHelper::check( - $option1['selection'] - )) - { - // convert the type - $option1['type'] - = $typeArray[$option1['type']]; - // convert the operator - $option1['operator'] - = $operatorArray[$option1['operator']]; - // get the on field values - $on_field - = $_relationship[$nr]['on_field']; - // get the join field values - $join_field - = $_relationship[$nr]['join_field']; - // set selection - $option1['selection'] - = $this->setDataSelection( - $result->key, $view_code, - $option1['selection'], - $option1['db_table'], - $option1['as'], - $option1['row_type'], 'db' - ); - $option1['key'] = $result->key; - $option1['context'] = $context; - // load to the getters - if ($option1['row_type'] == 1) - { - $result->main_get[] = $option1; - if ($on_field[0] === 'a' - || isset($_part_of_a[$join_field[0]]) - || isset($_part_of_a[$on_field[0]])) - { - $this->siteMainGet[CFactory::_('Config')->build_target][$view_code][$option1['as']] - = $option1['as']; - } - else - { - $this->siteDynamicGet[CFactory::_('Config')->build_target][$view_code][$option1['as']][$join_field[1]] - = $on_field[0]; - } - } - elseif ($option1['row_type'] == 2) - { - $result->custom_get[] = $option1; - if ($on_field[0] != 'a') - { - $this->siteDynamicGet[CFactory::_('Config')->build_target][$view_code][$option1['as']][$join_field[1]] - = $on_field[0]; - } - } - } - unset($result->join_db_table[$nr]); - } - } - unset($result->join_db_table); - // set filter details - $result->filter = json_decode( - $result->filter, true - ); - if (ArrayHelper::check( - $result->filter - )) - { - foreach ($result->filter as $nr => &$option2) - { - if (isset($option2['operator'])) - { - $option2['operator'] - = $operatorArray[$option2['operator']]; - $option2['state_key'] - = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - $option2['state_key'] - ), CFactory::_('Placeholder')->active - ); - $option2['key'] = $result->key; - } - else - { - unset($result->filter[$nr]); - } - } - } - // set where details - $result->where = json_decode($result->where, true); - if (ArrayHelper::check( - $result->where - )) - { - foreach ($result->where as $nr => &$option3) - { - if (isset($option3['operator'])) - { - $option3['operator'] - = $operatorArray[$option3['operator']]; - } - else - { - unset($result->where[$nr]); - } - } - } - else - { - unset($result->where); - } - // set order details - $result->order = json_decode($result->order, true); - if (!ArrayHelper::check( - $result->order - )) - { - unset($result->order); - } - // set grouping - $result->group = json_decode($result->group, true); - if (!ArrayHelper::check( - $result->group - )) - { - unset($result->group); - } - // set global details - $result->global = json_decode( - $result->global, true - ); - if (!ArrayHelper::check( - $result->global - )) - { - unset($result->global); - } - } - else - { - // when we have a custom query script we do not add the dynamic options - unset($result->join_view_table); - unset($result->join_db_table); - unset($result->filter); - unset($result->where); - unset($result->order); - unset($result->group); - unset($result->global); - } - // load the events if any is set - if ($result->gettype == 1 - && JsonHelper::check( - $result->plugin_events - )) - { - $result->plugin_events = json_decode( - $result->plugin_events, true - ); - } - else - { - $result->plugin_events = ''; - } - // Trigger Event: jcb_ce_onAfterModelDynamicGetData - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterModelDynamicGetData', - array(&$this->componentContext, &$result, &$result->id, &$view_code, &$context) - ); - } - - return $results; - } - } - } - - return false; - } - - /** - * Set the script for the customcode dispenser - * - * @param string $script The script - * @param string $first The first key - * @param string|null $second The second key (if not set we use only first key) - * @param string|null $third The third key (if not set we use only first and second key) - * @param array $config The config options - * @param bool $base64 The switch to decode base64 the script - * default: true - * @param bool $dynamic The switch to dynamic update the script - * default: true - * @param bool $add The switch to add to exiting instead of replace - * default: false - * - * @return bool true on success - * @deprecated 3.3 Use CFactory::_('Customcode.Dispenser')->set($script, $first, $second, $third, $config, $base64, $dynamic, $add); - */ - public function setCustomScriptBuilder( - &$script, - string $first, - ?string $second = null, - ?string $third = null, - array $config = array(), - bool $base64 = true, - bool $dynamic = true, - bool $add = false - ): bool - { - return CFactory::_('Customcode.Dispenser')->set($script, $first, $second, $third, $config, $base64, $dynamic, $add); - } - - /** - * get the a script from the custom script builder - * - * @param string $first The first key - * @param string $second The second key - * @param string $prefix The prefix to add in front of the script if found - * @param string $note The switch/note to add to the script - * @param bool $unset The switch to unset the value if found - * @param string $default The switch/string to use as default return if script not found - * @param string $sufix The sufix to add after the script if found - * - * @return mix The string/script if found or the default value if not found - * @deprecated 3.3 Use CFactory::_('Customcode.Dispenser')->get($first, $second, $prefix, $note, $unset, $default, $sufix); - */ - public function getCustomScriptBuilder($first, $second, $prefix = '', - $note = null, $unset = null, $default = null, $sufix = '' - ) - { - return CFactory::_('Customcode.Dispenser')->get($first, $second, $prefix, $note, $unset, $default, $sufix); - } - - /** - * To limit the SQL Demo date build in the views - * - * @param array $settings Tweaking array. - * - * @return void - * - */ - public function setSqlTweaking($settings) - { - if (ArrayHelper::check($settings)) - { - foreach ($settings as $setting) - { - // should sql dump be added - if (1 == $setting['add_sql']) - { - // add sql (by option) - if (2 == $setting['add_sql_options']) - { - // rest always - $id_array = array(); - // by id (first remove backups) - $ids = $setting['ids']; - // now get the ids - if (strpos($ids, ',') !== false) - { - $id_array = (array) array_map( - 'trim', explode(',', $ids) - ); - } - else - { - $id_array[] = trim($ids); - } - $id_array_new = array(); - // check for ranges - foreach ($id_array as $key => $id) - { - if (strpos($id, '=>') !== false) - { - $id_range = (array) array_map( - 'trim', explode('=>', $id) - ); - unset($id_array[$key]); - // build range - if (count((array) $id_range) == 2) - { - $range = range( - $id_range[0], $id_range[1] - ); - $id_array_new = array_merge( - $id_array_new, $range - ); - } - } - } - if (ArrayHelper::check($id_array_new)) - { - $id_array = array_merge($id_array_new, $id_array); - } - // final fixing to array - if (ArrayHelper::check($id_array)) - { - // uniqe - $id_array = array_unique($id_array, SORT_NUMERIC); - // sort - sort($id_array, SORT_NUMERIC); - // now set it to global - $this->sqlTweak[(int) $setting['adminview']]['where'] - = implode(',', $id_array); - } - } - } - else - { - // remove all sql dump options - $this->sqlTweak[(int) $setting['adminview']]['remove'] - = true; - } - } - } - } - - /** - * check if an update SQL is needed - * - * @param mix $old The old values - * @param mix $new The new values - * @param string $type The type of values - * @param int $key The id/key where values changed - * @param array $ignore The ids to ignore - * - * @return void - * - */ - protected function setUpdateSQL($old, $new, $type, $key = null, - $ignore = null - ) - { - // check if there were new items added - if (ArrayHelper::check($new) - && ArrayHelper::check($old)) - { - // check if this is old repeatable field - if (isset($new[$type])) - { - foreach ($new[$type] as $item) - { - $newItem = true; - // check if this is an id to ignore - if (ArrayHelper::check($ignore) - && in_array( - $item, $ignore - )) - { - // don't add ignored ids - $newItem = false; - } - // check if this is old repeatable field - elseif (isset($old[$type]) - && ArrayHelper::check($old[$type])) - { - if (!in_array($item, $old[$type])) - { - // we have a new item, lets add to SQL - $this->setAddSQL($type, $item, $key); - } - // add only once - $newItem = false; - } - elseif (!isset($old[$type])) - { - // we have new values - foreach ($old as $oldItem) - { - if (isset($oldItem[$type])) - { - if ($oldItem[$type] == $item[$type]) - { - $newItem = false; - break; - } - } - else - { - $newItem = false; - break; - } - } - } - else - { - $newItem = false; - } - // add if new - if ($newItem) - { - // we have a new item, lets add to SQL - $this->setAddSQL($type, $item[$type], $key); - } - } - } - else - { - foreach ($new as $item) - { - if (isset($item[$type])) - { - // search to see if this is a new value - $newItem = true; - // check if this is an id to ignore - if (ArrayHelper::check($ignore) - && in_array($item[$type], $ignore)) - { - // don't add ignored ids - $newItem = false; - } - // check if this is old repeatable field - elseif (isset($old[$type]) - && ArrayHelper::check($old[$type])) - { - if (in_array($item[$type], $old[$type])) - { - $newItem = false; - } - } - elseif (!isset($old[$type])) - { - // we have new values - foreach ($old as $oldItem) - { - if (isset($oldItem[$type])) - { - if ($oldItem[$type] == $item[$type]) - { - $newItem = false; - break; - } - } - else - { - $newItem = false; - break; - } - } - } - else - { - $newItem = false; - } - // add if new - if ($newItem) - { - // we have a new item, lets add to SQL - $this->setAddSQL($type, $item[$type], $key); - } - } - } - } - } - elseif ($key - && ((StringHelper::check($new) - && StringHelper::check($old)) - || (is_numeric($new) && is_numeric($old))) - && $new !== $old) - { - // the string changed, lets add to SQL update - if (!isset($this->updateSQL[$type]) - || !ArrayHelper::check($this->updateSQL[$type])) - { - $this->updateSQL[$type] = array(); - } - // set at key - $this->updateSQL[$type][$key] = array('old' => $old, 'new' => $new); - } - } - - /** - * Set the add sql - * - * @param string $type The type of values - * @param int $item The item id to add - * @param int $key The id/key where values changed - * - * @return void - */ - protected function setAddSQL($type, $item, $key) - { - // we have a new item, lets add to SQL - if (!isset($this->addSQL[$type]) - || !ArrayHelper::check( - $this->addSQL[$type] - )) - { - $this->addSQL[$type] = array(); - } - // add key if found - if ($key) - { - if (!isset($this->addSQL[$type][$key]) - || !ArrayHelper::check( - $this->addSQL[$type][$key] - )) - { - $this->addSQL[$type][$key] = array(); - } - $this->addSQL[$type][$key][] = (int) $item; - } - else - { - // convert adminview id to name - if ('adminview' === $type) - { - $this->addSQL[$type][] = StringHelper::safe( - $this->getAdminViewData($item)->name_single - ); - } - else - { - $this->addSQL[$type][] = (int) $item; - } - } - } - - /** - * Get Item History values - * - * @param string $type The type of item - * @param int $id The item ID - * - * @return oject The history - * - */ - protected function getHistoryWatch($type, $id) - { - // quick class object to store old history object - $this->tmpHistory = null; - // Create a new query object. - $query = $this->db->getQuery(true); - - $query->select('h.*'); - $query->from('#__ucm_history AS h'); - $query->where( - $this->db->quoteName('h.ucm_item_id') . ' = ' . (int) $id - ); - // Join over the content type for the type id - $query->join( - 'LEFT', '#__content_types AS ct ON ct.type_id = h.ucm_type_id' - ); - $query->where( - 'ct.type_alias = ' . $this->db->quote( - 'com_componentbuilder.' . $type - ) - ); - $query->order('h.save_date DESC'); - $this->db->setQuery($query, 0, 1); - $this->db->execute(); - if ($this->db->getNumRows()) - { - // new version of this item found - // so we need to mark it as the last compiled version - $newActive = $this->db->loadObject(); - // set the new version watch - $this->setHistoryWatch($newActive, 1); - } - // Get last compiled verion - $query = $this->db->getQuery(true); - - $query->select('h.*'); - $query->from('#__ucm_history AS h'); - $query->where( - $this->db->quoteName('h.ucm_item_id') . ' = ' . (int) $id - ); - $query->where('h.keep_forever = 1'); - $query->where('h.version_note LIKE ' . $this->db->quote('%component%')); - // make sure it does not return the active version - if (isset($newActive) && isset($newActive->version_id)) - { - $query->where('h.version_id != ' . (int) $newActive->version_id); - } - // Join over the content type for the type id - $query->join( - 'LEFT', '#__content_types AS ct ON ct.type_id = h.ucm_type_id' - ); - $query->where( - 'ct.type_alias = ' . $this->db->quote( - 'com_componentbuilder.' . $type - ) - ); - $query->order('h.save_date DESC'); - $this->db->setQuery($query); - $this->db->execute(); - if ($this->db->getNumRows()) - { - // the old active version was found - // so we may need to do an SQL update - // and unmark the old compiled version - $oldActives = $this->db->loadObjectList(); - foreach ($oldActives as $oldActive) - { - // remove old version watch - $this->setHistoryWatch($oldActive, 0); - } - } - - // return the last used history record or null. - return $this->tmpHistory; - } - - /** - * Set Item History Watch - * - * @param Object $object The history object - * @param int $action The action to take - * 0 = remove watch - * 1 = add watch - * @param string $type The type of item - * - * @return bool - * - */ - protected function setHistoryWatch($object, $action) - { - // check the note - if (JsonHelper::check($object->version_note)) - { - $version_note = json_decode($object->version_note, true); - } - else - { - $version_note = array('component' => array()); - } - // set watch - switch ($action) - { - case 0: - // remove watch - if (isset($version_note['component']) - && ($key = array_search( - CFactory::_('Config')->component_id, $version_note['component'] - )) !== false) - { - // last version that was used to build/compile - $this->tmpHistory = json_decode($object->version_data); - // remove it from this component - unset($version_note['component'][$key]); - } - else - { - // since it was not found, no need to update anything - return true; - } - break; - case 1: - // add watch - if (!in_array(CFactory::_('Config')->component_id, $version_note['component'])) - { - $version_note['component'][] = CFactory::_('Config')->component_id; - } - else - { - // since it is there already, no need to update anything - return true; - } - break; - } - // check if we need to still keep this locked - if (isset($version_note['component']) - && ArrayHelper::check($version_note['component'])) - { - // insure component ids are only added once per item - $version_note['component'] = array_unique( - $version_note['component'] - ); - // we may change this, little risky (but since JCB does not have history notes it should be okay for now) - $object->version_note = json_encode($version_note); - $object->keep_forever = '1'; - } - else - { - $object->version_note = ''; - $object->keep_forever = '0'; - } - - // run the update - return $this->db->updateObject('#__ucm_history', $object, 'version_id'); - } - - /** - * Set Template and Layout Data - * - * @param string $default The content to check - * @param string $view The view code name - * @param boolean $found The proof that something was found - * @param array $templates The option to pass templates keys (to avoid search) - * @param array $layouts The option to pass layout keys (to avoid search) - * - * @return boolean if something was found true - * - */ - public function setTemplateAndLayoutData($default, $view, $found = false, - $templates = array(), $layouts = array() - ) - { - // to check inside the templates - $again = array(); - // check if template keys were passed - if (!ArrayHelper::check($templates)) - { - // set the Template data - $temp1 = GetHelper::allBetween( - $default, "\$this->loadTemplate('", "')" - ); - $temp2 = GetHelper::allBetween( - $default, '$this->loadTemplate("', '")' - ); - if (ArrayHelper::check($temp1) - && ArrayHelper::check($temp2)) - { - $templates = array_merge($temp1, $temp2); - } - else - { - if (ArrayHelper::check($temp1)) - { - $templates = $temp1; - } - elseif (ArrayHelper::check($temp2)) - { - $templates = $temp2; - } - } - } - // check if we found templates - if (ArrayHelper::check($templates, true)) - { - foreach ($templates as $template) - { - if (!isset($this->templateData[CFactory::_('Config')->build_target][$view]) - || !array_key_exists( - $template, $this->templateData[CFactory::_('Config')->build_target][$view] - )) - { - $data = $this->getDataWithAlias( - $template, 'template', $view - ); - if (ArrayHelper::check($data)) - { - // load it to the template data array - $this->templateData[CFactory::_('Config')->build_target][$view][$template] - = $data; - // call self to get child data - $again[] = array($data['html'], $view); - $again[] = array($data['php_view'], $view); - } - } - // check if we have the template set (and nothing yet found) - if (!$found - && isset($this->templateData[CFactory::_('Config')->build_target][$view][$template])) - { - // something was found - $found = true; - } - } - } - // check if layout keys were passed - if (!ArrayHelper::check($layouts)) - { - // set the Layout data - $lay1 = GetHelper::allBetween( - $default, "JLayoutHelper::render('", "'," - ); - $lay2 = GetHelper::allBetween( - $default, 'JLayoutHelper::render("', '",' - ); - if (ArrayHelper::check($lay1) - && ArrayHelper::check($lay2)) - { - $layouts = array_merge($lay1, $lay2); - } - else - { - if (ArrayHelper::check($lay1)) - { - $layouts = $lay1; - } - elseif (ArrayHelper::check($lay2)) - { - $layouts = $lay2; - } - } - } - // check if we found layouts - if (ArrayHelper::check($layouts, true)) - { - // get the other target if both - $_target = null; - if (CFactory::_('Config')->lang_target === 'both') - { - $_target = (CFactory::_('Config')->build_target === 'admin') ? 'site' : 'admin'; - } - foreach ($layouts as $layout) - { - if (!isset($this->layoutData[CFactory::_('Config')->build_target]) - || !ArrayHelper::check( - $this->layoutData[CFactory::_('Config')->build_target] - ) - || !array_key_exists( - $layout, $this->layoutData[CFactory::_('Config')->build_target] - )) - { - $data = $this->getDataWithAlias($layout, 'layout', $view); - if (ArrayHelper::check($data)) - { - // load it to the layout data array - $this->layoutData[CFactory::_('Config')->build_target][$layout] = $data; - // check if other target is set - if (CFactory::_('Config')->lang_target === 'both' && $_target) - { - $this->layoutData[$_target][$layout] = $data; - } - // call self to get child data - $again[] = array($data['html'], $view); - $again[] = array($data['php_view'], $view); - } - } - // check if we have the layout set (and nothing yet found) - if (!$found && isset($this->layoutData[CFactory::_('Config')->build_target][$layout])) - { - // something was found - $found = true; - } - } - } - // check again - if (ArrayHelper::check($again)) - { - foreach ($again as $go) - { - $found = $this->setTemplateAndLayoutData( - $go[0], $go[1], $found - ); - } - } - - // return the proof that something was found - return $found; - } - - /** - * Get Data With Alias - * - * @param string $n_ame The alias name - * @param string $table The table where to find the alias - * @param string $view The view code name - * - * @return array The data found with the alias - * - */ - protected function getDataWithAlias($n_ame, $table, $view) - { - // if not set, get all keys in table and set by ID - $this->setDataWithAliasKeys($table); - // now check if key is found - $name = preg_replace("/[^A-Za-z]/", '', $n_ame); - if (isset($this->dataWithAliasKeys[$table][$name])) - { - $ID = $this->dataWithAliasKeys[$table][$name]; - } - elseif (isset($this->dataWithAliasKeys[$table][$n_ame])) - { - $ID = $this->dataWithAliasKeys[$table][$n_ame]; - } - else - { - return false; - } - // Create a new query object. - $query = $this->db->getQuery(true); - $query->select('a.*'); - $query->from('#__componentbuilder_' . $table . ' AS a'); - $query->where( - $this->db->quoteName('a.id') . ' = ' . (int) $ID - ); - // get the other target if both - $_targets = array(CFactory::_('Config')->build_target); - if (CFactory::_('Config')->lang_target === 'both') - { - $_targets = array('site', 'admin'); - } - $this->db->setQuery($query); - // get the row - $row = $this->db->loadObject(); - // we load this layout - $php_view = ''; - if ($row->add_php_view == 1 - && StringHelper::check($row->php_view)) - { - $php_view = CFactory::_('Customcode.Gui')->set( - CFactory::_('Customcode')->add(base64_decode($row->php_view)), - array( - 'table' => $table, - 'field' => 'php_view', - 'id' => (int) $row->id, - 'type' => 'php') - ); - } - $contnent = CFactory::_('Customcode.Gui')->set( - CFactory::_('Customcode')->add(base64_decode($row->{$table})), - array( - 'table' => $table, - 'field' => $table, - 'id' => (int) $row->id, - 'type' => 'html') - ); - // load all targets - foreach ($_targets as $_target) - { - // load the library - if (!isset($this->libManager[$_target])) - { - $this->libManager[$_target] = array(); - } - if (!isset($this->libManager[$_target][$view])) - { - $this->libManager[$_target][$view] = array(); - } - // make sure json become array - if (JsonHelper::check($row->libraries)) - { - $row->libraries = json_decode($row->libraries, true); - } - // if we have an array add it - if (ArrayHelper::check($row->libraries)) - { - foreach ($row->libraries as $library) - { - if (!isset($this->libManager[$_target][$view][$library])) - { - if ($this->getMediaLibrary((int) $library)) - { - $this->libManager[$_target][$view][(int) $library] - = true; - } - } - } - } - elseif (is_numeric($row->libraries) - && !isset($this->libManager[$_target][$view][(int) $row->libraries])) - { - if ($this->getMediaLibrary((int) $row->libraries)) - { - $this->libManager[$_target][$view][(int) $row->libraries] - = true; - } - } - // set footable to views and turn it on - if (!isset($this->footableScripts[$_target][$view]) - || !$this->footableScripts[$_target][$view]) - { - $foundFoo = $this->getFootableScripts($contnent); - if ($foundFoo) - { - $this->footableScripts[$_target][$view] = true; - } - if ($foundFoo && !$this->footable) - { - $this->footable = true; - } - } - // set google charts to views and turn it on - if (!isset($this->googleChart[$_target][$view]) - || !$this->googleChart[$_target][$view]) - { - $foundA = $this->getGoogleChart($php_view); - $foundB = $this->getGoogleChart($contnent); - if ($foundA || $foundB) - { - $this->googleChart[$_target][$view] = true; - } - if ($foundA || $foundB && !$this->googlechart) - { - $this->googlechart = true; - } - } - // check for get module - if (!isset($this->getModule[$_target][$view]) - || !$this->getModule[$_target][$view]) - { - $foundA = $this->getGetModule($php_view); - $foundB = $this->getGetModule($contnent); - if ($foundA || $foundB) - { - $this->getModule[$_target][$view] = true; - } - } - } - // load UIKIT if needed - if (2 == $this->uikit || 1 == $this->uikit) - { - if (!isset($this->uikitComp[$view])) - { - $this->uikitComp[$view] = array(); - } - // set uikit to views - $this->uikitComp[$view] - = ComponentbuilderHelper::getUikitComp( - $contnent, $this->uikitComp[$view] - ); - } - - return array( - 'id' => $row->id, - 'html' => CFactory::_('Customcode.Gui')->set( - $contnent, - array( - 'table' => $table, - 'field' => $table, - 'id' => $row->id, - 'type' => 'html' - ) - ), - 'php_view' => CFactory::_('Customcode.Gui')->set( - $php_view, - array( - 'table' => $table, - 'field' => 'php_view', - 'id' => $row->id, - 'type' => 'php' - ) - ) - ); - } - - /** - * set Data With Alias Keys - * - * @param string $table The table where to find the alias - * - * @return void - * - */ - protected function setDataWithAliasKeys($table) - { - // now check if key is found - if (!isset($this->dataWithAliasKeys[$table])) - { - // load this table keys - $this->dataWithAliasKeys[$table] = array(); - // Create a new query object. - $query = $this->db->getQuery(true); - $query->select(array('a.id', 'a.alias')); - $query->from('#__componentbuilder_' . $table . ' AS a'); - $this->db->setQuery($query); - $rows = $this->db->loadObjectList(); - // check if we have an array - if (ArrayHelper::check($rows)) - { - foreach ($rows as $row) - { - // build the key - $k_ey = StringHelper::safe($row->alias); - $key = preg_replace("/[^A-Za-z]/", '', $k_ey); - // set the keys - $this->dataWithAliasKeys[$table][$row->alias] = $row->id; - $this->dataWithAliasKeys[$table][$k_ey] = $row->id; - $this->dataWithAliasKeys[$table][$key] = $row->id; - } - } - } - } - - /** - * Get Media Library Data and store globally - * - * @param string $id the library id - * - * @return bool true on success - * - */ - protected function getMediaLibrary($id) - { - // check if the lib has already been set - if (!isset($this->libraries[$id])) - { - // make sure we should continue and that the lib is not already being loaded - switch ($id) - { - case 1: // No Library - return false; - break; - case 3: // Uikit v3 - if (2 == $this->uikit || 3 == $this->uikit) - { - // already being loaded - $this->libraries[$id] = false; - } - break; - case 4: // Uikit v2 - if (2 == $this->uikit || 1 == $this->uikit) - { - // already being loaded - $this->libraries[$id] = false; - } - break; - case 5: // FooTable v2 - if (!isset($this->footableVersion) - || 2 == $this->footableVersion) - { - // already being loaded - $this->libraries[$id] = false; - } - break; - case 6: // FooTable v3 - if (3 == $this->footableVersion) - { - // already being loaded - $this->libraries[$id] = false; - } - break; - } - } - // check if the lib has already been set - if (!isset($this->libraries[$id])) - { - $query = $this->db->getQuery(true); - - $query->select('a.*'); - $query->select( - $this->db->quoteName( - array( - 'a.id', - 'a.name', - 'a.how', - 'a.type', - 'a.addconditions', - 'b.addconfig', - 'c.addfiles', - 'c.addfolders', - 'c.addfilesfullpath', - 'c.addfoldersfullpath', - 'c.addurls', - 'a.php_setdocument' - ), array( - 'id', - 'name', - 'how', - 'type', - 'addconditions', - 'addconfig', - 'addfiles', - 'addfolders', - 'addfilesfullpath', - 'addfoldersfullpath', - 'addurls', - 'php_setdocument' - ) - ) - ); - // from these tables - $query->from('#__componentbuilder_library AS a'); - $query->join( - 'LEFT', - $this->db->quoteName('#__componentbuilder_library_config', 'b') - . ' ON (' . $this->db->quoteName('a.id') . ' = ' - . $this->db->quoteName('b.library') . ')' - ); - $query->join( - 'LEFT', $this->db->quoteName( - '#__componentbuilder_library_files_folders_urls', 'c' - ) . ' ON (' . $this->db->quoteName('a.id') . ' = ' - . $this->db->quoteName('c.library') . ')' - ); - $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); - $query->where($this->db->quoteName('a.target') . ' = 1'); - - // Reset the query using our newly populated query object. - $this->db->setQuery($query); - - // Load the results as a list of stdClass objects - $library = $this->db->loadObject(); - - // check if this lib uses build-in behaviour - if ($library->how == 4) - { - // fall back on build-in features - $buildin = array(3 => array('uikit' => 3), - 4 => array('uikit' => 1), - 5 => array('footableVersion' => 2, - 'footable' => true), - 6 => array('footableVersion' => 3, - 'footable' => true)); - if (isset($buildin[$library->id]) - && ArrayHelper::check( - $buildin[$library->id] - )) - { - // set the lib switch - foreach ($buildin[$library->id] as $lib => $val) - { - $this->{$lib} = $val; - } - // since we are falling back on build-in feature - $library->how = 0; - } - else - { - // since we did not find build in behaviour we must load always. - $library->how = 1; - } - } - // check if this lib has dynamic behaviour - if ($library->how > 0) - { - // set the add targets - $addArray = array('files' => 'files', - 'folders' => 'folders', - 'urls' => 'urls', - 'filesfullpath' => 'files', - 'foldersfullpath' => 'folders'); - foreach ($addArray as $addTarget => $targetHere) - { - // set the add target data - $library->{'add' . $addTarget} = (isset( - $library->{'add' . $addTarget} - ) - && JsonHelper::check( - $library->{'add' . $addTarget} - )) ? json_decode($library->{'add' . $addTarget}, true) - : null; - if (ArrayHelper::check( - $library->{'add' . $addTarget} - )) - { - if (isset($library->{$targetHere}) - && ArrayHelper::check( - $library->{$targetHere} - )) - { - foreach ($library->{'add' . $addTarget} as $taget) - { - $library->{$targetHere}[] = $taget; - } - } - else - { - $library->{$targetHere} = array_values( - $library->{'add' . $addTarget} - ); - } - } - unset($library->{'add' . $addTarget}); - } - // add config fields only if needed - if ($library->how > 1) - { - // set the config data - $library->addconfig = (isset($library->addconfig) - && JsonHelper::check( - $library->addconfig - )) ? json_decode($library->addconfig, true) : null; - if (ArrayHelper::check($library->addconfig)) - { - $library->config = array_map( - function ($array) { - $array['alias'] = 0; - $array['title'] = 0; - $array['settings'] = $this->getFieldData( - $array['field'] - ); - - return $array; - }, array_values($library->addconfig) - ); - } - } - // if this lib is controlled by custom script - if (3 == $library->how) - { - // set Needed PHP - if (isset($library->php_setdocument) - && StringHelper::check( - $library->php_setdocument - )) - { - $library->document = CFactory::_('Customcode.Gui')->set( - CFactory::_('Customcode')->add( - base64_decode($library->php_setdocument) - ), - array( - 'table' => 'library', - 'field' => 'php_setdocument', - 'id' => (int) $id, - 'type' => 'php') - ); - } - } - // if this lib is controlled by conditions - elseif (2 == $library->how) - { - // set the addconditions data - $library->addconditions = (isset($library->addconditions) - && JsonHelper::check( - $library->addconditions - )) ? json_decode($library->addconditions, true) : null; - if (ArrayHelper::check( - $library->addconditions - )) - { - $library->conditions = array_values( - $library->addconditions - ); - } - } - unset($library->php_setdocument); - unset($library->addconditions); - unset($library->addconfig); - // load to global lib - $this->libraries[$id] = $library; - } - else - { - $this->libraries[$id] = false; - } - } - // if set return - if (isset($this->libraries[$id])) - { - return $this->libraries[$id]; - } - - return false; - } - - /** - * Set Language Place Holders - * - * @param string $content The content - * - * @return string The content with the updated Language place holder - * @deprecated 3.3 Use CFactory::_('Language.Extractor')->engine($content) - */ - public function setLangStrings($content) - { - return CFactory::_('Language.Extractor')->engine($content); - } - - /** - * Set the language String - * - * @param string $string The plan text string (English) - * - * @return string The key language string (all uppercase) - * @deprecated 3.3 Use CFactory::_('Language')->key($string); - */ - public function setLang($string) - { - return CFactory::_('Language')->key($string); - } - - /** - * Set Data Selection of the dynamic get - * - * @param string $method_key The method unique key - * @param string $view_code The code name of the view - * @param string $string The data string - * @param string $asset The asset in question - * @param string $as The as string - * @param int $row_type The row type - * @param string $type The target type (db||view) - * - * @return array the select query - * - */ - public function setDataSelection($method_key, $view_code, $string, $asset, - $as, $row_type, $type - ) - { - if (StringHelper::check($string)) - { - if ('db' === $type) - { - $table = '#__' . $asset; - $queryName = $asset; - $view = ''; - } - elseif ('view' === $type) - { - $view = $this->getViewTableName($asset); - $table = '#__' . CFactory::_('Config')->component_code_name . '_' . $view; - $queryName = $view; - } - // just get all values from table if * is found - if ($string === '*' || strpos($string, '*') !== false) - { - if ($type == 'view') - { - $_string = ComponentbuilderHelper::getViewTableColumns( - $asset, $as, $row_type - ); - } - else - { - $_string = ComponentbuilderHelper::getDbTableColumns( - $asset, $as, $row_type - ); - } - // get only selected values - $lines = explode(PHP_EOL, $_string); - // make sure to set the string to * - $string = '*'; - } - else - { - // get only selected values - $lines = explode(PHP_EOL, $string); - } - // only continue if lines are available - if (ArrayHelper::check($lines)) - { - $gets = array(); - $keys = array(); - // first load all options - foreach ($lines as $line) - { - if (strpos($line, 'AS') !== false) - { - $lineArray = explode("AS", $line); - } - elseif (strpos($line, 'as') !== false) - { - $lineArray = explode("as", $line); - } - else - { - $lineArray = array($line, null); - } - // set the get and key - $get = trim($lineArray[0]); - $key = trim($lineArray[1]); - // only add the view (we must adapt this) - if (isset($this->getAsLookup[$method_key][$get]) - && 'a' != $as - && 1 == $row_type - && 'view' === $type - && strpos('#' . $key, '#' . $view . '_') === false) - { - // this is a problem (TODO) since we may want to not add the view name. - $key = $view . '_' . trim($key); - } - // continue only if we have get - if (StringHelper::check($get)) - { - $gets[] = $this->db->quote($get); - if (StringHelper::check($key)) - { - $this->getAsLookup[$method_key][$get] = $key; - $keys[] - = $this->db->quote( - $key - ); - } - else - { - $key = str_replace( - $as . '.', '', $get - ); - $this->getAsLookup[$method_key][$get] = $key; - $keys[] - = $this->db->quote( - $key - ); - } - // make sure we have the view name - if (StringHelper::check($view)) - { - // prep the field name - $field = str_replace($as . '.', '', $get); - // make sure the array is set - if (!isset($this->siteFields[$view][$field])) - { - $this->siteFields[$view][$field] = array(); - } - // load to the site fields memory bucket - $this->siteFields[$view][$field][$method_key . '___' - . $as] - = array('site' => $view_code, 'get' => $get, - 'as' => $as, 'key' => $key); - } - } - } - if (ArrayHelper::check($gets) - && ArrayHelper::check($keys)) - { - // single joined selection needs the prefix to the values to avoid conflict in the names - // so we must still add then AS - if ($string == '*' && 1 != $row_type) - { - $querySelect = "\$query->select('" . $as . ".*');"; - } - else - { - $querySelect = '$query->select($db->quoteName(' - . PHP_EOL . Indent::_(3) . 'array(' . implode( - ',', $gets - ) . '),' . PHP_EOL . Indent::_(3) . 'array(' - . implode(',', $keys) . ')));'; - } - $queryFrom = '$db->quoteName(' . $this->db->quote($table) - . ', ' . $this->db->quote($as) . ')'; - - // return the select query - return array('select' => $querySelect, - 'from' => $queryFrom, - 'name' => $queryName, - 'table' => $table, - 'type' => $type, - 'select_gets' => $gets, - 'select_keys' => $keys); - } - } - } - - return false; - } - - /** - * Get the View Table Name - * - * @param int $id The admin view in - * - * @return string view code name - * - */ - public function getViewTableName($id) - { - // Create a new query object. - $query = $this->db->getQuery(true); - $query->select($this->db->quoteName(array('a.name_single'))); - $query->from( - $this->db->quoteName('#__componentbuilder_admin_view', 'a') - ); - $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); - $this->db->setQuery($query); - - return StringHelper::safe($this->db->loadResult()); - } - - /** - * Build the SQL dump String for a view - * - * @param string $tables The tables to use in build - * @param string $view The target view/table to dump in - * @param int $view_id The id of the target view - * - * @return string on success with the Dump SQL - * - */ - public function buildSqlDump($tables, $view, $view_id) - { - // first build a query statment to get all the data (insure it must be added - check the tweaking) - if (ArrayHelper::check($tables) - && (!isset($this->sqlTweak[$view_id]['remove']) - || !$this->sqlTweak[$view_id]['remove'])) - { - $counter = 'a'; - // Create a new query object. - $query = $this->db->getQuery(true); - // switch to onlu trigger the run of the query if we have tables to query - $runQuery = false; - foreach ($tables as $table) - { - if (isset($table['table'])) - { - if ($counter === 'a') - { - // the main table fields - if (strpos($table['sourcemap'], PHP_EOL) !== false) - { - $fields = explode(PHP_EOL, $table['sourcemap']); - if (ArrayHelper::check($fields)) - { - // reset array buckets - $sourceArray = array(); - $targetArray = array(); - foreach ($fields as $field) - { - if (strpos($field, "=>") !== false) - { - list($source, $target) = explode( - "=>", $field - ); - $sourceArray[] = $counter . '.' . trim( - $source - ); - $targetArray[] = trim($target); - } - } - if (ArrayHelper::check( - $sourceArray - ) - && ArrayHelper::check( - $targetArray - )) - { - // add to query - $query->select( - $this->db->quoteName( - $sourceArray, $targetArray - ) - ); - $query->from( - '#__' . $table['table'] . ' AS a' - ); - $runQuery = true; - } - // we may need to filter the selection - if (isset($this->sqlTweak[$view_id]['where'])) - { - // add to query the where filter - $query->where( - 'a.id IN (' - . $this->sqlTweak[$view_id]['where'] - . ')' - ); - } - } - } - } - else - { - // the other tables - if (strpos($table['sourcemap'], PHP_EOL) !== false) - { - $fields = explode(PHP_EOL, $table['sourcemap']); - if (ArrayHelper::check($fields)) - { - // reset array buckets - $sourceArray = array(); - $targetArray = array(); - foreach ($fields as $field) - { - if (strpos($field, "=>") !== false) - { - list($source, $target) = explode( - "=>", $field - ); - $sourceArray[] = $counter . '.' . trim( - $source - ); - $targetArray[] = trim($target); - } - if (strpos($field, "==") !== false) - { - list($aKey, $bKey) = explode( - "==", $field - ); - // add to query - $query->join( - 'LEFT', $this->db->quoteName( - '#__' . $table['table'], - $counter - ) . ' ON (' . $this->db->quoteName( - 'a.' . trim($aKey) - ) . ' = ' . $this->db->quoteName( - $counter . '.' . trim($bKey) - ) . ')' - ); - } - } - if (ArrayHelper::check( - $sourceArray - ) - && ArrayHelper::check( - $targetArray - )) - { - // add to query - $query->select( - $this->db->quoteName( - $sourceArray, $targetArray - ) - ); - } - } - } - } - $counter++; - } - else - { - // see where - // var_dump($view); - // jexit(); - } - } - // check if we should run query - if ($runQuery) - { - // now get the data - $this->db->setQuery($query); - $this->db->execute(); - if ($this->db->getNumRows()) - { - // get the data - $data = $this->db->loadObjectList(); - // start building the MySql dump - $dump = "--"; - $dump .= PHP_EOL . "-- Dumping data for table `#__" - . Placefix::_( "component" ) . "_" . $view - . "`"; - $dump .= PHP_EOL . "--"; - $dump .= PHP_EOL . PHP_EOL . "INSERT INTO `#__" . Placefix::_("component" ) . "_" . $view . "` ("; - foreach ($data as $line) - { - $comaSet = 0; - foreach ($line as $fieldName => $fieldValue) - { - if ($comaSet == 0) - { - $dump .= $this->db->quoteName($fieldName); - } - else - { - $dump .= ", " . $this->db->quoteName( - $fieldName - ); - } - $comaSet++; - } - break; - } - $dump .= ") VALUES"; - $coma = 0; - foreach ($data as $line) - { - if ($coma == 0) - { - $dump .= PHP_EOL . "("; - } - else - { - $dump .= "," . PHP_EOL . "("; - } - $comaSet = 0; - foreach ($line as $fieldName => $fieldValue) - { - if ($comaSet == 0) - { - $dump .= $this->mysql_escape($fieldValue); - } - else - { - $dump .= ", " . $this->mysql_escape( - $fieldValue - ); - } - $comaSet++; - } - $dump .= ")"; - $coma++; - } - $dump .= ";"; - - // return build dump query - return $dump; - } - } - } - - return false; - } - - /** - * Escape the values for a SQL dump - * - * @param string $value the value to escape - * - * @return string on success with escaped string - * - */ - public function mysql_escape($value) - { - // if array then return maped - if (ArrayHelper::check($value)) - { - return array_map(__METHOD__, $value); - } - // if string make sure it is correctly escaped - if (StringHelper::check($value) && !is_numeric($value)) - { - return $this->db->quote($value); - } - // if empty value return place holder - if (empty($value)) - { - return "''"; - } - - // if not array or string then return number - return $value; - } - - /** - * Creating an uniqueCode - * - * @param string $code The planed code - * - * @return string The unique code - * - */ - public function uniqueCode($code) - { - if (!isset($this->uniquecodes[CFactory::_('Config')->build_target]) - || !in_array( - $code, $this->uniquecodes[CFactory::_('Config')->build_target] - )) - { - $this->uniquecodes[CFactory::_('Config')->build_target][] = $code; - - return $code; - } - - // make sure it is unique - return $this->uniqueCode($code . $this->uniquekey(1)); - } - - /** - * Creating an unique local key - * - * @param int $size The key size - * - * @return string The unique localkey - * - */ - public function uniquekey($size, $random = false, - $newBag = "vvvvvvvvvvvvvvvvvvv" - ) - { - if ($random) - { - $bag - = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; - } - else - { - $bag = $newBag; - } - $key = array(); - $bagsize = strlen($bag) - 1; - for ($i = 0; $i < $size; $i++) - { - $get = rand(0, $bagsize); - $key[] = $bag[$get]; - } - $key = implode($key); - while (in_array($key, $this->uniquekeys)) - { - $key++; - } - $this->uniquekeys[] = $key; - - return $key; - } - - /** - * Check for footable scripts - * - * @param string $content The content to check - * - * @return boolean True if found - * - */ - public function getFootableScripts($content) - { - if (strpos($content, 'footable') !== false) - { - return true; - } - - return false; - } - - /** - * Check for getModules script - * - * @param string $content The content to check - * - * @return boolean True if found - * - */ - public function getGetModule($content) - { - if (strpos($content, 'this->getModules(') !== false) - { - return true; - } - - return false; - } - - /** - * Check for get Google Chart script - * - * @param string $content The content to check - * - * @return boolean True if found - * - */ - public function getGoogleChart($content) - { - if (strpos($content, 'Chartbuilder(') !== false) - { - return true; - } - - return false; - } - - /** - * Set the dynamic values in strings here - * - * @param string $string The content to check - * @param int $debug The switch to debug the update - * We can now at any time debug the - * dynamic build values if it gets broken - * - * @return string - * @deprecated 3.3 Use CFactory::_('Customcode')->add($string, $debug); - */ - public function setDynamicValues($string, $debug = 0) - { - return CFactory::_('Customcode')->add($string, $debug); - } - - /** - * Set the external code string & load it in to string - * - * @param string $string The content to check - * @param int $debug The switch to debug the update - * - * @return string - * @deprecated 3.3 Use CFactory::_('Customcode.External')->set($string, $debug); - */ - public function setExternalCodeString($string, $debug = 0) - { - return CFactory::_('Customcode.External')->set($string, $debug); - } - - /** - * Get the External Code/String - * - * @param string $string The content to check - * @param array $bucket The Placeholders bucket - * - * @return void - * @deprecated 3.3 - */ - protected function getExternalCodeString($target, &$bucket) - { - // set notice that we could not get a valid string from the target - $this->app->enqueueMessage( - JText::_('

External Code Warning

'), 'Error' - ); - $this->app->enqueueMessage( - JText::_( - 'Use of a deprecated method (getExternalCodeString)!' - ), 'Error' - ); - } - - /** - * Cut the External Code/String - * - * @param string $string The content to cut - * @param string $sequence The cutting sequence - * @param string $key The content key - * - * @return string - * @deprecated 3.3 - */ - protected function cutExternalCodeString($string, $sequence, $key) - { - // set notice that we could not get a valid string from the target - $this->app->enqueueMessage( - JText::_('

External Code Warning

'), 'Error' - ); - $this->app->enqueueMessage( - JText::_( - 'Use of a deprecated method (cutExternalCodeString)!' - ), 'Error' - ); - - return ''; - } - - /** - * We start set the custom code data & can load it in to string - * - * @param string $string The content to check - * @param int $debug The switch to debug the update - * - * @return string - * @deprecated 3.3 Use CFactory::_('Customcode')->set($string, $debug, $not); - */ - public function setCustomCodeData($string, $debug = 0, $not = null) - { - return CFactory::_('Customcode')->set($string, $debug, $not); - } - - /** - * Insert the custom code into the string - * - * @param string $string The content to check - * @param int $debug The switch to debug the update - * - * @return string on success - * @deprecated 3.3 - */ - protected function insertCustomCode($ids, $string, $debug = 0) - { - // set notice that we could not get a valid string from the target - $this->app->enqueueMessage( - JText::_('

External Code Warning

'), 'Error' - ); - $this->app->enqueueMessage( - JText::_( - 'Use of a deprecated method (insertCustomCode)!' - ), 'Error' - ); - - return ''; - } - - /** - * Insert the custom code into the string - * - * @param string $string The content to check - * @param int $debug The switch to debug the update - * - * @return string on success - * @deprecated 3.3 - */ - protected function buildCustomCodePlaceholders($item, &$code, $debug = 0) - { - // set notice that we could not get a valid string from the target - $this->app->enqueueMessage( - JText::_('

External Code Warning

'), 'Error' - ); - $this->app->enqueueMessage( - JText::_( - 'Use of a deprecated method (buildCustomCodePlaceholders)!' - ), 'Error' - ); - - return ''; - } - - /** - * Set a type of placeholder with set of values - * - * @param string $key The main string for placeholder key - * @param array $values The values to add - * - * @return void - * @deprecated 3.3 Use CFactory::_('Placeholder')->setType($key, $values); - */ - public function setThesePlaceHolders($key, $values) - { - // use the new container class - CFactory::_('Placeholder')->setType($key, $values); - } - - /** - * Remove a type of placeholder by main string - * - * @param string $like The main string for placeholder key - * - * @return void - * @deprecated 3.3 Use CFactory::_('Placeholder')->clearType($key); - */ - public function clearFromPlaceHolders($like) - { - // use the new container class - CFactory::_('Placeholder')->clearType($like); - } - - /** - * to unset stuff that are private or protected - * - */ - public function unsetNow($remove) - { - unset($this->$remove); - } - - /** - * Get the other languages - * - * @param array $values The lang strings to get - * - * - * @return void - * - */ - public function getMultiLangStrings($values) - { - // Create a new query object. - $query = $this->db->getQuery(true); - $query->from( - $this->db->quoteName( - '#__componentbuilder_language_translation', 'a' - ) - ); - if (ArrayHelper::check($values)) - { - $query->select( - $this->db->quoteName( - array('a.id', 'a.translation', 'a.source', 'a.components', - 'a.modules', 'a.plugins', 'a.published') - ) - ); - $query->where( - $this->db->quoteName('a.source') . ' IN (' . implode( - ',', array_map( - function ($a) { - return $this->db->quote($a); - }, $values - ) - ) . ')' - ); - $this->db->setQuery($query); - $this->db->execute(); - if ($this->db->getNumRows()) - { - return $this->db->loadAssocList('source'); - } - } - - return false; - } - - /** - * Set the Current language values to DB - * - * - * @return void - * - */ - public function setLangPlaceholders($strings, int $target_id, - $target = 'components' - ) - { - $counterInsert = 0; - $counterUpdate = 0; - $today = JFactory::getDate()->toSql(); - foreach ( - $this->languages[$target][CFactory::_('Config')->get('lang_tag', 'en-GB')] as $area => $placeholders - ) - { - foreach ($placeholders as $placeholder => $string) - { - // to keep or remove - $remove = false; - // build the translations - if (StringHelper::check($string) - && isset($this->multiLangString[$string])) - { - // make sure we have converted the string to array - if (isset($this->multiLangString[$string]['translation']) - && JsonHelper::check( - $this->multiLangString[$string]['translation'] - )) - { - $this->multiLangString[$string]['translation'] - = json_decode( - $this->multiLangString[$string]['translation'], true - ); - } - // if we have an array continue - if (isset($this->multiLangString[$string]['translation']) - && ArrayHelper::check( - $this->multiLangString[$string]['translation'] - )) - { - // great lets build the multi languages strings - foreach ( - $this->multiLangString[$string]['translation'] as - $translations - ) - { - if (isset($translations['language']) - && isset($translations['translation'])) - { - // build arrays - if (!isset($this->languages[$target][$translations['language']])) - { - $this->languages[$target][$translations['language']] - = array(); - } - if (!isset($this->languages[$target][$translations['language']][$area])) - { - $this->languages[$target][$translations['language']][$area] - = array(); - } - $this->languages[$target][$translations['language']][$area][$placeholder] - = $translations['translation']; - } - } - } - else - { - // remove this string not to be checked again - $remove = true; - } - } - // do the database management - if (StringHelper::check($string) - && ($key = array_search($string, $strings)) !== false) - { - if (isset($this->multiLangString[$string])) - { - // update the existing placeholder in db - $id = $this->multiLangString[$string]['id']; - if (JsonHelper::check( - $this->multiLangString[$string][$target] - )) - { - $targets = (array) json_decode( - $this->multiLangString[$string][$target], true - ); - // check if we should add the target ID - if (in_array($target_id, $targets)) - { - // only skip the update if the string is published and has the target ID - if ($this->multiLangString[$string]['published'] - == 1) - { - continue; - } - } - else - { - $targets[] = $target_id; - } - } - else - { - $targets = array($target_id); - } - // start the bucket for this lang - $this->setUpdateExistingLangStrings( - $id, $target, $targets, 1, $today, $counterUpdate - ); - - $counterUpdate++; - - // load to db - $this->setExistingLangStrings(50); - // remove string if needed - if ($remove) - { - unset($this->multiLangString[$string]); - } - } - else - { - // add the new lang placeholder to the db - if (!isset($this->newLangStrings[$target])) - { - $this->newLangStrings[$target] = array(); - } - $this->newLangStrings[$target][$counterInsert] - = array(); - $this->newLangStrings[$target][$counterInsert][] - = $this->db->quote( - json_encode(array($target_id)) - ); // 'target' - $this->newLangStrings[$target][$counterInsert][] - = $this->db->quote( - $string - ); // 'source' - $this->newLangStrings[$target][$counterInsert][] - = $this->db->quote( - 1 - ); // 'published' - $this->newLangStrings[$target][$counterInsert][] - = $this->db->quote( - $today - ); // 'created' - $this->newLangStrings[$target][$counterInsert][] - = $this->db->quote( - (int) $this->user->id - ); // 'created_by' - $this->newLangStrings[$target][$counterInsert][] - = $this->db->quote( - 1 - ); // 'version' - $this->newLangStrings[$target][$counterInsert][] - = $this->db->quote( - 1 - ); // 'access' - - $counterInsert++; - - // load to db - $this->setNewLangStrings($target, 100); - } - // only set the string once - unset($strings[$key]); - } - } - } - // just to make sure all is done - $this->setExistingLangStrings(); - $this->setNewLangStrings($target); - } - - /** - * store the language placeholders - * - * @param string $target The target extention type - * @param int $when To set when to update - * - * @return void - * - */ - protected function setNewLangStrings($target, $when = 1) - { - if (isset($this->newLangStrings[$target]) - && count( - (array) $this->newLangStrings[$target] - ) >= $when) - { - // Create a new query object. - $query = $this->db->getQuery(true); - $continue = false; - // Insert columns. - $columns = array($target, 'source', 'published', 'created', - 'created_by', 'version', 'access'); - // Prepare the insert query. - $query->insert( - $this->db->quoteName('#__componentbuilder_language_translation') - ); - $query->columns($this->db->quoteName($columns)); - foreach ($this->newLangStrings[$target] as $values) - { - if (count((array) $values) == 7) - { - $query->values(implode(',', $values)); - $continue = true; - } - else - { - // TODO line mismatch... should not happen - } - } - // clear the values array - $this->newLangStrings[$target] = array(); - if (!$continue) - { - return false; // insure we dont continue if no values were loaded - } - // Set the query using our newly populated query object and execute it. - $this->db->setQuery($query); - $this->db->execute(); - } - } - - /** - * update the language placeholders - * - * @param int $when To set when to update - * - * @return void - * - */ - protected function setExistingLangStrings($when = 1) - { - if (count((array) $this->existingLangStrings) >= $when) - { - foreach ($this->existingLangStrings as $values) - { - // Create a new query object. - $query = $this->db->getQuery(true); - // Prepare the update query. - $query->update( - $this->db->quoteName( - '#__componentbuilder_language_translation' - ) - )->set($values['fields'])->where($values['conditions']); - // Set the query using our newly populated query object and execute it. - $this->db->setQuery($query); - $this->db->execute(); - } - // clear the values array - $this->existingLangStrings = array(); - } - } - - /** - * Remove exiting language translation stings - * - * @param int $id To string ID to remove - * - * @return void - * - */ - protected function removeExitingLangString($id) - { - // Create a new query object. - $query = $this->db->getQuery(true); - - // delete all custom keys for user 1001. - $conditions = array( - $this->db->quoteName('id') . ' = ' . (int) $id - ); - - $query->delete( - $this->db->quoteName('#__componentbuilder_language_translation') - ); - $query->where($conditions); - - $this->db->setQuery($query); - $this->db->execute(); - } - - /** - * Function to purge the unused languge strings - * - * @param string $values the active strings - * - * @return void - * - */ - public function purgeLanuageStrings($values, $target_id, - $target = 'components' - ) - { - // the target types are - $target_types = array('components' => 'components', - 'modules' => 'modules', - 'plugins' => 'plugins'); - // make sure we only work with preset targets - if (isset($target_types[$target])) - { - // remove the current target - unset($target_types[$target]); - // Create a new query object. - $query = $this->db->getQuery(true); - $query->from( - $this->db->quoteName( - '#__componentbuilder_language_translation', 'a' - ) - ); - $query->select( - $this->db->quoteName( - array('a.id', 'a.translation', 'a.components', 'a.modules', - 'a.plugins') - ) - ); - // get all string that are not linked to this component - $query->where( - $this->db->quoteName('a.source') . ' NOT IN (' . implode( - ',', array_map( - function ($a) { - return $this->db->quote($a); - }, $values - ) - ) . ')' - ); - $query->where($this->db->quoteName('a.published') . ' = 1'); - $this->db->setQuery($query); - $this->db->execute(); - if ($this->db->getNumRows()) - { - $counterUpdate = 0; - $otherStrings = $this->db->loadAssocList(); - $today = JFactory::getDate()->toSql(); - foreach ($otherStrings as $item) - { - if (JsonHelper::check($item[$target])) - { - $targets = (array) json_decode($item[$target], true); - // if component is not found ignore this string, and do nothing - if (($key = array_search($target_id, $targets)) - !== false) - { - // first remove the component from the string - unset($targets[$key]); - // check if there are more components - if (ArrayHelper::check($targets)) - { - // just update the string to unlink the current component - $this->setUpdateExistingLangStrings( - $item['id'], $target, $targets, 1, $today, - $counterUpdate - ); - - $counterUpdate++; - - // load to db - $this->setExistingLangStrings(50); - } - // check if this string has been worked on or is linked to other extensions - else - { - // the action (1 = remove, 2 = archive, 0 = do nothing) - $action_with_string = 1; - // now check if it is linked to other extensions - foreach ($target_types as $other_target) - { - // just one linked extension type is enough to stop the search - if ($action_with_string - && JsonHelper::check( - $item[$other_target] - )) - { - $other_targets = (array) json_decode( - $item[$other_target], true - ); - // check if linked to other extensions - if (ArrayHelper::check( - $other_targets - )) - { - $action_with_string - = 0; // do nothing - } - } - } - // check we should just archive or remove string - if ($action_with_string - && JsonHelper::check( - $item['translation'] - )) - { - $translation = json_decode( - $item['translation'], true - ); - if (ArrayHelper::check( - $translation - )) - { - // only archive the item and update the string to unlink the current component - $this->setUpdateExistingLangStrings( - $item['id'], $target, $targets, 2, - $today, $counterUpdate - ); - - $counterUpdate++; - - // load to db - $this->setExistingLangStrings(50); - - $action_with_string - = 2; // we archived it - } - } - // remove the string since no translation found and not linked to any other extensions - if ($action_with_string == 1) - { - $this->removeExitingLangString($item['id']); - } - } - } - } - } - // load to db - $this->setExistingLangStrings(); - } - } - } - - /** - * just to add lang string to the existing Lang Strings array - * - * @return void - * - */ - protected function setUpdateExistingLangStrings($id, $target, $targets, - $published, $today, $counterUpdate - ) - { - // start the bucket for this lang - $this->existingLangStrings[$counterUpdate] = array(); - $this->existingLangStrings[$counterUpdate]['id'] = (int) $id; - $this->existingLangStrings[$counterUpdate]['conditions'] = array(); - $this->existingLangStrings[$counterUpdate]['conditions'][] - = $this->db->quoteName( - 'id' - ) . ' = ' . $this->db->quote($id); - $this->existingLangStrings[$counterUpdate]['fields'] = array(); - $this->existingLangStrings[$counterUpdate]['fields'][] - = $this->db->quoteName( - $target - ) . ' = ' . $this->db->quote(json_encode($targets)); - $this->existingLangStrings[$counterUpdate]['fields'][] - = $this->db->quoteName( - 'published' - ) . ' = ' . $this->db->quote($published); - $this->existingLangStrings[$counterUpdate]['fields'][] - = $this->db->quoteName( - 'modified' - ) . ' = ' . $this->db->quote($today); - $this->existingLangStrings[$counterUpdate]['fields'][] - = $this->db->quoteName( - 'modified_by' - ) . ' = ' . $this->db->quote((int) $this->user->id); - } - - /** - * get the custom code from the system - * - * @param array|null $ids The custom code ides if known - * @param int|null $setLang The set lang switch - * @param int $debug The switch to debug the update - * - * @return void - * @deprecated 3.3 Use CFactory::_('Customcode')->load($ids, $setLang, $debug); - */ - public function getCustomCode(?array $ids = null, bool $setLang = true, int $debug = 0) - { - CFactory::_('Customcode')->load($ids, $setLang, $debug); - } - - /** - * check if we already have these ids in local memory - * - * @return void - * @deprecated 3.3 - */ - protected function checkCustomCodeMemory($ids) - { - // reset custom code - CFactory::_('Customcode')->active = array(); - foreach ($ids as $pointer => $id) - { - if (isset(CFactory::_('Customcode')->memory[$id])) - { - CFactory::_('Customcode')->active[] = CFactory::_('Customcode')->memory[$id]; - unset($ids[$pointer]); - } - } - // check if any ids left to fetch - if (ArrayHelper::check($ids)) - { - return $ids; - } - - return false; - } - - /** - * get all the powers linkd to this component - * - * @return void - * @deprecated 3.3 Use CFactory::_('Power')->load($guids); - */ - protected function getPowers($guids) - { - CFactory::_('Power')->load($guids); - } - - /** - * get a power linkd to this component - * - * @return mixed - * @deprecated 3.3 Use CFactory::_('Power')->get($guid, $build); - */ - public function getPower($guid, $build = 0) - { - CFactory::_('Power')->get($guid, $build); - } - - /** - * set a power linkd to this component - * - * @return bool - * @deprecated 3.3 - */ - protected function setPower($guid) - { - // set notice that we could not get a valid string from the target - $this->app->enqueueMessage( - JText::_('

Power building error

'), 'Error' - ); - $this->app->enqueueMessage( - JText::_( - 'Use of a deprecated method (setPower)!' - ), 'Error' - ); - - return ''; - } - - /** - * get the Joomla module path - * - * @return array of module path and target site area on success - * - */ - protected function getModulePath($id) - { - if (is_numeric($id) && $id > 0) - { - // Create a new query object. - $query = $this->db->getQuery(true); - - $query->select('a.*'); - $query->select( - $this->db->quoteName( - array( - 'a.name', - 'a.target' - ), array( - 'name', - 'target' - ) - ) - ); - // from these tables - $query->from('#__componentbuilder_joomla_module AS a'); - $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); - $this->db->setQuery($query); - $this->db->execute(); - if ($this->db->getNumRows()) - { - // get the module data - $module = $this->db->loadObject(); - // update the name if it has dynamic values - $module->name = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add($module->name), - $this->globalPlaceholders - ); - // set safe class function name - $module->code_name - = ClassfunctionHelper::safe( - $module->name - ); - // set module folder name - $module->folder_name = 'mod_' . strtolower($module->code_name); - // set the lang key - CFactory::_('Language.Extractor')->langKeys[strtoupper($module->folder_name)] = $module->id - . '_M0dU|3'; - // return the path - if ($module->target == 2) - { - // administrator client area - return JPATH_ADMINISTRATOR . '/modules/' - . $module->folder_name; - } - else - { - // default is the site client area - return JPATH_ROOT . '/modules/' . $module->folder_name; - } - } - } - - return false; - } - - /** - * get the Joomla Modules IDs - * - * @return array of IDs on success - * - */ - protected function getModuleIDs() - { - if (($addjoomla_modules = GetHelper::var( - 'component_modules', CFactory::_('Config')->component_id, 'joomla_component', - 'addjoomla_modules' - )) !== false) - { - $addjoomla_modules = (JsonHelper::check( - $addjoomla_modules - )) ? json_decode($addjoomla_modules, true) : null; - if (ArrayHelper::check($addjoomla_modules)) - { - $joomla_modules = array_filter( - array_values($addjoomla_modules), - function ($array) { - // only load the modules whose target association call for it - if (!isset($array['target']) || $array['target'] != 2) - { - return true; - } - - return false; - } - ); - // if we have values we return IDs - if (ArrayHelper::check($joomla_modules)) - { - return array_map( - function ($array) { - return (int) $array['module']; - }, $joomla_modules - ); - } - } - } - - return false; - } - - /** - * set the Joomla modules - * - * @return true - * - */ - public function setJoomlaModule($id, &$component) - { - if (isset($this->joomlaModules[$id])) - { - return true; - } - else - { - // Create a new query object. - $query = $this->db->getQuery(true); - - $query->select('a.*'); - $query->select( - $this->db->quoteName( - array( - 'f.addfiles', - 'f.addfolders', - 'f.addfilesfullpath', - 'f.addfoldersfullpath', - 'f.addurls', - 'u.version_update', - 'u.id' - ), array( - 'addfiles', - 'addfolders', - 'addfilesfullpath', - 'addfoldersfullpath', - 'addurls', - 'version_update', - 'version_update_id' - ) - ) - ); - // from these tables - $query->from('#__componentbuilder_joomla_module AS a'); - $query->join( - 'LEFT', $this->db->quoteName( - '#__componentbuilder_joomla_module_updates', 'u' - ) . ' ON (' . $this->db->quoteName('a.id') . ' = ' - . $this->db->quoteName('u.joomla_module') . ')' - ); - $query->join( - 'LEFT', $this->db->quoteName( - '#__componentbuilder_joomla_module_files_folders_urls', 'f' - ) . ' ON (' . $this->db->quoteName('a.id') . ' = ' - . $this->db->quoteName('f.joomla_module') . ')' - ); - $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); - $query->where($this->db->quoteName('a.published') . ' >= 1'); - $this->db->setQuery($query); - $this->db->execute(); - if ($this->db->getNumRows()) - { - // get the module data - $module = $this->db->loadObject(); - // tweak system to set stuff to the module domain - $_backup_target = CFactory::_('Config')->build_target; - $_backup_lang = CFactory::_('Config')->lang_target; - $_backup_langPrefix = CFactory::_('Config')->lang_prefix; - // set some keys - $module->target_type = 'M0dU|3'; - $module->key = $module->id . '_' . $module->target_type; - // update to point to module - CFactory::_('Config')->build_target = $module->key; - CFactory::_('Config')->lang_target = $module->key; - // set version if not set - if (empty($module->module_version)) - { - $module->module_version = '1.0.0'; - } - // set target client - if ($module->target == 2) - { - $module->target_client = 'administrator'; - } - else - { - // default is site area - $module->target_client = 'site'; - } - // set GUI mapper - $guiMapper = array('table' => 'joomla_module', - 'id' => (int) $id, 'type' => 'php'); - // update the name if it has dynamic values - $module->name = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add($module->name), CFactory::_('Placeholder')->active - ); - // set safe class function name - $module->code_name - = ClassfunctionHelper::safe( - $module->name - ); - // alias of code name - $module->class_name = $module->code_name; - // set official name - $module->official_name = StringHelper::safe( - $module->name, 'W' - ); - // set langPrefix - $this->langPrefix = 'MOD_' . strtoupper($module->code_name); - CFactory::_('Config')->set('lang_prefix', $this->langPrefix); - // set lang prefix - $module->lang_prefix = CFactory::_('Config')->lang_prefix; - // set module class name - $module->class_helper_name = 'Mod' . ucfirst($module->code_name) - . 'Helper'; - $module->class_data_name = 'Mod' . ucfirst($module->code_name) - . 'Data'; - // set module install class name - $module->installer_class_name = 'mod_' . ucfirst( - $module->code_name - ) . 'InstallerScript'; - // set module folder name - $module->folder_name = 'mod_' . strtolower($module->code_name); - // set the zip name - $module->zip_name = $module->folder_name . '_v' . str_replace( - '.', '_', $module->module_version - ) . '__J' . CFactory::_('Config')->joomla_version; - // set module file name - $module->file_name = $module->folder_name; - // set module context - $module->context = $module->file_name . '.' . $module->id; - // set official_name lang strings - CFactory::_('Language')->set( - $module->key, CFactory::_('Config')->lang_prefix, $module->official_name - ); - // set some placeholder for this module - CFactory::_('Placeholder')->active[Placefix::_('Module_name')] - = $module->official_name; - CFactory::_('Placeholder')->active[Placefix::_('Module')] - = ucfirst( - $module->code_name - ); - CFactory::_('Placeholder')->active[Placefix::_('module')] - = strtolower( - $module->code_name - ); - CFactory::_('Placeholder')->active[Placefix::_('module.version')] - = $module->module_version; - CFactory::_('Placeholder')->active[Placefix::_('module_version')] - = str_replace( - '.', '_', $module->module_version - ); - // set description (TODO) add description field to module - if (!isset($module->description) - || !StringHelper::check( - $module->description - )) - { - $module->description = ''; - } - else - { - $module->description = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add($module->description), - CFactory::_('Placeholder')->active - ); - CFactory::_('Language')->set( - $module->key, $module->lang_prefix . '_DESCRIPTION', - $module->description - ); - $module->description = '

' . $module->description - . '

'; - } - $module->xml_description = "

" . $module->official_name - . " (v." . $module->module_version - . ")

" - . $module->description . "

Created by " . trim( - JFilterOutput::cleanText($component->author) - ) . "
Development started " - . JFactory::getDate($module->created)->format("jS F, Y") - . "

"; - // set xml description - CFactory::_('Language')->set( - $module->key, $module->lang_prefix . '_XML_DESCRIPTION', - $module->xml_description - ); - // update the readme if set - if ($module->addreadme == 1 && !empty($module->readme)) - { - $module->readme = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add(base64_decode($module->readme)), - CFactory::_('Placeholder')->active - ); - } - else - { - $module->addreadme = 0; - unset($module->readme); - } - // get the custom_get - $module->custom_get = (isset($module->custom_get) - && JsonHelper::check($module->custom_get)) - ? json_decode($module->custom_get, true) : null; - if (ArrayHelper::check($module->custom_get)) - { - $module->custom_get = $this->setGetData( - $module->custom_get, $module->key, $module->key - ); - } - else - { - $module->custom_get = false; - } - // set helper class details - if ($module->add_class_helper >= 1 - && StringHelper::check( - $module->class_helper_code - )) - { - if ($module->add_class_helper_header == 1 - && StringHelper::check( - $module->class_helper_header - )) - { - // set GUI mapper field - $guiMapper['field'] = 'class_helper_header'; - // base64 Decode code - $module->class_helper_header = PHP_EOL - . CFactory::_('Customcode.Gui')->set( - CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode( - $module->class_helper_header - ) - ), CFactory::_('Placeholder')->active - ), - $guiMapper - ) . PHP_EOL; - } - else - { - $module->add_class_helper_header = 0; - $module->class_helper_header = ''; - } - // set GUI mapper field - $guiMapper['field'] = 'class_helper_code'; - // base64 Decode code - $module->class_helper_code = CFactory::_('Customcode.Gui')->set( - CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode($module->class_helper_code) - ), CFactory::_('Placeholder')->active - ), - $guiMapper - ); - // set class type - if ($module->add_class_helper == 2) - { - $module->class_helper_type = 'abstract class '; - } - else - { - $module->class_helper_type = 'class '; - } - } - else - { - $module->add_class_helper = 0; - $module->class_helper_code = ''; - $module->class_helper_header = ''; - } - // base64 Decode mod_code - if (isset($module->mod_code) - && StringHelper::check($module->mod_code)) - { - // set GUI mapper field - $guiMapper['field'] = 'mod_code'; - $module->mod_code = CFactory::_('Customcode.Gui')->set( - CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode($module->mod_code) - ), CFactory::_('Placeholder')->active - ), - $guiMapper - ); - } - else - { - $module->mod_code = "// get the module class sfx"; - $module->mod_code .= PHP_EOL - . "\$moduleclass_sfx = htmlspecialchars(\$params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');"; - $module->mod_code .= PHP_EOL . "// load the default Tmpl"; - $module->mod_code .= PHP_EOL - . "require JModuleHelper::getLayoutPath('mod_" - . strtolower($module->code_name) - . "', \$params->get('layout', 'default'));"; - } - // base64 Decode default header - if (isset($module->default_header) - && StringHelper::check( - $module->default_header - )) - { - // set GUI mapper field - $guiMapper['field'] = 'default_header'; - $module->default_header = CFactory::_('Customcode.Gui')->set( - CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode($module->default_header) - ), CFactory::_('Placeholder')->active - ), - $guiMapper - ); - } - else - { - $module->default_header = ''; - } - // base64 Decode default - if (isset($module->default) - && StringHelper::check($module->default)) - { - // set GUI mapper field - $guiMapper['field'] = 'default'; - $guiMapper['type'] = 'html'; - $module->default = CFactory::_('Customcode.Gui')->set( - CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode($module->default) - ), CFactory::_('Placeholder')->active - ), - $guiMapper - ); - } - else - { - $module->default = '

No Tmpl set

'; - } - // start the config array - $module->config_fields = array(); - // create the form arrays - $module->form_files = array(); - $module->fieldsets_label = array(); - $module->fieldsets_paths = array(); - $module->add_rule_path = array(); - $module->add_field_path = array(); - // set global fields rule to default component path - $module->fields_rules_paths = 1; - // set the fields data - $module->fields = (isset($module->fields) - && JsonHelper::check($module->fields)) - ? json_decode($module->fields, true) : null; - if (ArrayHelper::check($module->fields)) - { - // ket global key - $key = $module->key; - $dynamic_fields = array('fieldset' => 'basic', - 'fields_name' => 'params', - 'file' => 'config'); - foreach ($module->fields as $n => &$form) - { - if (isset($form['fields']) - && ArrayHelper::check( - $form['fields'] - )) - { - // make sure the dynamic_field is set to dynamic_value by default - foreach ( - $dynamic_fields as $dynamic_field => - $dynamic_value - ) - { - if (!isset($form[$dynamic_field]) - || !StringHelper::check( - $form[$dynamic_field] - )) - { - $form[$dynamic_field] = $dynamic_value; - } - else - { - if ('fields_name' === $dynamic_field - && strpos($form[$dynamic_field], '.') - !== false) - { - $form[$dynamic_field] - = $form[$dynamic_field]; - } - else - { - $form[$dynamic_field] - = StringHelper::safe( - $form[$dynamic_field] - ); - } - } - } - // check if field is external form file - if (!isset($form['module']) || $form['module'] != 1) - { - // now build the form key - $unique = $form['file'] . $form['fields_name'] - . $form['fieldset']; - } - else - { - // now build the form key - $unique = $form['fields_name'] - . $form['fieldset']; - } - // set global fields rule path switches - if ($module->fields_rules_paths == 1 - && isset($form['fields_rules_paths']) - && $form['fields_rules_paths'] == 2) - { - $module->fields_rules_paths = 2; - } - // set where to path is pointing - $module->fieldsets_paths[$unique] - = $form['fields_rules_paths']; - // check for extra rule paths - if (isset($form['addrulepath']) - && ArrayHelper::check($form['addrulepath'])) - { - foreach ($form['addrulepath'] as $add_rule_path) - { - if (StringHelper::check($add_rule_path['path'])) - { - $module->add_rule_path[$unique] = $add_rule_path['path']; - } - } - } - // check for extra field paths - if (isset($form['addfieldpath']) - && ArrayHelper::check($form['addfieldpath'])) - { - foreach ($form['addfieldpath'] as $add_field_path) - { - if (StringHelper::check($add_field_path['path'])) - { - $module->add_field_path[$unique] = $add_field_path['path']; - } - } - } - // add the label if set to lang - if (isset($form['label']) - && StringHelper::check( - $form['label'] - )) - { - $module->fieldsets_label[$unique] - = CFactory::_('Language')->key($form['label']); - } - // build the fields - $form['fields'] = array_map( - function ($field) use ($key, $unique) { - // make sure the alias and title is 0 - $field['alias'] = 0; - $field['title'] = 0; - // set the field details - $this->setFieldDetails( - $field, $key, $key, $unique - ); - // update the default if set - if (StringHelper::check( - $field['custom_value'] - ) - && isset($field['settings'])) - { - if (($old_default - = GetHelper::between( - $field['settings']->xml, - 'default="', '"', false - )) !== false) - { - // replace old default - $field['settings']->xml - = str_replace( - 'default="' . $old_default - . '"', 'default="' - . $field['custom_value'] . '"', - $field['settings']->xml - ); - } - else - { - // add the default (hmmm not ideal but okay it should work) - $field['settings']->xml - = 'default="' - . $field['custom_value'] . '" ' - . $field['settings']->xml; - } - } - unset($field['custom_value']); - - // return field - return $field; - }, array_values($form['fields']) - ); - // check if field is external form file - if (!isset($form['module']) || $form['module'] != 1) - { - // load the form file - if (!isset($module->form_files[$form['file']])) - { - $module->form_files[$form['file']] - = array(); - } - if (!isset($module->form_files[$form['file']][$form['fields_name']])) - { - $module->form_files[$form['file']][$form['fields_name']] - = array(); - } - if (!isset($module->form_files[$form['file']][$form['fields_name']][$form['fieldset']])) - { - $module->form_files[$form['file']][$form['fields_name']][$form['fieldset']] - = array(); - } - // do some house cleaning (for fields) - foreach ($form['fields'] as $field) - { - // so first we lock the field name in - $this->getFieldName( - $field, $module->key, $unique - ); - // add the fields to the global form file builder - $module->form_files[$form['file']][$form['fields_name']][$form['fieldset']][] - = $field; - } - // remove form - unset($module->fields[$n]); - } - else - { - // load the config form - if (!isset($module->config_fields[$form['fields_name']])) - { - $module->config_fields[$form['fields_name']] - = array(); - } - if (!isset($module->config_fields[$form['fields_name']][$form['fieldset']])) - { - $module->config_fields[$form['fields_name']][$form['fieldset']] - = array(); - } - // do some house cleaning (for fields) - foreach ($form['fields'] as $field) - { - // so first we lock the field name in - $this->getFieldName( - $field, $module->key, $unique - ); - // add the fields to the config builder - $module->config_fields[$form['fields_name']][$form['fieldset']][] - = $field; - } - // remove form - unset($module->fields[$n]); - } - } - else - { - unset($module->fields[$n]); - } - } - } - unset($module->fields); - // set the add targets - $addArray = array('files' => 'files', - 'folders' => 'folders', - 'urls' => 'urls', - 'filesfullpath' => 'files', - 'foldersfullpath' => 'folders'); - foreach ($addArray as $addTarget => $targetHere) - { - // set the add target data - $module->{'add' . $addTarget} = (isset( - $module->{'add' . $addTarget} - ) - && JsonHelper::check( - $module->{'add' . $addTarget} - )) ? json_decode($module->{'add' . $addTarget}, true) - : null; - if (ArrayHelper::check( - $module->{'add' . $addTarget} - )) - { - if (isset($module->{$targetHere}) - && ArrayHelper::check( - $module->{$targetHere} - )) - { - foreach ($module->{'add' . $addTarget} as $taget) - { - $module->{$targetHere}[] = $taget; - } - } - else - { - $module->{$targetHere} = array_values( - $module->{'add' . $addTarget} - ); - } - } - unset($module->{'add' . $addTarget}); - } - // load the library - if (!isset($this->libManager[CFactory::_('Config')->build_target])) - { - $this->libManager[CFactory::_('Config')->build_target] = array(); - } - if (!isset($this->libManager[CFactory::_('Config')->build_target][$module->code_name])) - { - $this->libManager[CFactory::_('Config')->build_target][$module->code_name] - = array(); - } - // make sure json become array - if (JsonHelper::check($module->libraries)) - { - $module->libraries = json_decode($module->libraries, true); - } - // if we have an array add it - if (ArrayHelper::check($module->libraries)) - { - foreach ($module->libraries as $library) - { - if (!isset($this->libManager[CFactory::_('Config')->build_target][$module->code_name][$library])) - { - if ($this->getMediaLibrary((int) $library)) - { - $this->libManager[CFactory::_('Config')->build_target][$module->code_name][(int) $library] - = true; - } - } - } - } - elseif (is_numeric($module->libraries) - && !isset($this->libManager[CFactory::_('Config')->build_target][$module->code_name][(int) $module->libraries])) - { - if ($this->getMediaLibrary((int) $module->libraries)) - { - $this->libManager[CFactory::_('Config')->build_target][$module->code_name][(int) $module->libraries] - = true; - } - } - // add PHP in module install - $module->add_install_script = false; - $addScriptMethods = array('php_preflight', - 'php_postflight', - 'php_method'); - $addScriptTypes = array('install', 'update', - 'uninstall'); - // the next are php placeholders - $guiMapper['type'] = 'php'; - foreach ($addScriptMethods as $scriptMethod) - { - foreach ($addScriptTypes as $scriptType) - { - if (isset( - $module->{'add_' . $scriptMethod . '_' - . $scriptType} - ) - && $module->{'add_' . $scriptMethod . '_' - . $scriptType} == 1 - && StringHelper::check( - $module->{$scriptMethod . '_' . $scriptType} - )) - { - // set GUI mapper field - $guiMapper['field'] = $scriptMethod . '_' - . $scriptType; - $module->{$scriptMethod . '_' . $scriptType} - = CFactory::_('Customcode.Gui')->set( - CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode( - $module->{$scriptMethod . '_' - . $scriptType} - ) - ), CFactory::_('Placeholder')->active - ), - $guiMapper - ); - $module->add_install_script = true; - } - else - { - unset($module->{$scriptMethod . '_' . $scriptType}); - $module->{'add_' . $scriptMethod . '_' - . $scriptType} - = 0; - } - } - } - // add_sql - if ($module->add_sql == 1 - && StringHelper::check($module->sql)) - { - $module->sql = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add(base64_decode($module->sql)), - CFactory::_('Placeholder')->active - ); - } - else - { - unset($module->sql); - $module->add_sql = 0; - } - // add_sql_uninstall - if ($module->add_sql_uninstall == 1 - && StringHelper::check( - $module->sql_uninstall - )) - { - $module->sql_uninstall = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode($module->sql_uninstall) - ), CFactory::_('Placeholder')->active - ); - } - else - { - unset($module->sql_uninstall); - $module->add_sql_uninstall = 0; - } - // update the URL of the update_server if set - if ($module->add_update_server == 1 - && StringHelper::check( - $module->update_server_url - )) - { - $module->update_server_url = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add($module->update_server_url), - CFactory::_('Placeholder')->active - ); - } - // add the update/sales server FTP details if that is the expected protocol - $serverArray = array('update_server', 'sales_server'); - foreach ($serverArray as $server) - { - if ($module->{'add_' . $server} == 1 - && is_numeric( - $module->{$server} - ) - && $module->{$server} > 0) - { - // get the server protocol - $module->{$server . '_protocol'} - = GetHelper::var( - 'server', (int) $module->{$server}, 'id', 'protocol' - ); - } - else - { - $module->{$server} = 0; - // only change this for sales server (update server can be added loacaly to the zip file) - if ('sales_server' === $server) - { - $module->{'add_' . $server} = 0; - } - $module->{$server . '_protocol'} = 0; - } - } - // set the update server stuff (TODO) - // update_server_xml_path - // update_server_xml_file_name - - // rest globals - CFactory::_('Config')->build_target = $_backup_target; - CFactory::_('Config')->lang_target = $_backup_lang; - $this->langPrefix = $_backup_langPrefix; - CFactory::_('Config')->set('lang_prefix', $_backup_langPrefix); - - unset( - CFactory::_('Placeholder')->active[Placefix::_('Module_name')] - ); - unset(CFactory::_('Placeholder')->active[Placefix::_('Module')]); - unset(CFactory::_('Placeholder')->active[Placefix::_('module')]); - unset( - CFactory::_('Placeholder')->active[Placefix::_('module.version')] - ); - unset( - CFactory::_('Placeholder')->active[Placefix::_('module_version')] - ); - - $this->joomlaModules[$id] = $module; - - return true; - } - } - - return false; - } - - /** - * get the module xml template - * - * @return string - * - */ - public function getModuleXMLTemplate(&$module) - { - $xml = ''; - $xml .= PHP_EOL . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . $module->lang_prefix - . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . Placefix::_h('BUILDDATE') . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . Placefix::_h('AUTHOR') . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . Placefix::_h('AUTHOREMAIL') . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . Placefix::_h('AUTHORWEBSITE') . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . Placefix::_h('COPYRIGHT') . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . Placefix::_h('LICENSE') . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . $module->module_version - . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . $module->lang_prefix - . '_XML_DESCRIPTION'; - $xml .= Placefix::_h('MAINXML'); - $xml .= PHP_EOL . ''; - - return $xml; - } - - /** - * get the module admin custom script field - * - * @return string - * - */ - public function getModAdminVvvvvvvdm($fieldScriptBucket) - { - $form_field_class = array(); - $form_field_class[] = Placefix::_h('BOM') . PHP_EOL; - $form_field_class[] = "//" . Line::_(__Line__, __Class__) - . " No direct access to this file"; - $form_field_class[] = "defined('_JEXEC') or die('Restricted access');"; - $form_field_class[] = PHP_EOL . "use Joomla\CMS\Form\FormField;"; - $form_field_class[] = "use Joomla\CMS\Factory;"; - $form_field_class[] = PHP_EOL - . "class JFormFieldModadminvvvvvvvdm extends FormField"; - $form_field_class[] = "{"; - $form_field_class[] = Indent::_(1) - . "protected \$type = 'modadminvvvvvvvdm';"; - $form_field_class[] = PHP_EOL . Indent::_(1) - . "protected function getLabel()"; - $form_field_class[] = Indent::_(1) . "{"; - $form_field_class[] = Indent::_(2) . "return;"; - $form_field_class[] = Indent::_(1) . "}"; - $form_field_class[] = PHP_EOL . Indent::_(1) - . "protected function getInput()"; - $form_field_class[] = Indent::_(1) . "{"; - $form_field_class[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) - . " Get the document"; - $form_field_class[] = Indent::_(2) - . "\$document = Factory::getDocument();"; - $form_field_class[] = implode(PHP_EOL, $fieldScriptBucket); - $form_field_class[] = Indent::_(2) . "return; // noting for now :)"; - $form_field_class[] = Indent::_(1) . "}"; - $form_field_class[] = "}"; - - return implode(PHP_EOL, $form_field_class); - } - - /** - * get the Joomla plugins IDs - * - * @return array of IDs on success - * - */ - protected function getPluginIDs() - { - if (($addjoomla_plugins = GetHelper::var( - 'component_plugins', CFactory::_('Config')->component_id, 'joomla_component', - 'addjoomla_plugins' - )) !== false) - { - $addjoomla_plugins = (JsonHelper::check( - $addjoomla_plugins - )) ? json_decode($addjoomla_plugins, true) : null; - if (ArrayHelper::check($addjoomla_plugins)) - { - $joomla_plugins = array_filter( - array_values($addjoomla_plugins), - function ($array) { - // only load the plugins whose target association call for it - if (!isset($array['target']) || $array['target'] != 2) - { - return true; - } - - return false; - } - ); - // if we have values we return IDs - if (ArrayHelper::check($joomla_plugins)) - { - return array_map( - function ($array) { - return (int) $array['plugin']; - }, $joomla_plugins - ); - } - } - } - - return false; - } - - /** - * get the Joomla plugin path - * - * @return string of plugin path on success - * - */ - protected function getPluginPath($id) - { - if (is_numeric($id) && $id > 0) - { - // Create a new query object. - $query = $this->db->getQuery(true); - - $query->select('a.*'); - $query->select( - $this->db->quoteName( - array( - 'a.name', - 'g.name' - ), array( - 'name', - 'group' - ) - ) - ); - // from these tables - $query->from('#__componentbuilder_joomla_plugin AS a'); - $query->join( - 'LEFT', $this->db->quoteName( - '#__componentbuilder_joomla_plugin_group', 'g' - ) . ' ON (' . $this->db->quoteName('a.joomla_plugin_group') - . ' = ' . $this->db->quoteName('g.id') . ')' - ); - $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); - $this->db->setQuery($query); - $this->db->execute(); - if ($this->db->getNumRows()) - { - // get the plugin data - $plugin = $this->db->loadObject(); - // update the name if it has dynamic values - $plugin->name = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add($plugin->name), - $this->globalPlaceholders - ); - // update the name if it has dynamic values - $plugin->code_name - = ClassfunctionHelper::safe( - $plugin->name - ); - // set plugin folder name - $plugin->group = strtolower($plugin->group); - // set plugin file name - $plugin->file_name = strtolower($plugin->code_name); - // set the lang key - CFactory::_('Language.Extractor')->langKeys['PLG_' . strtoupper( - $plugin->group . '_' . $plugin->file_name - )] - = $plugin->id . '_P|uG!n'; - - // return the path - return $plugin->group . '/' . $plugin->file_name; - } - } - - return false; - } - - /** - * set the Joomla plugins - * - * @return true - * - */ - public function setJoomlaPlugin($id, &$component) - { - if (isset($this->joomlaPlugins[$id])) - { - return true; - } - else - { - // Create a new query object. - $query = $this->db->getQuery(true); - - $query->select('a.*'); - $query->select( - $this->db->quoteName( - array( - 'g.name', - 'e.name', - 'e.head', - 'e.comment', - 'e.id', - 'f.addfiles', - 'f.addfolders', - 'f.addfilesfullpath', - 'f.addfoldersfullpath', - 'f.addurls', - 'u.version_update', - 'u.id' - ), array( - 'group', - 'extends', - 'class_head', - 'comment', - 'class_id', - 'addfiles', - 'addfolders', - 'addfilesfullpath', - 'addfoldersfullpath', - 'addurls', - 'version_update', - 'version_update_id' - ) - ) - ); - // from these tables - $query->from('#__componentbuilder_joomla_plugin AS a'); - $query->join( - 'LEFT', $this->db->quoteName( - '#__componentbuilder_joomla_plugin_group', 'g' - ) . ' ON (' . $this->db->quoteName('a.joomla_plugin_group') - . ' = ' . $this->db->quoteName('g.id') . ')' - ); - $query->join( - 'LEFT', - $this->db->quoteName('#__componentbuilder_class_extends', 'e') - . ' ON (' . $this->db->quoteName('a.class_extends') . ' = ' - . $this->db->quoteName('e.id') . ')' - ); - $query->join( - 'LEFT', $this->db->quoteName( - '#__componentbuilder_joomla_plugin_updates', 'u' - ) . ' ON (' . $this->db->quoteName('a.id') . ' = ' - . $this->db->quoteName('u.joomla_plugin') . ')' - ); - $query->join( - 'LEFT', $this->db->quoteName( - '#__componentbuilder_joomla_plugin_files_folders_urls', 'f' - ) . ' ON (' . $this->db->quoteName('a.id') . ' = ' - . $this->db->quoteName('f.joomla_plugin') . ')' - ); - $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); - $query->where($this->db->quoteName('a.published') . ' >= 1'); - $this->db->setQuery($query); - $this->db->execute(); - if ($this->db->getNumRows()) - { - // get the plugin data - $plugin = $this->db->loadObject(); - // tweak system to set stuff to the plugin domain - $_backup_target = CFactory::_('Config')->build_target; - $_backup_lang = CFactory::_('Config')->lang_target; - $_backup_langPrefix = CFactory::_('Config')->lang_prefix; - // set some keys - $plugin->target_type = 'P|uG!n'; - $plugin->key = $plugin->id . '_' . $plugin->target_type; - // update to point to plugin - CFactory::_('Config')->build_target = $plugin->key; - CFactory::_('Config')->lang_target = $plugin->key; - // set version if not set - if (empty($plugin->plugin_version)) - { - $plugin->plugin_version = '1.0.0'; - } - // set GUI mapper - $guiMapper = array('table' => 'joomla_plugin', - 'id' => (int) $id, 'type' => 'php'); - // update the name if it has dynamic values - $plugin->name = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add($plugin->name), CFactory::_('Placeholder')->active - ); - // update the name if it has dynamic values - $plugin->code_name - = ClassfunctionHelper::safe( - $plugin->name - ); - // set official name - $plugin->official_name = ucwords( - $plugin->group . ' - ' . $plugin->name - ); - // set langPrefix - $this->langPrefix - = PluginHelper::safeLangPrefix( - $plugin->code_name, - $plugin->group - ); - CFactory::_('Config')->set('lang_prefix', $this->langPrefix); - // set lang prefix - $plugin->lang_prefix = CFactory::_('Config')->lang_prefix; - // set plugin class name - $plugin->class_name - = PluginHelper::safeClassName( - $plugin->code_name, - $plugin->group - ); - // set plugin install class name - $plugin->installer_class_name - = PluginHelper::safeInstallClassName( - $plugin->code_name, - $plugin->group - ); - // set plugin folder name - $plugin->folder_name - = PluginHelper::safeFolderName( - $plugin->code_name, - $plugin->group - ); - // set the zip name - $plugin->zip_name = $plugin->folder_name . '_v' . str_replace( - '.', '_', $plugin->plugin_version - ) . '__J' . CFactory::_('Config')->joomla_version; - // set plugin file name - $plugin->file_name = strtolower($plugin->code_name); - // set plugin context - $plugin->context = $plugin->folder_name . '.' . $plugin->id; - // set official_name lang strings - CFactory::_('Language')->set( - $plugin->key, CFactory::_('Config')->lang_prefix, $plugin->official_name - ); - // set some placeholder for this plugin - CFactory::_('Placeholder')->active[Placefix::_('Plugin_name')] - = $plugin->official_name; - CFactory::_('Placeholder')->active[Placefix::_h('PLUGIN_NAME')] - = $plugin->official_name; - CFactory::_('Placeholder')->active[Placefix::_('Plugin')] - = ucfirst( - $plugin->code_name - ); - CFactory::_('Placeholder')->active[Placefix::_('plugin')] - = strtolower( - $plugin->code_name - ); - CFactory::_('Placeholder')->active[Placefix::_('Plugin_group')] - = ucfirst( - $plugin->group - ); - CFactory::_('Placeholder')->active[Placefix::_('plugin_group')] - = strtolower( - $plugin->group - ); - CFactory::_('Placeholder')->active[Placefix::_('plugin.version')] - = $plugin->plugin_version; - CFactory::_('Placeholder')->active[Placefix::_h('VERSION')] - = $plugin->plugin_version; - CFactory::_('Placeholder')->active[Placefix::_('plugin_version')] - = str_replace( - '.', '_', $plugin->plugin_version - ); - // set description - CFactory::_('Placeholder')->active[Placefix::_h('DESCRIPTION')] - = ''; - if (!isset($plugin->description) - || !StringHelper::check( - $plugin->description - )) - { - $plugin->description = ''; - } - else - { - $plugin->description = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add($plugin->description), - CFactory::_('Placeholder')->active - ); - CFactory::_('Language')->set( - $plugin->key, $plugin->lang_prefix . '_DESCRIPTION', - $plugin->description - ); - // set description - CFactory::_('Placeholder')->active[Placefix::_h('DESCRIPTION')] - = $plugin->description; - $plugin->description = '

' . $plugin->description - . '

'; - } - $plugin->xml_description = "

" . $plugin->official_name - . " (v." . $plugin->plugin_version - . ")

" - . $plugin->description . "

Created by " . trim( - JFilterOutput::cleanText($component->author) - ) . "
Development started " - . JFactory::getDate($plugin->created)->format("jS F, Y") - . "

"; - // set xml discription - CFactory::_('Language')->set( - $plugin->key, $plugin->lang_prefix . '_XML_DESCRIPTION', - $plugin->xml_description - ); - // update the readme if set - if ($plugin->addreadme == 1 && !empty($plugin->readme)) - { - $plugin->readme = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add(base64_decode($plugin->readme)), - CFactory::_('Placeholder')->active - ); - } - else - { - $plugin->addreadme = 0; - unset($plugin->readme); - } - // open some base64 strings - if (!empty($plugin->main_class_code)) - { - // set GUI mapper field - $guiMapper['field'] = 'main_class_code'; - // base64 Decode main_class_code. - $plugin->main_class_code = CFactory::_('Customcode.Gui')->set( - CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode($plugin->main_class_code) - ), CFactory::_('Placeholder')->active - ), - $guiMapper - ); - } - // set the head :) - if ($plugin->add_head == 1 && !empty($plugin->head)) - { - // set GUI mapper field - $guiMapper['field'] = 'head'; - // base64 Decode head. - $plugin->head = CFactory::_('Customcode.Gui')->set( - CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode($plugin->head) - ), CFactory::_('Placeholder')->active - ), - $guiMapper - ); - } - elseif (!empty($plugin->class_head)) - { - // base64 Decode head. - $plugin->head = CFactory::_('Customcode.Gui')->set( - CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode($plugin->class_head) - ), CFactory::_('Placeholder')->active - ), - array( - 'table' => 'class_extends', - 'field' => 'head', - 'id' => (int) $plugin->class_id, - 'type' => 'php') - ); - } - unset($plugin->class_head); - // set the comment - if (!empty($plugin->comment)) - { - // base64 Decode comment. - $plugin->comment = CFactory::_('Customcode.Gui')->set( - CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode($plugin->comment) - ), CFactory::_('Placeholder')->active - ), - array( - 'table' => 'class_extends', - 'field' => 'comment', - 'id' => (int) $plugin->class_id, - 'type' => 'php') - ); - } - // start the config array - $plugin->config_fields = array(); - // create the form arrays - $plugin->form_files = array(); - $plugin->fieldsets_label = array(); - $plugin->fieldsets_paths = array(); - $plugin->add_rule_path = array(); - $plugin->add_field_path = array(); - // set global fields rule to default component path - $plugin->fields_rules_paths = 1; - // set the fields data - $plugin->fields = (isset($plugin->fields) - && JsonHelper::check($plugin->fields)) - ? json_decode($plugin->fields, true) : null; - if (ArrayHelper::check($plugin->fields)) - { - // ket global key - $key = $plugin->key; - $dynamic_fields = array('fieldset' => 'basic', - 'fields_name' => 'params', - 'file' => 'config'); - foreach ($plugin->fields as $n => &$form) - { - if (isset($form['fields']) - && ArrayHelper::check( - $form['fields'] - )) - { - // make sure the dynamic_field is set to dynamic_value by default - foreach ( - $dynamic_fields as $dynamic_field => - $dynamic_value - ) - { - if (!isset($form[$dynamic_field]) - || !StringHelper::check( - $form[$dynamic_field] - )) - { - $form[$dynamic_field] = $dynamic_value; - } - else - { - if ('fields_name' === $dynamic_field - && strpos($form[$dynamic_field], '.') - !== false) - { - $form[$dynamic_field] - = $form[$dynamic_field]; - } - else - { - $form[$dynamic_field] - = StringHelper::safe( - $form[$dynamic_field] - ); - } - } - } - // check if field is external form file - if (!isset($form['plugin']) || $form['plugin'] != 1) - { - // now build the form key - $unique = $form['file'] . $form['fields_name'] - . $form['fieldset']; - } - else - { - // now build the form key - $unique = $form['fields_name'] - . $form['fieldset']; - } - // set global fields rule path switchs - if ($plugin->fields_rules_paths == 1 - && isset($form['fields_rules_paths']) - && $form['fields_rules_paths'] == 2) - { - $plugin->fields_rules_paths = 2; - } - // set where to path is pointing - $plugin->fieldsets_paths[$unique] - = $form['fields_rules_paths']; - // add the label if set to lang - if (isset($form['label']) - && StringHelper::check( - $form['label'] - )) - { - $plugin->fieldsets_label[$unique] - = CFactory::_('Language')->key($form['label']); - } - // check for extra rule paths - if (isset($form['addrulepath']) - && ArrayHelper::check($form['addrulepath'])) - { - foreach ($form['addrulepath'] as $add_rule_path) - { - if (StringHelper::check($add_rule_path['path'])) - { - $plugin->add_rule_path[$unique] = $add_rule_path['path']; - } - } - } - // check for extra field paths - if (isset($form['addfieldpath']) - && ArrayHelper::check($form['addfieldpath'])) - { - foreach ($form['addfieldpath'] as $add_field_path) - { - if (StringHelper::check($add_field_path['path'])) - { - $plugin->add_field_path[$unique] = $add_field_path['path']; - } - } - } - // build the fields - $form['fields'] = array_map( - function ($field) use ($key, $unique) { - // make sure the alias and title is 0 - $field['alias'] = 0; - $field['title'] = 0; - // set the field details - $this->setFieldDetails( - $field, $key, $key, $unique - ); - // update the default if set - if (StringHelper::check( - $field['custom_value'] - ) - && isset($field['settings'])) - { - if (($old_default - = GetHelper::between( - $field['settings']->xml, - 'default="', '"', false - )) !== false) - { - // replace old default - $field['settings']->xml - = str_replace( - 'default="' . $old_default - . '"', 'default="' - . $field['custom_value'] . '"', - $field['settings']->xml - ); - } - else - { - // add the default (hmmm not ideal but okay it should work) - $field['settings']->xml - = 'default="' - . $field['custom_value'] . '" ' - . $field['settings']->xml; - } - } - unset($field['custom_value']); - - // return field - return $field; - }, array_values($form['fields']) - ); - // check if field is external form file - if (!isset($form['plugin']) || $form['plugin'] != 1) - { - // load the form file - if (!isset($plugin->form_files[$form['file']])) - { - $plugin->form_files[$form['file']] - = array(); - } - if (!isset($plugin->form_files[$form['file']][$form['fields_name']])) - { - $plugin->form_files[$form['file']][$form['fields_name']] - = array(); - } - if (!isset($plugin->form_files[$form['file']][$form['fields_name']][$form['fieldset']])) - { - $plugin->form_files[$form['file']][$form['fields_name']][$form['fieldset']] - = array(); - } - // do some house cleaning (for fields) - foreach ($form['fields'] as $field) - { - // so first we lock the field name in - $this->getFieldName( - $field, $plugin->key, $unique - ); - // add the fields to the global form file builder - $plugin->form_files[$form['file']][$form['fields_name']][$form['fieldset']][] - = $field; - } - // remove form - unset($plugin->fields[$n]); - } - else - { - // load the config form - if (!isset($plugin->config_fields[$form['fields_name']])) - { - $plugin->config_fields[$form['fields_name']] - = array(); - } - if (!isset($plugin->config_fields[$form['fields_name']][$form['fieldset']])) - { - $plugin->config_fields[$form['fields_name']][$form['fieldset']] - = array(); - } - // do some house cleaning (for fields) - foreach ($form['fields'] as $field) - { - // so first we lock the field name in - $this->getFieldName( - $field, $plugin->key, $unique - ); - // add the fields to the config builder - $plugin->config_fields[$form['fields_name']][$form['fieldset']][] - = $field; - } - // remove form - unset($plugin->fields[$n]); - } - } - else - { - unset($plugin->fields[$n]); - } - } - } - unset($plugin->fields); - // set the add targets - $addArray = array('files' => 'files', - 'folders' => 'folders', - 'urls' => 'urls', - 'filesfullpath' => 'files', - 'foldersfullpath' => 'folders'); - foreach ($addArray as $addTarget => $targetHere) - { - // set the add target data - $plugin->{'add' . $addTarget} = (isset( - $plugin->{'add' . $addTarget} - ) - && JsonHelper::check( - $plugin->{'add' . $addTarget} - )) ? json_decode($plugin->{'add' . $addTarget}, true) - : null; - if (ArrayHelper::check( - $plugin->{'add' . $addTarget} - )) - { - if (isset($plugin->{$targetHere}) - && ArrayHelper::check( - $plugin->{$targetHere} - )) - { - foreach ($plugin->{'add' . $addTarget} as $taget) - { - $plugin->{$targetHere}[] = $taget; - } - } - else - { - $plugin->{$targetHere} = array_values( - $plugin->{'add' . $addTarget} - ); - } - } - unset($plugin->{'add' . $addTarget}); - } - // add PHP in plugin install - $plugin->add_install_script = false; - $addScriptMethods = array('php_preflight', - 'php_postflight', - 'php_method'); - $addScriptTypes = array('install', 'update', - 'uninstall'); - foreach ($addScriptMethods as $scriptMethod) - { - foreach ($addScriptTypes as $scriptType) - { - if (isset( - $plugin->{'add_' . $scriptMethod . '_' - . $scriptType} - ) - && $plugin->{'add_' . $scriptMethod . '_' - . $scriptType} == 1 - && StringHelper::check( - $plugin->{$scriptMethod . '_' . $scriptType} - )) - { - // set GUI mapper field - $guiMapper['field'] = $scriptMethod . '_' - . $scriptType; - $plugin->{$scriptMethod . '_' . $scriptType} - = CFactory::_('Customcode.Gui')->set( - CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode( - $plugin->{$scriptMethod . '_' - . $scriptType} - ) - ), CFactory::_('Placeholder')->active - ), - $guiMapper - ); - $plugin->add_install_script = true; - } - else - { - unset($plugin->{$scriptMethod . '_' . $scriptType}); - $plugin->{'add_' . $scriptMethod . '_' - . $scriptType} - = 0; - } - } - } - // add_sql - if ($plugin->add_sql == 1 - && StringHelper::check($plugin->sql)) - { - $plugin->sql = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add(base64_decode($plugin->sql)), - CFactory::_('Placeholder')->active - ); - } - else - { - unset($plugin->sql); - $plugin->add_sql = 0; - } - // add_sql_uninstall - if ($plugin->add_sql_uninstall == 1 - && StringHelper::check( - $plugin->sql_uninstall - )) - { - $plugin->sql_uninstall = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add( - base64_decode($plugin->sql_uninstall) - ), CFactory::_('Placeholder')->active - ); - } - else - { - unset($plugin->sql_uninstall); - $plugin->add_sql_uninstall = 0; - } - // update the URL of the update_server if set - if ($plugin->add_update_server == 1 - && StringHelper::check( - $plugin->update_server_url - )) - { - $plugin->update_server_url = CFactory::_('Placeholder')->update( - CFactory::_('Customcode')->add($plugin->update_server_url), - CFactory::_('Placeholder')->active - ); - } - // add the update/sales server FTP details if that is the expected protocol - $serverArray = array('update_server', 'sales_server'); - foreach ($serverArray as $server) - { - if ($plugin->{'add_' . $server} == 1 - && is_numeric( - $plugin->{$server} - ) - && $plugin->{$server} > 0) - { - // get the server protocol - $plugin->{$server . '_protocol'} - = GetHelper::var( - 'server', (int) $plugin->{$server}, 'id', 'protocol' - ); - } - else - { - $plugin->{$server} = 0; - // only change this for sales server (update server can be added locally to the zip file) - if ('sales_server' === $server) - { - $plugin->{'add_' . $server} = 0; - } - $plugin->{$server . '_protocol'} = 0; - } - } - // set the update server stuff (TODO) - // update_server_xml_path - // update_server_xml_file_name - - // rest globals - CFactory::_('Config')->build_target = $_backup_target; - CFactory::_('Config')->lang_target = $_backup_lang; - $this->langPrefix = $_backup_langPrefix; - CFactory::_('Config')->set('lang_prefix', $_backup_langPrefix); - - unset( - CFactory::_('Placeholder')->active[Placefix::_('Plugin_name')] - ); - unset(CFactory::_('Placeholder')->active[Placefix::_('Plugin')]); - unset(CFactory::_('Placeholder')->active[Placefix::_('plugin')]); - unset( - CFactory::_('Placeholder')->active[Placefix::_('Plugin_group')] - ); - unset( - CFactory::_('Placeholder')->active[Placefix::_('plugin_group')] - ); - unset( - CFactory::_('Placeholder')->active[Placefix::_('plugin.version')] - ); - unset( - CFactory::_('Placeholder')->active[Placefix::_('plugin_version')] - ); - unset( - CFactory::_('Placeholder')->active[Placefix::_h('VERSION')] - ); - unset( - CFactory::_('Placeholder')->active[Placefix::_h('DESCRIPTION')] - ); - unset( - CFactory::_('Placeholder')->active[Placefix::_h('PLUGIN_NAME')] - ); - - $this->joomlaPlugins[$id] = $plugin; - - return true; - } - } - - return false; - } - - /** - * get the plugin xml template - * - * @return string - * - */ - public function getPluginXMLTemplate(&$plugin) - { - $xml = ''; - $xml .= PHP_EOL . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . $plugin->lang_prefix - . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . Placefix::_h('BUILDDATE') . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . Placefix::_h('AUTHOR') . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . Placefix::_h('AUTHOREMAIL') . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . Placefix::_h('AUTHORWEBSITE') . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . Placefix::_h('COPYRIGHT') . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . Placefix::_h('LICENSE') . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . $plugin->plugin_version - . ''; - $xml .= PHP_EOL . Indent::_(1) . '' . $plugin->lang_prefix - . '_XML_DESCRIPTION'; - $xml .= Placefix::_h('MAINXML'); - $xml .= PHP_EOL . ''; - - return $xml; - } - - /** - * store the code - * - * @param int $when To set when to update - * - * @return void - * - */ - protected function setNewCustomCode($when = 1) - { - if (count((array) $this->newCustomCode) >= $when) - { - // Create a new query object. - $query = $this->db->getQuery(true); - $continue = false; - // Insert columns. - $columns = array('path', 'type', 'target', 'comment_type', - 'component', 'published', 'created', 'created_by', - 'version', 'access', 'hashtarget', 'from_line', - 'to_line', 'code', 'hashendtarget'); - // Prepare the insert query. - $query->insert( - $this->db->quoteName('#__componentbuilder_custom_code') - ); - $query->columns($this->db->quoteName($columns)); - foreach ($this->newCustomCode as $values) - { - if (count((array) $values) == 15) - { - $query->values(implode(',', $values)); - $continue = true; - } - else - { - // TODO line mismatch... should not happen - } - } - // clear the values array - $this->newCustomCode = array(); - if (!$continue) - { - return false; // insure we dont continue if no values were loaded - } - // Set the query using our newly populated query object and execute it. - $this->db->setQuery($query); - $this->db->execute(); - } - } - - /** - * store the code - * - * @param int $when To set when to update - * - * @return void - * - */ - protected function setExistingCustomCode($when = 1) - { - if (count((array) $this->existingCustomCode) >= $when) - { - foreach ($this->existingCustomCode as $code) - { - // Create a new query object. - $query = $this->db->getQuery(true); - // Prepare the update query. - $query->update( - $this->db->quoteName('#__componentbuilder_custom_code') - )->set($code['fields'])->where($code['conditions']); - // Set the query using our newly populated query object and execute it. - $this->db->setQuery($query); - $this->db->execute(); - } - // clear the values array - $this->existingCustomCode = array(); - } - } - - /** - * get the custom code from the local files - * - * @param array $paths The local paths to parse - * @param string $today The date for today - * - * @return void - * - */ - protected function customCodeFactory(&$paths, &$today) - { - // we must first store the current working directory - $joomla = getcwd(); - $counter = array(1 => 0, 2 => 0); - // file types to get - $fileTypes = array('\.php', '\.js', '\.xml'); - - // set some local placeholders - $placeholders = array_flip( - $this->globalPlaceholders - ); - $placeholders[StringHelper::safe( - CFactory::_('Config')->component_code_name, 'F' - ) . 'Helper::'] - = Placefix::_('Component') . 'Helper::'; - $placeholders['COM_' . StringHelper::safe( - CFactory::_('Config')->component_code_name, 'U' - )] - = 'COM_' . Placefix::_('COMPONENT'); - $placeholders['com_' . CFactory::_('Config')->component_code_name] = 'com_' . Placefix::_('component'); - // putt the last first - $placeholders = array_reverse($placeholders, true); - - foreach ($paths as $target => $path) - { - // we are changing the working directory to the component path - chdir($path); - foreach ($fileTypes as $type) - { - // get a list of files in the current directory tree (only PHP, JS and XML for now) - $files = Folder::files('.', $type, true, true); - // check if files found - if (ArrayHelper::check($files)) - { - foreach ($files as $file) - { - $this->searchFileContent( - $counter, $file, $target, - $this->customCodePlaceholders, $placeholders, $today - ); - // insert new code - if (ArrayHelper::check( - $this->newCustomCode - )) - { - $this->setNewCustomCode(100); - } - // update existing custom code - if (ArrayHelper::check( - $this->existingCustomCode - )) - { - $this->setExistingCustomCode(30); - } - } - } - } - } - // change back to Joomla working directory - chdir($joomla); - // make sure all code is stored - if (ArrayHelper::check($this->newCustomCode)) - { - $this->setNewCustomCode(); - } - // update existing custom code - if (ArrayHelper::check($this->existingCustomCode)) - { - $this->setExistingCustomCode(); - } - } - - /** - * search a file for placeholders and store result - * - * @param array $counter The counter for the arrays - * @param string $file The file path to search - * @param array $searchArray The values to search for - * @param array $placeholders The values to replace in the code being stored - * @param string $today The date for today - * - * @return array on success - * - */ - protected function searchFileContent(&$counter, &$file, &$target, - &$searchArray, &$placeholders, &$today - ) - { - // we add a new search for the GUI CODE Blocks - CFactory::_('Customcode.Gui')->search($file, $placeholders, $today, $target); - // reset each time per file - $loadEndFingerPrint = false; - $endFingerPrint = array(); - $fingerPrint = array(); - $codeBucket = array(); - $pointer = array(); - $reading = array(); - $reader = 0; - // reset found Start type - $commentType = 0; - // make sure we have the path correct (the script file is not in admin path for example) - // there may be more... will nead to keep our eye on this... since files could be moved during install - $file = str_replace('./', '', $file); # TODO (windows path issues) - if ($file !== 'script.php') - { - $path = $target . '/' . $file; - } - else - { - $path = $file; - } - // now we go line by line - foreach (new SplFileObject($file) as $lineNumber => $lineContent) - { - // we musk keep last few lines to dynamic find target entry later - $fingerPrint[$lineNumber] = trim($lineContent); - // load the end fingerprint - if ($loadEndFingerPrint) - { - $endFingerPrint[$lineNumber] = trim($lineContent); - } - foreach ($searchArray as $type => $search) - { - $i = (int) ($type == 3 || $type == 4) ? 2 : 1; - $_type = (int) ($type == 1 || $type == 3) ? 1 : 2; - if ($reader === 0 || $reader === $i) - { - $targetKey = $type; - $start = '/***[' . $search . '***/'; - $end = '/***[/' . $search . '***/'; - $startHTML = ''; - $endHTML = ''; - // check if the ending place holder was found - if (isset($reading[$targetKey]) && $reading[$targetKey] - && ((trim($lineContent) === $end - || strpos( - $lineContent, $end - ) !== false) - || (trim($lineContent) === $endHTML - || strpos( - $lineContent, $endHTML - ) !== false))) - { - // trim the placeholder and if there is still data then load it - if (isset($endReplace) - && ($_line - = $this->addLineChecker( - $endReplace, 2, $lineContent - )) !== false) - { - $codeBucket[$pointer[$targetKey]][] = $_line; - } - // deactivate the reader - $reading[$targetKey] = false; - if ($_type == 2) - { - // deactivate search - $reader = 0; - } - else - { - // activate fingerPrint for replacement end target - $loadEndFingerPrint = true; - $backupTargetKey = $targetKey; - $backupI = $i; - } - // all new records we can do a bulk insert - if ($i === 1) - { - // end the bucket info for this code block - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - (int) $lineNumber - ); // 'toline' - // first reverse engineer this code block - $c0de = CFactory::_('Placeholder.Reverse')->engine( - implode('', $codeBucket[$pointer[$targetKey]]), - $placeholders, $target - ); - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - base64_encode($c0de) - ); // 'code' - if ($_type == 2) - { - // load the last value - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote(0); // 'hashendtarget' - } - } - // the record already exist so we must update instead - elseif ($i === 2) - { - // end the bucket info for this code block - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] - = $this->db->quoteName('to_line') . ' = ' - . $this->db->quote($lineNumber); - // first reverse engineer this code block - $c0de = CFactory::_('Placeholder.Reverse')->engine( - implode('', $codeBucket[$pointer[$targetKey]]), - $placeholders, $target, - $this->existingCustomCode[$pointer[$targetKey]]['id'] - ); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] - = $this->db->quoteName('code') . ' = ' - . $this->db->quote(base64_encode($c0de)); - if ($_type == 2) - { - // load the last value - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] - = $this->db->quoteName('hashendtarget') - . ' = ' . $this->db->quote(0); - } - } - } - // check if the endfingerprint is ready to save - if (count((array) $endFingerPrint) === 3) - { - $hashendtarget = '3__' . md5( - implode('', $endFingerPrint) - ); - // all new records we can do a bulk insert - if ($i === 1) - { - // load the last value - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - $hashendtarget - ); // 'hashendtarget' - } - // the record already exist so we must use module to update - elseif ($i === 2) - { - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] - = $this->db->quoteName('hashendtarget') . ' = ' - . $this->db->quote($hashendtarget); - } - // reset the needed values - $endFingerPrint = array(); - $loadEndFingerPrint = false; - // deactivate reader (to allow other search) - $reader = 0; - } - // then read in the code - if (isset($reading[$targetKey]) && $reading[$targetKey]) - { - $codeBucket[$pointer[$targetKey]][] = $lineContent; - } - // see if the custom code line starts now with PHP/JS comment type - if ((!isset($reading[$targetKey]) || !$reading[$targetKey]) - && (($i === 1 && trim($lineContent) === $start) - || strpos($lineContent, $start) !== false)) - { - $commentType = 1; // PHP/JS type - $startReplace = $start; - $endReplace = $end; - } - // see if the custom code line starts now with HTML comment type - elseif ((!isset($reading[$targetKey]) - || !$reading[$targetKey]) - && (($i === 1 && trim($lineContent) === $startHTML) - || strpos($lineContent, $startHTML) !== false)) - { - $commentType = 2; // HTML type - $startReplace = $startHTML; - $endReplace = $endHTML; - } - // check if the starting place holder was found - if ($commentType > 0) - { - // if we have all on one line we have a problem (don't load it TODO) - if (strpos($lineContent, $endReplace) !== false) - { - // reset found comment type - $commentType = 0; - $this->app->enqueueMessage( - JText::_('

Custom Codes Warning

'), - 'Warning' - ); - $this->app->enqueueMessage( - JText::sprintf( - 'We found dynamic code all in one line, and ignored it! Please review (%s) for more details!', - $path - ), 'Warning' - ); - continue; - } - // do a quick check to insure we have an id - $id = false; - if ($i === 2) - { - $id = $this->getSystemID( - $lineContent, - array(1 => $start, 2 => $startHTML), - $commentType - ); - } - if ($i === 2 && $id > 0) - { - // make sure we update it only once even if found again. - if (isset($this->codeAreadyDone[$id])) - { - // reset found comment type - $commentType = 0; - continue; - } - // store the id to avoid duplication - $this->codeAreadyDone[$id] = (int) $id; - } - // start replace - $startReplace = $this->setStartReplace( - $id, $commentType, $startReplace - ); - // set active reader (to lock out other search) - $reader = $i; - // set pointer - $pointer[$targetKey] = $counter[$i]; - // activate the reader - $reading[$targetKey] = true; - // start code bucket - $codeBucket[$pointer[$targetKey]] = array(); - // trim the placeholder and if there is still data then load it - if ($_line = $this->addLineChecker( - $startReplace, 1, $lineContent - )) - { - $codeBucket[$pointer[$targetKey]][] = $_line; - } - // get the finger print around the custom code - $inFinger = count($fingerPrint); - $getFinger = $inFinger - 1; - $hasharray = array_slice( - $fingerPrint, -$inFinger, $getFinger, true - ); - $hasleng = count($hasharray); - $hashtarget = $hasleng . '__' . md5( - implode('', $hasharray) - ); - // for good practice - ComponentbuilderHelper::fixPath($path); - // all new records we can do a bulk insert - if ($i === 1 || !$id) - { - // start the bucket for this code - $this->newCustomCode[$pointer[$targetKey]] - = array(); - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - $path - ); // 'path' - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - (int) $_type - ); // 'type' - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - 1 - ); // 'target' - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - $commentType - ); // 'comment_type' - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - (int) CFactory::_('Config')->component_id - ); // 'component' - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - 1 - ); // 'published' - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - $today - ); // 'created' - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - (int) $this->user->id - ); // 'created_by' - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - 1 - ); // 'version' - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - 1 - ); // 'access' - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - $hashtarget - ); // 'hashtarget' - $this->newCustomCode[$pointer[$targetKey]][] - = $this->db->quote( - (int) $lineNumber - ); // 'fromline' - } - // the record already exist so we must update instead - elseif ($i === 2 && $id > 0) - { - // start the bucket for this code - $this->existingCustomCode[$pointer[$targetKey]] - = array(); - $this->existingCustomCode[$pointer[$targetKey]]['id'] - = (int) $id; - $this->existingCustomCode[$pointer[$targetKey]]['conditions'] - = array(); - $this->existingCustomCode[$pointer[$targetKey]]['conditions'][] - = $this->db->quoteName('id') . ' = ' - . $this->db->quote($id); - $this->existingCustomCode[$pointer[$targetKey]]['fields'] - = array(); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] - = $this->db->quoteName('path') . ' = ' - . $this->db->quote($path); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] - = $this->db->quoteName('type') . ' = ' - . $this->db->quote($_type); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] - = $this->db->quoteName('comment_type') . ' = ' - . $this->db->quote($commentType); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] - = $this->db->quoteName('component') . ' = ' - . $this->db->quote(CFactory::_('Config')->component_id); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] - = $this->db->quoteName('from_line') . ' = ' - . $this->db->quote($lineNumber); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] - = $this->db->quoteName('modified') . ' = ' - . $this->db->quote($today); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] - = $this->db->quoteName('modified_by') . ' = ' - . $this->db->quote($this->user->id); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] - = $this->db->quoteName('hashtarget') . ' = ' - . $this->db->quote($hashtarget); - } - else // this should actualy never happen - { - // de activate the reader - $reading[$targetKey] = false; - $reader = 0; - } - // reset found comment type - $commentType = 0; - // update the counter - $counter[$i]++; - } - } - } - // make sure only a few lines is kept at a time - if (count((array) $fingerPrint) > 10) - { - $fingerPrint = array_slice($fingerPrint, -6, 6, true); - } - } - // if the code is at the end of the page and there were not three more lines - if (count((array) $endFingerPrint) > 0 || $loadEndFingerPrint) - { - if (count((array) $endFingerPrint) > 0) - { - $leng = count($endFingerPrint); - $hashendtarget = $leng . '__' . md5( - implode('', $endFingerPrint) - ); - } - else - { - $hashendtarget = 0; - } - // all new records we can do a buldk insert - if ($backupI === 1) - { - // load the last value - $this->newCustomCode[$pointer[$backupTargetKey]][] - = $this->db->quote($hashendtarget); // 'hashendtarget' - } - // the record already exist so we must use module to update - elseif ($backupI === 2) - { - $this->existingCustomCode[$pointer[$backupTargetKey]]['fields'][] - = $this->db->quoteName('hashendtarget') . ' = ' - . $this->db->quote($hashendtarget); - } - } - } - - /** - * Set a hash of a file and/or string - * - * @param string $string The code string - * - * @return string - * @deprecated 3.3 Use CFactory::_('Customcode.Hash')->set($script); - */ - protected function setDynamicHASHING($script) - { - // check if we should hash a string - if (strpos($script, 'HASHSTRING((((') !== false) - { - // get the strings - $values = GetHelper::allBetween( - $script, 'HASHSTRING((((', '))))' - ); - $locker = array(); - // convert them - foreach ($values as $value) - { - $locker['HASHSTRING((((' . $value . '))))'] - = md5($value); - } - - // update the script - return CFactory::_('Placeholder')->update($script, $locker); - } - // check if we should hash a file - if (strpos($script, 'HASHFILE((((') !== false) - { - // get the strings - $values = GetHelper::allBetween( - $script, 'HASHFILE((((', '))))' - ); - $locker = array(); - // convert them - foreach ($values as $path) - { - // we first get the file if it exist - if ($value = FileHelper::getContent($path)) - { - // now we hash the file content - $locker['HASHFILE((((' . $path . '))))'] - = md5($value); - } - else - { - // could not retrieve the file so we show error - $locker['HASHFILE((((' . $path . '))))'] - = 'ERROR'; - } - } - - // update the script - return CFactory::_('Placeholder')->update($script, $locker); - } - - return $script; - } - - /** - * Lock a string with bsae64 (basic) - * - * @param string $string The code string - * - * @return string - * @deprecated 3.3 Use CFactory::_('Customcode.LockBase')->set($script); - */ - protected function setBase64LOCK($script) - { - if (strpos($script, 'LOCKBASE64((((') !== false) - { - // get the strings - $values = GetHelper::allBetween( - $script, 'LOCKBASE64((((', '))))' - ); - $locker = array(); - // convert them - foreach ($values as $value) - { - $locker['LOCKBASE64((((' . $value . '))))'] - = "base64_decode( preg_replace('/\s+/', ''," . - PHP_EOL . Indent::_(2) . "'" . - wordwrap( - base64_encode($value), 64, PHP_EOL . Indent::_(2), true - ) . - "'))"; - } - - // update the script - return CFactory::_('Placeholder')->update($script, $locker); - } - - return $script; - } - - /** - * Set the JCB GUI code placeholder - * - * @param string $string The code string - * @param array $config The placeholder config values - * - * @return string - * @deprecated 3.3 Use CFactory::_('Customcode.Gui')->set($string, $config); - */ - public function setGuiCodePlaceholder($string, $config) - { - return CFactory::_('Customcode.Gui')->set($string, $config); - } - - /** - * search a code to see if there is already any custom - * code or other reasons not to add the GUI code placeholders - * - * @param string $code The code to check - * - * @return boolean true if GUI code placeholders can be added - * @deprecated 3.3 - */ - protected function canAddGuiCodePlaceholder(&$code) - { - // check for customcode placeholders - if (strpos($code, '$$$$') !== false) - { - // we do not add GUI wrapper placeholder to code - // that already has any customcode placeholders - return false; - } - - return true; - } - - /** - * search a file for gui code blocks that were updated in the IDE - * - * @param string $file The file path to search - * @param array $placeholders The values to replace in the code being stored - * @param string $today The date for today - * @param string $target The target path type - * - * @return void - * @deprecated 3.3 Use CFactory::_('Customcode.Gui')->search($file, $placeholders, $today, $target); - */ - protected function guiCodeSearch(&$file, &$placeholders, &$today, &$target) - { - CFactory::_('Customcode.Gui')->search($file, $placeholders, $today, $target); - } - - /** - * Check if this line should be added - * - * @param string $replaceKey The key to remove from line - * @param int $type The line type - * @param string $lineContent The line to check - * - * @return bool true on success - * - */ - protected function addLineChecker($replaceKey, $type, $lineContent) - { - $check = explode($replaceKey, $lineContent); - switch ($type) - { - case 1: - // beginning of code - $i = trim($check[1]); - if (StringHelper::check($i)) - { - return $check[1]; - } - break; - case 2: - // end of code - $i = trim($check[0]); - if (StringHelper::check($i)) - { - return $check[0]; - } - break; - } - - return false; - } - - /** - * set the start replace placeholder - * - * @param int $id The comment id - * @param int $commentType The comment type - * @param string $startReplace The main replace string - * - * @return array on success - * - */ - protected function setStartReplace($id, $commentType, $startReplace) - { - if ($id > 0) - { - switch ($commentType) - { - case 1: // the PHP & JS type - $startReplace .= '/*' . $id . '*/'; - break; - case 2: // the HTML type - $startReplace .= ''; - break; - } - } - - return $startReplace; - } - - /** - * search for the system id in the line given - * - * @param string $lineContent The file path to search - * @param string $placeholders The values to search for - * @param int $commentType The comment type - * - * @return array on success - * - */ - protected function getSystemID(&$lineContent, $placeholders, $commentType) - { - $trim = '/'; - if ($commentType == 2) - { - $trim = ''; - // search if we must add the component path - $add_component_path = false; - foreach ($fields as $field_name => $fieldsets) - { - if (!$add_component_path) - { - foreach ($fieldsets as $fieldset => $field) - { - if (!$add_component_path - && isset( - $module->fieldsets_paths[$file - . $field_name . $fieldset] - ) - && $module->fieldsets_paths[$file - . $field_name . $fieldset] == 1) - { - $add_component_path = true; - } - } - } - } - // only add if part of the component field types path is required - if ($add_component_path) - { - $xml .= PHP_EOL . ''; - } - else - { - $xml .= PHP_EOL . '
'; - } - // add the fields - foreach ($fields as $field_name => $fieldsets) - { - // check if we have an double fields naming set - $field_name_inner = ''; - $field_name_outer = $field_name; - if (strpos($field_name, '.') !== false) - { - $field_names = explode('.', $field_name); - if (count((array) $field_names) == 2) - { - $field_name_outer = $field_names[0]; - $field_name_inner = $field_names[1]; - } - } - $xml .= PHP_EOL . Indent::_(1) - . ''; - foreach ($fieldsets as $fieldset => $field) - { - // default to the field set name - $label = $fieldset; - if (isset($module->fieldsets_label[$file . $field_name . $fieldset])) - { - $label = $module->fieldsets_label[$file . $field_name . $fieldset]; - } - // add path to module rules and custom fields - if (isset($module->fieldsets_paths[$file . $field_name . $fieldset]) - && ($module->fieldsets_paths[$file . $field_name . $fieldset] == 2 - || $module->fieldsets_paths[$file . $field_name . $fieldset] == 3)) - { - if ($module->target == 2) - { - if (!isset($module->add_rule_path[$file . $field_name . $fieldset])) - { - $module->add_rule_path[$file . $field_name . $fieldset] = - '/administrator/modules/' - . $module->file_name . '/rules'; - } - - if (!isset($module->add_field_path[$file . $field_name . $fieldset])) - { - $module->add_field_path[$file . $field_name . $fieldset] = - '/administrator/modules/' - . $module->file_name . '/fields'; - } - } - else - { - if (!isset($module->add_rule_path[$file . $field_name . $fieldset])) - { - $module->add_rule_path[$file . $field_name . $fieldset] = - '/modules/' . $module->file_name - . '/rules'; - } - - if (!isset($module->add_field_path[$file . $field_name . $fieldset])) - { - $module->add_field_path[$file . $field_name . $fieldset] = - '/modules/' . $module->file_name - . '/fields'; - } - } - } - // add path to module rules and custom fields - if (isset($module->add_rule_path[$file . $field_name . $fieldset]) - || isset($module->add_field_path[$file . $field_name . $fieldset])) - { - - $xml .= PHP_EOL . Indent::_(1) . ''; - - $xml .= PHP_EOL . Indent::_(1) . '
add_rule_path[$file . $field_name . $fieldset])) - { - $xml .= PHP_EOL . Indent::_(2) - . 'addrulepath="' . $module->add_rule_path[$file . $field_name . $fieldset] . '"'; - } - - if (isset($module->add_field_path[$file . $field_name . $fieldset])) - { - $xml .= PHP_EOL . Indent::_(2) - . 'addfieldpath="' . $module->add_field_path[$file . $field_name . $fieldset] . '"'; - } - - $xml .= PHP_EOL . Indent::_(1) . '>'; - } - else - { - $xml .= PHP_EOL . Indent::_(1) . '
'; - } - // check if we have an inner field set - if (StringHelper::check( - $field_name_inner - )) - { - $xml .= PHP_EOL . Indent::_(1) - . ''; - } - // add the placeholder of the fields - $xml .= Placefix::_h('FIELDSET_' . $file - . $field_name . $fieldset ); - // check if we have an inner field set - if (StringHelper::check( - $field_name_inner - )) - { - $xml .= PHP_EOL . Indent::_(1) - . ''; - } - $xml .= PHP_EOL . Indent::_(1) - . '
'; - } - $xml .= PHP_EOL . Indent::_(1) . ''; - } - $xml .= PHP_EOL . ''; - // add xml to file - $this->writeFile($fileDetails['path'], $xml); - $this->newFiles[$module->key][] = $fileDetails; - // count the file created - $this->fileCount++; - } - } - // set SQL stuff if needed - if ($module->add_sql || $module->add_sql_uninstall) - { - // create SQL folder - $this->createFolder($module->folder_path . '/sql'); - // create mysql folder - $this->createFolder( - $module->folder_path . '/sql/mysql' - ); - // now set the install file - if ($module->add_sql) - { - $this->writeFile( - $module->folder_path . '/sql/mysql/install.sql', - $module->sql - ); - // count the file created - $this->fileCount++; - } - // now set the uninstall file - if ($module->add_sql_uninstall) - { - $this->writeFile( - $module->folder_path - . '/sql/mysql/uninstall.sql', - $module->sql_uninstall - ); - // count the file created - $this->fileCount++; - } - } - // creat the language folder - $this->createFolder($module->folder_path . '/language'); - // also create the lang tag folder - $this->createFolder( - $module->folder_path . '/language/' . CFactory::_('Config')->get('lang_tag', 'en-GB') - ); - // check if this lib has files - if (isset($module->files) - && ArrayHelper::check($module->files)) - { - // add to component files - foreach ($module->files as $file) - { - // set the path finder - $file['target_type'] = $module->target_type; - $file['target_id'] = $module->id; - $this->componentData->files[] = $file; - } - } - // check if this lib has folders - if (isset($module->folders) - && ArrayHelper::check($module->folders)) - { - // add to component folders - foreach ($module->folders as $folder) - { - // set the path finder - $folder['target_type'] = $module->target_type; - $folder['target_id'] = $module->id; - $this->componentData->folders[] = $folder; - } - } - // check if this module has urls - if (isset($module->urls) - && ArrayHelper::check($module->urls)) - { - // add to component urls - foreach ($module->urls as $n => &$url) - { - // should we add the local folder - if (isset($url['type']) && $url['type'] > 1 - && isset($url['url']) - && StringHelper::check( - $url['url'] - )) - { - // set file name - $fileName = basename($url['url']); - // get the file contents - $data = FileHelper::getContent( - $url['url'] - ); - // build sub path - if (strpos($fileName, '.js') !== false) - { - $path = '/js'; - } - elseif (strpos($fileName, '.css') !== false) - { - $path = '/css'; - } - else - { - $path = ''; - } - // create sub media path if not set - $this->createFolder( - $module->folder_path . $path - ); - // set the path to module file - $url['path'] = $module->folder_path . $path - . '/' . $fileName; // we need this for later - // write data to path - $this->writeFile($url['path'], $data); - // count the file created - $this->fileCount++; - } - } - } - } - } - } - } - - /** - * Build the Plugins files, folders, url's and config - * - * @return void - * - */ - private function buildPlugins() - { - if (ArrayHelper::check($this->joomlaPlugins)) - { - // Trigger Event: jcb_ce_onBeforeSetPlugins - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeBuildPlugins', - array(&$this->componentContext, &$this->joomlaPlugins) - ); - foreach ($this->joomlaPlugins as $plugin) - { - if (ObjectHelper::check($plugin) - && isset($plugin->folder_name) - && StringHelper::check( - $plugin->folder_name - )) - { - // plugin path - $plugin->folder_path = CFactory::_('Config')->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/' - . $plugin->folder_name; - // set the plugin paths - $this->dynamicPaths[$plugin->key] = $plugin->folder_path; - // make sure there is no old build - $this->removeFolder($plugin->folder_path); - // creat the main component folder - $this->createFolder($plugin->folder_path); - // set main class file - $fileDetails = array('path' => $plugin->folder_path . '/' - . $plugin->file_name . '.php', - 'name' => $plugin->file_name . '.php', - 'zip' => $plugin->file_name . '.php'); - $this->writeFile( - $fileDetails['path'], - 'newFiles[$plugin->key][] = $fileDetails; - // count the file created - $this->fileCount++; - // set main xml file - $fileDetails = array('path' => $plugin->folder_path . '/' - . $plugin->file_name . '.xml', - 'name' => $plugin->file_name . '.xml', - 'zip' => $plugin->file_name . '.xml'); - $this->writeFile( - $fileDetails['path'], - $this->getPluginXMLTemplate($plugin) - ); - $this->newFiles[$plugin->key][] = $fileDetails; - // count the file created - $this->fileCount++; - // set install script if needed - if ($plugin->add_install_script) - { - $fileDetails = array('path' => $plugin->folder_path - . '/script.php', - 'name' => 'script.php', - 'zip' => 'script.php'); - $this->writeFile( - $fileDetails['path'], - 'newFiles[$plugin->key][] = $fileDetails; - // count the file created - $this->fileCount++; - } - // set readme if found - if ($plugin->addreadme) - { - $fileDetails = array('path' => $plugin->folder_path - . '/README.md', - 'name' => 'README.md', - 'zip' => 'README.md'); - $this->writeFile($fileDetails['path'], $plugin->readme); - $this->newFiles[$plugin->key][] = $fileDetails; - // count the file created - $this->fileCount++; - } - // set fields & rules folders if needed - if (isset($plugin->fields_rules_paths) - && $plugin->fields_rules_paths == 2) - { - // create fields folder - $this->createFolder($plugin->folder_path . '/fields'); - // create rules folder - $this->createFolder($plugin->folder_path . '/rules'); - } - // set forms folder if needed - if (isset($plugin->form_files) - && ArrayHelper::check( - $plugin->form_files - )) - { - // create forms folder - $this->createFolder($plugin->folder_path . '/forms'); - // set the template files - foreach ($plugin->form_files as $file => $fields) - { - // set file details - $fileDetails = array('path' => $plugin->folder_path - . '/forms/' . $file . '.xml', - 'name' => $file . '.xml', - 'zip' => 'forms/' . $file - . '.xml'); - // biuld basic XML - $xml = ''; - $xml .= PHP_EOL . ''; - // search if we must add the component path - $add_component_path = false; - foreach ($fields as $field_name => $fieldsets) - { - if (!$add_component_path) - { - foreach ($fieldsets as $fieldset => $field) - { - if (!$add_component_path - && isset( - $plugin->fieldsets_paths[$file - . $field_name . $fieldset] - ) - && $plugin->fieldsets_paths[$file - . $field_name . $fieldset] == 1) - { - $add_component_path = true; - } - } - } - } - // only add if part of the component field types path is required - if ($add_component_path) - { - $xml .= PHP_EOL . ''; - } - else - { - $xml .= PHP_EOL . '
'; - } - // add the fields - foreach ($fields as $field_name => $fieldsets) - { - // check if we have an double fields naming set - $field_name_inner = ''; - $field_name_outer = $field_name; - if (strpos($field_name, '.') !== false) - { - $field_names = explode('.', $field_name); - if (count((array) $field_names) == 2) - { - $field_name_outer = $field_names[0]; - $field_name_inner = $field_names[1]; - } - } - $xml .= PHP_EOL . Indent::_(1) - . ''; - foreach ($fieldsets as $fieldset => $field) - { - // default to the field set name - $label = $fieldset; - if (isset($plugin->fieldsets_label[$file . $field_name . $fieldset])) - { - $label = $plugin->fieldsets_label[$file . $field_name . $fieldset]; - } - // add path to plugin rules and custom fields - if (isset($plugin->fieldsets_paths[$file . $field_name . $fieldset]) - && ($plugin->fieldsets_paths[$file . $field_name . $fieldset] == 2 - || $plugin->fieldsets_paths[$file . $field_name . $fieldset] == 3)) - { - if (!isset($plugin->add_rule_path[$file . $field_name . $fieldset])) - { - $plugin->add_rule_path[$file . $field_name . $fieldset] = - '/plugins/' . strtolower($plugin->group - ) . '/' . strtolower($plugin->code_name) - . '/rules'; - } - - if (!isset($plugin->add_field_path[$file . $field_name . $fieldset])) - { - $plugin->add_field_path[$file . $field_name . $fieldset] = - '/plugins/' . strtolower($plugin->group - ) . '/' . strtolower($plugin->code_name) - . '/fields'; - } - } - // add path to plugin rules and custom fields - if (isset($plugin->add_rule_path[$file . $field_name . $fieldset]) - || isset($plugin->add_field_path[$file . $field_name . $fieldset])) - { - $xml .= PHP_EOL . Indent::_(1) . ''; - - $xml .= PHP_EOL . Indent::_(1) . '
add_rule_path[$file . $field_name . $fieldset])) - { - $xml .= PHP_EOL . Indent::_(2) - . 'addrulepath="' . $plugin->add_rule_path[$file . $field_name . $fieldset] . '"'; - } - - if (isset($plugin->add_field_path[$file . $field_name . $fieldset])) - { - $xml .= PHP_EOL . Indent::_(2) - . 'addfieldpath="' . $plugin->add_field_path[$file . $field_name . $fieldset] . '"'; - } - - $xml .= PHP_EOL . Indent::_(1) . '>'; - } - else - { - $xml .= PHP_EOL . Indent::_(1) . '
'; - } - // check if we have an inner field set - if (StringHelper::check( - $field_name_inner - )) - { - $xml .= PHP_EOL . Indent::_(1) - . ''; - } - // add the placeholder of the fields - $xml .= Placefix::_h('FIELDSET_' . $file - . $field_name . $fieldset ); - // check if we have an inner field set - if (StringHelper::check( - $field_name_inner - )) - { - $xml .= PHP_EOL . Indent::_(1) - . ''; - } - $xml .= PHP_EOL . Indent::_(1) - . '
'; - } - $xml .= PHP_EOL . Indent::_(1) . ''; - } - $xml .= PHP_EOL . ''; - // add xml to file - $this->writeFile($fileDetails['path'], $xml); - $this->newFiles[$plugin->key][] = $fileDetails; - // count the file created - $this->fileCount++; - } - } - // set SQL stuff if needed - if ($plugin->add_sql || $plugin->add_sql_uninstall) - { - // create SQL folder - $this->createFolder($plugin->folder_path . '/sql'); - // create mysql folder - $this->createFolder( - $plugin->folder_path . '/sql/mysql' - ); - // now set the install file - if ($plugin->add_sql) - { - $this->writeFile( - $plugin->folder_path . '/sql/mysql/install.sql', - $plugin->sql - ); - // count the file created - $this->fileCount++; - } - // now set the uninstall file - if ($plugin->add_sql_uninstall) - { - $this->writeFile( - $plugin->folder_path - . '/sql/mysql/uninstall.sql', - $plugin->sql_uninstall - ); - // count the file created - $this->fileCount++; - } - } - // creat the language folder path - $this->createFolder($plugin->folder_path . '/language'); - // also creat the lang tag folder path - $this->createFolder( - $plugin->folder_path . '/language/' . CFactory::_('Config')->get('lang_tag', 'en-GB') - ); - // check if this lib has files - if (isset($plugin->files) - && ArrayHelper::check($plugin->files)) - { - // add to component files - foreach ($plugin->files as $file) - { - // set the path finder - $file['target_type'] = $plugin->target_type; - $file['target_id'] = $plugin->id; - $this->componentData->files[] = $file; - } - } - // check if this lib has folders - if (isset($plugin->folders) - && ArrayHelper::check($plugin->folders)) - { - // add to component folders - foreach ($plugin->folders as $folder) - { - // set the path finder - $folder['target_type'] = $plugin->target_type; - $folder['target_id'] = $plugin->id; - $this->componentData->folders[] = $folder; - } - } - // check if this plugin has urls - if (isset($plugin->urls) - && ArrayHelper::check($plugin->urls)) - { - // add to component urls - foreach ($plugin->urls as $n => &$url) - { - // should we add the local folder - if (isset($url['type']) && $url['type'] > 1 - && isset($url['url']) - && StringHelper::check( - $url['url'] - )) - { - // set file name - $fileName = basename($url['url']); - // get the file contents - $data = FileHelper::getContent( - $url['url'] - ); - // build sub path - if (strpos($fileName, '.js') !== false) - { - $path = '/js'; - } - elseif (strpos($fileName, '.css') !== false) - { - $path = '/css'; - } - else - { - $path = ''; - } - // create sub media media folder path if not set - $this->createFolder( - $plugin->folder_path . $path - ); - // set the path to plugin file - $url['path'] = $plugin->folder_path . $path - . '/' . $fileName; // we need this for later - // write data to path - $this->writeFile($url['path'], $data); - // count the file created - $this->fileCount++; - } - } - } - } - } - } - } - - /** - * Create Path if not exist - * - * @return void - */ - private function createFolder($path) - { - // check if the path exist - if (!Folder::exists( - $path - )) - { - // create the path - Folder::create( - $path - ); - // count the folder created - $this->folderCount++; - // add index.html (boring I know) - $this->indexHTML( - $path, '' - ); - } - } - - /** - * Build the Libraries files, folders, url's and config - * - * @return void - * - */ - private function setLibraries() - { - if (ArrayHelper::check($this->libraries)) - { - // Trigger Event: jcb_ce_onBeforeSetLibraries - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeSetLibraries', - array(&$this->componentContext, &$this->libraries) - ); - // creat the main component folder - if (!Folder::exists($this->componentPath)) - { - Folder::create($this->componentPath); - // count the folder created - $this->folderCount++; - $this->indexHTML(''); - } - // create media path if not set - $this->createFolder($this->componentPath . '/media'); - foreach ($this->libraries as $id => &$library) - { - if (ObjectHelper::check($library)) - { - // check if this lib has files - if (isset($library->files) - && ArrayHelper::check($library->files)) - { - // add to component files - foreach ($library->files as $file) - { - $this->componentData->files[] = $file; - } - } - // check if this lib has folders - if (isset($library->folders) - && ArrayHelper::check( - $library->folders - )) - { - // add to component folders - foreach ($library->folders as $folder) - { - $this->componentData->folders[] = $folder; - } - } - // check if this lib has urls - if (isset($library->urls) - && ArrayHelper::check($library->urls)) - { - // build media folder path - $libFolder = strtolower( - preg_replace( - '/\s+/', '-', - StringHelper::safe( - $library->name, 'filename', ' ', false - ) - ) - ); - $mediaPath = '/media/' . $libFolder; - // should we add the local folder - $addLocalFolder = false; - // add to component urls - foreach ($library->urls as $n => &$url) - { - if (isset($url['type']) && $url['type'] > 1 - && isset($url['url']) - && StringHelper::check( - $url['url'] - )) - { - // create media/lib path if not set - $this->createFolder( - $this->componentPath . $mediaPath - ); - // add local folder - $addLocalFolder = true; - // set file name - $fileName = basename($url['url']); - // get the file contents - $data = FileHelper::getContent( - $url['url'] - ); - // build sub path - if (strpos($fileName, '.js') !== false) - { - $path = '/js'; - } - elseif (strpos($fileName, '.css') !== false) - { - $path = '/css'; - } - else - { - $path = ''; - } - // create sub media path if not set - $this->createFolder( - $this->componentPath . $mediaPath . $path - ); - // set the path to library file - $url['path'] = $mediaPath . $path . '/' - . $fileName; // we need this for later - // set full path - $path = $this->componentPath . $url['path']; - // write data to path - $this->writeFile($path, $data); - // count the file created - $this->fileCount++; - } - } - // only add if local - if ($addLocalFolder) - { - // add folder to xml of media folders - $this->fileContentStatic[Placefix::_h('EXSTRA_MEDIA_FOLDERS')] - .= PHP_EOL . Indent::_(2) . "" - . $libFolder . ""; - } - } - // if config fields are found load into component config (avoiding duplicates) - if (isset($library->how) && $library->how > 1 - && isset($library->config) - && ArrayHelper::check($library->config)) - { - foreach ($library->config as $cofig) - { - $found = array_filter( - $this->componentData->config, - function ($item) use ($cofig) { - return $item['field'] == $cofig['field']; - } - ); - // set the config data if not found - if (!ArrayHelper::check($found)) - { - $this->componentData->config[] = $cofig; - } - } - } - } - } - } - } - - /** - * set the dynamic dashboard if set - * - * @return void - * - */ - private function setDynamicDashboard() - { - // only add the dynamic dashboard if all checks out - if (isset($this->componentData->dashboard_type) - && 2 == $this->componentData->dashboard_type - && isset($this->componentData->dashboard) - && StringHelper::check( - $this->componentData->dashboard - ) - && strpos($this->componentData->dashboard, '_') !== false) - { - // set the default view - $getter = explode('_', $this->componentData->dashboard); - if (count((array) $getter) == 2 && is_numeric($getter[1])) - { - // the pointers - $t = StringHelper::safe($getter[0], 'U'); - $id = (int) $getter[1]; - // the dynamic stuff - $targets = array('A' => 'admin_views', - 'C' => 'custom_admin_views'); - $names = array('A' => 'admin view', - 'C' => 'custom admin view'); - $types = array('A' => 'adminview', 'C' => 'customadminview'); - $keys = array('A' => 'name_list', 'C' => 'code'); - // check the target values - if (isset($targets[$t]) && $id > 0) - { - // set the type name - $type_names = StringHelper::safe( - $targets[$t], 'w' - ); - // set the dynamic dash - if (isset($this->componentData->{$targets[$t]}) - && ArrayHelper::check( - $this->componentData->{$targets[$t]} - )) - { - // search the target views - $dashboard = (array) array_filter( - $this->componentData->{$targets[$t]}, - function ($view) use ($id, $t, $types) { - if (isset($view[$types[$t]]) - && $id == $view[$types[$t]]) - { - return true; - } - - return false; - } - ); - // set dashboard - if (ArrayHelper::check($dashboard)) - { - $dashboard = array_values($dashboard)[0]; - } - // check if view was found (this should be true) - if (isset($dashboard['settings']) - && isset($dashboard['settings']->{$keys[$t]})) - { - $this->dynamicDashboard - = StringHelper::safe( - $dashboard['settings']->{$keys[$t]} - ); - $this->dynamicDashboardType - = $targets[$t]; - } - else - { - // set massage that something is wrong - $this->app->enqueueMessage( - JText::_('

Dashboard Error

'), - 'Error' - ); - $this->app->enqueueMessage( - JText::sprintf( - 'The %s (%s) is not available in your component! Please insure to only used %s, for a dynamic dashboard, that are still linked to your component.', - $names[$t], $this->componentData->dashboard, - $type_names - ), 'Error' - ); - } - } - else - { - // set massage that something is wrong - $this->app->enqueueMessage( - JText::_('

Dashboard Error

'), 'Error' - ); - $this->app->enqueueMessage( - JText::sprintf( - 'The %s (%s) is not available in your component! Please insure to only used %s, for a dynamic dashboard, that are still linked to your component.', - $names[$t], $this->componentData->dashboard, - $type_names - ), 'Error' - ); - } - } - else - { - // the target value is wrong - $this->app->enqueueMessage( - JText::_('

Dashboard Error

'), 'Error' - ); - $this->app->enqueueMessage( - JText::sprintf( - 'The %s value for the dynamic dashboard is invalid.', - $this->componentData->dashboard - ), 'Error' - ); - } - } - else - { - // the target value is wrong - $this->app->enqueueMessage( - JText::_('

Dashboard Error

'), 'Error' - ); - $this->app->enqueueMessage( - JText::sprintf( - 'The %s value for the dynamic dashboard is invalid.', - $this->componentData->dashboard - ), 'Error' - ); - } - // if default was changed to dynamic dashboard the remove default tab and methods - if (StringHelper::check($this->dynamicDashboard)) - { - // dynamic dashboard is used - $this->componentData->dashboard_tab = ''; - $this->componentData->php_dashboard_methods = ''; - } - } - } - - /** - * Write data to file - * - * @return bool true on success - * - */ - public function writeFile($path, $data) - { - return FileHelper::write($path, $data); - } - - /** - * Build the Initial Folders - * - * @return void - * - */ - private function setFolders() - { - if (ObjectHelper::check( - $this->joomlaVersionData->create - )) - { - // creat the main component folder - if (!Folder::exists($this->componentPath)) - { - Folder::create($this->componentPath); - // count the folder created - $this->folderCount++; - $this->indexHTML(''); - } - // now build all folders needed for this component - foreach ($this->joomlaVersionData->create as $main => $folders) - { - $this->createFolder($this->componentPath . '/' . $main); - if (ObjectHelper::check($folders)) - { - foreach ($folders as $sub => $subFolders) - { - $this->createFolder( - $this->componentPath . '/' . $main . '/' . $sub - ); - if (ObjectHelper::check($subFolders)) - { - foreach ($subFolders as $sub_2 => $subFolders_2) - { - $this->createFolder( - $this->componentPath . '/' . $main . '/' - . $sub . '/' . $sub_2 - ); - if (ObjectHelper::check( - $subFolders_2 - )) - { - foreach ( - $subFolders_2 as $sub_3 => $subFolders_3 - ) - { - $this->createFolder( - $this->componentPath . '/' . $main - . '/' . $sub . '/' . $sub_2 . '/' - . $sub_3 - ); - if (ObjectHelper::check( - $subFolders_3 - )) - { - foreach ( - $subFolders_3 as $sub_4 => - $subFolders_4 - ) - { - $this->createFolder( - $this->componentPath . '/' - . $main . '/' . $sub . '/' - . $sub_2 . '/' . $sub_3 - . '/' . $sub_4 - ); - if (ObjectHelper::check( - $subFolders_4 - )) - { - foreach ( - $subFolders_4 as $sub_5 - => $subFolders_5 - ) - { - $this->createFolder( - $this->componentPath - . '/' . $main . '/' - . $sub . '/' - . $sub_2 . '/' - . $sub_3 . '/' - . $sub_4 . '/' - . $sub_5 - ); - if (ObjectHelper::check( - $subFolders_5 - )) - { - foreach ( - $subFolders_5 as - $sub_6 => - $subFolders_6 - ) - { - $this->createFolder( - $this->componentPath - . '/' - . $main - . '/' - . $sub - . '/' - . $sub_2 - . '/' - . $sub_3 - . '/' - . $sub_4 - . '/' - . $sub_5 - . '/' - . $sub_6 - ); - if (ObjectHelper::check( - $subFolders_6 - )) - { - foreach ( - $subFolders_6 - as - $sub_7 - => - $subFolders_7 - ) - { - $this->createFolder( - $this->componentPath - . '/' - . $main - . '/' - . $sub - . '/' - . $sub_2 - . '/' - . $sub_3 - . '/' - . $sub_4 - . '/' - . $sub_5 - . '/' - . $sub_6 - . '/' - . $sub_7 - ); - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - - return true; - } - - return false; - } - - /** - * Set the Static File & Folder - * - * @return boolean - * - */ - private function setStatic() - { - if (ObjectHelper::check( - $this->joomlaVersionData->move->static - )) - { - $codeName = CFactory::_('Config')->component_code_name; - // TODO needs more looking at this must be dynamic actually - $this->notNew[] = 'LICENSE.txt'; - // do license check - $LICENSE = false; - $licenseChecker = strtolower($this->componentData->license); - if (strpos($licenseChecker, 'gnu') !== false - && strpos( - $licenseChecker, '2' - ) !== false - && (strpos($licenseChecker, 'gpl') !== false - || strpos( - $licenseChecker, 'general public license' - ) !== false)) - { - $LICENSE - = true; // we only add version 2 auto at this time (TODO) - } - // do README check - $README = false; - // add the README file if needed - if ($this->componentData->addreadme) - { - $README = true; - } - // start moving - foreach ( - $this->joomlaVersionData->move->static as $ftem => $details - ) - { - // set item - $item = $details->naam; - // do the file renaming - if ($details->rename) - { - if ($details->rename === 'new') - { - $new = $details->newName; - } - else - { - $new = str_replace($details->rename, $codeName, $item); - } - } - else - { - $new = $item; - } - // if not gnu/gpl license dont add the LICENSE.txt file - if ($item === 'LICENSE.txt' && !$LICENSE) - { - continue; - } - // if not needed do not add - if (($item === 'README.md' || $item === 'README.txt') - && !$README) - { - continue; - } - // check if we have a target value - if (isset($details->_target)) - { - // set destination path - $zipPath = str_replace( - $details->_target['type'] . '/', '', $details->path - ); - $path = str_replace( - $details->_target['type'] . '/', - $this->dynamicPaths[$details->_target['key']] . '/', - $details->path - ); - } - else - { - // set destination path - $zipPath = str_replace('c0mp0n3nt/', '', $details->path); - $path = str_replace( - 'c0mp0n3nt/', $this->componentPath . '/', $details->path - ); - } - // set the template folder path - $templatePath = (isset($details->custom) && $details->custom) - ? (($details->custom !== 'full') ? $this->templatePathCustom - . '/' : '') : $this->templatePath . '/'; - // set the final paths - $currentFullPath = (preg_match('/^[a-z]:/i', $item)) ? $item - : $templatePath . '/' . $item; - $currentFullPath = str_replace('//', '/', $currentFullPath); - $packageFullPath = str_replace('//', '/', $path . '/' . $new); - $zipFullPath = str_replace( - '//', '/', $zipPath . '/' . $new - ); - // now move the file - if ($details->type === 'file') - { - if (!File::exists($currentFullPath)) - { - $this->app->enqueueMessage( - JText::_('

File Path Error

'), 'Error' - ); - $this->app->enqueueMessage( - JText::sprintf( - 'The file path: %s does not exist, and was not added!', - $currentFullPath - ), 'Error' - ); - } - else - { - // get base name && get the path only - $packageFullPath0nly = str_replace( - basename($packageFullPath), '', $packageFullPath - ); - // check if path exist, if not creat it - if (!Folder::exists($packageFullPath0nly)) - { - Folder::create($packageFullPath0nly); - } - // move the file to its place - File::copy($currentFullPath, $packageFullPath); - // count the file created - $this->fileCount++; - // store the new files - if (!in_array($ftem, $this->notNew)) - { - if (isset($details->_target)) - { - $this->newFiles[$details->_target['key']][] - = array('path' => $packageFullPath, - 'name' => $new, - 'zip' => $zipFullPath); - } - else - { - $this->newFiles['static'][] - = array('path' => $packageFullPath, - 'name' => $new, - 'zip' => $zipFullPath); - } - } - // ensure we update this file if needed - if (isset($this->updateFileContent[$ftem]) - && $this->updateFileContent[$ftem]) - { - // remove the pointer - unset($this->updateFileContent[$ftem]); - // set the full path - $this->updateFileContent[$packageFullPath] - = $packageFullPath; - } - } - } - elseif ($details->type === 'folder') - { - if (!Folder::exists($currentFullPath)) - { - $this->app->enqueueMessage( - JText::_('

Folder Path Error

'), - 'Error' - ); - $this->app->enqueueMessage( - JText::sprintf( - 'The folder path: %s does not exist, and was not added!', - $currentFullPath - ), 'Error' - ); - } - else - { - // move the folder to its place - Folder::copy( - $currentFullPath, $packageFullPath, '', true - ); - // count the folder created - $this->folderCount++; - } - } - // only add if no target found since those belong to plugins and modules - if (!isset($details->_target)) - { - // check if we should add the dynamic folder moving script to the installer script - $checker = array_values((array) explode('/', $zipFullPath)); - // TODO <-- this may not be the best way, will keep an eye on this. - // We basicly only want to check if a folder is added that is not in the stdFolders array - if (isset($checker[0]) - && StringHelper::check($checker[0]) - && !in_array($checker[0], $this->stdFolders)) - { - // activate dynamic folders - $this->setDynamicFolders(); - } - elseif (count((array) $checker) == 2 - && StringHelper::check($checker[0])) - { - $add_to_extra = false; - // set the target - $eNAME = 'FILES'; - $ename = 'filename'; - // this should not happen and must have been caught by the above if statment - if ($details->type === 'folder') - { - // only folders outside the standard folder are added - $eNAME = 'FOLDERS'; - $ename = 'folder'; - $add_to_extra = true; - } - // if this is a file, it can only be added to the admin/site/media folders - // all other folders are moved as a whole so their files do not need to be declared - elseif (in_array($checker[0], $this->stdFolders) - && !in_array($checker[1], $this->stdRootFiles)) - { - $add_to_extra = true; - } - // add if valid folder/file - if ($add_to_extra) - { - // set the tab - $eTab = Indent::_(2); - if ('admin' === $checker[0]) - { - $eTab = Indent::_(3); - } - // set the xml file - $this->fileContentStatic[Placefix::_h('EXSTRA_' - . StringHelper::safe( - $checker[0], 'U' - ) . '_' . $eNAME)] - .= PHP_EOL . $eTab . "<" . $ename . ">" - . $checker[1] . ""; - } - } - } - } - - return true; - } - - return false; - } - - /** - * Set the Dynamic File & Folder - * - * @return boolean - * - */ - private function setDynamique() - { - $back = false; - $front = false; - if ((isset($this->joomlaVersionData->move->dynamic) - && ObjectHelper::check( - $this->joomlaVersionData->move->dynamic - )) - && (isset($this->componentData->admin_views) - && ArrayHelper::check( - $this->componentData->admin_views - ))) - { - if (!StringHelper::check($this->dynamicDashboard)) - { - // setup dashboard - $target = array('admin' => $this->componentData->name_code); - $this->buildDynamique($target, 'dashboard'); - } - // now the rest of the views - foreach ($this->componentData->admin_views as $nr => $view) - { - if (ObjectHelper::check($view['settings'])) - { - $created = $this->getCreatedDate($view); - $modified = $this->getLastModifiedDate($view); - if ($view['settings']->name_list != 'null') - { - $target - = array('admin' => $view['settings']->name_list); - $config = array(Placefix::_h('CREATIONDATE') => $created, - Placefix::_h('BUILDDATE') => $modified, - Placefix::_h('VERSION') => $view['settings']->version); - $this->buildDynamique($target, 'list', false, $config); - } - if ($view['settings']->name_single != 'null') - { - $target - = array('admin' => $view['settings']->name_single); - $config = array(Placefix::_h('CREATIONDATE') => $created, - Placefix::_h('BUILDDATE') => $modified, - Placefix::_h('VERSION') => $view['settings']->version); - $this->buildDynamique( - $target, 'single', false, $config - ); - } - if (isset($view['edit_create_site_view']) - && is_numeric( - $view['edit_create_site_view'] - ) - && $view['edit_create_site_view'] > 0) - { - // setup the front site edit-view files - $target - = array('site' => $view['settings']->name_single); - $config = array(Placefix::_h('CREATIONDATE') => $created, - Placefix::_h('BUILDDATE') => $modified, - Placefix::_h('VERSION') => $view['settings']->version); - $this->buildDynamique($target, 'edit', false, $config); - } - } - // quick set of checkin once - if (isset($view['checkin']) && $view['checkin'] == 1 - && !$this->addCheckin) - { - // switch to add checking to config - $this->addCheckin = true; - } - } - $back = true; - } - if ((isset($this->joomlaVersionData->move->dynamic) - && ObjectHelper::check( - $this->joomlaVersionData->move->dynamic - )) - && (isset($this->componentData->site_views) - && ArrayHelper::check( - $this->componentData->site_views - ))) - { - - foreach ($this->componentData->site_views as $nr => $view) - { - $created = $this->getCreatedDate($view); - $modified = $this->getLastModifiedDate($view); - if ($view['settings']->main_get->gettype == 2) - { - // set list view - $target = array('site' => $view['settings']->code); - $config = array(Placefix::_h('CREATIONDATE') => $created, - Placefix::_h('BUILDDATE') => $modified, - Placefix::_h('VERSION') => $view['settings']->version); - $this->buildDynamique($target, 'list', false, $config); - } - elseif ($view['settings']->main_get->gettype == 1) - { - // set single view - $target = array('site' => $view['settings']->code); - $config = array(Placefix::_h('CREATIONDATE') => $created, - Placefix::_h('BUILDDATE') => $modified, - Placefix::_h('VERSION') => $view['settings']->version); - $this->buildDynamique($target, 'single', false, $config); - } - } - $front = true; - } - if ((isset($this->joomlaVersionData->move->dynamic) - && ObjectHelper::check( - $this->joomlaVersionData->move->dynamic - )) - && (isset($this->componentData->custom_admin_views) - && ArrayHelper::check( - $this->componentData->custom_admin_views - ))) - { - foreach ($this->componentData->custom_admin_views as $nr => $view) - { - $created = $this->getCreatedDate($view); - $modified = $this->getLastModifiedDate($view); - if ($view['settings']->main_get->gettype == 2) - { - // set list view$view - $target = array('custom_admin' => $view['settings']->code); - $config = array(Placefix::_h('CREATIONDATE') => $created, - Placefix::_h('BUILDDATE') => $modified, - Placefix::_h('VERSION') => $view['settings']->version); - $this->buildDynamique($target, 'list', false, $config); - } - elseif ($view['settings']->main_get->gettype == 1) - { - // set single view - $target = array('custom_admin' => $view['settings']->code); - $config = array(Placefix::_h('CREATIONDATE') => $created, - Placefix::_h('BUILDDATE') => $modified, - Placefix::_h('VERSION') => $view['settings']->version); - $this->buildDynamique($target, 'single', false, $config); - } - } - $back = true; - } - // check if we had success - if ($back || $front) - { - return true; - } - - return false; - } - - /** - * move the fields and Rules - * - * @param array $field The field data - * @param string $path The path to move to - * - * @return void - * - */ - public function moveFieldsRules($field, $path) - { - // check if we have a subform or repeatable field - if ($field['type_name'] === 'subform' - || $field['type_name'] === 'repeatable') - { - // since we could have a custom field or rule inside - $this->moveMultiFieldsRules($field, $path); - } - else - { - // check if this is a custom field that should be moved - if (isset($this->extentionCustomfields[$field['type_name']])) - { - $check = md5($path . 'type' . $field['type_name']); - // lets check if we already moved this - if (!isset($this->extentionTrackingFilesMoved[$check])) - { - // check files exist - if (File::exists( - $this->componentPath . '/admin/models/fields/' - . $field['type_name'] . '.php' - )) - { - // copy the custom field - File::copy( - $this->componentPath . '/admin/models/fields/' - . $field['type_name'] . '.php', - $path . '/fields/' . $field['type_name'] . '.php' - ); - } - // stop from doing this again. - $this->extentionTrackingFilesMoved[$check] = true; - } - } - // check if this has validation that should be moved - if (isset($this->validationLinkedFields[$field['field']])) - { - $check = md5( - $path . 'rule' - . $this->validationLinkedFields[$field['field']] - ); - // lets check if we already moved this - if (!isset($this->extentionTrackingFilesMoved[$check])) - { - // check files exist - if (File::exists( - $this->componentPath . '/admin/models/rules/' - . $this->validationLinkedFields[$field['field']] - . '.php' - )) - { - // copy the custom field - File::copy( - $this->componentPath . '/admin/models/rules/' - . $this->validationLinkedFields[$field['field']] - . '.php', $path . '/rules/' - . $this->validationLinkedFields[$field['field']] - . '.php' - ); - } - // stop from doing this again. - $this->extentionTrackingFilesMoved[$check] = true; - } - } - } - } - - /** - * move the fields and Rules of multi fields - * - * @param array $multi_field The field data - * @param string $path The path to move to - * - * @return void - * - */ - protected function moveMultiFieldsRules($multi_field, $path) - { - // get the fields ids - $ids = array_map( - 'trim', - explode( - ',', - GetHelper::between( - $multi_field['settings']->xml, 'fields="', '"' - ) - ) - ); - if (ArrayHelper::check($ids)) - { - foreach ($ids as $id) - { - // setup the field - $field = array(); - $field['field'] = $id; - $this->setFieldDetails($field); - // move field and rules if needed - $this->moveFieldsRules($field, $path); - } - } - } - - /** - * get the created date of the (view) - * - * @param array $view The view values - * - * @return string Last Modified Date - * - */ - public function getCreatedDate($view) - { - if (isset($view['settings']->created) - && StringHelper::check($view['settings']->created)) - { - // first set the main date - $date = strtotime($view['settings']->created); - } - else - { - // first set the main date - $date = strtotime("now"); - } - - return JFactory::getDate($date)->format('jS F, Y'); - } - - /** - * get the last modified date of a MVC (view) - * - * @param array $view The view values - * - * @return string Last Modified Date - * - */ - public function getLastModifiedDate($view) - { - // first set the main date - if (isset($view['settings']->modified) - && StringHelper::check($view['settings']->modified) - && '0000-00-00 00:00:00' !== $view['settings']->modified) - { - $date = strtotime($view['settings']->modified); - } - else - { - // use todays date - $date = strtotime("now"); - } - // search for the last modified date - if (isset($view['adminview'])) - { - $id = $view['adminview'] . 'admin'; - // now check if value has been set - if (!isset($this->lastModifiedDate[$id])) - { - if (isset($view['settings']->fields) - && ArrayHelper::check( - $view['settings']->fields - )) - { - foreach ($view['settings']->fields as $field) - { - if (isset($field['settings']) - && ObjectHelper::check( - $field['settings'] - ) - && isset($field['settings']->modified) - && StringHelper::check( - $field['settings']->modified - ) - && '0000-00-00 00:00:00' - !== $field['settings']->modified) - { - $anotherDate = strtotime( - $field['settings']->modified - ); - if ($anotherDate > $date) - { - $date = $anotherDate; - } - } - } - } - } - } - elseif (isset($view['siteview'])) - { - $id = $view['siteview'] . 'site'; - // now check if value has been set - if (!isset($this->lastModifiedDate[$id])) - { - if (isset($view['settings']->main_get->modified) - && StringHelper::check( - $view['settings']->main_get->modified - ) - && '0000-00-00 00:00:00' - !== $view['settings']->main_get->modified) - { - $anotherDate = strtotime( - $view['settings']->main_get->modified - ); - if ($anotherDate > $date) - { - $date = $anotherDate; - } - } - } - } - elseif (isset($view['customadminview'])) - { - $id = $view['customadminview'] . 'customadmin'; - // now check if value has been set - if (!isset($this->lastModifiedDate[$id])) - { - if (isset($view['settings']->main_get->modified) - && StringHelper::check( - $view['settings']->main_get->modified - ) - && '0000-00-00 00:00:00' - !== $view['settings']->main_get->modified) - { - $anotherDate = strtotime( - $view['settings']->main_get->modified - ); - if ($anotherDate > $date) - { - $date = $anotherDate; - } - } - } - } - // check if ID was found - if (!isset($id)) - { - $id = md5($date); - } - // now load the date - if (!isset($this->lastModifiedDate[$id])) - { - $this->lastModifiedDate[$id] = $date; - } - - return JFactory::getDate($this->lastModifiedDate[$id])->format( - 'jS F, Y' - ); - } - - /** - * Set the Static File & Folder - * - * @param array $target The main target and name - * @param string $type The type in the target - * @param string $fileName The custom file name - * @param array $cofig to add more data to the files info - * - * @return boolean - * - */ - public function buildDynamique($target, $type, $fileName = false, - $config = false - ) - { - // did we build the files (any number) - $build_status = false; - // check that we have the target values - if (ArrayHelper::check($target)) - { - // search the target - foreach ($target as $main => $name) - { - // make sure it is lower case - $name = StringHelper::safe($name); - // setup the files - foreach ( - $this->joomlaVersionData->move->dynamic->{$main} as $item => - $details - ) - { - if ($details->type === $type) - { - // set destination path - $path = ''; - if (strpos($details->path, 'VIEW') !== false) - { - $path = str_replace('VIEW', $name, $details->path); - } - else - { - $path = $details->path; - } - // make sure we have component to replace - if (strpos($path, 'c0mp0n3nt') !== false) - { - $zipPath = str_replace('c0mp0n3nt/', '', $path); - $path = str_replace( - 'c0mp0n3nt/', $this->componentPath . '/', $path - ); - } - else - { - $this->app->enqueueMessage( - JText::sprintf( - '

c0mp0n3nt issue found

The path (%s) could not be used.

', - $path - ), 'Error' - ); - continue; - } - - // setup the folder - if (!Folder::exists($path)) - { - Folder::create($path); - $this->indexHTML($zipPath); - // count the folder created - $this->folderCount++; - } - // do the file renaming - if ($details->rename) - { - if ($fileName) - { - $new = str_replace( - $details->rename, $fileName, $item - ); - $name = $name . '_' . $fileName; - } - elseif ($details->rename === 'new') - { - $new = $details->newName; - } - else - { - $new = str_replace( - $details->rename, $name, $item - ); - } - } - else - { - $new = $item; - } - if (!File::exists($path . '/' . $new)) - { - // move the file to its place - File::copy( - $this->templatePath . '/' . $item, - $path . '/' . $new - ); - // count the file created - $this->fileCount++; - } - // setup array for new file - $newFIle = array('path' => $path . '/' . $new, - 'name' => $new, 'view' => $name, - 'zip' => $zipPath . '/' . $new); - if (ArrayHelper::check($config)) - { - $newFIle['config'] = $config; - } - // store the new files - $this->newFiles['dynamic'][$name][] = $newFIle; - // we have build atleast one - $build_status = true; - } - } - } - } - - return $build_status; - } - - /** - * set the Joomla Version Data - * - * @return object The version data - * - */ - private function setJoomlaVersionData() - { - // option to load other settings - $custom_settings = $this->templatePath . '/settings_' . CFactory::_('Config')->component_code_name . '.json'; - // set the version data - if (File::exists($custom_settings)) - { - $version_data = json_decode( - FileHelper::getContent( - $custom_settings - ) - ); - } - else - { - $version_data = json_decode( - FileHelper::getContent( - $this->templatePath . '/settings.json' - ) - ); - } - // add custom folders - if ((isset($this->componentData->folders) - && ArrayHelper::check( - $this->componentData->folders - )) - || $this->addEximport - || $this->uikit - || $this->footable) - { - if ($this->addEximport) - { - // move the import view folder in place - $importView = array('folder' => 'importViews', - 'path' => 'admin/views/import', - 'rename' => 1); - $this->componentData->folders[] = $importView; - // move the phpspreadsheet Folder (TODO we must move this to a library package) - $PHPExcel - = array('folderpath' => 'JPATH_LIBRARIES/phpspreadsheet/vendor', - 'path' => '/libraries/phpspreadsheet/', - 'rename' => 0); - $this->componentData->folders[] = $PHPExcel; - } - if (2 == $this->uikit || 1 == $this->uikit) - { - // move the UIKIT Folder into place - $uikit = array('folder' => 'uikit-v2', - 'path' => 'media', - 'rename' => 0); - $this->componentData->folders[] = $uikit; - } - if (2 == $this->uikit || 3 == $this->uikit) - { - // move the UIKIT-3 Folder into place - $uikit = array('folder' => 'uikit-v3', - 'path' => 'media', - 'rename' => 0); - $this->componentData->folders[] = $uikit; - } - if ($this->footable - && (!isset($this->footableVersion) - || 2 == $this->footableVersion)) - { - // move the footable folder into place - $footable = array('folder' => 'footable-v2', - 'path' => 'media', - 'rename' => 0); - $this->componentData->folders[] = $footable; - } - elseif ($this->footable && 3 == $this->footableVersion) - { - // move the footable folder into place - $footable = array('folder' => 'footable-v3', - 'path' => 'media', - 'rename' => 0); - $this->componentData->folders[] = $footable; - } - - // pointer tracker - $pointer_tracker = 'h'; - foreach ($this->componentData->folders as $custom) - { - // check type of target type - $_target_type = 'c0mp0n3nt'; - if (isset($custom['target_type'])) - { - $_target_type = $custom['target_type']; - } - // for good practice - ComponentbuilderHelper::fixPath( - $custom, array('path', 'folder', 'folderpath') - ); - // fix custom path - if (isset($custom['path']) - && StringHelper::check($custom['path'])) - { - $custom['path'] = trim($custom['path'], '/'); - } - // by default custom path is true - $customPath = 'custom'; - // set full path if this is a full path folder - if (!isset($custom['folder']) && isset($custom['folderpath'])) - { - // update the dynamic path - $custom['folderpath'] = $this->updateDynamicPath( - $custom['folderpath'] - ); - // set the folder path with / if does not have a drive/windows full path - $custom['folder'] = (preg_match( - '/^[a-z]:/i', $custom['folderpath'] - )) - ? trim($custom['folderpath'], '/') - : '/' . trim($custom['folderpath'], '/'); - // remove the file path - unset($custom['folderpath']); - // triget fullpath - $customPath = 'full'; - } - // make sure we use the correct name - $pathArray = (array) explode('/', $custom['path']); - $firstFolder = array_values($pathArray)[0]; - $lastFolder = end($pathArray); - // only rename folder if last has folder name - if (isset($custom['rename']) && $custom['rename'] == 1) - { - $custom['path'] = str_replace( - '/' . $lastFolder, '', $custom['path'] - ); - $rename = 'new'; - $newname = $lastFolder; - } - elseif ('full' === $customPath) - { - // make sure we use the correct name - $folderArray = (array) explode('/', $custom['folder']); - $lastFolder = end($folderArray); - $rename = 'new'; - $newname = $lastFolder; - } - else - { - $lastFolder = $custom['folder']; - $rename = false; - $newname = ''; - } - // insure we have no duplicates - $key_pointer = StringHelper::safe( - $custom['folder'] - ) . '_f' . $pointer_tracker; - $pointer_tracker++; - // fix custom path - $custom['path'] = ltrim($custom['path'], '/'); - // set new folder to object - $version_data->move->static->{$key_pointer} = new stdClass(); - $version_data->move->static->{$key_pointer}->naam - = str_replace( - '//', '/', $custom['folder'] - ); - $version_data->move->static->{$key_pointer}->path - = $_target_type - . '/' . $custom['path']; - $version_data->move->static->{$key_pointer}->rename = $rename; - $version_data->move->static->{$key_pointer}->newName = $newname; - $version_data->move->static->{$key_pointer}->type = 'folder'; - $version_data->move->static->{$key_pointer}->custom - = $customPath; - // set the target if type and id is found - if (isset($custom['target_id']) - && isset($custom['target_type'])) - { - $version_data->move->static->{$key_pointer}->_target - = array('key' => $custom['target_id'] . '_' - . $custom['target_type'], - 'type' => $custom['target_type']); - } - } - unset($this->componentData->folders); - unset($custom); - } - // add custom files - if ((isset($this->componentData->files) - && ArrayHelper::check( - $this->componentData->files - )) - || $this->googlechart) - { - if ($this->googlechart) - { - // move the google chart files - $googleChart = array('file' => 'google.jsapi.js', - 'path' => 'media/js', - 'rename' => 0); - $this->componentData->files[] = $googleChart; - $googleChart - = array('file' => 'chartbuilder.php', - 'path' => 'admin/helpers', - 'rename' => 0); - $this->componentData->files[] = $googleChart; - } - - // pointer tracker - $pointer_tracker = 'h'; - foreach ($this->componentData->files as $custom) - { - // check type of target type - $_target_type = 'c0mp0n3nt'; - if (isset($custom['target_type'])) - { - $_target_type = $custom['target_type']; - } - // for good practice - ComponentbuilderHelper::fixPath( - $custom, array('path', 'file', 'filepath') - ); - // by default custom path is true - $customPath = 'custom'; - // set full path if this is a full path file - if (!isset($custom['file']) && isset($custom['filepath'])) - { - // update the dynamic path - $custom['filepath'] = $this->updateDynamicPath( - $custom['filepath'] - ); - // set the file path with / if does not have a drive/windows full path - $custom['file'] = (preg_match( - '/^[a-z]:/i', $custom['filepath'] - )) - ? trim($custom['filepath'], '/') - : '/' . trim($custom['filepath'], '/'); - // remove the file path - unset($custom['filepath']); - // triget fullpath - $customPath = 'full'; - } - // make sure we have not duplicates - $key_pointer = StringHelper::safe( - $custom['file'] - ) . '_g' . $pointer_tracker; - $pointer_tracker++; - // set new file to object - $version_data->move->static->{$key_pointer} = new stdClass(); - $version_data->move->static->{$key_pointer}->naam = str_replace( - '//', '/', $custom['file'] - ); - // update the dynamic component name placholders in file names - $custom['path'] = CFactory::_('Placeholder')->update( - $custom['path'], CFactory::_('Placeholder')->active - ); - // get the path info - $pathInfo = pathinfo($custom['path']); - if (isset($pathInfo['extension']) && $pathInfo['extension']) - { - $pathInfo['dirname'] = trim($pathInfo['dirname'], '/'); - // set the info - $version_data->move->static->{$key_pointer}->path - = $_target_type - . '/' . $pathInfo['dirname']; - $version_data->move->static->{$key_pointer}->rename = 'new'; - $version_data->move->static->{$key_pointer}->newName - = $pathInfo['basename']; - } - elseif ('full' === $customPath) - { - // fix custom path - $custom['path'] = ltrim($custom['path'], '/'); - // get file array - $fileArray = (array) explode('/', $custom['file']); - // set the info - $version_data->move->static->{$key_pointer}->path - = $_target_type - . '/' . $custom['path']; - $version_data->move->static->{$key_pointer}->rename = 'new'; - $version_data->move->static->{$key_pointer}->newName = end( - $fileArray - ); - } - else - { - // fix custom path - $custom['path'] = ltrim($custom['path'], '/'); - // set the info - $version_data->move->static->{$key_pointer}->path - = $_target_type - . '/' . $custom['path']; - $version_data->move->static->{$key_pointer}->rename = false; - } - $version_data->move->static->{$key_pointer}->type = 'file'; - $version_data->move->static->{$key_pointer}->custom - = $customPath; - // set the target if type and id is found - if (isset($custom['target_id']) - && isset($custom['target_type'])) - { - $version_data->move->static->{$key_pointer}->_target - = array('key' => $custom['target_id'] . '_' - . $custom['target_type'], - 'type' => $custom['target_type']); - } - // check if file should be updated - if (!isset($custom['notnew']) || $custom['notnew'] == 0 - || $custom['notnew'] != 1) - { - $this->notNew[] = $key_pointer; - } - else - { - // update the file content - $this->updateFileContent[$key_pointer] = true; - } - } - unset($this->componentData->files); - unset($custom); - } - - return $version_data; - } - - /** - * Add the dynamic folders - */ - protected function setDynamicFolders() - { - // check if we should add the dynamic folder moving script to the installer script - if (!$this->setMoveFolders) - { - // add the setDynamicF0ld3rs() method to the install scipt.php file - $this->setMoveFolders = true; - // set message that this was done (will still add a tutorial link later) - $this->app->enqueueMessage( - JText::_( - '

Dynamic folder(s) were detected.

' - ), 'Notice' - ); - $this->app->enqueueMessage( - JText::sprintf( - 'A method (setDynamicF0ld3rs) was added to the install script.php of this package to insure that the folder(s) are copied into the correct place when this component is installed!' - ), 'Notice' - ); - } - } - - /** - * set the index.html file in a folder path - * - * @param string $path The path to place the index.html file in - * - * @return void - * - */ - private function indexHTML($path, $root = 'component') - { - if ('component' === $root) - { - $root = $this->componentPath . '/'; - } - // use path if exist - if (strlen($path) > 0) - { - File::copy( - $this->templatePath . '/index.html', - $root . $path . '/index.html' - ); - // count the file created - $this->fileCount++; - } - else - { - File::copy( - $this->templatePath . '/index.html', $root . '/index.html' - ); - // count the file created - $this->fileCount++; - } - } - - /** - * Update paths with real value - * - * @param string $path The full path - * - * @return string The updated path - * - */ - protected function updateDynamicPath($path) - { - return CFactory::_('Placeholder')->update( - CFactory::_('Placeholder')->update( - $path, ComponentbuilderHelper::$constantPaths - ), CFactory::_('Placeholder')->active - ); - } - - /** - * Remove folders with files - * - * @param string $dir The path to folder to remove - * @param boolean $ignore The files and folders to ignore - * - * @return boolean True if all is removed - * - */ - protected function removeFolder($dir, $ignore = false) - { - return ComponentbuilderHelper::removeFolder($dir, $ignore); - } - -} diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php deleted file mode 100644 index a657d6ac7..000000000 --- a/admin/helpers/compiler/c_Fields.php +++ /dev/null @@ -1,6485 +0,0 @@ - - * @gitea Joomla Component Builder - * @github 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'); - -use VDM\Joomla\Utilities\StringHelper; -use VDM\Joomla\Utilities\ArrayHelper; -use VDM\Joomla\Utilities\ObjectHelper; -use VDM\Joomla\Utilities\GetHelper; -use VDM\Joomla\Utilities\String\FieldHelper; -use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory; -use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix; -use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; -use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; - -/** - * Compiler class - */ -class Fields extends Structure -{ - - - /** - * Metadate Switch - * - * @var array - */ - public $metadataBuilder = array(); - - /** - * View access Switch - * - * @var array - */ - public $accessBuilder = array(); - - /** - * edit view tabs counter - * - * @var array - */ - public $tabCounter = array(); - - /** - * layout builder - * - * @var array - */ - public $layoutBuilder = array(); - - /** - * permissions builder - * - * @var array - */ - public $hasPermissions = array(); - - /** - * used to fix the zero order - * - * @var array - */ - private $zeroOrderFix = array(); - - /** - * Site field data - * - * @var array - */ - public $siteFieldData = array(); - - /** - * list of fields that are not being escaped - * - * @var array - */ - public $doNotEscape = array(); - - /** - * list of classes used in the list view for the fields - * - * @var array - */ - public $listFieldClass = array(); - - /** - * tags builder - * - * @var array - */ - public $tagsBuilder = array(); - - /** - * query builder - * - * @var array - */ - public $queryBuilder = array(); - - /** - * unique keys for database field - * - * @var array - */ - public $dbUniqueKeys = array(); - - /** - * unique guid swtich - * - * @var array - */ - public $dbUniqueGuid = array(); - - /** - * keys for database field - * - * @var array - */ - public $dbKeys = array(); - - /** - * history builder - * - * @var array - */ - public $historyBuilder = array(); - - /** - * alias builder - * - * @var array - */ - public $aliasBuilder = array(); - - /** - * title builder - * - * @var array - */ - public $titleBuilder = array(); - - /** - * list builder - * - * @var array - */ - public $listBuilder = array(); - - /** - * custom Builder List - * - * @var array - */ - public $customBuilderList = array(); - - /** - * Hidden Fields Builder - * - * @var array - */ - public $hiddenFieldsBuilder = array(); - - /** - * INT Field Builder - * - * @var array - */ - public $intFieldsBuilder = array(); - - /** - * Dynamic Fields Builder - * - * @var array - */ - public $dynamicfieldsBuilder = array(); - - /** - * Main text Builder - * - * @var array - */ - public $maintextBuilder = array(); - - /** - * Custom Builder - * - * @var array - */ - public $customBuilder = array(); - - /** - * Custom Field Links Builder - * - * @var array - */ - public $customFieldLinksBuilder = array(); - - /** - * Set Script for User Switch - * - * @var array - */ - public $setScriptUserSwitch = array(); - - /** - * Set Script for Media Switch - * - * @var array - */ - public $setScriptMediaSwitch = array(); - - /** - * Category builder - * - * @var array - */ - public $categoryBuilder = array(); - - /** - * Category Code builder - * - * @var array - */ - public $catCodeBuilder = array(); - - /** - * Check Box builder - * - * @var array - */ - public $checkboxBuilder = array(); - - /** - * Json String Builder - * - * @var array - */ - public $jsonStringBuilder = array(); - - /** - * Json String Builder for return values to array - * - * @var array - */ - public $jsonItemBuilderArray = array(); - - /** - * Json Item Builder - * - * @var array - */ - public $jsonItemBuilder = array(); - - /** - * Base 64 Builder - * - * @var array - */ - public $base64Builder = array(); - - /** - * Basic Encryption Field Modeling - * - * @var array - */ - public $basicFieldModeling = array(); - - /** - * WHMCS Encryption Field Modeling - * - * @var array - */ - public $whmcsFieldModeling = array(); - - /** - * Medium Encryption Field Modeling - * - * @var array - */ - public $mediumFieldModeling = array(); - - /** - * Expert Field Modeling - * - * @var array - */ - public $expertFieldModeling = array(); - - /** - * Expert Mode Initiator - * - * @var array - */ - public $expertFieldModelInitiator = array(); - - /** - * Get Items Method List String Fix Builder - * - * @var array - */ - public $getItemsMethodListStringFixBuilder = array(); - - /** - * Get Items Method Eximport String Fix Builder - * - * @var array - */ - public $getItemsMethodEximportStringFixBuilder = array(); - - /** - * Selection Translation Fix Builder - * - * @var array - */ - public $selectionTranslationFixBuilder = array(); - - /** - * Sort Builder - * - * @var array - */ - public $sortBuilder = array(); - - /** - * Search Builder - * - * @var array - */ - public $searchBuilder = array(); - - /** - * Filter Builder - * - * @var array - */ - public $filterBuilder = array(); - - /** - * Set Group Control - * - * @var array - */ - public $setGroupControl = array(); - - /** - * Set Field Names - * - * @var array - */ - public $fieldsNames = array(); - - /** - * Default Fields set to publishing - * - * @var array - */ - public $newPublishingFields = array(); - - /** - * Default Fields set to publishing - * - * @var array - */ - public $movedPublishingFields = array(); - - /** - * set the Field set of a view - * - * @param array $view The view data - * @param string $component The component name - * @param string $nameSingleCode The single view name - * @param string $nameListCode The list view name - * - * @return string The fields set in xml - * - */ - public function setFieldSet($view, $component, $nameSingleCode, - $nameListCode - ) { - // setup the fieldset of this view - if (isset($view['settings']->fields) - && ArrayHelper::check($view['settings']->fields)) - { - // add metadata to the view - if (isset($view['metadata']) && $view['metadata']) - { - $this->metadataBuilder[$nameSingleCode] = $nameListCode; - } - // add access to the view - if (isset($view['access']) && $view['access']) - { - $this->accessBuilder[$nameSingleCode] = $nameListCode; - } - // main lang prefix - $langView = CFactory::_('Config')->lang_prefix . '_' - . CFactory::_('Placeholder')->active[Placefix::_h('VIEW')]; - $langViews = CFactory::_('Config')->lang_prefix . '_' - . CFactory::_('Placeholder')->active[Placefix::_h('VIEWS')]; - // set default lang - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langView, $view['settings']->name_single - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews, $view['settings']->name_list - ); - // set global item strings - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_ARCHIVED', - "%s " . $view['settings']->name_list . " archived." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_ARCHIVED_1', - "%s " . $view['settings']->name_single . " archived." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_CHECKED_IN_0', - "No " . $view['settings']->name_single - . " successfully checked in." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_CHECKED_IN_1', - "%d " . $view['settings']->name_single - . " successfully checked in." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_CHECKED_IN_MORE', - "%d " . $view['settings']->name_list - . " successfully checked in." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_DELETED', - "%s " . $view['settings']->name_list . " deleted." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_DELETED_1', - "%s " . $view['settings']->name_single . " deleted." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_FEATURED', - "%s " . $view['settings']->name_list . " featured." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_FEATURED_1', - "%s " . $view['settings']->name_single . " featured." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_PUBLISHED', - "%s " . $view['settings']->name_list . " published." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_PUBLISHED_1', - "%s " . $view['settings']->name_single . " published." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_TRASHED', - "%s " . $view['settings']->name_list . " trashed." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_TRASHED_1', - "%s " . $view['settings']->name_single . " trashed." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_UNFEATURED', - "%s " . $view['settings']->name_list . " unfeatured." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_UNFEATURED_1', - "%s " . $view['settings']->name_single . " unfeatured." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_UNPUBLISHED', - "%s " . $view['settings']->name_list . " unpublished." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_UNPUBLISHED_1', - "%s " . $view['settings']->name_single . " unpublished." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_FAILED_PUBLISHING', - "%s " . $view['settings']->name_list . " failed publishing." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_FAILED_PUBLISHING_1', - "%s " . $view['settings']->name_single . " failed publishing." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_BATCH_OPTIONS', - "Batch process the selected " . $view['settings']->name_list - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langViews . '_BATCH_TIP', - "All changes will be applied to all selected " - . $view['settings']->name_list - ); - // set some basic defaults - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langView . '_ERROR_UNIQUE_ALIAS', - "Another " . $view['settings']->name_single - . " has the same alias." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langView . '_CREATED_DATE_LABEL', "Created Date" - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langView . '_CREATED_DATE_DESC', - "The date this " . $view['settings']->name_single - . " was created." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langView . '_MODIFIED_DATE_LABEL', "Modified Date" - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langView . '_MODIFIED_DATE_DESC', - "The date this " . $view['settings']->name_single - . " was modified." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langView . '_CREATED_BY_LABEL', "Created By" - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langView . '_CREATED_BY_DESC', - "The user that created this " . $view['settings']->name_single - . "." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langView . '_MODIFIED_BY_LABEL', "Modified By" - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langView . '_MODIFIED_BY_DESC', - "The last user that modified this " - . $view['settings']->name_single . "." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langView . '_ORDERING_LABEL', "Ordering" - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langView . '_VERSION_LABEL', "Version" - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langView . '_VERSION_DESC', - "A count of the number of times this " - . $view['settings']->name_single . " has been revised." - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langView . '_SAVE_WARNING', - "Alias already existed so a number was added at the end. You can re-edit the " - . $view['settings']->name_single . " to customise the alias." - ); - // check what type of field builder to use - if (CFactory::_('Config')->get('field_builder_type', 2) == 1) - { - // build field set using string manipulation - return $this->stringFieldSet( - $view, $component, $nameSingleCode, $nameListCode, - $langView, $langViews - ); - } - else - { - // build field set with simpleXMLElement class - return $this->simpleXMLFieldSet( - $view, $component, $nameSingleCode, $nameListCode, - $langView, $langViews - ); - } - } - - return ''; - } - - /** - * build field set using string manipulation - * - * @param array $view The view data - * @param string $component The component name - * @param string $nameSingleCode The single view name - * @param string $nameListCode The list view name - * @param string $langView The language string of the view - * @param string $langViews The language string of the views - * - * @return string The fields set in xml - * - */ - protected function stringFieldSet($view, $component, $nameSingleCode, - $nameListCode, $langView, $langViews - ) { - // set the read only - $readOnly = false; - if ($view['settings']->type == 2) - { - $readOnly = Indent::_(3) . 'readonly="true"' . PHP_EOL . Indent::_( - 3 - ) . 'disabled="true"'; - } - // start adding dynamc fields - $dynamicFields = ''; - // set the custom table key - $dbkey = 'g'; - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onBeforeBuildFields - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeBuildFields', - array(&$this->componentContext, &$dynamicFields, &$readOnly, - &$dbkey, &$view, &$component, &$nameSingleCode, - &$nameListCode, &$this->placeholders, &$langView, - &$langViews) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - // TODO we should add the global and local view switch if field for front end - foreach ($view['settings']->fields as $field) - { - $dynamicFields .= $this->setDynamicField( - $field, $view, $view['settings']->type, $langView, - $nameSingleCode, $nameListCode, CFactory::_('Placeholder')->active, $dbkey, - true - ); - } - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onAfterBuildFields - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterBuildFields', - array(&$this->componentContext, &$dynamicFields, &$readOnly, - &$dbkey, &$view, &$component, &$nameSingleCode, - &$nameListCode, &$this->placeholders, &$langView, - &$langViews) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - // set the default fields - $fieldSet = array(); - $fieldSet[] = '
'; - $fieldSet[] = Indent::_(2) . ""; - $fieldSet[] = Indent::_(2) . ""; - // if id is not set - if (!isset($this->fieldsNames[$nameSingleCode]['id'])) - { - $fieldSet[] = Indent::_(2) . ""; - // count the static field created - $this->fieldCount++; - } - // if created is not set - if (!isset($this->fieldsNames[$nameSingleCode]['created'])) - { - $fieldSet[] = Indent::_(2) . ""; - $fieldSet[] = Indent::_(2) . ""; - // count the static field created - $this->fieldCount++; - } - // if created_by is not set - if (!isset($this->fieldsNames[$nameSingleCode]['created_by'])) - { - $fieldSet[] = Indent::_(2) . ""; - $fieldSet[] = Indent::_(2) . ""; - // count the static field created - $this->fieldCount++; - } - // if published is not set - if (!isset($this->fieldsNames[$nameSingleCode]['published'])) - { - $fieldSet[] = Indent::_(2) . ""; - $fieldSet[] = Indent::_(2) . "'; - $fieldSet[] = Indent::_(3) . ""; - $fieldSet[] = Indent::_(3) . ""; - $fieldSet[] = Indent::_(3) . ""; - $fieldSet[] = Indent::_(3) . ""; - $fieldSet[] = Indent::_(2) . ""; - // count the static field created - $this->fieldCount++; - } - // if modified is not set - if (!isset($this->fieldsNames[$nameSingleCode]['modified'])) - { - $fieldSet[] = Indent::_(2) . ""; - $fieldSet[] = Indent::_(2) - . ''; - // count the static field created - $this->fieldCount++; - } - // if modified_by is not set - if (!isset($this->fieldsNames[$nameSingleCode]['modified_by'])) - { - $fieldSet[] = Indent::_(2) . ""; - $fieldSet[] = Indent::_(2) - . '"; - // count the static field created - $this->fieldCount++; - } - // check if view has access - if (isset($this->accessBuilder[$nameSingleCode]) - && StringHelper::check( - $this->accessBuilder[$nameSingleCode] - ) - && !isset($this->fieldsNames[$nameSingleCode]['access'])) - { - $fieldSet[] = Indent::_(2) . ""; - $fieldSet[] = Indent::_(2) . '"; - // count the static field created - $this->fieldCount++; - } - // if ordering is not set - if (!isset($this->fieldsNames[$nameSingleCode]['ordering'])) - { - $fieldSet[] = Indent::_(2) . ""; - $fieldSet[] = Indent::_(2) . ""; - // count the static field created - $this->fieldCount++; - } - // if version is not set - if (!isset($this->fieldsNames[$nameSingleCode]['version'])) - { - $fieldSet[] = Indent::_(2) . ""; - $fieldSet[] = Indent::_(2) . ""; - // count the static field created - $this->fieldCount++; - } - // check if metadata is added to this view - if (isset($this->metadataBuilder[$nameSingleCode]) - && StringHelper::check( - $this->metadataBuilder[$nameSingleCode] - )) - { - // metakey - if (!isset($this->fieldsNames[$nameSingleCode]['metakey'])) - { - $fieldSet[] = Indent::_(2) . ""; - $fieldSet[] = Indent::_(2) . ""; - // count the static field created - $this->fieldCount++; - } - // metadesc - if (!isset($this->fieldsNames[$nameSingleCode]['metadesc'])) - { - $fieldSet[] = Indent::_(2) . ""; - $fieldSet[] = Indent::_(2) . ""; - // count the static field created - $this->fieldCount++; - } - } - // fix the permissions field "title" issue gh-629 - // check if the the title is not already set - if (!isset($this->fieldsNames[$nameSingleCode]['title']) - && $this->hasPermissionsSet($view, $nameSingleCode)) - { - // set the field/tab name - $field_name = "title"; - $tab_name = "publishing"; - $fieldSet[] = Indent::_(2) . ""; - $fieldSet[] = Indent::_(2) . ""; - $fieldSet[] = Indent::_(2) . ""; - // at this point we know that we must add a hidden title field - // and make sure it does not get stored to the database - $fieldSet[] = Indent::_(2) . ""; - // count the static field created - $this->fieldCount++; - // setup needed field values for layout - $field_array = array(); - $field_array['order_edit'] = 0; - $field_array['tab'] = 15; - $field_array['alignment'] = 1; - // make sure it gets added to view - $this->setLayoutBuilder( - $nameSingleCode, $tab_name, $field_name, $field_array - ); - } - // load the dynamic fields now - if (StringHelper::check($dynamicFields)) - { - $fieldSet[] = Indent::_(2) . "" . $dynamicFields; - } - // close fieldset - $fieldSet[] = Indent::_(1) . "
"; - // check if metadata is added to this view - if (isset($this->metadataBuilder[$nameSingleCode]) - && StringHelper::check( - $this->metadataBuilder[$nameSingleCode] - )) - { - if (!isset($this->fieldsNames[$nameSingleCode]['robots']) - || !isset($this->fieldsNames[$nameSingleCode]['rights']) - || !isset($this->fieldsNames[$nameSingleCode]['author'])) - { - $fieldSet[] = PHP_EOL . Indent::_(1) . ""; - $fieldSet[] = Indent::_(1) . "'; - $fieldSet[] = Indent::_(2) . '
'; - // robots - if (!isset($this->fieldsNames[$nameSingleCode]['robots'])) - { - $fieldSet[] = Indent::_(3) . ""; - $fieldSet[] = Indent::_(3) . ''; - $fieldSet[] = Indent::_(4) - . ''; - $fieldSet[] = Indent::_(4) - . ''; - $fieldSet[] = Indent::_(4) - . ''; - $fieldSet[] = Indent::_(4) - . ''; - $fieldSet[] = Indent::_(4) - . ''; - $fieldSet[] = Indent::_(3) . ''; - // count the static field created - $this->fieldCount++; - } - // author - if (!isset($this->fieldsNames[$nameSingleCode]['author'])) - { - $fieldSet[] = Indent::_(3) . ""; - $fieldSet[] = Indent::_(3) . '"; - // count the static field created - $this->fieldCount++; - } - // rights - if (!isset($this->fieldsNames[$nameSingleCode]['rights'])) - { - $fieldSet[] = Indent::_(3) . ""; - $fieldSet[] = Indent::_(3) - . '"; - // count the static field created - $this->fieldCount++; - } - $fieldSet[] = Indent::_(2) . "
"; - $fieldSet[] = Indent::_(1) . ""; - } - } - - // return the set - return implode(PHP_EOL, $fieldSet); - } - - /** - * build field set with simpleXMLElement class - * - * @param array $view The view data - * @param string $component The component name - * @param string $nameSingleCode The single view name - * @param string $nameListCode The list view name - * @param string $langView The language string of the view - * @param string $langViews The language string of the views - * - * @return string The fields set in xml - * - */ - protected function simpleXMLFieldSet($view, $component, $nameSingleCode, - $nameListCode, $langView, $langViews - ) { - // set the read only - $readOnlyXML = array(); - if ($view['settings']->type == 2) - { - $readOnlyXML['readonly'] = true; - $readOnlyXML['disabled'] = true; - } - // start adding dynamc fields - $dynamicFieldsXML = array(); - // set the custom table key - $dbkey = 'g'; - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onBeforeBuildFields - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeBuildFields', - array(&$this->componentContext, &$dynamicFieldsXML, &$readOnlyXML, - &$dbkey, &$view, &$component, &$nameSingleCode, - &$nameListCode, &$this->placeholders, &$langView, - &$langViews) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - // TODO we should add the global and local view switch if field for front end - foreach ($view['settings']->fields as $field) - { - $dynamicFieldsXML[] = $this->setDynamicField( - $field, $view, $view['settings']->type, $langView, - $nameSingleCode, $nameListCode, CFactory::_('Placeholder')->active, $dbkey, - true - ); - } - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onAfterBuildFields - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterBuildFields', - array(&$this->componentContext, &$dynamicFieldsXML, &$readOnlyXML, - &$dbkey, &$view, &$component, &$nameSingleCode, - &$nameListCode, &$this->placeholders, &$langView, - &$langViews) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - // set the default fields - $XML = new simpleXMLElement(''); - $fieldSetXML = $XML->addChild('fieldset'); - $fieldSetXML->addAttribute('name', 'details'); - ComponentbuilderHelper::xmlComment( - $fieldSetXML, Line::_(__Line__, __Class__) . " Default Fields." - ); - ComponentbuilderHelper::xmlComment( - $fieldSetXML, - Line::_(__Line__, __Class__) . " Id Field. Type: Text (joomla)" - ); - // if id is not set - if (!isset($this->fieldsNames[$nameSingleCode]['id'])) - { - $attributes = array( - 'name' => 'id', - 'type' => 'text', - 'class' => 'readonly', - 'readonly' => "true", - 'label' => 'JGLOBAL_FIELD_ID_LABEL', - 'description' => 'JGLOBAL_FIELD_ID_DESC', - 'size' => 10, - 'default' => 0 - ); - $fieldXML = $fieldSetXML->addChild('field'); - ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // if created is not set - if (!isset($this->fieldsNames[$nameSingleCode]['created'])) - { - $attributes = array( - 'name' => 'created', - 'type' => 'calendar', - 'label' => $langView . '_CREATED_DATE_LABEL', - 'description' => $langView . '_CREATED_DATE_DESC', - 'size' => 22, - 'format' => '%Y-%m-%d %H:%M:%S', - 'filter' => 'user_utc' - ); - $attributes = array_merge($attributes, $readOnlyXML); - ComponentbuilderHelper::xmlComment( - $fieldSetXML, Line::_(__Line__, __Class__) - . " Date Created Field. Type: Calendar (joomla)" - ); - $fieldXML = $fieldSetXML->addChild('field'); - ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // if created_by is not set - if (!isset($this->fieldsNames[$nameSingleCode]['created_by'])) - { - $attributes = array( - 'name' => 'created_by', - 'type' => 'user', - 'label' => $langView . '_CREATED_BY_LABEL', - 'description' => $langView . '_CREATED_BY_DESC', - ); - $attributes = array_merge($attributes, $readOnlyXML); - ComponentbuilderHelper::xmlComment( - $fieldSetXML, Line::_(__Line__, __Class__) - . " User Created Field. Type: User (joomla)" - ); - $fieldXML = $fieldSetXML->addChild('field'); - ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // if published is not set - if (!isset($this->fieldsNames[$nameSingleCode]['published'])) - { - $attributes = array( - 'name' => 'published', - 'type' => 'list', - 'label' => 'JSTATUS' - ); - $attributes = array_merge($attributes, $readOnlyXML); - ComponentbuilderHelper::xmlComment( - $fieldSetXML, Line::_(__Line__, __Class__) - . " Published Field. Type: List (joomla)" - ); - $fieldXML = $fieldSetXML->addChild('field'); - ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - foreach ( - array('JPUBLISHED' => 1, 'JUNPUBLISHED' => 0, 'JARCHIVED' => 2, - 'JTRASHED' => -2) as $text => $value - ) - { - $optionXML = $fieldXML->addChild('option'); - $optionXML->addAttribute('value', $value); - $optionXML[] = $text; - } - } - // if modified is not set - if (!isset($this->fieldsNames[$nameSingleCode]['modified'])) - { - $attributes = array( - 'name' => 'modified', - 'type' => 'calendar', - 'class' => 'readonly', - 'label' => $langView . '_MODIFIED_DATE_LABEL', - 'description' => $langView . '_MODIFIED_DATE_DESC', - 'size' => 22, - 'readonly' => "true", - 'format' => '%Y-%m-%d %H:%M:%S', - 'filter' => 'user_utc' - ); - ComponentbuilderHelper::xmlComment( - $fieldSetXML, Line::_(__Line__, __Class__) - . " Date Modified Field. Type: Calendar (joomla)" - ); - $fieldXML = $fieldSetXML->addChild('field'); - ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // if modified_by is not set - if (!isset($this->fieldsNames[$nameSingleCode]['modified_by'])) - { - $attributes = array( - 'name' => 'modified_by', - 'type' => 'user', - 'label' => $langView . '_MODIFIED_BY_LABEL', - 'description' => $langView . '_MODIFIED_BY_DESC', - 'class' => 'readonly', - 'readonly' => 'true', - 'filter' => 'unset' - ); - ComponentbuilderHelper::xmlComment( - $fieldSetXML, Line::_(__Line__, __Class__) - . " User Modified Field. Type: User (joomla)" - ); - $fieldXML = $fieldSetXML->addChild('field'); - ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // check if view has access - if (isset($this->accessBuilder[$nameSingleCode]) - && StringHelper::check( - $this->accessBuilder[$nameSingleCode] - ) - && !isset($this->fieldsNames[$nameSingleCode]['access'])) - { - $attributes = array( - 'name' => 'access', - 'type' => 'accesslevel', - 'label' => 'JFIELD_ACCESS_LABEL', - 'description' => 'JFIELD_ACCESS_DESC', - 'default' => 1, - 'required' => "false" - ); - $attributes = array_merge($attributes, $readOnlyXML); - ComponentbuilderHelper::xmlComment( - $fieldSetXML, Line::_(__Line__, __Class__) - . " Access Field. Type: Accesslevel (joomla)" - ); - $fieldXML = $fieldSetXML->addChild('field'); - ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // if ordering is not set - if (!isset($this->fieldsNames[$nameSingleCode]['ordering'])) - { - $attributes = array( - 'name' => 'ordering', - 'type' => 'number', - 'class' => 'inputbox validate-ordering', - 'label' => $langView . '_ORDERING_LABEL', - 'description' => '', - 'default' => 0, - 'size' => 6, - 'required' => "false" - ); - $attributes = array_merge($attributes, $readOnlyXML); - ComponentbuilderHelper::xmlComment( - $fieldSetXML, Line::_(__Line__, __Class__) - . " Ordering Field. Type: Numbers (joomla)" - ); - $fieldXML = $fieldSetXML->addChild('field'); - ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // if version is not set - if (!isset($this->fieldsNames[$nameSingleCode]['version'])) - { - $attributes = array( - 'name' => 'version', - 'type' => 'text', - 'class' => 'readonly', - 'label' => $langView . '_VERSION_LABEL', - 'description' => $langView . '_VERSION_DESC', - 'size' => 6, - 'readonly' => "true", - 'filter' => 'unset' - ); - ComponentbuilderHelper::xmlComment( - $fieldSetXML, - Line::_(__Line__, __Class__) . " Version Field. Type: Text (joomla)" - ); - $fieldXML = $fieldSetXML->addChild('field'); - ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // check if metadata is added to this view - if (isset($this->metadataBuilder[$nameSingleCode]) - && StringHelper::check( - $this->metadataBuilder[$nameSingleCode] - )) - { - // metakey - if (!isset($this->fieldsNames[$nameSingleCode]['metakey'])) - { - $attributes = array( - 'name' => 'metakey', - 'type' => 'textarea', - 'label' => 'JFIELD_META_KEYWORDS_LABEL', - 'description' => 'JFIELD_META_KEYWORDS_DESC', - 'rows' => 3, - 'cols' => 30 - ); - ComponentbuilderHelper::xmlComment( - $fieldSetXML, Line::_(__Line__, __Class__) - . " Metakey Field. Type: Textarea (joomla)" - ); - $fieldXML = $fieldSetXML->addChild('field'); - ComponentbuilderHelper::xmlAddAttributes( - $fieldXML, $attributes - ); - // count the static field created - $this->fieldCount++; - } - // metadesc - if (!isset($this->fieldsNames[$nameSingleCode]['metadesc'])) - { - $attributes['name'] = 'metadesc'; - $attributes['label'] = 'JFIELD_META_DESCRIPTION_LABEL'; - $attributes['description'] = 'JFIELD_META_DESCRIPTION_DESC'; - ComponentbuilderHelper::xmlComment( - $fieldSetXML, Line::_(__Line__, __Class__) - . " Metadesc Field. Type: Textarea (joomla)" - ); - $fieldXML = $fieldSetXML->addChild('field'); - ComponentbuilderHelper::xmlAddAttributes( - $fieldXML, $attributes - ); - // count the static field created - $this->fieldCount++; - } - } - // fix the permissions field "title" issue gh-629 - // check if the the title is not already set - if (!isset($this->fieldsNames[$nameSingleCode]['title']) - && $this->hasPermissionsSet($view, $nameSingleCode)) - { - // set the field/tab name - $field_name = "title"; - $tab_name = "publishing"; - - $attributes = array( - 'name' => $field_name, - 'type' => 'hidden', - 'default' => $component . ' ' . $nameSingleCode - ); - ComponentbuilderHelper::xmlComment( - $fieldSetXML, - Line::_(__Line__, __Class__) - . " Was added due to Permissions JS needing a Title field" - ); - ComponentbuilderHelper::xmlComment( - $fieldSetXML, - Line::_(__Line__, __Class__) - . " Let us know at gh-629 should this change" - ); - ComponentbuilderHelper::xmlComment( - $fieldSetXML, - Line::_(__Line__, __Class__) - . " https://github.com/vdm-io/Joomla-Component-Builder/issues/629#issuecomment-750117235" - ); - $fieldXML = $fieldSetXML->addChild('field'); - ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - // setup needed field values for layout - $field_array = array(); - $field_array['order_edit'] = 0; - $field_array['tab'] = 15; - $field_array['alignment'] = 1; - // make sure it gets added to view - $this->setLayoutBuilder( - $nameSingleCode, $tab_name, $field_name, $field_array - ); - } - // load the dynamic fields now - if (count((array) $dynamicFieldsXML)) - { - ComponentbuilderHelper::xmlComment( - $fieldSetXML, Line::_(__Line__, __Class__) . " Dynamic Fields." - ); - foreach ($dynamicFieldsXML as $dynamicfield) - { - ComponentbuilderHelper::xmlAppend($fieldSetXML, $dynamicfield); - } - } - // check if metadata is added to this view - if (isset($this->metadataBuilder[$nameSingleCode]) - && StringHelper::check( - $this->metadataBuilder[$nameSingleCode] - )) - { - if (!isset($this->fieldsNames[$nameSingleCode]['robots']) - || !isset($this->fieldsNames[$nameSingleCode]['author']) - || !isset($this->fieldsNames[$nameSingleCode]['rights'])) - { - ComponentbuilderHelper::xmlComment( - $fieldSetXML, Line::_(__Line__, __Class__) . " Metadata Fields" - ); - $fieldsXML = $fieldSetXML->addChild('fields'); - $fieldsXML->addAttribute('name', 'metadata'); - $fieldsXML->addAttribute( - 'label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS' - ); - $fieldsFieldSetXML = $fieldsXML->addChild('fieldset'); - $fieldsFieldSetXML->addAttribute('name', 'vdmmetadata'); - $fieldsFieldSetXML->addAttribute( - 'label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS' - ); - // robots - if (!isset($this->fieldsNames[$nameSingleCode]['robots'])) - { - ComponentbuilderHelper::xmlComment( - $fieldsFieldSetXML, Line::_(__Line__, __Class__) - . " Robots Field. Type: List (joomla)" - ); - $robots = $fieldsFieldSetXML->addChild('field'); - $attributes = array( - 'name' => 'robots', - 'type' => 'list', - 'label' => 'JFIELD_METADATA_ROBOTS_LABEL', - 'description' => 'JFIELD_METADATA_ROBOTS_DESC' - ); - ComponentbuilderHelper::xmlAddAttributes( - $robots, $attributes - ); - // count the static field created - $this->fieldCount++; - $options = array( - 'JGLOBAL_USE_GLOBAL' => '', - 'JGLOBAL_INDEX_FOLLOW' => 'index, follow', - 'JGLOBAL_NOINDEX_FOLLOW' => 'noindex, follow', - 'JGLOBAL_INDEX_NOFOLLOW' => 'index, nofollow', - 'JGLOBAL_NOINDEX_NOFOLLOW' => 'noindex, nofollow', - ); - foreach ($options as $text => $value) - { - $option = $robots->addChild('option'); - $option->addAttribute('value', $value); - $option[] = $text; - } - } - // author - if (!isset($this->fieldsNames[$nameSingleCode]['author'])) - { - ComponentbuilderHelper::xmlComment( - $fieldsFieldSetXML, Line::_(__Line__, __Class__) - . " Author Field. Type: Text (joomla)" - ); - $author = $fieldsFieldSetXML->addChild('field'); - $attributes = array( - 'name' => 'author', - 'type' => 'text', - 'label' => 'JAUTHOR', - 'description' => 'JFIELD_METADATA_AUTHOR_DESC', - 'size' => 20 - ); - ComponentbuilderHelper::xmlAddAttributes( - $author, $attributes - ); - // count the static field created - $this->fieldCount++; - } - // rights - if (!isset($this->fieldsNames[$nameSingleCode]['rights'])) - { - ComponentbuilderHelper::xmlComment( - $fieldsFieldSetXML, Line::_(__Line__, __Class__) - . " Rights Field. Type: Textarea (joomla)" - ); - $rights = $fieldsFieldSetXML->addChild('field'); - $attributes = array( - 'name' => 'rights', - 'type' => 'textarea', - 'label' => 'JFIELD_META_RIGHTS_LABEL', - 'description' => 'JFIELD_META_RIGHTS_DESC', - 'required' => 'false', - 'filter' => 'string', - 'cols' => 30, - 'rows' => 2 - ); - ComponentbuilderHelper::xmlAddAttributes( - $rights, $attributes - ); - // count the static field created - $this->fieldCount++; - } - } - } - - // return the set - return $this->xmlPrettyPrint($XML, 'fieldset'); - } - - /** - * Check to see if a view has permissions - * - * @param array $view View details - * @param string $nameSingleCode View Single Code Name - * - * @return boolean true if it has permisssions - * - */ - protected function hasPermissionsSet(&$view, &$nameSingleCode) - { - // first check if we have checked this already - if (!isset($this->hasPermissions[$nameSingleCode])) - { - // default is false - $this->hasPermissions[$nameSingleCode] = false; - // when a view has history, it has permissions - // since it tracks the version access - if (isset($view['history']) && $view['history'] == 1) - { - // set the permission for later - $this->hasPermissions[$nameSingleCode] = true; - - // break out here - return true; - } - // check if the view has permissions - if (isset($view['settings']) - && ArrayHelper::check( - $view['settings']->permissions, true - )) - { - foreach ($view['settings']->permissions as $per) - { - // check if the permission targets the view - // 1 = view - // 3 = both view & component - if (isset($per['implementation']) - && ( - $per['implementation'] == 1 - || $per['implementation'] == 3 - )) - { - // set the permission for later - $this->hasPermissions[$nameSingleCode] = true; - - // break out here - return true; - } - } - } - // check if the fields has permissions - if (isset($view['settings']) - && ArrayHelper::check( - $view['settings']->fields, true - )) - { - foreach ($view['settings']->fields as $field) - { - // if a field has any permissions - // the a view has permissions - if (isset($field['permission']) - && ArrayHelper::check( - $field['permission'], true - )) - { - // set the permission for later - $this->hasPermissions[$nameSingleCode] = true; - - // break out here - return true; - } - } - } - } - - return $this->hasPermissions[$nameSingleCode]; - } - - /** - * set Field Names - * - * @param string $view View the field belongs to - * @param string $name The name of the field - * - * - */ - public function setFieldsNames(&$view, &$name) - { - $this->fieldsNames[$view][$name] = $name; - } - - /** - * set Dynamic field - * - * @param array $field The field data - * @param array $view The view data - * @param int $viewType The view type - * @param string $langView The language string of the view - * @param string $nameSingleCode The single view name - * @param string $nameListCode The list view name - * @param array $placeholders The place holder and replace values - * @param string $dbkey The the custom table key - * @param boolean $build The switch to set the build option - * - * @return SimpleXMLElement The complete field in xml - * - */ - public function setDynamicField(&$field, &$view, &$viewType, &$langView, - &$nameSingleCode, &$nameListCode, &$placeholders, &$dbkey, $build - ) { - // set default return - if (CFactory::_('Config')->get('field_builder_type', 2) == 1) - { - // string manipulation - $dynamicField = ''; - } - else - { - // simpleXMLElement class - $dynamicField = false; - } - // make sure we have settings - if (isset($field['settings']) - && ObjectHelper::check( - $field['settings'] - )) - { - // reset some values - $name = $this->getFieldName($field, $nameListCode); - $typeName = $this->getFieldType($field); - $multiple = false; - $langLabel = ''; - $fieldSet = ''; - $fieldAttributes = array(); - // set field attributes - $fieldAttributes = $this->setFieldAttributes( - $field, $viewType, $name, $typeName, $multiple, $langLabel, - $langView, $nameListCode, $nameSingleCode, $placeholders - ); - // check if values were set - if (ArrayHelper::check($fieldAttributes)) - { - // set the array of field names - $this->setFieldsNames( - $nameSingleCode, $fieldAttributes['name'] - ); - - if (ComponentbuilderHelper::fieldCheck($typeName, 'option')) - { - //reset options array - $optionArray = array(); - // now add to the field set - $dynamicField = $this->setField( - 'option', $fieldAttributes, $name, $typeName, $langView, - $nameSingleCode, $nameListCode, $placeholders, - $optionArray - ); - if ($build) - { - // set builders - $this->setBuilders( - $langLabel, $langView, $nameSingleCode, - $nameListCode, $name, $view, $field, $typeName, - $multiple, false, $optionArray - ); - } - } - elseif (ComponentbuilderHelper::fieldCheck($typeName, 'spacer')) - { - if ($build) - { - // make sure spacers gets loaded to layout - $tabName = ''; - if (isset($view['settings']->tabs) - && isset($view['settings']->tabs[(int) $field['tab']])) - { - $tabName - = $view['settings']->tabs[(int) $field['tab']]; - } - elseif ((int) $field['tab'] == 15) - { - // set to publishing tab - $tabName = 'publishing'; - } - $this->setLayoutBuilder( - $nameSingleCode, $tabName, $name, $field - ); - } - // now add to the field set - $dynamicField = $this->setField( - 'spacer', $fieldAttributes, $name, $typeName, $langView, - $nameSingleCode, $nameListCode, $placeholders, - $optionArray - ); - } - elseif (ComponentbuilderHelper::fieldCheck( - $typeName, 'special' - )) - { - // set the repeatable field or subform field - if ($typeName === 'repeatable' || $typeName === 'subform') - { - if ($build) - { - // set builders - $this->setBuilders( - $langLabel, $langView, $nameSingleCode, - $nameListCode, $name, $view, $field, - $typeName, $multiple, false - ); - } - // now add to the field set - $dynamicField = $this->setField( - 'special', $fieldAttributes, $name, $typeName, - $langView, $nameSingleCode, $nameListCode, - $placeholders, $optionArray - ); - } - } - elseif (isset($fieldAttributes['custom']) - && ArrayHelper::check( - $fieldAttributes['custom'] - )) - { - // set the custom array - $custom = $fieldAttributes['custom']; - unset($fieldAttributes['custom']); - // set db key - $custom['db'] = $dbkey; - // increment the db key - $dbkey++; - if ($build) - { - // set builders - $this->setBuilders( - $langLabel, $langView, $nameSingleCode, - $nameListCode, $name, $view, $field, $typeName, - $multiple, $custom - ); - } - // now add to the field set - $dynamicField = $this->setField( - 'custom', $fieldAttributes, $name, $typeName, $langView, - $nameSingleCode, $nameListCode, $placeholders, - $optionArray, $custom - ); - } - else - { - if ($build) - { - // set builders - $this->setBuilders( - $langLabel, $langView, $nameSingleCode, - $nameListCode, $name, $view, $field, $typeName, - $multiple - ); - } - // now add to the field set - $dynamicField = $this->setField( - 'plain', $fieldAttributes, $name, $typeName, $langView, - $nameSingleCode, $nameListCode, $placeholders, - $optionArray - ); - } - } - } - - return $dynamicField; - } - - /** - * build field set - * - * @param array $fields The fields data - * @param string $langView The language string of the view - * @param string $nameSingleCode The single view name - * @param string $nameListCode The list view name - * @param array $placeholders The place holder and replace values - * @param string $dbkey The the custom table key - * @param boolean $build The switch to set the build option - * @param int $return_type The return type 1 = string, 2 = array - * - * @return mix The complete field in xml - * - */ - public function getFieldsetXML(&$fields, &$langView, &$nameSingleCode, - &$nameListCode, &$placeholders, &$dbkey, $build = false, - $return_type = 1 - ) { - // set some defaults - $view = ''; - $viewType = 0; - // build the fieldset - if ($return_type == 1) - { - $fieldset = ''; - } - else - { - $fieldset = array(); - } - // loop over the fields to build - if (ArrayHelper::check($fields)) - { - foreach ($fields as $field) - { - // get the field - $xmlField = $this->getFieldXMLString( - $field, $view, $viewType, $langView, - $nameSingleCode, $nameListCode, - $placeholders, $dbkey, $build - ); - // make sure the xml is set and a string - if (isset($xmlField) - && StringHelper::check( - $xmlField - )) - { - if ($return_type == 1) - { - $fieldset .= $xmlField; - } - else - { - $fieldset[] = $xmlField; - } - } - } - } - - return $fieldset; - } - - /** - * build field string - * - * @param array $field The field data - * @param array $view The view data - * @param int $viewType The view type - * @param string $langView The language string of the view - * @param string $nameSingleCode The single view name - * @param string $nameListCode The list view name - * @param array $placeholders The place holder and replace values - * @param string $dbkey The the custom table key - * @param boolean $build The switch to set the build option - * - * @return string The complete field in xml-string - * - */ - public function getFieldXMLString(&$field, &$view, &$viewType, &$langView, - &$nameSingleCode, &$nameListCode, &$placeholders, &$dbkey, - $build = false - ) { - // check the field builder type - $xmlField = ''; - if (CFactory::_('Config')->get('field_builder_type', 2) == 1) - { - // string manipulation - $xmlField = $this->setDynamicField( - $field, $view, $viewType, $langView, - $nameSingleCode, $nameListCode, - $placeholders, $dbkey, $build - ); - } - else - { - // simpleXMLElement class - $newxmlField = $this->setDynamicField( - $field, $view, $viewType, $langView, - $nameSingleCode, $nameListCode, - $placeholders, $dbkey, $build - ); - if (isset($newxmlField->fieldXML)) - { - $xmlField = dom_import_simplexml( - $newxmlField->fieldXML - ); - $xmlField = PHP_EOL . Indent::_(2) . "' . PHP_EOL - . Indent::_(1) . $this->xmlPrettyPrint( - $xmlField, 'field' - ); - } - } - - // return the string - return $xmlField; - } - - /** - * set a field - * - * @param string $setType The set of fields type - * @param array $fieldAttributes The field values - * @param string $name The field name - * @param string $typeName The field type - * @param string $langView The language string of the view - * @param string $nameSingleCode The single view name - * @param string $nameListCode The list view name - * @param array $placeholders The place holder and replace values - * @param string $optionArray The option bucket array used to set the field options if needed. - * @param array $custom Used when field is from config - * @param string $taber The tabs to add in layout (only in string manipulation) - * - * @return SimpleXMLElement The field in xml - * - */ - private function setField($setType, &$fieldAttributes, &$name, &$typeName, - &$langView, &$nameSingleCode, &$nameListCode, $placeholders, - &$optionArray, $custom = null, $taber = '' - ) { - // count the dynamic fields created - $this->fieldCount++; - // check what type of field builder to use - if (CFactory::_('Config')->get('field_builder_type', 2) == 1) - { - // build field set using string manipulation - return $this->stringSetField( - $setType, $fieldAttributes, $name, $typeName, $langView, - $nameSingleCode, $nameListCode, $placeholders, $optionArray, - $custom, $taber - ); - } - else - { - // build field set with simpleXMLElement class - return $this->simpleXMLSetField( - $setType, $fieldAttributes, $name, $typeName, $langView, - $nameSingleCode, $nameListCode, $placeholders, $optionArray, - $custom - ); - } - } - - /** - * set a field using string manipulation - * - * @param string $setType The set of fields type - * @param array $fieldAttributes The field values - * @param string $name The field name - * @param string $typeName The field type - * @param string $langView The language string of the view - * @param string $nameSingleCode The single view name - * @param string $nameListCode The list view name - * @param array $placeholders The place holder and replace values - * @param string $optionArray The option bucket array used to set the field options if needed. - * @param array $custom Used when field is from config - * @param string $taber The tabs to add in layout - * - * @return SimpleXMLElement The field in xml - * - */ - protected function stringSetField($setType, &$fieldAttributes, &$name, - &$typeName, &$langView, &$nameSingleCode, &$nameListCode, - $placeholders, &$optionArray, $custom = null, $taber = '' - ) { - $field = ''; - if ($setType === 'option') - { - // now add to the field set - $field .= PHP_EOL . Indent::_(1) . $taber . Indent::_(1) - . ""; - $field .= PHP_EOL . Indent::_(1) . $taber . Indent::_(1) - . " $value) - { - if ($property != 'option') - { - $field .= PHP_EOL . Indent::_(2) . $taber . Indent::_(1) - . $property . '="' . $value . '"'; - } - elseif ($property === 'option') - { - $optionSet = ''; - if (strtolower($typeName) === 'groupedlist' - && strpos( - $value, ',' - ) !== false - && strpos($value, '@@') !== false) - { - // reset the group temp arrays - $groups_ = array(); - $grouped_ = array('group' => array(), - 'option' => array()); - $order_ = array(); - // mulitpal options - $options = explode(',', $value); - foreach ($options as $option) - { - if (strpos($option, '@@') !== false) - { - // set the group label - $valueKeyArray = explode('@@', $option); - if (count((array) $valueKeyArray) == 2) - { - $langValue = $langView . '_' - . FieldHelper::safe( - $valueKeyArray[0], true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, - $valueKeyArray[0] - ); - // now add group label - $groups_[$valueKeyArray[1]] = PHP_EOL - . Indent::_(1) . $taber . Indent::_(2) - . ''; - // set order - $order_['group' . $valueKeyArray[1]] - = $valueKeyArray[1]; - } - } - elseif (strpos($option, '|') !== false) - { - // has other value then text - $valueKeyArray = explode('|', $option); - if (count((array) $valueKeyArray) == 3) - { - $langValue = $langView . '_' - . FieldHelper::safe( - $valueKeyArray[1], true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, - $valueKeyArray[1] - ); - // now add to option set - $grouped_['group'][$valueKeyArray[2]][] - = PHP_EOL . Indent::_(1) . $taber - . Indent::_(3) . ''; - $optionArray[$valueKeyArray[0]] - = $langValue; - // set order - $order_['group' . $valueKeyArray[2]] - = $valueKeyArray[2]; - } - else - { - $langValue = $langView . '_' - . FieldHelper::safe( - $valueKeyArray[1], true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, - $valueKeyArray[1] - ); - // now add to option set - $grouped_['option'][$valueKeyArray[0]] - = PHP_EOL . Indent::_(1) . $taber - . Indent::_(2) . ''; - $optionArray[$valueKeyArray[0]] - = $langValue; - // set order - $order_['option' . $valueKeyArray[0]] - = $valueKeyArray[0]; - } - } - else - { - // text is also the value - $langValue = $langView . '_' - . FieldHelper::safe( - $option, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $option - ); - // now add to option set - $grouped_['option'][$option] = PHP_EOL - . Indent::_(1) . $taber . Indent::_(2) - . ''; - $optionArray[$option] = $langValue; - // set order - $order_['option' . $option] = $option; - } - } - // now build the groups - foreach ($order_ as $pointer_ => $_id) - { - // load the default key - $key_ = 'group'; - if (strpos($pointer_, 'option') !== false) - { - // load the option field - $key_ = 'option'; - } - // check if this is a group loader - if ('group' === $key_ && isset($groups_[$_id]) - && isset($grouped_[$key_][$_id]) - && ArrayHelper::check( - $grouped_[$key_][$_id] - )) - { - // set group label - $optionSet .= $groups_[$_id]; - foreach ($grouped_[$key_][$_id] as $option_) - { - $optionSet .= $option_; - } - unset($groups_[$_id]); - unset($grouped_[$key_][$_id]); - // close the group - $optionSet .= PHP_EOL . Indent::_(1) . $taber - . Indent::_(2) . ''; - } - elseif (isset($grouped_[$key_][$_id]) - && StringHelper::check( - $grouped_[$key_][$_id] - )) - { - $optionSet .= $grouped_[$key_][$_id]; - } - } - } - elseif (strpos($value, ',') !== false) - { - // mulitpal options - $options = explode(',', $value); - foreach ($options as $option) - { - if (strpos($option, '|') !== false) - { - // has other value then text - list($v, $t) = explode('|', $option); - $langValue = $langView . '_' - . FieldHelper::safe( - $t, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $t - ); - // now add to option set - $optionSet .= PHP_EOL . Indent::_(1) - . $taber . Indent::_(2) . ''; - $optionArray[$v] = $langValue; - } - else - { - // text is also the value - $langValue = $langView . '_' - . FieldHelper::safe( - $option, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $option - ); - // now add to option set - $optionSet .= PHP_EOL . Indent::_(2) - . $taber . Indent::_(1) . ''; - $optionArray[$option] = $langValue; - } - } - } - else - { - // one option - if (strpos($value, '|') !== false) - { - // has other value then text - list($v, $t) = explode('|', $value); - $langValue = $langView . '_' - . FieldHelper::safe( - $t, true - ); - // add to lang array - CFactory::_('Language')->set(CFactory::_('Config')->lang_target, $langValue, $t); - // now add to option set - $optionSet .= PHP_EOL . Indent::_(2) . $taber - . Indent::_(1) . ''; - $optionArray[$v] = $langValue; - } - else - { - // text is also the value - $langValue = $langView . '_' - . FieldHelper::safe( - $value, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $value - ); - // now add to option set - $optionSet .= PHP_EOL . Indent::_(2) - . $taber . Indent::_(1) . ''; - $optionArray[$value] = $langValue; - } - } - } - } - // if options were found - if (StringHelper::check($optionSet)) - { - $field .= '>'; - $field .= PHP_EOL . Indent::_(3) . $taber . ""; - $field .= $optionSet; - $field .= PHP_EOL . Indent::_(2) . $taber . ""; - } - // if no options found and must have a list of options - elseif (ComponentbuilderHelper::fieldCheck($typeName, 'list')) - { - $optionArray = false; - $field .= PHP_EOL . Indent::_(2) . $taber . "/>"; - $field .= PHP_EOL . Indent::_(2) . $taber . "" - . PHP_EOL; - } - else - { - $optionArray = false; - $field .= PHP_EOL . Indent::_(2) . $taber . "/>"; - } - } - elseif ($setType === 'plain') - { - // now add to the field set - $field .= PHP_EOL . Indent::_(2) . $taber . ""; - $field .= PHP_EOL . Indent::_(2) . $taber . " $value) - { - if ($property != 'option') - { - $field .= PHP_EOL . Indent::_(2) . $taber . Indent::_(1) - . $property . '="' . $value . '"'; - } - } - $field .= PHP_EOL . Indent::_(2) . $taber . "/>"; - } - elseif ($setType === 'spacer') - { - // now add to the field set - $field .= PHP_EOL . Indent::_(2) . ""; - $field .= PHP_EOL . Indent::_(2) . " $value) - { - if ($property != 'option') - { - $field .= " " . $property . '="' . $value . '"'; - } - } - $field .= " />"; - } - elseif ($setType === 'special') - { - // set the repeatable field - if ($typeName === 'repeatable') - { - // now add to the field set - $field .= PHP_EOL . Indent::_(2) . ""; - $field .= PHP_EOL . Indent::_(2) . " $value) - { - if ($property != 'fields') - { - $field .= PHP_EOL . Indent::_(3) . $property . '="' - . $value . '"'; - } - } - $field .= ">"; - $field .= PHP_EOL . Indent::_(3) . ''; - $field .= PHP_EOL . Indent::_(4) - . '"; - $field .= PHP_EOL . Indent::_(3) . ""; - $field .= PHP_EOL . Indent::_(2) . ""; - } - // set the subform fields (it is a repeatable without the modal) - elseif ($typeName === 'subform') - { - // now add to the field set - $field .= PHP_EOL . Indent::_(2) . $taber . ""; - $field .= PHP_EOL . Indent::_(2) . $taber . " $value) - { - if ($property != 'fields') - { - $field .= PHP_EOL . Indent::_(3) . $taber . $property - . '="' . $value . '"'; - } - } - $field .= ">"; - $field .= PHP_EOL . Indent::_(3) . $taber - . '"; - $field .= PHP_EOL . Indent::_(2) . $taber . ""; - } - } - elseif ($setType === 'custom') - { - // now add to the field set - $field .= PHP_EOL . Indent::_(2) . $taber . ""; - $field .= PHP_EOL . Indent::_(2) . $taber . " $value) - { - if ($property != 'option') - { - $field .= PHP_EOL . Indent::_(2) . $taber . Indent::_(1) - . $property . '="' . $value . '"'; - } - elseif ($property === 'option') - { - $optionSet = ''; - if (strtolower($typeName) === 'groupedlist' - && strpos( - $value, ',' - ) !== false - && strpos($value, '@@') !== false) - { - // reset the group temp arrays - $groups_ = array(); - $grouped_ = array('group' => array(), - 'option' => array()); - $order_ = array(); - // mulitpal options - $options = explode(',', $value); - foreach ($options as $option) - { - if (strpos($option, '@@') !== false) - { - // set the group label - $valueKeyArray = explode('@@', $option); - if (count((array) $valueKeyArray) == 2) - { - $langValue = $langView . '_' - . FieldHelper::safe( - $valueKeyArray[0], true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, - $valueKeyArray[0] - ); - // now add group label - $groups_[$valueKeyArray[1]] = PHP_EOL - . Indent::_(1) . $taber . Indent::_(2) - . ''; - // set order - $order_['group' . $valueKeyArray[1]] - = $valueKeyArray[1]; - } - } - elseif (strpos($option, '|') !== false) - { - // has other value then text - $valueKeyArray = explode('|', $option); - if (count((array) $valueKeyArray) == 3) - { - $langValue = $langView . '_' - . FieldHelper::safe( - $valueKeyArray[1], true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, - $valueKeyArray[1] - ); - // now add to option set - $grouped_['group'][$valueKeyArray[2]][] - = PHP_EOL . Indent::_(1) . $taber - . Indent::_(3) . ''; - $optionArray[$valueKeyArray[0]] - = $langValue; - // set order - $order_['group' . $valueKeyArray[2]] - = $valueKeyArray[2]; - } - else - { - $langValue = $langView . '_' - . FieldHelper::safe( - $valueKeyArray[1], true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, - $valueKeyArray[1] - ); - // now add to option set - $grouped_['option'][$valueKeyArray[0]] - = PHP_EOL . Indent::_(1) . $taber - . Indent::_(2) . ''; - $optionArray[$valueKeyArray[0]] - = $langValue; - // set order - $order_['option' . $valueKeyArray[0]] - = $valueKeyArray[0]; - } - } - else - { - // text is also the value - $langValue = $langView . '_' - . FieldHelper::safe( - $option, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $option - ); - // now add to option set - $grouped_['option'][$option] = PHP_EOL - . Indent::_(1) . $taber . Indent::_(2) - . ''; - $optionArray[$option] = $langValue; - // set order - $order_['option' . $option] = $option; - } - } - // now build the groups - foreach ($order_ as $pointer_ => $_id) - { - // load the default key - $key_ = 'group'; - if (strpos($pointer_, 'option') !== false) - { - // load the option field - $key_ = 'option'; - } - // check if this is a group loader - if ('group' === $key_ && isset($groups_[$_id]) - && isset($grouped_[$key_][$_id]) - && ArrayHelper::check( - $grouped_[$key_][$_id] - )) - { - // set group label - $optionSet .= $groups_[$_id]; - foreach ($grouped_[$key_][$_id] as $option_) - { - $optionSet .= $option_; - } - unset($groups_[$_id]); - unset($grouped_[$key_][$_id]); - // close the group - $optionSet .= PHP_EOL . Indent::_(1) . $taber - . Indent::_(2) . ''; - } - elseif (isset($grouped_[$key_][$_id]) - && StringHelper::check( - $grouped_[$key_][$_id] - )) - { - $optionSet .= $grouped_[$key_][$_id]; - } - } - } - elseif (strpos($value, ',') !== false) - { - // mulitpal options - $options = explode(',', $value); - foreach ($options as $option) - { - if (strpos($option, '|') !== false) - { - // has other value then text - list($v, $t) = explode('|', $option); - $langValue = $langView . '_' - . FieldHelper::safe( - $t, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $t - ); - // now add to option set - $optionSet .= PHP_EOL . Indent::_(1) - . $taber . Indent::_(2) . ''; - $optionArray[$v] = $langValue; - } - else - { - // text is also the value - $langValue = $langView . '_' - . FieldHelper::safe( - $option, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $option - ); - // now add to option set - $optionSet .= PHP_EOL . Indent::_(2) - . $taber . Indent::_(1) . ''; - $optionArray[$option] = $langValue; - } - } - } - else - { - // one option - if (strpos($value, '|') !== false) - { - // has other value then text - list($v, $t) = explode('|', $value); - $langValue = $langView . '_' - . FieldHelper::safe( - $t, true - ); - // add to lang array - CFactory::_('Language')->set(CFactory::_('Config')->lang_target, $langValue, $t); - // now add to option set - $optionSet .= PHP_EOL . Indent::_(2) . $taber - . Indent::_(1) . ''; - $optionArray[$v] = $langValue; - } - else - { - // text is also the value - $langValue = $langView . '_' - . FieldHelper::safe( - $value, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $value - ); - // now add to option set - $optionSet .= PHP_EOL . Indent::_(2) - . $taber . Indent::_(1) . ''; - $optionArray[$value] = $langValue; - } - } - } - } - // if options were found - if (StringHelper::check($optionSet)) - { - $field .= '>'; - $field .= PHP_EOL . Indent::_(3) . $taber . ""; - $field .= $optionSet; - $field .= PHP_EOL . Indent::_(2) . $taber . ""; - } - // if no options found and must have a list of options - elseif (ComponentbuilderHelper::fieldCheck($typeName, 'list')) - { - $optionArray = false; - $field .= PHP_EOL . Indent::_(2) . $taber . "/>"; - $field .= PHP_EOL . Indent::_(2) . $taber . "" - . PHP_EOL; - } - else - { - $optionArray = false; - $field .= PHP_EOL . Indent::_(2) . $taber . "/>"; - } - // incase the field is in the config and has not been set - if ('config' === $nameSingleCode && 'configs' === $nameListCode - || (strpos($nameSingleCode, 'P|uG!n') !== false - || strpos( - $nameSingleCode, 'M0dU|3' - ) !== false)) - { - // set lang (just incase) - $listLangName = $langView . '_' - . StringHelper::safe($name, 'U'); - // set the custom array - $data = array('type' => $typeName, 'code' => $name, - 'lang' => $listLangName, 'custom' => $custom); - // set the custom field file - $this->setCustomFieldTypeFile( - $data, $nameListCode, $nameSingleCode - ); - } - } - - // return field - return $field; - } - - /** - * set a field with simpleXMLElement class - * - * @param string $setType The set of fields type - * @param array $fieldAttributes The field values - * @param string $name The field name - * @param string $typeName The field type - * @param string $langView The language string of the view - * @param string $nameSingleCode The single view name - * @param string $nameListCode The list view name - * @param array $placeholders The place holder and replace values - * @param string $optionArray The option bucket array used to set the field options if needed. - * @param array $custom Used when field is from config - * - * @return SimpleXMLElement The field in xml - * - */ - protected function simpleXMLSetField($setType, &$fieldAttributes, &$name, - &$typeName, &$langView, &$nameSingleCode, &$nameListCode, - $placeholders, &$optionArray, $custom = null - ) { - $field = new stdClass(); - if ($setType === 'option') - { - // now add to the field set - $field->fieldXML = new SimpleXMLElement(''); - $field->comment = Line::_(__Line__, __Class__) . " " . ucfirst($name) - . " Field. Type: " . StringHelper::safe( - $typeName, 'F' - ) . ". (joomla)"; - - foreach ($fieldAttributes as $property => $value) - { - if ($property != 'option') - { - $field->fieldXML->addAttribute($property, $value); - } - elseif ($property === 'option') - { - ComponentbuilderHelper::xmlComment( - $field->fieldXML, - Line::_(__Line__, __Class__) . " Option Set." - ); - if (strtolower($typeName) === 'groupedlist' - && strpos( - $value, ',' - ) !== false - && strpos($value, '@@') !== false) - { - // reset the group temp arrays - $groups_ = array(); - $grouped_ = array('group' => array(), - 'option' => array()); - $order_ = array(); - // mulitpal options - $options = explode(',', $value); - foreach ($options as $option) - { - if (strpos($option, '@@') !== false) - { - // set the group label - $valueKeyArray = explode('@@', $option); - if (count((array) $valueKeyArray) == 2) - { - $langValue = $langView . '_' - . FieldHelper::safe( - $valueKeyArray[0], true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, - $valueKeyArray[0] - ); - // now add group label - $groups_[$valueKeyArray[1]] = $langValue; - // set order - $order_['group' . $valueKeyArray[1]] - = $valueKeyArray[1]; - } - } - elseif (strpos($option, '|') !== false) - { - // has other value then text - $valueKeyArray = explode('|', $option); - if (count((array) $valueKeyArray) == 3) - { - $langValue = $langView . '_' - . FieldHelper::safe( - $valueKeyArray[1], true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, - $valueKeyArray[1] - ); - // now add to option set - $grouped_['group'][$valueKeyArray[2]][] - = array('value' => $valueKeyArray[0], - 'text' => $langValue); - $optionArray[$valueKeyArray[0]] - = $langValue; - // set order - $order_['group' . $valueKeyArray[2]] - = $valueKeyArray[2]; - } - else - { - $langValue = $langView . '_' - . FieldHelper::safe( - $valueKeyArray[1], true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, - $valueKeyArray[1] - ); - // now add to option set - $grouped_['option'][$valueKeyArray[0]] - = array('value' => $valueKeyArray[0], - 'text' => $langValue); - $optionArray[$valueKeyArray[0]] - = $langValue; - // set order - $order_['option' . $valueKeyArray[0]] - = $valueKeyArray[0]; - } - } - else - { - // text is also the value - $langValue = $langView . '_' - . FieldHelper::safe( - $option, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $option - ); - // now add to option set - $grouped_['option'][$option] - = array('value' => $option, - 'text' => $langValue); - $optionArray[$option] = $langValue; - // set order - $order_['option' . $option] = $option; - } - } - // now build the groups - foreach ($order_ as $pointer_ => $_id) - { - // load the default key - $key_ = 'group'; - if (strpos($pointer_, 'option') !== false) - { - // load the option field - $key_ = 'option'; - } - // check if this is a group loader - if ('group' === $key_ && isset($groups_[$_id]) - && isset($grouped_[$key_][$_id]) - && ArrayHelper::check( - $grouped_[$key_][$_id] - )) - { - // set group label - $groupXML = $field->fieldXML->addChild('group'); - $groupXML->addAttribute( - 'label', $groups_[$_id] - ); - - foreach ($grouped_[$key_][$_id] as $option_) - { - $groupOptionXML = $groupXML->addChild( - 'option' - ); - $groupOptionXML->addAttribute( - 'value', $option_['value'] - ); - $groupOptionXML[] = $option_['text']; - } - unset($groups_[$_id]); - unset($grouped_[$key_][$_id]); - } - elseif (isset($grouped_[$key_][$_id]) - && StringHelper::check( - $grouped_[$key_][$_id] - )) - { - $optionXML = $field->fieldXML->addChild( - 'option' - ); - $optionXML->addAttribute( - 'value', $grouped_[$key_][$_id]['value'] - ); - $optionXML[] = $grouped_[$key_][$_id]['text']; - } - } - } - elseif (strpos($value, ',') !== false) - { - // mulitpal options - $options = explode(',', $value); - foreach ($options as $option) - { - $optionXML = $field->fieldXML->addChild('option'); - if (strpos($option, '|') !== false) - { - // has other value then text - list($v, $t) = explode('|', $option); - $langValue = $langView . '_' - . FieldHelper::safe( - $t, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $t - ); - // now add to option set - $optionXML->addAttribute('value', $v); - $optionArray[$v] = $langValue; - } - else - { - // text is also the value - $langValue = $langView . '_' - . FieldHelper::safe( - $option, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $option - ); - // now add to option set - $optionXML->addAttribute('value', $option); - $optionArray[$option] = $langValue; - } - $optionXML[] = $langValue; - } - } - else - { - // one option - $optionXML = $field->fieldXML->addChild('option'); - if (strpos($value, '|') !== false) - { - // has other value then text - list($v, $t) = explode('|', $value); - $langValue = $langView . '_' - . FieldHelper::safe( - $t, true - ); - // add to lang array - CFactory::_('Language')->set(CFactory::_('Config')->lang_target, $langValue, $t); - // now add to option set - $optionXML->addAttribute('value', $v); - $optionArray[$v] = $langValue; - } - else - { - // text is also the value - $langValue = $langView . '_' - . FieldHelper::safe( - $value, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $value - ); - // now add to option set - $optionXML->addAttribute('value', $value); - $optionArray[$value] = $langValue; - } - $optionXML[] = $langValue; - } - } - } - // if no options found and must have a list of options - if (!$field->fieldXML->count() - && ComponentbuilderHelper::fieldCheck($typeName, 'list')) - { - ComponentbuilderHelper::xmlComment( - $field->fieldXML, Line::_(__Line__, __Class__) - . " No Manual Options Were Added In Field Settings." - ); - } - } - elseif ($setType === 'plain') - { - // now add to the field set - $field->fieldXML = new SimpleXMLElement(''); - $field->comment = Line::_(__Line__, __Class__) . " " . ucfirst($name) - . " Field. Type: " . StringHelper::safe( - $typeName, 'F' - ) . ". (joomla)"; - - foreach ($fieldAttributes as $property => $value) - { - if ($property != 'option') - { - $field->fieldXML->addAttribute($property, $value); - } - } - } - elseif ($setType === 'spacer') - { - // now add to the field set - $field->fieldXML = new SimpleXMLElement(''); - $field->comment = Line::_(__Line__, __Class__) . " " . ucfirst($name) - . " Field. Type: " . StringHelper::safe( - $typeName, 'F' - ) . ". A None Database Field. (joomla)"; - - foreach ($fieldAttributes as $property => $value) - { - if ($property != 'option') - { - $field->fieldXML->addAttribute($property, $value); - } - } - } - elseif ($setType === 'special') - { - // set the repeatable field - if ($typeName === 'repeatable') - { - // now add to the field set - $field->fieldXML = new SimpleXMLElement(''); - $field->comment = Line::_(__Line__, __Class__) . " " . ucfirst( - $name - ) . " Field. Type: " . StringHelper::safe( - $typeName, 'F' - ) . ". (depreciated)"; - - foreach ($fieldAttributes as $property => $value) - { - if ($property != 'fields') - { - $field->fieldXML->addAttribute($property, $value); - } - } - $fieldsXML = $field->fieldXML->addChild('fields'); - $fieldsXML->addAttribute( - 'name', $fieldAttributes['name'] . '_fields' - ); - $fieldsXML->addAttribute('label', ''); - $fieldSetXML = $fieldsXML->addChild('fieldset'); - $fieldSetXML->addAttribute('hidden', 'true'); - $fieldSetXML->addAttribute( - 'name', $fieldAttributes['name'] . '_modal' - ); - $fieldSetXML->addAttribute('repeat', 'true'); - - if (strpos($fieldAttributes['fields'], ',') !== false) - { - // mulitpal fields - $fieldsSets = (array) explode( - ',', $fieldAttributes['fields'] - ); - } - elseif (is_numeric($fieldAttributes['fields'])) - { - // single field - $fieldsSets[] = (int) $fieldAttributes['fields']; - } - // only continue if we have a field set - if (ArrayHelper::check($fieldsSets)) - { - // set the resolver - $_resolverKey = $fieldAttributes['name']; - // load the field data - $fieldsSets = array_map( - function ($id) use ( - $nameSingleCode, $nameListCode, $_resolverKey - ) { - // start field - $field = array(); - $field['field'] = $id; - // set the field details - $this->setFieldDetails( - $field, $nameSingleCode, $nameListCode, - $_resolverKey - ); - - // return field - return $field; - }, array_values($fieldsSets) - ); - // start the build - foreach ($fieldsSets as $fieldData) - { - // if we have settings continue - if (ObjectHelper::check( - $fieldData['settings'] - )) - { - $r_name = $this->getFieldName( - $fieldData, $nameListCode, $_resolverKey - ); - $r_typeName = $this->getFieldType($fieldData); - $r_multiple = false; - $r_langLabel = ''; - // get field values - $r_fieldValues = $this->setFieldAttributes( - $fieldData, $view, $r_name, $r_typeName, - $r_multiple, $r_langLabel, $langView, - $nameListCode, $nameSingleCode, - $placeholders, true - ); - // check if values were set - if (ArrayHelper::check( - $r_fieldValues - )) - { - //reset options array - $r_optionArray = array(); - if (ComponentbuilderHelper::fieldCheck( - $r_typeName, 'option' - )) - { - // now add to the field set - ComponentbuilderHelper::xmlAppend( - $fieldSetXML, $this->setField( - 'option', $r_fieldValues, $r_name, - $r_typeName, $langView, - $nameSingleCode, $nameListCode, - $placeholders, $r_optionArray - ) - ); - } - elseif (isset($r_fieldValues['custom']) - && ArrayHelper::check( - $r_fieldValues['custom'] - )) - { - // add to custom - $custom = $r_fieldValues['custom']; - unset($r_fieldValues['custom']); - // now add to the field set - ComponentbuilderHelper::xmlAppend( - $fieldSetXML, $this->setField( - 'custom', $r_fieldValues, $r_name, - $r_typeName, $langView, - $nameSingleCode, $nameListCode, - $placeholders, $r_optionArray - ) - ); - // set lang (just incase) - $r_listLangName = $langView . '_' - . FieldHelper::safe( - $r_name, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $r_listLangName, - StringHelper::safe( - $r_name, 'W' - ) - ); - // if label was set use instead - if (StringHelper::check( - $r_langLabel - )) - { - $r_listLangName = $r_langLabel; - } - // set the custom array - $data = array('type' => $r_typeName, - 'code' => $r_name, - 'lang' => $r_listLangName, - 'custom' => $custom); - // set the custom field file - $this->setCustomFieldTypeFile( - $data, $nameListCode, - $nameSingleCode - ); - } - else - { - // now add to the field set - ComponentbuilderHelper::xmlAppend( - $fieldSetXML, $this->setField( - 'plain', $r_fieldValues, $r_name, - $r_typeName, $langView, - $nameSingleCode, $nameListCode, - $placeholders, $r_optionArray - ) - ); - } - } - } - } - } - } - // set the subform fields (it is a repeatable without the modal) - elseif ($typeName === 'subform') - { - // now add to the field set - $field->fieldXML = new SimpleXMLElement(''); - $field->comment = Line::_(__Line__, __Class__) . " " . ucfirst( - $name - ) . " Field. Type: " . StringHelper::safe( - $typeName, 'F' - ) . ". (joomla)"; - // add all properties - foreach ($fieldAttributes as $property => $value) - { - if ($property != 'fields' && $property != 'formsource') - { - $field->fieldXML->addAttribute($property, $value); - } - } - // if we detect formsource we do not add the form - if (isset($fieldAttributes['formsource']) - && StringHelper::check( - $fieldAttributes['formsource'] - )) - { - $field->fieldXML->addAttribute( - 'formsource', $fieldAttributes['formsource'] - ); - } - // add the form - else - { - $form = $field->fieldXML->addChild('form'); - $attributes = array( - 'hidden' => 'true', - 'name' => 'list_' . $fieldAttributes['name'] - . '_modal', - 'repeat' => 'true' - ); - ComponentbuilderHelper::xmlAddAttributes( - $form, $attributes - ); - - if (strpos($fieldAttributes['fields'], ',') !== false) - { - // multiple fields - $fieldsSets = (array) explode( - ',', $fieldAttributes['fields'] - ); - } - elseif (is_numeric($fieldAttributes['fields'])) - { - // single field - $fieldsSets[] = (int) $fieldAttributes['fields']; - } - // only continue if we have a field set - if (ArrayHelper::check($fieldsSets)) - { - // set the resolver - $_resolverKey = $fieldAttributes['name']; - // load the field data - $fieldsSets = array_map( - function ($id) use ( - $nameSingleCode, $nameListCode, - $_resolverKey - ) { - // start field - $field = array(); - $field['field'] = $id; - // set the field details - $this->setFieldDetails( - $field, $nameSingleCode, $nameListCode, - $_resolverKey - ); - - // return field - return $field; - }, array_values($fieldsSets) - ); - // start the build - foreach ($fieldsSets as $fieldData) - { - // if we have settings continue - if (ObjectHelper::check( - $fieldData['settings'] - )) - { - $r_name = $this->getFieldName( - $fieldData, $nameListCode, $_resolverKey - ); - $r_typeName = $this->getFieldType($fieldData); - $r_multiple = false; - $r_langLabel = ''; - // get field values - $r_fieldValues = $this->setFieldAttributes( - $fieldData, $view, $r_name, $r_typeName, - $r_multiple, $r_langLabel, $langView, - $nameListCode, $nameSingleCode, - $placeholders, true - ); - // check if values were set - if (ArrayHelper::check( - $r_fieldValues - )) - { - //reset options array - $r_optionArray = array(); - if (ComponentbuilderHelper::fieldCheck( - $r_typeName, 'option' - )) - { - // now add to the field set - ComponentbuilderHelper::xmlAppend( - $form, $this->setField( - 'option', $r_fieldValues, $r_name, - $r_typeName, $langView, - $nameSingleCode, $nameListCode, - $placeholders, $r_optionArray - ) - ); - } - elseif ($r_typeName === 'subform') - { - // set nested depth - if (isset($fieldAttributes['nested_depth'])) - { - $r_fieldValues['nested_depth'] - = ++$fieldAttributes['nested_depth']; - } - else - { - $r_fieldValues['nested_depth'] = 1; - } - // only continue if nest is bellow 20 (this should be a safe limit) - if ($r_fieldValues['nested_depth'] - <= 20) - { - // now add to the field set - ComponentbuilderHelper::xmlAppend( - $form, $this->setField( - 'special', $r_fieldValues, - $r_name, $r_typeName, $langView, - $nameSingleCode, - $nameListCode, $placeholders, - $r_optionArray - ) - ); - } - - } - elseif (isset($r_fieldValues['custom']) - && ArrayHelper::check( - $r_fieldValues['custom'] - )) - { - // add to custom - $custom = $r_fieldValues['custom']; - unset($r_fieldValues['custom']); - // now add to the field set - ComponentbuilderHelper::xmlAppend( - $form, $this->setField( - 'custom', $r_fieldValues, $r_name, - $r_typeName, $langView, - $nameSingleCode, $nameListCode, - $placeholders, $r_optionArray - ) - ); - // set lang (just incase) - $r_listLangName = $langView . '_' - . FieldHelper::safe( - $r_name, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $r_listLangName, - StringHelper::safe( - $r_name, 'W' - ) - ); - // if label was set use instead - if (StringHelper::check( - $r_langLabel - )) - { - $r_listLangName = $r_langLabel; - } - // set the custom array - $data = array('type' => $r_typeName, - 'code' => $r_name, - 'lang' => $r_listLangName, - 'custom' => $custom); - // set the custom field file - $this->setCustomFieldTypeFile( - $data, $nameListCode, - $nameSingleCode - ); - } - else - { - // now add to the field set - ComponentbuilderHelper::xmlAppend( - $form, $this->setField( - 'plain', $r_fieldValues, $r_name, - $r_typeName, $langView, - $nameSingleCode, $nameListCode, - $placeholders, $r_optionArray - ) - ); - } - } - } - } - } - } - } - } - elseif ($setType === 'custom') - { - // now add to the field set - $field->fieldXML = new SimpleXMLElement(''); - $field->comment = Line::_(__Line__, __Class__) . " " . ucfirst($name) - . " Field. Type: " . StringHelper::safe( - $typeName, 'F' - ) . ". (custom)"; - foreach ($fieldAttributes as $property => $value) - { - if ($property != 'option') - { - $field->fieldXML->addAttribute($property, $value); - } - elseif ($property === 'option') - { - ComponentbuilderHelper::xmlComment( - $field->fieldXML, - Line::_(__Line__, __Class__) . " Option Set." - ); - if (strtolower($typeName) === 'groupedlist' - && strpos( - $value, ',' - ) !== false - && strpos($value, '@@') !== false) - { - // reset the group temp arrays - $groups_ = array(); - $grouped_ = array('group' => array(), - 'option' => array()); - $order_ = array(); - // mulitpal options - $options = explode(',', $value); - foreach ($options as $option) - { - if (strpos($option, '@@') !== false) - { - // set the group label - $valueKeyArray = explode('@@', $option); - if (count((array) $valueKeyArray) == 2) - { - $langValue = $langView . '_' - . FieldHelper::safe( - $valueKeyArray[0], true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, - $valueKeyArray[0] - ); - // now add group label - $groups_[$valueKeyArray[1]] = $langValue; - // set order - $order_['group' . $valueKeyArray[1]] - = $valueKeyArray[1]; - } - } - elseif (strpos($option, '|') !== false) - { - // has other value then text - $valueKeyArray = explode('|', $option); - if (count((array) $valueKeyArray) == 3) - { - $langValue = $langView . '_' - . FieldHelper::safe( - $valueKeyArray[1], true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, - $valueKeyArray[1] - ); - // now add to option set - $grouped_['group'][$valueKeyArray[2]][] - = array('value' => $valueKeyArray[0], - 'text' => $langValue); - $optionArray[$valueKeyArray[0]] - = $langValue; - // set order - $order_['group' . $valueKeyArray[2]] - = $valueKeyArray[2]; - } - else - { - $langValue = $langView . '_' - . FieldHelper::safe( - $valueKeyArray[1], true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, - $valueKeyArray[1] - ); - // now add to option set - $grouped_['option'][$valueKeyArray[0]] - = array('value' => $valueKeyArray[0], - 'text' => $langValue); - $optionArray[$valueKeyArray[0]] - = $langValue; - // set order - $order_['option' . $valueKeyArray[0]] - = $valueKeyArray[0]; - } - } - else - { - // text is also the value - $langValue = $langView . '_' - . FieldHelper::safe( - $option, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $option - ); - // now add to option set - $grouped_['option'][$option] - = array('value' => $option, - 'text' => $langValue); - $optionArray[$option] = $langValue; - // set order - $order_['option' . $option] = $option; - } - } - // now build the groups - foreach ($order_ as $pointer_ => $_id) - { - // load the default key - $key_ = 'group'; - if (strpos($pointer_, 'option') !== false) - { - // load the option field - $key_ = 'option'; - } - // check if this is a group loader - if ('group' === $key_ && isset($groups_[$_id]) - && isset($grouped_[$key_][$_id]) - && ArrayHelper::check( - $grouped_[$key_][$_id] - )) - { - // set group label - $groupXML = $field->fieldXML->addChild('group'); - $groupXML->addAttribute( - 'label', $groups_[$_id] - ); - - foreach ($grouped_[$key_][$_id] as $option_) - { - $groupOptionXML = $groupXML->addChild( - 'option' - ); - $groupOptionXML->addAttribute( - 'value', $option_['value'] - ); - $groupOptionXML[] = $option_['text']; - } - unset($groups_[$_id]); - unset($grouped_[$key_][$_id]); - } - elseif (isset($grouped_[$key_][$_id]) - && StringHelper::check( - $grouped_[$key_][$_id] - )) - { - $optionXML = $field->fieldXML->addChild( - 'option' - ); - $optionXML->addAttribute( - 'value', $grouped_[$key_][$_id]['value'] - ); - $optionXML[] = $grouped_[$key_][$_id]['text']; - } - } - } - elseif (strpos($value, ',') !== false) - { - // municipal options - $options = explode(',', $value); - foreach ($options as $option) - { - $optionXML = $field->fieldXML->addChild('option'); - if (strpos($option, '|') !== false) - { - // has other value then text - list($v, $t) = explode('|', $option); - $langValue = $langView . '_' - . FieldHelper::safe( - $t, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $t - ); - // now add to option set - $optionXML->addAttribute('value', $v); - $optionArray[$v] = $langValue; - } - else - { - // text is also the value - $langValue = $langView . '_' - . FieldHelper::safe( - $option, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $option - ); - // now add to option set - $optionXML->addAttribute('value', $option); - $optionArray[$option] = $langValue; - } - $optionXML[] = $langValue; - } - } - else - { - // one option - $optionXML = $field->fieldXML->addChild('option'); - if (strpos($value, '|') !== false) - { - // has other value then text - list($v, $t) = explode('|', $value); - $langValue = $langView . '_' - . FieldHelper::safe( - $t, true - ); - // add to lang array - CFactory::_('Language')->set(CFactory::_('Config')->lang_target, $langValue, $t); - // now add to option set - $optionXML->addAttribute('value', $v); - $optionArray[$v] = $langValue; - } - else - { - // text is also the value - $langValue = $langView . '_' - . FieldHelper::safe( - $value, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $langValue, $value - ); - // now add to option set - $optionXML->addAttribute('value', $value); - $optionArray[$value] = $langValue; - } - $optionXML[] = $langValue; - } - } - } - // incase the field is in the config and has not been set (or is part of a plugin or module) - if (('config' === $nameSingleCode - && 'configs' === $nameListCode) - || (strpos($nameSingleCode, 'P|uG!n') !== false - || strpos( - $nameSingleCode, 'M0dU|3' - ) !== false)) - { - // set lang (just incase) - $listLangName = $langView . '_' - . StringHelper::safe($name, 'U'); - // set the custom array - $data = array('type' => $typeName, 'code' => $name, - 'lang' => $listLangName, 'custom' => $custom); - // set the custom field file - $this->setCustomFieldTypeFile( - $data, $nameListCode, $nameSingleCode - ); - } - } - - return $field; - } - - /** - * set the layout builder - * - * @param string $nameSingleCode The single edit view code name - * @param string $tabName The tab code name - * @param string $name The field code name - * @param array $field The field details - * - * @return void - * - */ - public function setLayoutBuilder(&$nameSingleCode, &$tabName, &$name, - &$field - ) { - // first fix the zero order - // to insure it lands before all the other fields - // as zero is expected to behave - if ($field['order_edit'] == 0) - { - if (!isset($this->zeroOrderFix[$nameSingleCode])) - { - $this->zeroOrderFix[$nameSingleCode] = array(); - } - if (!isset($this->zeroOrderFix[$nameSingleCode][(int) $field['tab']])) - { - $this->zeroOrderFix[$nameSingleCode][(int) $field['tab']] - = -999; - } - else - { - $this->zeroOrderFix[$nameSingleCode][(int) $field['tab']]++; - } - $field['order_edit'] - = $this->zeroOrderFix[$nameSingleCode][(int) $field['tab']]; - } - // now build the layout - if (StringHelper::check($tabName) - && $tabName != 'publishing') - { - $this->tabCounter[$nameSingleCode][(int) $field['tab']] - = $tabName; - if (isset($this->layoutBuilder[$nameSingleCode][$tabName][(int) $field['alignment']][(int) $field['order_edit']])) - { - $size = (int) count( - (array) $this->layoutBuilder[$nameSingleCode][$tabName][(int) $field['alignment']] - ) + 1; - while (isset($this->layoutBuilder[$nameSingleCode][$tabName][(int) $field['alignment']][$size])) - { - $size++; - } - $this->layoutBuilder[$nameSingleCode][$tabName][(int) $field['alignment']][$size] - = $name; - } - else - { - $this->layoutBuilder[$nameSingleCode][$tabName][(int) $field['alignment']][(int) $field['order_edit']] - = $name; - } - // check if default fields were over written - if (in_array($name, $this->defaultFields)) - { - // just to eliminate - $this->movedPublishingFields[$nameSingleCode][$name] = $name; - } - } - elseif ($tabName === 'publishing' || $tabName === 'Publishing') - { - if (!in_array($name, $this->defaultFields)) - { - if (isset($this->newPublishingFields[$nameSingleCode][(int) $field['alignment']][(int) $field['order_edit']])) - { - $size = (int) count( - (array) $this->newPublishingFields[$nameSingleCode][(int) $field['alignment']] - ) + 1; - while (isset($this->newPublishingFields[$nameSingleCode][(int) $field['alignment']][$size])) - { - $size++; - } - $this->newPublishingFields[$nameSingleCode][(int) $field['alignment']][$size] - = $name; - } - else - { - $this->newPublishingFields[$nameSingleCode][(int) $field['alignment']][(int) $field['order_edit']] - = $name; - } - } - } - else - { - $this->tabCounter[$nameSingleCode][1] = 'Details'; - if (isset($this->layoutBuilder[$nameSingleCode]['Details'][(int) $field['alignment']][(int) $field['order_edit']])) - { - $size = (int) count( - (array) $this->layoutBuilder[$nameSingleCode]['Details'][(int) $field['alignment']] - ) + 1; - while (isset($this->layoutBuilder[$nameSingleCode]['Details'][(int) $field['alignment']][$size])) - { - $size++; - } - $this->layoutBuilder[$nameSingleCode]['Details'][(int) $field['alignment']][$size] - = $name; - } - else - { - $this->layoutBuilder[$nameSingleCode]['Details'][(int) $field['alignment']][(int) $field['order_edit']] - = $name; - } - // check if default fields were over written - if (in_array($name, $this->defaultFields)) - { - // just to eliminate - $this->movedPublishingFields[$nameSingleCode][$name] = $name; - } - } - } - - /** - * build the site field data needed - * - * @param string $view The single edit view code name - * @param string $field The field name - * @param string $set The decoding set this field belongs to - * @param string $type The field type - * - * @return void - * - */ - public function buildSiteFieldData($view, $field, $set, $type) - { - $decode = array('json', 'base64', 'basic_encryption', - 'whmcs_encryption', 'medium_encryption', - 'expert_mode'); - $textareas = array('textarea', 'editor'); - if (isset($this->siteFields[$view][$field]) - && ArrayHelper::check( - $this->siteFields[$view][$field] - )) - { - foreach ($this->siteFields[$view][$field] as $codeString => $array) - { - // get the code array - $codeArray = explode('___', $codeString); - // set the code - $code = trim($codeArray[0]); - // set the decoding methods - if (in_array($set, $decode)) - { - if (isset($this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]) - && isset($this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]['decode'])) - { - if (!in_array( - $set, - $this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]['decode'] - )) - { - $this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']]['decode'][] - = $set; - } - } - else - { - $this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']] - = array('decode' => array($set), - 'type' => $type, - 'admin_view' => $view); - } - } - // set the uikit checker - if ((2 == $this->uikit || 1 == $this->uikit) - && in_array( - $type, $textareas - )) - { - $this->siteFieldData['uikit'][$array['site']][$code][$array['as']][$array['key']] - = $array; - } - // set the textareas checker - if (in_array($type, $textareas)) - { - $this->siteFieldData['textareas'][$array['site']][$code][$array['as']][$array['key']] - = $array; - } - } - } - } - - /** - * set field attributes - * - * @param array $field The field data - * @param int $viewType The view type - * @param string $name The field name - * @param string $typeName The field type - * @param boolean $multiple The switch to set multiple selection option - * @param string $langLabel The language string for field label - * @param string $langView The language string of the view - * @param string $nameListCode The list view name - * @param string $nameSingleCode The single view name - * @param array $placeholders The place holder and replace values - * @param boolean $repeatable The repeatable field switch - * - * @return array The field attributes - * - */ - private function setFieldAttributes(&$field, &$viewType, &$name, &$typeName, - &$multiple, &$langLabel, $langView, $nameListCode, $nameSingleCode, - $placeholders, $repeatable = false - ) { - // reset array - $fieldAttributes = array(); - $setCustom = false; - $setReadonly = false; - // setup joomla default fields - if (!ComponentbuilderHelper::fieldCheck($typeName)) - { - $fieldAttributes['custom'] = array(); - // is this an own custom field - if (isset($field['settings']->own_custom)) - { - $fieldAttributes['custom']['own_custom'] - = $field['settings']->own_custom; - } - $setCustom = true; - } - // setup a default field - if (ArrayHelper::check($field['settings']->properties)) - { - // we need a deeper php code search tracker - $phpTracker = array(); - foreach ($field['settings']->properties as $property) - { - // reset - $xmlValue = ''; - $langValue = ''; - if ($property['name'] === 'type') - { - // get type name - $xmlValue = $typeName; - - // add to custom if it is custom - if ($setCustom) - { - // set the type just to make sure. - $fieldAttributes['custom']['type'] = $typeName; - } - } - elseif ($property['name'] === 'name') - { - // get the actual field name - $xmlValue = CFactory::_('Placeholder')->update($name, $placeholders); - } - elseif ($property['name'] === 'validate') - { - // check if we have validate (validation rule set) - $xmlValue = GetHelper::between( - $field['settings']->xml, 'validate="', '"' - ); - if (StringHelper::check($xmlValue)) - { - $xmlValue = StringHelper::safe( - $xmlValue - ); - } - } - elseif ($property['name'] === 'extension' - || $property['name'] === 'directory' - || $property['name'] === 'formsource') - { - // get value & replace the placeholders - $xmlValue = CFactory::_('Placeholder')->update( - GetHelper::between( - $field['settings']->xml, $property['name'] . '="', - '"' - ), $placeholders - ); - } - // catch all PHP here - elseif (strpos($property['name'], 'type_php') !== false - && $setCustom) - { - // set the line number - $phpLine = (int) preg_replace( - '/[^0-9]/', '', $property['name'] - ); - // set the type key - $phpKey = (string) trim( - str_replace( - 'type_', '', - preg_replace('/[0-9]+/', '', $property['name']) - ), '_' - ); - // load the php for the custom field file - $fieldAttributes['custom'][$phpKey][$phpLine] - = CFactory::_('Customcode')->add( - ComponentbuilderHelper::openValidBase64( - GetHelper::between( - $field['settings']->xml, - $property['name'] . '="', '"' - ) - ) - ); - // load tracker - $phpTracker['type_' . $phpKey] = $phpKey; - } - elseif ($property['name'] === 'prime_php' && $setCustom) - { - // load the php for the custom field file - $fieldAttributes['custom']['prime_php'] - = (int) GetHelper::between( - $field['settings']->xml, $property['name'] . '="', '"' - ); - } - elseif ($property['name'] === 'extends' && $setCustom) - { - // load the class that is being extended - $fieldAttributes['custom']['extends'] - = GetHelper::between( - $field['settings']->xml, 'extends="', '"' - ); - } - elseif ($property['name'] === 'view' && $setCustom) - { - // load the view name & replace the placeholders - $fieldAttributes['custom']['view'] - = StringHelper::safe( - CFactory::_('Placeholder')->update( - GetHelper::between( - $field['settings']->xml, 'view="', '"' - ), $placeholders - ) - ); - } - elseif ($property['name'] === 'views' && $setCustom) - { - // load the views name & replace the placeholders - $fieldAttributes['custom']['views'] - = StringHelper::safe( - CFactory::_('Placeholder')->update( - GetHelper::between( - $field['settings']->xml, 'views="', '"' - ), $placeholders - ) - ); - } - elseif ($property['name'] === 'component' && $setCustom) - { - // load the component name & replace the placeholders - $fieldAttributes['custom']['component'] - = CFactory::_('Placeholder')->update( - GetHelper::between( - $field['settings']->xml, 'component="', '"' - ), $placeholders - ); - } - elseif ($property['name'] === 'table' && $setCustom) - { - // load the main table that is queried & replace the placeholders - $fieldAttributes['custom']['table'] - = CFactory::_('Placeholder')->update( - GetHelper::between( - $field['settings']->xml, 'table="', '"' - ), $placeholders - ); - } - elseif ($property['name'] === 'value_field' && $setCustom) - { - // load the text key - $fieldAttributes['custom']['text'] - = StringHelper::safe( - GetHelper::between( - $field['settings']->xml, 'value_field="', '"' - ) - ); - } - elseif ($property['name'] === 'key_field' && $setCustom) - { - // load the id key - $fieldAttributes['custom']['id'] - = StringHelper::safe( - GetHelper::between( - $field['settings']->xml, 'key_field="', '"' - ) - ); - } - elseif ($property['name'] === 'button' && $repeatable - && $setCustom) - { - // dont load the button to repeatable - $xmlValue = 'false'; - // do not add button - $fieldAttributes['custom']['add_button'] = 'false'; - } - elseif ($property['name'] === 'button' && $setCustom) - { - // load the button string value if found - $xmlValue = (string) StringHelper::safe( - GetHelper::between( - $field['settings']->xml, 'button="', '"' - ) - ); - // add to custom values - $fieldAttributes['custom']['add_button'] - = (StringHelper::check($xmlValue) - || 1 == $xmlValue) ? $xmlValue : 'false'; - } - elseif ($property['name'] === 'required' - && 'repeatable' === $typeName) - { - // dont load the required to repeatable field type - $xmlValue = 'false'; - } - elseif ($viewType == 2 - && ($property['name'] === 'readonly' - || $property['name'] === 'disabled')) - { - // set read only - $xmlValue = 'true'; - // trip the switch for readonly - if ($property['name'] === 'readonly') - { - $setReadonly = true; - } - } - elseif ($property['name'] === 'multiple') - { - $xmlValue = (string) GetHelper::between( - $field['settings']->xml, $property['name'] . '="', '"' - ); - // add the multipal - if ('true' === $xmlValue) - { - $multiple = true; - } - } - // make sure the name is added as a cless name for use in javascript - elseif ($property['name'] === 'class' - && ($typeName === 'note' - || $typeName === 'spacer')) - { - $xmlValue = GetHelper::between( - $field['settings']->xml, 'class="', '"' - ); - // add the type class - if (StringHelper::check($xmlValue)) - { - if (strpos($xmlValue, $name) === false) - { - $xmlValue = $xmlValue . ' ' . $name; - } - } - else - { - $xmlValue = $name; - } - } - else - { - // set the rest of the fields - $xmlValue = (string) CFactory::_('Placeholder')->update( - GetHelper::between( - $field['settings']->xml, $property['name'] . '="', - '"' - ), $placeholders - ); - } - - // check if translatable - if (StringHelper::check($xmlValue) - && isset($property['translatable']) - && $property['translatable'] == 1) - { - // update label if field use multiple times - if ($property['name'] === 'label') - { - if (isset($fieldAttributes['name']) - && isset($this->uniqueNames[$nameListCode]['names'][$fieldAttributes['name']])) - { - $xmlValue .= ' (' - . StringHelper::safe( - $this->uniqueNames[$nameListCode]['names'][$fieldAttributes['name']] - ) . ')'; - } - } - // replace placeholders - $xmlValue = CFactory::_('Placeholder')->update( - $xmlValue, $placeholders - ); - // insure custom lables dont get messed up - if ($setCustom) - { - $customLabel = $xmlValue; - } - // set lang key - $langValue = $langView . '_' - . FieldHelper::safe( - $name . ' ' . $property['name'], true - ); - // add to lang array - CFactory::_('Language')->set(CFactory::_('Config')->lang_target, $langValue, $xmlValue); - // use lang value - $xmlValue = $langValue; - } - elseif (isset($field['alias']) && $field['alias'] - && isset($property['translatable']) - && $property['translatable'] == 1) - { - if ($property['name'] === 'label') - { - $xmlValue = 'JFIELD_ALIAS_LABEL'; - } - elseif ($property['name'] === 'description') - { - $xmlValue = 'JFIELD_ALIAS_DESC'; - } - elseif ($property['name'] === 'hint') - { - $xmlValue = 'JFIELD_ALIAS_PLACEHOLDER'; - } - } - elseif (isset($field['title']) && $field['title'] - && isset($property['translatable']) - && $property['translatable'] == 1) - { - if ($property['name'] === 'label') - { - $xmlValue = 'JGLOBAL_TITLE'; - } - } - // only load value if found or is mandatory - if (StringHelper::check($xmlValue) - || (isset($property['mandatory']) - && $property['mandatory'] == 1 - && !$setCustom)) - { - // make sure mantory fields are added - if (!StringHelper::check($xmlValue)) - { - if (isset($property['example']) - && StringHelper::check( - $property['example'] - )) - { - $xmlValue = $property['example']; - } - } - // load to langBuilder down the line - if ($property['name'] === 'label') - { - if ($setCustom) - { - $fieldAttributes['custom']['label'] = $customLabel; - } - $langLabel = $xmlValue; - } - // now set the value - $fieldAttributes[$property['name']] = $xmlValue; - } - // validate that the default field is set - elseif ($property['name'] === 'default' - && ($xmlValidateValue - = GetHelper::between( - $field['settings']->xml, 'default="', '"', 'none-set' - )) !== 'none-set') - { - // we must allow empty defaults - $fieldAttributes['default'] = $xmlValue; - } - } - // check if all php is loaded using the tracker - if (ArrayHelper::check($phpTracker)) - { - // litle search validation - $confirmation - = '8qvZHoyuFYQqpj0YQbc6F3o5DhBlmS-_-a8pmCZfOVSfANjkmV5LG8pCdAY2JNYu6cB'; - foreach ($phpTracker as $searchKey => $phpKey) - { - // we must search for more code in the xml just encase - foreach (range(2, 30) as $phpLine) - { - $get_ = $searchKey . '_' . $phpLine; - if (!isset($fieldAttributes['custom'][$phpKey][$phpLine]) - && ($value - = ComponentbuilderHelper::getValueFromXMLstring( - $field['settings']->xml, $get_, $confirmation - )) !== $confirmation) - { - $fieldAttributes['custom'][$phpKey][$phpLine] - = CFactory::_('Customcode')->add( - ComponentbuilderHelper::openValidBase64($value) - ); - } - } - } - } - // do some nice twigs beyond the default - if (isset($fieldAttributes['name'])) - { - // check if we have class value for the list view of this field - $listclass = GetHelper::between( - $field['settings']->xml, 'listclass="', '"' - ); - if (StringHelper::check($listclass)) - { - $this->listFieldClass[$nameListCode][$fieldAttributes['name']] - = $listclass; - } - // check if we find reason to remove this field from being escaped - $escaped = GetHelper::between( - $field['settings']->xml, 'escape="', '"' - ); - if (StringHelper::check($escaped)) - { - $this->doNotEscape[$nameListCode][] - = $fieldAttributes['name']; - } - // check if we have display switch for dynamic placement - $display = GetHelper::between( - $field['settings']->xml, 'display="', '"' - ); - if (StringHelper::check($display)) - { - $fieldAttributes['display'] = $display; - } - // make sure validation is set if found (even it not part of field properties) - if (!isset($fieldAttributes['validate'])) - { - // check if we have validate (validation rule set) - $validationRule = GetHelper::between( - $field['settings']->xml, 'validate="', '"' - ); - if (StringHelper::check($validationRule)) - { - $fieldAttributes['validate'] - = StringHelper::safe( - $validationRule - ); - } - } - // make sure ID is always readonly - if ($fieldAttributes['name'] === 'id' && !$setReadonly) - { - $fieldAttributes['readonly'] = 'true'; - } - } - } - - return $fieldAttributes; - } - - /** - * set Builders - * - * @param string $langLabel The language string for field label - * @param string $langView The language string of the view - * @param string $nameSingleCode The single view name - * @param string $nameListCode The list view name - * @param string $name The field name - * @param array $view The view data - * @param array $field The field data - * @param string $typeName The field type - * @param boolean $multiple The switch to set multiple selection option - * @param boolean $custom The custom field switch - * @param boolean $options The options switch - * - * @return void - * - */ - public function setBuilders($langLabel, $langView, $nameSingleCode, - $nameListCode, $name, $view, $field, $typeName, $multiple, - $custom = false, $options = false - ) { - // check if this is a tag field - if ($typeName === 'tag') - { - // set tags for this view but don't load to DB - $this->tagsBuilder[$nameSingleCode] = $nameSingleCode; - } - // dbSwitch - $dbSwitch = true; - if (isset($field['list']) && $field['list'] == 2) - { - // do not add this field to the database - $dbSwitch = false; - } - elseif (isset($field['settings']->datatype)) - { - // insure default not none if number type - $numberKeys = array('INT', 'TINYINT', 'BIGINT', 'FLOAT', 'DECIMAL', - 'DOUBLE'); - // don't use these as index or uniqe keys - $textKeys = array('TEXT', 'TINYTEXT', 'MEDIUMTEXT', 'LONGTEXT', - 'BLOB', 'TINYBLOB', 'MEDIUMBLOB', 'LONGBLOB'); - // build the query values - $this->queryBuilder[$nameSingleCode][$name]['type'] - = $field['settings']->datatype; - // check if this is a number - if (in_array($field['settings']->datatype, $numberKeys)) - { - if ($field['settings']->datadefault === 'Other') - { - // setup the checking - $number_check = $field['settings']->datadefault_other; - // Decimals in SQL needs some help - if ('DECIMAL' === $field['settings']->datatype - && !is_numeric($number_check)) - { - $number_check = str_replace( - ',', '.', $field['settings']->datadefault_other - ); - } - // check if we have a valid number value - if (!is_numeric($number_check)) - { - $field['settings']->datadefault_other = '0'; - } - } - elseif (!is_numeric($field['settings']->datadefault)) - { - $field['settings']->datadefault = '0'; - } - } - // check if this is not text - if (!in_array($field['settings']->datatype, $textKeys)) - { - $this->queryBuilder[$nameSingleCode][$name]['lenght'] - = $field['settings']->datalenght; - $this->queryBuilder[$nameSingleCode][$name]['lenght_other'] - = $field['settings']->datalenght_other; - $this->queryBuilder[$nameSingleCode][$name]['default'] - = $field['settings']->datadefault; - $this->queryBuilder[$nameSingleCode][$name]['other'] - = $field['settings']->datadefault_other; - } - // fall back unto EMPTY for text - else - { - $this->queryBuilder[$nameSingleCode][$name]['default'] - = 'EMPTY'; - } - // to identify the field - $this->queryBuilder[$nameSingleCode][$name]['ID'] - = $field['settings']->id; - $this->queryBuilder[$nameSingleCode][$name]['null_switch'] - = $field['settings']->null_switch; - // set index types - $_guid = true; - if ($field['settings']->indexes == 1 - && !in_array( - $field['settings']->datatype, $textKeys - )) - { - // build unique keys of this view for db - $this->dbUniqueKeys[$nameSingleCode][] = $name; - // prevent guid from being added twice - if ('guid' === $name) - { - $_guid = false; - } - } - elseif (($field['settings']->indexes == 2 - || (isset($field['alias']) - && $field['alias']) - || (isset($field['title']) && $field['title']) - || $typeName === 'category') - && !in_array($field['settings']->datatype, $textKeys)) - { - // build keys of this view for db - $this->dbKeys[$nameSingleCode][] = $name; - } - // special treatment for GUID - if ('guid' === $name && $_guid) - { - $this->dbUniqueGuid[$nameSingleCode] = true; - } - } - // set list switch - $listSwitch = (isset($field['list']) - && ($field['list'] == 1 - || $field['list'] == 3 - || $field['list'] == 4)); - // set list join - $listJoin - = (isset($this->listJoinBuilder[$nameListCode][(int) $field['field']])); - // add history to this view - if (isset($view['history']) && $view['history']) - { - $this->historyBuilder[$nameSingleCode] = $nameSingleCode; - } - // set Alias (only one title per view) - if ($dbSwitch && isset($field['alias']) && $field['alias'] - && !isset($this->aliasBuilder[$nameSingleCode])) - { - $this->aliasBuilder[$nameSingleCode] = $name; - } - // set Titles (only one title per view) - if ($dbSwitch && isset($field['title']) && $field['title'] - && !isset($this->titleBuilder[$nameSingleCode])) - { - $this->titleBuilder[$nameSingleCode] = $name; - } - // category name fix - if ($typeName === 'category') - { - if (isset($this->catOtherName[$nameListCode]) - && ArrayHelper::check( - $this->catOtherName[$nameListCode] - )) - { - $tempName = $this->catOtherName[$nameListCode]['name']; - } - else - { - $tempName = $nameListCode . ' categories'; - } - // set lang - $listLangName = $langView . '_' - . FieldHelper::safe($tempName, true); - // set field name - $listFieldName = StringHelper::safe($tempName, 'W'); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $listLangName, $listFieldName - ); - } - else - { - // if label was set use instead - if (StringHelper::check($langLabel)) - { - $listLangName = $langLabel; - // get field label from the lang label - if (CFactory::_('Language')->exist(CFactory::_('Config')->lang_target, $langLabel)) - { - $listFieldName - = CFactory::_('Language')->get(CFactory::_('Config')->lang_target, $langLabel); - } - else - { - // get it from the field xml string - $listFieldName = (string) CFactory::_('Placeholder')->update( - GetHelper::between( - $field['settings']->xml, 'label="', - '"' - ), CFactory::_('Placeholder')->active - ); - } - // make sure there is no html in the list field name - $listFieldName = strip_tags($listFieldName); - } - else - { - // set lang (just in case) - $listLangName = $langView . '_' - . FieldHelper::safe($name, true); - // set field name - $listFieldName = StringHelper::safe($name, 'W'); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $listLangName, $listFieldName - ); - } - } - // build the list values - if (($listSwitch || $listJoin) && $typeName != 'repeatable' - && $typeName != 'subform') - { - // load to list builder - if ($listSwitch) - { - $this->listBuilder[$nameListCode][] = array( - 'id' => (int) $field['field'], - 'type' => $typeName, - 'code' => $name, - 'lang' => $listLangName, - 'title' => (isset($field['title']) && $field['title']) - ? true : false, - 'alias' => (isset($field['alias']) && $field['alias']) - ? true : false, - 'link' => (isset($field['link']) && $field['link']) - ? true : false, - 'sort' => (isset($field['sort']) && $field['sort']) - ? true : false, - 'custom' => $custom, - 'multiple' => $multiple, - 'options' => $options, - 'target' => (int) $field['list']); - } - // build custom builder list - if ($listSwitch || $listJoin) - { - $this->customBuilderList[$nameListCode][] = $name; - } - } - // load the list join builder - if ($listJoin) - { - $this->listJoinBuilder[$nameListCode][(int) $field['field']] - = array( - 'type' => $typeName, - 'code' => $name, - 'lang' => $listLangName, - 'title' => (isset($field['title']) && $field['title']) ? true - : false, - 'alias' => (isset($field['alias']) && $field['alias']) ? true - : false, - 'link' => (isset($field['link']) && $field['link']) ? true - : false, - 'sort' => (isset($field['sort']) && $field['sort']) ? true - : false, - 'custom' => $custom, - 'multiple' => $multiple, - 'options' => $options); - } - // update the field relations - if (isset($this->fieldRelations[$nameListCode]) - && isset($this->fieldRelations[$nameListCode][(int) $field['field']]) - && ArrayHelper::check( - $this->fieldRelations[$nameListCode][(int) $field['field']] - )) - { - foreach ( - $this->fieldRelations[$nameListCode][(int) $field['field']] as - $area => &$field_values - ) - { - $field_values['type'] = $typeName; - $field_values['code'] = $name; - $field_values['custom'] = $custom; - } - } - // set the hidden field of this view - if ($dbSwitch && $typeName === 'hidden') - { - if (!isset($this->hiddenFieldsBuilder[$nameSingleCode])) - { - $this->hiddenFieldsBuilder[$nameSingleCode] = ''; - } - $this->hiddenFieldsBuilder[$nameSingleCode] .= ',"' . $name . '"'; - } - // set all int fields of this view - if ($dbSwitch && isset($field['settings']->datatype) - && ($field['settings']->datatype === 'INT' - || $field['settings']->datatype === 'TINYINT' - || $field['settings']->datatype === 'BIGINT')) - { - if (!isset($this->intFieldsBuilder[$nameSingleCode])) - { - $this->intFieldsBuilder[$nameSingleCode] = ''; - } - $this->intFieldsBuilder[$nameSingleCode] .= ',"' . $name . '"'; - } - // set all dynamic field of this view - if ($dbSwitch && $typeName != 'category' && $typeName != 'repeatable' - && $typeName != 'subform' - && !in_array($name, $this->defaultFields)) - { - if (!isset($this->dynamicfieldsBuilder[$nameSingleCode])) - { - $this->dynamicfieldsBuilder[$nameSingleCode] = ''; - } - if (isset($this->dynamicfieldsBuilder[$nameSingleCode]) - && StringHelper::check( - $this->dynamicfieldsBuilder[$nameSingleCode] - )) - { - $this->dynamicfieldsBuilder[$nameSingleCode] .= ',"' . $name - . '":"' . $name . '"'; - } - else - { - $this->dynamicfieldsBuilder[$nameSingleCode] .= '"' . $name - . '":"' . $name . '"'; - } - } - // TODO we may need to add a switch instead (since now it uses the first editor field) - // set the main(biggest) text field of this view - if ($dbSwitch && $typeName === 'editor') - { - if (!isset($this->maintextBuilder[$nameSingleCode]) - || !StringHelper::check( - $this->maintextBuilder[$nameSingleCode] - )) - { - $this->maintextBuilder[$nameSingleCode] = $name; - } - } - // set the custom builder - if (ArrayHelper::check($custom) - && $typeName != 'category' - && $typeName != 'repeatable' - && $typeName != 'subform') - { - $this->customBuilder[$nameListCode][] = array('type' => $typeName, - 'code' => $name, - 'lang' => $listLangName, - 'custom' => $custom, - 'method' => $field['settings']->store); - // set the custom fields needed in content type data - if (!isset($this->customFieldLinksBuilder[$nameSingleCode])) - { - $this->customFieldLinksBuilder[$nameSingleCode] = ''; - } - // only load this if table is set - if (isset($custom['table']) - && StringHelper::check( - $custom['table'] - )) - { - $this->customFieldLinksBuilder[$nameSingleCode] .= ',{"sourceColumn": "' - . $name . '","targetTable": "' . $custom['table'] - . '","targetColumn": "' . $custom['id'] - . '","displayColumn": "' . $custom['text'] . '"}'; - } - // build script switch for user - if ($custom['extends'] === 'user') - { - $this->setScriptUserSwitch[$typeName] = $typeName; - } - } - if ($typeName === 'media') - { - $this->setScriptMediaSwitch[$typeName] = $typeName; - } - // setup category for this view - if ($dbSwitch && $typeName === 'category') - { - if (isset($this->catOtherName[$nameListCode]) - && ArrayHelper::check( - $this->catOtherName[$nameListCode] - )) - { - $otherViews = $this->catOtherName[$nameListCode]['views']; - $otherView = $this->catOtherName[$nameListCode]['view']; - } - else - { - $otherViews = $nameListCode; - $otherView = $nameSingleCode; - } - // get the xml extension name - $_extension = CFactory::_('Placeholder')->update( - GetHelper::between( - $field['settings']->xml, 'extension="', '"' - ), CFactory::_('Placeholder')->active - ); - // if they left out the extension for some reason - if (!StringHelper::check($_extension)) - { - $_extension = 'com_' . CFactory::_('Config')->component_code_name . '.' - . $otherView; - } - // check the context (does our target match) - if (strpos($_extension, '.') !== false) - { - $target_view = trim(explode('.', $_extension)[1]); - // from my understanding the target extension view and the otherView must align - // so I will here check that it does, and if not raise an error message to fix this - if ($target_view !== $otherView) - { - $target_extension = trim(explode('.', $_extension)[0]); - $correction = $target_extension . '.' . $otherView; - $this->app->enqueueMessage( - JText::sprintf( - '

Category targeting view mismatch

-

The - category field in (%s) admin view has a mismatching target view. -
To correct the mismatch, the extension value %s in the - field must be changed to %s - for - best category integration with Joomla. -
Please watch - this tutorial before proceeding!!!, - code fix

', - $field['field'], $nameSingleCode, $_extension, - $field['field'], $correction - ), 'Error' - ); - } - } - // load the category builder - TODO must move all to single view - $this->categoryBuilder[$nameListCode] = array('code' => $name, - 'name' => $listLangName, - 'extension' => $_extension, - 'filter' => $field['filter']); - // also set code name for title alias fix - $this->catCodeBuilder[$nameSingleCode] = array('code' => $name, - 'views' => $otherViews, - 'view' => $otherView); - } - // setup checkbox for this view - if ($dbSwitch - && ($typeName === 'checkbox' - || (ArrayHelper::check($custom) - && isset($custom['extends']) - && $custom['extends'] === 'checkboxes'))) - { - $this->checkboxBuilder[$nameSingleCode][] = $name; - } - // setup checkboxes and other json items for this view - // if we have advance field modeling and the field is not being set in the DB - // this could mean that field is modeled manually (so we add it) - if (($dbSwitch || $field['settings']->store == 6) - && (($typeName === 'subform' || $typeName === 'checkboxes' - || $multiple - || $field['settings']->store != 0) - && $typeName != 'tag')) - { - $subformJsonSwitch = true; - switch ($field['settings']->store) - { - case 1: - // JSON_STRING_ENCODE - $this->jsonStringBuilder[$nameSingleCode][] = $name; - // Site settings of each field if needed - $this->buildSiteFieldData( - $nameSingleCode, $name, 'json', $typeName - ); - break; - case 2: - // BASE_SIXTY_FOUR - $this->base64Builder[$nameSingleCode][] = $name; - // Site settings of each field if needed - $this->buildSiteFieldData( - $nameSingleCode, $name, 'base64', $typeName - ); - break; - case 3: - // BASIC_ENCRYPTION_LOCALKEY - $this->basicFieldModeling[$nameSingleCode][] = $name; - // Site settings of each field if needed - $this->buildSiteFieldData( - $nameSingleCode, $name, 'basic_encryption', $typeName - ); - break; - case 4: - // WHMCS_ENCRYPTION_VDMKEY (DUE REMOVAL) - $this->whmcsFieldModeling[$nameSingleCode][] = $name; - // Site settings of each field if needed - $this->buildSiteFieldData( - $nameSingleCode, $name, 'whmcs_encryption', $typeName - ); - break; - case 5: - // MEDIUM_ENCRYPTION_LOCALFILE - $this->mediumFieldModeling[$nameSingleCode][] = $name; - // Site settings of each field if needed - $this->buildSiteFieldData( - $nameSingleCode, $name, 'medium_encryption', $typeName - ); - break; - case 6: - // EXPERT_MODE - if (isset($field['settings']->model_field)) - { - if (isset($field['settings']->initiator_save_key)) - { - $this->expertFieldModelInitiator[$nameSingleCode]['save'][$field['settings']->initiator_save_key] - = $field['settings']->initiator_save; - } - if (isset($field['settings']->initiator_get_key)) - { - $this->expertFieldModelInitiator[$nameSingleCode]['get'][$field['settings']->initiator_get_key] - = $field['settings']->initiator_get; - } - $this->expertFieldModeling[$nameSingleCode][$name] - = $field['settings']->model_field; - // Site settings of each field if needed - $this->buildSiteFieldData( - $nameSingleCode, $name, 'expert_mode', $typeName - ); - } - break; - default: - // JSON_ARRAY_ENCODE - $this->jsonItemBuilder[$nameSingleCode][] = $name; - // Site settings of each field if needed - $this->buildSiteFieldData( - $nameSingleCode, $name, 'json', $typeName - ); - // no londer add the json again (already added) - $subformJsonSwitch = false; - break; - } - // just a heads-up for usergroups set to multiple - if ($typeName === 'usergroup') - { - $this->buildSiteFieldData( - $nameSingleCode, $name, 'json', $typeName - ); - } - - // load the model list display fix - if (($listSwitch || $listJoin) - && (($typeName != 'repeatable' - && $typeName != 'subform') - || $field['settings']->store == 6)) - { - if (ArrayHelper::check($options)) - { - $this->getItemsMethodListStringFixBuilder[$nameSingleCode][] - = array('name' => $name, 'type' => $typeName, - 'translation' => true, 'custom' => $custom, - 'method' => $field['settings']->store); - } - else - { - $this->getItemsMethodListStringFixBuilder[$nameSingleCode][] - = array('name' => $name, 'type' => $typeName, - 'translation' => false, 'custom' => $custom, - 'method' => $field['settings']->store); - } - } - - // subform house keeping (only if not advance modeling) - if ('subform' === $typeName && $field['settings']->store != 6) - { - // the values must revert to array - $this->jsonItemBuilderArray[$nameSingleCode][] = $name; - // should the json builder still be added - if ($subformJsonSwitch) - { - // and insure the if is converted to json - $this->jsonItemBuilder[$nameSingleCode][] = $name; - // Site settings of each field if needed - $this->buildSiteFieldData( - $nameSingleCode, $name, 'json', $typeName - ); - } - } - } - // build the data for the export & import methods $typeName === 'repeatable' || - if ($dbSwitch - && (($typeName === 'checkboxes' || $multiple - || $field['settings']->store != 0) - && !ArrayHelper::check($options))) - { - $this->getItemsMethodEximportStringFixBuilder[$nameSingleCode][] - = array('name' => $name, 'type' => $typeName, - 'translation' => false, 'custom' => $custom, - 'method' => $field['settings']->store); - } - // check if field should be added to uikit - $this->buildSiteFieldData($nameSingleCode, $name, 'uikit', $typeName); - // load the selection translation fix - if (ArrayHelper::check($options) - && ($listSwitch - || $listJoin) - && $typeName != 'repeatable' - && $typeName != 'subform') - { - $this->selectionTranslationFixBuilder[$nameListCode][$name] - = $options; - } - // main lang filter prefix - $lang_filter_ = CFactory::_('Config')->lang_prefix . '_FILTER_'; - // build the sort values - if ($dbSwitch && (isset($field['sort']) && $field['sort'] == 1) - && ($listSwitch || $listJoin) - && (!$multiple && $typeName != 'checkbox' - && $typeName != 'checkboxes' - && $typeName != 'repeatable' - && $typeName != 'subform')) - { - // add the language only for new filter option - $filter_name_asc_lang = ''; - $filter_name_desc_lang = ''; - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2) - { - // set the language strings for ascending - $filter_name_asc = $listFieldName . ' ascending'; - $filter_name_asc_lang = $lang_filter_ - . StringHelper::safe( - $filter_name_asc, 'U' - ); - // and to translation - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $filter_name_asc_lang, $filter_name_asc - ); - // set the language strings for descending - $filter_name_desc = $listFieldName . ' descending'; - $filter_name_desc_lang = $lang_filter_ - . StringHelper::safe( - $filter_name_desc, 'U' - ); - // and to translation - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $filter_name_desc_lang, $filter_name_desc - ); - } - $this->sortBuilder[$nameListCode][] = array('type' => $typeName, - 'code' => $name, - 'lang' => $listLangName, - 'lang_asc' => $filter_name_asc_lang, - 'lang_desc' => $filter_name_desc_lang, - 'custom' => $custom, - 'options' => $options); - } - // build the search values - if ($dbSwitch && isset($field['search']) && $field['search'] == 1) - { - $_list = (isset($field['list'])) - ? $field['list'] : 0; - $this->searchBuilder[$nameListCode][] = array('type' => $typeName, - 'code' => $name, - 'custom' => $custom, - 'list' => $_list); - } - // build the filter values - if ($dbSwitch && (isset($field['filter']) && $field['filter'] >= 1) - && ($listSwitch || $listJoin) - && (!$multiple && $typeName != 'checkbox' - && $typeName != 'checkboxes' - && $typeName != 'repeatable' - && $typeName != 'subform')) - { - // this pains me... but to avoid collusion - $filter_type_code = StringHelper::safe( - $nameListCode . 'filter' . $name - ); - $filter_type_code = preg_replace('/_+/', '', $filter_type_code); - $filter_function_name = StringHelper::safe( - $name, 'F' - ); - // add the language only for new filter option - $filter_name_select_lang = ''; - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2) - { - // set the language strings for selection - $filter_name_select = 'Select ' . $listFieldName; - $filter_name_select_lang = $lang_filter_ - . StringHelper::safe( - $filter_name_select, 'U' - ); - // and to translation - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $filter_name_select_lang, $filter_name_select - ); - } - - // add the filter details - $this->filterBuilder[$nameListCode][] = array( - 'id' => (int) $field['field'], - 'type' => $typeName, - 'multi' => $field['filter'], - 'code' => $name, - 'label' => $langLabel, - 'lang' => $listLangName, - 'lang_select' => $filter_name_select_lang, - 'database' => $nameSingleCode, - 'function' => $filter_function_name, - 'custom' => $custom, - 'options' => $options, - 'filter_type' => $filter_type_code - ); - } - - // build the layout - $tabName = ''; - if (isset($view['settings']->tabs) - && isset($view['settings']->tabs[(int) $field['tab']])) - { - $tabName = $view['settings']->tabs[(int) $field['tab']]; - } - elseif ((int) $field['tab'] == 15) - { - // set to publishing tab - $tabName = 'publishing'; - } - $this->setLayoutBuilder($nameSingleCode, $tabName, $name, $field); - } - - /** - * set Custom Field Type File - * - * @param array $data The field complete data set - * @param string $nameListCode The list view code name - * @param string $nameSingleCode The single view code name - * - * @return void - * - */ - public function setCustomFieldTypeFile($data, $nameListCode, - $nameSingleCode - ) { - // make sure it is not already been build or if it is prime - if (isset($data['custom']) && isset($data['custom']['extends']) - && ((isset($data['custom']['prime_php']) - && $data['custom']['prime_php'] == 1) - || !isset( - $this->fileContentDynamic['customfield_' . $data['type']] - ) - || !ArrayHelper::check( - $this->fileContentDynamic['customfield_' . $data['type']] - ))) - { - // set J prefix - $jprefix = 'J'; - // check if this field has a dot in field type name - if (strpos($data['type'], '.') !== false) - { - // so we have name spacing in custom field type name - $dotTypeArray = explode('.', $data['type']); - // set the J prefix - if (count((array) $dotTypeArray) > 1) - { - $jprefix = strtoupper(array_shift($dotTypeArray)); - } - // update the type name now - $data['type'] = implode('', $dotTypeArray); - $data['custom']['type'] = $data['type']; - } - // set tab and break replacements - $tabBreak = array( - '\t' => Indent::_(1), - '\n' => PHP_EOL - ); - // set the [[[PLACEHOLDER]]] options - $replace = array( - Placefix::_('JPREFIX') => $jprefix, - Placefix::_('TABLE') => (isset($data['custom']['table'])) - ? $data['custom']['table'] : '', - Placefix::_('ID') => (isset($data['custom']['id'])) - ? $data['custom']['id'] : '', - Placefix::_('TEXT') => (isset($data['custom']['text'])) - ? $data['custom']['text'] : '', - Placefix::_('CODE_TEXT') => (isset($data['code'], $data['custom']['text'])) - ? $data['code'] . '_' . $data['custom']['text'] : '', - Placefix::_('CODE') => (isset($data['code'])) - ? $data['code'] : '', - Placefix::_('view_type') => $nameSingleCode - . '_' . $data['type'], - Placefix::_('type') => (isset($data['type'])) - ? $data['type'] : '', - Placefix::_('com_component') => (isset($data['custom']['component']) - && StringHelper::check( - $data['custom']['component'] - )) ? StringHelper::safe( - $data['custom']['component'] - ) : 'com_' . CFactory::_('Config')->component_code_name, - // set the generic values - Placefix::_('component') => CFactory::_('Config')->component_code_name, - Placefix::_('Component') => $this->fileContentStatic[Placefix::_h('Component')], - Placefix::_('view') => (isset($data['custom']['view']) - && StringHelper::check( - $data['custom']['view'] - )) ? StringHelper::safe( - $data['custom']['view'] - ) : $nameSingleCode, - Placefix::_('views') => (isset($data['custom']['views']) - && StringHelper::check( - $data['custom']['views'] - )) ? StringHelper::safe( - $data['custom']['views'] - ) : $nameListCode - ); - // now set the ###PLACEHOLDER### options - foreach ($replace as $replacekey => $replacevalue) - { - // update the key value - $replacekey = str_replace( - array(Placefix::b(), Placefix::d()), - array(Placefix::h(), Placefix::h()), $replacekey - ); - // now set the value - $replace[$replacekey] = $replacevalue; - } - // load the global placeholders - if (ArrayHelper::check($this->globalPlaceholders)) - { - foreach ( - $this->globalPlaceholders as $globalPlaceholder => - $gloabalValue - ) - { - $replace[$globalPlaceholder] = $gloabalValue; - } - } - // start loading the field type - $this->fileContentDynamic['customfield_' . $data['type']] = array(); - // JPREFIX <<>> - $this->fileContentDynamic['customfield_' . $data['type']][Placefix::_h('JPREFIX')] - = $jprefix; - // Type <<>> - $this->fileContentDynamic['customfield_' . $data['type']][Placefix::_h('Type')] - = StringHelper::safe( - $data['custom']['type'], 'F' - ); - // type <<>> - $this->fileContentDynamic['customfield_' . $data['type']][Placefix::_h('type')] - = StringHelper::safe($data['custom']['type']); - // is this a own custom field - if (isset($data['custom']['own_custom'])) - { - // make sure the button option notice is set to notify the developer that the button option is not available in own custom field types - if (isset($data['custom']['add_button']) - && ($data['custom']['add_button'] === 'true' - || 1 == $data['custom']['add_button'])) - { - // set error - $this->app->enqueueMessage( - JText::_('

Dynamic Button Error

'), 'Error' - ); - $this->app->enqueueMessage( - JText::_( - 'The option to add a dynamic button is not available in own custom field types, you will have to custom code it.' - ), 'Error' - ); - } - // load another file - $target = array('admin' => 'customfield'); - $this->buildDynamique( - $target, 'fieldcustom', $data['custom']['type'] - ); - // get the extends name - $JFORM_extends = StringHelper::safe( - $data['custom']['extends'] - ); - // JFORM_TYPE_HEADER <<>> - $add_default_header = true; - $this->fileContentDynamic['customfield_' - . $data['type']][Placefix::_h('JFORM_TYPE_HEADER')] - = "//" . Line::_( - __LINE__,__CLASS__ - ) . " Import the " . $JFORM_extends - . " field type classes needed"; - // JFORM_extens <<>> - $this->fileContentDynamic['customfield_' - . $data['type']][Placefix::_h('JFORM_extends')] - = $JFORM_extends; - // JFORM_EXTENDS <<>> - $this->fileContentDynamic['customfield_' - . $data['type']][Placefix::_h('JFORM_EXTENDS')] - = StringHelper::safe( - $data['custom']['extends'], 'F' - ); - // JFORM_TYPE_PHP <<>> - $this->fileContentDynamic['customfield_' - . $data['type']][Placefix::_h('JFORM_TYPE_PHP')] - = PHP_EOL . PHP_EOL . Indent::_(1) . "//" . Line::_( - __LINE__,__CLASS__ - ) . " A " . $data['custom']['own_custom'] . " Field"; - // load the other PHP options - foreach (ComponentbuilderHelper::$phpFieldArray as $x) - { - // reset the php bucket - $phpBucket = ''; - // only set if available - if (isset($data['custom']['php' . $x]) - && ArrayHelper::check( - $data['custom']['php' . $x] - )) - { - foreach ($data['custom']['php' . $x] as $line => $code) - { - if (StringHelper::check($code)) - { - $phpBucket .= PHP_EOL . CFactory::_('Placeholder')->update( - $code, $tabBreak - ); - } - } - // check if this is header text - if ('HEADER' === $x) - { - $this->fileContentDynamic['customfield_' - . $data['type']][Placefix::_h('JFORM_TYPE_HEADER')] - .= PHP_EOL . CFactory::_('Placeholder')->update( - $phpBucket, $replace - ); - // stop default headers from loading - $add_default_header = false; - } - else - { - // JFORM_TYPE_PHP <<>> - $this->fileContentDynamic['customfield_' - . $data['type']][Placefix::_h('JFORM_TYPE_PHP')] - .= PHP_EOL . CFactory::_('Placeholder')->update( - $phpBucket, $replace - ); - } - } - } - // check if we should add default header - if ($add_default_header) - { - $this->fileContentDynamic['customfield_' - . $data['type']][Placefix::_h('JFORM_TYPE_HEADER')] - .= PHP_EOL . "jimport('joomla.form.helper');"; - $this->fileContentDynamic['customfield_' - . $data['type']][Placefix::_h('JFORM_TYPE_HEADER')] - .= PHP_EOL . "JFormHelper::loadFieldClass('" - . $JFORM_extends . "');"; - } - // check the the JFormHelper::loadFieldClass(..) was set - elseif (strpos( - $this->fileContentDynamic['customfield_' - . $data['type']][Placefix::_h('JFORM_TYPE_HEADER')], 'JFormHelper::loadFieldClass(' - ) === false) - { - $this->fileContentDynamic['customfield_' - . $data['type']][Placefix::_h('JFORM_TYPE_HEADER')] - .= PHP_EOL . "JFormHelper::loadFieldClass('" - . $JFORM_extends . "');"; - } - } - else - { - // first build the custom field type file - $target = array('admin' => 'customfield'); - $this->buildDynamique( - $target, 'field' . $data['custom']['extends'], - $data['custom']['type'] - ); - // make sure the value is reset - $phpCode = ''; - // now load the php script - if (isset($data['custom']['php']) - && ArrayHelper::check( - $data['custom']['php'] - )) - { - foreach ($data['custom']['php'] as $line => $code) - { - if (StringHelper::check($code)) - { - if ($line == 1) - { - $phpCode .= CFactory::_('Placeholder')->update( - $code, $tabBreak - ); - } - else - { - $phpCode .= PHP_EOL . Indent::_(2) - . CFactory::_('Placeholder')->update($code, $tabBreak); - } - } - } - // replace the placholders - $phpCode = CFactory::_('Placeholder')->update($phpCode, $replace); - } - // catch empty stuff - if (!StringHelper::check($phpCode)) - { - $phpCode = 'return null;'; - } - // some house cleaning for users - if ($data['custom']['extends'] === 'user') - { - // make sure the value is reset - $phpxCode = ''; - // now load the php xclude script - if (ArrayHelper::check( - $data['custom']['phpx'] - )) - { - foreach ($data['custom']['phpx'] as $line => $code) - { - if (StringHelper::check($code)) - { - if ($line == 1) - { - $phpxCode .= CFactory::_('Placeholder')->update( - $code, $tabBreak - ); - } - else - { - $phpxCode .= PHP_EOL . Indent::_(2) - . CFactory::_('Placeholder')->update( - $code, $tabBreak - ); - } - } - } - // replace the placholders - $phpxCode = CFactory::_('Placeholder')->update($phpxCode, $replace); - } - // catch empty stuff - if (!StringHelper::check($phpxCode)) - { - $phpxCode = 'return null;'; - } - // temp holder for name - $tempName = $data['custom']['label'] . ' Group'; - // set lang - $groupLangName = CFactory::_('Config')->lang_prefix . '_' - . FieldHelper::safe( - $tempName, true - ); - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $groupLangName, - StringHelper::safe($tempName, 'W') - ); - // build the Group Control - $this->setGroupControl[$data['type']] = $groupLangName; - // JFORM_GETGROUPS_PHP <<>> - $this->fileContentDynamic['customfield_' - . $data['type']][Placefix::_h('JFORM_GETGROUPS_PHP')] - = $phpCode; - // JFORM_GETEXCLUDED_PHP <<>> - $this->fileContentDynamic['customfield_' - . $data['type']][Placefix::_h('JFORM_GETEXCLUDED_PHP')] - = $phpxCode; - } - else - { - // JFORM_GETOPTIONS_PHP <<>> - $this->fileContentDynamic['customfield_' - . $data['type']][Placefix::_h('JFORM_GETOPTIONS_PHP')] - = $phpCode; - } - // type <<>> - $this->fileContentDynamic['customfield_' - . $data['type']][Placefix::_h('ADD_BUTTON')] - = $this->setAddButtonToListField($data['custom']); - } - } - // if this field gets used in plugin or module we should track it so if needed we can copy it over - if ((strpos($nameSingleCode, 'P|uG!n') !== false - || strpos( - $nameSingleCode, 'M0dU|3' - ) !== false) - && isset($data['custom']) - && isset($data['custom']['type'])) - { - $this->extentionCustomfields[$data['type']] - = $data['custom']['type']; - } - } - - /** - * This is just to get the code. - * Don't use this to build the field - * - * @param array $custom The field complete data set - * - * @return array with the code - * - */ - public function getCustomFieldCode($custom) - { - // the code bucket - $code_bucket = array( - 'JFORM_TYPE_HEADER' => '', - 'JFORM_TYPE_PHP' => '' - ); - // set tab and break replacements - $tabBreak = array( - '\t' => Indent::_(1), - '\n' => PHP_EOL - ); - // load the other PHP options - foreach (ComponentbuilderHelper::$phpFieldArray as $x) - { - // reset the php bucket - $phpBucket = ''; - // only set if available - if (isset($custom['php' . $x]) - && ArrayHelper::check( - $custom['php' . $x] - )) - { - foreach ($custom['php' . $x] as $line => $code) - { - if (StringHelper::check($code)) - { - $phpBucket .= PHP_EOL . CFactory::_('Placeholder')->update( - $code, $tabBreak - ); - } - } - // check if this is header text - if ('HEADER' === $x) - { - $code_bucket['JFORM_TYPE_HEADER'] - .= PHP_EOL . $phpBucket; - } - else - { - // JFORM_TYPE_PHP <<>> - $code_bucket['JFORM_TYPE_PHP'] - .= PHP_EOL . $phpBucket; - } - } - } - - return $code_bucket; - } - - /** - * set the Filter Field set of a view - * - * @param string $nameSingleCode The single view name - * @param string $nameListCode The list view name - * - * @return string The fields set in xml - * - */ - public function setFieldFilterSet(&$nameSingleCode, &$nameListCode) - { - // check if this is the above/new filter option - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2) - { - // we first create the file - $target = array('admin' => 'filter_' . $nameListCode); - $this->buildDynamique( - $target, 'filter' - ); - // the search language string - $lang_search = CFactory::_('Config')->lang_prefix . '_FILTER_SEARCH'; - // and to translation - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $lang_search, 'Search' - . StringHelper::safe($nameListCode, 'w') - ); - // the search description language string - $lang_search_desc = CFactory::_('Config')->lang_prefix . '_FILTER_SEARCH_' - . strtoupper($nameListCode); - // and to translation - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $lang_search_desc, 'Search the ' - . StringHelper::safe($nameSingleCode, 'w') - . ' items. Prefix with ID: to search for an item by ID.' - ); - // now build the XML - $field_filter_sets = array(); - $field_filter_sets[] = Indent::_(1) . ''; - // we first add the search - $field_filter_sets[] = Indent::_(2) . ''; - // add the published filter if published is not set - if (!isset($this->fieldsNames[$nameSingleCode]['published'])) - { - // the published language string - $lang_published = CFactory::_('Config')->lang_prefix . '_FILTER_PUBLISHED'; - // and to translation - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $lang_published, 'Status' - ); - // the published description language string - $lang_published_desc = CFactory::_('Config')->lang_prefix . '_FILTER_PUBLISHED_' - . strtoupper($nameListCode); - // and to translation - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, $lang_published_desc, 'Status options for ' - . StringHelper::safe($nameListCode, 'w') - ); - $field_filter_sets[] = Indent::_(2) . ''; - $field_filter_sets[] = Indent::_(3) - . ''; - $field_filter_sets[] = Indent::_(2) . ''; - } - // add the category if found - if (isset($this->categoryBuilder[$nameListCode]) - && ArrayHelper::check( - $this->categoryBuilder[$nameListCode] - ) - && isset($this->categoryBuilder[$nameListCode]['extension']) - && isset($this->categoryBuilder[$nameListCode]['filter']) - && $this->categoryBuilder[$nameListCode]['filter'] >= 1) - { - $field_filter_sets[] = Indent::_(2) . ''; - } - // add the access filter if this view has access - // and if access manually is not set - if (isset($this->accessBuilder[$nameSingleCode]) - && StringHelper::check( - $this->accessBuilder[$nameSingleCode] - ) - && !isset($this->fieldsNames[$nameSingleCode]['access'])) - { - $field_filter_sets[] = Indent::_(2) . ''; - } - // now add the dynamic fields - if (isset($this->filterBuilder[$nameListCode]) - && ArrayHelper::check( - $this->filterBuilder[$nameListCode] - )) - { - foreach ($this->filterBuilder[$nameListCode] as $r => &$filter) - { - if ($filter['type'] != 'category') - { - $field_filter_sets[] = Indent::_(2) . ''; - } - } - } - $field_filter_sets[] = Indent::_(2) - . ''; - $field_filter_sets[] = Indent::_(1) . ''; - - // now update the file - return implode(PHP_EOL, $field_filter_sets); - } - - return ''; - } - - /** - * set the Filter List set of a view - * - * @param string $nameSingleCode The single view name - * @param string $nameListCode The list view name - * - * @return string The fields set in xml - * - */ - public function setFieldFilterListSet(&$nameSingleCode, &$nameListCode) - { - // check if this is the above/new filter option - if (isset($this->adminFilterType[$nameListCode]) - && $this->adminFilterType[$nameListCode] == 2) - { - // keep track of all fields already added - $donelist = array('ordering' => true, 'id' => true); - // now build the XML - $list_sets = array(); - $list_sets[] = Indent::_(1) . ''; - $list_sets[] = Indent::_(2) . 'getListViewDefaultOrdering( - $nameListCode - ); - // set the default ordering - $list_sets[] = Indent::_(3) . 'default="' - . $default_ordering['name'] . ' ' - . $default_ordering['direction'] . '"'; - $list_sets[] = Indent::_(3) . 'validate="options"'; - $list_sets[] = Indent::_(2) . '>'; - $list_sets[] = Indent::_(3) - . ''; - $list_sets[] = Indent::_(3) - . ''; - $list_sets[] = Indent::_(3) - . ''; - // add the published filter if published is not set - if (!isset($this->fieldsNames[$nameSingleCode]['published'])) - { - // add to done list - $donelist['published'] = true; - // add to xml :) - $list_sets[] = Indent::_(3) - . ''; - $list_sets[] = Indent::_(3) - . ''; - } - - // add the rest of the set filters - if (isset($this->sortBuilder[$nameListCode]) - && ArrayHelper::check( - $this->sortBuilder[$nameListCode] - )) - { - foreach ($this->sortBuilder[$nameListCode] as $filter) - { - if (!isset($donelist[$filter['code']])) - { - if ($filter['type'] === 'category') - { - $list_sets[] = Indent::_(3) - . ''; - $list_sets[] = Indent::_(3) - . ''; - } - elseif (ArrayHelper::check( - $filter['custom'] - )) - { - $list_sets[] = Indent::_(3) . ''; - $list_sets[] = Indent::_(3) . ''; - } - else - { - $list_sets[] = Indent::_(3) . ''; - $list_sets[] = Indent::_(3) . ''; - } - // do not add again - $donelist[$filter['code']] = true; - } - } - } - - $list_sets[] = Indent::_(3) - . ''; - $list_sets[] = Indent::_(3) - . ''; - $list_sets[] = Indent::_(2) . '' . PHP_EOL; - - $list_sets[] = Indent::_(2) . ''; - $list_sets[] = Indent::_(1) . ''; - - return implode(PHP_EOL, $list_sets); - } - - return ''; - } - - /** - * set Custom Field for Filter - * - * @param string $getOptions The get options php string/code - * @param array $filter The filter details - * - * @return void - * - */ - public function setFilterFieldFile($getOptions, $filter) - { - // make sure it is not already been build - if (!isset( - $this->fileContentDynamic['customfilterfield_' - . $filter['filter_type']] - ) - || !ArrayHelper::check( - $this->fileContentDynamic['customfilterfield_' - . $filter['filter_type']] - ) - ) - { - // start loading the field type - $this->fileContentDynamic['customfilterfield_' - . $filter['filter_type']] - = array(); - // JPREFIX <>> - $this->fileContentDynamic['customfilterfield_' - . $filter['filter_type']][Placefix::_h('JPREFIX')] - = 'J'; - // Type <<>> - $this->fileContentDynamic['customfilterfield_' - . $filter['filter_type']][Placefix::_h('Type')] - = StringHelper::safe( - $filter['filter_type'], 'F' - ); - // type <<>> - $this->fileContentDynamic['customfilterfield_' - . $filter['filter_type']][Placefix::_h('type')] - = StringHelper::safe($filter['filter_type']); - // JFORM_GETOPTIONS_PHP <<>> - $this->fileContentDynamic['customfilterfield_' - . $filter['filter_type']][Placefix::_h('JFORM_GETOPTIONS_PHP')] - = $getOptions; - // ADD_BUTTON <<>> - $this->fileContentDynamic['customfilterfield_' - . $filter['filter_type']][Placefix::_h('ADD_BUTTON')] - = ''; - // now build the custom filter field type file - $target = array('admin' => 'customfilterfield'); - $this->buildDynamique( - $target, 'fieldlist', - $filter['filter_type'] - ); - } - } - - /** - * set Add Button To List Field (getInput tweak) - * - * @param array $fieldData The field custom data - * - * @return string of getInput class on success empty string otherwise - * - */ - protected function setAddButtonToListField($fieldData) - { - // make sure hte view values are set - if (isset($fieldData['add_button']) - && ($fieldData['add_button'] === 'true' - || 1 == $fieldData['add_button']) - && isset($fieldData['view']) - && isset($fieldData['views']) - && StringHelper::check($fieldData['view']) - && StringHelper::check($fieldData['views'])) - { - // set local component - $local_component = "com_" . CFactory::_('Config')->component_code_name; - // check that the component value is set - if (!isset($fieldData['component']) - || !StringHelper::check( - $fieldData['component'] - )) - { - $fieldData['component'] = $local_component; - } - // check that the component has the com_ value in it - if (strpos($fieldData['component'], 'com_') === false - || strpos( - $fieldData['component'], '=' - ) !== false) - { - $fieldData['component'] = "com_" . $fieldData['component']; - } - // make sure the component is update if # # # or [ [ [ component placeholder is used - if (strpos($fieldData['component'], Placefix::h()) !== false - || strpos( - $fieldData['component'], Placefix::b() - ) !== false) // should not be needed... but - { - $fieldData['component'] = CFactory::_('Placeholder')->update( - $fieldData['component'], CFactory::_('Placeholder')->active - ); - } - // get core permissions - $coreLoad = false; - // add ref tags - $refLoad = true; - // fall back on the field component - $component = $fieldData['component']; - // check if we should add ref tags (since it only works well on local views) - if ($local_component !== $component) - { - // do not add ref tags - $refLoad = false; - } - // get core permisssions - if (isset($this->permissionCore[$fieldData['view']])) - { - // get the core permission naming array - $core = $this->permissionCore[$fieldData['view']]; - // set switch to activate easy update - $coreLoad = true; - } - // start building the add buttons/s - $addButton = array(); - $addButton[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**"; - $addButton[] = Indent::_(1) . " * Override to add new button"; - $addButton[] = Indent::_(1) . " *"; - $addButton[] = Indent::_(1) - . " * @return string The field input markup."; - $addButton[] = Indent::_(1) . " *"; - $addButton[] = Indent::_(1) . " * @since 3.2"; - $addButton[] = Indent::_(1) . " */"; - $addButton[] = Indent::_(1) . "protected function getInput()"; - $addButton[] = Indent::_(1) . "{"; - $addButton[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) - . " see if we should add buttons"; - $addButton[] = Indent::_(2) - . "\$set_button = \$this->getAttribute('button');"; - $addButton[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) - . " get html"; - $addButton[] = Indent::_(2) . "\$html = parent::getInput();"; - $addButton[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) - . " if true set button"; - $addButton[] = Indent::_(2) . "if (\$set_button === 'true')"; - $addButton[] = Indent::_(2) . "{"; - $addButton[] = Indent::_(3) . "\$button = array();"; - $addButton[] = Indent::_(3) . "\$script = array();"; - $addButton[] = Indent::_(3) - . "\$button_code_name = \$this->getAttribute('name');"; - $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) - . " get the input from url"; - $addButton[] = Indent::_(3) . "\$app = JFactory::getApplication();"; - $addButton[] = Indent::_(3) . "\$jinput = \$app->input;"; - $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) - . " get the view name & id"; - $addButton[] = Indent::_(3) - . "\$values = \$jinput->getArray(array("; - $addButton[] = Indent::_(4) . "'id' => 'int',"; - $addButton[] = Indent::_(4) . "'view' => 'word'"; - $addButton[] = Indent::_(3) . "));"; - $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) - . " check if new item"; - $addButton[] = Indent::_(3) . "\$ref = '';"; - $addButton[] = Indent::_(3) . "\$refJ = '';"; - if ($refLoad) - { - $addButton[] = Indent::_(3) - . "if (!is_null(\$values['id']) && strlen(\$values['view']))"; - $addButton[] = Indent::_(3) . "{"; - $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) - . " only load referral if not new item."; - $addButton[] = Indent::_(4) - . "\$ref = '&ref=' . \$values['view'] . '&refid=' . \$values['id'];"; - $addButton[] = Indent::_(4) - . "\$refJ = '&ref=' . \$values['view'] . '&refid=' . \$values['id'];"; - $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) - . " get the return value."; - $addButton[] = Indent::_(4) - . "\$_uri = (string) JUri::getInstance();"; - $addButton[] = Indent::_(4) - . "\$_return = urlencode(base64_encode(\$_uri));"; - $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) - . " load return value."; - $addButton[] = Indent::_(4) - . "\$ref .= '&return=' . \$_return;"; - $addButton[] = Indent::_(4) - . "\$refJ .= '&return=' . \$_return;"; - $addButton[] = Indent::_(3) . "}"; - } - else - { - $addButton[] = Indent::_(3) - . "if (!is_null(\$values['id']) && strlen(\$values['view']))"; - $addButton[] = Indent::_(3) . "{"; - $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) - . " only load field details if not new item."; - $addButton[] = Indent::_(4) - . "\$ref = '&field=' . \$values['view'] . '&field_id=' . \$values['id'];"; - $addButton[] = Indent::_(4) - . "\$refJ = '&field=' . \$values['view'] . '&field_id=' . \$values['id'];"; - $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) - . " get the return value."; - $addButton[] = Indent::_(4) - . "\$_uri = (string) JUri::getInstance();"; - $addButton[] = Indent::_(4) - . "\$_return = urlencode(base64_encode(\$_uri));"; - $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) - . " load return value."; - $addButton[] = Indent::_(4) - . "\$ref = '&return=' . \$_return;"; - $addButton[] = Indent::_(4) - . "\$refJ = '&return=' . \$_return;"; - $addButton[] = Indent::_(3) . "}"; - } - $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) - . " get button label"; - $addButton[] = Indent::_(3) - . "\$button_label = trim(\$button_code_name);"; - $addButton[] = Indent::_(3) - . "\$button_label = preg_replace('/_+/', ' ', \$button_label);"; - $addButton[] = Indent::_(3) - . "\$button_label = preg_replace('/\s+/', ' ', \$button_label);"; - $addButton[] = Indent::_(3) - . "\$button_label = preg_replace(\"/[^A-Za-z ]/\", '', \$button_label);"; - $addButton[] = Indent::_(3) - . "\$button_label = ucfirst(strtolower(\$button_label));"; - $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) - . " get user object"; - $addButton[] = Indent::_(3) . "\$user = JFactory::getUser();"; - $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) - . " only add if user allowed to create " . $fieldData['view']; - // check if the item has permissions. - if ($coreLoad && isset($core['core.create']) - && isset($this->permissionBuilder['global'][$core['core.create']]) - && ArrayHelper::check( - $this->permissionBuilder['global'][$core['core.create']] - ) - && in_array( - $fieldData['view'], - $this->permissionBuilder['global'][$core['core.create']] - )) - { - $addButton[] = Indent::_(3) . "if (\$user->authorise('" - . $core['core.create'] . "', '" . $component - . "') && \$app->isAdmin()) // TODO for now only in admin area."; - } - else - { - $addButton[] = Indent::_(3) - . "if (\$user->authorise('core.create', '" . $component - . "') && \$app->isAdmin()) // TODO for now only in admin area."; - } - $addButton[] = Indent::_(3) . "{"; - $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) - . " build Create button"; - $addButton[] = Indent::_(4) - . "\$button[] = 'lang_prefix - . "_CREATE_NEW_S', \$button_label).'\" style=\"border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;\""; - $addButton[] = Indent::_(5) . "href=\"index.php?option=" - . $fieldData['component'] . "&view=" . $fieldData['view'] - . "&layout=edit'.\$ref.'\" >"; - $addButton[] = Indent::_(5) - . "';"; - $addButton[] = Indent::_(3) . "}"; - $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) - . " only add if user allowed to edit " . $fieldData['view']; - // check if the item has permissions. - if ($coreLoad && isset($core['core.edit']) - && isset($this->permissionBuilder['global'][$core['core.edit']]) - && ArrayHelper::check( - $this->permissionBuilder['global'][$core['core.edit']] - ) - && in_array( - $fieldData['view'], - $this->permissionBuilder['global'][$core['core.edit']] - )) - { - $addButton[] = Indent::_(3) . "if (\$user->authorise('" - . $core['core.edit'] . "', '" . $component - . "') && \$app->isAdmin()) // TODO for now only in admin area."; - } - else - { - $addButton[] = Indent::_(3) - . "if (\$user->authorise('core.edit', '" . $component - . "') && \$app->isAdmin()) // TODO for now only in admin area."; - } - $addButton[] = Indent::_(3) . "{"; - $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) - . " build edit button"; - $addButton[] = Indent::_(4) - . "\$button[] = 'lang_prefix - . "_EDIT_S', \$button_label).'\" style=\"display: none; padding: 4px 4px 4px 7px;\" href=\"#\" >"; - $addButton[] = Indent::_(5) - . "';"; - $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) - . " build script"; - $addButton[] = Indent::_(4) . "\$script[] = \""; - $addButton[] = Indent::_(5) . "jQuery(document).ready(function() {"; - $addButton[] = Indent::_(6) - . "jQuery('#adminForm').on('change', '#jform_\".\$button_code_name.\"',function (e) {"; - $addButton[] = Indent::_(7) . "e.preventDefault();"; - $addButton[] = Indent::_(7) - . "var \".\$button_code_name.\"Value = jQuery('#jform_\".\$button_code_name.\"').val();"; - $addButton[] = Indent::_(7) - . "\".\$button_code_name.\"Button(\".\$button_code_name.\"Value);"; - $addButton[] = Indent::_(6) . "});"; - $addButton[] = Indent::_(6) - . "var \".\$button_code_name.\"Value = jQuery('#jform_\".\$button_code_name.\"').val();"; - $addButton[] = Indent::_(6) - . "\".\$button_code_name.\"Button(\".\$button_code_name.\"Value);"; - $addButton[] = Indent::_(5) . "});"; - $addButton[] = Indent::_(5) - . "function \".\$button_code_name.\"Button(value) {"; - $addButton[] = Indent::_(6) - . "if (value > 0) {"; // TODO not ideal since value may not be an (int) - $addButton[] = Indent::_(7) . "// hide the create button"; - $addButton[] = Indent::_(7) - . "jQuery('#\".\$button_code_name.\"Create').hide();"; - $addButton[] = Indent::_(7) . "// show edit button"; - $addButton[] = Indent::_(7) - . "jQuery('#\".\$button_code_name.\"Edit').show();"; - $addButton[] = Indent::_(7) . "var url = 'index.php?option=" - . $fieldData['component'] . "&view=" . $fieldData['views'] - . "&task=" . $fieldData['view'] - . ".edit&id='+value+'\".\$refJ.\"';"; // TODO this value may not be the ID - $addButton[] = Indent::_(7) - . "jQuery('#\".\$button_code_name.\"Edit').attr('href', url);"; - $addButton[] = Indent::_(6) . "} else {"; - $addButton[] = Indent::_(7) . "// show the create button"; - $addButton[] = Indent::_(7) - . "jQuery('#\".\$button_code_name.\"Create').show();"; - $addButton[] = Indent::_(7) . "// hide edit button"; - $addButton[] = Indent::_(7) - . "jQuery('#\".\$button_code_name.\"Edit').hide();"; - $addButton[] = Indent::_(6) . "}"; - $addButton[] = Indent::_(5) . "}\";"; - $addButton[] = Indent::_(3) . "}"; - $addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) - . " check if button was created for " . $fieldData['view'] - . " field."; - $addButton[] = Indent::_(3) - . "if (is_array(\$button) && count(\$button) > 0)"; - $addButton[] = Indent::_(3) . "{"; - $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) - . " Load the needed script."; - $addButton[] = Indent::_(4) - . "\$document = JFactory::getDocument();"; - $addButton[] = Indent::_(4) - . "\$document->addScriptDeclaration(implode(' ',\$script));"; - $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) - . " return the button attached to input field."; - $addButton[] = Indent::_(4) - . "return '
' .\$html . implode('',\$button).'
';"; - $addButton[] = Indent::_(3) . "}"; - $addButton[] = Indent::_(2) . "}"; - $addButton[] = Indent::_(2) . "return \$html;"; - $addButton[] = Indent::_(1) . "}"; - - return implode(PHP_EOL, $addButton); - } - - return ''; - } - - /** - * xmlPrettyPrint - * - * @param SimpleXMLElement $xml The XML element containing a node to be output - * @param string $nodename node name of the input xml element to print out. this is done to omit the ownerDocument; - $dom->formatOutput = true; - $xmlString = $dom->saveXML( - $dom->getElementsByTagName($nodename)->item(0) - ); - // make sure Tidy is enabled - if (CFactory::_('Config')->get('tidy', false)) - { - $tidy = new Tidy(); - $tidy->parseString( - $xmlString, array('indent' => true, - 'indent-spaces' => 8, 'input-xml' => true, - 'output-xml' => true, - 'indent-attributes' => true, - 'wrap-attributes' => true, 'wrap' => false) - ); - $tidy->cleanRepair(); - - return $this->xmlIndent((string) $tidy, ' ', 8, true, false); - } - // set tidy waring atleast once - elseif (!$this->setTidyWarning) - { - // set the warning only once - $this->setTidyWarning = true; - // now set the warning - $this->app->enqueueMessage( - JText::_('

Tidy Error

'), 'Error' - ); - $this->app->enqueueMessage( - JText::_( - 'You must enable the Tidy extension in your php.ini file so we can tidy up your xml! If you need help please start here!' - ), 'Error' - ); - } - - return $xmlString; - } - - /** - * xmlIndent - * - * @param string $string The XML input - * @param string $char Character or characters to use as the repeated indent - * @param integer $depth number of times to repeat the indent character - * @param boolean $skipfirst Skip the first line of the input. - * @param boolean $skiplast Skip the last line of the input; - * - * @return string XML output - * - */ - public function xmlIndent($string, $char = ' ', $depth = 0, - $skipfirst = false, $skiplast = false - ) { - $output = array(); - $lines = explode("\n", $string); - $first = true; - $last = count($lines) - 1; - foreach ($lines as $i => $line) - { - $output[] = (($first && $skipfirst) || $i === $last && $skiplast) - ? $line : str_repeat($char, $depth) . $line; - $first = false; - } - - return implode("\n", $output); - } - -} diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php deleted file mode 100644 index 65dc4de66..000000000 --- a/admin/helpers/compiler/f_Infusion.php +++ /dev/null @@ -1,2556 +0,0 @@ - - * @gitea Joomla Component Builder - * @github 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'); - -use Joomla\CMS\Filesystem\File; -use Joomla\CMS\Filesystem\Folder; -use VDM\Joomla\Utilities\StringHelper; -use VDM\Joomla\Utilities\ArrayHelper; -use VDM\Joomla\Utilities\ObjectHelper; -use VDM\Joomla\Utilities\FileHelper; -use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory; -use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix; -use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; -use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; - -/** - * Infusion class - */ -class Infusion extends Interpretation -{ - - - public $langFiles = array(); - public $removeSiteFolder = false; - public $removeSiteEditFolder = true; - - /** - * Constructor - */ - public function __construct() - { - // first we run the perent constructor - if (parent::__construct()) - { - // infuse the data into the structure - return $this->buildFileContent(); - } - - return false; - } - - /** - * Build the content for the structure - * - * - * @return boolean on success - * - */ - protected function buildFileContent() - { - if (isset($this->componentData->admin_views) - && ArrayHelper::check( - $this->componentData->admin_views - )) - { - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onBeforeBuildFilesContent - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeBuildFilesContent', - array(&$this->componentContext, &$this->componentData, - &$this->fileContentStatic, &$this->fileContentDynamic, - &$this->placeholders, &$this->hhh) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - - // COMPONENT - $this->fileContentStatic[Placefix::_h('COMPONENT')] - = CFactory::_('Placeholder')->active[Placefix::_h('COMPONENT')]; - - // Component - $this->fileContentStatic[Placefix::_h('Component')] - = CFactory::_('Placeholder')->active[Placefix::_h('Component')]; - - // component - $this->fileContentStatic[Placefix::_h('component')] - = CFactory::_('Placeholder')->active[Placefix::_h('component')]; - - // COMPANYNAME - $this->fileContentStatic[Placefix::_h('COMPANYNAME')] - = trim( - JFilterOutput::cleanText($this->componentData->companyname) - ); - - // CREATIONDATE - $this->fileContentStatic[Placefix::_h('CREATIONDATE')] - = JFactory::getDate($this->componentData->created)->format( - 'jS F, Y' - ); - $this->fileContentStatic[Placefix::_h('CREATIONDATE') - . 'GLOBAL'] - = $this->fileContentStatic[Placefix::_h('CREATIONDATE')]; - - // BUILDDATE - $this->fileContentStatic[Placefix::_h('BUILDDATE')] - = JFactory::getDate()->format('jS F, Y'); - $this->fileContentStatic[Placefix::_h('BUILDDATE') - . 'GLOBAL'] - = $this->fileContentStatic[Placefix::_h('BUILDDATE')]; - - // AUTHOR - $this->fileContentStatic[Placefix::_h('AUTHOR')] = trim( - JFilterOutput::cleanText($this->componentData->author) - ); - - // AUTHOREMAIL - $this->fileContentStatic[Placefix::_h('AUTHOREMAIL')] - = trim($this->componentData->email); - - // AUTHORWEBSITE - $this->fileContentStatic[Placefix::_h('AUTHORWEBSITE')] - = trim($this->componentData->website); - - // COPYRIGHT - $this->fileContentStatic[Placefix::_h('COPYRIGHT')] - = trim($this->componentData->copyright); - - // LICENSE - $this->fileContentStatic[Placefix::_h('LICENSE')] - = trim($this->componentData->license); - - // VERSION - $this->fileContentStatic[Placefix::_h('VERSION')] - = trim($this->componentData->component_version); - // set the actual global version - $this->fileContentStatic[Placefix::_h('ACTUALVERSION')] - = $this->fileContentStatic[Placefix::_h('VERSION')]; - - // do some Tweaks to the version based on selected options - if (strpos( - $this->fileContentStatic[Placefix::_h('VERSION')], '.' - ) !== false) - { - $versionArray = explode( - '.', $this->fileContentStatic[Placefix::_h('VERSION')] - ); - } - // load only first two values - if (isset($versionArray) - && ArrayHelper::check( - $versionArray - ) - && $this->componentData->mvc_versiondate == 2) - { - $this->fileContentStatic[Placefix::_h('VERSION')] - = $versionArray[0] . '.' . $versionArray[1] . '.x'; - } - // load only the first value - elseif (isset($versionArray) - && ArrayHelper::check( - $versionArray - ) - && $this->componentData->mvc_versiondate == 3) - { - $this->fileContentStatic[Placefix::_h('VERSION')] - = $versionArray[0] . '.x.x'; - } - unset($versionArray); - - // set the global version in case - $this->fileContentStatic[Placefix::_h('VERSION') - . 'GLOBAL'] - = $this->fileContentStatic[Placefix::_h('VERSION')]; - - // set the joomla target xml version - $this->fileContentStatic[Placefix::_h('XMLVERSION')] - = $this->joomlaVersions[CFactory::_('Config')->joomla_version]['xml_version']; - - // Component_name - $this->fileContentStatic[Placefix::_h('Component_name')] - = JFilterOutput::cleanText($this->componentData->name); - - // SHORT_DISCRIPTION - $this->fileContentStatic[Placefix::_h('SHORT_DESCRIPTION')] - = trim( - JFilterOutput::cleanText( - $this->componentData->short_description - ) - ); - - // DESCRIPTION - $this->fileContentStatic[Placefix::_h('DESCRIPTION')] - = trim($this->componentData->description); - - // COMP_IMAGE_TYPE - $this->fileContentStatic[Placefix::_h('COMP_IMAGE_TYPE')] - = $this->setComponentImageType($this->componentData->image); - - // ACCESS_SECTIONS - $this->fileContentStatic[Placefix::_h('ACCESS_SECTIONS')] - = $this->setAccessSections(); - - // CONFIG_FIELDSETS - $keepLang = CFactory::_('Config')->lang_target; - CFactory::_('Config')->lang_target = 'admin'; - - // start loading the category tree scripts - $this->fileContentStatic[Placefix::_h('CATEGORY_CLASS_TREES')] - = ''; - // run the field sets for first time - $this->setConfigFieldsets(1); - CFactory::_('Config')->lang_target = $keepLang; - - // ADMINJS - $this->fileContentStatic[Placefix::_h('ADMINJS')] - = CFactory::_('Placeholder')->update( - CFactory::_('Customcode.Dispenser')->hub['component_js'], CFactory::_('Placeholder')->active - ); - // SITEJS - $this->fileContentStatic[Placefix::_h('SITEJS')] - = CFactory::_('Placeholder')->update( - CFactory::_('Customcode.Dispenser')->hub['component_js'], CFactory::_('Placeholder')->active - ); - - // ADMINCSS - $this->fileContentStatic[Placefix::_h('ADMINCSS')] - = CFactory::_('Placeholder')->update( - CFactory::_('Customcode.Dispenser')->hub['component_css_admin'], - CFactory::_('Placeholder')->active - ); - // SITECSS - $this->fileContentStatic[Placefix::_h('SITECSS')] - = CFactory::_('Placeholder')->update( - CFactory::_('Customcode.Dispenser')->hub['component_css_site'], - CFactory::_('Placeholder')->active - ); - - // CUSTOM_HELPER_SCRIPT - $this->fileContentStatic[Placefix::_h('CUSTOM_HELPER_SCRIPT')] - = CFactory::_('Placeholder')->update( - CFactory::_('Customcode.Dispenser')->hub['component_php_helper_admin'], - CFactory::_('Placeholder')->active - ); - - // BOTH_CUSTOM_HELPER_SCRIPT - $this->fileContentStatic[Placefix::_h('BOTH_CUSTOM_HELPER_SCRIPT')] - = CFactory::_('Placeholder')->update( - CFactory::_('Customcode.Dispenser')->hub['component_php_helper_both'], - CFactory::_('Placeholder')->active - ); - - // ADMIN_GLOBAL_EVENT_HELPER - if (!isset($this->fileContentStatic[Placefix::_h('ADMIN_GLOBAL_EVENT')])) - { - $this->fileContentStatic[Placefix::_h('ADMIN_GLOBAL_EVENT')] = ''; - } - if (!isset($this->fileContentStatic[Placefix::_h('ADMIN_GLOBAL_EVENT_HELPER')])) - { - $this->fileContentStatic[Placefix::_h('ADMIN_GLOBAL_EVENT_HELPER')] = ''; - } - // now load the data for the global event if needed - if ($this->componentData->add_admin_event == 1) - { - // ADMIN_GLOBAL_EVENT - $this->fileContentStatic[Placefix::_h('ADMIN_GLOBAL_EVENT')] - .= PHP_EOL . PHP_EOL . '// Trigger the Global Admin Event'; - $this->fileContentStatic[Placefix::_h('ADMIN_GLOBAL_EVENT')] - .= PHP_EOL . $this->fileContentStatic[Placefix::_h('Component')] - . 'Helper::globalEvent($document);'; - // ADMIN_GLOBAL_EVENT_HELPER - $this->fileContentStatic[Placefix::_h('ADMIN_GLOBAL_EVENT_HELPER')] - .= PHP_EOL . PHP_EOL . Indent::_(1) . '/**'; - $this->fileContentStatic[Placefix::_h('ADMIN_GLOBAL_EVENT_HELPER')] - .= PHP_EOL . Indent::_(1) - . '* The Global Admin Event Method.'; - $this->fileContentStatic[Placefix::_h('ADMIN_GLOBAL_EVENT_HELPER')] - .= PHP_EOL . Indent::_(1) . '**/'; - $this->fileContentStatic[Placefix::_h('ADMIN_GLOBAL_EVENT_HELPER')] - .= PHP_EOL . Indent::_(1) - . 'public static function globalEvent($document)'; - $this->fileContentStatic[Placefix::_h('ADMIN_GLOBAL_EVENT_HELPER')] - .= PHP_EOL . Indent::_(1) . '{'; - $this->fileContentStatic[Placefix::_h('ADMIN_GLOBAL_EVENT_HELPER')] - .= PHP_EOL . CFactory::_('Placeholder')->update( - CFactory::_('Customcode.Dispenser')->hub['component_php_admin_event'], - CFactory::_('Placeholder')->active - ); - $this->fileContentStatic[Placefix::_h('ADMIN_GLOBAL_EVENT_HELPER')] - .= PHP_EOL . Indent::_(1) . '}'; - } - - // now load the readme file if needed - if ($this->componentData->addreadme == 1) - { - $this->fileContentStatic[Placefix::_h('EXSTRA_ADMIN_FILES')] - .= PHP_EOL . Indent::_(3) - . "README.txt"; - } - - // HELPER_CREATEUSER - $this->fileContentStatic[Placefix::_h('HELPER_CREATEUSER')] - = $this->setCreateUserHelperMethod( - $this->componentData->creatuserhelper - ); - - // HELP - $this->fileContentStatic[Placefix::_h('HELP')] - = $this->noHelp(); - // HELP_SITE - $this->fileContentStatic[Placefix::_h('HELP_SITE')] - = $this->noHelp(); - - // build route parse switch - $this->fileContentStatic[Placefix::_h('ROUTER_PARSE_SWITCH')] - = ''; - // build route views - $this->fileContentStatic[Placefix::_h('ROUTER_BUILD_VIEWS')] - = ''; - - // add the helper emailer if set - $this->fileContentStatic[Placefix::_h('HELPER_EMAIL')] - = $this->addEmailHelper(); - - // load the global placeholders - if (ArrayHelper::check($this->globalPlaceholders)) - { - foreach ( - $this->globalPlaceholders as $globalPlaceholder => - $gloabalValue - ) - { - $this->fileContentStatic[$globalPlaceholder] - = $gloabalValue; - } - } - // reset view array - $viewarray = array(); - $site_edit_view_array = array(); - // start dynamic build - foreach ($this->componentData->admin_views as $view) - { - // set the target - CFactory::_('Config')->build_target = 'admin'; - CFactory::_('Config')->lang_target = 'admin'; - - // set local names - $nameSingleCode = $view['settings']->name_single_code; - $nameListCode = $view['settings']->name_list_code; - - // set the view placeholders - $this->setViewPlaceholders($view['settings']); - - // set site edit view array - if (isset($view['edit_create_site_view']) - && is_numeric( - $view['edit_create_site_view'] - ) - && $view['edit_create_site_view'] > 0) - { - $site_edit_view_array[] = Indent::_(4) . "'" - . $nameSingleCode . "'"; - CFactory::_('Config')->lang_target = 'both'; - // insure site view does not get removed - $this->removeSiteEditFolder = false; - } - // check if help is being loaded - $this->checkHelp($nameSingleCode); - // set custom admin view list links - $this->setCustomAdminViewListLink( - $view, $nameListCode - ); - - // set view array - $viewarray[] = Indent::_(4) . "'" - . $nameSingleCode . "' => '" - . $nameListCode . "'"; - // set the view names - if (isset($view['settings']->name_single) - && $view['settings']->name_single != 'null') - { - // set license per view if needed - $this->setLockLicensePer( - $nameSingleCode, CFactory::_('Config')->build_target - ); - $this->setLockLicensePer( - $nameListCode, CFactory::_('Config')->build_target - ); - - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onBeforeBuildAdminEditViewContent - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeBuildAdminEditViewContent', - array(&$this->componentContext, &$view, - &$nameSingleCode, - &$nameListCode, - &$this->fileContentStatic, - &$this->fileContentDynamic[$nameSingleCode], - &$this->placeholders, &$this->hhh) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - - // FIELDSETS <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('FIELDSETS')] - = $this->setFieldSet( - $view, CFactory::_('Config')->component_code_name, - $nameSingleCode, - $nameListCode - ); - - // ACCESSCONTROL <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('ACCESSCONTROL')] - = $this->setFieldSetAccessControl( - $nameSingleCode - ); - - // LINKEDVIEWITEMS <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('LINKEDVIEWITEMS')] - = ''; - - // ADDTOOLBAR <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('ADDTOOLBAR')] - = $this->setAddToolBar($view); - - // set the script for this view - $this->buildTheViewScript($view); - - // VIEW_SCRIPT - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('VIEW_SCRIPT')] - = $this->setViewScript( - $nameSingleCode, 'fileScript' - ); - - // EDITBODYSCRIPT - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('EDITBODYSCRIPT')] - = $this->setViewScript( - $nameSingleCode, 'footerScript' - ); - - // AJAXTOKE <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('AJAXTOKE')] - = $this->setAjaxToke( - $nameSingleCode - ); - - // DOCUMENT_CUSTOM_PHP <<>> - if ($phpDocument = CFactory::_('Customcode.Dispenser')->get( - 'php_document', $nameSingleCode, - PHP_EOL, null, true, - false - )) - { - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('DOCUMENT_CUSTOM_PHP')] - = str_replace( - '$document->', '$this->document->', $phpDocument - ); - // clear some memory - unset($phpDocument); - } - else - { - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('DOCUMENT_CUSTOM_PHP')] - = ''; - } - // LINKEDVIEWTABLESCRIPTS <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('LINKEDVIEWTABLESCRIPTS')] - = ''; - - // VALIDATEFIX <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('VALIDATIONFIX')] - = $this->setValidationFix( - $nameSingleCode, - $this->fileContentStatic[Placefix::_h('Component')] - ); - - // EDITBODY <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('EDITBODY')] - = $this->setEditBody($view); - - // EDITBODYFADEIN <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('EDITBODYFADEIN')] - = $this->setFadeInEfect($view); - - // JTABLECONSTRUCTOR <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('JTABLECONSTRUCTOR')] - = $this->setJtableConstructor( - $nameSingleCode - ); - - // JTABLEALIASCATEGORY <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('JTABLEALIASCATEGORY')] - = $this->setJtableAliasCategory( - $nameSingleCode - ); - - // METHOD_GET_ITEM <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('METHOD_GET_ITEM')] - = $this->setMethodGetItem( - $nameSingleCode - ); - - // LINKEDVIEWGLOBAL <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('LINKEDVIEWGLOBAL')] - = ''; - - // LINKEDVIEWMETHODS <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('LINKEDVIEWMETHODS')] - = ''; - - // JMODELADMIN_BEFORE_DELETE <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('JMODELADMIN_BEFORE_DELETE')] - = CFactory::_('Customcode.Dispenser')->get( - 'php_before_delete', - $nameSingleCode, PHP_EOL - ); - - // JMODELADMIN_AFTER_DELETE <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('JMODELADMIN_AFTER_DELETE')] - = CFactory::_('Customcode.Dispenser')->get( - 'php_after_delete', $nameSingleCode, - PHP_EOL . PHP_EOL - ); - - // JMODELADMIN_BEFORE_DELETE <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('JMODELADMIN_BEFORE_PUBLISH')] - = CFactory::_('Customcode.Dispenser')->get( - 'php_before_publish', - $nameSingleCode, PHP_EOL - ); - - // JMODELADMIN_AFTER_DELETE <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('JMODELADMIN_AFTER_PUBLISH')] - = CFactory::_('Customcode.Dispenser')->get( - 'php_after_publish', - $nameSingleCode, PHP_EOL . PHP_EOL - ); - - // CHECKBOX_SAVE <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('CHECKBOX_SAVE')] - = $this->setCheckboxSave( - $nameSingleCode - ); - - // METHOD_ITEM_SAVE <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('METHOD_ITEM_SAVE')] - = $this->setMethodItemSave( - $nameSingleCode - ); - - // POSTSAVEHOOK <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('POSTSAVEHOOK')] - = CFactory::_('Customcode.Dispenser')->get( - 'php_postsavehook', $nameSingleCode, - PHP_EOL, null, - true, PHP_EOL . Indent::_(2) . "return;", - PHP_EOL . PHP_EOL . Indent::_(2) . "return;" - ); - - // VIEWCSS <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('VIEWCSS')] - = CFactory::_('Customcode.Dispenser')->get( - 'css_view', $nameSingleCode, '', - null, true - ); - - // add css to front end - if (isset($view['edit_create_site_view']) - && is_numeric( - $view['edit_create_site_view'] - ) - && $view['edit_create_site_view'] > 0) - { - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('SITE_VIEWCSS')] - = $this->fileContentDynamic[$nameSingleCode][Placefix::_h('VIEWCSS')]; - // check if we should add a create menu - if ($view['edit_create_site_view'] == 2) - { - // SITE_MENU_XML <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('SITE_MENU_XML')] - = $this->setAdminViewMenu( - $nameSingleCode, $view - ); - } - // SITE_ADMIN_VIEW_CONTROLLER_HEADER <<>> add the header details for the controller - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('SITE_ADMIN_VIEW_CONTROLLER_HEADER')] - = $this->setFileHeader( - 'site.admin.view.controller', - $nameSingleCode - ); - // SITE_ADMIN_VIEW_MODEL_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('SITE_ADMIN_VIEW_MODEL_HEADER')] - = $this->setFileHeader( - 'site.admin.view.model', - $nameSingleCode - ); - // SITE_ADMIN_VIEW_HTML_HEADER <<>> add the header details for the view - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('SITE_ADMIN_VIEW_HTML_HEADER')] - = $this->setFileHeader( - 'site.admin.view.html', - $nameSingleCode - ); - // SITE_ADMIN_VIEW_HEADER <<>> add the header details for the view - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('SITE_ADMIN_VIEW_HEADER')] - = $this->setFileHeader( - 'site.admin.view', - $nameSingleCode - ); - } - - // TABLAYOUTFIELDSARRAY <<>> add the tab layout fields array to the model - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('TABLAYOUTFIELDSARRAY')] - = $this->getTabLayoutFieldsArray( - $nameSingleCode - ); - - // ADMIN_VIEW_CONTROLLER_HEADER <<>> add the header details for the controller - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('ADMIN_VIEW_CONTROLLER_HEADER')] - = $this->setFileHeader( - 'admin.view.controller', - $nameSingleCode - ); - // ADMIN_VIEW_MODEL_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('ADMIN_VIEW_MODEL_HEADER')] - = $this->setFileHeader( - 'admin.view.model', $nameSingleCode - ); - // ADMIN_VIEW_HTML_HEADER <<>> add the header details for the view - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('ADMIN_VIEW_HTML_HEADER')] - = $this->setFileHeader( - 'admin.view.html', $nameSingleCode - ); - // ADMIN_VIEW_HEADER <<>> add the header details for the view - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('ADMIN_VIEW_HEADER')] - = $this->setFileHeader( - 'admin.view', $nameSingleCode - ); - - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onAfterBuildAdminEditViewContent - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterBuildAdminEditViewContent', - array(&$this->componentContext, &$view, - &$nameSingleCode, - &$nameListCode, - &$this->fileContentStatic, - &$this->fileContentDynamic[$nameSingleCode], - &$this->placeholders, &$this->hhh) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - } - // set the views names - if (isset($view['settings']->name_list) - && $view['settings']->name_list != 'null') - { - CFactory::_('Config')->lang_target = 'admin'; - - // ICOMOON <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('ICOMOON')] - = $view['icomoon']; - - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onBeforeBuildAdminListViewContent - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeBuildAdminListViewContent', - array(&$this->componentContext, &$view, - &$nameSingleCode, - &$nameListCode, - &$this->fileContentStatic, - &$this->fileContentDynamic[$nameListCode], - &$this->placeholders, &$this->hhh) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - - // set the export/import option - if (isset($view['port']) && $view['port'] - || 1 == $view['settings']->add_custom_import) - { - $this->eximportView[$nameListCode] - = true; - if (1 == $view['settings']->add_custom_import) - { - // this view has custom import scripting - $this->importCustomScripts[$nameListCode] - = true; - // set all custom scripts - $this->setImportCustomScripts( - $nameListCode - ); - } - } - else - { - $this->eximportView[$nameListCode] - = false; - } - - // set Auto check in function - if (isset($view['checkin']) && $view['checkin'] == 1) - { - // AUTOCHECKIN <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('AUTOCHECKIN')] - = $this->setAutoCheckin( - $nameSingleCode, - CFactory::_('Config')->component_code_name - ); - // CHECKINCALL <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('CHECKINCALL')] - = $this->setCheckinCall(); - } - else - { - // AUTOCHECKIN <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('AUTOCHECKIN')] - = ''; - // CHECKINCALL <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('CHECKINCALL')] - = ''; - } - // admin list file contnet - $this->fileContentDynamic[$nameListCode][Placefix::_h('ADMIN_JAVASCRIPT_FILE')] - = $this->setViewScript( - $nameListCode, 'list_fileScript' - ); - // ADMIN_CUSTOM_BUTTONS_LIST - $this->fileContentDynamic[$nameListCode][Placefix::_h('ADMIN_CUSTOM_BUTTONS_LIST')] - = $this->setCustomButtons($view, 3, Indent::_(1)); - $this->fileContentDynamic[$nameListCode][Placefix::_h('ADMIN_CUSTOM_FUNCTION_ONLY_BUTTONS_LIST')] - = $this->setFunctionOnlyButtons( - $nameListCode - ); - - // GET_ITEMS_METHOD_STRING_FIX <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('GET_ITEMS_METHOD_STRING_FIX')] - = $this->setGetItemsMethodStringFix( - $nameSingleCode, - $nameListCode, - $this->fileContentStatic[Placefix::_h('Component')] - ); - - // GET_ITEMS_METHOD_AFTER_ALL <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('GET_ITEMS_METHOD_AFTER_ALL')] - = CFactory::_('Customcode.Dispenser')->get( - 'php_getitems_after_all', - $nameSingleCode, PHP_EOL - ); - - // SELECTIONTRANSLATIONFIX <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('SELECTIONTRANSLATIONFIX')] - = $this->setSelectionTranslationFix( - $nameListCode, - $this->fileContentStatic[Placefix::_h('Component')] - ); - - // SELECTIONTRANSLATIONFIXFUNC <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('SELECTIONTRANSLATIONFIXFUNC')] - = $this->setSelectionTranslationFixFunc( - $nameListCode, - $this->fileContentStatic[Placefix::_h('Component')] - ); - - // FILTER_FIELDS <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('FILTER_FIELDS')] - = $this->setFilterFieldsArray( - $nameSingleCode, - $nameListCode - ); - - // STOREDID <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('STOREDID')] - = $this->setStoredId( - $nameSingleCode, $nameListCode - ); - - // POPULATESTATE <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('POPULATESTATE')] - = $this->setPopulateState( - $nameSingleCode, $nameListCode - ); - - // SORTFIELDS <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('SORTFIELDS')] - = $this->setSortFields( - $nameListCode - ); - - // CATEGORY_VIEWS - if (!isset( - $this->fileContentStatic[Placefix::_h('ROUTER_CATEGORY_VIEWS')] - )) - { - $this->fileContentStatic[Placefix::_h('ROUTER_CATEGORY_VIEWS')] - = ''; - } - $this->fileContentStatic[Placefix::_h('ROUTER_CATEGORY_VIEWS')] - .= $this->setRouterCategoryViews( - $nameSingleCode, - $nameListCode - ); - - // FILTERFIELDDISPLAYHELPER <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('FILTERFIELDDISPLAYHELPER')] - = $this->setFilterFieldSidebarDisplayHelper( - $nameSingleCode, - $nameListCode - ); - - // BATCHDISPLAYHELPER <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('BATCHDISPLAYHELPER')] - = $this->setBatchDisplayHelper( - $nameSingleCode, - $nameListCode - ); - - // FILTERFUNCTIONS <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('FILTERFUNCTIONS')] - = $this->setFilterFieldHelper( - $nameSingleCode, - $nameListCode - ); - - // FIELDFILTERSETS <<>> - $this->fileContentDynamic['filter_' - . $nameListCode][Placefix::_h('FIELDFILTERSETS')] - = $this->setFieldFilterSet( - $nameSingleCode, - $nameListCode - ); - - // FIELDLISTSETS <<>> - $this->fileContentDynamic['filter_' - . $nameListCode][Placefix::_h('FIELDLISTSETS')] - = $this->setFieldFilterListSet( - $nameSingleCode, - $nameListCode - ); - - // LISTQUERY <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('LISTQUERY')] - = $this->setListQuery( - $nameSingleCode, - $nameListCode - ); - - // MODELEXPORTMETHOD <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('MODELEXPORTMETHOD')] - = $this->setGetItemsModelMethod( - $nameSingleCode, - $nameListCode - ); - - // MODELEXIMPORTMETHOD <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('CONTROLLEREXIMPORTMETHOD')] - = $this->setControllerEximportMethod( - $nameSingleCode, - $nameListCode - ); - - // EXPORTBUTTON <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('EXPORTBUTTON')] - = $this->setExportButton( - $nameSingleCode, - $nameListCode - ); - - // IMPORTBUTTON <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('IMPORTBUTTON')] - = $this->setImportButton( - $nameSingleCode, - $nameListCode - ); - - // VIEWS_DEFAULT_BODY <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('VIEWS_DEFAULT_BODY')] - = $this->setDefaultViewsBody( - $nameSingleCode, - $nameListCode - ); - - // LISTHEAD <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('LISTHEAD')] - = $this->setListHead( - $nameSingleCode, - $nameListCode - ); - - // LISTBODY <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('LISTBODY')] - = $this->setListBody( - $nameSingleCode, - $nameListCode - ); - - // LISTCOLNR <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('LISTCOLNR')] - = $this->setListColnr( - $nameListCode - ); - - // JVIEWLISTCANDO <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('JVIEWLISTCANDO')] - = $this->setJviewListCanDo( - $nameSingleCode, - $nameListCode - ); - - // VIEWSCSS <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('VIEWSCSS')] - = CFactory::_('Customcode.Dispenser')->get( - 'css_views', $nameSingleCode, '', - null, true - ); - - // ADMIN_DIPLAY_METHOD <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('ADMIN_DIPLAY_METHOD')] - = $this->setAdminViewDisplayMethod( - $nameListCode - ); - - // VIEWS_FOOTER_SCRIPT <<>> - $scriptNote = PHP_EOL . '//' . Line::_(__Line__, __Class__) - . ' ' . $nameListCode - . ' footer script'; - if (($footerScript = CFactory::_('Customcode.Dispenser')->get( - 'views_footer', $nameSingleCode, '', - $scriptNote, true, - false, PHP_EOL - )) !== false - && StringHelper::check($footerScript)) - { - // only minfy if no php is added to the footer script - if (CFactory::_('Config')->get('minify', 0) - && strpos($footerScript, 'add($footerScript); - $footerScript = $minifier->minify(); - // clear some memory - unset($minifier); - } - $this->fileContentDynamic[$nameListCode][Placefix::_h('VIEWS_FOOTER_SCRIPT')] - = PHP_EOL . '"; - // clear some memory - unset($footerScript); - } - else - { - $this->fileContentDynamic[$nameListCode][Placefix::_h('VIEWS_FOOTER_SCRIPT')] - = ''; - } - - // ADMIN_VIEWS_CONTROLLER_HEADER <<>> add the header details for the controller - $this->fileContentDynamic[$nameListCode][Placefix::_h('ADMIN_VIEWS_CONTROLLER_HEADER')] - = $this->setFileHeader( - 'admin.views.controller', - $nameListCode - ); - // ADMIN_VIEWS_MODEL_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$nameListCode][Placefix::_h('ADMIN_VIEWS_MODEL_HEADER')] - = $this->setFileHeader( - 'admin.views.model', $nameListCode - ); - // ADMIN_VIEWS_HTML_HEADER <<>> add the header details for the views - $this->fileContentDynamic[$nameListCode][Placefix::_h('ADMIN_VIEWS_HTML_HEADER')] - = $this->setFileHeader( - 'admin.views.html', $nameListCode - ); - // ADMIN_VIEWS_HEADER <<>> add the header details for the views - $this->fileContentDynamic[$nameListCode][Placefix::_h('ADMIN_VIEWS_HEADER')] - = $this->setFileHeader( - 'admin.views', $nameListCode - ); - - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onAfterBuildAdminListViewContent - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterBuildAdminListViewContent', - array(&$this->componentContext, &$view, - &$nameSingleCode, - &$nameListCode, - &$this->fileContentStatic, - &$this->fileContentDynamic[$nameListCode], - &$this->placeholders, &$this->hhh) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - } - - // set u fields used in batch - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('UNIQUEFIELDS')] - = $this->setUniqueFields( - $nameSingleCode - ); - - // TITLEALIASFIX <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('TITLEALIASFIX')] - = $this->setAliasTitleFix( - $nameSingleCode - ); - - // GENERATENEWTITLE <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('GENERATENEWTITLE')] - = $this->setGenerateNewTitle( - $nameSingleCode - ); - - // GENERATENEWALIAS <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('GENERATENEWALIAS')] - = $this->setGenerateNewAlias( - $nameSingleCode - ); - - // MODEL_BATCH_COPY <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('MODEL_BATCH_COPY')] - = $this->setBatchCopy($nameSingleCode); - - // MODEL_BATCH_MOVE <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('MODEL_BATCH_MOVE')] - = $this->setBatchMove($nameSingleCode); - - // BATCH_ONCLICK_CANCEL_SCRIPT <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('BATCH_ONCLICK_CANCEL_SCRIPT')] - = ''; // TODO <-- must still be build - - // JCONTROLLERFORM_ALLOWADD <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('JCONTROLLERFORM_ALLOWADD')] - = $this->setJcontrollerAllowAdd( - $nameSingleCode, - $nameListCode - ); - - // JCONTROLLERFORM_BEFORECANCEL <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('JCONTROLLERFORM_BEFORECANCEL')] - = CFactory::_('Customcode.Dispenser')->get( - 'php_before_cancel', $nameSingleCode, - PHP_EOL, null, false, - '' - ); - - // JCONTROLLERFORM_AFTERCANCEL <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('JCONTROLLERFORM_AFTERCANCEL')] - = CFactory::_('Customcode.Dispenser')->get( - 'php_after_cancel', $nameSingleCode, - PHP_EOL, null, false, - '' - ); - - // JCONTROLLERFORM_ALLOWEDIT <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('JCONTROLLERFORM_ALLOWEDIT')] - = $this->setJcontrollerAllowEdit( - $nameSingleCode, - $nameListCode - ); - - // JMODELADMIN_GETFORM <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('JMODELADMIN_GETFORM')] - = $this->setJmodelAdminGetForm( - $nameSingleCode, - $nameListCode - ); - - // JMODELADMIN_ALLOWEDIT <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('JMODELADMIN_ALLOWEDIT')] - = $this->setJmodelAdminAllowEdit( - $nameSingleCode, - $nameListCode - ); - - // JMODELADMIN_CANDELETE <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('JMODELADMIN_CANDELETE')] - = $this->setJmodelAdminCanDelete( - $nameSingleCode, - $nameListCode - ); - - // JMODELADMIN_CANEDITSTATE <<>> - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('JMODELADMIN_CANEDITSTATE')] - = $this->setJmodelAdminCanEditState( - $nameSingleCode, - $nameListCode - ); - - // set custom admin view Toolbare buttons - // CUSTOM_ADMIN_DYNAMIC_BUTTONS <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('CUSTOM_ADMIN_DYNAMIC_BUTTONS')] - = $this->setCustomAdminDynamicButton( - $nameListCode - ); - // CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER <<>> - $this->fileContentDynamic[$nameListCode][Placefix::_h('CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER')] - = $this->setCustomAdminDynamicButtonController( - $nameListCode - ); - - // set helper router - if (!isset( - $this->fileContentStatic[Placefix::_h('ROUTEHELPER')] - )) - { - $this->fileContentStatic[Placefix::_h('ROUTEHELPER')] - = ''; - } - $this->fileContentStatic[Placefix::_h('ROUTEHELPER')] - .= $this->setRouterHelp( - $nameSingleCode, - $nameListCode - ); - - if (isset($view['edit_create_site_view']) - && is_numeric( - $view['edit_create_site_view'] - ) - && $view['edit_create_site_view'] > 0) - { - // add needed router stuff for front edit views - $this->fileContentStatic[Placefix::_h('ROUTER_PARSE_SWITCH')] - .= $this->routerParseSwitch( - $nameSingleCode, null, false - ); - $this->fileContentStatic[Placefix::_h('ROUTER_BUILD_VIEWS')] - .= $this->routerBuildViews( - $nameSingleCode - ); - } - - // ACCESS_SECTIONS - if (!isset( - $this->fileContentStatic[Placefix::_h('ACCESS_SECTIONS')] - )) - { - $this->fileContentStatic[Placefix::_h('ACCESS_SECTIONS')] - = ''; - } - $this->fileContentStatic[Placefix::_h('ACCESS_SECTIONS')] - .= $this->setAccessSectionsCategory( - $nameSingleCode, - $nameListCode - ); - // set the Joomla Fields ACCESS section if needed - if (isset($view['joomla_fields']) - && $view['joomla_fields'] == 1) - { - $this->fileContentStatic[Placefix::_h('ACCESS_SECTIONS')] - .= $this->setAccessSectionsJoomlaFields(); - } - - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onAfterBuildAdminViewContent - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterBuildAdminViewContent', - array(&$this->componentContext, &$view, - &$nameSingleCode, - &$nameListCode, - &$this->fileContentStatic, - &$this->fileContentDynamic, &$this->placeholders, - &$this->hhh) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - } - - // setup the layouts - $this->setCustomViewLayouts(); - - // setup custom_admin_views and all needed stuff for the site - if (isset($this->componentData->custom_admin_views) - && ArrayHelper::check( - $this->componentData->custom_admin_views - )) - { - CFactory::_('Config')->build_target = 'custom_admin'; - CFactory::_('Config')->lang_target = 'admin'; - // start dynamic build - foreach ($this->componentData->custom_admin_views as $view) - { - // for single views - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SView')] - = $view['settings']->Code; - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('sview')] - = $view['settings']->code; - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SVIEW')] - = $view['settings']->CODE; - // for list views - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SViews')] - = $view['settings']->Code; - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('sviews')] - = $view['settings']->code; - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SVIEWS')] - = $view['settings']->CODE; - // add to lang array - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, - CFactory::_('Config')->lang_prefix . '_' . $view['settings']->CODE, - $view['settings']->name - ); - CFactory::_('Language')->set( - CFactory::_('Config')->lang_target, - CFactory::_('Config')->lang_prefix . '_' . $view['settings']->CODE - . '_DESC', $view['settings']->description - ); - // ICOMOON <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('ICOMOON')] - = $view['icomoon']; - - // set placeholders - CFactory::_('Placeholder')->active[Placefix::_h('SView')] - = $view['settings']->Code; - CFactory::_('Placeholder')->active[Placefix::_h('sview')] - = $view['settings']->code; - CFactory::_('Placeholder')->active[Placefix::_h('SVIEW')] - = $view['settings']->CODE; - CFactory::_('Placeholder')->active[Placefix::_('SView')] - = $view['settings']->Code; - CFactory::_('Placeholder')->active[Placefix::_('sview')] - = $view['settings']->code; - CFactory::_('Placeholder')->active[Placefix::_('SVIEW')] - = $view['settings']->CODE; - CFactory::_('Placeholder')->active[Placefix::_h('SViews')] - = $view['settings']->Code; - CFactory::_('Placeholder')->active[Placefix::_h('sviews')] - = $view['settings']->code; - CFactory::_('Placeholder')->active[Placefix::_h('SVIEWS')] - = $view['settings']->CODE; - CFactory::_('Placeholder')->active[Placefix::_('SViews')] - = $view['settings']->Code; - CFactory::_('Placeholder')->active[Placefix::_('sviews')] - = $view['settings']->code; - CFactory::_('Placeholder')->active[Placefix::_('SVIEWS')] - = $view['settings']->CODE; - - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onBeforeBuildCustomAdminViewContent - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeBuildCustomAdminViewContent', - array(&$this->componentContext, &$view, - &$view['settings']->code, - &$this->fileContentStatic, - &$this->fileContentDynamic[$view['settings']->code], - &$this->placeholders, &$this->hhh) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - - // set license per view if needed - $this->setLockLicensePer( - $view['settings']->code, CFactory::_('Config')->build_target - ); - - // check if this custom admin view is the default view - if ($this->dynamicDashboardType === 'custom_admin_views' - && $this->dynamicDashboard === $view['settings']->code) - { - // HIDEMAINMENU <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('HIDEMAINMENU')] - = ''; - } - else - { - // HIDEMAINMENU <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('HIDEMAINMENU')] - = PHP_EOL . Indent::_(2) . '//' . Line::_( - __LINE__,__CLASS__ - ) . " hide the main menu" - . PHP_EOL . Indent::_(2) - . "\$this->app->input->set('hidemainmenu', true);"; - } - - if ($view['settings']->main_get->gettype == 1) - { - // CUSTOM_ADMIN_BEFORE_GET_ITEM <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_BEFORE_GET_ITEM')] - = CFactory::_('Customcode.Dispenser')->get( - CFactory::_('Config')->build_target . '_php_before_getitem', - $view['settings']->code, '', null, true - ); - - // CUSTOM_ADMIN_GET_ITEM <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_GET_ITEM')] - = $this->setCustomViewGetItem( - $view['settings']->main_get, - $view['settings']->code, Indent::_(2) - ); - - // CUSTOM_ADMIN_AFTER_GET_ITEM <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_AFTER_GET_ITEM')] - = CFactory::_('Customcode.Dispenser')->get( - CFactory::_('Config')->build_target . '_php_after_getitem', - $view['settings']->code, '', null, true - ); - } - elseif ($view['settings']->main_get->gettype == 2) - { - // CUSTOM_ADMIN_GET_LIST_QUERY <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_GET_LIST_QUERY')] - = $this->setCustomViewListQuery( - $view['settings']->main_get, $view['settings']->code - ); - - // CUSTOM_ADMIN_CUSTOM_BEFORE_LIST_QUERY <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_CUSTOM_BEFORE_LIST_QUERY')] - = CFactory::_('Customcode.Dispenser')->get( - CFactory::_('Config')->build_target . '_php_getlistquery', - $view['settings']->code, PHP_EOL, null, true - ); - - // CUSTOM_ADMIN_BEFORE_GET_ITEMS <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_BEFORE_GET_ITEMS')] - = CFactory::_('Customcode.Dispenser')->get( - CFactory::_('Config')->build_target . '_php_before_getitems', - $view['settings']->code, PHP_EOL, null, true - ); - - // CUSTOM_ADMIN_GET_ITEMS <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_GET_ITEMS')] - = $this->setCustomViewGetItems( - $view['settings']->main_get, $view['settings']->code - ); - - // CUSTOM_ADMIN_AFTER_GET_ITEMS <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_AFTER_GET_ITEMS')] - = CFactory::_('Customcode.Dispenser')->get( - CFactory::_('Config')->build_target . '_php_after_getitems', - $view['settings']->code, PHP_EOL, null, true - ); - } - - // CUSTOM_ADMIN_CUSTOM_METHODS <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_CUSTOM_METHODS')] - = $this->setCustomViewCustomItemMethods( - $view['settings']->main_get, $view['settings']->code - ); - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_CUSTOM_METHODS')] - .= $this->setCustomViewCustomMethods( - $view, $view['settings']->code - ); - // CUSTOM_ADMIN_DIPLAY_METHOD <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_DIPLAY_METHOD')] - = $this->setCustomViewDisplayMethod($view); - // set document details - $this->setPrepareDocument($view); - // CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS')] - = $this->setCustomViewExtraDisplayMethods($view); - // CUSTOM_ADMIN_CODE_BODY <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_CODE_BODY')] - = $this->setCustomViewCodeBody($view); - // CUSTOM_ADMIN_BODY <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_BODY')] - = $this->setCustomViewBody($view); - // CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT')] - = $this->setCustomViewSubmitButtonScript($view); - - // setup the templates - $this->setCustomViewTemplateBody($view); - - // set the site form if needed - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_TOP_FORM')] - = $this->setCustomViewForm( - $view['settings']->code, - $view['settings']->main_get->gettype, 1 - ); - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_BOTTOM_FORM')] - = $this->setCustomViewForm( - $view['settings']->code, - $view['settings']->main_get->gettype, 2 - ); - - // set headers based on the main get type - if ($view['settings']->main_get->gettype == 1) - { - // CUSTOM_ADMIN_VIEW_CONTROLLER_HEADER <<>> add the header details for the controller - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_VIEW_CONTROLLER_HEADER')] - = $this->setFileHeader( - 'custom.admin.view.controller', - $view['settings']->code - ); - // CUSTOM_ADMIN_VIEW_MODEL_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_VIEW_MODEL_HEADER')] - = $this->setFileHeader( - 'custom.admin.view.model', $view['settings']->code - ); - // CUSTOM_ADMIN_VIEW_HTML_HEADER <<>> add the header details for the view - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_VIEW_HTML_HEADER')] - = $this->setFileHeader( - 'custom.admin.view.html', $view['settings']->code - ); - // CUSTOM_ADMIN_VIEW_HEADER <<>> add the header details for the view - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_VIEW_HEADER')] - = $this->setFileHeader( - 'custom.admin.view', $view['settings']->code - ); - } - elseif ($view['settings']->main_get->gettype == 2) - { - // CUSTOM_ADMIN_VIEWS_CONTROLLER_HEADER <<>> add the header details for the controller - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_VIEWS_CONTROLLER_HEADER')] - = $this->setFileHeader( - 'custom.admin.views.controller', - $view['settings']->code - ); - // CUSTOM_ADMIN_VIEWS_MODEL_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_VIEWS_MODEL_HEADER')] - = $this->setFileHeader( - 'custom.admin.views.model', $view['settings']->code - ); - // CUSTOM_ADMIN_VIEWS_HTML_HEADER <<>> add the header details for the view - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_VIEWS_HTML_HEADER')] - = $this->setFileHeader( - 'custom.admin.views.html', $view['settings']->code - ); - // CUSTOM_ADMIN_VIEWS_HEADER <<>> add the header details for the view - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('CUSTOM_ADMIN_VIEWS_HEADER')] - = $this->setFileHeader( - 'custom.admin.views', $view['settings']->code - ); - } - - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onAfterBuildCustomAdminViewContent - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterBuildCustomAdminViewContent', - array(&$this->componentContext, &$view, - &$view['settings']->code, - &$this->fileContentStatic, - &$this->fileContentDynamic[$view['settings']->code], - &$this->placeholders, &$this->hhh) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - } - - // setup the layouts - $this->setCustomViewLayouts(); - } - - // ADMIN_HELPER_CLASS_HEADER - $this->fileContentStatic[Placefix::_h('ADMIN_HELPER_CLASS_HEADER')] - = $this->setFileHeader( - 'admin.helper', 'admin' - ); - - // ADMIN_COMPONENT_HEADER - $this->fileContentStatic[Placefix::_h('ADMIN_COMPONENT_HEADER')] - = $this->setFileHeader( - 'admin.component', 'admin' - ); - - // SITE_HELPER_CLASS_HEADER - $this->fileContentStatic[Placefix::_h('SITE_HELPER_CLASS_HEADER')] - = $this->setFileHeader( - 'site.helper', 'site' - ); - - // SITE_COMPONENT_HEADER - $this->fileContentStatic[Placefix::_h('SITE_COMPONENT_HEADER')] - = $this->setFileHeader( - 'site.component', 'site' - ); - - // HELPER_EXEL - $this->fileContentStatic[Placefix::_h('HELPER_EXEL')] - = $this->setHelperExelMethods(); - - // VIEWARRAY - $this->fileContentStatic[Placefix::_h('VIEWARRAY')] - = PHP_EOL . implode("," . PHP_EOL, $viewarray); - - // CUSTOM_ADMIN_EDIT_VIEW_ARRAY - $this->fileContentStatic[Placefix::_h('SITE_EDIT_VIEW_ARRAY')] - = PHP_EOL . implode("," . PHP_EOL, $site_edit_view_array); - - // MAINMENUS - $this->fileContentStatic[Placefix::_h('MAINMENUS')] - = $this->setMainMenus(); - - // SUBMENU - $this->fileContentStatic[Placefix::_h('SUBMENU')] - = $this->setSubMenus(); - - // GET_CRYPT_KEY - $this->fileContentStatic[Placefix::_h('GET_CRYPT_KEY')] - = $this->setGetCryptKey(); - - // set the license locker - $this->setLockLicense(); - - // CONTRIBUTORS - $this->fileContentStatic[Placefix::_h('CONTRIBUTORS')] - = $this->theContributors; - - // INSTALL - $this->fileContentStatic[Placefix::_h('INSTALL')] - = $this->setInstall(); - - // UNINSTALL - $this->fileContentStatic[Placefix::_h('UNINSTALL')] - = $this->setUninstall(); - - // UPDATE_VERSION_MYSQL - $this->setVersionController(); - - // only set these if default dashboard it used - if (!StringHelper::check($this->dynamicDashboard)) - { - // DASHBOARDVIEW - $this->fileContentStatic[Placefix::_h('DASHBOARDVIEW')] - = CFactory::_('Config')->component_code_name; - - // DASHBOARDICONS - $this->fileContentDynamic[CFactory::_('Config')->component_code_name][Placefix::_h('DASHBOARDICONS')] - = $this->setDashboardIcons(); - - // DASHBOARDICONACCESS - $this->fileContentDynamic[CFactory::_('Config')->component_code_name][Placefix::_h('DASHBOARDICONACCESS')] - = $this->setDashboardIconAccess(); - - // DASH_MODEL_METHODS - $this->fileContentDynamic[CFactory::_('Config')->component_code_name][Placefix::_h('DASH_MODEL_METHODS')] - = $this->setDashboardModelMethods(); - - // DASH_GET_CUSTOM_DATA - $this->fileContentDynamic[CFactory::_('Config')->component_code_name][Placefix::_h('DASH_GET_CUSTOM_DATA')] - = $this->setDashboardGetCustomData(); - - // DASH_DISPLAY_DATA - $this->fileContentDynamic[CFactory::_('Config')->component_code_name][Placefix::_h('DASH_DISPLAY_DATA')] - = $this->setDashboardDisplayData(); - - // DASH_VIEW_HEADER - $this->fileContentDynamic[CFactory::_('Config')->component_code_name][Placefix::_h('DASH_VIEW_HEADER')] - = $this->setFileHeader('dashboard.view', 'dashboard'); - // DASH_VIEW_HTML_HEADER - $this->fileContentDynamic[CFactory::_('Config')->component_code_name][Placefix::_h('DASH_VIEW_HTML_HEADER')] - = $this->setFileHeader('dashboard.view.html', 'dashboard'); - // DASH_MODEL_HEADER - $this->fileContentDynamic[CFactory::_('Config')->component_code_name][Placefix::_h('DASH_MODEL_HEADER')] - = $this->setFileHeader('dashboard.model', 'dashboard'); - // DASH_CONTROLLER_HEADER - $this->fileContentDynamic[CFactory::_('Config')->component_code_name][Placefix::_h('DASH_CONTROLLER_HEADER')] - = $this->setFileHeader('dashboard.controller', 'dashboard'); - } - else - { - // DASHBOARDVIEW - $this->fileContentStatic[Placefix::_h('DASHBOARDVIEW')] - = $this->dynamicDashboard; - } - - // add import - if (isset($this->addEximport) && $this->addEximport) - { - // setup import files - $target = array('admin' => 'import'); - $this->buildDynamique($target, 'import'); - // IMPORT_EXT_METHOD <<>> - $this->fileContentDynamic['import'][Placefix::_h('IMPORT_EXT_METHOD')] - = PHP_EOL . PHP_EOL . CFactory::_('Placeholder')->update( - ComponentbuilderHelper::getDynamicScripts('ext'), - CFactory::_('Placeholder')->active - ); - // IMPORT_SETDATA_METHOD <<>> - $this->fileContentDynamic['import'][Placefix::_h('IMPORT_SETDATA_METHOD')] - = PHP_EOL . PHP_EOL . CFactory::_('Placeholder')->update( - ComponentbuilderHelper::getDynamicScripts('setdata'), - CFactory::_('Placeholder')->active - ); - // IMPORT_SAVE_METHOD <<>> - $this->fileContentDynamic['import'][Placefix::_h('IMPORT_SAVE_METHOD')] - = PHP_EOL . PHP_EOL . CFactory::_('Placeholder')->update( - ComponentbuilderHelper::getDynamicScripts('save'), - CFactory::_('Placeholder')->active - ); - } - - // ensure that the ajax model and controller is set if needed - if (isset($this->addAjax) && $this->addAjax) - { - // setup Ajax files - $target = array('admin' => 'ajax'); - $this->buildDynamique($target, 'ajax'); - // set the controller - $this->fileContentDynamic['ajax'][Placefix::_h('REGISTER_AJAX_TASK')] - = $this->setRegisterAjaxTask('admin'); - $this->fileContentDynamic['ajax'][Placefix::_h('AJAX_INPUT_RETURN')] - = $this->setAjaxInputReturn('admin'); - // set the model header - $this->fileContentDynamic['ajax'][Placefix::_h('AJAX_ADMIN_MODEL_HEADER')] - = $this->setFileHeader('ajax.admin.model', 'ajax'); - // set the module - $this->fileContentDynamic['ajax'][Placefix::_h('AJAX_MODEL_METHODS')] - = $this->setAjaxModelMethods('admin'); - } - - // ensure that the site ajax model and controller is set if needed - if (isset($this->addSiteAjax) && $this->addSiteAjax) - { - // setup Ajax files - $target = array('site' => 'ajax'); - $this->buildDynamique($target, 'ajax'); - // set the controller - $this->fileContentDynamic['ajax'][Placefix::_h('REGISTER_SITE_AJAX_TASK')] - = $this->setRegisterAjaxTask('site'); - $this->fileContentDynamic['ajax'][Placefix::_h('AJAX_SITE_INPUT_RETURN')] - = $this->setAjaxInputReturn('site'); - // set the model header - $this->fileContentDynamic['ajax'][Placefix::_h('AJAX_SITE_MODEL_HEADER')] - = $this->setFileHeader('ajax.site.model', 'ajax'); - // set the module - $this->fileContentDynamic['ajax'][Placefix::_h('AJAX_SITE_MODEL_METHODS')] - = $this->setAjaxModelMethods('site'); - } - - // build the validation rules - if (isset($this->validationRules) - && ArrayHelper::check($this->validationRules)) - { - foreach ($this->validationRules as $rule => $_php) - { - // setup rule file - $target = array('admin' => 'a_rule_zi'); - $this->buildDynamique($target, 'rule', $rule); - // set the JFormRule Name - $this->fileContentDynamic['a_rule_zi_' . $rule][Placefix::_h('Name')] - = ucfirst($rule); - // set the JFormRule PHP - $this->fileContentDynamic['a_rule_zi_' . $rule][Placefix::_h('VALIDATION_RULE_METHODS')] - = PHP_EOL . $_php; - } - } - - // run the second run if needed - if (isset($this->secondRunAdmin) - && ArrayHelper::check($this->secondRunAdmin)) - { - // start dynamic build - foreach ($this->secondRunAdmin as $function => $arrays) - { - if (ArrayHelper::check($arrays) - && StringHelper::check($function)) - { - foreach ($arrays as $array) - { - $this->{$function}($array); - } - } - } - } - - // CONFIG_FIELDSETS - $keepLang = CFactory::_('Config')->lang_target; - CFactory::_('Config')->lang_target = 'admin'; - // run field sets for second time - $this->setConfigFieldsets(2); - CFactory::_('Config')->lang_target = $keepLang; - - // setup front-views and all needed stuff for the site - if (isset($this->componentData->site_views) - && ArrayHelper::check( - $this->componentData->site_views - )) - { - CFactory::_('Config')->build_target = 'site'; - // start dynamic build - foreach ($this->componentData->site_views as $view) - { - // for list views - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SViews')] - = $view['settings']->Code; - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('sviews')] - = $view['settings']->code; - // for single views - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SView')] - = $view['settings']->Code; - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('sview')] - = $view['settings']->code; - - // set placeholder - CFactory::_('Placeholder')->active[Placefix::_h('SView')] - = $view['settings']->Code; - CFactory::_('Placeholder')->active[Placefix::_h('sview')] - = $view['settings']->code; - CFactory::_('Placeholder')->active[Placefix::_h('SVIEW')] - = $view['settings']->CODE; - CFactory::_('Placeholder')->active[Placefix::_('SView')] - = $view['settings']->Code; - CFactory::_('Placeholder')->active[Placefix::_('sview')] - = $view['settings']->code; - CFactory::_('Placeholder')->active[Placefix::_('SVIEW')] - = $view['settings']->CODE; - CFactory::_('Placeholder')->active[Placefix::_h('SViews')] - = $view['settings']->Code; - CFactory::_('Placeholder')->active[Placefix::_h('sviews')] - = $view['settings']->code; - CFactory::_('Placeholder')->active[Placefix::_h('SVIEWS')] - = $view['settings']->CODE; - CFactory::_('Placeholder')->active[Placefix::_('SViews')] - = $view['settings']->Code; - CFactory::_('Placeholder')->active[Placefix::_('sviews')] - = $view['settings']->code; - CFactory::_('Placeholder')->active[Placefix::_('SVIEWS')] - = $view['settings']->CODE; - - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onBeforeBuildSiteViewContent - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeBuildSiteViewContent', - array(&$this->componentContext, &$view, - &$view['settings']->code, - &$this->fileContentStatic, - &$this->fileContentDynamic[$view['settings']->code], - &$this->placeholders, &$this->hhh) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - - // set license per view if needed - $this->setLockLicensePer( - $view['settings']->code, CFactory::_('Config')->build_target - ); - - // set the site default view - if (isset($view['default_view']) - && $view['default_view'] == 1) - { - $this->fileContentStatic[Placefix::_h('SITE_DEFAULT_VIEW')] - = $view['settings']->code; - } - // add site menu - if (isset($view['menu']) && $view['menu'] == 1) - { - // SITE_MENU_XML <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_MENU_XML')] - = $this->setCustomViewMenu($view); - } - - // insure the needed route helper is loaded - $this->fileContentStatic[Placefix::_h('ROUTEHELPER')] - .= $this->setRouterHelp( - $view['settings']->code, $view['settings']->code, true - ); - // build route details - $this->fileContentStatic[Placefix::_h('ROUTER_PARSE_SWITCH')] - .= $this->routerParseSwitch( - $view['settings']->code, $view - ); - $this->fileContentStatic[Placefix::_h('ROUTER_BUILD_VIEWS')] - .= $this->routerBuildViews($view['settings']->code); - - if ($view['settings']->main_get->gettype == 1) - { - // set user permission access check USER_PERMISSION_CHECK_ACCESS <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('USER_PERMISSION_CHECK_ACCESS')] - = $this->setUserPermissionCheckAccess($view, 1); - - // SITE_BEFORE_GET_ITEM <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_BEFORE_GET_ITEM')] - = CFactory::_('Customcode.Dispenser')->get( - CFactory::_('Config')->build_target . '_php_before_getitem', - $view['settings']->code, '', null, true - ); - - // SITE_GET_ITEM <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_GET_ITEM')] - = $this->setCustomViewGetItem( - $view['settings']->main_get, - $view['settings']->code, Indent::_(2) - ); - - // SITE_AFTER_GET_ITEM <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_AFTER_GET_ITEM')] - = CFactory::_('Customcode.Dispenser')->get( - CFactory::_('Config')->build_target . '_php_after_getitem', - $view['settings']->code, '', null, true - ); - } - elseif ($view['settings']->main_get->gettype == 2) - { - // set user permission access check USER_PERMISSION_CHECK_ACCESS <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('USER_PERMISSION_CHECK_ACCESS')] - = $this->setUserPermissionCheckAccess($view, 2); - // SITE_GET_LIST_QUERY <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_GET_LIST_QUERY')] - = $this->setCustomViewListQuery( - $view['settings']->main_get, $view['settings']->code - ); - - // SITE_BEFORE_GET_ITEMS <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_BEFORE_GET_ITEMS')] - = CFactory::_('Customcode.Dispenser')->get( - CFactory::_('Config')->build_target . '_php_before_getitems', - $view['settings']->code, PHP_EOL, null, true - ); - - // SITE_GET_ITEMS <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_GET_ITEMS')] - = $this->setCustomViewGetItems( - $view['settings']->main_get, $view['settings']->code - ); - - // SITE_AFTER_GET_ITEMS <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_AFTER_GET_ITEMS')] - = CFactory::_('Customcode.Dispenser')->get( - CFactory::_('Config')->build_target . '_php_after_getitems', - $view['settings']->code, PHP_EOL, null, true - ); - } - // add to lang array - CFactory::_('Language')->set( - 'site', - CFactory::_('Config')->lang_prefix . '_' . $view['settings']->CODE, - $view['settings']->name - ); - CFactory::_('Language')->set( - 'site', - CFactory::_('Config')->lang_prefix . '_' . $view['settings']->CODE - . '_DESC', $view['settings']->description - ); - // SITE_CUSTOM_METHODS <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_CUSTOM_METHODS')] - = $this->setCustomViewCustomItemMethods( - $view['settings']->main_get, $view['settings']->code - ); - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_CUSTOM_METHODS')] - .= $this->setCustomViewCustomMethods( - $view, $view['settings']->code - ); - // SITE_DIPLAY_METHOD <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_DIPLAY_METHOD')] - = $this->setCustomViewDisplayMethod($view); - // set document details - $this->setPrepareDocument($view); - // SITE_EXTRA_DIPLAY_METHODS <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_EXTRA_DIPLAY_METHODS')] - = $this->setCustomViewExtraDisplayMethods($view); - // SITE_CODE_BODY <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_CODE_BODY')] - = $this->setCustomViewCodeBody($view); - // SITE_BODY <<>> - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_BODY')] - = $this->setCustomViewBody($view); - - // setup the templates - $this->setCustomViewTemplateBody($view); - - // set the site form if needed - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_TOP_FORM')] - = $this->setCustomViewForm( - $view['settings']->code, - $view['settings']->main_get->gettype, 1 - ); - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_BOTTOM_FORM')] - = $this->setCustomViewForm( - $view['settings']->code, - $view['settings']->main_get->gettype, 2 - ); - - // set headers based on the main get type - if ($view['settings']->main_get->gettype == 1) - { - // insure the controller headers are added - if (StringHelper::check( - $view['settings']->php_controller - ) - && $view['settings']->php_controller != '//') - { - // SITE_VIEW_CONTROLLER_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_VIEW_CONTROLLER_HEADER')] - = $this->setFileHeader( - 'site.view.controller', $view['settings']->code - ); - } - // SITE_VIEW_MODEL_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_VIEW_MODEL_HEADER')] - = $this->setFileHeader( - 'site.view.model', $view['settings']->code - ); - // SITE_VIEW_HTML_HEADER <<>> add the header details for the view - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_VIEW_HTML_HEADER')] - = $this->setFileHeader( - 'site.view.html', $view['settings']->code - ); - // SITE_VIEW_HEADER <<>> add the header details for the view - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_VIEW_HEADER')] - = $this->setFileHeader( - 'site.view', $view['settings']->code - ); - } - elseif ($view['settings']->main_get->gettype == 2) - { - // insure the controller headers are added - if (StringHelper::check( - $view['settings']->php_controller - ) - && $view['settings']->php_controller != '//') - { - // SITE_VIEW_CONTROLLER_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_VIEW_CONTROLLER_HEADER')] - = $this->setFileHeader( - 'site.views.controller', $view['settings']->code - ); - } - // SITE_VIEWS_MODEL_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_VIEWS_MODEL_HEADER')] - = $this->setFileHeader( - 'site.views.model', $view['settings']->code - ); - // SITE_VIEWS_HTML_HEADER <<>> add the header details for the view - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_VIEWS_HTML_HEADER')] - = $this->setFileHeader( - 'site.views.html', $view['settings']->code - ); - // SITE_VIEWS_HEADER <<>> add the header details for the view - $this->fileContentDynamic[$view['settings']->code][Placefix::_h('SITE_VIEWS_HEADER')] - = $this->setFileHeader( - 'site.views', $view['settings']->code - ); - } - - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onAfterBuildSiteViewContent - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterBuildSiteViewContent', - array(&$this->componentContext, &$view, - &$view['settings']->code, - &$this->fileContentStatic, - &$this->fileContentDynamic[$view['settings']->code], - &$this->placeholders, &$this->hhh) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - } - - // setup the layouts - $this->setCustomViewLayouts(); - } - else - { - // clear all site folder since none is needed - $this->removeSiteFolder = true; - } - // load the site statics - if (!$this->removeSiteFolder || !$this->removeSiteEditFolder) - { - CFactory::_('Config')->build_target = 'site'; - // if no default site view was set, the redirect to root - if (!isset( - $this->fileContentStatic[Placefix::_h('SITE_DEFAULT_VIEW')] - )) - { - $this->fileContentStatic[Placefix::_h('SITE_DEFAULT_VIEW')] - = ''; - } - // set site custom script to helper class - // SITE_CUSTOM_HELPER_SCRIPT - $this->fileContentStatic[Placefix::_h('SITE_CUSTOM_HELPER_SCRIPT')] - = CFactory::_('Placeholder')->update( - CFactory::_('Customcode.Dispenser')->hub['component_php_helper_site'], - CFactory::_('Placeholder')->active - ); - // SITE_GLOBAL_EVENT_HELPER - if (!isset($this->fileContentStatic[Placefix::_h('SITE_GLOBAL_EVENT')])) - { - $this->fileContentStatic[Placefix::_h('SITE_GLOBAL_EVENT')] = ''; - } - if (!isset($this->fileContentStatic[Placefix::_h('SITE_GLOBAL_EVENT_HELPER')])) - { - $this->fileContentStatic[Placefix::_h('SITE_GLOBAL_EVENT_HELPER')] = ''; - } - // now load the data for the global event if needed - if ($this->componentData->add_site_event == 1) - { - $this->fileContentStatic[Placefix::_h('SITE_GLOBAL_EVENT')] - .= PHP_EOL . PHP_EOL . '// Trigger the Global Site Event'; - $this->fileContentStatic[Placefix::_h('SITE_GLOBAL_EVENT')] - .= PHP_EOL . $this->fileContentStatic[Placefix::_h('Component')] - . 'Helper::globalEvent($document);'; - // SITE_GLOBAL_EVENT_HELPER - $this->fileContentStatic[Placefix::_h('SITE_GLOBAL_EVENT_HELPER')] - .= PHP_EOL . PHP_EOL . Indent::_(1) . '/**'; - $this->fileContentStatic[Placefix::_h('SITE_GLOBAL_EVENT_HELPER')] - .= PHP_EOL . Indent::_(1) - . '* The Global Site Event Method.'; - $this->fileContentStatic[Placefix::_h('SITE_GLOBAL_EVENT_HELPER')] - .= PHP_EOL . Indent::_(1) . '**/'; - $this->fileContentStatic[Placefix::_h('SITE_GLOBAL_EVENT_HELPER')] - .= PHP_EOL . Indent::_(1) - . 'public static function globalEvent($document)'; - $this->fileContentStatic[Placefix::_h('SITE_GLOBAL_EVENT_HELPER')] - .= PHP_EOL . Indent::_(1) . '{'; - $this->fileContentStatic[Placefix::_h('SITE_GLOBAL_EVENT_HELPER')] - .= PHP_EOL . CFactory::_('Placeholder')->update( - CFactory::_('Customcode.Dispenser')->hub['component_php_site_event'], - CFactory::_('Placeholder')->active - ); - $this->fileContentStatic[Placefix::_h('SITE_GLOBAL_EVENT_HELPER')] - .= PHP_EOL . Indent::_(1) . '}'; - } - } - - // PREINSTALLSCRIPT - $this->fileContentStatic[Placefix::_h('PREINSTALLSCRIPT')] - = CFactory::_('Customcode.Dispenser')->get( - 'php_preflight', 'install', PHP_EOL, null, true - ); - - // PREUPDATESCRIPT - $this->fileContentStatic[Placefix::_h('PREUPDATESCRIPT')] - = CFactory::_('Customcode.Dispenser')->get( - 'php_preflight', 'update', PHP_EOL, null, true - ); - - // POSTINSTALLSCRIPT - $this->fileContentStatic[Placefix::_h('POSTINSTALLSCRIPT')] - = $this->setPostInstallScript(); - - // POSTUPDATESCRIPT - $this->fileContentStatic[Placefix::_h('POSTUPDATESCRIPT')] - = $this->setPostUpdateScript(); - - // UNINSTALLSCRIPT - $this->fileContentStatic[Placefix::_h('UNINSTALLSCRIPT')] - = $this->setUninstallScript(); - - // MOVEFOLDERSSCRIPT - $this->fileContentStatic[Placefix::_h('MOVEFOLDERSSCRIPT')] - = $this->setMoveFolderScript(); - - // MOVEFOLDERSMETHOD - $this->fileContentStatic[Placefix::_h('MOVEFOLDERSMETHOD')] - = $this->setMoveFolderMethod(); - - // HELPER_UIKIT - $this->fileContentStatic[Placefix::_h('HELPER_UIKIT')] - = $this->setUikitHelperMethods(); - - // CONFIG_FIELDSETS - $this->fileContentStatic[Placefix::_h('CONFIG_FIELDSETS')] - = implode(PHP_EOL, $this->configFieldSets); - - // check if this has been set - if (!isset( - $this->fileContentStatic[Placefix::_h('ROUTER_BUILD_VIEWS')] - ) - || !StringHelper::check( - $this->fileContentStatic[Placefix::_h('ROUTER_BUILD_VIEWS')] - )) - { - $this->fileContentStatic[Placefix::_h('ROUTER_BUILD_VIEWS')] - = 0; - } - else - { - $this->fileContentStatic[Placefix::_h('ROUTER_BUILD_VIEWS')] - = '(' . $this->fileContentStatic[Placefix::_h('ROUTER_BUILD_VIEWS')] . ')'; - } - - // README - if ($this->componentData->addreadme) - { - $this->fileContentStatic[Placefix::_h('README')] - = $this->componentData->readme; - } - // remove all the power placeholders - $this->fileContentStatic[Placefix::_h('ADMIN_POWER_HELPER')] = ''; - $this->fileContentStatic[Placefix::_h('SITE_POWER_HELPER')] = ''; - $this->fileContentStatic[Placefix::_h('CUSTOM_POWER_AUTOLOADER')] = ''; - // infuse powers data if set - if (ArrayHelper::check(CFactory::_('Power')->active)) - { - // start the autoloader - $autoloader = array(); - foreach (CFactory::_('Power')->active as $power) - { - if (ObjectHelper::check($power)) - { - // Trigger Event: jcb_ce_onBeforeInfusePowerData - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeInfusePowerData', - array(&$this->componentContext, &$power, &$this) - ); - // POWERCODE - $this->fileContentDynamic[$power->key][Placefix::_h('POWERCODE')] - = $this->getPowerCode($power); - // build the autoloader - $autoloader[implode('.', $power->_namespace_prefix)] = $power->_namespace_prefix; - // Trigger Event: jcb_ce_onAfterInfusePowerData - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterInfusePowerData', - array(&$this->componentContext, &$power, &$this) - ); - } - } - // now set the power autoloader - $this->setPowersAutoloader($autoloader, (!$this->removeSiteFolder || !$this->removeSiteEditFolder)); - } - // tweak system to set stuff to the module domain - $_backup_target = CFactory::_('Config')->build_target; - $_backup_lang = CFactory::_('Config')->lang_target; - $_backup_langPrefix = CFactory::_('Config')->lang_prefix; - // infuse module data if set - if (ArrayHelper::check($this->joomlaModules)) - { - foreach ($this->joomlaModules as $module) - { - if (ObjectHelper::check($module)) - { - // Trigger Event: jcb_ce_onBeforeInfuseModuleData - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeInfuseModuleData', - array(&$this->componentContext, &$module, &$this) - ); - CFactory::_('Config')->build_target = $module->key; - CFactory::_('Config')->lang_target = $module->key; - $this->langPrefix = $module->lang_prefix; - CFactory::_('Config')->set('lang_prefix', $module->lang_prefix); - // MODCODE - $this->fileContentDynamic[$module->key][Placefix::_h('MODCODE')] - = $this->getModCode($module); - // DYNAMICGET - $this->fileContentDynamic[$module->key][Placefix::_h('DYNAMICGETS')] - = $this->setCustomViewCustomMethods( - $module, $module->key - ); - // HELPERCODE - if ($module->add_class_helper >= 1) - { - $this->fileContentDynamic[$module->key][Placefix::_h('HELPERCODE')] - = $this->getModHelperCode($module); - } - // MODDEFAULT - $this->fileContentDynamic[$module->key][Placefix::_h('MODDEFAULT')] - = $this->getModDefault($module, $module->key); - // only add install script if needed - if ($module->add_install_script) - { - // INSTALLCLASS - $this->fileContentDynamic[$module->key][Placefix::_h('INSTALLCLASS')] - = CFactory::_J('Extension.InstallScript')->get($module); - } - // FIELDSET - if (isset($module->form_files) - && ArrayHelper::check( - $module->form_files - )) - { - foreach ($module->form_files as $file => $files) - { - foreach ($files as $field_name => $fieldsets) - { - foreach ($fieldsets as $fieldset => $fields) - { - // FIELDSET_ . $file.$field_name.$fieldset - $this->fileContentDynamic[$module->key][Placefix::_h('FIELDSET_' - . $file . $field_name . $fieldset)] - = $this->getExtensionFieldsetXML( - $module, $fields - ); - } - } - } - } - // MAINXML - $this->fileContentDynamic[$module->key][Placefix::_h('MAINXML')] - = $this->getModuleMainXML($module); - // Trigger Event: jcb_ce_onAfterInfuseModuleData - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterInfuseModuleData', - array(&$this->componentContext, &$module, &$this) - ); - } - } - } - // infuse plugin data if set - if (ArrayHelper::check($this->joomlaPlugins)) - { - foreach ($this->joomlaPlugins as $plugin) - { - if (ObjectHelper::check($plugin)) - { - // Trigger Event: jcb_ce_onBeforeInfusePluginData - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeInfusePluginData', - array(&$this->componentContext, &$plugin, &$this) - ); - CFactory::_('Config')->build_target = $plugin->key; - CFactory::_('Config')->lang_target = $plugin->key; - $this->langPrefix = $plugin->lang_prefix; - CFactory::_('Config')->set('lang_prefix', $plugin->lang_prefix); - // MAINCLASS - $this->fileContentDynamic[$plugin->key][Placefix::_h('MAINCLASS')] - = $this->getPluginMainClass($plugin); - // only add install script if needed - if ($plugin->add_install_script) - { - // INSTALLCLASS - $this->fileContentDynamic[$plugin->key][Placefix::_h('INSTALLCLASS')] - = CFactory::_J('Extension.InstallScript')->get($plugin); - } - // FIELDSET - if (isset($plugin->form_files) - && ArrayHelper::check( - $plugin->form_files - )) - { - foreach ($plugin->form_files as $file => $files) - { - foreach ($files as $field_name => $fieldsets) - { - foreach ($fieldsets as $fieldset => $fields) - { - // FIELDSET_ . $file.$field_name.$fieldset - $this->fileContentDynamic[$plugin->key][Placefix::_h( - 'FIELDSET_' . $file . $field_name . $fieldset)] - = $this->getExtensionFieldsetXML( - $plugin, $fields - ); - } - } - } - } - // MAINXML - $this->fileContentDynamic[$plugin->key][Placefix::_h('MAINXML')] - = $this->getPluginMainXML($plugin); - // Trigger Event: jcb_ce_onAfterInfusePluginData - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterInfusePluginData', - array(&$this->componentContext, &$plugin, &$this) - ); - } - } - } - // rest globals - CFactory::_('Config')->build_target = $_backup_target; - CFactory::_('Config')->lang_target = $_backup_lang; - $this->langPrefix = $_backup_langPrefix; - CFactory::_('Config')->set('lang_prefix', $_backup_langPrefix); - // for plugin event TODO change event api signatures - $this->placeholders = CFactory::_('Placeholder')->active; - // Trigger Event: jcb_ce_onAfterBuildFilesContent - CFactory::_J('Event')->trigger( - 'jcb_ce_onAfterBuildFilesContent', - array(&$this->componentContext, &$this->componentData, - &$this->fileContentStatic, &$this->fileContentDynamic, - &$this->placeholders, &$this->hhh) - ); - // for plugin event TODO change event api signatures - CFactory::_('Placeholder')->active = $this->placeholders; - - return true; - } - - return false; - } - - /** - * Set the view place holders to global scope - * - * @param object $view The view settings - * - * @ return void - */ - protected function setViewPlaceholders(&$view) - { - // just to be safe, lets clear previous view placeholders - CFactory::_('Placeholder')->clearType('view'); - - // VIEW <<>> - if (isset($view->name_single) && $view->name_single != 'null') - { - // set main keys - $nameSingleCode = $view->name_single_code; - $name_single_uppercase = StringHelper::safe( - $view->name_single, 'U' - ); - $name_single_first_uppercase = StringHelper::safe( - $view->name_single, 'F' - ); - - // set some place holder for the views - CFactory::_('Placeholder')->active[Placefix::_h('view')] - = $nameSingleCode; - CFactory::_('Placeholder')->active[Placefix::_h('View')] - = $name_single_first_uppercase; - CFactory::_('Placeholder')->active[Placefix::_h('VIEW')] - = $name_single_uppercase; - CFactory::_('Placeholder')->active[Placefix::_('view')] - = $nameSingleCode; - CFactory::_('Placeholder')->active[Placefix::_('View')] - = $name_single_first_uppercase; - CFactory::_('Placeholder')->active[Placefix::_('VIEW')] - = $name_single_uppercase; - } - - // VIEWS <<>> - if (isset($view->name_list) && $view->name_list != 'null') - { - $nameListCode = $view->name_list_code; - $name_list_uppercase = StringHelper::safe( - $view->name_list, 'U' - ); - $name_list_first_uppercase = StringHelper::safe( - $view->name_list, 'F' - ); - - // set some place holder for the views - CFactory::_('Placeholder')->active[Placefix::_h('views')] - = $nameListCode; - CFactory::_('Placeholder')->active[Placefix::_h('Views')] - = $name_list_first_uppercase; - CFactory::_('Placeholder')->active[Placefix::_h('VIEWS')] - = $name_list_uppercase; - CFactory::_('Placeholder')->active[Placefix::_('views')] - = $nameListCode; - CFactory::_('Placeholder')->active[Placefix::_('Views')] - = $name_list_first_uppercase; - CFactory::_('Placeholder')->active[Placefix::_('VIEWS')] - = $name_list_uppercase; - } - - // view <<>> - if (isset($nameSingleCode)) - { - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('view')] - = $nameSingleCode; - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('VIEW')] - = $name_single_uppercase; - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('View')] - = $name_single_first_uppercase; - - if (isset($nameListCode)) - { - $this->fileContentDynamic[$nameListCode][Placefix::_h('view')] - = $nameSingleCode; - $this->fileContentDynamic[$nameListCode][Placefix::_h('VIEW')] - = $name_single_uppercase; - $this->fileContentDynamic[$nameListCode][Placefix::_h('View')] - = $name_single_first_uppercase; - } - } - - // views <<>> - if (isset($nameListCode)) - { - $this->fileContentDynamic[$nameListCode][Placefix::_h('views')] - = $nameListCode; - $this->fileContentDynamic[$nameListCode][Placefix::_h('VIEWS')] - = $name_list_uppercase; - $this->fileContentDynamic[$nameListCode][Placefix::_h('Views')] - = $name_list_first_uppercase; - - if (isset($nameSingleCode)) - { - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('views')] - = $nameListCode; - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('VIEWS')] - = $name_list_uppercase; - $this->fileContentDynamic[$nameSingleCode][Placefix::_h('Views')] - = $name_list_first_uppercase; - } - } - } - - /** - * Build the language values and insert into file - * - * @return boolean on success - * - */ - public function setLangFileData() - { - // reset values - $values = array(); - $mainLangLoader = array(); - // check the admin lang is set - if ($this->setLangAdmin()) - { - $values[] = array_values( - $this->languages['components'][CFactory::_('Config')->get('lang_tag', 'en-GB')]['admin'] - ); - $mainLangLoader['admin'] = count( - $this->languages['components'][CFactory::_('Config')->get('lang_tag', 'en-GB')]['admin'] - ); - } - // check the admin system lang is set - if ($this->setLangAdminSys()) - { - $values[] = array_values( - $this->languages['components'][CFactory::_('Config')->get('lang_tag', 'en-GB')]['adminsys'] - ); - $mainLangLoader['adminsys'] = count( - $this->languages['components'][CFactory::_('Config')->get('lang_tag', 'en-GB')]['adminsys'] - ); - } - // check the site lang is set - if ((!$this->removeSiteFolder || !$this->removeSiteEditFolder) - && $this->setLangSite()) - { - $values[] = array_values( - $this->languages['components'][CFactory::_('Config')->get('lang_tag', 'en-GB')]['site'] - ); - $mainLangLoader['site'] = count( - $this->languages['components'][CFactory::_('Config')->get('lang_tag', 'en-GB')]['site'] - ); - } - // check the site system lang is set - if ((!$this->removeSiteFolder || !$this->removeSiteEditFolder) - && $this->setLangSiteSys()) - { - $values[] = array_values( - $this->languages['components'][CFactory::_('Config')->get('lang_tag', 'en-GB')]['sitesys'] - ); - $mainLangLoader['sitesys'] = count( - $this->languages['components'][CFactory::_('Config')->get('lang_tag', 'en-GB')]['sitesys'] - ); - } - $values = array_unique(ArrayHelper::merge($values)); - // get the other lang strings if there is any - $this->multiLangString = $this->getMultiLangStrings($values); - // update insert the current lang in to DB - $this->setLangPlaceholders($values, CFactory::_('Config')->component_id); - // remove old unused language strings - $this->purgeLanuageStrings($values, CFactory::_('Config')->component_id); - // path to INI file - $getPAth = $this->templatePath . '/en-GB.com_admin.ini'; - // Trigger Event: jcb_ce_onBeforeBuildAllLangFiles - CFactory::_J('Event')->trigger( - 'jcb_ce_onBeforeBuildAllLangFiles', - array(&$this->componentContext, &$this->languages['components'], - &$this->langTag) - ); - // for plugin event TODO change event api signatures - CFactory::_('Config')->lang_tag = $this->langTag; - // now we insert the values into the files - if (ArrayHelper::check($this->languages['components'])) - { - // rest xml array - $langXML = array(); - foreach ($this->languages['components'] as $tag => $areas) - { - // trim the tag - $tag = trim($tag); - foreach ($areas as $area => $languageStrings) - { - // set naming convention - $p = 'admin'; - $t = ''; - if (strpos($area, 'site') !== false) - { - if ($this->removeSiteFolder - && $this->removeSiteEditFolder) - { - continue; - } - $p = 'site'; - } - if (strpos($area, 'sys') !== false) - { - $t = '.sys'; - } - // build the file name - $file_name = $tag . '.com_' . CFactory::_('Config')->component_code_name . $t - . '.ini'; - // check if language should be added - if ($this->shouldLanguageBeAdded( - $tag, $languageStrings, $mainLangLoader[$area], - $file_name - )) - { - // build the path to place the lang file - $path = $this->componentPath . '/' . $p . '/language/' - . $tag . '/'; - if (!Folder::exists($path)) - { - Folder::create($path); - // count the folder created - $this->folderCount++; - } - // move the file to its place - File::copy($getPAth, $path . $file_name); - // count the file created - $this->fileCount++; - // add content to it - $lang = array_map( - function ($langstring, $placeholder) { - return $placeholder . '="' . $langstring . '"'; - }, array_values($languageStrings), - array_keys($languageStrings) - ); - // add to language file - $this->writeFile( - $path . $file_name, implode(PHP_EOL, $lang) - ); - // set the line counter - $this->lineCount = $this->lineCount + count( - (array) $lang - ); - unset($lang); - // build xml strings - if (!isset($langXML[$p])) - { - $langXML[$p] = array(); - } - $langXML[$p][] = 'language/' - . $tag . '/' . $file_name . ''; - } - } - } - // load the lang xml - if (ArrayHelper::check($langXML)) - { - $replace = array(); - if (isset($langXML['admin']) - && ArrayHelper::check($langXML['admin'])) - { - $replace[Placefix::_h('ADMIN_LANGUAGES')] - = implode(PHP_EOL . Indent::_(3), $langXML['admin']); - } - if ((!$this->removeSiteFolder || !$this->removeSiteEditFolder) - && isset($langXML['site']) - && ArrayHelper::check($langXML['site'])) - { - $replace[Placefix::_h('SITE_LANGUAGES')] - = implode(PHP_EOL . Indent::_(2), $langXML['site']); - } - // build xml path - $xmlPath = $this->componentPath . '/' . CFactory::_('Config')->component_code_name - . '.xml'; - // get the content in xml - $componentXML = FileHelper::getContent( - $xmlPath - ); - // update the xml content - $componentXML = CFactory::_('Placeholder')->update($componentXML, $replace); - // store the values back to xml - $this->writeFile($xmlPath, $componentXML); - } - } - } - -} diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 98e6cfb74..b1a970aff 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -12,62 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// register this component namespace -spl_autoload_register(function ($class) { - // project-specific base directories and namespace prefix - $search = array( - 'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla', - 'libraries/jcb_powers/VDM.Gitea' => 'VDM\\Gitea' - ); - // Start the search and load if found - $found = false; - $found_base_dir = ""; - $found_len = 0; - foreach ($search as $base_dir => $prefix) - { - // does the class use the namespace prefix? - $len = strlen($prefix); - if (strncmp($prefix, $class, $len) === 0) - { - // we have a match so load the values - $found = true; - $found_base_dir = $base_dir; - $found_len = $len; - // done here - break; - } - } - // check if we found a match - if (!$found) - { - // no, move to the next registered autoloader - return; - } - // get the relative class name - $relative_class = substr($class, $found_len); - // replace the namespace prefix with the base directory, replace namespace - // separators with directory separators in the relative class name, append - // with .php - $file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; - // if the file exists, require it - if (file_exists($file)) - { - require $file; - } -}); +// The power autoloader for this project admin area. +$power_autoloader = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/powerloader.php'; +if (file_exists($power_autoloader)) +{ + require_once $power_autoloader; +} +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Access\Access; +use Joomla\CMS\Access\Rules as AccessRules; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filesystem\File; use Joomla\CMS\Language\Language; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Object\CMSObject; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Version; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; -use Joomla\Archive\Archive; -use Joomla\CMS\Filesystem\File; -use Joomla\CMS\Filesystem\Folder; +use Joomla\Archive\Archive; +use Joomla\CMS\Filesystem\Folder; use Joomla\CMS\Filesystem\Path; -use VDM\Joomla\Utilities; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Openai\Factory as OpenaiFactory; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\FileHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\FieldHelper; +use VDM\Joomla\Componentbuilder\Compiler\Factory as CompilerFactory; +use VDM\Joomla\Utilities\Base64Helper; +use VDM\Joomla\FOF\Encrypt\AES; +use VDM\Joomla\Utilities\String\ClassfunctionHelper; +use VDM\Joomla\Utilities\String\FieldHelper as StringFieldHelper; +use VDM\Joomla\Utilities\String\TypeHelper; +use VDM\Joomla\Utilities\String\NamespaceHelper; +use VDM\Joomla\Utilities\MathHelper; +use VDM\Joomla\Utilities\String\PluginHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\Component\Helper; +use VDM\Joomla\Utilities\FormHelper; /** * Componentbuilder component helper. @@ -75,23 +68,18 @@ abstract class ComponentbuilderHelper { /** - * Adding the utilities trait to this class + * Composer Switch * - * @deprecated 4.0 - Check the trait methods for details, a legacy implementation - */ - use Utilities; - - /** - * get the Component Code Name + * @var array */ - public static $ComponentCodeName = 'componentbuilder'; + protected static $composer = []; /** - * Composer Switch - * - * @var array + * The Main Active Language + * + * @var string */ - protected static $composer = array(); + public static $langTag; /** * The Global Admin Event Method. @@ -103,6 +91,11 @@ public static function globalEvent($document) } + /** + * Just to Add the OPEN AI api to JCB (soon) + * OpenaiFactory + **/ + /** * Locked Libraries (we can not have these change) **/ @@ -221,9 +214,9 @@ public static function getClassCode($id, $type) if ('property' === $type || 'method' === $type) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. $query = $db->getQuery(true); // get method @@ -257,7 +250,7 @@ public static function getClassCode($id, $type) // combine method values $combinded = array(); // add comment if set - if (self::checkString($code->comment)) + if (UtilitiesStringHelper::check($code->comment)) { $comment = array_map('trim', (array) explode(PHP_EOL, base64_decode($code->comment))); $combinded[] = "\t" . implode(PHP_EOL . "\t ", $comment); @@ -266,7 +259,7 @@ public static function getClassCode($id, $type) if ('method' === $type) { // set the method signature - if (self::checkString($code->arguments)) + if (UtilitiesStringHelper::check($code->arguments)) { $combinded[] = "\t" . $code->visibility . ' function ' . $code->name . '(' . base64_decode($code->arguments) . ')'; } @@ -277,7 +270,7 @@ public static function getClassCode($id, $type) // set the method code $combinded[] = "\t" . "{"; // add code if set - if (self::checkString(trim($code->code))) + if (UtilitiesStringHelper::check(trim($code->code))) { $combinded[] = base64_decode($code->code); } @@ -289,7 +282,7 @@ public static function getClassCode($id, $type) } else { - if (self::checkString($code->default)) + if (UtilitiesStringHelper::check($code->default)) { $code->default = base64_decode($code->default); if (is_int($code->default)) @@ -303,12 +296,12 @@ public static function getClassCode($id, $type) $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ' = ' . (float) $code->default . ';'; } elseif (('false' === $code->default || 'true' === $code->default) - || (self::checkString($code->default) && (strpos($code->default, 'array(') !== false || strpos($code->default, '"') !== false))) + || (UtilitiesStringHelper::check($code->default) && (strpos($code->default, 'array(') !== false || strpos($code->default, '"') !== false))) { // set the class property $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ' = ' . $code->default . ';'; } - elseif (self::checkString($code->default) && strpos($code->default, '"') === false) + elseif (UtilitiesStringHelper::check($code->default) && strpos($code->default, '"') === false) { // set the class property $combinded[] = "\t" . $code->visibility . ' $' . $code->name . ' = "' . $code->default . '";'; @@ -342,11 +335,11 @@ public static function getClassCode($id, $type) **/ public static function extractBoilerplateClassExtends(&$class, $type) { - if (($strings = self::getAllBetween($class, 'class ', '}')) !== false && self::checkArray($strings)) + if (($strings = GetHelper::allBetween($class, 'class ', '}')) !== false && UtilitiesArrayHelper::check($strings)) { foreach ($strings as $string) { - if (($extends = self::getBetween($string, 'extends ', '{')) !== false && self::checkString($extends)) + if (($extends = GetHelper::between($string, 'extends ', '{')) !== false && UtilitiesStringHelper::check($extends)) { return trim($extends); } @@ -366,10 +359,10 @@ public static function extractBoilerplateClassExtends(&$class, $type) **/ public static function extractBoilerplateClassHeader(&$class, $extends, $type) { - if (($string = self::getBetween($class, "defined('_JEXEC')", 'extends ' . $extends)) !== false && self::checkString($string)) + if (($string = GetHelper::between($class, "defined('_JEXEC')", 'extends ' . $extends)) !== false && UtilitiesStringHelper::check($string)) { $headArray = explode(PHP_EOL, $string); - if (self::checkArray($headArray) && count($headArray) > 3) + if (UtilitiesArrayHelper::check($headArray) && count($headArray) > 3) { // remove first since it still has the [or die;] string in it array_shift($headArray); @@ -391,7 +384,7 @@ public static function extractBoilerplateClassHeader(&$class, $extends, $type) } } // make sure we only return if we have values - if (self::checkArray($headArray)) + if (UtilitiesArrayHelper::check($headArray)) { return implode(PHP_EOL, $headArray); } @@ -411,10 +404,10 @@ public static function extractBoilerplateClassHeader(&$class, $extends, $type) **/ public static function extractBoilerplateClassComment(&$class, $extends, $type) { - if (($string = self::getBetween($class, "defined('_JEXEC')", 'extends ' . $extends)) !== false && self::checkString($string)) + if (($string = GetHelper::between($class, "defined('_JEXEC')", 'extends ' . $extends)) !== false && UtilitiesStringHelper::check($string)) { $headArray = explode(PHP_EOL, $string); - if (self::checkArray($headArray) && count($headArray) > 3) + if (UtilitiesArrayHelper::check($headArray) && count($headArray) > 3) { $comment = array(); // remove the last since it has the class declaration @@ -435,7 +428,7 @@ public static function extractBoilerplateClassComment(&$class, $extends, $type) } } // make sure we only return if we have values - if (self::checkArray($comment)) + if (UtilitiesArrayHelper::check($comment)) { // set the correct order ksort($comment); @@ -464,7 +457,7 @@ public static function extractBoilerplateClassPropertiesMethods(&$class, $extend // get the class code, and remove the head $codeArrayTmp = explode('extends ' . $extends, $class); // make sure we have the correct result - if (self::checkArray($codeArrayTmp) && count($codeArrayTmp) == 2) + if (UtilitiesArrayHelper::check($codeArrayTmp) && count($codeArrayTmp) == 2) { // the triggers $triggers = array('public' => 1, 'protected' => 2, 'private' => 3); @@ -489,12 +482,12 @@ public static function extractBoilerplateClassPropertiesMethods(&$class, $extend // build filter $filters = array('extension_type' => $type); // add more data based on target - if ('method' === $target && self::checkArray($tmp)) + if ('method' === $target && UtilitiesArrayHelper::check($tmp)) { // clean the code self::cleanBoilerplateCode($tmp); // only load if there are values - if (self::checkArray($tmp, true)) + if (UtilitiesArrayHelper::check($tmp, true)) { $_tmp['code'] = implode(PHP_EOL, $tmp); } @@ -503,7 +496,7 @@ public static function extractBoilerplateClassPropertiesMethods(&$class, $extend $_tmp['code'] = ''; } // load arguments only if set - if (self::checkString($arg)) + if (UtilitiesStringHelper::check($arg)) { $_tmp['arguments'] = $arg; } @@ -511,13 +504,13 @@ public static function extractBoilerplateClassPropertiesMethods(&$class, $extend elseif ('property' === $target) { // load default only if set - if (self::checkString($arg)) + if (UtilitiesStringHelper::check($arg)) { $_tmp['default'] = $arg; } } // load comment only if set - if (self::checkArray($comment, true)) + if (UtilitiesArrayHelper::check($comment, true)) { $_tmp['comment'] = implode(PHP_EOL, $comment); } @@ -577,9 +570,9 @@ public static function extractBoilerplateClassPropertiesMethods(&$class, $extend { $target = 'method'; // get the name - $name = trim(self::getBetween($line, 'function ', '(')); + $name = trim(GetHelper::between($line, 'function ', '(')); // get the arguments - $arg = trim(self::getBetween($line, ' ' . $name . '(', ')')); + $arg = trim(GetHelper::between($line, ' ' . $name . '(', ')')); } else { @@ -587,14 +580,14 @@ public static function extractBoilerplateClassPropertiesMethods(&$class, $extend if (strpos($line, '=') !== false) { // get the name - $name = trim(self::getBetween($line, '$', '=')); + $name = trim(GetHelper::between($line, '$', '=')); // get the default - $arg = trim(self::getBetween($line, '=', ';')); + $arg = trim(GetHelper::between($line, '=', ';')); } else { // get the name - $name = trim(self::getBetween($line, '$', ';')); + $name = trim(GetHelper::between($line, '$', ';')); } } } @@ -627,7 +620,7 @@ protected static function getLocalBoilerplate($name, $table, $extension_type, $f if ('property' === $table || 'method' === $table) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); // get method @@ -636,7 +629,7 @@ protected static function getLocalBoilerplate($name, $table, $extension_type, $f $query->where($db->quoteName('a.name') . ' = ' . $db->quote($name)); $query->where($db->quoteName('a.extension_type') . ' = ' . $db->quote($extension_type)); // add more filters - if (self::checkArray($filters)) + if (UtilitiesArrayHelper::check($filters)) { foreach($filters as $where => $value) { @@ -677,7 +670,7 @@ protected static function cleanBoilerplateCode(&$code) $found = true; } // remove empty lines - elseif (!self::checkString(trim($code[$key]))) + elseif (!UtilitiesStringHelper::check(trim($code[$key]))) { unset($code[$key]); } @@ -706,7 +699,7 @@ protected static function cleanBoilerplateCode(&$code) $last = 0; } // remove empty lines - elseif (!self::checkString(trim($code[$last]))) + elseif (!UtilitiesStringHelper::check(trim($code[$last]))) { unset($code[$last]); } @@ -744,7 +737,7 @@ public static function getExistingValidationRuleNames($lowercase = false) // change back to Joomla working directory chdir($joomla); // make sure we have an array - if (!self::checkArray($items)) + if (!UtilitiesArrayHelper::check($items)) { return false; } @@ -756,7 +749,7 @@ public static function getExistingValidationRuleNames($lowercase = false) self::set('_existing_validation_rules_VDM', json_encode($items)); } // make sure it is no longer json - if (self::checkJson($items)) + if (JsonHelper::check($items)) { $items = json_decode($items, true); } @@ -789,8 +782,8 @@ public static function getContributorDetails($filename, $type = 'snippet') case 'snippet': $path = self::$snippetPath.$filename; // get the file if available - $content = self::getFileContents($path); - if (self::checkJson($content)) + $content = FileHelper::getContent($path); + if (JsonHelper::check($content)) { $content = json_decode($content, true); } @@ -801,7 +794,7 @@ public static function getContributorDetails($filename, $type = 'snippet') break; } // see if we have content and all needed details - if (isset($content) && self::checkArray($content) + if (isset($content) && UtilitiesArrayHelper::check($content) && isset($content['contributor_company']) && isset($content['contributor_name']) && isset($content['contributor_email']) @@ -811,12 +804,12 @@ public static function getContributorDetails($filename, $type = 'snippet') return array('contributor_company' => $content['contributor_company'] ,'contributor_name' => $content['contributor_name'], 'contributor_email' => $content['contributor_email'], 'contributor_website' => $content['contributor_website'], 'origin' => 'file'); } // get the global settings - if (!self::checkObject(self::$params)) + if (!ObjectHelper::check(self::$params)) { - self::$params = JComponentHelper::getParams('com_componentbuilder'); + self::$params = ComponentHelper::getParams('com_componentbuilder'); } // get the global company details - if (!self::checkArray(self::$localCompany)) + if (!UtilitiesArrayHelper::check(self::$localCompany)) { // Set the person sharing information (default VDM ;) self::$localCompany['company'] = self::$params->get('export_company', 'Vast Development Method'); @@ -841,7 +834,7 @@ public static function getLibraryFiles($id) // get the library files, folders, and urls $files = array(); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); $query->select($db->quoteName(array('b.name','a.addurls','a.addfolders','a.addfiles'))); @@ -855,19 +848,19 @@ public static function getLibraryFiles($id) // prepare the files $result = $db->loadObject(); // first we load the URLs - if (self::checkJson($result->addurls)) + if (JsonHelper::check($result->addurls)) { // convert to array $result->addurls = json_decode($result->addurls, true); // set urls - if (self::checkArray($result->addurls)) + if (UtilitiesArrayHelper::check($result->addurls)) { // build media folder path - $mediaPath = '/media/' . strtolower( preg_replace('/\s+/', '-', self::safeString($result->name, 'filename', ' ', false))); + $mediaPath = '/media/' . strtolower( preg_replace('/\s+/', '-', UtilitiesStringHelper::safe($result->name, 'filename', ' ', false))); // load the urls foreach($result->addurls as $url) { - if (isset($url['url']) && self::checkString($url['url'])) + if (isset($url['url']) && UtilitiesStringHelper::check($url['url'])) { // set the path if needed if (isset($url['type']) && $url['type'] > 1) @@ -893,25 +886,25 @@ public static function getLibraryFiles($id) if (isset($url['path'])) { // load document script - $files[md5($url['path'])] = '(' . JText::_('URL') . ') ' . basename($url['url']) . ' - ' . JText::_('COM_COMPONENTBUILDER_LOCAL'); + $files[md5($url['path'])] = '(' . Text::_('URL') . ') ' . basename($url['url']) . ' - ' . Text::_('COM_COMPONENTBUILDER_LOCAL'); } // check if link must be added if (isset($url['url']) && ((isset($url['type']) && $url['type'] == 1) || (isset($url['type']) && $url['type'] == 3) || !isset($url['type']))) { // load url also if not building document - $files[md5($url['url'])] = '(' . JText::_('URL') . ') ' . basename($url['url']) . ' - ' . JText::_('COM_COMPONENTBUILDER_LINK'); + $files[md5($url['url'])] = '(' . Text::_('URL') . ') ' . basename($url['url']) . ' - ' . Text::_('COM_COMPONENTBUILDER_LINK'); } } } } } // load the local files - if (self::checkJson($result->addfiles)) + if (JsonHelper::check($result->addfiles)) { // convert to array $result->addfiles = json_decode($result->addfiles, true); // set files - if (self::checkArray($result->addfiles)) + if (UtilitiesArrayHelper::check($result->addfiles)) { foreach($result->addfiles as $file) { @@ -923,29 +916,29 @@ public static function getLibraryFiles($id) if (isset($pathInfo['extension']) && $pathInfo['extension']) { // load document script - $files[md5($path)] = '(' . JText::_('COM_COMPONENTBUILDER_FILE') . ') ' . $file['file']; + $files[md5($path)] = '(' . Text::_('COM_COMPONENTBUILDER_FILE') . ') ' . $file['file']; } else { // load document script - $files[md5($path.'/'.trim($file['file'],'/'))] = '(' . JText::_('COM_COMPONENTBUILDER_FILE') . ') ' . $file['file']; + $files[md5($path.'/'.trim($file['file'],'/'))] = '(' . Text::_('COM_COMPONENTBUILDER_FILE') . ') ' . $file['file']; } } } } } // load the files in the folder - if (self::checkJson($result->addfolders)) + if (JsonHelper::check($result->addfolders)) { // convert to array $result->addfolders = json_decode($result->addfolders, true); // set folder - if (self::checkArray($result->addfolders)) + if (UtilitiesArrayHelper::check($result->addfolders)) { // get the global settings - if (!self::checkObject(self::$params)) + if (!ObjectHelper::check(self::$params)) { - self::$params = JComponentHelper::getParams('com_componentbuilder'); + self::$params = ComponentHelper::getParams('com_componentbuilder'); } // reset bucket $bucket = array(); @@ -960,7 +953,7 @@ public static function getLibraryFiles($id) $customFolder = '/'.trim($folder['folder'], '/'); if (isset($folder['rename']) && 1 == $folder['rename']) { - if ($_paths = self::getAllFilePaths($customPath.$customFolder)) + if ($_paths = FileHelper::getPaths($customPath.$customFolder)) { $bucket[$_path] = $_paths; } @@ -968,7 +961,7 @@ public static function getLibraryFiles($id) else { $path = $_path.$customFolder; - if ($_paths = self::getAllFilePaths($customPath.$customFolder)) + if ($_paths = FileHelper::getPaths($customPath.$customFolder)) { $bucket[$path] = $_paths; } @@ -976,21 +969,21 @@ public static function getLibraryFiles($id) } } // now load the script - if (self::checkArray($bucket)) + if (UtilitiesArrayHelper::check($bucket)) { foreach ($bucket as $root => $paths) { // load per path foreach($paths as $path) { - $files[md5($root.'/'.trim($path, '/'))] = '(' . JText::_('COM_COMPONENTBUILDER_FOLDER') . ') ' . basename($path) . ' - ' . basename($root); + $files[md5($root.'/'.trim($path, '/'))] = '(' . Text::_('COM_COMPONENTBUILDER_FOLDER') . ') ' . basename($path) . ' - ' . basename($root); } } } } } // return files if found - if (self::checkArray($files)) + if (UtilitiesArrayHelper::check($files)) { return $files; } @@ -1015,7 +1008,7 @@ public static function getLibraryFiles($id) public static function fixPath(&$values, $targets = array()) { // if multiple to gets searched and fixed - if (self::checkArray($values) && self::checkArray($targets)) + if (UtilitiesArrayHelper::check($values) && UtilitiesArrayHelper::check($targets)) { foreach ($targets as $target) { @@ -1026,7 +1019,7 @@ public static function fixPath(&$values, $targets = array()) } } // if just a string - elseif (self::checkString($values) && strpos($values, '\\') !== false) + elseif (UtilitiesStringHelper::check($values) && strpos($values, '\\') !== false) { $values = str_replace('\\', '/', $values); } @@ -1038,7 +1031,7 @@ public static function fixPath(&$values, $targets = array()) public static function getComponentIDs() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); $query->select($db->quoteName(array('id'))); @@ -1071,8 +1064,6 @@ public static function autoLoader($type = 'compiler') { // 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) @@ -1084,15 +1075,6 @@ public static function autoLoader($type = 'compiler') jimport('joomla.application'); } - /** - * The dynamic builder of views, tables and fields - **/ - public static function dynamicBuilder(&$data, $type) - { - self::autoLoader('extrusion'); - $extruder = new Extrusion($data); - } - /* * Convert repeatable field to subform * @@ -1104,14 +1086,14 @@ public static function dynamicBuilder(&$data, $type) public static function convertRepeatable($item, $name) { // continue only if we have an array - if (self::checkArray($item)) + if (UtilitiesArrayHelper::check($item)) { $bucket = array(); foreach ($item as $key => $values) { foreach ($values as $nr => $value) { - if (!isset($bucket[$name . $nr]) || !self::checkArray($bucket[$name . $nr])) + if (!isset($bucket[$name . $nr]) || !UtilitiesArrayHelper::check($bucket[$name . $nr])) { $bucket[$name . $nr] = array(); } @@ -1140,19 +1122,19 @@ public static function convertRepeatableFields($object, $searcher, $updater = ar if (isset($object->{$key})) { $isJson = false; - if (self::checkJson($object->{$key})) + if (JsonHelper::check($object->{$key})) { $object->{$key} = json_decode($object->{$key}, true); $isJson = true; } // check if this is old values for repeatable fields - if (self::checkArray($object->{$key}) && isset($object->{$key}[$sleutel])) + if (UtilitiesArrayHelper::check($object->{$key}) && isset($object->{$key}[$sleutel])) { // load it back $object->{$key} = self::convertRepeatable($object->{$key}, $key); // add to global updater if ( - self::checkArray($object->{$key}) && self::checkArray($updater) && + UtilitiesArrayHelper::check($object->{$key}) && UtilitiesArrayHelper::check($updater) && ( ( isset($updater['table']) && isset($updater['val']) && isset($updater['key']) ) || ( isset($updater['unique']) && isset($updater['unique'][$key]) && isset($updater['unique'][$key]['table']) && isset($updater['unique'][$key]['val']) && isset($updater['unique'][$key]['key']) ) @@ -1176,13 +1158,13 @@ public static function convertRepeatableFields($object, $searcher, $updater = ar $_table = $updater['table']; } // continue only if values are valid - if (self::checkString($_table) && self::checkString($_key) && $_value > 0) + if (UtilitiesStringHelper::check($_table) && UtilitiesStringHelper::check($_key) && $_value > 0) { // set target table & item $target = trim($_table) . '.' . trim($_key) . '.' . trim($_value); if (!isset(self::$globalUpdater[$target])) { - self::$globalUpdater[$target] = new stdClass; + self::$globalUpdater[$target] = new \stdClass; self::$globalUpdater[$target]->{$_key} = (int) $_value; } // load the new subform values to global updater @@ -1191,12 +1173,12 @@ public static function convertRepeatableFields($object, $searcher, $updater = ar } } // no set back to json if came in as json - if ($isJson && self::checkArray($object->{$key})) + if ($isJson && UtilitiesArrayHelper::check($object->{$key})) { $object->{$key} = json_encode($object->{$key}); } // remove if not json or array - elseif (!self::checkArray($object->{$key}) && !self::checkJson($object->{$key})) + elseif (!UtilitiesArrayHelper::check($object->{$key}) && !JsonHelper::check($object->{$key})) { unset($object->{$key}); } @@ -1214,10 +1196,10 @@ public static function convertRepeatableFields($object, $searcher, $updater = ar public static function runGlobalUpdater() { // check if any updates are set to run - if (self::checkArray(self::$globalUpdater)) + if (UtilitiesArrayHelper::check(self::$globalUpdater)) { // get the database object - $db = JFactory::getDbo(); + $db = Factory::getDbo(); foreach (self::$globalUpdater as $tableKeyID => $object) { // get the table @@ -1247,12 +1229,12 @@ public static function copyItem($id, $type, $config = array()) { // get the model $model = self::getModel($type); - $app = \JFactory::getApplication(); + $app = Factory::getApplication(); // get item if ($item = $model->getItem($id)) { // update values that should change - if (self::checkArray($config)) + if (UtilitiesArrayHelper::check($config)) { foreach($config as $key => $value) { @@ -1396,12 +1378,12 @@ protected static function setSessionDefaults() public static function newHash($hash, $name = 'backup', $type = 'hash', $key = '', $fileType = 'txt') { // make sure we have a hash - if (self::checkString($hash)) + if (UtilitiesStringHelper::check($hash)) { // first get the file path - $path_filename = self::getFilePath('path', $name.$type, $fileType, $key, JPATH_COMPONENT_ADMINISTRATOR); + $path_filename = FileHelper::getPath('path', $name.$type, $fileType, $key, JPATH_COMPONENT_ADMINISTRATOR); // set as read if not already set - if ($content = self::getFileContents($path_filename, false)) + if ($content = FileHelper::getContent($path_filename, false)) { if ($hash == $content) { @@ -1409,7 +1391,7 @@ public static function newHash($hash, $name = 'backup', $type = 'hash', $key = ' } } // set the hash - return self::writeFile($path_filename, $hash); + return FileHelper::write($path_filename, $hash); } return false; } @@ -1429,14 +1411,14 @@ public static function newHash($hash, $name = 'backup', $type = 'hash', $key = ' public static function getPackageOwnerDetailsDisplay(&$info, $trust = false) { $hasOwner = false; - $ownerDetails = ''; + $ownerDetails = ''; $ownerDetails .= '
'; // load the list items foreach (self::$pkOwnerSearch as $key => $dd) { if ($value = self::getPackageOwnerValue($key, $info)) { - $ownerDetails .= JText::sprintf($dd, $value); + $ownerDetails .= Text::sprintf($dd, $value); // check if we have a owner/source name if (('owner' === $key || 'company' === $key) && !$hasOwner) { @@ -1448,18 +1430,18 @@ public static function getPackageOwnerDetailsDisplay(&$info, $trust = false) $ownerDetails .= '
'; // provide some details to how the user can get a key - if ($hasOwner && isset($info['getKeyFrom']['buy_link']) && self::checkString($info['getKeyFrom']['buy_link'])) + if ($hasOwner && isset($info['getKeyFrom']['buy_link']) && UtilitiesStringHelper::check($info['getKeyFrom']['buy_link'])) { $ownerDetails .= '
'; - $ownerDetails .= JText::sprintf('COM_COMPONENTBUILDER_BGET_THE_KEY_FROMB_A_SSA', 'class="btn btn-primary" href="'.$info['getKeyFrom']['buy_link'].'" target="_blank" title="get a key from '.$owner.'"', $owner); + $ownerDetails .= Text::sprintf('COM_COMPONENTBUILDER_BGET_THE_KEY_FROMB_A_SSA', 'class="btn btn-primary" href="'.$info['getKeyFrom']['buy_link'].'" target="_blank" title="get a key from '.$owner.'"', $owner); } // add more custom links - elseif ($hasOwner && isset($info['getKeyFrom']['buy_links']) && self::checkArray($info['getKeyFrom']['buy_links'])) + elseif ($hasOwner && isset($info['getKeyFrom']['buy_links']) && UtilitiesArrayHelper::check($info['getKeyFrom']['buy_links'])) { $buttons = array(); foreach ($info['getKeyFrom']['buy_links'] as $keyName => $link) { - $buttons[] = JText::sprintf('COM_COMPONENTBUILDER_BGET_THE_KEY_FROM_SB_FOR_A_SSA', $owner, 'class="btn btn-primary" href="'.$link.'" target="_blank" title="get a key from '.$owner.'"', $keyName); + $buttons[] = Text::sprintf('COM_COMPONENTBUILDER_BGET_THE_KEY_FROM_SB_FOR_A_SSA', $owner, 'class="btn btn-primary" href="'.$link.'" target="_blank" title="get a key from '.$owner.'"', $keyName); } $ownerDetails .= '
'; $ownerDetails .= implode('
', $buttons); @@ -1467,10 +1449,10 @@ public static function getPackageOwnerDetailsDisplay(&$info, $trust = false) // return the owner details if (!$hasOwner) { - $ownerDetails = '

' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS_NOT_FOUND') . '

'; + $ownerDetails = '

' . Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS_NOT_FOUND') . '

'; if (!$trust) { - $ownerDetails .= '

' . JText::_('COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE') . '

'; + $ownerDetails .= '

' . Text::_('COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE') . '

'; } } return '
'.$ownerDetails.'
'; @@ -1479,7 +1461,7 @@ public static function getPackageOwnerDetailsDisplay(&$info, $trust = false) public static function getPackageOwnerValue($key, &$info) { $source = (isset($info['source']) && isset($info['source'][$key])) ? 'source' : ((isset($info['getKeyFrom']) && isset($info['getKeyFrom'][$key])) ? 'getKeyFrom' : false); - if ($source && self::checkString($info[$source][$key])) + if ($source && UtilitiesStringHelper::check($info[$source][$key])) { return $info[$source][$key]; } @@ -1528,7 +1510,7 @@ public static function getPackageComponentsDetailsDisplay(&$info) { // check if these components need a key $needKey = self::getPackageComponentsKeyStatus($info); - if (isset($info['name']) && self::checkArray($info['name'])) + if (isset($info['name']) && UtilitiesArrayHelper::check($info['name'])) { $cAmount = count((array) $info['name']); $class2 = ($cAmount == 1) ? 'span12' : 'span6'; @@ -1552,11 +1534,11 @@ public static function getPackageComponentsDetailsDisplay(&$info) $display[] = $name; if ($needKey) { - $display[] = ' - ' . JText::sprintf('COM_COMPONENTBUILDER_PAIDLOCKED') . ''; + $display[] = ' - ' . Text::sprintf('COM_COMPONENTBUILDER_PAIDLOCKED') . ''; } else { - $display[] = ' - ' . JText::sprintf('COM_COMPONENTBUILDER_FREEOPEN') . ''; + $display[] = ' - ' . Text::sprintf('COM_COMPONENTBUILDER_FREEOPEN') . ''; } $display[] = '

'; $display[] = $info['short_description'][$key]; @@ -1567,12 +1549,12 @@ public static function getPackageComponentsDetailsDisplay(&$info) { if (isset($info[$li]) && isset($info[$li][$key])) { - $display[] = '
  • '.JText::sprintf($value, $info[$li][$key]).'
  • '; + $display[] = '
  • '.Text::sprintf($value, $info[$li][$key]).'
  • '; } } $display[] = ''; // if we have a source link we add it - if (isset($info['joomla_source_link']) && self::checkArray($info['joomla_source_link']) && isset($info['joomla_source_link'][$key]) && self::checkString($info['joomla_source_link'][$key])) + if (isset($info['joomla_source_link']) && UtilitiesArrayHelper::check($info['joomla_source_link']) && isset($info['joomla_source_link'][$key]) && UtilitiesStringHelper::check($info['joomla_source_link'][$key])) { $display[] = 'source code'; } @@ -1581,7 +1563,7 @@ public static function getPackageComponentsDetailsDisplay(&$info) { if (isset($info[$other]) && isset($info[$other][$key])) { - $display[] = JText::sprintf($value, $info[$other][$key]); + $display[] = Text::sprintf($value, $info[$other][$key]); } } $display[] = '

    '; @@ -1595,7 +1577,7 @@ public static function getPackageComponentsDetailsDisplay(&$info) } return implode("\n",$display); } - return '
    '.JText::_('COM_COMPONENTBUILDER_NO_COMPONENT_DETAILS_FOUND_SO_IT_IS_NOT_SAFE_TO_CONTINUE').'
    '; + return '
    '.Text::_('COM_COMPONENTBUILDER_NO_COMPONENT_DETAILS_FOUND_SO_IT_IS_NOT_SAFE_TO_CONTINUE').'
    '; } /** @@ -1604,16 +1586,16 @@ public static function getPackageComponentsDetailsDisplay(&$info) public static function getDbTableColumns($tableName, $as, $type) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__" . $tableName); // set the type (multi or single) $unique = ''; if (1 == $type) { - $unique = self::safeString($tableName) . '_'; + $unique = UtilitiesStringHelper::safe($tableName) . '_'; } - if (self::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // build the return string $tableColumns = array(); @@ -1632,7 +1614,7 @@ public static function getDbTableColumns($tableName, $as, $type) public static function getViewTableColumns($admin_view, $as, $type) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -1651,10 +1633,10 @@ public static function getViewTableColumns($admin_view, $as, $type) $tableName = ''; if (1 == $type) { - $tableName = self::safeString($result->name_single) . '_'; + $tableName = UtilitiesStringHelper::safe($result->name_single) . '_'; } $addfields = json_decode($result->addfields, true); - if (self::checkArray($addfields)) + if (UtilitiesArrayHelper::check($addfields)) { // reset all buckets $field = array(); @@ -1663,7 +1645,7 @@ public static function getViewTableColumns($admin_view, $as, $type) foreach ($addfields as $nr => $value) { $tmp = self::getFieldNameAndType((int) $value['field']); - if (self::checkArray($tmp)) + if (UtilitiesArrayHelper::check($tmp)) { $field[$nr] = $tmp; } @@ -1684,7 +1666,7 @@ public static function getViewTableColumns($admin_view, $as, $type) // load data foreach ($field as $n => $f) { - if (self::checkArray($f)) + if (UtilitiesArrayHelper::check($f)) { $fields[] = $as . "." . $f['name'] . " AS " . $tableName . $f['name']; } @@ -1712,7 +1694,7 @@ public static function getViewTableColumns($admin_view, $as, $type) public static function getFieldNameAndType($id, $spacers = false) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -1753,11 +1735,11 @@ public static function getFieldNameAndType($id, $spacers = false) } else { - $name = self::safeFieldName(self::getBetween($field->xml,'name="','"')); + $name = self::safeFieldName(GetHelper::between($field->xml,'name="','"')); } // use field core name only if not found in xml - if (!self::checkString($name)) + if (!UtilitiesStringHelper::check($name)) { $name = self::safeFieldName($field->name); } @@ -1780,7 +1762,7 @@ public static function validateUniquePlaceholder($id, $name, $bool = false) if (!$bool) { return array ( - 'message' => JText::_('COM_COMPONENTBUILDER_SORRY_THIS_PLACEHOLDER_IS_ALREADY_IN_USE_IN_THE_COMPILER'), + 'message' => Text::_('COM_COMPONENTBUILDER_SORRY_THIS_PLACEHOLDER_IS_ALREADY_IN_USE_IN_THE_COMPILER'), 'status' => 'danger'); } return false; @@ -1793,7 +1775,7 @@ public static function validateUniquePlaceholder($id, $name, $bool = false) if (!$bool) { return array ( - 'message' => JText::_('COM_COMPONENTBUILDER_SORRY_THIS_PLACEHOLDER_IS_ALREADY_IN_USE'), + 'message' => Text::_('COM_COMPONENTBUILDER_SORRY_THIS_PLACEHOLDER_IS_ALREADY_IN_USE'), 'status' => 'danger'); } return false; @@ -1803,7 +1785,7 @@ public static function validateUniquePlaceholder($id, $name, $bool = false) { return array ( 'name' => $name, - 'message' => JText::_('COM_COMPONENTBUILDER_GREAT_THIS_PLACEHOLDER_WILL_WORK'), + 'message' => Text::_('COM_COMPONENTBUILDER_GREAT_THIS_PLACEHOLDER_WILL_WORK'), 'status' => 'success'); } return true; @@ -1835,7 +1817,7 @@ protected static function placeholderIsSet($id, $name) protected static function getPlaceholderTarget($id, $name) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); $query->select($db->quoteName(array('id', 'target'))); @@ -1864,7 +1846,7 @@ public static function excludePowers($id) if (!isset(self::$exPowers[$id])) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); $query->select($db->quoteName(array('a.id'))); @@ -1887,159 +1869,158 @@ public static function excludePowers($id) } return false; } - /** * The array of dynamic content - * - * @var array + * + * @var array */ - protected static $dynamicContent = array( + protected static array $dynamicContent = [ // The banners by size (width - height) - 'banner' => array( - '728-90' => array( - array( - 'url' => 'https://cdn.joomla.org/volunteers/joomla-heart-wide.gif', + 'banner' => [ + '728-90' => [ + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/banner/joomla-heart-wide.gif', 'hash' => 'f857e3a38facaeac9eba3cffa912b620', - 'html' => 'Joomla! Volunteers Portal'), - array( - 'url' => 'https://magazine.joomla.org/images/banners/JCM_2010_728x90.png', - 'hash' => '4083c66f996279fd5a76adffc3a7d194', - 'html' => 'Joomla! Community Magazine | Because community matters...'), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/banners/tlwebdesign_jcb_sponsor_728_90.png', + 'html' => 'Joomla! Volunteers Portal'], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/banner/JCM_2010_120x600.png', + 'hash' => '5389cf3be8569cb3f6793e8bd4013d19', + 'html' => 'Joomla! Community Magazine | Because community matters...'], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/banner/tlwebdesign_jcb_sponsor_728_90.png', 'hash' => 'd19be1f9f5b2049ff901096aafc246be', - 'html' => 'tlwebdesign a JCB sponsor | Because community matters...'), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/banners/vdm_jcb_sponsor_728_90.gif', + 'html' => 'tlwebdesign a JCB sponsor | Because community matters...'], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/banner/vdm_jcb_sponsor_728_90.gif', 'hash' => '84478dfa0cd880395815e0ee026812a4', - 'html' => 'VDM a JCB sponsor | Because community matters...'), - array( + 'html' => 'VDM a JCB sponsor | Because community matters...'], + [ 'url' => 'https://cms-experts.org/images/banners/agerix/agerix-loves-jcb-728-90.gif', 'hash' => 'b24c0726aa809cdcc04bcffe7e1e1529', - 'html' => 'Agerix a JCB sponsor | Because community matters...') - ), - '160-600' => array( - array( - 'url' => 'https://cdn.joomla.org/volunteers/joomla-heart-tall.gif', + 'html' => 'Agerix a JCB sponsor | Because community matters...'] + ], + '160-600' => [ + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/banner/joomla-heart-tall.gif', 'hash' => '9a75e4929b86c318128b53cf78251678', - 'html' => 'Joomla! Volunteers Portal'), - array( - 'url' => 'https://magazine.joomla.org/images/banners/JCM_2010_120x600.png', + 'html' => 'Joomla! Volunteers Portal'], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/banner/JCM_2010_120x600.png', 'hash' => '5389cf3be8569cb3f6793e8bd4013d19', - 'html' => 'Joomla! Community Magazine | Because community matters...') - ) - ), + 'html' => 'Joomla! Community Magazine | Because community matters...'] + ] + ], // The build-gif by size (width - height) - 'builder-gif' => array( + 'builder-gif' => [ // original gif ;) - '480-272' => array( - array( + '480-272' => [ + [ 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/original.gif', 'hash' => '676e37a949add8f4573381195cd1061c', 'html' => '' - ) - ), + ] + ], // new gif artwork since 2021 - '480-540' => array( - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/1.gif', + '480-540' => [ + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/1.gif', 'hash' => 'ce6e36456fa794ba95d981547b2f54f8', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/2.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/2.gif', 'hash' => '0a54dbc393359747e33db90cabb1e2d7', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/3.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/3.gif', 'hash' => '4e5498713ff69a64a0a79dbf620372a3', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/4.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/4.gif', 'hash' => '3554ffab2a6df95a116fd9f0db63925c', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/5.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/5.gif', 'hash' => '08f0cdf188593eca65c6dafd7af27ef9', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/6.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/6.gif', 'hash' => '103b46a7ac3fcb974e25d06f417a4e87', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/7.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/7.gif', 'hash' => 'ffa8547099b7286f89ab7ff5a140dd90', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/8.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/8.gif', 'hash' => '316df780f9e4ce81200a65d3c4303c41', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/9.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/9.gif', 'hash' => '9ab6ba78b6e63a285fdef2ff5e447c93', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/10.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/10.gif', 'hash' => 'cd9abaa1cb95f51a70916da6b70614f2', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/11.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/11.gif', 'hash' => 'cfe53095b5249618e2348223b89262b9', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/12.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/12.gif', 'hash' => '15a6690647d5160d67c80ce4dd1f5602', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/13.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/13.gif', 'hash' => '2f77562e92c8a3b7c47664c98f551fe8', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/14.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/14.gif', 'hash' => '46db15517ef5bd063be85134e1cc575d', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/15.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/15.gif', 'hash' => 'e6c96eff157ea648ceb1583f2cc22544', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/16.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/16.gif', 'hash' => '76010b7d1f99952eb9645df660467ae8', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/17.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/17.gif', 'hash' => '021219ddd72d8fcfc7f80bd4a874d651', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/18.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/18.gif', 'hash' => '383af3179d4ae27301c1292e630d7155', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/19.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/19.gif', 'hash' => '8537e6d7be93447241b521f851e8a61d', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/20.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/20.gif', 'hash' => '10d96f70e3d43086a925b00a7dc0022e', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/21.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/21.gif', 'hash' => '161de9865b171b44039353b8d50491d3', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/22.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/22.gif', 'hash' => '6a2354e43eb97d278d74bb2c12890988', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/23.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/23.gif', 'hash' => '2cb6e2f9562a8dc8eef6d5d8d1a84f5e', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '), - array( - 'url' => 'https://www.joomlacomponentbuilder.com/images/builder/24.gif', + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '], + [ + 'url' => 'https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/images/builder/24.gif', 'hash' => '745b3fb5e16515689132432bf02ab1b4', - 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    ') - ) - ) - ); + 'html' => '
    Animation produced with 3D Particle Explorations by Jack Rugile.
    '] + ] + ] + ]; /** * get the dynamic content array size @@ -2050,10 +2031,10 @@ public static function excludePowers($id) * @return int on success number of items in array type,size * */ - public static function getDynamicContentSize($type, $size) + public static function getDynamicContentSize(string $type, string $size): int { if (isset(self::$dynamicContent[$type]) && isset(self::$dynamicContent[$type][$size]) - && ($nr = self::checkArray(self::$dynamicContent[$type][$size]))) + && ($nr = UtilitiesArrayHelper::check(self::$dynamicContent[$type][$size]))) { return $nr; } @@ -2063,16 +2044,16 @@ public static function getDynamicContentSize($type, $size) /** * get the dynamic content * - * @param string $type The type of content - * @param string $size The size of the content - * @param mix $default The default to return - * @param int $try Retry tracker (when bigger then array size it stops) - * @param mix $getter The specific getter number (not zero based) + * @param string $type The type of content + * @param string $size The size of the content + * @param mixed $default The default to return + * @param int $try Retry tracker (when bigger then array size it stops) + * @param mixed $getter The specific getter number (not zero based) * * @return string on success html string * */ - public static function getDynamicContent($type, $size, $default = '', $try = 1, $getter = null) + public static function getDynamicContent(string $type, string $size, $default = '', int $try = 1, $getter = null) { if (($nr = self::getDynamicContentSize($type, $size)) !== 0) { @@ -2099,12 +2080,12 @@ public static function getDynamicContent($type, $size, $default = '', $try = 1, // set the local path (in admin area so when the component uninstall these images get removed as well) $path = JPATH_ROOT . "/administrator/components/com_componentbuilder/assets/images/$type/$file_name"; // check if file exist or if it changed - if (($image_data = self::getFileContents($path, false)) === false || + if (($image_data = FileHelper::getContent($path, false)) === false || md5($image_data) !== $target['hash']) { // since the file does not exist or has changed (so we have a new hash) // therefore we download it to validate - if (($image_data = self::getFileContents($target['url'], false)) !== false && + if (($image_data = FileHelper::getContent($target['url'], false)) !== false && md5($image_data) === $target['hash']) { // create the JCB type path if it does not exist @@ -2113,7 +2094,7 @@ public static function getDynamicContent($type, $size, $default = '', $try = 1, Folder::create(JPATH_ROOT . "/administrator/components/com_componentbuilder/assets/images/$type"); } // only set the image if the data match the hash - self::writeFile($path, $image_data); + FileHelper::write($path, $image_data); } // we retry array size times (unless specific getter is used) elseif ($try <= $nr && !$getter) @@ -2123,11 +2104,12 @@ public static function getDynamicContent($type, $size, $default = '', $try = 1, } } // return found content - return str_replace('[[[ROOT-URL]]]', JURI::root(), $target['html']); + return str_replace('[[[ROOT-URL]]]', Uri::root(), $target['html']); } } return $default; - } + } + /** * Tab/spacer bucket (to speed-up the build) @@ -2179,9 +2161,9 @@ public static function _t($nr) **/ public static function loadSession() { - if (!isset(self::$session) || !self::checkObject(self::$session)) + if (!isset(self::$session) || !ObjectHelper::check(self::$session)) { - self::$session = JFactory::getSession(); + self::$session = Factory::getSession(); } // set the defaults self::setSessionDefaults(); @@ -2192,9 +2174,9 @@ public static function loadSession() **/ public static function set($key, $value) { - if (!isset(self::$session) || !self::checkObject(self::$session)) + if (!isset(self::$session) || !ObjectHelper::check(self::$session)) { - self::$session = JFactory::getSession(); + self::$session = Factory::getSession(); } // set to local memory to speed up program self::$localSession[$key] = $value; @@ -2207,9 +2189,9 @@ public static function set($key, $value) **/ public static function get($key, $default = null) { - if (!isset(self::$session) || !self::checkObject(self::$session)) + if (!isset(self::$session) || !ObjectHelper::check(self::$session)) { - self::$session = JFactory::getSession(); + self::$session = Factory::getSession(); } // check if in local memory if (!isset(self::$localSession[$key])) @@ -2227,10 +2209,10 @@ public static function get($key, $default = null) * @return array on success * */ - public static function getFieldTypeProperties($value, $type, $settings = array(), $xml = null, $dbDefaults = false) + public static function getFieldTypeProperties($value, $type, $settings = [], $xml = null, $dbDefaults = false) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -2272,13 +2254,13 @@ public static function getFieldTypeProperties($value, $type, $settings = array() // value to check since there are false and null values even 0 in the values returned $confirmation = '8qvZHoyuFYQqpj0YQbc6F3o5DhBlmS-_-a8pmCZfOVSfANjkmV5LG8pCdAY2JNYu6cB'; // set the headers - $field['values_description'] .= '' . JText::_('COM_COMPONENTBUILDER_PROPERTY') . '' . JText::_('COM_COMPONENTBUILDER_EXAMPLE') . '' . JText::_('COM_COMPONENTBUILDER_DESCRIPTION') . ''; + $field['values_description'] .= '' . Text::_('COM_COMPONENTBUILDER_PROPERTY') . '' . Text::_('COM_COMPONENTBUILDER_EXAMPLE') . '' . Text::_('COM_COMPONENTBUILDER_DESCRIPTION') . ''; foreach ($properties as $property) { - $example = (isset($property['example']) && self::checkString($property['example'])) ? $property['example'] : ''; + $example = (isset($property['example']) && UtilitiesStringHelper::check($property['example'])) ? $property['example'] : ''; $field['values_description'] .= '' . $property['name'] . '' . $example . '' . $property['description'] . ''; // check if we should load the value - $value = self::getValueFromXMLstring($xml, $property['name'], $confirmation); + $value = FieldHelper::getValue($xml, $property['name'], $confirmation); // check if this is a php field $addPHP = false; if (strpos($property['name'], 'type_php') !== false) @@ -2299,7 +2281,7 @@ public static function getFieldTypeProperties($value, $type, $settings = array() } } // was the settings for the property passed - if(self::checkArray($settings) && isset($settings[$property['name']])) + if(UtilitiesArrayHelper::check($settings) && isset($settings[$property['name']])) { // add the xml values $field['values'] .= PHP_EOL . "\t" . $property['name'] . '="'. $settings[$property['name']] . '" '; @@ -2338,7 +2320,7 @@ public static function getFieldTypeProperties($value, $type, $settings = array() $nr++; } // check if all php is loaded using the tracker - if (self::checkString($xml) && isset($phpTracker) && self::checkArray($phpTracker)) + if (UtilitiesStringHelper::check($xml) && isset($phpTracker) && UtilitiesArrayHelper::check($phpTracker)) { foreach ($phpTracker as $phpKey => $start) { @@ -2348,7 +2330,7 @@ public static function getFieldTypeProperties($value, $type, $settings = array() foreach(range(2, 30) as $t_nr) { $get_ = $phpKey . '_' . $t_nr; - if (!isset($field['php'][$phpKey]['value'][$t_nr]) && ($value = self::getValueFromXMLstring($xml, $get_, $confirmation)) !== $confirmation) + if (!isset($field['php'][$phpKey]['value'][$t_nr]) && ($value = FieldHelper::getValue($xml, $get_, $confirmation)) !== $confirmation) { $field['php'][$phpKey]['value'][$t_nr] = $value; } @@ -2378,18 +2360,19 @@ public static function getFieldTypeProperties($value, $type, $settings = array() return false; } + /** + * Get a field value from the XML stored string + * + * @param string $xml The xml string of the field + * @param string $get The value key to get from the string + * @param string $confirmation The value to confirm found value + * + * @return string The field value from xml + * @deprecated 3.3 Use FieldHelper::getValue($xml, $get, $confirmation); + */ public static function getValueFromXMLstring(&$xml, &$get, $confirmation = '') { - if (self::checkString($xml)) - { - // if we have a PHP value, we must base64 decode it - if (strpos($get, 'type_php') !== false) - { - return self::openValidBase64(self::getBetween($xml, $get.'="', '"', $confirmation)); - } - return self::getBetween($xml, $get . '="', '"', $confirmation); - } - return $confirmation; + return FieldHelper::getValue($xml, $get, $confirmation); } @@ -2402,7 +2385,7 @@ public static function getValueFromXMLstring(&$xml, &$get, $confirmation = '') public static function getFieldTypesProperties($targets = array(), $filter = array(), $exclude = array(), $type = 'id', $operator = 'IN') { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -2438,12 +2421,12 @@ public static function getFieldTypesProperties($targets = array(), $filter = arr // add if no objection is found $add = true; // check if we have exclude - if (self::checkArray($exclude) && in_array($property->name, $exclude)) + if (UtilitiesArrayHelper::check($exclude) && in_array($property->name, $exclude)) { continue; } // check if we have filter - if (self::checkArray($filter)) + if (UtilitiesArrayHelper::check($filter)) { foreach($filter as $key => $val) { @@ -2490,76 +2473,79 @@ public static function getFieldTypesProperties($targets = array(), $filter = arr /** * Remove folders with files * - * @param string $dir The path to folder to remove - * @param boolean $ignore The folders and files to ignore and not remove + * @param string $path The path to folder to remove + * @param array|null $ignore The folders and files to ignore and not remove * - * @return boolean True in all is removed - * + * @return bool True if all are removed */ - public static function removeFolder($dir, $ignore = false) + public static function removeFolder(string $path, ?array $ignore = null): bool { - if (Folder::exists($dir)) - { - $it = new RecursiveDirectoryIterator($dir); - $it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); - // remove ending / - $dir = rtrim($dir, '/'); - // now loop the files & folders - foreach ($it as $file) + if (!Folder::exists($path)) + { + return false; + } + + $it = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS); + $files = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST); + + // Prepare a base path without trailing slash for comparison + $basePath = rtrim($path, '/'); + + foreach ($files as $fileinfo) + { + $filePath = $fileinfo->getRealPath(); + + if (self::removeFolderShouldIgnore($basePath, $filePath, $ignore)) { - if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue; - // set file dir - $file_dir = $file->getPathname(); - // check if this is a dir or a file - if ($file->isDir()) - { - $keeper = false; - if (self::checkArray($ignore)) - { - foreach ($ignore as $keep) - { - if (strpos($file_dir, $dir.'/'.$keep) !== false) - { - $keeper = true; - } - } - } - if ($keeper) - { - continue; - } - Folder::delete($file_dir); - } - else - { - $keeper = false; - if (self::checkArray($ignore)) - { - foreach ($ignore as $keep) - { - if (strpos($file_dir, $dir.'/'.$keep) !== false) - { - $keeper = true; - } - } - } - if ($keeper) - { - continue; - } - File::delete($file_dir); - } + continue; } - // delete the root folder if not ignore found - if (!self::checkArray($ignore)) + + if ($fileinfo->isDir()) { - return Folder::delete($dir); + Folder::delete($filePath); + } + else + { + File::delete($filePath); } - return true; } - return false; + + // Delete the root folder if ignore not set + if (!UtilitiesArrayHelper::check($ignore)) + { + return Folder::delete($path); + } + + return true; } + /** + * Check if the current path should be ignored. + * + * @param string $basePath The base directory path + * @param string $filePath The current file or directory path + * @param array|null $ignore List of items to ignore + * + * @return boolean True if the path should be ignored + * @since 3.2.0 + */ + protected static function removeFolderShouldIgnore(string $basePath, string $filePath, ?array $ignore = null): bool + { + if (!$ignore || !UtilitiesArrayHelper::check($ignore)) + { + return false; + } + + foreach ($ignore as $item) + { + if (strpos($filePath, $basePath . '/' . $item) !== false) + { + return true; + } + } + + return false; + } /** * The github access token @@ -2606,12 +2592,12 @@ public static function getGithubRepoData($type, $url, $target = null, $return_ty if (self::urlExists($_url)) { // get the data from github - if (($repoData = self::getFileContents($_url)) !== false && self::checkJson($repoData)) + if (($repoData = FileHelper::getContent($_url)) !== false && JsonHelper::check($repoData)) { $github_returned = json_decode($repoData); - if (self::checkString($target) && - ( (self::checkObject($github_returned) && isset($github_returned->{$target}) && self::checkArray($github_returned->{$target})) || - (self::checkArray($github_returned) && isset($github_returned[$target]) && self::checkArray($github_returned[$target])) )) + if (UtilitiesStringHelper::check($target) && + ( (ObjectHelper::check($github_returned) && isset($github_returned->{$target}) && UtilitiesArrayHelper::check($github_returned->{$target})) || + (UtilitiesArrayHelper::check($github_returned) && isset($github_returned[$target]) && UtilitiesArrayHelper::check($github_returned[$target])) )) { if ('nomemory' !== $type) { @@ -2619,7 +2605,7 @@ public static function getGithubRepoData($type, $url, $target = null, $return_ty self::set($type, $repoData); } } - elseif (!self::checkString($target) && (self::checkArray($github_returned) || (self::checkObject($github_returned) && !isset($github_returned->message)))) + elseif (!UtilitiesStringHelper::check($target) && (UtilitiesArrayHelper::check($github_returned) || (ObjectHelper::check($github_returned) && !isset($github_returned->message)))) { if ('nomemory' !== $type) { @@ -2630,21 +2616,21 @@ public static function getGithubRepoData($type, $url, $target = null, $return_ty // check if we have error message from github elseif (($errorMessage = self::githubErrorHandeler(array('error' => null), $github_returned, $type)) !== false) { - if (isset($errorMessage['error']) && self::checkString($errorMessage['error'])) + if (isset($errorMessage['error']) && UtilitiesStringHelper::check($errorMessage['error'])) { // set the error in the application - JFactory::getApplication()->enqueueMessage($errorMessage['error'], 'Error'); + Factory::getApplication()->enqueueMessage($errorMessage['error'], 'Error'); // set the error also in the class encase it is and Ajax call self::$githubRepoDataErrors[] = $errorMessage['error']; } return false; } - elseif (self::checkString($target)) + elseif (UtilitiesStringHelper::check($target)) { // setup error string - $error = JText::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_S_DATA', $url, $target); + $error = Text::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_S_DATA', $url, $target); // set the error in the application - JFactory::getApplication()->enqueueMessage($error, 'Error'); + Factory::getApplication()->enqueueMessage($error, 'Error'); // set the error also in the class encase it is and Ajax call self::$githubRepoDataErrors[] = $error; // we are done here @@ -2653,9 +2639,9 @@ public static function getGithubRepoData($type, $url, $target = null, $return_ty elseif ('nomemory' !== $type) { // setup error string - $error = JText::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_S_DATA', $url, $type); + $error = Text::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_S_DATA', $url, $type); // set the error in the application - JFactory::getApplication()->enqueueMessage($error, 'Error'); + Factory::getApplication()->enqueueMessage($error, 'Error'); // set the error also in the class encase it is and Ajax call self::$githubRepoDataErrors[] = $error; // we are done here @@ -2664,9 +2650,9 @@ public static function getGithubRepoData($type, $url, $target = null, $return_ty else { // setup error string - $error = JText::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_VALID_DATA', $url, $type); + $error = Text::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_VALID_DATA', $url, $type); // set the error in the application - JFactory::getApplication()->enqueueMessage($error, 'Error'); + Factory::getApplication()->enqueueMessage($error, 'Error'); // set the error also in the class encase it is and Ajax call self::$githubRepoDataErrors[] = $error; // we are done here @@ -2676,9 +2662,9 @@ public static function getGithubRepoData($type, $url, $target = null, $return_ty else { // setup error string - $error = JText::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_RETURN_ANY_DATA', $url); + $error = Text::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_RETURN_ANY_DATA', $url); // set the error in the application - JFactory::getApplication()->enqueueMessage($error, 'Error'); + Factory::getApplication()->enqueueMessage($error, 'Error'); // set the error also in the class encase it is and Ajax call self::$githubRepoDataErrors[] = $error; // we are done here @@ -2688,9 +2674,9 @@ public static function getGithubRepoData($type, $url, $target = null, $return_ty else { // setup error string - $error = JText::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_EXIST', $url); + $error = Text::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_EXIST', $url); // set the error in the application - JFactory::getApplication()->enqueueMessage($error, 'Error'); + Factory::getApplication()->enqueueMessage($error, 'Error'); // set the error also in the class encase it is and Ajax call self::$githubRepoDataErrors[] = $error; // we are done here @@ -2698,7 +2684,7 @@ public static function getGithubRepoData($type, $url, $target = null, $return_ty } } // check if we could find packages - if (isset($repoData) && self::checkJson($repoData)) + if (isset($repoData) && JsonHelper::check($repoData)) { if ('object' === $return_type) { @@ -2721,12 +2707,12 @@ public static function getGithubRepoData($type, $url, $target = null, $return_ty */ protected static function githubErrorHandeler($message, &$github, $type) { - if (self::checkObject($github) && isset($github->message) && self::checkString($github->message)) + if (ObjectHelper::check($github) && isset($github->message) && UtilitiesStringHelper::check($github->message)) { // set the message $errorMessage = $github->message; // add the documentation URL - if (isset($github->documentation_url) && self::checkString($github->documentation_url)) + if (isset($github->documentation_url) && UtilitiesStringHelper::check($github->documentation_url)) { $errorMessage = $errorMessage . '
    ' . $github->documentation_url; } @@ -2738,7 +2724,7 @@ protected static function githubErrorHandeler($message, &$github, $type) $type = 'data'; } // add little more help if it is an access token issue - $errorMessage = JText::sprintf('COM_COMPONENTBUILDER_SBR_YOU_CAN_ADD_A_BGITHUB_ACCESS_TOKENB_TO_COMPONENTBUILDER_GLOBAL_OPTIONS_TO_MAKE_AUTHENTICATED_REQUESTS_TO_GITHUB_AN_ACCESS_TOKEN_WITH_ONLY_PUBLIC_ACCESS_WILL_DO_TO_RETRIEVE_S', $errorMessage, $type); + $errorMessage = Text::sprintf('COM_COMPONENTBUILDER_SBR_YOU_CAN_ADD_A_BGITHUB_ACCESS_TOKENB_TO_COMPONENTBUILDER_GLOBAL_OPTIONS_TO_MAKE_AUTHENTICATED_REQUESTS_TO_GITHUB_AN_ACCESS_TOKEN_WITH_ONLY_PUBLIC_ACCESS_WILL_DO_TO_RETRIEVE_S', $errorMessage, $type); } // set error notice $message['error'] = $errorMessage; @@ -2760,17 +2746,17 @@ protected static function setGithubToken($url) if (strpos($url, 'access_token=') !== false) { // make sure the token is loaded - if (!self::checkString(self::$gitHubAccessToken)) + if (!UtilitiesStringHelper::check(self::$gitHubAccessToken)) { // get the global settings - if (!self::checkObject(self::$params)) + if (!ObjectHelper::check(self::$params)) { - self::$params = JComponentHelper::getParams('com_componentbuilder'); + self::$params = \JComponentHelper::getParams('com_componentbuilder'); } self::$gitHubAccessToken = self::$params->get('github_access_token', null); } // make sure the token is loaded at this point - if (self::checkString(self::$gitHubAccessToken)) + if (UtilitiesStringHelper::check(self::$gitHubAccessToken)) { $url .= '&access_token=' . self::$gitHubAccessToken; } @@ -2828,7 +2814,7 @@ public static function getDynamicScripts($type, $fieldName = false) $script['display'][] = self::_t(3) . "// Include helper submenu"; $script['display'][] = self::_t(3) . "[[[-#-#-Component]]]Helper::addSubmenu('import');"; $script['display'][] = self::_t(2) . "}"; - $script['display'][] = PHP_EOL . self::_t(2) . "\$paths = new stdClass;"; + $script['display'][] = PHP_EOL . self::_t(2) . "\$paths = new \stdClass;"; $script['display'][] = self::_t(2) . "\$paths->first = '';"; $script['display'][] = self::_t(2) . "\$state = \$this->get('state');"; $script['display'][] = PHP_EOL . self::_t(2) . "\$this->paths = &\$paths;"; @@ -2842,7 +2828,7 @@ public static function getDynamicScripts($type, $fieldName = false) $script['display'][] = self::_t(3) . "\$this->sidebar = JHtmlSidebar::render();"; $script['display'][] = self::_t(2) . "}"; $script['display'][] = PHP_EOL . self::_t(2) . "// get the session object"; - $script['display'][] = self::_t(2) . "\$session = JFactory::getSession();"; + $script['display'][] = self::_t(2) . "\$session = Factory::getSession();"; $script['display'][] = self::_t(2) . "// check if it has package"; $script['display'][] = self::_t(2) . "\$this->hasPackage" . self::_t(1) . "= \$session->get('hasPackage', false);"; $script['display'][] = self::_t(2) . "\$this->dataType" . self::_t(1) . "= \$session->get('dataType', false);"; @@ -2875,11 +2861,11 @@ public static function getDynamicScripts($type, $fieldName = false) $script['setdata'][] = self::_t(1) . "**/"; $script['setdata'][] = self::_t(1) . "protected function setData(\$package,\$table,\$target_headers)"; $script['setdata'][] = self::_t(1) . "{"; - $script['setdata'][] = self::_t(2) . "if ([[[-#-#-Component]]]Helper::checkArray(\$target_headers))"; + $script['setdata'][] = self::_t(2) . "if (Super-#-#-___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$target_headers))"; $script['setdata'][] = self::_t(2) . "{"; $script['setdata'][] = self::_t(3) . "// make sure the file is loaded"; $script['setdata'][] = self::_t(3) . "[[[-#-#-Component]]]Helper::composerAutoload('phpspreadsheet');"; - $script['setdata'][] = self::_t(3) . "\$jinput = JFactory::getApplication()->input;"; + $script['setdata'][] = self::_t(3) . "\$jinput = Factory::getApplication()->input;"; $script['setdata'][] = self::_t(3) . "foreach(\$target_headers as \$header)"; $script['setdata'][] = self::_t(3) . "{"; $script['setdata'][] = self::_t(4) . "if ((\$column = \$jinput->getString(\$header, false)) !== false ||"; @@ -2919,16 +2905,16 @@ public static function getDynamicScripts($type, $fieldName = false) $script['headers'][] = self::_t(1) . "public function getExImPortHeaders()"; $script['headers'][] = self::_t(1) . "{"; $script['headers'][] = self::_t(2) . "// Get a db connection."; - $script['headers'][] = self::_t(2) . "\$db = JFactory::getDbo();"; + $script['headers'][] = self::_t(2) . "\$db = Factory::getDbo();"; $script['headers'][] = self::_t(2) . "// get the columns"; $script['headers'][] = self::_t(2) . "\$columns = \$db->getTableColumns(\"#__[[[-#-#-component]]]_[[[-#-#-view]]]\");"; - $script['headers'][] = self::_t(2) . "if ([[[-#-#-Component]]]Helper::checkArray(\$columns))"; + $script['headers'][] = self::_t(2) . "if (Super-#-#-___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$columns))"; $script['headers'][] = self::_t(2) . "{"; $script['headers'][] = self::_t(3) . "// remove the headers you don't import/export."; $script['headers'][] = self::_t(3) . "unset(\$columns['asset_id']);"; $script['headers'][] = self::_t(3) . "unset(\$columns['checked_out']);"; $script['headers'][] = self::_t(3) . "unset(\$columns['checked_out_time']);"; - $script['headers'][] = self::_t(3) . "\$headers = new stdClass();"; + $script['headers'][] = self::_t(3) . "\$headers = new \stdClass();"; $script['headers'][] = self::_t(3) . "foreach (\$columns as \$column => \$type)"; $script['headers'][] = self::_t(3) . "{"; $script['headers'][] = self::_t(4) . "\$headers->{\$column} = \$column;"; @@ -2952,10 +2938,10 @@ public static function getDynamicScripts($type, $fieldName = false) $script['save'][] = self::_t(1) . "protected function save(\$data,\$table)"; $script['save'][] = self::_t(1) . "{"; $script['save'][] = self::_t(2) . "// import the data if there is any"; - $script['save'][] = self::_t(2) . "if([[[-#-#-Component]]]Helper::checkArray(\$data['array']))"; + $script['save'][] = self::_t(2) . "if(Super-#-#-___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$data['array']))"; $script['save'][] = self::_t(2) . "{"; $script['save'][] = self::_t(3) . "// get user object"; - $script['save'][] = self::_t(3) . "\$user" . self::_t(2) . "= JFactory::getUser();"; + $script['save'][] = self::_t(3) . "\$user" . self::_t(2) . "= Factory::getUser();"; $script['save'][] = self::_t(3) . "// remove header if it has headers"; $script['save'][] = self::_t(3) . "\$id_key" . self::_t(1) . "= \$data['target_headers']['id'];"; $script['save'][] = self::_t(3) . "\$published_key" . self::_t(1) . "= \$data['target_headers']['published'];"; @@ -2970,14 +2956,14 @@ public static function getDynamicScripts($type, $fieldName = false) $script['save'][] = self::_t(3) . "}"; $script['save'][] = self::_t(3) . ""; $script['save'][] = self::_t(3) . "// make sure there is still values in array and that it was not only headers"; - $script['save'][] = self::_t(3) . "if([[[-#-#-Component]]]Helper::checkArray(\$data['array']) && \$user->authorise(\$table.'.import', 'com_[[[-#-#-component]]]') && \$user->authorise('core.import', 'com_[[[-#-#-component]]]'))"; + $script['save'][] = self::_t(3) . "if(Super-#-#-___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$data['array']) && \$user->authorise(\$table.'.import', 'com_[[[-#-#-component]]]') && \$user->authorise('core.import', 'com_[[[-#-#-component]]]'))"; $script['save'][] = self::_t(3) . "{"; $script['save'][] = self::_t(4) . "// set target."; $script['save'][] = self::_t(4) . "\$target" . self::_t(1) . "= array_flip(\$data['target_headers']);"; $script['save'][] = self::_t(4) . "// Get a db connection."; - $script['save'][] = self::_t(4) . "\$db = JFactory::getDbo();"; + $script['save'][] = self::_t(4) . "\$db = Factory::getDbo();"; $script['save'][] = self::_t(4) . "// set some defaults"; - $script['save'][] = self::_t(4) . "\$todayDate" . self::_t(2) . "= JFactory::getDate()->toSql();"; + $script['save'][] = self::_t(4) . "\$todayDate" . self::_t(2) . "= Factory::getDate()->toSql();"; $script['save'][] = self::_t(4) . "// get global action permissions"; $script['save'][] = self::_t(4) . "\$canDo" . self::_t(3) . "= [[[-#-#-Component]]]Helper::getActions(\$table);"; $script['save'][] = self::_t(4) . "\$canEdit" . self::_t(2) . "= \$canDo->get('core.edit');"; @@ -3165,7 +3151,7 @@ public static function getDynamicScripts($type, $fieldName = false) { $script['view'] = array(); $script['view'][] = ""; $script['view'][] = ""; $script['view'][] = PHP_EOL . "
    "; - $script['view'][] = "
    \" method=\"post\" name=\"adminForm\" id=\"adminForm\" class=\"form-horizontal form-validate\">"; + $script['view'][] = "\" method=\"post\" name=\"adminForm\" id=\"adminForm\" class=\"form-horizontal form-validate\">"; $script['view'][] = ""; $script['view'][] = PHP_EOL . self::_t(1) . "sidebar)) : ?>"; $script['view'][] = self::_t(2) . "
    "; @@ -3279,7 +3265,7 @@ public static function getDynamicScripts($type, $fieldName = false) $script['view'][] = self::_t(2) . "
    "; $script['view'][] = self::_t(1) . ""; $script['view'][] = ""; - $script['view'][] = PHP_EOL . self::_t(1) . "hasPackage && [[[-#-#-Component]]]Helper::checkArray(\$this->headerList) && [[[-#-#-Component]]]Helper::checkArray(\$this->headers)) : ?>"; + $script['view'][] = PHP_EOL . self::_t(1) . "hasPackage && Super-#-#-___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$this->headerList) && Super-#-#-___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$this->headers)) : ?>"; $script['view'][] = self::_t(2) . "
    "; $script['view'][] = self::_t(3) . ""; $script['view'][] = self::_t(3) . "
    "; @@ -3309,9 +3295,9 @@ public static function getDynamicScripts($type, $fieldName = false) $script['view'][] = self::_t(2) . "
    "; $script['view'][] = self::_t(2) . ""; $script['view'][] = self::_t(1) . ""; - $script['view'][] = self::_t(2) . " 'upload')); ?>"; + $script['view'][] = self::_t(2) . " 'upload')); ?>"; $script['view'][] = self::_t(2) . ""; - $script['view'][] = self::_t(2) . ""; + $script['view'][] = self::_t(2) . ""; $script['view'][] = self::_t(3) . "
    "; $script['view'][] = self::_t(4) . ""; $script['view'][] = self::_t(4) . "
    "; @@ -3324,9 +3310,9 @@ public static function getDynamicScripts($type, $fieldName = false) $script['view'][] = self::_t(5) . "\" onclick=\"Joomla.submitbutton()\" />    (.csv .xls .ods)"; $script['view'][] = self::_t(4) . "
    "; $script['view'][] = self::_t(3) . "
    "; - $script['view'][] = self::_t(2) . ""; + $script['view'][] = self::_t(2) . ""; $script['view'][] = self::_t(2) . ""; - $script['view'][] = self::_t(2) . ""; + $script['view'][] = self::_t(2) . ""; $script['view'][] = self::_t(3) . "
    "; $script['view'][] = self::_t(4) . ""; $script['view'][] = self::_t(4) . "
    "; @@ -3339,9 +3325,9 @@ public static function getDynamicScripts($type, $fieldName = false) $script['view'][] = self::_t(5) . "\" onclick=\"Joomla.submitbutton3()\" />    (.csv .xls .ods)"; $script['view'][] = self::_t(4) . "
    "; $script['view'][] = self::_t(4) . "
    "; - $script['view'][] = self::_t(2) . ""; + $script['view'][] = self::_t(2) . ""; $script['view'][] = ""; - $script['view'][] = PHP_EOL . self::_t(2) . ""; + $script['view'][] = PHP_EOL . self::_t(2) . ""; $script['view'][] = self::_t(3) . "
    "; $script['view'][] = self::_t(4) . ""; $script['view'][] = self::_t(4) . "
    "; @@ -3354,12 +3340,12 @@ public static function getDynamicScripts($type, $fieldName = false) $script['view'][] = self::_t(5) . "\" onclick=\"Joomla.submitbutton4()\" />    (.csv .xls .ods)"; $script['view'][] = self::_t(4) . "
    "; $script['view'][] = self::_t(3) . "
    "; - $script['view'][] = self::_t(2) . ""; - $script['view'][] = self::_t(2) . ""; + $script['view'][] = self::_t(2) . ""; + $script['view'][] = self::_t(2) . ""; $script['view'][] = self::_t(2) . ""; $script['view'][] = self::_t(1) . ""; $script['view'][] = self::_t(1) . ""; - $script['view'][] = self::_t(1) . ""; + $script['view'][] = self::_t(1) . ""; $script['view'][] = ""; $script['view'][] = "
    "; } @@ -3375,8 +3361,8 @@ public static function getDynamicScripts($type, $fieldName = false) $script['import'][] = self::_t(1) . "public function import()"; $script['import'][] = self::_t(1) . "{"; $script['import'][] = self::_t(2) . "\$this->setState('action', 'import');"; - $script['import'][] = self::_t(2) . "\$app" . self::_t(2) . "= JFactory::getApplication();"; - $script['import'][] = self::_t(2) . "\$session" . self::_t(1) . "= JFactory::getSession();"; + $script['import'][] = self::_t(2) . "\$app" . self::_t(2) . "= Factory::getApplication();"; + $script['import'][] = self::_t(2) . "\$session" . self::_t(1) . "= Factory::getSession();"; $script['import'][] = self::_t(2) . "\$package" . self::_t(1) . "= null;"; $script['import'][] = self::_t(2) . "\$continue" . self::_t(1) . "= false;"; $script['import'][] = self::_t(2) . "// get import type"; @@ -3517,6 +3503,7 @@ public static function getDynamicScripts($type, $fieldName = false) /** * Field Grouping https://docs.joomla.org/Form_field + * @deprecated 3.3 **/ protected static $fieldGroups = array( 'default' => array( @@ -3550,6 +3537,9 @@ public static function getDynamicScripts($type, $fieldName = false) ), 'special' => array( 'contentlanguage', 'moduleposition', 'plugin', 'repeatable', 'subform' + ), + 'search' => array( + 'editor', 'email', 'tel', 'text', 'textarea', 'url', 'subform' ) ); @@ -3560,83 +3550,44 @@ public static function getDynamicScripts($type, $fieldName = false) * @param boolean $option The field grouping * * @return boolean if the field was found + * @deprecated 3.3 Use CompilerFactory::_('Field.Groups')->check($type, $option); */ public static function fieldCheck($type, $option = 'default') { - // now check - if (isset(self::$fieldGroups[$option]) && in_array($type, self::$fieldGroups[$option])) - { - return true; - } - return false; + return CompilerFactory::_('Field.Groups')->check($type, $option); } /** * get the field types id -> name of a group or groups * * @return array ids of the spacer field types + * @deprecated 3.3 Use CompilerFactory::_('Field.Groups')->types($groups); */ public static function getFieldTypesByGroup($groups = array()) { - // make sure we have a group - if (($ids = self::getFieldTypesIdsByGroup($groups)) !== false) - { - // get the database object to use quote - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - $query->select($db->quoteName(array('id', 'name'))); - $query->from($db->quoteName('#__componentbuilder_fieldtype')); - $query->where($db->quoteName('published') . ' = 1'); - $query->where($db->quoteName('id') . ' IN (' . implode(',',$ids) . ')'); - // Reset the query using our newly populated query object. - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - return $db->loadAssocList('id', 'name'); - } - } - return false; + return CompilerFactory::_('Field.Groups')->types($groups); } /** * get the field types IDs of a group or groups * * @return array ids of the spacer field types + * @deprecated 3.3 Use CompilerFactory::_('Field.Groups')->typesIds($groups); */ public static function getFieldTypesIdsByGroup($groups = array()) { - // make sure we have a group - if (self::checkArray($groups)) - { - $merge_groups = array(); - foreach ($groups as $group) - { - if (isset(self::$fieldGroups[$group])) - { - $merge_groups[] = self::$fieldGroups[$group]; - } - } - // make sure we have these types of groups - if (self::checkArray($merge_groups)) - { - // get the database object to use quote - $db = JFactory::getDbo(); - return self::getVars('fieldtype', (array) array_map(function($name) use($db) { return $db->quote(ucfirst($name)); }, self::mergeArrays($merge_groups)), 'name', 'id'); - } - } - return false; + return CompilerFactory::_('Field.Groups')->typesIds($groups); } /** * get the spacer IDs * * @return array ids of the spacer field types + * @deprecated 3.3 Use CompilerFactory::_('Field.Groups')->spacerIds(); */ public static function getSpacerIds() { - return self::getFieldTypesIdsByGroup($groups = array('spacer')); + return CompilerFactory::_('Field.Groups')->spacerIds(); } @@ -3648,60 +3599,41 @@ public static function getSpacerIds() * @param string $default The default switch * * @return string The opened string - * + * @deprecated 3.3 Use Base64Helper::open($data, $key, $default); */ public static function openValidBase64($data, $key = '__.o0=base64=Oo.__', $default = 'string') { - // check that we have a string - if (self::checkString($data)) - { - // check if we have a key - if (self::checkString($key)) - { - if (strpos($data, $key) !== false) - { - return base64_decode(str_replace($key, '', $data)); - } - } - // fallback to this, not perfect method - if (base64_encode(base64_decode($data, true)) === $data) - { - return base64_decode($data); - } - } - // check if we should just return the string - if ('string' === $default) - { - return $data; - } - return $default; + return Base64Helper::open($data, $key, $default); } - - /** - * prepare base64 string for url - **/ - public static function base64_urlencode($string, $encode = false) - { - if ($encode) - { - $string = base64_encode($string); - } - return str_replace(array('+', '/'), array('-', '_'), $string); - } - - /** - * prepare base64 string form url - **/ - public static function base64_urldecode($string, $decode = false) - { - $string = str_replace(array('-', '_'), array('+', '/'), $string); - if ($decode) - { - $string = base64_decode($string); - } - return $string; - } + /** + * prepare base64 string for url + * + * @deprecate Use urlencode(); + */ + public static function base64_urlencode($string, $encode = false) + { + if ($encode) + { + $string = base64_encode($string); + } + return str_replace(array('+', '/'), array('-', '_'), $string); + } + + /** + * prepare base64 string form url + * + * @deprecate + */ + public static function base64_urldecode($string, $decode = false) + { + $string = str_replace(array('-', '_'), array('+', '/'), $string); + if ($decode) + { + $string = base64_decode($string); + } + return $string; + } /** @@ -3718,14 +3650,14 @@ public static function base64_urldecode($string, $decode = false) public static function getFolderPath($type = 'path', $target = 'folderpath', $default = '', $createIfNotSet = true) { // make sure to always have a string/path - if(!self::checkString($default)) + if(!UtilitiesStringHelper::check($default)) { $default = JPATH_SITE . '/images/'; } // get the global settings - if (!self::checkObject(self::$params)) + if (!ObjectHelper::check(self::$params)) { - self::$params = JComponentHelper::getParams('com_componentbuilder'); + self::$params = \JComponentHelper::getParams('com_componentbuilder'); } $folderPath = self::$params->get($target, $default); // create the folder if it does not exist @@ -3739,10 +3671,10 @@ public static function getFolderPath($type = 'path', $target = 'folderpath', $de if (strpos($folderPath, JPATH_SITE) !== false) { $folderPath = trim( str_replace( JPATH_SITE, '', $folderPath), '/'); - return JURI::root() . $folderPath . '/'; + return Uri::root() . $folderPath . '/'; } // since the path is behind the root folder of the site, return only the root url (may be used to build the link) - return JURI::root(); + return Uri::root(); } // sanitize the path return '/' . trim( $folderPath, '/' ) . '/'; @@ -3785,7 +3717,7 @@ public static function crypt($type, $mode = null) $key = $type; } // check if it was already set - if (isset(self::$CRYPT[$key]) && self::checkObject(self::$CRYPT[$key])) + if (isset(self::$CRYPT[$key]) && ObjectHelper::check(self::$CRYPT[$key])) { return self::$CRYPT[$key]; } @@ -3797,7 +3729,7 @@ public static function crypt($type, $mode = null) if (!class_exists($CLASS)) { // class not in place so send out error - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_BSB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESPHPSECLIBVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO', $CLASS), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_BSB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESPHPSECLIBVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO', $CLASS), 'Error'); return false; } // does this crypt class use mode @@ -3806,42 +3738,42 @@ public static function crypt($type, $mode = null) 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 - JFactory::getApplication()->enqueueMessage(JText::_('COM_COMPONENTBUILDER_NO_VALID_MODE_HAS_BEEN_SPECIFIED'), 'Error'); + Factory::getApplication()->enqueueMessage(Text::_('COM_COMPONENTBUILDER_NO_VALID_MODE_HAS_BEEN_SPECIFIED'), 'Error'); return false; break; } } else { - // set the + // set the default self::$CRYPT[$key] = new $CLASS(); } // return the object @@ -3870,7 +3802,7 @@ public static function moveToServer($localPath, $fileName, $serverID, $protocol // now move the file if (!$server->store($localPath, $fileName)) { - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER', $fileName, $server->jcb_remote_server_name[(int) $serverID]), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER', $fileName, $server->jcb_remote_server_name[(int) $serverID]), 'Error'); return false; } // close the connection @@ -3882,9 +3814,9 @@ public static function moveToServer($localPath, $fileName, $serverID, $protocol // get the remote path $remote_path = '/' . trim($server->jcb_remote_server_path[(int) $serverID], '/') . '/' . $fileName; // now move the file - if (!$server->put($remote_path, self::getFileContents($localPath, null))) + if (!$server->put($remote_path, FileHelper::getContent($localPath, null))) { - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_PATH_ON_BSB_SERVER', $fileName, $server->jcb_remote_server_path[(int) $serverID], $server->jcb_remote_server_name[(int) $serverID]), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_PATH_ON_BSB_SERVER', $fileName, $server->jcb_remote_server_path[(int) $serverID], $server->jcb_remote_server_name[(int) $serverID]), 'Error'); return false; } } @@ -3946,7 +3878,7 @@ public static function getSftp($serverID, $permission = 'core.export') if ($server = self::getServerDetails($serverID, 2, $permission)) { // check if it was already set - if (!isset(self::$sftp[$server->cache]) || !self::checkObject(self::$sftp[$server->cache])) + if (!isset(self::$sftp[$server->cache]) || !ObjectHelper::check(self::$sftp[$server->cache])) { // make sure we have the composer classes loaded self::composerAutoload('phpseclib'); @@ -3954,7 +3886,7 @@ public static function getSftp($serverID, $permission = 'core.export') if (!class_exists('\phpseclib\Net\SFTP')) { // class not in place so send out error - JFactory::getApplication()->enqueueMessage(JText::_('COM_COMPONENTBUILDER_THE_BPHPSECLIBNETSFTPB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO'), 'Error'); + Factory::getApplication()->enqueueMessage(Text::_('COM_COMPONENTBUILDER_THE_BPHPSECLIBNETSFTPB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO'), 'Error'); return false; } // insure the port is set @@ -3969,102 +3901,102 @@ public static function getSftp($serverID, $permission = 'core.export') case 1: // password if (!self::$sftp[$server->cache]->login($server->username, $server->password)) { - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT', $server->name), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT', $server->name), 'Error'); unset(self::$sftp[$server->cache]); return false; } break; case 2: // private key file - if (self::checkObject(self::crypt('RSA'))) + if (ObjectHelper::check(self::crypt('RSA'))) { // check if we have a passprase - if (self::checkString($server->secret)) + if (UtilitiesStringHelper::check($server->secret)) { self::crypt('RSA')->setPassword($server->secret); } // now load the key file - if (!self::crypt('RSA')->loadKey(self::getFileContents($server->private, null))) + if (!self::crypt('RSA')->loadKey(FileHelper::getContent($server->private, null))) { - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FILE_COULD_NOT_BE_LOADEDFOUND_FOR_BSB_SERVER', $server->name), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FILE_COULD_NOT_BE_LOADEDFOUND_FOR_BSB_SERVER', $server->name), 'Error'); unset(self::$sftp[$server->cache]); return false; } // now login if (!self::$sftp[$server->cache]->login($server->username, self::crypt('RSA'))) { - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT', $server->name), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT', $server->name), 'Error'); unset(self::$sftp[$server->cache]); return false; } } break; case 3: // both password and private key file - if (self::checkObject(self::crypt('RSA'))) + if (ObjectHelper::check(self::crypt('RSA'))) { // check if we have a passphrase - if (self::checkString($server->secret)) + if (UtilitiesStringHelper::check($server->secret)) { self::crypt('RSA')->setPassword($server->secret); } // now load the key file - if (!self::crypt('RSA')->loadKey(self::getFileContents($server->private, null))) + if (!self::crypt('RSA')->loadKey(FileHelper::getContent($server->private, null))) { - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FILE_COULD_NOT_BE_LOADEDFOUND_FOR_BSB_SERVER', $server->name), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FILE_COULD_NOT_BE_LOADEDFOUND_FOR_BSB_SERVER', $server->name), 'Error'); unset(self::$sftp[$server->cache]); return false; } // now login if (!self::$sftp[$server->cache]->login($server->username, $server->password, self::crypt('RSA'))) { - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT', $server->name), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT', $server->name), 'Error'); unset(self::$sftp[$server->cache]); return false; } } break; case 4: // private key field - if (self::checkObject(self::crypt('RSA'))) + if (ObjectHelper::check(self::crypt('RSA'))) { // check if we have a passprase - if (self::checkString($server->secret)) + if (UtilitiesStringHelper::check($server->secret)) { self::crypt('RSA')->setPassword($server->secret); } // now load the key field if (!self::crypt('RSA')->loadKey($server->private_key)) { - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FIELD_COULD_NOT_BE_LOADED_FOR_BSB_SERVER', $server->name), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FIELD_COULD_NOT_BE_LOADED_FOR_BSB_SERVER', $server->name), 'Error'); unset(self::$sftp[$server->cache]); return false; } // now login if (!self::$sftp[$server->cache]->login($server->username, self::crypt('RSA'))) { - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT', $server->name), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT', $server->name), 'Error'); unset(self::$sftp[$server->cache]); return false; } } break; case 5: // both password and private key field - if (self::checkObject(self::crypt('RSA'))) + if (ObjectHelper::check(self::crypt('RSA'))) { // check if we have a passphrase - if (self::checkString($server->secret)) + if (UtilitiesStringHelper::check($server->secret)) { self::crypt('RSA')->setPassword($server->secret); } // now load the key file if (!self::crypt('RSA')->loadKey($server->private_key)) { - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FIELD_COULD_NOT_BE_LOADED_FOR_BSB_SERVER', $server->name), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FIELD_COULD_NOT_BE_LOADED_FOR_BSB_SERVER', $server->name), 'Error'); unset(self::$sftp[$server->cache]); return false; } // now login if (!self::$sftp[$server->cache]->login($server->username, $server->password, self::crypt('RSA'))) { - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT', $server->name), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT', $server->name), 'Error'); unset(self::$sftp[$server->cache]); return false; } @@ -4073,7 +4005,7 @@ public static function getSftp($serverID, $permission = 'core.export') } } // only continue if object is set - if (isset(self::$sftp[$server->cache]) && self::checkObject(self::$sftp[$server->cache])) + if (isset(self::$sftp[$server->cache]) && ObjectHelper::check(self::$sftp[$server->cache])) { // set the unique buckets if (!isset(self::$sftp[$server->cache]->jcb_remote_server_name)) @@ -4083,7 +4015,7 @@ public static function getSftp($serverID, $permission = 'core.export') } // always set the name and remote server path self::$sftp[$server->cache]->jcb_remote_server_name[$serverID] = $server->name; - self::$sftp[$server->cache]->jcb_remote_server_path[$serverID] = (self::checkString($server->path) && $server->path !== '/') ? $server->path : ''; + self::$sftp[$server->cache]->jcb_remote_server_path[$serverID] = (UtilitiesStringHelper::check($server->path) && $server->path !== '/') ? $server->path : ''; // return the sftp object return self::$sftp[$server->cache]; } @@ -4123,12 +4055,12 @@ public static function getFtp($serverID, $permission) } } // make sure we have a string and it is not default or empty - if (self::checkString($server->signature)) + if (UtilitiesStringHelper::check($server->signature)) { // turn into variables parse_str($server->signature); // because of this I am using strange variable naming to avoid any collisions. // set options - if (isset($options) && self::checkArray($options)) + if (isset($options) && UtilitiesArrayHelper::check($options)) { foreach ($options as $o__p0t1on => $vAln3) { @@ -4155,7 +4087,7 @@ public static function getFtp($serverID, $permission) else { // load error to indicate signature was in error - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_FTP_SIGNATURE_FOR_BSB_WAS_NOT_WELL_FORMED_PLEASE_CHECK_YOUR_SIGNATURE_DETAILS', $server->name), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_FTP_SIGNATURE_FOR_BSB_WAS_NOT_WELL_FORMED_PLEASE_CHECK_YOUR_SIGNATURE_DETAILS', $server->name), 'Error'); return false; } // check if we are connected @@ -4177,7 +4109,7 @@ public static function getFtp($serverID, $permission) unset(self::$ftp[$server->cache]); } // load error to indicate signature was in error - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_FTP_CONNECTION_FOR_BSB_COULD_NOT_BE_MADE_PLEASE_CHECK_YOUR_SIGNATURE_DETAILS', $server->name), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_FTP_CONNECTION_FOR_BSB_COULD_NOT_BE_MADE_PLEASE_CHECK_YOUR_SIGNATURE_DETAILS', $server->name), 'Error'); } return false; } @@ -4194,17 +4126,17 @@ public static function getFtp($serverID, $permission) public static function getServerDetails($serverID, $protocol = 2, $permission = 'core.export') { // check if this user has permission to access items - if (!JFactory::getUser()->authorise($permission, 'com_componentbuilder')) + if (!Factory::getUser()->authorise($permission, 'com_componentbuilder')) { // set message to inform the user that permission was denied - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_ACCESS_THE_SERVER_DETAILS_BS_DENIEDB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO', self::safeString($permission, 'w')), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_ACCESS_THE_SERVER_DETAILS_BS_DENIEDB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO', UtilitiesStringHelper::safe($permission, 'w')), 'Error'); return false; } // now insure we have correct values if (is_int($serverID) && is_int($protocol)) { // Get a db connection - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // start the query $query = $db->getQuery(true); // select based to protocol @@ -4233,7 +4165,7 @@ public static function getServerDetails($serverID, $protocol = 2, $permission = // Get the basic encryption. $basickey = self::getCryptKey('basic', 'Th1sMnsTbL0ck@d'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey, 128); + $basic = new AES($basickey, 128); // start cache keys $keys = array(); // unlock the needed fields @@ -4252,7 +4184,7 @@ public static function getServerDetails($serverID, $protocol = 2, $permission = } } // check if cache keys were found - if (self::checkArray($keys)) + if (UtilitiesArrayHelper::check($keys)) { // now set cache $server->cache = md5(implode('', $keys)); @@ -4266,7 +4198,7 @@ public static function getServerDetails($serverID, $protocol = 2, $permission = return $server; } } - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_SERVER_DETAILS_FOR_BID_SB_COULD_NOT_BE_RETRIEVED', $serverID), 'Error'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_SERVER_DETAILS_FOR_BID_SB_COULD_NOT_BE_RETRIEVED', $serverID), 'Error'); return false; } @@ -4285,42 +4217,45 @@ protected static function composephpseclib() /** - * the locker - * - * @var array - **/ - protected static $locker = array(); + * the locker + * + * @var array + * @since 3.1 + */ + protected static array $locker = []; /** - * the dynamic replacement salt - * - * @var array - **/ - protected static $globalSalt = array(); + * the dynamic replacement salt + * + * @var array + * @since 3.1 + */ + protected static array $globalSalt = []; /** - * the timer - * - * @var object - **/ + * the timer + * + * @var object + * @since 3.1 + */ protected static $keytimer; /** - * To Lock string - * - * @param string $string The string/array to lock - * @param string $key The custom key to use - * @param int $salt The switch to add salt and type of salt - * @param int $dynamic The dynamic replacement array of salt build string - * @param int $urlencode The switch to control url encoding - * - * @return string Encrypted String - * - **/ - public static function lock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true) + * To Lock string + * + * @param string $string The string/array to lock + * @param string|null $key The custom key to use + * @param int $salt The switch to add salt and type of salt + * @param int|null $dynamic The dynamic replacement array of salt build string + * @param int $urlencode The switch to control url encoding + * + * @return string Encrypted String + * @since 3.1 + */ + public static function lock(string $string, ?string $key = null, int $salt = 2, ?int $dynamic = null, $urlencode = true): string { // get the global settings - if (!$key || !self::checkString($key)) + if (!$key || !UtilitiesStringHelper::check($key)) { // set temp timer $timer = 2; @@ -4344,12 +4279,12 @@ public static function lock($string, $key = null, $salt = 2, $dynamic = null, $u $key .= self::salt($salt, $dynamic); } // get the locker settings - if (!isset(self::$locker[$key]) || !self::checkObject(self::$locker[$key])) + if (!isset(self::$locker[$key]) || !ObjectHelper::check(self::$locker[$key])) { - self::$locker[$key] = new FOFEncryptAes($key, 128); + self::$locker[$key] = new AES($key, 128); } // convert array or object to string - if (self::checkArray($string) || self::checkObject($string)) + if (UtilitiesArrayHelper::check($string) || ObjectHelper::check($string)) { $string = serialize($string); } @@ -4362,21 +4297,21 @@ public static function lock($string, $key = null, $salt = 2, $dynamic = null, $u } /** - * To un-Lock string - * - * @param string $string The string to unlock - * @param string $key The custom key to use - * @param int $salt The switch to add salt and type of salt - * @param int $dynamic The dynamic replacement array of salt build string - * @param int $urlencode The switch to control url decoding - * - * @return string Decrypted String - * - **/ - public static function unlock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true) + * To un-Lock string + * + * @param string $string The string to unlock + * @param string $key The custom key to use + * @param int $salt The switch to add salt and type of salt + * @param int $dynamic The dynamic replacement array of salt build string + * @param int $urlencode The switch to control url decoding + * + * @return string Decrypted String + * @since 3.1 + */ + public static function unlock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true): string { // get the global settings - if (!$key || !self::checkString($key)) + if (!$key || !UtilitiesStringHelper::check($key)) { // set temp timer $timer = 2; @@ -4400,9 +4335,9 @@ public static function unlock($string, $key = null, $salt = 2, $dynamic = null, $key .= self::salt($salt, $dynamic); } // get the locker settings - if (!isset(self::$locker[$key]) || !self::checkObject(self::$locker[$key])) + if (!isset(self::$locker[$key]) || !ObjectHelper::check(self::$locker[$key])) { - self::$locker[$key] = new FOFEncryptAes($key, 128); + self::$locker[$key] = new AES($key, 128); } // make sure we have real base64 if ($urlencode && method_exists(get_called_class(), "base64_urldecode")) @@ -4419,24 +4354,25 @@ public static function unlock($string, $key = null, $salt = 2, $dynamic = null, $string = unserialize($string); } } + return $string; } /** - * The Salt - * - * @param int $type The type of length the salt should be valid - * @param int $dynamic The dynamic replacement array of salt build string - * - * @return string - * - **/ - public static function salt($type = 1, $dynamic = null) + * The Salt + * + * @param int $type The type of length the salt should be valid + * @param int $dynamic The dynamic replacement array of salt build string + * + * @return string + * @since 3.1 + */ + public static function salt(int $type = 1, $dynamic = null): string { // get dynamic replacement salt $dynamic = self::getDynamicSalt($dynamic); // get the key timer - if (!self::checkObject(self::$keytimer)) + if (!ObjectHelper::check(self::$keytimer)) { // load the date time object self::$keytimer = new DateTime; @@ -4466,7 +4402,7 @@ public static function salt($type = 1, $dynamic = null) $format = 'Y-m-d \o\n H:' . self::periodFix(self::$keytimer->format('i')); } // get key - if (self::checkArray($dynamic)) + if (UtilitiesArrayHelper::check($dynamic)) { return md5(str_replace(array_keys($dynamic), array_values($dynamic), self::$keytimer->format($format) . ' @ VDM.I0')); } @@ -4474,35 +4410,37 @@ public static function salt($type = 1, $dynamic = null) } /** - * The function to insure the salt is valid within the given period (third try) - * - * @param int $main The main number - */ - protected static function periodFix($main) + * The function to insure the salt is valid within the given period (third try) + * + * @param int $main The main number + * @since 3.1 + */ + protected static function periodFix(int $main): int { return round($main / 3) * 3; } /** - * Check if a string is serialized - * - * @param string $string - * - * @return Boolean - * - */ - public static function is_serial($string) + * Check if a string is serialized + * + * @param string $string + * + * @return Boolean + * @since 3.1 + */ + public static function is_serial(string $string): bool { return (@unserialize($string) !== false); } /** - * Get dynamic replacement salt - */ + * Get dynamic replacement salt + * @since 3.1 + */ public static function getDynamicSalt($dynamic = null) { // load global if not manually set - if (!self::checkArray($dynamic)) + if (!UtilitiesArrayHelper::check($dynamic)) { return self::getGlobalSalt(); } @@ -4514,8 +4452,9 @@ public static function getDynamicSalt($dynamic = null) } /** - * The random or dynamic secret salt - */ + * The random or dynamic secret salt + * @since 3.1 + */ public static function getSecretSalt($string = null, $size = 9) { // set the string @@ -4525,7 +4464,7 @@ public static function getSecretSalt($string = null, $size = 9) $string = self::randomkey($size); } // convert string to array - $string = self::safeString($string); + $string = UtilitiesStringHelper::safe($string); // convert string to array $array = str_split($string); // insure only unique values are used @@ -4537,24 +4476,25 @@ public static function getSecretSalt($string = null, $size = 9) } /** - * Get global replacement salt - */ + * Get global replacement salt + * @since 3.1 + */ public static function getGlobalSalt() { // load from memory if found - if (!self::checkArray(self::$globalSalt)) + if (!UtilitiesArrayHelper::check(self::$globalSalt)) { // get the global settings - if (!self::checkObject(self::$params)) + if (!ObjectHelper::check(self::$params)) { - self::$params = JComponentHelper::getParams('com_componentbuilder'); + self::$params = ComponentHelper::getParams('com_componentbuilder'); } // check if we have a global dynamic replacement array available (format --> ' 1->!,3->E,4->A') $tmp = self::$params->get('dynamic_salt', null); - if (self::checkString($tmp) && strpos($tmp, ',') !== false && strpos($tmp, '->') !== false) + if (UtilitiesStringHelper::check($tmp) && strpos($tmp, ',') !== false && strpos($tmp, '->') !== false) { $salt = array_map('trim', (array) explode(',', $tmp)); - if (self::checkArray($salt )) + if (UtilitiesArrayHelper::check($salt )) { foreach($salt as $replace) { @@ -4568,7 +4508,7 @@ public static function getGlobalSalt() } } // return global if found - if (self::checkArray(self::$globalSalt)) + if (UtilitiesArrayHelper::check(self::$globalSalt)) { return self::$globalSalt; } @@ -4577,8 +4517,9 @@ public static function getGlobalSalt() } /** - * Close public protocol - */ + * Close public protocol + * @since 3.1 + */ public static function closePublicProtocol($id, $public) { // get secret salt @@ -4604,8 +4545,9 @@ public static function closePublicProtocol($id, $public) } /** - * Open public protocol - */ + * Open public protocol + * @since 3.1 + */ public static function openPublicProtocol($SECRET, $ID, $PUBLIC) { // get secret salt @@ -4629,44 +4571,48 @@ public static function openPublicProtocol($SECRET, $ID, $PUBLIC) } /** - * Workers to load tasks - * - * @var array - */ - protected static $worker = array(); + * Workers to load tasks + * + * @var array + * @since 3.1 + */ + protected static array $worker = []; /** - * Set a worker dynamic URLs - * - * @var array - */ - protected static $workerURL = array(); + * Set a worker dynamic URLs + * + * @var array + * @since 3.1 + */ + protected static array $workerURL = []; /** - * Set a worker dynamic HEADERs - * - * @var array - */ - protected static $workerHEADER = array(); + * Set a worker dynamic HEADERs + * + * @var array + * @since 3.1 + */ + protected static array $workerHEADER = []; /** - * Curl Error Notice - * - * @var bool - */ - protected static $curlErrorLoaded = false; + * Curl Error Notice + * + * @var bool + * @since 3.1 + */ + protected static bool $curlErrorLoaded = false; /** - * check if a worker has more work - * - * @param string $function The function to target to perform the task - * - * @return bool - * - */ - public static function hasWork(&$function) + * check if a worker has more work + * + * @param string $function The function to target to perform the task + * + * @return bool + * @since 3.1 + */ + public static function hasWork(string $function): bool { - if (isset(self::$worker[$function]) && self::checkArray(self::$worker[$function])) + if (isset(self::$worker[$function]) && UtilitiesArrayHelper::check(self::$worker[$function])) { return count( (array) self::$worker[$function]); } @@ -4674,18 +4620,18 @@ public static function hasWork(&$function) } /** - * Set a worker url - * - * @param string $function The function to target to perform the task - * @param string $url The url of where the task is to be performed - * - * @return void - * - */ - public static function setWorkerUrl(&$function, &$url) + * Set a worker url + * + * @param string $function The function to target to perform the task + * @param string $url The url of where the task is to be performed + * + * @return void + * @since 3.1 + */ + public static function setWorkerUrl(string $function, string $url): void { // set the URL if found - if (self::checkString($url)) + if (UtilitiesStringHelper::check($url)) { // make sure task function url is up self::$workerURL[$function] = $url; @@ -4693,18 +4639,18 @@ public static function setWorkerUrl(&$function, &$url) } /** - * Set a worker headers - * - * @param string $function The function to target to perform the task - * @param array $headers The headers needed for these workers/function - * - * @return void - * - */ - public static function setWorkerHeaders(&$function, &$headers) + * Set a worker headers + * + * @param string $function The function to target to perform the task + * @param array|null $headers The headers needed for these workers/function + * + * @return void + * @since 3.1 + */ + public static function setWorkerHeaders(string $function, ?array $headers): void { // set the Headers if found - if (self::checkArray($headers)) + if (UtilitiesArrayHelper::check($headers)) { // make sure task function headers are set self::$workerHEADER[$function] = $headers; @@ -4712,30 +4658,33 @@ public static function setWorkerHeaders(&$function, &$headers) } /** - * Set a worker that needs to perform a task - * - * @param mixed $data The data to pass to the task - * @param string $function The function to target to perform the task - * @param string $url The url of where the task is to be performed - * @param array $headers The headers needed for these workers/function - * - * @return void - * - */ - public static function setWorker($data, $function, $url = null, $headers = null) + * Set a worker that needs to perform a task + * + * @param mixed $data The data to pass to the task + * @param string $function The function to target to perform the task + * @param string $url The url of where the task is to be performed + * @param array $headers The headers needed for these workers/function + * + * @return void + * @since 3.1 + */ + public static function setWorker($data, string $function, ?string $url = null, ?array $headers = null) { // make sure task function is up if (!isset(self::$worker[$function])) { - self::$worker[$function] = array(); + self::$worker[$function] = []; } + // load the task self::$worker[$function][] = self::lock($data); + // set the Headers if found if ($headers && !isset(self::$workerHEADER[$function])) { self::setWorkerHeaders($function, $headers); } + // set the URL if found if ($url && !isset(self::$workerURL[$function])) { @@ -4744,24 +4693,24 @@ public static function setWorker($data, $function, $url = null, $headers = null) } /** - * Run set Workers - * - * @param string $function The function to target to perform the task - * @param string $perTask The amount of task per worker - * @param function $callback The option to do a call back when task is completed - * @param int $threadSize The size of the thread - * - * @return bool true On success - * - */ - public static function runWorker($function, $perTask = 50, $callback = null, $threadSize = 20) + * Run set Workers + * + * @param string $function The function to target to perform the task + * @param string $perTask The amount of task per worker + * @param function $callback The option to do a call back when task is completed + * @param int $threadSize The size of the thread + * + * @return bool true On success + * @since 3.1 + */ + public static function runWorker(string $function, $perTask = 50, $callback = null, $threadSize = 20): bool { // set task $task = self::lock($function); // build headers $headers = array('VDM-TASK: ' .$task); // build dynamic headers - if (isset(self::$workerHEADER[$function]) && self::checkArray(self::$workerHEADER[$function])) + if (isset(self::$workerHEADER[$function]) && UtilitiesArrayHelper::check(self::$workerHEADER[$function])) { foreach (self::$workerHEADER[$function] as $header) { @@ -4771,7 +4720,7 @@ public static function runWorker($function, $perTask = 50, $callback = null, $th // build worker options $options = array(); // make sure worker is up - if (isset(self::$worker[$function]) && self::checkArray(self::$worker[$function])) + if (isset(self::$worker[$function]) && UtilitiesArrayHelper::check(self::$worker[$function])) { // this load method is for each if (1 == $perTask) @@ -4800,7 +4749,7 @@ public static function runWorker($function, $perTask = 50, $callback = null, $th self::$worker[$function] = array(); } // do the execution - if (self::checkArray($options)) + if (UtilitiesArrayHelper::check($options)) { if (isset(self::$workerURL[$function])) { @@ -4808,7 +4757,7 @@ public static function runWorker($function, $perTask = 50, $callback = null, $th } else { - $url = JURI::root() . '/index.php?option=com_componentbuilder&task=api.worker'; + $url = Uri::root() . '/index.php?option=com_componentbuilder&task=api.worker'; } return self::curlMultiExec($url, $options, $callback, $threadSize); } @@ -4816,16 +4765,16 @@ public static function runWorker($function, $perTask = 50, $callback = null, $th } /** - * Do a multi curl execution of tasks - * - * @param string $url The url of where the task is to be performed - * @param array $_options The array of curl options/headers to set - * @param function $callback The option to do a call back when task is completed - * @param int $threadSize The size of the thread - * - * @return bool true On success - * - */ + * Do a multi curl execution of tasks + * + * @param string $url The url of where the task is to be performed + * @param array $_options The array of curl options/headers to set + * @param function $callback The option to do a call back when task is completed + * @param int $threadSize The size of the thread + * + * @return bool true On success + * @since 3.1 + */ public static function curlMultiExec(&$url, &$_options, $callback = null, $threadSize = 20) { // make sure we have curl available @@ -4834,14 +4783,14 @@ public static function curlMultiExec(&$url, &$_options, $callback = null, $threa if (!self::$curlErrorLoaded) { // set the notice - JFactory::getApplication()->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP'), 'Error'); + Factory::getApplication()->enqueueMessage(Text::_('COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP'), 'Error'); // load the notice only once self::$curlErrorLoaded = true; } return false; } // make sure we have an url - if (self::checkString($url)) + if (UtilitiesStringHelper::check($url)) { // make sure the thread size isn't greater than the # of _options $threadSize = (count($_options) < $threadSize) ? count($_options) : $threadSize; @@ -4932,17 +4881,17 @@ public static function getEditButton(&$item, $view, $views, $ref = '', $componen // get URL $url = self::getEditURL($item, $view, $views, $ref, $component); // check if we found any - if (self::checkString($url)) + if (UtilitiesStringHelper::check($url)) { // get the global settings - if (!self::checkObject(self::$params)) + if (!ObjectHelper::check(self::$params)) { - self::$params = JComponentHelper::getParams('com_componentbuilder'); + self::$params = \JComponentHelper::getParams('com_componentbuilder'); } // get UIKIT version $uikit = self::$params->get('uikit_version', 2); // check that we have the ID - if (self::checkObject($item) && isset($item->id)) + if (ObjectHelper::check($item) && isset($item->id)) { // check if the checked_out is available if (isset($item->checked_out)) @@ -4954,7 +4903,7 @@ public static function getEditButton(&$item, $view, $views, $ref = '', $componen $checked_out = self::getVar($view, $item->id, 'id', 'checked_out', '=', str_replace('com_', '', $component)); } } - elseif (self::checkArray($item) && isset($item['id'])) + elseif (UtilitiesArrayHelper::check($item) && isset($item['id'])) { // check if the checked_out is available if (isset($item['checked_out'])) @@ -4971,17 +4920,17 @@ public static function getEditButton(&$item, $view, $views, $ref = '', $componen $checked_out = self::getVar($view, $item, 'id', 'checked_out', '=', str_replace('com_', '', $component)); } // set the link title - $title = self::safeString(JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W'); + $title = UtilitiesStringHelper::safe(Text::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W'); // check that there is a check message - if (self::checkString($headsup)) + if (UtilitiesStringHelper::check($headsup)) { if (3 == $uikit) { - $href = 'onclick="UIkit.modal.confirm(\''.JText::_($headsup).'\').then( function(){ window.location.href = \'' . $url . '\' } )" href="javascript:void(0)"'; + $href = 'onclick="UIkit.modal.confirm(\''.Text::_($headsup).'\').then( function(){ window.location.href = \'' . $url . '\' } )" href="javascript:void(0)"'; } else { - $href = 'onclick="UIkit2.modal.confirm(\''.JText::_($headsup).'\', function(){ window.location.href = \'' . $url . '\' })" href="javascript:void(0)"'; + $href = 'onclick="UIkit2.modal.confirm(\''.Text::_($headsup).'\', function(){ window.location.href = \'' . $url . '\' })" href="javascript:void(0)"'; } } else @@ -4995,11 +4944,11 @@ public static function getEditButton(&$item, $view, $views, $ref = '', $componen if (isset($checked_out) && $checked_out > 0) { // is this user the one who checked it out - if ($checked_out == JFactory::getUser()->id) + if ($checked_out == Factory::getUser()->id) { return ' '; } - return ' '; + return ' '; } // return normal edit link return ' '; @@ -5008,11 +4957,11 @@ public static function getEditButton(&$item, $view, $views, $ref = '', $componen if (isset($checked_out) && $checked_out > 0) { // is this user the one who checked it out - if ($checked_out == JFactory::getUser()->id) + if ($checked_out == Factory::getUser()->id) { return ' '; } - return ' '; + return ' '; } // return normal edit link return ' '; @@ -5037,24 +4986,24 @@ public static function getEditButton(&$item, $view, $views, $ref = '', $componen public static function getEditTextButton($text, &$item, $view, $views, $ref = '', $component = 'com_componentbuilder', $jRoute = true, $class = 'uk-button', $headsup = 'COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE') { // make sure we have text - if (!self::checkString($text)) + if (!UtilitiesStringHelper::check($text)) { return self::getEditButton($item, $view, $views, $ref, $component, $headsup); } // get URL $url = self::getEditURL($item, $view, $views, $ref, $component, $jRoute); // check if we found any - if (self::checkString($url)) + if (UtilitiesStringHelper::check($url)) { // get the global settings - if (!self::checkObject(self::$params)) + if (!ObjectHelper::check(self::$params)) { - self::$params = JComponentHelper::getParams('com_componentbuilder'); + self::$params = \JComponentHelper::getParams('com_componentbuilder'); } // get UIKIT version $uikit = self::$params->get('uikit_version', 2); // check that we have the ID - if (self::checkObject($item) && isset($item->id)) + if (ObjectHelper::check($item) && isset($item->id)) { // check if the checked_out is available if (isset($item->checked_out)) @@ -5066,7 +5015,7 @@ public static function getEditTextButton($text, &$item, $view, $views, $ref = '' $checked_out = self::getVar($view, $item->id, 'id', 'checked_out', '=', str_replace('com_', '', $component)); } } - elseif (self::checkArray($item) && isset($item['id'])) + elseif (UtilitiesArrayHelper::check($item) && isset($item['id'])) { // check if the checked_out is available if (isset($item['checked_out'])) @@ -5083,17 +5032,17 @@ public static function getEditTextButton($text, &$item, $view, $views, $ref = '' $checked_out = self::getVar($view, $item, 'id', 'checked_out', '=', str_replace('com_', '', $component)); } // set the link title - $title = self::safeString(JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W'); + $title = UtilitiesStringHelper::safe(Text::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W'); // check that there is a check message - if (self::checkString($headsup)) + if (UtilitiesStringHelper::check($headsup)) { if (3 == $uikit) { - $href = 'onclick="UIkit.modal.confirm(\''.JText::_($headsup).'\').then( function(){ window.location.href = \'' . $url . '\' } )" href="javascript:void(0)"'; + $href = 'onclick="UIkit.modal.confirm(\''.Text::_($headsup).'\').then( function(){ window.location.href = \'' . $url . '\' } )" href="javascript:void(0)"'; } else { - $href = 'onclick="UIkit2.modal.confirm(\''.JText::_($headsup).'\', function(){ window.location.href = \'' . $url . '\' })" href="javascript:void(0)"'; + $href = 'onclick="UIkit2.modal.confirm(\''.Text::_($headsup).'\', function(){ window.location.href = \'' . $url . '\' })" href="javascript:void(0)"'; } } else @@ -5107,11 +5056,11 @@ public static function getEditTextButton($text, &$item, $view, $views, $ref = '' if (isset($checked_out) && $checked_out > 0) { // is this user the one who checked it out - if ($checked_out == JFactory::getUser()->id) + if ($checked_out == Factory::getUser()->id) { return ' ' . $text . ''; } - return ' ' . $text . ''; + return ' ' . $text . ''; } // return normal edit link return ' ' . $text . ''; @@ -5120,11 +5069,11 @@ public static function getEditTextButton($text, &$item, $view, $views, $ref = '' if (isset($checked_out) && $checked_out > 0) { // is this user the one who checked it out - if ($checked_out == JFactory::getUser()->id) + if ($checked_out == Factory::getUser()->id) { return ' ' . $text . ''; } - return ' ' . $text . ''; + return ' ' . $text . ''; } // return normal edit link return ' ' . $text . ''; @@ -5148,14 +5097,14 @@ public static function getEditTextButton($text, &$item, $view, $views, $ref = '' public static function getEditURL(&$item, $view, $views, $ref = '', $component = 'com_componentbuilder', $jRoute = true) { // build record - $record = new stdClass(); + $record = new \stdClass(); // check if user can edit if (self::canEditItem($record, $item, $view, $views, $component)) { // set the edit link if ($jRoute) { - return JRoute::_("index.php?option=" . $component . "&view=" . $views . "&task=" . $view . ".edit&id=" . $record->id . $ref); + return \JRoute::_("index.php?option=" . $component . "&view=" . $views . "&task=" . $view . ".edit&id=" . $record->id . $ref); } return "index.php?option=" . $component . "&view=" . $views . "&task=" . $view . ".edit&id=" . $record->id . $ref; } @@ -5176,7 +5125,7 @@ public static function getEditURL(&$item, $view, $views, $ref = '', $component = public static function allowEdit(&$item, $view, $views, $component = 'com_componentbuilder') { // build record - $record = new stdClass(); + $record = new \stdClass(); return self::canEditItem($record, $item, $view, $views, $component); } @@ -5195,14 +5144,14 @@ public static function allowEdit(&$item, $view, $views, $component = 'com_compon protected static function canEditItem(&$record, &$item, $view, $views, $component = 'com_componentbuilder') { // make sure the user has access to view - if (!JFactory::getUser()->authorise($view. '.access', $component)) + if (!Factory::getUser()->authorise($view. '.access', $component)) { return false; } // we start with false. $can_edit = false; // check that we have the ID - if (self::checkObject($item) && isset($item->id)) + if (ObjectHelper::check($item) && isset($item->id)) { $record->id = (int) $item->id; // check if created_by is available @@ -5211,7 +5160,7 @@ protected static function canEditItem(&$record, &$item, $view, $views, $componen $record->created_by = (int) $item->created_by; } } - elseif (self::checkArray($item) && isset($item['id'])) + elseif (UtilitiesArrayHelper::check($item) && isset($item['id'])) { $record->id = (int) $item['id']; // check if created_by is available @@ -5486,10 +5435,10 @@ public static function getSubformLayout($view, $field, $default = 'repeatablejcb // get global values if (self::$subformLayouts === false) { - self::$subformLayouts = JComponentHelper::getParams('com_componentbuilder')->get('subform_layouts', false); + self::$subformLayouts = ComponentHelper::getParams('com_componentbuilder')->get('subform_layouts', false); } // check what we found (else) return default - if (self::checkObject(self::$subformLayouts)) + if (ObjectHelper::check(self::$subformLayouts)) { // looking for $target = $view . '.' . $field; @@ -5510,636 +5459,449 @@ public static function getSubformLayout($view, $field, $default = 'repeatablejcb /** - * get extensions grouped list xml - **/ - public static function getExtensionGroupedListXml() + * Check if a row already exist + * + * @param string $table The table from which to get the variable + * @param array $where The value where + * @param string $main The component in which the table is found + * + * @return int the id, or false + * + */ + public static function checkExist($table, $where, $what = 'id', $operator = '=', $main = 'componentbuilder') { - // 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) + // Get a db connection. + $db = Factory::getDbo(); + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array($what))); + if (empty($table)) { - ${$extension} = self::getByTypeTheIdsSystemNames($extension); + $query->from($db->quoteName('#__'.$main)); } - - $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) + else { - $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); + $query->from($db->quoteName('#__'.$main.'_'.$table)); } - $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) + if (UtilitiesArrayHelper::check($where)) + { + foreach ($where as $key => $value) { - $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 (is_numeric($value)) { - if (self::checkJson($addViews)) + if (is_float($value + 0)) { - $addViews = json_decode($addViews, true); - if (self::checkArray($addViews)) - { - foreach($addViews as $addView) - { - if (isset($addView['adminview'])) - { - $adminviewIds[(int) $addView['adminview']] = (int) $addView['adminview']; - } - } - } + $query->where($db->quoteName($key) . ' ' . $operator . ' ' . (float) $value); + } + else + { + $query->where($db->quoteName($key) . ' ' . $operator . ' ' . (int) $value); } } + elseif (is_bool($value)) + { + $query->where($db->quoteName($key) . ' ' . $operator . ' ' . (bool) $value); + } + // we do not allow arrays at this point + elseif (!UtilitiesArrayHelper::check($value)) + { + $query->where($db->quoteName($key) . ' ' . $operator . ' ' . $db->quote( (string) $value)); + } + else + { + return false; + } } - // now check if we still have admin views - if (self::checkArray($adminviewIds)) - { - $query->where($db->quoteName('id') . ' IN (' . implode(',', $adminviewIds) . ')'); - } - else - { - return false; - } + } + else + { + return false; } $db->setQuery($query); $db->execute(); if ($db->getNumRows()) { - return $db->loadAssocList('id', 'system_name'); + return $db->loadResult(); } return false; } /** - * get any area linked IDs + * Making class or function name safe + * + * @input string The name you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use ClassfunctionHelper::safe($name); */ - public static function getAreaLinkedIDs($extension, $type) + public static function safeClassFunctionName($name) { - // 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; + return ClassfunctionHelper::safe($name); } /** - * get a component admin views IDs + * Making field names safe + * + * @input string The you would like to make safe + * @input boolean The switch to return an ALL UPPER CASE string + * @input string The string to use in white space + * + * @returns string on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use StringFieldHelper::safe($string, $allcap, $spacer); */ - public static function getComponentAdminViewsIDs($id) + public static function safeFieldName($string, $allcap = false, $spacer = '_') { - // 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; + // set the local component option + self::setComponentOption(); + + return StringFieldHelper::safe($string, $allcap, $spacer); } /** - * get a component custom admin views IDs + * Making field type name safe + * + * @input string The you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use TypeHelper::safe($string); */ - public static function getComponentCustomAdminViewsIDs($id) + public static function safeTypeName($string) { - // 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; + // set the local component option + self::setComponentOption(); + + return TypeHelper::safe($string); } /** - * get a component site views IDs + * Making namespace safe + * + * @input string The you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use NamespaceHelper::safe($string); */ - public static function getComponentSiteViewsIDs($id) + public static function safeNamespace($string) { - // 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; + return NamespaceHelper::safe($string); } /** - * get a component fields IDs + * get all strings between two other strings + * + * @param string $content The content to search + * @param string $start The starting value + * @param string $end The ending value + * + * @return array On success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use GetHelper::allBetween($content, $start, $end); */ - public static function getComponentFieldsIDs($id) + public static function getAllBetween($content, $start, $end) { - // 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; + return GetHelper::allBetween($content, $start, $end); } /** - * get a module fields IDs + * get a string between two other strings + * + * @param string $content The content to search + * @param string $start The starting value + * @param string $end The ending value + * @param string $default The default value if none found + * + * @return string On success / empty string on failure + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use GetHelper::between($content, $start, $end, $default); */ - public static function getModuleFieldsIDs($id) + public static function getBetween($content, $start, $end, $default = '') { - // 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; + return GetHelper::between($content, $start, $end, $default); } /** - * get a plugin fields IDs + * bc math wrapper (very basic not for accounting) + * + * @param string $type The type bc math + * @param int $val1 The first value + * @param int $val2 The second value + * @param int $scale The scale value + * + * @return float|int + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use MathHelper::bc($type, $val1, $val2, $scale); */ - public static function getPluginFieldsIDs($id) + public static function bcmath($type, $val1, $val2, $scale = 0) { - // 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; + return MathHelper::bc($type, $val1, $val2, $scale); } /** - * get an admin view fields IDs + * Basic sum of an array with more precision + * + * @param array $array The values to sum + * @param int $scale The scale value + * + * @return float|int + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use MathHelper::sum($array, $scale); */ - public static function getAdminViewFieldsIDs($id) + public static function bcsum($array, $scale = 4) { - // 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; + return MathHelper::sum($array, $scale); + } + + /** + * create plugin class name + * + * @input string The group name + * @input string The name + * + * @return string + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use PluginHelper::safe($name, $group); + */ + public static function createPluginClassName($group, $name) + { + return PluginHelper::safeClassName($name, $group); } /** - * get translation extension ids - **/ - public static function getTranslationExtensionsIds($extension, $type) + * Returns a GUIDv4 string + * + * Thanks to Dave Pearson (and other) + * https://www.php.net/manual/en/function.com-create-guid.php#119168 + * + * Uses the best cryptographically secure method + * for all supported platforms with fallback to an older, + * less secure version. + * + * @param bool $trim + * + * @return string + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use GuidHelper::get($trim); + */ + public static function GUID($trim = true) { - // 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; + return GuidHelper::get($trim); + } + + /** + * Validate the Globally Unique Identifier ( and check if table already has this identifier) + * + * @param string $guid + * @param string $table + * @param int $id + * @param string|null $component + * + * @return bool + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id, $component); + */ + public static function validGUID($guid, $table = null, $id = 0, $component = null) + { + // set the local component option + self::setComponentOption(); + + return GuidHelper::valid($guid, $table, $id, $component); + } + + /** + * get the ITEM of a GUID by table + * + * @param string $guid + * @param string $table + * @param string/array $what + * @param string|null $component + * + * @return mixed + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id, $component); + */ + public static function getGUID($guid, $table, $what = 'a.id', $component = null) + { + // set the local component option + self::setComponentOption(); + + return GuidHelper::item($guid, $table, $what, $component); + } + + /** + * Validate the Globally Unique Identifier + * + * Thanks to Lewie + * https://stackoverflow.com/a/1515456/1429677 + * + * @param string $guid + * + * @return bool + * + * @deprecated 4.0 - Use GuidHelper::validate($guid); + */ + protected static function validateGUID($guid) + { + return GuidHelper::valid($guid); + } + + /** + * The zipper method + * + * @param string $workingDIR The directory where the items must be zipped + * @param string $filepath The path to where the zip file must be placed + * + * @return bool true On success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use FileHelper::zip($workingDIR, $filepath); + */ + public static function zip($workingDIR, &$filepath) + { + return FileHelper::zip($workingDIR, $filepath); + } + + /** + * get the content of a file + * + * @param string $path The path to the file + * @param mixed $none The return value if no content was found + * + * @return string On success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use FileHelper::getContent($path, $none); + */ + public static function getFileContents($path, $none = '') + { + return FileHelper::getContent($path, $none); + } + + /** + * Write a file to the server + * + * @param string $path The path and file name where to safe the data + * @param string $data The data to safe + * + * @return bool true On success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use FileHelper::write($path, $data); + */ + public static function writeFile($path, $data) + { + return FileHelper::write($path, $data); + } + + /** + * get all the file paths in folder and sub folders + * + * @param string $folder The local path to parse + * @param array $fileTypes The type of files to get + * + * @return array|null + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use FileHelper::getPaths($folder, $fileTypes , $recurse, $full); + */ + public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true) + { + return FileHelper::getPaths($folder, $fileTypes , $recurse, $full); } /** - * get translation ids - **/ - public static function getTranslationIds($language, $translated = true) + * Get the file path or url + * + * @param string $type The (url/path) type to return + * @param string $target The Params Target name (if set) + * @param string $fileType The kind of filename to generate (if not set no file name is generated) + * @param string $key The key to adjust the filename (if not set ignored) + * @param string $default The default path if not set in Params (fallback path) + * @param bool $createIfNotSet The switch to create the folder if not found + * + * @return string On success the path or url is returned based on the type requested + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use FileHelper::getPath($type, $target, $fileType, $key, $default, $createIfNotSet); + */ + public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = 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 . '%')); - } - } + // set the local component option + self::setComponentOption(); - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - return array_unique($db->loadColumn()); - } - return false; + return FileHelper::getPath($type, $target, $fileType, $key, $default, $createIfNotSet); } /** - * get available languages - **/ - public static function getAvailableLanguages() + * Check if file exist + * + * @param string $path The url/path to check + * + * @return bool If exist true + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use FileHelper::exists($path); + */ + public static function urlExists($path) { - $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; + return FileHelper::exists($path); } - /** - * Check if a row already exist - * - * @param string $table The table from which to get the variable - * @param array $where The value where - * @param string $main The component in which the table is found + * Set the component option * - * @return int the id, or false + * @param String|null $option The option for the component. * + * @since 3.0.11 */ - public static function checkExist($table, $where, $what = 'id', $operator = '=', $main = 'componentbuilder') + public static function setComponentOption($option = null) { - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else + // set the local component option + if (empty($option)) { - $query->from($db->quoteName('#__'.$main.'_'.$table)); - } - if (self::checkArray($where)) - { - foreach ($where as $key => $value) + if (empty(Helper::$option) && property_exists(__CLASS__, 'ComponentCodeName')) { - if (is_numeric($value)) - { - if (is_float($value + 0)) - { - $query->where($db->quoteName($key) . ' ' . $operator . ' ' . (float) $value); - } - else - { - $query->where($db->quoteName($key) . ' ' . $operator . ' ' . (int) $value); - } - } - elseif (is_bool($value)) - { - $query->where($db->quoteName($key) . ' ' . $operator . ' ' . (bool) $value); - } - // we do not allow arrays at this point - elseif (!self::checkArray($value)) - { - $query->where($db->quoteName($key) . ' ' . $operator . ' ' . $db->quote( (string) $value)); - } - else - { - return false; - } + Helper::$option = 'com_' . self::$ComponentCodeName; } } else { - return false; - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - return $db->loadResult(); + Helper::$option = $option; } - return false; } @@ -6152,7 +5914,7 @@ public static function composerAutoload($target) if (!isset(self::$composer[$target])) { // get the function name - $functionName = self::safeString('compose' . $target); + $functionName = UtilitiesStringHelper::safe('compose' . $target); // check if method exist if (method_exists(__CLASS__, $functionName)) { @@ -6174,7 +5936,7 @@ public static function manifest() /** * Joomla version object - */ + */ protected static $JVersion; /** @@ -6183,9 +5945,9 @@ public static function manifest() public static function jVersion() { // check if set - if (!self::checkObject(self::$JVersion)) + if (!ObjectHelper::check(self::$JVersion)) { - self::$JVersion = new JVersion(); + self::$JVersion = new Version(); } return self::$JVersion; } @@ -6196,18 +5958,18 @@ public static function jVersion() public static function getContributors() { // get params - $params = JComponentHelper::getParams('com_componentbuilder'); + $params = ComponentHelper::getParams('com_componentbuilder'); // start contributors array - $contributors = array(); + $contributors = []; // get all Contributors (max 20) $searchArray = range('0','20'); foreach($searchArray as $nr) - { + { if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 1 || $params->get("showContributor".$nr) == 3)) { // set link based of selected option if($params->get("useContributor".$nr) == 1) - { + { $link_front = ''; $link_back = ''; } @@ -6221,8 +5983,8 @@ public static function getContributors() $link_front = ''; $link_back = ''; } - $contributors[$nr]['title'] = self::htmlEscape($params->get("titleContributor".$nr)); - $contributors[$nr]['name'] = $link_front.self::htmlEscape($params->get("nameContributor".$nr)).$link_back; + $contributors[$nr]['title'] = UtilitiesStringHelper::html($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.UtilitiesStringHelper::html($params->get("nameContributor".$nr)).$link_back; } } return $contributors; @@ -6233,9 +5995,9 @@ public static function getContributors() **/ public static function getHelpUrl($view) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $groups = $user->get('groups'); - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select(array('a.id','a.groups','a.target','a.type','a.article','a.url')); $query->from('#__componentbuilder_help_document AS a'); @@ -6247,7 +6009,7 @@ public static function getHelpUrl($view) if($db->getNumRows()) { $helps = $db->loadObjectList(); - if (self::checkArray($helps)) + if (UtilitiesArrayHelper::check($helps)) { foreach ($helps as $nr => $help) { @@ -6288,7 +6050,7 @@ public static function getHelpUrl($view) **/ protected static function loadArticleLink($id) { - return JURI::root().'index.php?option=com_content&view=article&id='.$id.'&tmpl=component&layout=modal'; + return Uri::root() . 'index.php?option=com_content&view=article&id='.$id.'&tmpl=component&layout=modal'; } /** @@ -6296,8 +6058,8 @@ protected static function loadArticleLink($id) **/ protected static function loadHelpTextLink($id) { - $token = JSession::getFormToken(); - return 'index.php?option=com_componentbuilder&task=help.getText&id=' . (int) $id . '&token=' . $token; + $token = Session::getFormToken(); + return 'index.php?option=com_componentbuilder&task=help.getText&id=' . (int) $id . '&' . $token . '=1'; } /** @@ -6306,104 +6068,113 @@ protected static function loadHelpTextLink($id) public static function addSubmenu($submenu) { // load user for access menus - $user = JFactory::getUser(); + $user = Factory::getUser(); // load the submenus to sidebar - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_DASHBOARD'), 'index.php?option=com_componentbuilder&view=componentbuilder', $submenu === 'componentbuilder'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_DASHBOARD'), 'index.php?option=com_componentbuilder&view=componentbuilder', $submenu === 'componentbuilder'); // Access control (compiler.submenu). if ($user->authorise('compiler.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_COMPILER'), 'index.php?option=com_componentbuilder&view=compiler', $submenu === 'compiler'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_COMPILER'), 'index.php?option=com_componentbuilder&view=compiler', $submenu === 'compiler'); } 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'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_COMPONENTS'), 'index.php?option=com_componentbuilder&view=joomla_components', $submenu === 'joomla_components'); } if ($user->authorise('joomla_module.access', 'com_componentbuilder') && $user->authorise('joomla_module.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_MODULES'), 'index.php?option=com_componentbuilder&view=joomla_modules', $submenu === 'joomla_modules'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_MODULES'), 'index.php?option=com_componentbuilder&view=joomla_modules', $submenu === 'joomla_modules'); } if ($user->authorise('joomla_plugin.access', 'com_componentbuilder') && $user->authorise('joomla_plugin.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_PLUGINS'), 'index.php?option=com_componentbuilder&view=joomla_plugins', $submenu === 'joomla_plugins'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_PLUGINS'), 'index.php?option=com_componentbuilder&view=joomla_plugins', $submenu === 'joomla_plugins'); + } + if ($user->authorise('joomla_power.access', 'com_componentbuilder') && $user->authorise('joomla_power.submenu', 'com_componentbuilder')) + { + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_POWERS'), 'index.php?option=com_componentbuilder&view=joomla_powers', $submenu === 'joomla_powers'); } if ($user->authorise('power.access', 'com_componentbuilder') && $user->authorise('power.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_POWERS'), 'index.php?option=com_componentbuilder&view=powers', $submenu === 'powers'); + \JHtmlSidebar::addEntry(Text::_('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(Text::_('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'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_ADMIN_VIEWS'), 'index.php?option=com_componentbuilder&view=admin_views', $submenu === 'admin_views'); } if ($user->authorise('custom_admin_view.access', 'com_componentbuilder') && $user->authorise('custom_admin_view.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_CUSTOM_ADMIN_VIEWS'), 'index.php?option=com_componentbuilder&view=custom_admin_views', $submenu === 'custom_admin_views'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_CUSTOM_ADMIN_VIEWS'), 'index.php?option=com_componentbuilder&view=custom_admin_views', $submenu === 'custom_admin_views'); } if ($user->authorise('site_view.access', 'com_componentbuilder') && $user->authorise('site_view.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_SITE_VIEWS'), 'index.php?option=com_componentbuilder&view=site_views', $submenu === 'site_views'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_SITE_VIEWS'), 'index.php?option=com_componentbuilder&view=site_views', $submenu === 'site_views'); } if ($user->authorise('template.access', 'com_componentbuilder') && $user->authorise('template.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_TEMPLATES'), 'index.php?option=com_componentbuilder&view=templates', $submenu === 'templates'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_TEMPLATES'), 'index.php?option=com_componentbuilder&view=templates', $submenu === 'templates'); } if ($user->authorise('layout.access', 'com_componentbuilder') && $user->authorise('layout.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_LAYOUTS'), 'index.php?option=com_componentbuilder&view=layouts', $submenu === 'layouts'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_LAYOUTS'), 'index.php?option=com_componentbuilder&view=layouts', $submenu === 'layouts'); } if ($user->authorise('dynamic_get.access', 'com_componentbuilder') && $user->authorise('dynamic_get.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_DYNAMIC_GETS'), 'index.php?option=com_componentbuilder&view=dynamic_gets', $submenu === 'dynamic_gets'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_DYNAMIC_GETS'), 'index.php?option=com_componentbuilder&view=dynamic_gets', $submenu === 'dynamic_gets'); } if ($user->authorise('custom_code.access', 'com_componentbuilder') && $user->authorise('custom_code.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_CUSTOM_CODES'), 'index.php?option=com_componentbuilder&view=custom_codes', $submenu === 'custom_codes'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_CUSTOM_CODES'), 'index.php?option=com_componentbuilder&view=custom_codes', $submenu === 'custom_codes'); } if ($user->authorise('placeholder.access', 'com_componentbuilder') && $user->authorise('placeholder.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_PLACEHOLDERS'), 'index.php?option=com_componentbuilder&view=placeholders', $submenu === 'placeholders'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_PLACEHOLDERS'), 'index.php?option=com_componentbuilder&view=placeholders', $submenu === 'placeholders'); } if ($user->authorise('library.access', 'com_componentbuilder') && $user->authorise('library.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_LIBRARIES'), 'index.php?option=com_componentbuilder&view=libraries', $submenu === 'libraries'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_LIBRARIES'), 'index.php?option=com_componentbuilder&view=libraries', $submenu === 'libraries'); } if ($user->authorise('snippet.access', 'com_componentbuilder') && $user->authorise('snippet.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_SNIPPETS'), 'index.php?option=com_componentbuilder&view=snippets', $submenu === 'snippets'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_SNIPPETS'), 'index.php?option=com_componentbuilder&view=snippets', $submenu === 'snippets'); } // Access control (get_snippets.submenu). if ($user->authorise('get_snippets.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_GET_SNIPPETS'), 'index.php?option=com_componentbuilder&view=get_snippets', $submenu === 'get_snippets'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_GET_SNIPPETS'), 'index.php?option=com_componentbuilder&view=get_snippets', $submenu === 'get_snippets'); } if ($user->authorise('validation_rule.access', 'com_componentbuilder') && $user->authorise('validation_rule.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_VALIDATION_RULES'), 'index.php?option=com_componentbuilder&view=validation_rules', $submenu === 'validation_rules'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_VALIDATION_RULES'), 'index.php?option=com_componentbuilder&view=validation_rules', $submenu === 'validation_rules'); } if ($user->authorise('field.access', 'com_componentbuilder') && $user->authorise('field.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_FIELDS'), 'index.php?option=com_componentbuilder&view=fields', $submenu === 'fields'); - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_FIELD_FIELDS_CATEGORIES'), 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.field', $submenu === 'categories.field'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_FIELDS'), 'index.php?option=com_componentbuilder&view=fields', $submenu === 'fields'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_FIELD_FIELDS_CATEGORIES'), 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.field', $submenu === 'categories.field'); } if ($user->authorise('fieldtype.access', 'com_componentbuilder') && $user->authorise('fieldtype.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_FIELDTYPES'), 'index.php?option=com_componentbuilder&view=fieldtypes', $submenu === 'fieldtypes'); - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_FIELDTYPE_FIELDTYPES_CATEGORIES'), 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.fieldtype', $submenu === 'categories.fieldtype'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_FIELDTYPES'), 'index.php?option=com_componentbuilder&view=fieldtypes', $submenu === 'fieldtypes'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_FIELDTYPE_FIELDTYPES_CATEGORIES'), 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.fieldtype', $submenu === 'categories.fieldtype'); } if ($user->authorise('language_translation.access', 'com_componentbuilder') && $user->authorise('language_translation.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_LANGUAGE_TRANSLATIONS'), 'index.php?option=com_componentbuilder&view=language_translations', $submenu === 'language_translations'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_LANGUAGE_TRANSLATIONS'), 'index.php?option=com_componentbuilder&view=language_translations', $submenu === 'language_translations'); } if ($user->authorise('language.access', 'com_componentbuilder') && $user->authorise('language.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_LANGUAGES'), 'index.php?option=com_componentbuilder&view=languages', $submenu === 'languages'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_LANGUAGES'), 'index.php?option=com_componentbuilder&view=languages', $submenu === 'languages'); } if ($user->authorise('server.access', 'com_componentbuilder') && $user->authorise('server.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_SERVERS'), 'index.php?option=com_componentbuilder&view=servers', $submenu === 'servers'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_SERVERS'), 'index.php?option=com_componentbuilder&view=servers', $submenu === 'servers'); } if ($user->authorise('help_document.access', 'com_componentbuilder') && $user->authorise('help_document.submenu', 'com_componentbuilder')) { - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_componentbuilder&view=help_documents', $submenu === 'help_documents'); + \JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_componentbuilder&view=help_documents', $submenu === 'help_documents'); } } @@ -6477,7 +6248,7 @@ public static function getUikitComp($content,$classes = array()) if (strpos($content,'class="uk-') !== false) { // reset - $temp = array(); + $temp = []; foreach (self::$uk_components as $looking => $add) { if (strpos($content,$looking) !== false) @@ -6491,10 +6262,10 @@ public static function getUikitComp($content,$classes = array()) self::$uikit = true; } // sorter - if (self::checkArray($temp)) + if (UtilitiesArrayHelper::check($temp)) { // merger - if (self::checkArray($classes)) + if (UtilitiesArrayHelper::check($classes)) { $newTemp = array_merge($temp,$classes); $temp = array_unique($newTemp); @@ -6502,7 +6273,7 @@ public static function getUikitComp($content,$classes = array()) return $temp; } } - if (self::checkArray($classes)) + if (UtilitiesArrayHelper::check($classes)) { return $classes; } @@ -6515,11 +6286,11 @@ public static function getUikitComp($content,$classes = array()) public static function xls($rows, $fileName = null, $title = null, $subjectTab = null, $creator = 'Vast Development Method', $description = null, $category = null,$keywords = null, $modified = null) { // set the user - $user = JFactory::getUser(); + $user = Factory::getUser(); // set fileName if not set if (!$fileName) { - $fileName = 'exported_'.JFactory::getDate()->format('jS_F_Y'); + $fileName = 'exported_'.Factory::getDate()->format('jS_F_Y'); } // set modified if not set if (!$modified) @@ -6591,7 +6362,7 @@ public static function xls($rows, $fileName = null, $title = null, $subjectTab = )); // Add some data - if (($size = self::checkArray($rows)) !== false) + if (($size = UtilitiesArrayHelper::check($rows)) !== false) { $i = 1; @@ -6674,7 +6445,7 @@ public static function getFileHeaders($dataType) // make sure we have the composer classes loaded self::composerAutoload('phpspreadsheet'); // get session object - $session = JFactory::getSession(); + $session = Factory::getSession(); $package = $session->get('package', null); $package = json_decode($package, true); // set the headers @@ -6691,7 +6462,7 @@ public static function getFileHeaders($dataType) $excelReader->setReadDataOnly(true); // load the rows (only first three) $excelObj = $excelReader->load($package['dir']); - $headers = array(); + $headers = []; foreach ($excelObj->getActiveSheet()->getRowIterator() as $row) { if($row->getRowIndex() == 1) @@ -6728,13 +6499,84 @@ protected static function composephpspreadsheet() return true; } + /** + * Get a Variable + * + * @param string $table The table from which to get the variable + * @param string $where The value where + * @param string $whereString The target/field string where/name + * @param string $what The return field + * @param string $operator The operator between $whereString/field and $where/value + * @param string $main The component in which the table is found + * + * @return mix string/int/float + * @deprecated 3.3 Use GetHelper::var(...); + */ + public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'componentbuilder') + { + return GetHelper::var( + $table, + $where, + $whereString, + $what, + $operator, + $main + ); + } + + /** + * Get array of variables + * + * @param string $table The table from which to get the variables + * @param string $where The value where + * @param string $whereString The target/field string where/name + * @param string $what The return field + * @param string $operator The operator between $whereString/field and $where/value + * @param string $main The component in which the table is found + * @param bool $unique The switch to return a unique array + * + * @return array + * @deprecated 3.3 Use GetHelper::vars(...); + */ + public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'componentbuilder', $unique = true) + { + return GetHelper::vars( + $table, + $where, + $whereString, + $what, + $operator, + $main, + $unique + ); + } + + /** + * Convert a json object to a string + * + * @input string $value The json string to convert + * + * @returns a string + * @deprecated 3.3 Use JsonHelper::string(...); + */ + public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') + { + return JsonHelper::string( + $value, + $sperator, + $table, + $id, + $name + ); + } + public static function isPublished($id,$type) { if ($type == 'raw') { $type = 'item'; } - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select(array('a.published')); $query->from('#__componentbuilder_'.$type.' AS a'); @@ -6752,7 +6594,7 @@ public static function isPublished($id,$type) public static function getGroupName($id) { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select(array('a.title')); $query->from('#__usergroups AS a'); @@ -6761,7 +6603,7 @@ public static function getGroupName($id) $db->execute(); $found = $db->getNumRows(); if($found) - { + { return $db->loadResult(); } return $id; @@ -6777,39 +6619,39 @@ public static function getGroupName($id) * @param string $component The target component * @param object $user The user whose permissions we are loading * - * @return object The JObject of permission/authorised actions - * + * @return object The CMSObject of permission/authorised actions + * */ public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'componentbuilder', $user = 'null') { // load the user if not given - if (!self::checkObject($user)) + if (!ObjectHelper::check($user)) { // get the user object - $user = JFactory::getUser(); + $user = Factory::getUser(); } - // load the JObject - $result = new JObject; + // load the CMSObject + $result = new CMSObject; // make view name safe (just incase) - $view = self::safeString($view); - if (self::checkString($views)) + $view = UtilitiesStringHelper::safe($view); + if (UtilitiesStringHelper::check($views)) { - $views = self::safeString($views); - } + $views = UtilitiesStringHelper::safe($views); + } // get all actions from component - $actions = JAccess::getActionsFromFile( + $actions = Access::getActionsFromFile( JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', "/access/section[@name='component']/" ); - // if non found then return empty JObject + // if non found then return empty CMSObject if (empty($actions)) { return $result; } // get created by if not found - if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) + if (ObjectHelper::check($record) && !isset($record->created_by) && isset($record->id)) { - $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); + $record->created_by = GetHelper::var($view, $record->id, 'id', 'created_by', '=', $component); } // set actions only set in component settings $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); @@ -6818,12 +6660,12 @@ public static function getActions($view, &$record = null, $views = null, $target if ($target) { // convert to an array - if (self::checkString($target)) + if (UtilitiesStringHelper::check($target)) { $target = array($target); } // check if we are good to go - if (self::checkArray($target)) + if (UtilitiesArrayHelper::check($target)) { $checkTarget = true; } @@ -6844,7 +6686,7 @@ public static function getActions($view, &$record = null, $views = null, $target // set area $area = 'comp'; // check if the record has an ID and the action is item related (not a component action) - if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && + if (ObjectHelper::check($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) { // we are in item @@ -6877,7 +6719,7 @@ public static function getActions($view, &$record = null, $views = null, $target } } } - elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) + elseif (UtilitiesStringHelper::check($views) && isset($record->catid) && $record->catid > 0) { // we are in item $area = 'category'; @@ -6949,7 +6791,7 @@ public static function getActions($view, &$record = null, $views = null, $target * @param array $targets The array of target actions * * @return boolean true if action should be filtered out - * + * */ protected static function filterActions(&$view, &$action, &$targets) { @@ -6968,22 +6810,22 @@ protected static function filterActions(&$view, &$action, &$targets) /** * Get any component's model */ - public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = 'Componentbuilder', $config = array()) + public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = 'Componentbuilder', $config = []) { // fix the name - $name = self::safeString($name); + $name = UtilitiesStringHelper::safe($name); // full path to models $fullPathModels = $path . '/models'; // load the model file - JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); + BaseDatabaseModel::addIncludePath($fullPathModels, $Component . 'Model'); // make sure the table path is loaded - if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + if (!isset($config['table_path']) || !UtilitiesStringHelper::check($config['table_path'])) { // This is the JCB default path to tables in Joomla 3.x $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; } // get instance - $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); + $model = BaseDatabaseModel::getInstance($name, $Component . 'Model', $config); // if model not found (strange) if ($model == false) { @@ -7018,14 +6860,14 @@ public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $C */ public static function setAsset($id, $table, $inherit = true) { - $parent = JTable::getInstance('Asset'); + $parent = Table::getInstance('Asset'); $parent->loadByName('com_componentbuilder'); - + $parentId = $parent->id; $name = 'com_componentbuilder.'.$table.'.'.$id; $title = ''; - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName($name); // Check for an error. @@ -7049,14 +6891,14 @@ public static function setAsset($id, $table, $inherit = true) $asset->title = $title; // get the default asset rules $rules = self::getDefaultAssetRules('com_componentbuilder', $table, $inherit); - if ($rules instanceof JAccessRules) + if ($rules instanceof AccessRules) { $asset->rules = (string) $rules; } if (!$asset->check() || !$asset->store()) { - JFactory::getApplication()->enqueueMessage($asset->getError(), 'warning'); + Factory::getApplication()->enqueueMessage($asset->getError(), 'warning'); return false; } else @@ -7069,7 +6911,7 @@ public static function setAsset($id, $table, $inherit = true) $object->asset_id = (int) $asset->id; // Update their asset_id to link to the asset table. - return JFactory::getDbo()->updateObject('#__componentbuilder_'.$table, $object, 'id'); + return Factory::getDbo()->updateObject('#__componentbuilder_'.$table, $object, 'id'); } } return false; @@ -7086,7 +6928,7 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru if (!$inherit) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -7101,8 +6943,8 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru } } // get asset rules - $result = JAccess::getAssetRules($assetId); - if ($result instanceof JAccessRules) + $result = Access::getAssetRules($assetId); + if ($result instanceof AccessRules) { $_result = (string) $result; $_result = json_decode($_result); @@ -7117,7 +6959,7 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru elseif ($inherit) { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -7125,8 +6967,8 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules($_result); + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules($_result); // return filtered rules return $rules; } @@ -7140,35 +6982,12 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru * @param SimpleXMLElement $xml The XML element reference in which to inject a comment * @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement * - * @return null - * + * @return void + * @deprecated 3.3 Use FormHelper::append($xml, $node); */ public static function xmlAppend(&$xml, $node) { - if (!$node) - { - // element was not returned - return; - } - switch (get_class($node)) - { - case 'stdClass': - if (property_exists($node, 'comment')) - { - self::xmlComment($xml, $node->comment); - } - if (property_exists($node, 'fieldXML')) - { - self::xmlAppend($xml, $node->fieldXML); - } - break; - case 'SimpleXMLElement': - $domXML = dom_import_simplexml($xml); - $domNode = dom_import_simplexml($node); - $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); - $xml = simplexml_import_dom($domXML); - break; - } + FormHelper::append($xml, $node); } /** @@ -7177,16 +6996,12 @@ public static function xmlAppend(&$xml, $node) * @param SimpleXMLElement $xml The XML element reference in which to inject a comment * @param string $comment The comment to inject * - * @return null - * + * @return void + * @deprecated 3.3 Use FormHelper::comment($xml, $comment); */ public static function xmlComment(&$xml, $comment) { - $domXML = dom_import_simplexml($xml); - $domComment = new DOMComment($comment); - $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); - $domXML->appendChild($nodeTarget); - $xml = simplexml_import_dom($domXML); + FormHelper::comment($xml, $comment); } /** @@ -7196,14 +7011,11 @@ public static function xmlComment(&$xml, $comment) * @param array $attributes The attributes to apply to the XML element * * @return null - * + * @deprecated 3.3 Use FormHelper::attributes($xml, $attributes); */ - public static function xmlAddAttributes(&$xml, $attributes = array()) + public static function xmlAddAttributes(&$xml, $attributes = []) { - foreach ($attributes as $key => $value) - { - $xml->addAttribute($key, $value); - } + FormHelper::attributes($xml, $attributes); } /** @@ -7213,16 +7025,11 @@ public static function xmlAddAttributes(&$xml, $attributes = array()) * @param array $options The options to apply to the XML element * * @return void - * + * @deprecated 3.3 Use FormHelper::options($xml, $options); */ - public static function xmlAddOptions(&$xml, $options = array()) + public static function xmlAddOptions(&$xml, $options = []) { - foreach ($options as $key => $value) - { - $addOption = $xml->addChild('option'); - $addOption->addAttribute('value', $key); - $addOption[] = $value; - } + FormHelper::options($xml, $options); } /** @@ -7233,28 +7040,11 @@ public static function xmlAddOptions(&$xml, $options = array()) * @param array $options The options to apply to the XML element * * @return object - * + * @deprecated 3.3 Use FormHelper::field($attributes, $default, $options); */ public static function getFieldObject(&$attributes, $default = '', $options = null) { - // make sure we have attributes and a type value - if (self::checkArray($attributes) && isset($attributes['type'])) - { - // make sure the form helper class is loaded - if (!method_exists('JFormHelper', 'loadFieldType')) - { - jimport('joomla.form.form'); - } - // get field type - $field = JFormHelper::loadFieldType($attributes['type'], true); - // get field xml - $XML = self::getFieldXML($attributes, $options); - // setup the field - $field->setup($XML, $default); - // return the field object - return $field; - } - return false; + return FormHelper::field($attributes, $default, $options); } /** @@ -7264,27 +7054,11 @@ public static function getFieldObject(&$attributes, $default = '', $options = nu * @param array $options The options to apply to the XML element * * @return object - * + * @deprecated 3.3 Use FormHelper::xml($attributes, $options); */ public static function getFieldXML(&$attributes, $options = null) { - // make sure we have attributes and a type value - if (self::checkArray($attributes)) - { - // start field xml - $XML = new SimpleXMLElement(''); - // load the attributes - self::xmlAddAttributes($XML, $attributes); - // check if we have options - if (self::checkArray($options)) - { - // load the options - self::xmlAddOptions($XML, $options); - } - // return the field xml - return $XML; - } - return false; + return FormHelper::xml($attributes, $options); } /** @@ -7308,17 +7082,69 @@ public static function renderBoolButton() // button attributes $buttonAttributes = array( 'type' => 'radio', - 'name' => isset($args[0]) ? self::htmlEscape($args[0]) : 'bool_button', - 'label' => isset($args[0]) ? self::safeString(self::htmlEscape($args[0]), 'Ww') : 'Bool Button', // not seen anyway + 'name' => isset($args[0]) ? UtilitiesStringHelper::html($args[0]) : 'bool_button', + 'label' => isset($args[0]) ? UtilitiesStringHelper::safe(UtilitiesStringHelper::html($args[0]), 'Ww') : 'Bool Button', // not seen anyway 'class' => 'btn-group', 'filter' => 'INT', 'default' => isset($args[2]) ? (int) $args[2] : 0); // set the button options $buttonOptions = array( - '1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES', - '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); + '1' => isset($args[3]) ? UtilitiesStringHelper::html($args[3]) : 'JYES', + '0' => isset($args[4]) ? UtilitiesStringHelper::html($args[4]) : 'JNO'); // return the input - return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; + return FormHelper::field($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; + } + + /** + * Check if have an json string + * + * @input string The json string to check + * + * @returns bool true on success + * @deprecated 3.3 Use JsonHelper::check($string); + */ + public static function checkJson($string) + { + return JsonHelper::check($string); + } + + /** + * Check if have an object with a length + * + * @input object The object to check + * + * @returns bool true on success + * @deprecated 3.3 Use ObjectHelper::check($object); + */ + public static function checkObject($object) + { + return ObjectHelper::check($object); + } + + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns bool/int number of items in array on success + * @deprecated 3.3 Use UtilitiesArrayHelper::check($array, $removeEmptyString); + */ + public static function checkArray($array, $removeEmptyString = false) + { + return UtilitiesArrayHelper::check($array, $removeEmptyString); + } + + /** + * Check if have a string with a length + * + * @input string The string to check + * + * @returns bool true on success + * @deprecated 3.3 Use UtilitiesStringHelper::check($string); + */ + public static function checkString($string) + { + return UtilitiesStringHelper::check($string); } /** @@ -7330,8 +7156,8 @@ public static function renderBoolButton() public static function isConnected() { // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right? - $connected = @fsockopen("www.example.com", 80); - // website, port (try 80 or 443) + $connected = @fsockopen("www.example.com", 80); + // website, port (try 80 or 443) if ($connected) { //action when connected @@ -7346,12 +7172,125 @@ public static function isConnected() return $is_conn; } + /** + * Merge an array of array's + * + * @input array The arrays you would like to merge + * + * @returns array on success + * @deprecated 3.3 Use UtilitiesArrayHelper::merge($arrays); + */ + public static function mergeArrays($arrays) + { + return UtilitiesArrayHelper::merge($arrays); + } + // typo sorry! public static function sorten($string, $length = 40, $addTip = true) { return self::shorten($string, $length, $addTip); } + /** + * Shorten a string + * + * @input string The you would like to shorten + * + * @returns string on success + * @deprecated 3.3 Use UtilitiesStringHelper::shorten(...); + */ + public static function shorten($string, $length = 40, $addTip = true) + { + return UtilitiesStringHelper::shorten($string, $length, $addTip); + } + + /** + * Making strings safe (various ways) + * + * @input string The you would like to make safe + * + * @returns string on success + * @deprecated 3.3 Use UtilitiesStringHelper::safe(...); + */ + public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) + { + return UtilitiesStringHelper::safe( + $string, + $type, + $spacer, + $replaceNumbers, + $keepOnlyCharacters + ); + } + + /** + * Convert none English strings to code usable string + * + * @input an string + * + * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::transliterate($string); + */ + public static function transliterate($string) + { + return UtilitiesStringHelper::transliterate($string); + } + + /** + * make sure a string is HTML save + * + * @input an html string + * + * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::html(...); + */ + public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40) + { + return UtilitiesStringHelper::html( + $var, + $charset, + $shorten, + $length + ); + } + + /** + * Convert all int in a string to an English word string + * + * @input an string with numbers + * + * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::numbers($string); + */ + public static function replaceNumbers($string) + { + return UtilitiesStringHelper::numbers($string); + } + + /** + * Convert an integer into an English word string + * Thanks to Tom Nicholson + * + * @input an int + * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::number($x); + */ + public static function numberToString($x) + { + return UtilitiesStringHelper::number($x); + } + + /** + * Random Key + * + * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::random($size); + */ + public static function randomkey($size) + { + return UtilitiesStringHelper::random($size); + } + /** * Get The Encryption Keys * @@ -7364,12 +7303,12 @@ public static function sorten($string, $length = 40, $addTip = true) public static function getCryptKey($type, $default = false) { // Get the global params - $params = JComponentHelper::getParams('com_componentbuilder', true); + $params = ComponentHelper::getParams('com_componentbuilder', true); // Basic Encryption Type if ('basic' === $type) { $basic_key = $params->get('basic_key', $default); - if (self::checkString($basic_key)) + if (UtilitiesStringHelper::check($basic_key)) { return $basic_key; } diff --git a/admin/helpers/componentbuilderemail.php b/admin/helpers/componentbuilderemail.php index d5da051da..762f21866 100644 --- a/admin/helpers/componentbuilderemail.php +++ b/admin/helpers/componentbuilderemail.php @@ -12,6 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Mail\Mail; +use Joomla\Registry\Registry; +use VDM\Joomla\Utilities\ArrayHelper; + /** * Componentbuilder component email helper */ @@ -22,28 +28,28 @@ abstract class ComponentbuilderEmail * * @var activeRecipient (array) */ - public static $active = array(); + public static $active = []; /** * Configuraiton object * - * @var JConfig + * @var Registry */ - public static $config = null; + public static ?Registry $config = null; /** * Mailer object * - * @var JMail + * @var Mail */ - public static $mailer = null; + public static ?Mail $mailer = null; /** * Custom Headers * * @var array */ - protected static $header = array(); + protected static array $header = []; /** * Get a configuration object @@ -53,7 +59,7 @@ public static function getConfig() { if (!self::$config) { - self::$config = JComponentHelper::getParams('com_componentbuilder'); + self::$config = ComponentHelper::getParams('com_componentbuilder'); } return self::$config; @@ -92,7 +98,7 @@ public static function getMailerInstance() * @static * @access public */ - public static function validateAddress($address, $patternselect = null) + public static function validateAddress($address, $patternselect = null): bool { return self::getMailerInstance()->validateAddress($address, $patternselect); } @@ -100,13 +106,13 @@ public static function validateAddress($address, $patternselect = null) /** * Get a mailer object. * - * Returns the global {@link JMail} object, only creating it if it doesn't already exist. + * Returns the global {@link Mail} object, only creating it if it doesn't already exist. * - * @return JMail object + * @return Mail object * - * @see JMail + * @see Mail */ - public static function getMailer() + public static function getMailer(): Mail { if (!self::$mailer) { @@ -121,58 +127,58 @@ public static function getMailer() /** * Create a mailer object * - * @return JMail object + * @return Mail object * - * @see JMail + * @see Mail */ - protected static function createMailer() + protected static function createMailer(): Mail { // set component params $conf = self::getConfig(); - + // now load the mailer $mailer = $conf->get('mailer', 'global'); - - // Create a JMail object - $mail = JMail::getInstance(); + + // Create a Mail object + $mail = Mail::getInstance(); // check if set to global if ('global' == $mailer) { // get the global details - $globalConf = JFactory::getConfig(); - - $mailer = $globalConf->get('mailer'); - $smtpauth = ($globalConf->get('smtpauth') == 0) ? null : 1; - $smtpuser = $globalConf->get('smtpuser'); - $smtppass = $globalConf->get('smtppass'); - $smtphost = $globalConf->get('smtphost'); - $smtpsecure = $globalConf->get('smtpsecure'); - $smtpport = $globalConf->get('smtpport'); - $sendmail = $globalConf->get('sendmail'); - $mailfrom = $globalConf->get('mailfrom'); - $fromname = $globalConf->get('fromname'); - $replyto = $globalConf->get('replyto'); - $replytoname = $globalConf->get('replytoname'); + $globalConf = Factory::getConfig(); + + $mailer = $globalConf->get('mailer'); + $smtpauth = ($globalConf->get('smtpauth') == 0) ? null : 1; + $smtpuser = $globalConf->get('smtpuser'); + $smtppass = $globalConf->get('smtppass'); + $smtphost = $globalConf->get('smtphost'); + $smtpsecure = $globalConf->get('smtpsecure'); + $smtpport = $globalConf->get('smtpport'); + $sendmail = $globalConf->get('sendmail'); + $mailfrom = $globalConf->get('mailfrom'); + $fromname = $globalConf->get('fromname'); + $replyto = $globalConf->get('replyto'); + $replytoname = $globalConf->get('replytoname'); } else { - $smtpauth = ($conf->get('smtpauth') == 0) ? null : 1; - $smtpuser = $conf->get('smtpuser'); - $smtppass = $conf->get('smtppass'); - $smtphost = $conf->get('smtphost'); - $smtpsecure = $conf->get('smtpsecure'); - $smtpport = $conf->get('smtpport'); - $sendmail = $conf->get('sendmail'); - $mailfrom = $conf->get('emailfrom'); - $fromname = $conf->get('fromname'); - $replyto = $conf->get('replyto'); - $replytoname = $conf->get('replytoname'); + $smtpauth = ($conf->get('smtpauth') == 0) ? null : 1; + $smtpuser = $conf->get('smtpuser'); + $smtppass = $conf->get('smtppass'); + $smtphost = $conf->get('smtphost'); + $smtpsecure = $conf->get('smtpsecure'); + $smtpport = $conf->get('smtpport'); + $sendmail = $conf->get('sendmail'); + $mailfrom = $conf->get('emailfrom'); + $fromname = $conf->get('fromname'); + $replyto = $conf->get('replyto'); + $replytoname = $conf->get('replytoname'); } // Set global sender $mail->setSender(array($mailfrom, $fromname)); - + // set the global reply-to if found if ($replyto && $replytoname) { @@ -221,25 +227,25 @@ public static function setHeader($target, $value) */ public static function send($recipient, $subject, $body, $textonly, $mode = 0, $bounce_email = null, $idsession = null, $mailreply = null, $replyname = null , $mailfrom = null, $fromname = null, $cc = null, $bcc = null, $attachment = null, $embeded = null , $embeds = null) { - // Get a JMail instance + // Get a Mail instance $mail = self::getMailer(); - + // set component params $conf = self::getConfig(); - + // set if we have override if ($mailfrom && $fromname) { $mail->setSender(array($mailfrom, $fromname)); } - + // load the bounce email as sender if set if (!is_null($bounce_email)) - { + { $mail->Sender = $bounce_email; } - - // Add tag to email to identify it + + // Add tag to email to identify it if (!is_null($idsession)) { $mail->addCustomHeader('X-VDMmethodID:'.$idsession); @@ -257,7 +263,7 @@ public static function send($recipient, $subject, $body, $textonly, $mode = 0, $ // set the subject & Body $mail->setSubject($subject); $mail->setBody($body); - + // Are we sending the email as HTML? if ($mode) { @@ -268,7 +274,7 @@ public static function send($recipient, $subject, $body, $textonly, $mode = 0, $ //embed images if ($embeded) { - if(ComponentbuilderHelper::checkArray($embeds)) + if(ArrayHelper::check($embeds)) { foreach($embeds as $embed) { @@ -303,21 +309,21 @@ public static function send($recipient, $subject, $body, $textonly, $mode = 0, $ { if (!empty($conf->get('dkim_domain')) && !empty($conf->get('dkim_selector')) && !empty($conf->get('dkim_private')) && !empty($conf->get('dkim_public'))) { - $mail->DKIM_domain = $conf->get('dkim_domain'); - $mail->DKIM_selector = $conf->get('dkim_selector'); - $mail->DKIM_identity = $conf->get('dkim_identity'); - $mail->DKIM_passphrase = $conf->get('dkim_passphrase'); - - $tmp = tempnam(sys_get_temp_dir(), 'VDM'); - $h = fopen($tmp, 'w'); + $mail->DKIM_domain = $conf->get('dkim_domain'); + $mail->DKIM_selector = $conf->get('dkim_selector'); + $mail->DKIM_identity = $conf->get('dkim_identity'); + $mail->DKIM_passphrase = $conf->get('dkim_passphrase'); + + $tmp = tempnam(sys_get_temp_dir(), 'VDM'); + $h = fopen($tmp, 'w'); fwrite($h, $conf->get('dkim_private')); fclose($h); - $mail->DKIM_private = $tmp; + $mail->DKIM_private = $tmp; } } $sendmail = $mail->Send(); - + if ($conf->get('enable_dkim') && !empty($conf->get('dkim_domain')) && !empty($conf->get('dkim_selector')) && !empty($conf->get('dkim_private')) && !empty($conf->get('dkim_public'))) { @unlink($tmp); @@ -346,7 +352,7 @@ public static function send($recipient, $subject, $body, $textonly, $mode = 0, $ /** * Set html text (in a row) and subject (as title) to a email table. * do not use

    instead use
    - * in your html that you pass to this method + * in your html that you pass to this method * since it is a table row it does not * work well with paragraphs * @@ -355,7 +361,7 @@ public static function send($recipient, $subject, $body, $textonly, $mode = 0, $ */ public static function setBasicBody($html, $subject) { - $body = array(); + $body = []; $body[] = ""; $body[] = ""; $body[] = ""; @@ -392,7 +398,7 @@ public static function setBasicBody($html, $subject) /** * Set html text (in a row) and subject (as title) to a email table. * do not use

    instead use
    - * in your html that you pass to this method + * in your html that you pass to this method * since it is a table row it does not * work well with paragraphs * @@ -401,7 +407,7 @@ public static function setBasicBody($html, $subject) */ public static function setTableBody($html, $subject) { - $body = array(); + $body = []; $body[] = ""; $body[] = ""; $body[] = ""; diff --git a/admin/helpers/extrusion/a_mapping.php b/admin/helpers/extrusion/a_mapping.php deleted file mode 100644 index 468544f92..000000000 --- a/admin/helpers/extrusion/a_mapping.php +++ /dev/null @@ -1,415 +0,0 @@ - - @my wife Roline van der Merwe - @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'); - -/** - * Mapping class - */ -class Mapping -{ - /** - * Some default fields - */ - protected $buildcompsql; - public $id; - public $name_code; - public $addadmin_views; - public $addSql = array(); - public $source = array(); - public $sql = array(); - - /** - * The map of the needed fields and views - */ - public $map; - - /** - * The app to load messages mostly - */ - public $app; - - /** - * The needed set of keys needed to set - */ - protected $setting = array('id' => 'default', 'buildcompsql' => 'base64', 'name_code' => 'safeString'); - - /** - * The needed set of keys needed to set - */ - protected $notRequiered = array('id', 'asset_id', 'published', - 'created_by', 'modified_by', 'created', 'modified', 'checked_out','checked_out_time', - 'version', 'hits', 'access', 'ordering', - 'metakey', 'metadesc', 'metadata', 'params'); - - /** - * The datatypes and it linked field types (basic) - * (TODO) We may need to set this dynamicly - */ - protected $dataTypes = array( 'VARCHAR' => 'Text', 'CHAR' => 'Text', - 'MEDIUMTEXT' => 'Textarea', 'LONGTEXT' => 'Textarea', - 'TEXT' => 'Textarea', 'DATETIME' => 'Calendar', - 'DATE' => 'Text', 'TIME' => 'Text', 'TINYINT' => 'Text', - 'BIGINT' => 'Text', 'INT' => 'Text', 'FLOAT' => 'Text', - 'DECIMAL' => 'Text', 'DOUBLE' => 'Text'); - - /** - * The datasize identifiers - */ - protected $dataSize = array( - 'CHAR', 'VARCHAR', 'INT', 'TINYINT', - 'BIGINT', 'FLOAT', 'DECIMAL', 'DOUBLE'); - - /** - * The default identifiers - */ - protected $defaults = array(0, 1, "CURRENT_TIMESTAMP", "DATETIME"); // Other - - /** - * The sizes identifiers - */ - protected $sizes = array("1", "7", "10", "11", "50", "64", "100", "255", "1024", "2048"); // Other - - - /** - * Constructor - */ - public function __construct($data = false) - { - // set the app to insure messages can be set - $this->app = JFactory::getApplication(); - // check that we have data - if (ComponentbuilderHelper::checkArray($data)) - { - // make sure we have an id - if (isset($data['id']) && $data['id'] > 0) - { - if (isset($data['buildcomp']) && 1 == $data['buildcomp'] && isset($data['buildcompsql'])) - { - foreach ($data as $key => $value) - { - if (isset($this->setting[$key])) - { - switch($this->setting[$key]) - { - case 'base64': - // set needed value - $this->$key = base64_decode($value); - break; - case 'json': - // set needed value - $this->$key = json_decode($value, true); - break; - case 'safeString': - // set needed value - $this->$key = ComponentbuilderHelper::safeString($value); - break; - default : - $this->$key = $value; - break; - } - } - } - // get linked admin views - $addadmin_views = ComponentbuilderHelper::getVar('component_admin_views', $data['id'], 'joomla_component', 'addadmin_views'); - if (ComponentbuilderHelper::checkJson($addadmin_views)) - { - $this->addadmin_views = json_decode($addadmin_views, true); - } - // set the map of the views needed - if ($this->setMap()) - { - return true; - } - $this->app->enqueueMessage( - JText::_('No "CREATE TABLE.." were found, please check your sql.'), - 'Error' - ); - return false; - } - return false; // not set so just return without any error - } - $this->app->enqueueMessage( - JText::_('Please try again, this error usualy happens if it is a new component, beacues we need a component ID to do this build with your sql dump.'), - 'Error' - ); - return false; - } - $this->app->enqueueMessage( - JText::_('Could not find the data needed to continue.'), - 'Error' - ); - return false; - } - - /** - * The mapping function - * To Map the views and fields that are needed - */ - protected function setMap() - { - // start parsing the sql dump data - $queries = JDatabaseDriver::splitSql($this->buildcompsql); - if (ComponentbuilderHelper::checkArray($queries)) - { - foreach ($queries as $query) - { - // only use create table queries - if (strpos($query, 'CREATE TABLE IF NOT EXISTS') !== false || - strpos($query, 'CREATE TABLE') !== false) - { - if ($tableName = $this->getTableName($query)) - { - // now get the fields/columns of this view/table - if ($fields = $this->getFields($query)) - { - // make sure it is all lower case from here on - $tableName = strtolower($tableName); - $this->map[$tableName] = $fields; - } - } - else - { - continue; - } - } - // get the insert data if set - if (strpos($query, 'INSERT INTO `') !== false) - { - if ($tableName = $this->getTableName($query)) - { - $this->addSql[$tableName] = 1; - $this->source[$tableName] = 2; - $this->sql[$tableName] = $query; - } - } - } - // check if the mapping was done - if (ComponentbuilderHelper::checkArray($this->map)) - { - return true; - } - } - return false; - } - - /** - * Get the table name - */ - protected function getTableName(&$query) - { - if (strpos($query, '`#__') !== false) - { - // get table name - $tableName = ComponentbuilderHelper::getBetween($query, '`#__', "`"); - } - elseif (strpos($query, "'#__") !== false) - { - // get table name - $tableName = ComponentbuilderHelper::getBetween($query, "'#__", "'"); - } - // if it still was not found - if (!isset($tableName) || !ComponentbuilderHelper::checkString($tableName)) - { - // skip this query - return false; - } - // clean the table name (so only view name remain) - if (strpos($tableName, $this->name_code) !== false) - { - $tableName = trim(str_replace($this->name_code, '', $tableName), '_'); - } - // if found - if (ComponentbuilderHelper::checkString($tableName)) - { - return $tableName; - } - // skip this query - return false; - } - - /** - * Get the field details - */ - protected function getFields(&$query) - { - $rows = array_map('trim', explode(PHP_EOL, $query)); - $fields = array(); - foreach ($rows as $row) - { - // make sure we have a lower case string - $row = strtoupper($row); - $field = array(); - $name = ''; - if (0 === strpos($row, '`')) - { - // get field name - $name = ComponentbuilderHelper::getBetween($row, '`', '`'); - } - if (0 === strpos($row, "'")) - { - // get field name - $name = ComponentbuilderHelper::getBetween($row, "'", "'"); - } - // check if the name was found - if (ComponentbuilderHelper::checkString($name)) - { - // insure we have the name in lower case from here on - $name = strtolower($name); - // only continue if field is requered - if (in_array($name, $this->notRequiered)) - { - continue; - } - // check if the field type is found - if ($fieldType = $this->getType($row, $field, $name)) - { - $field['row'] = $row; - $field['name'] = $name; - $field['label'] = ComponentbuilderHelper::safeString($name, 'W'); - $field['fieldType'] = $fieldType; - $field['size'] = $this->getSize($row, $field); - $field['sizeOther'] = ''; - if (!in_array($field['size'], $this->sizes)) - { - if (ComponentbuilderHelper::checkString($field['size'])) - { - $field['sizeOther'] = $field['size']; - $field['size'] = 'Other'; - } - } - $field['default'] = $this->getDefault($row); - $field['defaultOther'] = ''; - if (!in_array($field['default'], $this->defaults)) - { - if (ComponentbuilderHelper::checkString($field['default'])) - { - $field['defaultOther'] = $field['default']; - $field['default'] = 'Other'; - } - } - $field['null'] = $this->getNullValue($row, $field); - // check if field is a key - $field['key'] = $this->getKeyStatus($rows, $name); - // load to fields - $fields[] = $field; - } - } - } - if (ComponentbuilderHelper::checkArray($fields)) - { - return $fields; - } - return false; - } - - /** - * Get the field types - */ - protected function getType($row, &$field, &$name) - { - // first remove field name - $row = str_replace($name, '', $row); - // get the data type first - foreach ($this->dataTypes as $type => $fieldType) - { - if (strpos($row, $type) !== false) - { - $field['dataType'] = $type; - return $fieldType; - } - } - return false; - } - - /** - * Get the field size - */ - protected function getSize(&$row, $field) - { - if (in_array($field['dataType'], $this->dataSize)) - { - return ComponentbuilderHelper::getBetween($row, $field['dataType'].'(', ')'); - } - return ''; - } - - /** - * Get the field default - */ - protected function getDefault(&$row) - { - // get default value - if (strpos($row, 'DEFAULT "') !== false) // to sure it this is correct... - { - return ComponentbuilderHelper::getBetween($row, 'DEFAULT "', '"'); - } - // get default value - if (strpos($row, "DEFAULT '") !== false) - { - return ComponentbuilderHelper::getBetween($row, "DEFAULT '", "'"); - } - return ''; - } - - /** - * Get the field Null Value - */ - protected function getNullValue(&$row, &$field) - { - // get the result of null - if (strpos($row, 'NOT NULL') !== false) - { - return 'NOT NULL'; - } - if (strpos($row, 'DEFAULT NULL') !== false) - { - $field['default'] = 'NULL'; - return ''; - } - return 'NULL'; - } - - /** - * Get the field key status - */ - protected function getKeyStatus(&$rows, &$name) - { - // get the data type first - foreach ($rows as $row) - { - if (strpos($row, 'UNIQUE KEY ') !== false && stripos($row, $name) !== false) - { - return 1; - } - if ((strpos($row, 'PRIMARY KEY ') !== false && stripos($row, $name) !== false) || (strpos($row, 'KEY ') !== false && stripos($row, $name) !== false)) - { - return 2; - } - } - return 0; - } -} diff --git a/admin/helpers/extrusion/c_extrusion.php b/admin/helpers/extrusion/c_extrusion.php deleted file mode 100644 index 81b2ffed4..000000000 --- a/admin/helpers/extrusion/c_extrusion.php +++ /dev/null @@ -1,108 +0,0 @@ - - @my wife Roline van der Merwe - @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'); - -/** - * Extrusion class - */ -class Extrusion extends Builder -{ - /*** - * Constructor - */ - public function __construct(&$data) - { - // first we run the perent constructor - if (parent::__construct($data)) - { - // link the view data to the component - if ($this->setAdminViews($data['id'])) - { - $this->app->enqueueMessage( - JText::_('All the fields and views from your sql dump has been created and linked to this component.'), - 'Success' - ); - return true; - } - } - return false; - } - - /** - * link the build views to the component - */ - protected function setAdminViews(&$component_id) - { - // check if views were set - if (ComponentbuilderHelper::checkArray($this->views)) - { - $count = 0; - if (ComponentbuilderHelper::checkArray($this->addadmin_views)) - { - $count = (int) count((array)$this->addadmin_views) + 3; - } - // set the admin view data linking - foreach ($this->views as $nr => $id) - { - $pointer = $count + $nr; - $this->addadmin_views['addadmin_views'.$pointer]['adminview'] = $id; - $this->addadmin_views['addadmin_views'.$pointer]['icomoon'] = 'joomla'; - $this->addadmin_views['addadmin_views'.$pointer]['mainmenu'] = 1; - $this->addadmin_views['addadmin_views'.$pointer]['dashboard_add'] = 1; - $this->addadmin_views['addadmin_views'.$pointer]['dashboard_list'] = 1; - $this->addadmin_views['addadmin_views'.$pointer]['submenu'] = 1; - $this->addadmin_views['addadmin_views'.$pointer]['checkin'] = 1; - $this->addadmin_views['addadmin_views'.$pointer]['history'] = 1; - $this->addadmin_views['addadmin_views'.$pointer]['metadata'] = 1; - $this->addadmin_views['addadmin_views'.$pointer]['access'] = 1; - $this->addadmin_views['addadmin_views'.$pointer]['port'] = 1; - $this->addadmin_views['addadmin_views'.$pointer]['edit_create_site_view'] = 0; - $this->addadmin_views['addadmin_views'.$pointer]['order'] = $pointer + 1; - } - } - if (isset($this->addadmin_views) && ComponentbuilderHelper::checkArray($this->addadmin_views)) - { - // set the field object - $object = new stdClass(); - $object->joomla_component = $component_id; - $object->addadmin_views = json_encode($this->addadmin_views, JSON_FORCE_OBJECT); - $object->created = $this->today; - $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')) - { - // set ID - $object->id = (int) $item_id; - return $this->db->updateObject('#__componentbuilder_component_admin_views', $object, 'id'); - } - // add to data base - return $this->db->insertObject('#__componentbuilder_component_admin_views', $object); - } - return false; - } -} diff --git a/admin/helpers/headercheck.php b/admin/helpers/headercheck.php index 707708464..edd5ee265 100644 --- a/admin/helpers/headercheck.php +++ b/admin/helpers/headercheck.php @@ -12,24 +12,36 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; + class componentbuilderHeaderCheck { + protected $document = null; + protected $app = null; + function js_loaded($script_name) { // UIkit check point if (strpos($script_name,'uikit') !== false) { - $app = JFactory::getApplication(); - $getTemplateName = $app->getTemplate('template')->template; - + if (!$this->app) + { + $this->app = Factory::getApplication(); + } + + $getTemplateName = $this->app->getTemplate('template')->template; if (strpos($getTemplateName,'yoo') !== false) { return true; } } - - $document = JFactory::getDocument(); - $head_data = $document->getHeadData(); + + if (!$this->document) + { + $this->document = Factory::getDocument(); + } + + $head_data = $this->document->getHeadData(); foreach (array_keys($head_data['scripts']) as $script) { if (stristr($script, $script_name)) @@ -40,24 +52,30 @@ function js_loaded($script_name) return false; } - + function css_loaded($script_name) { // UIkit check point if (strpos($script_name,'uikit') !== false) { - $app = JFactory::getApplication(); - $getTemplateName = $app->getTemplate('template')->template; - + if (!$this->app) + { + $this->app = Factory::getApplication(); + } + + $getTemplateName = $this->app->getTemplate('template')->template; if (strpos($getTemplateName,'yoo') !== false) { return true; } } - - $document = JFactory::getDocument(); - $head_data = $document->getHeadData(); - + + if (!$this->document) + { + $this->document = Factory::getDocument(); + } + + $head_data = $this->document->getHeadData(); foreach (array_keys($head_data['styleSheets']) as $script) { if (stristr($script, $script_name)) @@ -68,4 +86,4 @@ function css_loaded($script_name) return false; } -} \ No newline at end of file +} diff --git a/admin/helpers/html/batch_.php b/admin/helpers/html/batch_.php index d35e20b21..4ebc286b5 100644 --- a/admin/helpers/html/batch_.php +++ b/admin/helpers/html/batch_.php @@ -25,7 +25,7 @@ abstract class JHtmlBatch_ * @var array * @since 3.0 */ - protected static $ListSelection = array(); + protected static $ListSelection = []; /** * Render the batch selection options. diff --git a/admin/helpers/indenter.php b/admin/helpers/indenter.php deleted file mode 100644 index 575896cd0..000000000 --- a/admin/helpers/indenter.php +++ /dev/null @@ -1,204 +0,0 @@ - - @github 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'); - -/** - * @link https://github.com/gajus/dindent for the canonical source repository - * @license https://github.com/gajus/dindent/blob/master/LICENSE BSD 3-Clause - */ -class Indenter { - private - $log = array(), - $options = array( - 'indentation_character' => ' ' - ), - $inline_elements = array('b', 'big', 'i', 'small', 'tt', 'abbr', 'acronym', 'cite', 'code', 'dfn', 'em', 'kbd', 'strong', 'samp', 'var', 'a', 'bdo', 'br', 'img', 'span', 'sub', 'sup'), - $temporary_replacements_script = array(), - $temporary_replacements_inline = array(); - - const ELEMENT_TYPE_BLOCK = 0; - const ELEMENT_TYPE_INLINE = 1; - - const MATCH_INDENT_NO = 0; - const MATCH_INDENT_DECREASE = 1; - const MATCH_INDENT_INCREASE = 2; - const MATCH_DISCARD = 3; - - /** - * @param array $options - */ - public function __construct (array $options = array()) { - foreach ($options as $name => $value) { - if (!array_key_exists($name, $this->options)) { - throw new Exception\InvalidArgumentException('Unrecognized option.'); - } - - $this->options[$name] = $value; - } - } - - /** - * @param string $element_name Element name, e.g. "b". - * @param ELEMENT_TYPE_BLOCK|ELEMENT_TYPE_INLINE $type - * @return null - */ - public function setElementType ($element_name, $type) { - if ($type === static::ELEMENT_TYPE_BLOCK) { - $this->inline_elements = array_diff($this->inline_elements, array($element_name)); - } else if ($type === static::ELEMENT_TYPE_INLINE) { - $this->inline_elements[] = $element_name; - } else { - throw new Exception\InvalidArgumentException('Unrecognized element type.'); - } - - $this->inline_elements = array_unique($this->inline_elements); - } - - /** - * @param string $input HTML input. - * @return string Indented HTML. - */ - public function indent ($input) { - $this->log = array(); - - // Dindent does not indent ', $input); - } - } - - // Removing double whitespaces to make the source code easier to read. - // With exception of

    / CSS white-space changing the default behaviour, double whitespace is meaningless in HTML output.
    -        // This reason alone is sufficient not to use Dindent in production.
    -        $input = str_replace("\t", '', $input);
    -        $input = preg_replace('/\s{2,}/', ' ', $input);
    -
    -        // Remove inline elements and replace them with text entities.
    -        if (preg_match_all('/<(' . implode('|', $this->inline_elements) . ')[^>]*>(?:[^<]*)<\/\1>/', $input, $matches)) {
    -            $this->temporary_replacements_inline = $matches[0];
    -            foreach ($matches[0] as $i => $match) {
    -                $input = str_replace($match, 'ᐃ' . ($i + 1) . 'ᐃ', $input);
    -            }
    -        }
    -
    -        $subject = $input;
    -
    -        $output = '';
    -
    -        $next_line_indentation_level = 0;
    -
    -        do {
    -            $indentation_level = $next_line_indentation_level;
    -
    -            $patterns = array(
    -                // block tag
    -                '/^(<([a-z]+)(?:[^>]*)>(?:[^<]*)<\/(?:\2)>)/' => static::MATCH_INDENT_NO,
    -                // DOCTYPE
    -                '/^]*)>/' => static::MATCH_INDENT_NO,
    -                // tag with implied closing
    -                '/^<(input|link|meta|base|br|img|hr)([^>]*)>/' => static::MATCH_INDENT_NO,
    -                // opening tag
    -                '/^<[^\/]([^>]*)>/' => static::MATCH_INDENT_INCREASE,
    -                // closing tag
    -                '/^<\/([^>]*)>/' => static::MATCH_INDENT_DECREASE,
    -                // self-closing tag
    -                '/^<(.+)\/>/' => static::MATCH_INDENT_DECREASE,
    -                // whitespace
    -                '/^(\s+)/' => static::MATCH_DISCARD,
    -                // text node
    -                '/([^<]+)/' => static::MATCH_INDENT_NO
    -            );
    -            $rules = array('NO', 'DECREASE', 'INCREASE', 'DISCARD');
    -
    -            foreach ($patterns as $pattern => $rule) {
    -                if ($match = preg_match($pattern, $subject, $matches)) {
    -                    $this->log[] = array(
    -                        'rule' => $rules[$rule],
    -                        'pattern' => $pattern,
    -                        'subject' => $subject,
    -                        'match' => $matches[0]
    -                    );
    -
    -                    $subject = mb_substr($subject, mb_strlen($matches[0]));
    -
    -                    if ($rule === static::MATCH_DISCARD) {
    -                        break;
    -                    }
    -
    -                    if ($rule === static::MATCH_INDENT_NO) {
    -
    -                    } else if ($rule === static::MATCH_INDENT_DECREASE) {
    -                        $next_line_indentation_level--;
    -                        $indentation_level--;
    -                    } else {
    -                        $next_line_indentation_level++;
    -                    }
    -
    -                    if ($indentation_level < 0) {
    -                        $indentation_level = 0;
    -                    }
    -
    -                    $output .= str_repeat($this->options['indentation_character'], $indentation_level) . $matches[0] . "\n";
    -
    -                    break;
    -                }
    -            }
    -        } while ($match);
    -
    -        $interpreted_input = '';
    -        foreach ($this->log as $e) {
    -            $interpreted_input .= $e['match'];
    -        }
    -
    -        if ($interpreted_input !== $input) {
    -            throw new Exception\RuntimeException('Did not reproduce the exact input.');
    -        }
    -
    -        $output = preg_replace('/(<(\w+)[^>]*>)\s*(<\/\2>)/', '\\1\\3', $output);
    -
    -        foreach ($this->temporary_replacements_script as $i => $original) {
    -            $output = str_replace('', $original, $output);
    -        }
    -
    -        foreach ($this->temporary_replacements_inline as $i => $original) {
    -            $output = str_replace('ᐃ' . ($i + 1) . 'ᐃ', $original, $output);
    -        }
    -
    -        return trim($output);
    -    }
    -
    -    /**
    -     * Debugging utility. Get log for the last indent operation.
    -     *
    -     * @return array
    -     */
    -    public function getLog () {
    -        return $this->log;
    -    }
    -}
    diff --git a/admin/helpers/keywords_after.txt b/admin/helpers/keywords_after.txt
    deleted file mode 100644
    index 7ad651f54..000000000
    --- a/admin/helpers/keywords_after.txt
    +++ /dev/null
    @@ -1,7 +0,0 @@
    -in
    -public
    -extends
    -private
    -protected
    -implements
    -instanceof
    \ No newline at end of file
    diff --git a/admin/helpers/keywords_before.txt b/admin/helpers/keywords_before.txt
    deleted file mode 100644
    index c63026039..000000000
    --- a/admin/helpers/keywords_before.txt
    +++ /dev/null
    @@ -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
    \ No newline at end of file
    diff --git a/admin/helpers/keywords_reserved.txt b/admin/helpers/keywords_reserved.txt
    deleted file mode 100644
    index 626306fe5..000000000
    --- a/admin/helpers/keywords_reserved.txt
    +++ /dev/null
    @@ -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
    \ No newline at end of file
    diff --git a/admin/helpers/minify.php b/admin/helpers/minify.php
    deleted file mode 100644
    index b126a1f58..000000000
    --- a/admin/helpers/minify.php
    +++ /dev/null
    @@ -1,381 +0,0 @@
    -	
    -	@github			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 
    - *
    - * @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.'])(.*?((?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;
    -    }
    -}
    diff --git a/admin/helpers/operators_after.txt b/admin/helpers/operators_after.txt
    deleted file mode 100644
    index 68b7943d3..000000000
    --- a/admin/helpers/operators_after.txt
    +++ /dev/null
    @@ -1,45 +0,0 @@
    -+
    --
    -*
    -/
    -%
    -=
    -+=
    --=
    -*=
    -/=
    -%=
    -<<=
    ->>=
    ->>>=
    -&=
    -^=
    -|=
    -&
    -|
    -^
    -~
    -<<
    ->>
    ->>>
    -==
    -===
    -!=
    -!==
    ->
    -<
    ->=
    -<=
    -&&
    -||
    -.
    -[
    -]
    -?
    -:
    -,
    -;
    -(
    -)
    -{
    -}
    \ No newline at end of file
    diff --git a/admin/helpers/operators_before.txt b/admin/helpers/operators_before.txt
    deleted file mode 100644
    index 3bc220ac7..000000000
    --- a/admin/helpers/operators_before.txt
    +++ /dev/null
    @@ -1,43 +0,0 @@
    -+
    --
    -*
    -/
    -%
    -=
    -+=
    --=
    -*=
    -/=
    -%=
    -<<=
    ->>=
    ->>>=
    -&=
    -^=
    -|=
    -&
    -|
    -^
    -~
    -<<
    ->>
    ->>>
    -==
    -===
    -!=
    -!==
    ->
    -<
    ->=
    -<=
    -&&
    -||
    -!
    -.
    -[
    -?
    -:
    -,
    -;
    -(
    -{
    \ No newline at end of file
    diff --git a/admin/helpers/powerloader.php b/admin/helpers/powerloader.php
    new file mode 100644
    index 000000000..f95d8a694
    --- /dev/null
    +++ b/admin/helpers/powerloader.php
    @@ -0,0 +1,67 @@
    +
    + * @git        Joomla Component Builder 
    + * @copyright  Copyright (C) 2015 Vast Development Method. All rights reserved.
    + * @license    GNU General Public License version 2 or later; see LICENSE.txt
    + */
    +
    +// No direct access to this file
    +defined('_JEXEC') or die;
    +
    +// 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 additional namespace
    +\spl_autoload_register(function ($class) {
    +	// project-specific base directories and namespace prefix
    +	$search = [
    +		'libraries/vendor_jcb/VDM.Joomla.Gitea' => 'VDM\\Joomla\\Gitea',
    +		'libraries/vendor_jcb/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF',
    +		'libraries/vendor_jcb/VDM.Joomla' => 'VDM\\Joomla',
    +		'libraries/vendor_jcb/VDM.Minify' => 'VDM\\Minify',
    +		'libraries/vendor_jcb/VDM.Psr' => 'VDM\\Psr'
    +	];
    +	// Start the search and load if found
    +	$found = false;
    +	$found_base_dir = "";
    +	$found_len = 0;
    +	foreach ($search as $base_dir => $prefix)
    +	{
    +		// does the class use the namespace prefix?
    +		$len = strlen($prefix);
    +		if (strncmp($prefix, $class, $len) === 0)
    +		{
    +			// we have a match so load the values
    +			$found = true;
    +			$found_base_dir = $base_dir;
    +			$found_len = $len;
    +			// done here
    +			break;
    +		}
    +	}
    +	// check if we found a match
    +	if (!$found)
    +	{
    +		// not found so move to the next registered autoloader
    +		return;
    +	}
    +	// get the relative class name
    +	$relative_class = substr($class, $found_len);
    +	// replace the namespace prefix with the base directory, replace namespace
    +	// separators with directory separators in the relative class name, append
    +	// with .php
    +	$file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php';
    +	// if the file exists, require it
    +	if (file_exists($file))
    +	{
    +		require $file;
    +	}
    +});
    diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini
    index 895288ce3..cf6d61664 100644
    --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini
    +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini
    @@ -6,6 +6,7 @@ COM_COMPONENTBUILDER_ACCEPTS_ONLY_THE_VALUES_ZERO_ONE_TRUE_OR_FALSE_CASEINSENSIT
     COM_COMPONENTBUILDER_ACCESS="Access"
     COM_COMPONENTBUILDER_ACCESS_BULK_TOOLS="Access Bulk Tools"
     COM_COMPONENTBUILDER_ACCESS_DENIED="Access denied!"
    +COM_COMPONENTBUILDER_ACTIVATE_SUPER_POWERS="Activate Super Powers?"
     COM_COMPONENTBUILDER_ACTIVE_ONLY_FOUR_TEXT_FIELD="Active (only 4 text_field)"
     COM_COMPONENTBUILDER_ADD="Add"
     COM_COMPONENTBUILDER_ADD_ACCESS="Add Access"
    @@ -24,7 +25,7 @@ COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_ACCESS_DESC="Allows the users in this gr
     COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_BATCH_OPTIONS="Batch process the selected Admins Custom Tabs"
     COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_BATCH_TIP="All changes will be applied to all selected Admins Custom Tabs"
     COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_BATCH_USE="Admins Custom Tabs Batch Use"
    -COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch admins custom tabs"
    +COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch admins custom tabs"
     COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_CREATE="Admins Custom Tabs Create"
     COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_CREATE_DESC="Allows the users in this group to create create admins custom tabs"
     COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_DELETE="Admins Custom Tabs Delete"
    @@ -40,7 +41,7 @@ COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_EDIT_OWN_DESC="Allows the users in this
     COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_EDIT_STATE="Admins Custom Tabs Edit State"
     COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_EDIT_STATE_DESC="Allows the users in this group to update the state of the admin custom tabs"
     COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_EDIT_VERSION="Admins Custom Tabs Edit Version"
    -COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version admins custom tabs"
    +COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version admins custom tabs"
     COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_N_ITEMS_ARCHIVED="%s Admins Custom Tabs archived."
     COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_N_ITEMS_ARCHIVED_1="%s Admin Custom Tabs archived."
     COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_N_ITEMS_CHECKED_IN_0="No Admin Custom Tabs successfully checked in."
    @@ -66,14 +67,14 @@ COM_COMPONENTBUILDER_ADMINS_FIELDS_ACCESS_DESC="Allows the users in this group t
     COM_COMPONENTBUILDER_ADMINS_FIELDS_BATCH_OPTIONS="Batch process the selected Admins Fields"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_BATCH_TIP="All changes will be applied to all selected Admins Fields"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_BATCH_USE="Admins Fields Batch Use"
    -COM_COMPONENTBUILDER_ADMINS_FIELDS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch admins fields"
    +COM_COMPONENTBUILDER_ADMINS_FIELDS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch admins fields"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS="Admins Fields Conditions"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_ACCESS="Admins Fields Conditions Access"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_ACCESS_DESC="Allows the users in this group to access access admins fields conditions"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_BATCH_OPTIONS="Batch process the selected Admins Fields Conditions"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_BATCH_TIP="All changes will be applied to all selected Admins Fields Conditions"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_BATCH_USE="Admins Fields Conditions Batch Use"
    -COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch admins fields conditions"
    +COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch admins fields conditions"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_CREATE="Admins Fields Conditions Create"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_CREATE_DESC="Allows the users in this group to create create admins fields conditions"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_DELETE="Admins Fields Conditions Delete"
    @@ -89,7 +90,7 @@ COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_EDIT_OWN_DESC="Allows the users in
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_EDIT_STATE="Admins Fields Conditions Edit State"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_EDIT_STATE_DESC="Allows the users in this group to update the state of the admin fields conditions"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_EDIT_VERSION="Admins Fields Conditions Edit Version"
    -COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version admins fields conditions"
    +COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version admins fields conditions"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_N_ITEMS_ARCHIVED="%s Admins Fields Conditions archived."
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_N_ITEMS_ARCHIVED_1="%s Admin Fields Conditions archived."
     COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_N_ITEMS_CHECKED_IN_0="No Admin Fields Conditions successfully checked in."
    @@ -124,7 +125,7 @@ COM_COMPONENTBUILDER_ADMINS_FIELDS_EDIT_OWN_DESC="Allows the users in this group
     COM_COMPONENTBUILDER_ADMINS_FIELDS_EDIT_STATE="Admins Fields Edit State"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_EDIT_STATE_DESC="Allows the users in this group to update the state of the admin fields"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_EDIT_VERSION="Admins Fields Edit Version"
    -COM_COMPONENTBUILDER_ADMINS_FIELDS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version admins fields"
    +COM_COMPONENTBUILDER_ADMINS_FIELDS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version admins fields"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_N_ITEMS_ARCHIVED="%s Admins Fields archived."
     COM_COMPONENTBUILDER_ADMINS_FIELDS_N_ITEMS_ARCHIVED_1="%s Admin Fields archived."
     COM_COMPONENTBUILDER_ADMINS_FIELDS_N_ITEMS_CHECKED_IN_0="No Admin Fields successfully checked in."
    @@ -150,7 +151,7 @@ COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_ACCESS_DESC="Allows the users in th
     COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_BATCH_OPTIONS="Batch process the selected Admins Fields Relations"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_BATCH_TIP="All changes will be applied to all selected Admins Fields Relations"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_BATCH_USE="Admins Fields Relations Batch Use"
    -COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch admins fields relations"
    +COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch admins fields relations"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_CREATE="Admins Fields Relations Create"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_CREATE_DESC="Allows the users in this group to create create admins fields relations"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_DELETE="Admins Fields Relations Delete"
    @@ -166,7 +167,7 @@ COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_EDIT_OWN_DESC="Allows the users in
     COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_EDIT_STATE="Admins Fields Relations Edit State"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_EDIT_STATE_DESC="Allows the users in this group to update the state of the admin fields relations"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_EDIT_VERSION="Admins Fields Relations Edit Version"
    -COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version admins fields relations"
    +COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version admins fields relations"
     COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_N_ITEMS_ARCHIVED="%s Admins Fields Relations archived."
     COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_N_ITEMS_ARCHIVED_1="%s Admin Fields Relations archived."
     COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_N_ITEMS_CHECKED_IN_0="No Admin Fields Relations successfully checked in."
    @@ -198,6 +199,7 @@ COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_CREATED_DATE_DESC="The date this Admin Cu
     COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_CREATED_DATE_LABEL="Created Date"
     COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_EDIT="Editing the Admin Custom Tabs"
     COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_ERROR_UNIQUE_ALIAS="Another Admin Custom Tabs has the same alias."
    +COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Admin Custom Tabs has the same alias ."
     COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_HTML_HINT="// Add the tab HTML here. To access php values methodname->value; ?>"
     COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_HTML_LABEL="HTML"
     COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_ID="Id"
    @@ -253,6 +255,7 @@ COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_CREATED_DATE_DESC="The date this Ad
     COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_CREATED_DATE_LABEL="Created Date"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_EDIT="Editing the Admin Fields Conditions"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ERROR_UNIQUE_ALIAS="Another Admin Fields Conditions has the same alias."
    +COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Admin Fields Conditions has the same alias ."
     COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_EXACT_LENGTH_ONLY_4_TEXT_FIELD="Exact Length (only 4 text_field)"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_HIDE_ONLY="Hide Only"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_HIDE_TOGGLE="Hide Toggle"
    @@ -305,6 +308,7 @@ COM_COMPONENTBUILDER_ADMIN_FIELDS_DEFAULT="Default"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_EDIT="Editing the Admin Fields"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_EDITING="Editing"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_ERROR_UNIQUE_ALIAS="Another Admin Fields has the same alias."
    +COM_COMPONENTBUILDER_ADMIN_FIELDS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Admin Fields has the same alias ."
     COM_COMPONENTBUILDER_ADMIN_FIELDS_FIELD="Field"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_FIELDS="Fields"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_FIELD_DESCRIPTION="Select a field"
    @@ -356,6 +360,7 @@ COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_CREATED_DATE_LABEL="Created Date"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_CUSTOM_RAQUO_CODE="Custom » Code"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_EDIT="Editing the Admin Fields Relations"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_ERROR_UNIQUE_ALIAS="Another Admin Fields Relations has the same alias."
    +COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Admin Fields Relations has the same alias ."
     COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_ID="Id"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_JOINFIELDS="Joinfields"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_JOINFIELDS_DESCRIPTION="Select the target join fields."
    @@ -371,8 +376,7 @@ COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_MODIFIED_BY_LABEL="Modified By"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_MODIFIED_DATE_DESC="The date this Admin Fields Relations was modified."
     COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_MODIFIED_DATE_LABEL="Modified Date"
     COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_NEW="A New Admin Fields Relations"
    -COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_NOTE_ON_RELATIONS_DESCRIPTION="

    Here you are able to combine/join multiple fields into one for display in the list view of the admin area.

    -

    You are able to add calculations, or even model the values into one result.

    " +COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_NOTE_ON_RELATIONS_DESCRIPTION="

    Here you are able to combine/join multiple fields into one for display in the list view of the admin area.

    You are able to add calculations, or even model the values into one result.

    " COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_NOTE_ON_RELATIONS_LABEL="Relations Implementation" COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_ORDERING_LABEL="Ordering" COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_PERMISSION="Permissions" @@ -413,11 +417,9 @@ COM_COMPONENTBUILDER_ADMIN_VIEWS_ACCESS_DESC="Allows the users in this group to COM_COMPONENTBUILDER_ADMIN_VIEWS_BATCH_OPTIONS="Batch process the selected Admin Views" COM_COMPONENTBUILDER_ADMIN_VIEWS_BATCH_TIP="All changes will be applied to all selected Admin Views" 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_BATCH_USE_DESC="Allows the 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" @@ -434,7 +436,7 @@ COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_OWN_DESC="Allows the users in this group t COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_STATE="Admin Views Edit State" COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_STATE_DESC="Allows the users in this group to update the state of the admin view" COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_VERSION="Admin Views Edit Version" -COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version admin views" +COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version admin views" COM_COMPONENTBUILDER_ADMIN_VIEWS_EXPORT="Admin Views Export" COM_COMPONENTBUILDER_ADMIN_VIEWS_EXPORT_DESC="Allows the users in this group to export export admin views" COM_COMPONENTBUILDER_ADMIN_VIEWS_IMPORT="Admin Views Import" @@ -669,6 +671,7 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_ENVELOPE="Envelope" COM_COMPONENTBUILDER_ADMIN_VIEW_ENVELOPE_OPENED="Envelope Opened" COM_COMPONENTBUILDER_ADMIN_VIEW_EQUALIZER="Equalizer" COM_COMPONENTBUILDER_ADMIN_VIEW_ERROR_UNIQUE_ALIAS="Another Admin View has the same alias." +COM_COMPONENTBUILDER_ADMIN_VIEW_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Admin View has the same alias ." COM_COMPONENTBUILDER_ADMIN_VIEW_EUCJPMS_BIN_CHARSET_EUCJPMS="eucjpms_bin (charset = eucjpms)" COM_COMPONENTBUILDER_ADMIN_VIEW_EUCJPMS_JAPANESE_CI_CHARSET_EUCJPMS="eucjpms_japanese_ci (charset = eucjpms)" COM_COMPONENTBUILDER_ADMIN_VIEW_EUCJPMS_UJIS_FOR_WINDOWS_JAPANESE_MOST_SUITABLE_COLLATION_EUCJPMS_JAPANESE_CI="eucjpms - UJIS for Windows Japanese (most suitable collation = eucjpms_japanese_ci)" @@ -864,14 +867,12 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_HINT="Name Here" COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_LABEL="Name" COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_LIST_DESCRIPTION="The name of the list of records in this view" COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_LIST_HINT="List of Records Name Here" -COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_LIST_LABEL="Name (list of records)
    -Naming Conventions" +COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_LIST_LABEL="Name (list of records)
    Naming Conventions" COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_LIST_MESSAGE="Error! Please add list of records name here." COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_MESSAGE="Error! Please add name here." COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_SINGLE_DESCRIPTION="Type null if single record view is not to be set" COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_SINGLE_HINT="Single Record Name Here" -COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_SINGLE_LABEL="Name (single record)
    -Naming Conventions" +COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_SINGLE_LABEL="Name (single record)
    Naming Conventions" COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_SINGLE_MESSAGE="Error! Please add single record name here." COM_COMPONENTBUILDER_ADMIN_VIEW_NEW="A New Admin View" COM_COMPONENTBUILDER_ADMIN_VIEW_NEW_TAB="New Tab" @@ -890,15 +891,7 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_BEGINNER_IMPORT_LABEL="Beginners notice." COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_CATEGORY_MENU_SWITCH_DESCRIPTION="You can now choose whether this view's category is added to the sub-menu." COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_CATEGORY_MENU_SWITCH_LABEL="Category Menu Switch" COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_CREATE_EDIT_BUTTONS_DESCRIPTION="Some Shortcut Buttons
    " -COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_CREATE_EDIT_DISPLAY_DESCRIPTION="
    -

    Linked Fields

    -
    Display of the fields will load here!
    -
    -

    Field Relations

    -
    Display of the fields relations will load here!
    -
    -

    Field Conditions

    -
    Display of the fields conditions will load here!
    " +COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_CREATE_EDIT_DISPLAY_DESCRIPTION="

    Linked Fields

    Display of the fields will load here!

    Field Relations

    Display of the fields relations will load here!

    Field Conditions

    Display of the fields conditions will load here!
    " COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_CREATE_EDIT_NOTICE_DESCRIPTION="
    Welcome to the new improved fields and conditions layout.

    We had to remove the repeatable fields layouts since Joomla has depreciated it. With this new improved layout we trust your experience will be better then ever before.

    You can still watch the tutorials, and though it was made during the time repeatable fields were still being used, the various concepts and layouts still look mostly the same.

    " COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_CREATE_EDIT_NOTICE_LABEL="Fields & Conditions" COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_CUSTOM_TABS_NOTE_DESCRIPTION="You can add more custom tabs to this admin view, these tabs are generally used for static HTML content or Ajax generated fields/content. You can not have an admin view with only custom tabs, they can only be used as an add-on, not a stand alone." @@ -1055,9 +1048,10 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_SMILEY_NEUTRAL="Smiley Neutral" COM_COMPONENTBUILDER_ADMIN_VIEW_SMILEY_NEUTRAL_2="Smiley Neutral 2" COM_COMPONENTBUILDER_ADMIN_VIEW_SMILEY_SAD="Smiley Sad" COM_COMPONENTBUILDER_ADMIN_VIEW_SMILEY_SAD_2="Smiley Sad 2" -COM_COMPONENTBUILDER_ADMIN_VIEW_SOURCEMAP_DESCRIPTION="Map the Source to this view's fields.
    // First Table Map.
    SourceField => viewField
    // Other Tables Map.
    firstTableKeySourceField == keySourceField
    SourceField => viewField" +COM_COMPONENTBUILDER_ADMIN_VIEW_SOURCEMAP_DESCRIPTION="Map the Source to this view's fields.
    // First Table Map.
    SourceField => viewField
    // Other Tables Map.
    firstTableKeySourceField == keySourceField
    SourceField => viewField
    // Remember to add all fields that has no default value, and is not null." COM_COMPONENTBUILDER_ADMIN_VIEW_SOURCEMAP_HINT="SourceField => viewField" COM_COMPONENTBUILDER_ADMIN_VIEW_SOURCEMAP_LABEL="Source Map" +COM_COMPONENTBUILDER_ADMIN_VIEW_SOURCEMAP_MESSAGE="Please review the Source Map selection, as it appears that certain mandatory fields have been excluded from the (MySQL -> Tables -> Source Map) selection. These specific fields are designated as 'not null' and lack default values. This oversight may lead to errors when installing your component on Joomla 5 and above. To address this issue, you are presented with a few options:

    1. Assign a default value to the field. This can be done within the specific field settings under the Database Tab.
    2. Modify the field's Null Switch to 'NULL'. This adjustment also takes place in the field settings.3. Alternatively, you could add these fields into the MySQL -> Tables -> Source Map selection. This inclusion ensures that all necessary data parameters are correctly mapped in the MySQL (dump) and available during the Joomla component installation process.

    By taking one of these actions, you will prevent potential installation errors and ensure compatibility with the requirements of Joomla 5 and above." COM_COMPONENTBUILDER_ADMIN_VIEW_SOURCE_LABEL="Select MySql Source" COM_COMPONENTBUILDER_ADMIN_VIEW_SQL_DESCRIPTION="Add your MySQL here!" COM_COMPONENTBUILDER_ADMIN_VIEW_SQL_HINT="// Add MySQL Table Dump Here" @@ -1286,21 +1280,26 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_YES="Yes" COM_COMPONENTBUILDER_ADMIN_VIEW_YOUTUBE="Youtube" COM_COMPONENTBUILDER_ADMIN_VIEW_ZOOM_IN="Zoom In" COM_COMPONENTBUILDER_ADMIN_VIEW_ZOOM_OUT="Zoom Out" +COM_COMPONENTBUILDER_ADVANCED_OPTIONS="Advanced Options" COM_COMPONENTBUILDER_AHEAD="Ahead" COM_COMPONENTBUILDER_AHEAD_MEANS_YOUR_BLOCAL_SNIPPETB_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_A_BNEWER_MODIFIED_DATEB_THEN_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE="Ahead means your local snippet (with the same name, library and type) has a newer modified date then the community snippet (with the same name, library and type)." COM_COMPONENTBUILDER_AJAX="Ajax" COM_COMPONENTBUILDER_ALIAS="Alias" COM_COMPONENTBUILDER_ALIGNMENT="Alignment" COM_COMPONENTBUILDER_ALL="All" -COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER="All is good, please check again latter." +COM_COMPONENTBUILDER_ALLOWS_YOU_TO_OVERRIDE_THE_BUILD_DATE_BY_SELECTING_A_DATE_MANUALLY_FROM_THE_CALENDER="Allows you to override the build date by selecting a date manually from the calender." +COM_COMPONENTBUILDER_ALL_FOUND_INSTANCES_IN_S_WHERE_REPLACED="All found instances in %s where replaced" +COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATER="All is good, please check again later" COM_COMPONENTBUILDER_ALL_IS_GOOD_THERE_IS_NO_NOTICE_AT_THIS_TIME="All is good, there is no notice at this time." COM_COMPONENTBUILDER_ALL_OF_THESE_PACKAGES_ARE_A_FULLY_DEVELOPEDMAPPED_COMPONENTS_FOR_JCB_THEY_CAN_BE_SEEN_AS_DEMO_CONTENT_OR_BASE_IMAGES_FROM_WHICH_TO_START_YOUR_PROJECTBR_ALWAYS_MAKE_SURE_YOU_ARE_ON_THE_LATEST_VERSION_OF_JCB_BEFORE_IMPORTING_ANY_OF_THESE_PACKAGES_SHOULD_ANY_OF_THEM_FAIL_TO_IMPORT_A_S_PLEASE_LET_US_KNOWA="All of these packages are a fully developed/mapped components for JCB. They can be seen as demo content, or base images from which to start your project.
    Always make sure you are on the latest version of JCB before importing any of these packages, should any of them fail to import please let us know." +COM_COMPONENTBUILDER_ALL_THE_FIELDS_AND_VIEWS_FROM_YOUR_SQL_DUMP_HAS_BEEN_CREATED_AND_LINKED_TO_THIS_COMPONENT="All the fields and views from your sql dump has been created and linked to this component." COM_COMPONENTBUILDER_ALL_THE_LANGUAGES_FOUND_IN_JOOMLA_WERE_SUCCESSFULLY_IMPORTED="All the languages found in Joomla were successfully imported." COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE="All unsaved work on this page will be lost, are you sure you want to continue?" COM_COMPONENTBUILDER_ALREADY_SELECTED_TRY_ANOTHER="Already selected, try another." COM_COMPONENTBUILDER_ALREADY_TRANSLATED_INTO="Already translated into" COM_COMPONENTBUILDER_ALWAYS_ADD="Always Add" COM_COMPONENTBUILDER_ALWAYS_INSURE_THAT_YOU_HAVE_YOUR_LOCAL_COMPONENTS_BACKED_UP_BY_MAKING_AN_EXPORT_OF_ALL_YOUR_LOCAL_COMPONENTS_BEFORE_IMPORTING_ANY_NEW_COMPONENTS_SMALLMAKE_BSUREB_TO_MOVE_THIS_ZIPPED_BACKUP_PACKAGE_OUT_OF_THE_TMP_FOLDER_BEFORE_DOING_AN_IMPORTSMALLBR_IF_YOU_ARE_IMPORTING_A_PACKAGE_OF_A_THREERD_PARTY_JCB_PACKAGE_DEVELOPER_BMAKE_SURE_IT_IS_A_REPUTABLE_JCB_PACKAGE_DEVELOPERSB_A_SFIND_OUT_WHYA="Always insure that you have your local components backed up, by making an export of all your local components before importing any new components. (Make SURE to move this zipped backup package out of the tmp folder before doing an import)
    If you are importing a package of a 3rd party JCB package developer, make sure it is a reputable JCB package developers! Find out why!" +COM_COMPONENTBUILDER_AND_FINISHED_THE_SEARCH_IN="and finished the search in" COM_COMPONENTBUILDER_ANY_LANGUAGE="Any language" COM_COMPONENTBUILDER_ANY_SELECTION_ONLY_FOUR_LISTRADIOCHECKBOXESDYNAMIC_LIST="Any Selection (only 4 list/radio/checkboxes/dynamic_list)" COM_COMPONENTBUILDER_AN_ERROR_HAS_OCCURRED="An error has occurred" @@ -1311,12 +1310,14 @@ COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_CONTINUE="Are you sure you w COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_REPLACE_YOUR_LOCAL_SNIPPET_WITH_THIS_JCB_COMMUNITY_SNIPPET="Are you sure you would like to replace your local snippet with this JCB community snippet?" COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_UPDATE_YOUR_LOCAL_SNIPPET_WITH_THIS_NEWER_JCB_COMMUNITY_SNIPPET="Are you sure you would like to update your local snippet with this newer JCB community snippet?" COM_COMPONENTBUILDER_ARE_YOU_SURE_YOU_WOULD_LIKE_TO_UPDATE_YOUR_LOCAL_SNIPPET_WITH_THIS_OLDER_JCB_COMMUNITY_SNIPPET="Are you sure you would like to update your local snippet with this older JCB community snippet?" +COM_COMPONENTBUILDER_ARE_YOU_THEREFORE_ABSOLUTELY_SURE_YOU_WANT_TO_CONTINUE="Are you therefore absolutely sure you want to continue?" COM_COMPONENTBUILDER_AUTHOR="Author" COM_COMPONENTBUILDER_AUTHOR_EMAIL="Author Email" COM_COMPONENTBUILDER_AUTHOR_NAME="Author Name" COM_COMPONENTBUILDER_AUTHOR_WEBSITE="Author Website" COM_COMPONENTBUILDER_AUTO_CHECKIN="Auto Check-in" COM_COMPONENTBUILDER_AVAILABLE_LIBRARIES="Available Libraries" +COM_COMPONENTBUILDER_A_METHOD_S_WAS_ADDED_TO_THE_INSTALL_BSB_OF_THIS_PACKAGE_TO_INSURE_THAT_THE_FOLDERS_ARE_COPIED_INTO_THE_CORRECT_PLACE_WHEN_THIS_COMPONENT_IS_INSTALLED="A method (%s) was added to the install %s of this package to insure that the folder(s) are copied into the correct place when this component is installed!" COM_COMPONENTBUILDER_A_S_SPAN_CLASSICONFLAG_SPANREPORT_BROKEN_PACKAGEA=" Report Broken Package" COM_COMPONENTBUILDER_BACK="Back" COM_COMPONENTBUILDER_BACKUP="Backup" @@ -1330,9 +1331,11 @@ COM_COMPONENTBUILDER_BASIC_TUTORIAL_ON_GIT_BSB="Basic Tutorial on git: %s COM_COMPONENTBUILDER_BBEST_TO_NOT_CONTINUEBBR_WE_COULD_NOT_LOAD_THE_CHECKSUM_FOR_THIS_PACKAGE_AND_SO_NO_VALIDATION_WAS_POSSIBLE_THIS_MAY_BE_DUE_TO_YOUR_NETWORK_OR_A_CHANGE_TO_THAT_PACKAGE_NAME="Best to not continue!
    We could not load the checksum for this package, and so no validation was possible. This may be due to your network, or a change to that package name." COM_COMPONENTBUILDER_BBEST_TO_NOT_CONTINUEBBR_YOU_CAN_REFRESH_AND_TRY_AGAINBR_BUT_NOTE_THAT_THIS_PACKAGE_BFAILEDB_CHECKSUM_VALIDATION_THIS_COULD_BE_A_SERIOUS_SECURITY_BREACH_DO_NOT_CONTINUE="Best to not continue!
    You can Refresh and try again.
    But note that this package FAILED checksum validation, this could be a serious security breach! DO NOT CONTINUE!!!" COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVED_TO_CORRECT_LOCATION="Custom files not moved to correct location!" +COM_COMPONENTBUILDER_BECOME_A_CONTRIBUTOR="Become a Contributor" +COM_COMPONENTBUILDER_BEHAVIOUR="Behaviour" COM_COMPONENTBUILDER_BEHIND="Behind" COM_COMPONENTBUILDER_BEHIND_MEANS_YOUR_BLOCAL_SNIPPETB_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_A_BOLDER_MODIFIED_DATEB_THEN_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE="Behind means your local snippet (with the same name, library and type) has a older modified date then the community snippet (with the same name, library and type)." -COM_COMPONENTBUILDER_BETA_RELEASE="Beta Release" +COM_COMPONENTBUILDER_BE_A_PART_OF_JCB="Be a Part of JCB" COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE="Be cautious! Do not continue unless you trust the origin of this package!" COM_COMPONENTBUILDER_BFIELD_TYPEB_IDS_MISMATCH_IN_BSB="Field type id:%s mismatch in %s." COM_COMPONENTBUILDER_BFIELD_TYPEB_NOT_SET_FOR_BSB="Field type not set for %s." @@ -1350,6 +1353,7 @@ COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CH COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB="The tmp folder has been clear successfully!" COM_COMPONENTBUILDER_BUILD="Build" COM_COMPONENTBUILDER_BUILDIN="Build-in" +COM_COMPONENTBUILDER_BUILD_DATE="Build Date" COM_COMPONENTBUILDER_BULK="Bulk" COM_COMPONENTBUILDER_BULK_GET_ALL_NEW_SNIPPETS="Bulk Get All New Snippets" COM_COMPONENTBUILDER_BULK_TOOLS="Bulk Tools" @@ -1367,7 +1371,7 @@ COM_COMPONENTBUILDER_CLASS_EXTENDINGS_ACCESS_DESC="Allows the users in this grou COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_OPTIONS="Batch process the selected Class Extendings" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_TIP="All changes will be applied to all selected Class Extendings" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_USE="Class Extendings Batch Use" -COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch class extendings" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_CREATE="Class Extendings Create" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_CREATE_DESC="Allows the users in this group to create create class extendings" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_DELETE="Class Extendings Delete" @@ -1383,7 +1387,7 @@ COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_OWN_DESC="Allows the users in this gr COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_STATE="Class Extendings Edit State" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_STATE_DESC="Allows the users in this group to update the state of the class extends" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_VERSION="Class Extendings Edit Version" -COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version class extendings" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_ARCHIVED="%s Class Extendings archived." COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_ARCHIVED_1="%s Class Extends archived." COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_CHECKED_IN_0="No Class Extends successfully checked in." @@ -1405,11 +1409,7 @@ COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_UNPUBLISHED="%s Class Extendings u COM_COMPONENTBUILDER_CLASS_EXTENDINGS_N_ITEMS_UNPUBLISHED_1="%s Class Extends unpublished." COM_COMPONENTBUILDER_CLASS_EXTENDS="Class Extends" COM_COMPONENTBUILDER_CLASS_EXTENDS_COMMENT_DESCRIPTION="The class comment" -COM_COMPONENTBUILDER_CLASS_EXTENDS_COMMENT_HINT="/** - * [NAME] - * - * @package [COMPONENT_NAME] - */" +COM_COMPONENTBUILDER_CLASS_EXTENDS_COMMENT_HINT="/** * [NAME] * * @package [COMPONENT_NAME] */" COM_COMPONENTBUILDER_CLASS_EXTENDS_COMMENT_LABEL="Class Comment" COM_COMPONENTBUILDER_CLASS_EXTENDS_COMPONENTS="components" COM_COMPONENTBUILDER_CLASS_EXTENDS_CREATED_BY_DESC="The user that created this Class Extends." @@ -1419,6 +1419,7 @@ COM_COMPONENTBUILDER_CLASS_EXTENDS_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_CLASS_EXTENDS_DETAILS="Details" COM_COMPONENTBUILDER_CLASS_EXTENDS_EDIT="Editing the Class Extends" COM_COMPONENTBUILDER_CLASS_EXTENDS_ERROR_UNIQUE_ALIAS="Another Class Extends has the same alias." +COM_COMPONENTBUILDER_CLASS_EXTENDS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Class Extends has the same alias ." COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_DESCRIPTION="The type this class_extends belongs to." COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL="Type" COM_COMPONENTBUILDER_CLASS_EXTENDS_HEAD_DESCRIPTION="The class header to add any header values can be added." @@ -1451,7 +1452,7 @@ COM_COMPONENTBUILDER_CLASS_METHODS_ACCESS_DESC="Allows the users in this group t COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_OPTIONS="Batch process the selected Class Methods" COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_TIP="All changes will be applied to all selected Class Methods" COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_USE="Class Methods Batch Use" -COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch class methods" COM_COMPONENTBUILDER_CLASS_METHODS_CREATE="Class Methods Create" COM_COMPONENTBUILDER_CLASS_METHODS_CREATE_DESC="Allows the users in this group to create create class methods" COM_COMPONENTBUILDER_CLASS_METHODS_DELETE="Class Methods Delete" @@ -1467,7 +1468,7 @@ COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_OWN_DESC="Allows the users in this group COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_STATE="Class Methods Edit State" COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_STATE_DESC="Allows the users in this group to update the state of the class method" COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_VERSION="Class Methods Edit Version" -COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version class methods" COM_COMPONENTBUILDER_CLASS_METHODS_EXPORT="Class Methods Export" COM_COMPONENTBUILDER_CLASS_METHODS_EXPORT_DESC="Allows the users in this group to export export class methods" COM_COMPONENTBUILDER_CLASS_METHODS_IMPORT="Class Methods Import" @@ -1497,12 +1498,7 @@ COM_COMPONENTBUILDER_CLASS_METHOD_ARGUMENTS_LABEL="Params
    Method Arg COM_COMPONENTBUILDER_CLASS_METHOD_CODE_DESCRIPTION="Add the code here." COM_COMPONENTBUILDER_CLASS_METHOD_CODE_LABEL="Code" COM_COMPONENTBUILDER_CLASS_METHOD_COMMENT_DESCRIPTION="The comment" -COM_COMPONENTBUILDER_CLASS_METHOD_COMMENT_HINT="/** - * [NAME] - * - * [PARAMS] - * - */" +COM_COMPONENTBUILDER_CLASS_METHOD_COMMENT_HINT="/** * [NAME] * * [PARAMS] * */" COM_COMPONENTBUILDER_CLASS_METHOD_COMMENT_LABEL="DocBlock" COM_COMPONENTBUILDER_CLASS_METHOD_COMPONENTS="components" COM_COMPONENTBUILDER_CLASS_METHOD_CREATED_BY_DESC="The user that created this Class Method." @@ -1512,6 +1508,7 @@ COM_COMPONENTBUILDER_CLASS_METHOD_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_CLASS_METHOD_DETAILS="Details" COM_COMPONENTBUILDER_CLASS_METHOD_EDIT="Editing the Class Method" COM_COMPONENTBUILDER_CLASS_METHOD_ERROR_UNIQUE_ALIAS="Another Class Method has the same alias." +COM_COMPONENTBUILDER_CLASS_METHOD_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Class Method has the same alias ." COM_COMPONENTBUILDER_CLASS_METHOD_EXTENSION_TYPE_DESCRIPTION="The type this class_method belongs to." COM_COMPONENTBUILDER_CLASS_METHOD_EXTENSION_TYPE_LABEL="Type" COM_COMPONENTBUILDER_CLASS_METHOD_GUID_DESCRIPTION="Globally Unique Identifier" @@ -1553,7 +1550,7 @@ COM_COMPONENTBUILDER_CLASS_PROPERTIES_ACCESS_DESC="Allows the users in this grou COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_OPTIONS="Batch process the selected Class Properties" COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_TIP="All changes will be applied to all selected Class Properties" COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_USE="Class Properties Batch Use" -COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch class properties" COM_COMPONENTBUILDER_CLASS_PROPERTIES_CREATE="Class Properties Create" COM_COMPONENTBUILDER_CLASS_PROPERTIES_CREATE_DESC="Allows the users in this group to create create class properties" COM_COMPONENTBUILDER_CLASS_PROPERTIES_DELETE="Class Properties Delete" @@ -1569,7 +1566,7 @@ COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_OWN_DESC="Allows the users in this gr COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_STATE="Class Properties Edit State" COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_STATE_DESC="Allows the users in this group to update the state of the class property" COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_VERSION="Class Properties Edit Version" -COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version class properties" COM_COMPONENTBUILDER_CLASS_PROPERTIES_EXPORT="Class Properties Export" COM_COMPONENTBUILDER_CLASS_PROPERTIES_EXPORT_DESC="Allows the users in this group to export export class properties" COM_COMPONENTBUILDER_CLASS_PROPERTIES_IMPORT="Class Properties Import" @@ -1595,12 +1592,7 @@ COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_UNPUBLISHED="%s Class Properties u COM_COMPONENTBUILDER_CLASS_PROPERTIES_N_ITEMS_UNPUBLISHED_1="%s Class Property unpublished." COM_COMPONENTBUILDER_CLASS_PROPERTY="Class Property" COM_COMPONENTBUILDER_CLASS_PROPERTY_COMMENT_DESCRIPTION="The comment" -COM_COMPONENTBUILDER_CLASS_PROPERTY_COMMENT_HINT="/** - * [NAME] - * - * [PARAMS] - * - */" +COM_COMPONENTBUILDER_CLASS_PROPERTY_COMMENT_HINT="/** * [NAME] * * [PARAMS] * */" COM_COMPONENTBUILDER_CLASS_PROPERTY_COMMENT_LABEL="DocBlock" COM_COMPONENTBUILDER_CLASS_PROPERTY_COMPONENTS="components" COM_COMPONENTBUILDER_CLASS_PROPERTY_CREATED_BY_DESC="The user that created this Class Property." @@ -1614,6 +1606,7 @@ COM_COMPONENTBUILDER_CLASS_PROPERTY_DEFAULT_MESSAGE="Error! Please add default v COM_COMPONENTBUILDER_CLASS_PROPERTY_DETAILS="Details" COM_COMPONENTBUILDER_CLASS_PROPERTY_EDIT="Editing the Class Property" COM_COMPONENTBUILDER_CLASS_PROPERTY_ERROR_UNIQUE_ALIAS="Another Class Property has the same alias." +COM_COMPONENTBUILDER_CLASS_PROPERTY_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Class Property has the same alias ." COM_COMPONENTBUILDER_CLASS_PROPERTY_EXTENSION_TYPE_DESCRIPTION="The type this class_property belongs to." COM_COMPONENTBUILDER_CLASS_PROPERTY_EXTENSION_TYPE_LABEL="Type" COM_COMPONENTBUILDER_CLASS_PROPERTY_GUID_DESCRIPTION="Globally Unique Identifier" @@ -1649,11 +1642,13 @@ COM_COMPONENTBUILDER_CLASS_PROPERTY_VERSION_DESC="A count of the number of times COM_COMPONENTBUILDER_CLASS_PROPERTY_VERSION_LABEL="Version" COM_COMPONENTBUILDER_CLASS_PROPERTY_VISIBILITY_DESCRIPTION="The visibility of a function/method or property can be defined by prefixing the declaration with the keywords public, protected or private. You also have the option to make function/method or property static." COM_COMPONENTBUILDER_CLASS_PROPERTY_VISIBILITY_LABEL="Visibility" +COM_COMPONENTBUILDER_CLEAR="Clear" COM_COMPONENTBUILDER_CLEAR_TMP="Clear tmp" COM_COMPONENTBUILDER_CLONE="Clone" COM_COMPONENTBUILDER_CLONE_FAILED="Clone failed!" COM_COMPONENTBUILDER_CLOSE_NEW="Close & New" COM_COMPONENTBUILDER_CODE="Code" +COM_COMPONENTBUILDER_CODESTRINGS="code/strings" COM_COMPONENTBUILDER_COMMUNITY_PACKAGES="Community Packages" COM_COMPONENTBUILDER_COMPANY="Company" COM_COMPONENTBUILDER_COMPANY_NAME="Company Name" @@ -1684,7 +1679,7 @@ COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_ACCESS_DESC="Allows the users in thi COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_BATCH_OPTIONS="Batch process the selected Components Admin Views" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_BATCH_TIP="All changes will be applied to all selected Components Admin Views" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_BATCH_USE="Components Admin Views Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components admin views" +COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components admin views" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_CREATE="Components Admin Views Create" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_CREATE_DESC="Allows the users in this group to create create components admin views" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_DELETE="Components Admin Views Delete" @@ -1700,7 +1695,7 @@ COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_EDIT_OWN_DESC="Allows the users in t COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_EDIT_STATE="Components Admin Views Edit State" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component admin views" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_EDIT_VERSION="Components Admin Views Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components admin views" +COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components admin views" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_N_ITEMS_ARCHIVED="%s Components Admin Views archived." COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_N_ITEMS_ARCHIVED_1="%s Component Admin Views archived." COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_N_ITEMS_CHECKED_IN_0="No Component Admin Views successfully checked in." @@ -1720,13 +1715,14 @@ COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_N_ITEMS_UNFEATURED="%s Components Ad COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_N_ITEMS_UNFEATURED_1="%s Component Admin Views unfeatured." COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_N_ITEMS_UNPUBLISHED="%s Components Admin Views unpublished." COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_N_ITEMS_UNPUBLISHED_1="%s Component Admin Views unpublished." +COM_COMPONENTBUILDER_COMPONENTS_BR_SMALLDISABLED_SOONSMALL="Components
    (disabled... soon!)" COM_COMPONENTBUILDER_COMPONENTS_CONFIG="Components Config" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_ACCESS="Components Config Access" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_ACCESS_DESC="Allows the users in this group to access access components config" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_BATCH_OPTIONS="Batch process the selected Components Config" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_BATCH_TIP="All changes will be applied to all selected Components Config" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_BATCH_USE="Components Config Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_CONFIG_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components config" +COM_COMPONENTBUILDER_COMPONENTS_CONFIG_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components config" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_CREATE="Components Config Create" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_CREATE_DESC="Allows the users in this group to create create components config" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_DELETE="Components Config Delete" @@ -1742,7 +1738,7 @@ COM_COMPONENTBUILDER_COMPONENTS_CONFIG_EDIT_OWN_DESC="Allows the users in this g COM_COMPONENTBUILDER_COMPONENTS_CONFIG_EDIT_STATE="Components Config Edit State" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_EDIT_STATE_DESC="Allows the users in this group to update the state of the component config" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_EDIT_VERSION="Components Config Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_CONFIG_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components config" +COM_COMPONENTBUILDER_COMPONENTS_CONFIG_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components config" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_N_ITEMS_ARCHIVED="%s Components Config archived." COM_COMPONENTBUILDER_COMPONENTS_CONFIG_N_ITEMS_ARCHIVED_1="%s Component Config archived." COM_COMPONENTBUILDER_COMPONENTS_CONFIG_N_ITEMS_CHECKED_IN_0="No Component Config successfully checked in." @@ -1768,7 +1764,7 @@ COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_ACCESS_DESC="Allows the users COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_BATCH_OPTIONS="Batch process the selected Components Custom Admin Menus" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_BATCH_TIP="All changes will be applied to all selected Components Custom Admin Menus" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_BATCH_USE="Components Custom Admin Menus Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components custom admin menus" +COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components custom admin menus" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_CREATE="Components Custom Admin Menus Create" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_CREATE_DESC="Allows the users in this group to create create components custom admin menus" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_DELETE="Components Custom Admin Menus Delete" @@ -1784,7 +1780,7 @@ COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_EDIT_OWN_DESC="Allows the use COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_EDIT_STATE="Components Custom Admin Menus Edit State" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component custom admin menus" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_EDIT_VERSION="Components Custom Admin Menus Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components custom admin menus" +COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components custom admin menus" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_N_ITEMS_ARCHIVED="%s Components Custom Admin Menus archived." COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_N_ITEMS_ARCHIVED_1="%s Component Custom Admin Menus archived." COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_N_ITEMS_CHECKED_IN_0="No Component Custom Admin Menus successfully checked in." @@ -1810,7 +1806,7 @@ COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_ACCESS_DESC="Allows the users COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_BATCH_OPTIONS="Batch process the selected Components Custom Admin Views" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_BATCH_TIP="All changes will be applied to all selected Components Custom Admin Views" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_BATCH_USE="Components Custom Admin Views Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components custom admin views" +COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components custom admin views" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_CREATE="Components Custom Admin Views Create" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_CREATE_DESC="Allows the users in this group to create create components custom admin views" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_DELETE="Components Custom Admin Views Delete" @@ -1826,7 +1822,7 @@ COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_EDIT_OWN_DESC="Allows the use COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_EDIT_STATE="Components Custom Admin Views Edit State" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component custom admin views" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_EDIT_VERSION="Components Custom Admin Views Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components custom admin views" +COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components custom admin views" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_N_ITEMS_ARCHIVED="%s Components Custom Admin Views archived." COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_N_ITEMS_ARCHIVED_1="%s Component Custom Admin Views archived." COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_N_ITEMS_CHECKED_IN_0="No Component Custom Admin Views successfully checked in." @@ -1852,7 +1848,7 @@ COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_ACCESS_DESC="Allows the users in this COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_BATCH_OPTIONS="Batch process the selected Components Dashboard" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_BATCH_TIP="All changes will be applied to all selected Components Dashboard" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_BATCH_USE="Components Dashboard Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components dashboard" +COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components dashboard" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_CREATE="Components Dashboard Create" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_CREATE_DESC="Allows the users in this group to create create components dashboard" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_DELETE="Components Dashboard Delete" @@ -1868,7 +1864,7 @@ COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_EDIT_OWN_DESC="Allows the users in thi COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_EDIT_STATE="Components Dashboard Edit State" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_EDIT_STATE_DESC="Allows the users in this group to update the state of the component dashboard" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_EDIT_VERSION="Components Dashboard Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components dashboard" +COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components dashboard" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_N_ITEMS_ARCHIVED="%s Components Dashboard archived." COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_N_ITEMS_ARCHIVED_1="%s Component Dashboard archived." COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_N_ITEMS_CHECKED_IN_0="No Component Dashboard successfully checked in." @@ -1894,7 +1890,7 @@ COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_ACCESS_DESC="Allows the users in t COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_BATCH_OPTIONS="Batch process the selected Components Files & Folders" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_BATCH_TIP="All changes will be applied to all selected Components Files & Folders" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_BATCH_USE="Components Files Folders Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components files folders" +COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components files folders" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_CREATE="Components Files Folders Create" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_CREATE_DESC="Allows the users in this group to create create components files folders" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_DELETE="Components Files Folders Delete" @@ -1910,7 +1906,7 @@ COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_OWN_DESC="Allows the users in COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_STATE="Components Files Folders Edit State" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component files folders" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_VERSION="Components Files Folders Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components files folders" +COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components files folders" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_N_ITEMS_ARCHIVED="%s Components Files & Folders archived." COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_N_ITEMS_ARCHIVED_1="%s Component Files & Folders archived." COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_N_ITEMS_CHECKED_IN_0="No Component Files & Folders successfully checked in." @@ -1936,7 +1932,7 @@ COM_COMPONENTBUILDER_COMPONENTS_MODULES_ACCESS_DESC="Allows the users in this gr COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_OPTIONS="Batch process the selected Components Modules" COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_TIP="All changes will be applied to all selected Components Modules" COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_USE="Components Modules Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components modules" COM_COMPONENTBUILDER_COMPONENTS_MODULES_CREATE="Components Modules Create" COM_COMPONENTBUILDER_COMPONENTS_MODULES_CREATE_DESC="Allows the users in this group to create create components modules" COM_COMPONENTBUILDER_COMPONENTS_MODULES_DELETE="Components Modules Delete" @@ -1952,7 +1948,7 @@ COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_OWN_DESC="Allows the users in this COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_STATE="Components Modules Edit State" COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_STATE_DESC="Allows the users in this group to update the state of the component modules" COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_VERSION="Components Modules Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components modules" COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_ARCHIVED="%s Components Modules archived." COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_ARCHIVED_1="%s Component Modules archived." COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_CHECKED_IN_0="No Component Modules successfully checked in." @@ -1978,7 +1974,7 @@ COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_ACCESS_DESC="Allows the users in th COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_BATCH_OPTIONS="Batch process the selected Components mysql Tweaks" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_BATCH_TIP="All changes will be applied to all selected Components mysql Tweaks" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_BATCH_USE="Components Mysql Tweaks Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components mysql tweaks" +COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components mysql tweaks" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_CREATE="Components Mysql Tweaks Create" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_CREATE_DESC="Allows the users in this group to create create components mysql tweaks" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_DELETE="Components Mysql Tweaks Delete" @@ -1994,7 +1990,7 @@ COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_EDIT_OWN_DESC="Allows the users in COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_EDIT_STATE="Components Mysql Tweaks Edit State" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component mysql tweaks" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_EDIT_VERSION="Components Mysql Tweaks Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components mysql tweaks" +COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components mysql tweaks" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_N_ITEMS_ARCHIVED="%s Components mysql Tweaks archived." COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_N_ITEMS_ARCHIVED_1="%s Component mysql Tweaks archived." COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_N_ITEMS_CHECKED_IN_0="No Component mysql Tweaks successfully checked in." @@ -2020,7 +2016,7 @@ COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_ACCESS_DESC="Allows the users in th COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_BATCH_OPTIONS="Batch process the selected Components Placeholders" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_BATCH_TIP="All changes will be applied to all selected Components Placeholders" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_BATCH_USE="Components Placeholders Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components placeholders" +COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components placeholders" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_CREATE="Components Placeholders Create" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_CREATE_DESC="Allows the users in this group to create create components placeholders" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_DELETE="Components Placeholders Delete" @@ -2036,7 +2032,7 @@ COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_OWN_DESC="Allows the users in COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_STATE="Components Placeholders Edit State" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component placeholders" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_VERSION="Components Placeholders Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components placeholders" +COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components placeholders" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_N_ITEMS_ARCHIVED="%s Components Placeholders archived." COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_N_ITEMS_ARCHIVED_1="%s Component Placeholders archived." COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_N_ITEMS_CHECKED_IN_0="No Component Placeholders successfully checked in." @@ -2062,7 +2058,7 @@ COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS_DESC="Allows the users in this gr COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_OPTIONS="Batch process the selected Components Plugins" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_TIP="All changes will be applied to all selected Components Plugins" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE="Components Plugins Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components plugins" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE="Components Plugins Create" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE_DESC="Allows the users in this group to create create components plugins" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_DELETE="Components Plugins Delete" @@ -2078,7 +2074,7 @@ COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_OWN_DESC="Allows the users in this COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE="Components Plugins Edit State" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component plugins" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION="Components Plugins Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components plugins" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_ARCHIVED="%s Components Plugins archived." COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_ARCHIVED_1="%s Component Plugins archived." COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_CHECKED_IN_0="No Component Plugins successfully checked in." @@ -2098,13 +2094,55 @@ COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_UNFEATURED="%s Components Plugin COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_UNFEATURED_1="%s Component Plugins unfeatured." COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_UNPUBLISHED="%s Components Plugins unpublished." COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_N_ITEMS_UNPUBLISHED_1="%s Component Plugins unpublished." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS="Components Routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_ACCESS="Components Routers Access" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_ACCESS_DESC="Allows the users in this group to access access components routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_BATCH_OPTIONS="Batch process the selected Components Routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_BATCH_TIP="All changes will be applied to all selected Components Routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_BATCH_USE="Components Routers Batch Use" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_CREATE="Components Routers Create" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_CREATE_DESC="Allows the users in this group to create create components routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_DELETE="Components Routers Delete" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_DELETE_DESC="Allows the users in this group to delete delete components routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT="Components Routers Edit" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_CREATED_BY="Components Routers Edit Created By" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by components routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_CREATED_DATE="Components Routers Edit Created Date" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created components routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_DESC="Allows the users in this group to edit the component router" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_OWN="Components Routers Edit Own" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_OWN_DESC="Allows the users in this group to edit edit own components routers created by them" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_STATE="Components Routers Edit State" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component router" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_VERSION="Components Routers Edit Version" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_ARCHIVED="%s Components Routers archived." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_ARCHIVED_1="%s Component Router archived." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_CHECKED_IN_0="No Component Router successfully checked in." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_CHECKED_IN_1="%d Component Router successfully checked in." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_CHECKED_IN_MORE="%d Components Routers successfully checked in." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_DELETED="%s Components Routers deleted." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_DELETED_1="%s Component Router deleted." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_FAILED_PUBLISHING="%s Components Routers failed publishing." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_FAILED_PUBLISHING_1="%s Component Router failed publishing." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_FEATURED="%s Components Routers featured." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_FEATURED_1="%s Component Router featured." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_PUBLISHED="%s Components Routers published." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_PUBLISHED_1="%s Component Router published." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_TRASHED="%s Components Routers trashed." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_TRASHED_1="%s Component Router trashed." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_UNFEATURED="%s Components Routers unfeatured." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_UNFEATURED_1="%s Component Router unfeatured." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_UNPUBLISHED="%s Components Routers unpublished." +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_N_ITEMS_UNPUBLISHED_1="%s Component Router unpublished." COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS="Components Site Views" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_ACCESS="Components Site Views Access" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_ACCESS_DESC="Allows the users in this group to access access components site views" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_BATCH_OPTIONS="Batch process the selected Components Site Views" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_BATCH_TIP="All changes will be applied to all selected Components Site Views" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_BATCH_USE="Components Site Views Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components site views" +COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components site views" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_CREATE="Components Site Views Create" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_CREATE_DESC="Allows the users in this group to create create components site views" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_DELETE="Components Site Views Delete" @@ -2120,7 +2158,7 @@ COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_EDIT_OWN_DESC="Allows the users in th COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_EDIT_STATE="Components Site Views Edit State" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component site views" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_EDIT_VERSION="Components Site Views Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components site views" +COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components site views" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_N_ITEMS_ARCHIVED="%s Components Site Views archived." COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_N_ITEMS_ARCHIVED_1="%s Component Site Views archived." COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_N_ITEMS_CHECKED_IN_0="No Component Site Views successfully checked in." @@ -2146,7 +2184,7 @@ COM_COMPONENTBUILDER_COMPONENTS_UPDATES_ACCESS_DESC="Allows the users in this gr COM_COMPONENTBUILDER_COMPONENTS_UPDATES_BATCH_OPTIONS="Batch process the selected Components Updates" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_BATCH_TIP="All changes will be applied to all selected Components Updates" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_BATCH_USE="Components Updates Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_UPDATES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components updates" +COM_COMPONENTBUILDER_COMPONENTS_UPDATES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components updates" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_CREATE="Components Updates Create" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_CREATE_DESC="Allows the users in this group to create create components updates" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_DELETE="Components Updates Delete" @@ -2162,7 +2200,7 @@ COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_OWN_DESC="Allows the users in this COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_STATE="Components Updates Edit State" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_STATE_DESC="Allows the users in this group to update the state of the component updates" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_VERSION="Components Updates Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components updates" +COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components updates" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_N_ITEMS_ARCHIVED="%s Components Updates archived." COM_COMPONENTBUILDER_COMPONENTS_UPDATES_N_ITEMS_ARCHIVED_1="%s Component Updates archived." COM_COMPONENTBUILDER_COMPONENTS_UPDATES_N_ITEMS_CHECKED_IN_0="No Component Updates successfully checked in." @@ -2275,6 +2313,7 @@ COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ENVELOPE="Envelope" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ENVELOPE_OPENED="Envelope Opened" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_EQUALIZER="Equalizer" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ERROR_UNIQUE_ALIAS="Another Component Admin Views has the same alias." +COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Component Admin Views has the same alias ." COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_EXIT="Exit" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_EXPAND="Expand" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_EXPAND_2="Expand 2" @@ -2473,6 +2512,7 @@ COM_COMPONENTBUILDER_COMPONENT_CONFIG_CUSTOM_VALUE_HINT="Custom Value Here" COM_COMPONENTBUILDER_COMPONENT_CONFIG_CUSTOM_VALUE_LABEL="Custom Value" COM_COMPONENTBUILDER_COMPONENT_CONFIG_EDIT="Editing the Component Config" COM_COMPONENTBUILDER_COMPONENT_CONFIG_ERROR_UNIQUE_ALIAS="Another Component Config has the same alias." +COM_COMPONENTBUILDER_COMPONENT_CONFIG_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Component Config has the same alias ." COM_COMPONENTBUILDER_COMPONENT_CONFIG_FIELD="Field" COM_COMPONENTBUILDER_COMPONENT_CONFIG_FIELD_DESCRIPTION="Select a field" COM_COMPONENTBUILDER_COMPONENT_CONFIG_FIELD_LABEL="Field" @@ -2513,6 +2553,7 @@ COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_DASHBOARD_LIST_DESCRIPTION="Se COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_DASHBOARD_LIST_LABEL="Dashboard (list of records)" COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_EDIT="Editing the Component Custom Admin Menus" COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_ERROR_UNIQUE_ALIAS="Another Component Custom Admin Menus has the same alias." +COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Component Custom Admin Menus has the same alias ." COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_ICON_DESCRIPTION="Add the icon to the image folder and select it here (128 x 128px)" COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_ICON_LABEL="Icon" COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_ID="Id" @@ -2531,8 +2572,7 @@ COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_MODIFIED_DATE_DESC="The date t COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_MODIFIED_DATE_LABEL="Modified Date" COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NAME_CODE_DESCRIPTION="Add Name in Code Here" COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NAME_CODE_HINT="codename" -COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NAME_CODE_LABEL="Name in Code
    -Naming Conventions" +COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NAME_CODE_LABEL="Name in Code
    Naming Conventions" COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NAME_CODE_MESSAGE="Error! Please add name in code here." COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NAME_DESCRIPTION="Enter Name Here" COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NAME_HINT="Name Here" @@ -2639,6 +2679,7 @@ COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_ENVELOPE="Envelope" COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_ENVELOPE_OPENED="Envelope Opened" COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_EQUALIZER="Equalizer" COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_ERROR_UNIQUE_ALIAS="Another Component Custom Admin Views has the same alias." +COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Component Custom Admin Views has the same alias ." COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_EXIT="Exit" COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_EXPAND="Expand" COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_EXPAND_2="Expand 2" @@ -2822,15 +2863,12 @@ COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_DASHBOARD="Dashboard" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_DASHBOARD_TAB_LABEL="Dashboard Tabs" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_EDIT="Editing the Component Dashboard" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_ERROR_UNIQUE_ALIAS="Another Component Dashboard has the same alias." +COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Component Dashboard has the same alias ." COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HEADER_DESCRIPTION="Enter Header Here" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HEADER_HINT="Header Here" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HEADER_LABEL="Header" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HEADER_MESSAGE="Error! Please add header here." -COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HTML_HINT="// Add the tab HTML here. -// To access php values methodname->value; ?> -// Note the convention, if in the PHP area above you added a method called getMethodName() -// Then [MethodName] becomes a class variable called $this->methodname -// Which will hold the value/s your method returned." +COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HTML_HINT="// Add the tab HTML here.// To access php values methodname->value; ?>// Note the convention, if in the PHP area above you added a method called getMethodName()// Then [MethodName] becomes a class variable called $this->methodname// Which will hold the value/s your method returned." COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HTML_LABEL="HTML" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_ID="Id" COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_JOOMLA_COMPONENT_DESCRIPTION="Select a Joomla Component" @@ -2876,6 +2914,7 @@ COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_CREATED_DATE_DESC="The date this Co COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_EDIT="Editing the Component Files & Folders" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_ERROR_UNIQUE_ALIAS="Another Component Files & Folders has the same alias." +COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Component Files & Folders has the same alias ." COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_FILE="File" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_FILEPATH_DESCRIPTION="Full System Path" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_FILEPATH_HINT="/home/user/folder/file.php" @@ -2906,42 +2945,7 @@ COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FOLDERS_DESCRIPTION="You c COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FOLDERS_FULLPATH_DESCRIPTION="You can any folders to the component, by using the full system path. Example: /home/user/folder (make sure that php has permission to read the folder)
    Please note that you can also use constant paths in your full path (directly without quotes), this is highly recommended to insure portability.
    To see a list of constant paths please read the notes below. Example: JPATH_ROOT/folder or JPATH_ROOT/components/com_yourcomponentname/helpers/folder" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FOLDERS_FULLPATH_LABEL="Adding Folders" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FOLDERS_LABEL="Adding Custom Folders" -COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_CONSTANT_PATHS_DESCRIPTION="

    // The path to the administrator folder.
    -JPATH_ADMINISTRATOR
    -// The path to the installed Joomla! site, or JPATH_ROOT/administrator if executed from the backend.
    -JPATH_BASE
    -// The path to the cache folder.
    -JPATH_CACHE
    -// The path to the administration folder of JCB component.
    -JPATH_COMPONENT_ADMINISTRATOR no ideal to use
    -// The path to the site folder of JCB component.
    -JPATH_COMPONENT_SITE no ideal to use
    -// The path to the JCB component.
    -JPATH_COMPONENT no ideal to use
    -// The path to folder containing the configuration.php file.
    -JPATH_CONFIGURATION
    -// The path to the installation folder.
    -JPATH_INSTALLATION
    -// The path to the libraries folder.
    -JPATH_LIBRARIES
    -// The path to the plugins folder.
    -JPATH_PLUGINS
    -// The path to the installed Joomla! site.
    -JPATH_ROOT
    -// The path to the installed Joomla! site.
    -JPATH_SITE
    -// The path to the templates folder.
    -JPATH_THEMES

    - -

    JPATH_SITE is meant to represent the root path of the JSite application,
    -just as JPATH_ADMINISTRATOR is mean to represent the root path of the JAdministrator application.
    -JPATH_BASE is the root path for the current requested application.... so if you are in the administrator application:
    -JPATH_BASE == JPATH_ADMINISTRATOR
    -If you are in the site application:
    -JPATH_BASE == JPATH_SITE
    -If you are in the installation application:
    -JPATH_BASE == JPATH_INSTALLATION.
    -JPATH_ROOT is the root path for the Joomla install and does not depend upon any application.

    " +COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_CONSTANT_PATHS_DESCRIPTION="

    // The path to the administrator folder.
    JPATH_ADMINISTRATOR
    // The path to the installed Joomla! site, or JPATH_ROOT/administrator if executed from the backend.
    JPATH_BASE
    // The path to the cache folder.
    JPATH_CACHE
    // The path to the administration folder of JCB component.
    JPATH_COMPONENT_ADMINISTRATOR no ideal to use
    // The path to the site folder of JCB component.
    JPATH_COMPONENT_SITE no ideal to use
    // The path to the JCB component.
    JPATH_COMPONENT no ideal to use
    // The path to folder containing the configuration.php file.
    JPATH_CONFIGURATION
    // The path to the installation folder.
    JPATH_INSTALLATION
    // The path to the libraries folder.
    JPATH_LIBRARIES
    // The path to the plugins folder.
    JPATH_PLUGINS
    // The path to the installed Joomla! site.
    JPATH_ROOT
    // The path to the installed Joomla! site.
    JPATH_SITE
    // The path to the templates folder.
    JPATH_THEMES

    JPATH_SITE is meant to represent the root path of the JSite application,
    just as JPATH_ADMINISTRATOR is mean to represent the root path of the JAdministrator application.
    JPATH_BASE is the root path for the current requested application.... so if you are in the administrator application:
    JPATH_BASE == JPATH_ADMINISTRATOR
    If you are in the site application:
    JPATH_BASE == JPATH_SITE
    If you are in the installation application:
    JPATH_BASE == JPATH_INSTALLATION.
    JPATH_ROOT is the root path for the Joomla install and does not depend upon any application.

    " COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_CONSTANT_PATHS_LABEL="Constant Paths" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_HOW_TO_CLONE_DESCRIPTION="There has often been the case that we have two or more components_files_folders that should be exactly the same. Just selecting that component_files_folders and clicking save, will overwrite this component_files_folders with that selected component_files_folders data." COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_HOW_TO_CLONE_LABEL="How to clone another component_files_folders's values into this one." @@ -2973,6 +2977,7 @@ COM_COMPONENTBUILDER_COMPONENT_MODULES_CREATED_DATE_DESC="The date this Componen COM_COMPONENTBUILDER_COMPONENT_MODULES_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_COMPONENT_MODULES_EDIT="Editing the Component Modules" COM_COMPONENTBUILDER_COMPONENT_MODULES_ERROR_UNIQUE_ALIAS="Another Component Modules has the same alias." +COM_COMPONENTBUILDER_COMPONENT_MODULES_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Component Modules has the same alias ." COM_COMPONENTBUILDER_COMPONENT_MODULES_EXPORT_ONLY="Export (only)" COM_COMPONENTBUILDER_COMPONENT_MODULES_ID="Id" COM_COMPONENTBUILDER_COMPONENT_MODULES_JOOMLA_COMPONENT_DESCRIPTION="Select a Joomla Component" @@ -3015,6 +3020,7 @@ COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_CREATED_DATE_DESC="The date this Com COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_EDIT="Editing the Component mysql Tweaks" COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_ERROR_UNIQUE_ALIAS="Another Component mysql Tweaks has the same alias." +COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Component mysql Tweaks has the same alias ." COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_ID="Id" COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_IDS_DESCRIPTION="if id option selected" COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_IDS_HINT="// 1 => 500 or 1,2,3,4 or 1 => 4,20,40 => 90" @@ -3054,6 +3060,7 @@ COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_DETAILS="Details" COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_EDIT="Editing the Component Placeholders" COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_ERROR_UNIQUE_ALIAS="Another Component Placeholders has the same alias." +COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Component Placeholders has the same alias ." COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_ID="Id" COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_JOOMLA_COMPONENT_DESCRIPTION="Select a Joomla Component" COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_JOOMLA_COMPONENT_LABEL="Component" @@ -3092,6 +3099,7 @@ COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_DATE_DESC="The date this Componen COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_EDIT="Editing the Component Plugins" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ERROR_UNIQUE_ALIAS="Another Component Plugins has the same alias." +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Component Plugins has the same alias ." COM_COMPONENTBUILDER_COMPONENT_PLUGINS_EXPORT_ONLY="Export (only)" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ID="Id" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT_DESCRIPTION="Select a Joomla Component" @@ -3117,6 +3125,60 @@ COM_COMPONENTBUILDER_COMPONENT_PLUGINS_TARGET_DESCRIPTION="Association" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_TARGET_LABEL="Target" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_VERSION_DESC="A count of the number of times this Component Plugins has been revised." COM_COMPONENTBUILDER_COMPONENT_PLUGINS_VERSION_LABEL="Version" +COM_COMPONENTBUILDER_COMPONENT_ROUTER="Component Router" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_BASIC="Basic" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_CODE="Code" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_CONSTRUCTOR_AFTER_PARENT_CODE_DESCRIPTION="Here you can add the code to use in the constructor after parent class is called." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_CONSTRUCTOR_AFTER_PARENT_CODE_LABEL="Constructor After Parent
    Code" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_CONSTRUCTOR_BEFORE_PARENT_CODE_DESCRIPTION="Here you can add the code to use in the constructor before parent class is called." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_CONSTRUCTOR_BEFORE_PARENT_CODE_LABEL="Constructor Before Parent
    Code" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_CONSTRUCTOR_BEFORE_PARENT_MANUAL_DESCRIPTION="Setup the site views router configuration for this component." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_CONSTRUCTOR_BEFORE_PARENT_MANUAL_LABEL="Manual Setup of View Configuration" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_CREATED_BY_DESC="The user that created this Component Router." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_CREATED_BY_LABEL="Created By" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_CREATED_DATE_DESC="The date this Component Router was created." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_CREATED_DATE_LABEL="Created Date" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_DEFAULT="Default" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_DETAILS="Details" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_EDIT="Editing the Component Router" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_ERROR_UNIQUE_ALIAS="Another Component Router has the same alias." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Component Router has the same alias ." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_ID="Id" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_JOOMLA_COMPONENT_DESCRIPTION="Select a Joomla Component" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_JOOMLA_COMPONENT_LABEL="Component" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_MANUAL="Manual" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_METHODS_CODE_DESCRIPTION="Here you can add the methods to add to the router class." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_METHODS_CODE_LABEL="Methods
    Code" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_MODE_CONSTRUCTOR_AFTER_PARENT_DESCRIPTION="You can set your router constructor after parent mode here for only Joomla 4 and above." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_MODE_CONSTRUCTOR_AFTER_PARENT_LABEL="Router Mode
    [constructor_after_parent]" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_MODE_CONSTRUCTOR_BEFORE_PARENT_DESCRIPTION="You can set your router constructor before parent mode here for only Joomla 4 and above." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_MODE_CONSTRUCTOR_BEFORE_PARENT_LABEL="Router Mode
    [constructor_before_parent]" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_MODE_METHODS_DESCRIPTION="You can set your router methods mode here for only Joomla 4 and above." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_MODE_METHODS_LABEL="Router Mode
    [methods]" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_MODIFIED_BY_DESC="The last user that modified this Component Router." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_MODIFIED_BY_LABEL="Modified By" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_MODIFIED_DATE_DESC="The date this Component Router was modified." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_MODIFIED_DATE_LABEL="Modified Date" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_NEW="A New Component Router" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_NONE="None" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_NOTE_MODE_CONSTRUCTOR_BEFORE_PARENT_MANUAL_DESCRIPTION="This feature is not yet ready (SOON)" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_NOTE_MODE_CONSTRUCTOR_BEFORE_PARENT_MANUAL_LABEL="Manual Mode" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_NOTE_ROUTER_SETTINGS_ADVANCE_DESCRIPTION="

    The RouterView class in Joomla is designed to manage the routing process, translating human-readable URLs into query variables and vice versa. This functionality is crucial for creating search engine friendly (SEF) URLs and ensuring that requests within the Joomla application are directed to the appropriate components and views.

    Key Responsibilities

    • URL Building: Converts query information into SEF URLs. This process involves taking the query parameters associated with a particular route and constructing a URL that is both user-friendly and optimized for search engines.
    • URL Parsing: Interprets SEF URLs back into query parameters. When a request is made to Joomla with an SEF URL, the RouterView class parses this URL to determine the component, view, and other request variables required to fulfill the request.

    How to Use RouterView in a 3rd Party Extension

    To leverage the RouterView class in a 3rd party Joomla extension, follow these steps:

    1. Extend RouterView: Create a new router class in your component that extends RouterView. This class will define the routing rules specific to your component.
    2. Define Routes: Within your router class, define routes by mapping URL patterns to query parameters. This involves specifying how URL segments correspond to the component’s views and tasks.
    3. Register the Router: Ensure that Joomla is aware of your custom router by registering it with the application. This is typically done within the component’s entry point file.

    Benefits of Using RouterView

    • SEO Optimization: By enabling the creation of human-readable URLs, RouterView helps improve the SEO of your Joomla site.
    • Improved User Experience: SEF URLs are easier for users to understand and remember, enhancing the overall user experience.
    • Flexibility: Custom routers allow for granular control over URL structure, making it possible to tailor URLs to match the needs of your extension and its audience.

    The basic structure of a custom router class for a Joomla 3rd party extension highlights the need to implement the build and parse methods, which handle the conversion between query parameters and SEF URLs.

    " +COM_COMPONENTBUILDER_COMPONENT_ROUTER_NOTE_ROUTER_SETTINGS_ADVANCE_LABEL="Understanding the Site RouterView Class." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_NOTE_ROUTER_SETTINGS_DESCRIPTION="Extending the `RouterView` class in a Joomla 3rd party extension enables developers to intricately manage and customize URLs, significantly enhancing user navigation and SEO. This approach allows for defining clean, search-engine-friendly routes for component views, dynamic handling of query variables, and seamless integration with Joomla's menu system for automatic route adjustments. Additionally, it supports the implementation of custom routing rules, including support for multilingual sites, and sophisticated error handling and redirects. By leveraging `RouterView`, developers can craft a more intuitive and efficient URL structure, ensuring a smoother user experience and improved visibility on search engines." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_NOTE_ROUTER_SETTINGS_LABEL="Site Router Settings" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_ORDERING_LABEL="Ordering" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_PERMISSION="Permissions" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_PUBLISHING="Publishing" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_ROUTER_SETTINGS_DETAILS_SWITCH_LABEL="Documentation" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Component Router to customise the alias." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_SETTINGS="Settings" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_SITEVIEW="Siteview" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_SITEVIEW_DESCRIPTION="Select a site view" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_SITEVIEW_LABEL="View" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_STATUS="Status" +COM_COMPONENTBUILDER_COMPONENT_ROUTER_VERSION_DESC="A count of the number of times this Component Router has been revised." +COM_COMPONENTBUILDER_COMPONENT_ROUTER_VERSION_LABEL="Version" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS="Component Site Views" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ACCESS_DESCRIPTION="Select if this view
    should use access." COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ACCESS_LABEL="Add Access" @@ -3132,6 +3194,7 @@ COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_DEFAULT_VIEW_DESCRIPTION="Select only COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_DEFAULT_VIEW_LABEL="Default View" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_EDIT="Editing the Component Site Views" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ERROR_UNIQUE_ALIAS="Another Component Site Views has the same alias." +COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Component Site Views has the same alias ." COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ID="Id" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_JOOMLA_COMPONENT_DESCRIPTION="Select a Joomla Component" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_JOOMLA_COMPONENT_LABEL="Component" @@ -3175,6 +3238,7 @@ COM_COMPONENTBUILDER_COMPONENT_UPDATES_CREATED_DATE_DESC="The date this Componen COM_COMPONENTBUILDER_COMPONENT_UPDATES_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_COMPONENT_UPDATES_EDIT="Editing the Component Updates" COM_COMPONENTBUILDER_COMPONENT_UPDATES_ERROR_UNIQUE_ALIAS="Another Component Updates has the same alias." +COM_COMPONENTBUILDER_COMPONENT_UPDATES_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Component Updates has the same alias ." COM_COMPONENTBUILDER_COMPONENT_UPDATES_ID="Id" COM_COMPONENTBUILDER_COMPONENT_UPDATES_JOOMLA_COMPONENT_DESCRIPTION="Select a Joomla Component" COM_COMPONENTBUILDER_COMPONENT_UPDATES_JOOMLA_COMPONENT_LABEL="Component" @@ -3228,6 +3292,8 @@ COM_COMPONENTBUILDER_COMPONENT_UPDATES_YES="Yes" COM_COMPONENTBUILDER_CONCATENATE="Concatenate" COM_COMPONENTBUILDER_CONDITIONS="Conditions" COM_COMPONENTBUILDER_CONFIG_ACTIVE="Active" +COM_COMPONENTBUILDER_CONFIG_ADD_CUSTOM_GITEA_URL_DESCRIPTION="Switch to set your own Gitea url." +COM_COMPONENTBUILDER_CONFIG_ADD_CUSTOM_GITEA_URL_LABEL="Target Gitea URL" COM_COMPONENTBUILDER_CONFIG_ADD_MENU_PREFIX_DESCRIPTION="Would you like to add a prefix to the Joomla menu name of your components" COM_COMPONENTBUILDER_CONFIG_ADD_MENU_PREFIX_LABEL="Add Menu Prefix" COM_COMPONENTBUILDER_CONFIG_ADD_PLACEHOLDERS_DESCRIPTION="Should JCB insert the custom code placeholders? This is only applicable if this component has custom code." @@ -3241,9 +3307,8 @@ COM_COMPONENTBUILDER_CONFIG_ALPHANUMERIC="Alphanumeric" COM_COMPONENTBUILDER_CONFIG_ALPHANUMERICDOT="Alphanumeric+dot" COM_COMPONENTBUILDER_CONFIG_API_DESCRIPTION="This User will be used to log the API call." COM_COMPONENTBUILDER_CONFIG_API_LABEL="API User" -COM_COMPONENTBUILDER_CONFIG_ASSETS_TABLE_FIX_DESCRIPTION="How to apply the assets table fix in JCB.
    -SQL (add&remove) this is the default which adds the SQL fix and removes it once the component is uninstalled.
    -Intelligent (add&remove+if) same as default, but on uninstall will only remove this fix if no other component needs it. Note that this option will only work with other components that also use the intelligent path." +COM_COMPONENTBUILDER_CONFIG_APPROVED_PATHS_LABEL="Super Powers Repository Paths" +COM_COMPONENTBUILDER_CONFIG_ASSETS_TABLE_FIX_DESCRIPTION="How to apply the assets table fix in JCB.
    SQL (add&remove) this is the default which adds the SQL fix and removes it once the component is uninstalled.
    Intelligent (add&remove+if) same as default, but on uninstall will only remove this fix if no other component needs it. Note that this option will only work with other components that also use the intelligent path." COM_COMPONENTBUILDER_CONFIG_ASSETS_TABLE_FIX_LABEL="Assets Table Fix" COM_COMPONENTBUILDER_CONFIG_AUTHOR="Author Info" COM_COMPONENTBUILDER_CONFIG_AUTHOR_EMAIL_DESC="The email address of the author of this component." @@ -3252,58 +3317,7 @@ COM_COMPONENTBUILDER_CONFIG_AUTHOR_NAME_DESC="The name of the author of this com COM_COMPONENTBUILDER_CONFIG_AUTHOR_NAME_LABEL="Author Name" COM_COMPONENTBUILDER_CONFIG_AUTO_BACKUP="Auto Backup" COM_COMPONENTBUILDER_CONFIG_AUTO_LOAD="Auto" -COM_COMPONENTBUILDER_CONFIG_BACKUPCRONJOB_NOTE_DESCRIPTION="You can run a cronjob that will backup all your components as they are mapped in JCB.

    USE THE FOLLOWING: loading...

    Please note that if your Joomla website has a Firewall installed, it will not allow cronjob via direct URL (most of the time), you will then need to adapt the cornjob request to look like a browser. For more info please read https://stackoverflow.com/a/31597823/1429677 -" +COM_COMPONENTBUILDER_CONFIG_BACKUPCRONJOB_NOTE_DESCRIPTION="You can run a cronjob that will backup all your components as they are mapped in JCB.

    USE THE FOLLOWING: loading...

    Please note that if your Joomla website has a Firewall installed, it will not allow cronjob via direct URL (most of the time), you will then need to adapt the cornjob request to look like a browser. For more info please read https://stackoverflow.com/a/31597823/1429677" COM_COMPONENTBUILDER_CONFIG_BACKUPCRONJOB_NOTE_LABEL="Backup JCB Mapped Components" COM_COMPONENTBUILDER_CONFIG_BACKUP_DESCRIPTION="Should the zipped package of the component be moved to the local backup and remote sales server? This is only applicable if this component has those values set." COM_COMPONENTBUILDER_CONFIG_BACKUP_EMAIL_DESCRIPTION="Enter the email where the backup key should be send. It will only send an email if a key change is detected, and not on every backup." @@ -3323,6 +3337,8 @@ COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_DESC="Set the basic local key here." COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_LABEL="Basic Key" COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_NOTE_DESC="When using the basic encryption please use set a 32 character passphrase.
    Never change this passphrase once it is set! DATA WILL GET CORRUPTED IF YOU DO!" COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_NOTE_LABEL="Basic Encryption" +COM_COMPONENTBUILDER_CONFIG_BRANCH_HINT="[branch]" +COM_COMPONENTBUILDER_CONFIG_BRANCH_LABEL="Branch" COM_COMPONENTBUILDER_CONFIG_BUILDER_GIF_SIZE_DESCRIPTION="Select the artwork you would like to show during compilation of your projects in the compiler area." COM_COMPONENTBUILDER_CONFIG_BUILDER_GIF_SIZE_LABEL="Compiler Artwork Options" COM_COMPONENTBUILDER_CONFIG_CHECK_TIMER_DESC="Set the intervals for the auto checkin fuction of tables that checks out the items to an user." @@ -3359,10 +3375,18 @@ COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_SERVER_DESCRIPTION="Select your backu COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_SERVER_LABEL="Cronjob Backup Server" COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_TYPE_DESCRIPTION="Select how you would like to backup JCB" COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_TYPE_LABEL="Cronjob Backup type" +COM_COMPONENTBUILDER_CONFIG_CUSTOMGITEA="custom.gitea" COM_COMPONENTBUILDER_CONFIG_CUSTOM_FOLDER_PATH_DESCRIPTION="Here you can set the path to the custom folder" COM_COMPONENTBUILDER_CONFIG_CUSTOM_FOLDER_PATH_HINT="/home/user/custom" COM_COMPONENTBUILDER_CONFIG_CUSTOM_FOLDER_PATH_LABEL="Custom Folder Path" COM_COMPONENTBUILDER_CONFIG_CUSTOM_FOLDER_PATH_MESSAGE="Error! Please add folder path here." +COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_TOKEN_DESCRIPTION="This token is used to access private repositories as needed to get the super powers." +COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_TOKEN_HINT="Gitea Access Tokens" +COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_TOKEN_LABEL="Gitea Access Token
    Get token from your Gitea at: /user/settings/applications." +COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_DESCRIPTION="Enter Gitea Address" +COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_HINT="https://git.vdm.dev" +COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_LABEL="Gitea URL" +COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_MESSAGE="Error! Please add website here." COM_COMPONENTBUILDER_CONFIG_DEFAULT="Default" COM_COMPONENTBUILDER_CONFIG_DEVELOPMENT_METHOD="Development Method" COM_COMPONENTBUILDER_CONFIG_DEVELOPMENT_METHOD_DESCRIPTION="Select what development method you would like to use." @@ -3418,34 +3442,7 @@ COM_COMPONENTBUILDER_CONFIG_EVERY_MINUTE="Every Minute" COM_COMPONENTBUILDER_CONFIG_EVERY_SESSION="Every Session" COM_COMPONENTBUILDER_CONFIG_EVERY_WEEK="Every Week" COM_COMPONENTBUILDER_CONFIG_EXPANSION="Expansion" -COM_COMPONENTBUILDER_CONFIG_EXPANSIONCRONJOB_NOTE_DESCRIPTION="You must run a cronjob that will trigger the expansion events for JCB.

    USE THE FOLLOWING: loading...

    Please note that if your Joomla website has a Firewall installed, it will not allow cronjob via direct URL (most of the time), you will then need to adapt the cornjob request to look like a browser. For more info please read https://stackoverflow.com/a/31597823/1429677 -" +COM_COMPONENTBUILDER_CONFIG_EXPANSIONCRONJOB_NOTE_DESCRIPTION="You must run a cronjob that will trigger the expansion events for JCB.

    USE THE FOLLOWING: loading...

    Please note that if your Joomla website has a Firewall installed, it will not allow cronjob via direct URL (most of the time), you will then need to adapt the cornjob request to look like a browser. For more info please read https://stackoverflow.com/a/31597823/1429677" COM_COMPONENTBUILDER_CONFIG_EXPANSIONCRONJOB_NOTE_LABEL="Expansion Cronjob" COM_COMPONENTBUILDER_CONFIG_EXPANSION_DESCRIPTION="Properties for this field" COM_COMPONENTBUILDER_CONFIG_EXPANSION_LABEL="Expansion" @@ -3493,6 +3490,7 @@ COM_COMPONENTBUILDER_CONFIG_GITEA_TOKEN_LABEL="VDM Access Token
    Get COM_COMPONENTBUILDER_CONFIG_GITHUB_ACCESS_TOKEN_DESCRIPTION="This is only needed when you are on a shared IP or/and have reached the public free limit of API queries to gitHub. So unless you have seen some kind of error that directed you here to add an access token you can just ignore this field." COM_COMPONENTBUILDER_CONFIG_GITHUB_ACCESS_TOKEN_HINT="OAUTH-TOKEN" COM_COMPONENTBUILDER_CONFIG_GITHUB_ACCESS_TOKEN_LABEL="gitHub Access Token
    Check https://developer.github.com/v3/#authentication for more info." +COM_COMPONENTBUILDER_CONFIG_GITVDMDEV="git.vdm.dev" COM_COMPONENTBUILDER_CONFIG_GIT_FOLDER_PATH_DESCRIPTION="Here you can set the path to the git folder." COM_COMPONENTBUILDER_CONFIG_GIT_FOLDER_PATH_HINT="/home/user/git" COM_COMPONENTBUILDER_CONFIG_GIT_FOLDER_PATH_LABEL="Git Folder Path" @@ -3501,6 +3499,7 @@ COM_COMPONENTBUILDER_CONFIG_GLOBAL="Global" COM_COMPONENTBUILDER_CONFIG_GLOBAL_DESC="The Global Parameters" COM_COMPONENTBUILDER_CONFIG_GLOBAL_LABEL="Global" COM_COMPONENTBUILDER_CONFIG_GRADIANT_LOAD="Gradient" +COM_COMPONENTBUILDER_CONFIG_HIDE="Hide" COM_COMPONENTBUILDER_CONFIG_IMPORT_GUID_ONLY_DESCRIPTION="Force that all JCB package import (search for local items) is done with GUID value only." COM_COMPONENTBUILDER_CONFIG_IMPORT_GUID_ONLY_LABEL="Import by GUID only!" COM_COMPONENTBUILDER_CONFIG_INACTIVE="Inactive" @@ -3517,9 +3516,17 @@ COM_COMPONENTBUILDER_CONFIG_JCB_POWERS_PATH_LABEL="JCB Powers Path
    e COM_COMPONENTBUILDER_CONFIG_JCB_POWERS_PATH_MESSAGE="Error! Please add folder path here." COM_COMPONENTBUILDER_CONFIG_JOOMLA_MODULE_UPDATES_VERSION_UPDATE="Joomla Module Updates (version_update)" COM_COMPONENTBUILDER_CONFIG_JOOMLA_PLUGIN_UPDATES_VERSION_UPDATE="Joomla Plugin Updates (version_update)" +COM_COMPONENTBUILDER_CONFIG_JQUERY_LOAD="Load jQuery" +COM_COMPONENTBUILDER_CONFIG_JQUERY_LOAD_DESC="Would you like to load the Joomla jQuery Framework?" +COM_COMPONENTBUILDER_CONFIG_JQUERY_LOAD_LABEL="Load Joomla jQuery" +COM_COMPONENTBUILDER_CONFIG_JQUERY_REMOVE="Remove jQuery" COM_COMPONENTBUILDER_CONFIG_LANGUAGE_LABEL="Language" COM_COMPONENTBUILDER_CONFIG_LAYOUT_LABEL="Layout" COM_COMPONENTBUILDER_CONFIG_LOCAL_FOLDER="Local Folder" +COM_COMPONENTBUILDER_CONFIG_LOCAL_POWERS_REPOSITORY_PATH_DESCRIPTION="Here you can set the path to the super powers local repository folder, where [layer:core] and all targeted [layer:own] sub paths will be placed with their selective [switch:approved] powers." +COM_COMPONENTBUILDER_CONFIG_LOCAL_POWERS_REPOSITORY_PATH_HINT="/home/power" +COM_COMPONENTBUILDER_CONFIG_LOCAL_POWERS_REPOSITORY_PATH_LABEL="Local Powers Repository Path" +COM_COMPONENTBUILDER_CONFIG_LOCAL_POWERS_REPOSITORY_PATH_MESSAGE="Error! Please add some text here." COM_COMPONENTBUILDER_CONFIG_MAILER_DESCRIPTION="Select what mailer you would like to use to send emails." COM_COMPONENTBUILDER_CONFIG_MAILER_LABEL="Mailer" COM_COMPONENTBUILDER_CONFIG_MAILONLINE_DESCRIPTION="Warning this will stop all emails from going out." @@ -3528,20 +3535,16 @@ COM_COMPONENTBUILDER_CONFIG_MAIL_CONFIGURATION="Mail Configuration" COM_COMPONENTBUILDER_CONFIG_MANAGE_JCB_PACKAGE_DIRECTORIES_DESCRIPTION="Here you can choose to manually select what directories should show, or turn them off altogether." COM_COMPONENTBUILDER_CONFIG_MANAGE_JCB_PACKAGE_DIRECTORIES_LABEL="Manage JCB Package Directories" COM_COMPONENTBUILDER_CONFIG_MANUAL_SELECTION="Manual Selection" -COM_COMPONENTBUILDER_CONFIG_MEDIUM_KEY_DESC="Set the full path to where the key file must be stored. Make sure it is behind the root folder of your website, so that it is not public accessible." -COM_COMPONENTBUILDER_CONFIG_MEDIUM_KEY_LABEL="Medium Key (Path)" -COM_COMPONENTBUILDER_CONFIG_MEDIUM_KEY_NOTE_DESC="When using the medium encryption option, the system generates its own key and stores it in a file at the folder/path you set here.
    Never change this key once it is set, or remove the key file! DATA WILL GET CORRUPTED IF YOU DO! Also make sure the full path to where the the key file should be stored, is behind the root folder of your website/system, so that it is not public accessible. Making a backup of this key file over a secure connection is recommended!" -COM_COMPONENTBUILDER_CONFIG_MEDIUM_KEY_NOTE_LABEL="Medium Encryption" -COM_COMPONENTBUILDER_CONFIG_MEDIUM_KEY_PATH_ERROR="Medium key path (for encryption of various fields) does not exist, or is not writable. Please check the path and update it in the global option of this component." COM_COMPONENTBUILDER_CONFIG_MENU_PREFIX_DESCRIPTION="Add the prefix you would like to use. Make sure that it is HTML Character Entities since it is being used in XML." COM_COMPONENTBUILDER_CONFIG_MENU_PREFIX_HINT="»" -COM_COMPONENTBUILDER_CONFIG_MENU_PREFIX_LABEL="Prefix
    -Check out these lists:
    -Char-ref or -Emoji
    " +COM_COMPONENTBUILDER_CONFIG_MENU_PREFIX_LABEL="Prefix
    Check out these lists:
    Char-ref or Emoji
    " COM_COMPONENTBUILDER_CONFIG_MENU_PREFIX_MESSAGE="Error! Please add some text here." COM_COMPONENTBUILDER_CONFIG_MINIFY_DESCRIPTION="Should the JavaScript be minified when compiled." COM_COMPONENTBUILDER_CONFIG_MINIFY_LABEL="Minify JS" +COM_COMPONENTBUILDER_CONFIG_NAMESPACE_PREFIX_DESCRIPTION="Add the namespace prefix. Like your company name in a code formate. So it will have no spaces and starting with an uppercase letter, and only be alphabetical characters.
    Example: VastDevelopmentMethod
    This will be used as a prefix to namespacing when targeting Joomla 4 and above." +COM_COMPONENTBUILDER_CONFIG_NAMESPACE_PREFIX_HINT="VastDevelopmentMethod" +COM_COMPONENTBUILDER_CONFIG_NAMESPACE_PREFIX_LABEL="Namespace Prefix" +COM_COMPONENTBUILDER_CONFIG_NAMESPACE_PREFIX_MESSAGE="Error! Please add namespace prefix here." COM_COMPONENTBUILDER_CONFIG_NEVER_UPDATE="Never update" COM_COMPONENTBUILDER_CONFIG_NO="No" COM_COMPONENTBUILDER_CONFIG_NONE="None" @@ -3551,61 +3554,38 @@ COM_COMPONENTBUILDER_CONFIG_NOTE_COMPILER_FOLDER_PATH_DESCRIPTION="The compiler COM_COMPONENTBUILDER_CONFIG_NOTE_COMPILER_FOLDER_PATH_LABEL="Moving The Compiler Folder" COM_COMPONENTBUILDER_CONFIG_NOTE_CUSTOM_FOLDER_PATH_DESCRIPTION="The custom folder is where all files and folders that you would like to include in your components are stored, the default location is [administrator/components/com_componentbuilder/custom]. You can move this folder by adding your own path here. Remember to move the content of the default custom folder to this new location." COM_COMPONENTBUILDER_CONFIG_NOTE_CUSTOM_FOLDER_PATH_LABEL="Moving The Custom Folder" -COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_DEFAULT_DESCRIPTION="

    This method is basically the way JCB has always worked by default.

    -

    So once you have made changes, you go to the compiler view and compile your component. Then you have the option to install and/or distribute the Joomla installation package.

    This option will always be active to those with permission to access the compiler. You can change this permission in the Permissions tab with the option called Compiler Access.

    " +COM_COMPONENTBUILDER_CONFIG_NOTE_CUSTOM_GITEA_URL_DESCRIPTION="

    Each JCB system can only target one Gitea system at a time. Setting your own Gitea URL means you are decoupling from the git.vdm.dev system and will no longer be loading your super powers from the git.vdm.dev system!

    This will affect the [layers:all], so JCB will not search for any Powers on the git.vdm.dev system at all.

    This option is ideal for managing your own Core Super Powers and your own private Super Powers on your own, or another Gitea System, and allows you to use the Super Power integration completely independent from VDM. Our hope is that this gives you enough freedom and liberty to use our system or your own. Let's decentralize our systems so that we can start focusing on what we are building, and not be worried that some large conglomerate is stealing our ideas and building their empires on our hard work.

    " +COM_COMPONENTBUILDER_CONFIG_NOTE_CUSTOM_GITEA_URL_LABEL="Decentralize Super Powers, Yea!" +COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_DEFAULT_DESCRIPTION="

    This method is basically the way JCB has always worked by default.

    So once you have made changes, you go to the compiler view and compile your component. Then you have the option to install and/or distribute the Joomla installation package.

    This option will always be active to those with permission to access the compiler. You can change this permission in the Permissions tab with the option called Compiler Access.

    " COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_DEFAULT_LABEL="Default Development Method" -COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_EXPANSION_DESCRIPTION="

    This method adds easy compile and install of multiple components to the current Joomla system. This automated action is called expansion.

    -

    Expansion can be achieved in two ways.

    -

    Button Expansion Option

    -

    The first and most common way is to click on any of the Run Expansion buttons found at the top of some of the JCB admin views.

    -

    Cronjob Expansion Option

    -

    The second is by running a cronjob as explained bellow the area of selection in this tab. So you do not need to manually compile and install the selected components any more, the system does all that automatically for you. The latency of the workflow is based on your cronjob frequency and the size of your component.

    -

    Expansion is pause for a component in a few ways, one by actually checking out/opening the Joomla Component view of the component in JCB, or changing the state to unpublish, archive or trashed, or simply remove if from the list below.

    -

    The Expansion method is there to speedup development testing.

    -

    Below you should set the behaviour of a selected set of components that will be auto build and installed when the expansion module is run.

    " +COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_EXPANSION_DESCRIPTION="

    This method adds easy compile and install of multiple components to the current Joomla system. This automated action is called expansion.

    Expansion can be achieved in two ways.

    Button Expansion Option

    The first and most common way is to click on any of the Run Expansion buttons found at the top of some of the JCB admin views.

    Cronjob Expansion Option

    The second is by running a cronjob as explained bellow the area of selection in this tab. So you do not need to manually compile and install the selected components any more, the system does all that automatically for you. The latency of the workflow is based on your cronjob frequency and the size of your component.

    Expansion is pause for a component in a few ways, one by actually checking out/opening the Joomla Component view of the component in JCB, or changing the state to unpublish, archive or trashed, or simply remove if from the list below.

    The Expansion method is there to speedup development testing.

    Below you should set the behaviour of a selected set of components that will be auto build and installed when the expansion module is run.

    " COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_EXPANSION_LABEL="Expansion Development Method" -COM_COMPONENTBUILDER_CONFIG_NOTE_DKIM_USE_DESCRIPTION="

    Using the below details, you need to configure your DNS by adding a TXT record on your domain:

    -" +COM_COMPONENTBUILDER_CONFIG_NOTE_DKIM_USE_DESCRIPTION="

    Using the below details, you need to configure your DNS by adding a TXT record on your domain:

    " COM_COMPONENTBUILDER_CONFIG_NOTE_DKIM_USE_LABEL="Server Configuration" COM_COMPONENTBUILDER_CONFIG_NOTE_GIT_FOLDER_PATH_DESCRIPTION="You must set the folder where all the components should be deployed for git. You will have to still do your git commit and other git commands yourself. Each component will create their own folder inside this git folder." COM_COMPONENTBUILDER_CONFIG_NOTE_GIT_FOLDER_PATH_LABEL="Adding git to your compiler method" COM_COMPONENTBUILDER_CONFIG_NOTE_LANGUAGE_GLOBAL_DESCRIPTION="

    Here you can select the main/global language that you are using to build components. This is the language you use for field label, descriptions. view names and well everything language related across the whole JCB build interface.

    You should not change this global language option once you have set it as this will cause major confusion, that will cause languages to get mixed-up very badly.

    Also make sure that if you import a JCB package from other developers that they use the same language as you selected here.

    At this time best practice is to use en-GB since this has been the default language since the start of the project and will remain VDM's default for years to come, and if you import our JCB packages all the source language strings are in en-GB. English GB is also the source/main language for Joomla.

    " COM_COMPONENTBUILDER_CONFIG_NOTE_LANGUAGE_GLOBAL_LABEL="Global Language Source" +COM_COMPONENTBUILDER_CONFIG_NOTE_POWERS_REPOSITORY_PATH_DESCRIPTION="The powers repository local path is where [layer:core] and all [layer:own] powers are placed. So you can with git add your powers to your own profile on https://git.vdm.dev/[username]/power for easy reuse between projects." +COM_COMPONENTBUILDER_CONFIG_NOTE_POWERS_REPOSITORY_PATH_LABEL="Local Powers Repository Path" +COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_DESCRIPTION="

    Joomla Component Builder (JCB), has super powers. Which is another way of saying it now allows for powers to be pulled in from a global array of areas, over which you have full control. This allows for easy sharing of your powers between your JCB instances with your own power repositories on https://git.vdm.dev/[username]/my-powers. While at the same time be able to use the JCB core powers where needed.

    Let's explain:
    This feature called super-powers, manages powers by use of layers, events, tasks, methods, switches, and algorithms that all work in combination of different ways to achieve super powers.

    The [powers] are:

    • [guid] => Each power has a global unique identifier used to control the power global identity. This [power:guid] looks like this: b836c1b1-b6b1-44f7-b8a2-9a763a4185b1
    • [code] => The actual code of the power that is found in a PHP file
    • [settings] => The settings define the power details, relationships, and more. They are stored in a Json formatted file in [layer:repo] and/or [layer:local] and/or as column values in the [layer:database]
    The [layers] are:
    • [database] This JCB instance's Database
    • [repo] The https://git.vdm.dev/ git website that holds all repos, and which is managed by Vast Development Method
    • [core] The core super-power repo of JCB https://git.vdm.dev/joomla/super-powers (this target can be changed in global options)
    • [own] Your own super-powers repos https://git.vdm.dev/[username]/my-powers (sub-paths)
    • [local] Local path, and its sub-paths that hold [core] and [own] repositories.
    The [events] are:
    • [compile] Compilation of a component
    • [sync] Synchronisation of selected powers with [algorithm:cascading]
    • [init] Uploads all powers from all active [layers] into [layer:database] if not already exist in [layer:database]
    • [reset] Force synchronisation of selected powers with [layer:core]
    The [tasks] are:
    • [get] To get powers from any of the layers
    • [set] To set powers to database or local paths
    The [methods] are:
    • [auto] When JCB automatically does this for you
    • [manual] When you must manually do something
    The [switches] are:
    • [activate] This switch activates super-powers, and allows for [layer:local] path to be set
    • [token] This is the VDM access token from the global tab.
    • [super] This switch allows for [layer:own] paths to be set
    • [approved] This switch allows a power to be added to a [layer:core] or [layer:own] paths

    The [algorithms] are:
    • [cascading] The is the way in which JCB [task:get] a power during the [events] so that it can use the power in your component, and store in [layer:database]

    These terminologies and ideas are what you need to remember whenever you read any of the comments and other information about super-powers in JCB.

    JCB uses powers as the foundation of all it builds. You can build things with JCB without knowing how to use or work with powers. But JCB cannot build anything without powers. That means JCB needs to load powers from the [layer:core] and usually will do this whenever an [event] is triggered based on the [algorithm:cascading].

    All these events can possibly move powers into your [layer:database]. These [events] have the [method:auto] behaviour, and therefore we make use of the [algorithm:cascading] that allows for overriding any power in any way you like. Beware that divergence from the core powers may have side effects and therefore should only be done with knowledge and full understanding on your part.

    Let's Explain the [algorithm:cascading]
    During [events] we must [auto] load powers, and so there is a search path for each event.

    The [event:compile] when building your component, here is the [algorithm:cascading]:

    1. [layer:database]
    2. [layer:local IF switch:activate AND switch:approved]
    3. [layer:own IF switch:token AND switch:activate AND switch:super AND switch:approved]
    4. [layer:core]

    This means, that if JCB gets a [power:guid] in the [layer:database] it stops the search and uses that found power. But if not, it will continue until it finds the power, or it will show an error that the power could not be found. Once it finds the power, it will make sure that the power is in [layer:database], and if [layer:local] is active, it will update those as well as determined by the approved path selection of each power.

    The [event:sync] when the sync button is clicked, here is the [algorithm:cascading]:

    1. [layer:own IF switch:token AND switch:activate AND switch:super AND switch:approved]
    2. [layer:local IF switch:activate AND switch:approved]
    3. [layer:core]

    This means, that if JCB gets a [power:guid] in any of the targeted [layer:own] it stops the search for that power at the first instance it finds that power. Then JCB will update your [layer:database] with the found power, irrespective of modify or creation date. The [power:guid] is used as the key, and should JCB therefore have a power in any of your [layer:own] it will override the [layer:core] and [layer:local] version of any power, and update the [layer:database].

    The [event:reset] when the reset button is clicked, will update [layer:database] with [layer:core] version of the selected powers if found in [layer:core], irrespective of modify or creation date.

    The [event:init] when the init button is clicked, will initialise [layer:database] with all [layers] powers not found in [layer:database]. Should you have the same power in multiple of the layers, here is the [algorithm:cascading]:

    1. [layer:own IF switch:token AND switch:activate AND switch:super AND switch:approved]
    2. [layer:local IF switch:activate]
    3. [layer:core IF_NOT layer:database]

    This means, that if JCB gets a [power:guid] in any of the targeted [layer:own] it will not use any of the other [layers] versions. JCB will add this first found power to your [layer:database] unless it's already in [layer:database], in which case it will be ignored. Use [event:sync] or [event:reset] should you like to update [layer:database] existing powers.

    " +COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_LABEL="Super Powers" +COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_REPOSITORIES_DESCRIPTION="

    Add the paths to those repositories you would like to target with this instance of JCB.

    You only need to add the path, so if your repository is located here: https://git.vdm.dev/Llewellyn/workshop.
    Then the path will be: Llewellyn/workshop

    We will use these paths in all [events] based on the [algorithm:cascading]

    " +COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_REPOSITORIES_LABEL="Super Powers Repositories [layer:local:own]" COM_COMPONENTBUILDER_CONFIG_OFF="Off" COM_COMPONENTBUILDER_CONFIG_ON="On" COM_COMPONENTBUILDER_CONFIG_ONLY_BOOLEAN="Only Boolean" COM_COMPONENTBUILDER_CONFIG_ONLY_EXTRA="Only Extra" COM_COMPONENTBUILDER_CONFIG_ORIGINAL_VDM="Original (VDM)" +COM_COMPONENTBUILDER_CONFIG_OWNER_HINT="[owner]" +COM_COMPONENTBUILDER_CONFIG_OWNER_LABEL="Owner" COM_COMPONENTBUILDER_CONFIG_PACKAGE_NAME_PLAEHOLDERS_DESCRIPTION="[YEAR] [MONTH] [DAY] [HOUR] [MINUTE]" COM_COMPONENTBUILDER_CONFIG_PACKAGE_NAME_PLAEHOLDERS_LABEL="Package Name Placeholders" COM_COMPONENTBUILDER_CONFIG_PERCENTAGELANGUAGEADD_DESCRIPTION="Select percentage any language should be translated before the system should add the language to the component during compilation." COM_COMPONENTBUILDER_CONFIG_PERCENTAGELANGUAGEADD_LABEL="Add Language if %? ready." COM_COMPONENTBUILDER_CONFIG_PHP_MAIL="PHP Mail" +COM_COMPONENTBUILDER_CONFIG_POWERS_REPOSITORY_DESCRIPTION="This adds powers to a local repository folder. All approved powers, linked to a component, will during compiling be moved to your local powers repository folder into their selective target paths." +COM_COMPONENTBUILDER_CONFIG_POWERS_REPOSITORY_LABEL="Activate Super Powers?" COM_COMPONENTBUILDER_CONFIG_REMOTE_SERVER="Remote Server" COM_COMPONENTBUILDER_CONFIG_REPEATABLETABLE_JOOMLA="Repeatable-table (joomla)" COM_COMPONENTBUILDER_CONFIG_REPEATABLE_JOOMLA="Repeatable (Joomla)" @@ -3615,6 +3595,8 @@ COM_COMPONENTBUILDER_CONFIG_REPLYNAME_HINT="Reply Name Here" COM_COMPONENTBUILDER_CONFIG_REPLYNAME_LABEL="Reply to Name" COM_COMPONENTBUILDER_CONFIG_REPOSITORY_DESCRIPTION="Should the component be moved to your local repository folder?" COM_COMPONENTBUILDER_CONFIG_REPOSITORY_LABEL="Add to Repository Folder" +COM_COMPONENTBUILDER_CONFIG_REPO_HINT="[repo]" +COM_COMPONENTBUILDER_CONFIG_REPO_LABEL="Repo" COM_COMPONENTBUILDER_CONFIG_RETURN_OPTIONS_BUILD_DESCRIPTION="Should the system return the build info/messages, or simply 1 for success and 0 for failure." COM_COMPONENTBUILDER_CONFIG_RETURN_OPTIONS_BUILD_LABEL="Return Options for Build" COM_COMPONENTBUILDER_CONFIG_SENDMAIL="Sendmail" @@ -3623,6 +3605,7 @@ COM_COMPONENTBUILDER_CONFIG_SENDMAIL_HINT="/usr/sbin/sendmail" COM_COMPONENTBUILDER_CONFIG_SENDMAIL_LABEL="Sendmail Path" COM_COMPONENTBUILDER_CONFIG_SET_BROWSER_STORAGE_DESCRIPTION="Select if browser storage should be used to save on Ajax calls and speed up this components site pages." COM_COMPONENTBUILDER_CONFIG_SET_BROWSER_STORAGE_LABEL="Browser Storage" +COM_COMPONENTBUILDER_CONFIG_SHOW="Show" COM_COMPONENTBUILDER_CONFIG_SHOW_ALL="Show All" COM_COMPONENTBUILDER_CONFIG_SIMPLEXMLELEMENT_CLASS="SimpleXMLElement Class" COM_COMPONENTBUILDER_CONFIG_SMTP="SMTP" @@ -3648,13 +3631,24 @@ COM_COMPONENTBUILDER_CONFIG_STORAGE_TIME_TO_LIVE_LABEL="Update Cycle" COM_COMPONENTBUILDER_CONFIG_STRING_MANIPULATION="String Manipulation" COM_COMPONENTBUILDER_CONFIG_SUBFORM_LAYOUTS_DESCRIPTION="Select the sub-form layouts you would like to use." COM_COMPONENTBUILDER_CONFIG_SUBFORM_LAYOUTS_LABEL="Sub-form Layouts" +COM_COMPONENTBUILDER_CONFIG_SUPER_POWER="Super Power" +COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_HINT="joomla/super-powers" +COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_LABEL="Super Powers Core" +COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_ORGANISATION_DESCRIPTION="Set the organisation on your Gitea system where all the JCB core super powers repositories can be found." +COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_ORGANISATION_HINT="joomla" +COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_ORGANISATION_LABEL="Gitea Core Organisation" +COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_ORGANISATION_NOTE_DESCRIPTION="

    The organisation on your Gitea system where all the core super powers repositories can be found.
    Example: https://your.gitea.system.com/[core-org]/super-powers

    These are the core super powers:
    • https://git.vdm.dev/joomla/super-powers (required)
    • https://git.vdm.dev/joomla/phpseclib (encryption)
    • https://git.vdm.dev/joomla/fof (legacy encryption)
    • https://git.vdm.dev/joomla/gitea (Easy Gitea classes)
    • https://git.vdm.dev/joomla/openai (Easy Openai classes)
    • https://git.vdm.dev/joomla/minify (not usually required)
    • https://git.vdm.dev/joomla/psr (not usually required)
    • https://git.vdm.dev/joomla/jcb-compiler (not usually required)
    • https://git.vdm.dev/joomla/jcb-packager (not usually required)
    • https://git.vdm.dev/joomla/search (not usually required)

    You should mirror theses repositories to your Gitea system. Depending on your extension setup JCB may need these repositories to effectively build your extension.

    " +COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_ORGANISATION_NOTE_LABEL="Gitea Core Organisation" +COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_DOCUMENTATION_DESCRIPTION="Switch to show or hide the documentation of super powers." +COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_DOCUMENTATION_LABEL="Documentation" +COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_REPOSITORIES_DESCRIPTION="Do you have your own repositories on https://git.vdm.dev/ with super powers?" +COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_REPOSITORIES_LABEL="Own Super Powers?" COM_COMPONENTBUILDER_CONFIG_THREED_PARTICLE_EXPLORATIONS="3D Particle Explorations" COM_COMPONENTBUILDER_CONFIG_TLS="TLS" COM_COMPONENTBUILDER_CONFIG_TRUE="True" COM_COMPONENTBUILDER_CONFIG_TYPE_NAME_BUILDER_DESCRIPTION="The default option only uses alphabetical characters and converts all numbers in field names to the English equivalent like 1 becomes one.
    Alphanumeric+dot keeps the numbers unconverted unless it is at the beginning of the field name, and allows for a dot (.) to be used in the type name for namespacing." COM_COMPONENTBUILDER_CONFIG_TYPE_NAME_BUILDER_LABEL="Field Type Name Builder
    (in compiler)" -COM_COMPONENTBUILDER_CONFIG_UIKIT_DESC="The Parameters for the uikit are set here.
    Uikit is a lightweight and modular front-end framework -for developing fast and powerful web interfaces. For more info visit https://getuikit.com/v2/" +COM_COMPONENTBUILDER_CONFIG_UIKIT_DESC="The Parameters for the uikit are set here.
    Uikit is a lightweight and modular front-end frameworkfor developing fast and powerful web interfaces. For more info visit https://getuikit.com/v2/" COM_COMPONENTBUILDER_CONFIG_UIKIT_LABEL="Uikit2 Settings" COM_COMPONENTBUILDER_CONFIG_UIKIT_LOAD_DESC="Set the uikit loading option." COM_COMPONENTBUILDER_CONFIG_UIKIT_LOAD_LABEL="Loading Options" @@ -3667,11 +3661,13 @@ COM_COMPONENTBUILDER_CONFIG_VIEW_FIELD_LABEL="View & Field" COM_COMPONENTBUILDER_CONFIG_YES="Yes" COM_COMPONENTBUILDER_CONFIRMATION_STEP_BEFORE_IMPORTING="Confirmation Step Before Importing!" COM_COMPONENTBUILDER_CONTEXT="Context" +COM_COMPONENTBUILDER_CONTRIBUTE_TO_JCB="Contribute to JCB" COM_COMPONENTBUILDER_CONTRIBUTOR="Contributor" COM_COMPONENTBUILDER_CONTRIBUTORS="Contributors" COM_COMPONENTBUILDER_COPYRIGHT="Copyright" COM_COMPONENTBUILDER_COPYRIGHT_S="Copyright: %s" COM_COMPONENTBUILDER_COULD_NOT_CLEAR_THE_TMP_FOLDER="Could not clear the tmp folder!" +COM_COMPONENTBUILDER_COULD_NOT_FIND_THE_DATA_NEEDED_TO_CONTINUE="Could not find the data needed to continue." COM_COMPONENTBUILDER_COULD_NOT_INSTALL_COMPONENT="Could not install component!" COM_COMPONENTBUILDER_COULD_NOT_INSTALL_EXTENSIONS="Could not install extensions!" COM_COMPONENTBUILDER_COULD_NOT_INSTALL_MODULE="Could not install module!" @@ -3687,11 +3683,9 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_ACCESS_DESC="Allows the users in this gr COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_BATCH_OPTIONS="Batch process the selected Custom Admin Views" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_BATCH_TIP="All changes will be applied to all selected Custom Admin Views" 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_BATCH_USE_DESC="Allows the 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" @@ -3704,7 +3698,7 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_OWN_DESC="Allows the users in this COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_STATE="Custom Admin Views Edit State" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_STATE_DESC="Allows the users in this group to update the state of the custom admin view" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_VERSION="Custom Admin Views Edit Version" -COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version custom admin views" +COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version custom admin views" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EXPORT="Custom Admin Views Export" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EXPORT_DESC="Allows the users in this group to export export custom admin views" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_IMPORT="Custom Admin Views Import" @@ -3740,8 +3734,8 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_JAVASCRIPT_FILE_LABEL="Add JavaScript COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_JS_DOCUMENT_LABEL="Add JS (custom document script)" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_AJAX_LABEL="Add PHP (AJAX)" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_DOCUMENT_LABEL="Add PHP (custom document script)" -COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_JVIEW_DISPLAY_LABEL="Add PHP (custom JViewLegacy display)" -COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_JVIEW_LABEL="Add PHP (custom JViewLegacy methods)" +COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_JVIEW_DISPLAY_LABEL="Add PHP (custom HtmlView display)" +COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_JVIEW_LABEL="Add PHP (custom HtmlView methods)" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_VIEW_LABEL="Add PHP (custom view script)" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_AJAX_INPUT_LABEL="Ajax Input" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ALLOW_ZERO_DESCRIPTION="null & zero values" @@ -3801,8 +3795,7 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CLOCK="Clock" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CMD="CMD" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CODENAME_DESCRIPTION="Add Name in Code Here" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CODENAME_HINT="codename" -COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CODENAME_LABEL="Name in Code
    -Naming Conventions" +COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CODENAME_LABEL="Name in Code
    Naming Conventions" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CODENAME_MESSAGE="Error! Please add name in code here." COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_COG="Cog" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_COGS="Cogs" @@ -3852,6 +3845,7 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ENVELOPE="Envelope" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ENVELOPE_OPENED="Envelope Opened" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_EQUALIZER="Equalizer" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ERROR_UNIQUE_ALIAS="Another Custom Admin View has the same alias." +COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Custom Admin View has the same alias ." COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_EXIT="Exit" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_EXPAND="Expand" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_EXPAND_2="Expand 2" @@ -3960,10 +3954,7 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NEW_TAB="New Tab" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NEW_TAB_2="New Tab 2" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NEXT="Next" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO="No" -COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo JText::_('Text'); ?>
    -<?php echo JText::sprintf('Hello %s', $this->user->name); ?>
    -Just get UPPERCASE language string:
    -<?php echo JustTEXT::_('Text'); ?>" +COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo Text::_('Text'); ?>
    <?php echo Text::sprintf('Hello %s', $this->user->name); ?>
    Just get UPPERCASE language string:
    <?php echo JustTEXT::_('Text'); ?>" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_ADD_PHP_LANGUAGE_STRING_LABEL="Add PHP Language String" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_LIBRARIES_SELECTION_DESCRIPTION="All libraries you select will dynamically be added to the header of the page according to the settings of the selected library. Each library will also get its respective buttons added to the component global options if it has any set. Please take a look at the libraries for more details." COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_LIBRARIES_SELECTION_LABEL="Select libraries you would like to use in your code" @@ -4116,7 +4107,7 @@ COM_COMPONENTBUILDER_CUSTOM_CODES_ACCESS_DESC="Allows the users in this group to COM_COMPONENTBUILDER_CUSTOM_CODES_BATCH_OPTIONS="Batch process the selected Custom Codes" COM_COMPONENTBUILDER_CUSTOM_CODES_BATCH_TIP="All changes will be applied to all selected Custom Codes" COM_COMPONENTBUILDER_CUSTOM_CODES_BATCH_USE="Custom Codes Batch Use" -COM_COMPONENTBUILDER_CUSTOM_CODES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch custom codes" +COM_COMPONENTBUILDER_CUSTOM_CODES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch custom codes" COM_COMPONENTBUILDER_CUSTOM_CODES_CREATE="Custom Codes Create" COM_COMPONENTBUILDER_CUSTOM_CODES_CREATE_DESC="Allows the users in this group to create create custom codes" COM_COMPONENTBUILDER_CUSTOM_CODES_DASHBOARD_LIST="Custom Codes Dashboard List" @@ -4134,7 +4125,7 @@ COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_OWN_DESC="Allows the users in this group COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_STATE="Custom Codes Edit State" COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_STATE_DESC="Allows the users in this group to update the state of the custom code" COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_VERSION="Custom Codes Edit Version" -COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version custom codes" +COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version custom codes" COM_COMPONENTBUILDER_CUSTOM_CODES_EXPORT="Custom Codes Export" COM_COMPONENTBUILDER_CUSTOM_CODES_EXPORT_DESC="Allows the users in this group to export export custom codes" COM_COMPONENTBUILDER_CUSTOM_CODES_IMPORT="Custom Codes Import" @@ -4172,6 +4163,7 @@ COM_COMPONENTBUILDER_CUSTOM_CODE_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_CUSTOM_CODE_DETAILS="Details" COM_COMPONENTBUILDER_CUSTOM_CODE_EDIT="Editing the Custom Code" COM_COMPONENTBUILDER_CUSTOM_CODE_ERROR_UNIQUE_ALIAS="Another Custom Code has the same alias." +COM_COMPONENTBUILDER_CUSTOM_CODE_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Custom Code has the same alias ." COM_COMPONENTBUILDER_CUSTOM_CODE_FROM_LINE_DESCRIPTION="The line from where to start adding the code." COM_COMPONENTBUILDER_CUSTOM_CODE_FROM_LINE_HINT="Only Numbers" COM_COMPONENTBUILDER_CUSTOM_CODE_FROM_LINE_LABEL="From Line (Zero based)" @@ -4191,135 +4183,15 @@ COM_COMPONENTBUILDER_CUSTOM_CODE_HTML="HTML" COM_COMPONENTBUILDER_CUSTOM_CODE_ID="Id" COM_COMPONENTBUILDER_CUSTOM_CODE_INSERTION="Insertion" COM_COMPONENTBUILDER_CUSTOM_CODE_JCB_MANUAL="JCB (manual)" +COM_COMPONENTBUILDER_CUSTOM_CODE_JOOMLA_VERSION_LABEL="Joomla Version" COM_COMPONENTBUILDER_CUSTOM_CODE_MODIFIED_BY_DESC="The last user that modified this Custom Code." COM_COMPONENTBUILDER_CUSTOM_CODE_MODIFIED_BY_LABEL="Modified By" COM_COMPONENTBUILDER_CUSTOM_CODE_MODIFIED_DATE_DESC="The date this Custom Code was modified." COM_COMPONENTBUILDER_CUSTOM_CODE_MODIFIED_DATE_LABEL="Modified Date" COM_COMPONENTBUILDER_CUSTOM_CODE_NEW="A New Custom Code" -COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_JCB_PLACEHOLDER_DESCRIPTION="

    [save to see placeholder]
    You can also pass values to this code like this: [save to see placeholder trick]

    -

    Those values will be replace placeholders called args. These placeholders are zero based and should look like this: [[[arg0]]], [[[arg1]]] ... as many as you like. If you use 5 args in your code, you must always pass 5 values, since they are zero based your fifth arg will look like this [[[arg4]]]

    -

    To use the following [ ] , + = in your string being passed, use the following: [ &#91;; ] &#93;; , &#44;; + &#43;; = &#61;

    -

    Please note THAT YOU CAN NOW use this placeholder in other custom code views, just not in Hash (automation) custom code from the IDE, and not in it self, enjoy!
    Another important note, all code with args will not be reversed updated from the changes in the editor out side of JCB at this time, since that will remove all the arg placeholders this means you will only be able to update the code here in the JCB UI.

    This note will change once we have resolved these limitations." +COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_JCB_PLACEHOLDER_DESCRIPTION="

    [save to see placeholder]
    You can also pass values to this code like this: [save to see placeholder trick]

    Those values will be replace placeholders called args. These placeholders are zero based and should look like this: [[[arg0]]], [[[arg1]]] ... as many as you like. If you use 5 args in your code, you must always pass 5 values, since they are zero based your fifth arg will look like this [[[arg4]]]

    To use the following [ ] , + = in your string being passed, use the following: [ &#91;; ] &#93;; , &#44;; + &#43;; = &#61;

    Please note THAT YOU CAN NOW use this placeholder in other custom code views, just not in Hash (automation) custom code from the IDE, and not in it self, enjoy!
    Another important note, all code with args will not be reversed updated from the changes in the editor out side of JCB at this time, since that will remove all the arg placeholders this means you will only be able to update the code here in the JCB UI.

    This note will change once we have resolved these limitations." COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_JCB_PLACEHOLDER_LABEL="You can use this code in any JCB code area, simply add this PlaceHolder." -COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_PLACEHOLDERS_EXPLAINED_DESCRIPTION="
    -

    Understand how the placeholders work in (IDE)

    -
    -

    Comment Type PHP/JS

    -

    How You Can Add New Code in the IDE

    - - Add New Insert Code - - - -
    /***[INSERT<>$$$$]***/ 
     <YOUR CODE HERE>
    /***[/INSERT<>$$$$]***/ 
    - - Add New Replace Code - - - -
    /***[REPLACE<>$$$$]***/ 
     <YOUR CODE HERE>
    /***[/REPLACE<>$$$$]***/ 
    -

    When JCB Adds it Back

    - - JCB Add Inserted Code - - - -
    /***[INSERTED$$$$]***//*x*/ 
     <YOUR CODE HERE>
    /***[/INSERTED$$$$]***/ 
    - - JCB Add Replaced Code - - - -
    /***[REPLACED$$$$]***//*x*/ 
     <YOUR CODE HERE>
    /***[/REPLACED$$$$]***/ 
    -

    When You Want to Changing Existing Custom Code in the IDE

    - - Update Inserted Code - - - -
    /***[INSERTED<>$$$$]***//*x*/ 
     <YOUR CODE HERE>
    /***[/INSERTED<>$$$$]***/ 
    - - Update Replaced Code - - - -
    /***[REPLACED<>$$$$]***//*x*/ 
     <YOUR CODE HERE>
    /***[/REPLACED<>$$$$]***/ 
    -
    -
    -

    Comment Type HTML

    -

    How You Can Add New Code in the IDE

    - - Add New Insert Code - - - -
    <!--[INSERT<>$$$$]--> 
     <YOUR CODE HERE>
    <!--[/INSERT<>$$$$]--> 
    - - Add New Replace Code - - - -
    <!--[REPLACE<>$$$$]--> 
     <YOUR CODE HERE>
    <!--[/REPLACE<>$$$$]--> 
    -

    When JCB Adds it Back

    - - JCB Add Inserted Code - - - -
    <!--[INSERTED$$$$]--><!--x--> 
     <YOUR CODE HERE>
    <!--[/INSERTED$$$$]--> 
    - - JCB Add Replaced Code - - - -
    <!--[REPLACED$$$$]--><!--x--> 
     <YOUR CODE HERE>
    <!--[/REPLACED$$$$]--> 
    -

    When You Want to Changing Existing Custom Code in the IDE

    - - Update Inserted Code - - - -
    <!--[INSERTED<>$$$$]--><!--x--> 
     <YOUR CODE HERE>
    <!--[/INSERTED<>$$$$]--> 
    - - Update Replaced Code - - - -
    <!--[REPLACED<>$$$$]--><!--x--> 
     <YOUR CODE HERE>
    <!--[/REPLACED<>$$$$]--> 
    -
    -

    x is the ID of the code in the system don't change it when you edit the code in your IDE outside of JCB!

    -
    - -
    " +COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_PLACEHOLDERS_EXPLAINED_DESCRIPTION="

    Understand how the placeholders work in (IDE)

    Comment Type PHP/JS

    How You Can Add New Code in the IDE

    Add New Insert Code
    /***[INSERT<>$$$$]***/ 
     <YOUR CODE HERE>
    /***[/INSERT<>$$$$]***/ 
    Add New Replace Code
    /***[REPLACE<>$$$$]***/ 
     <YOUR CODE HERE>
    /***[/REPLACE<>$$$$]***/ 

    When JCB Adds it Back

    JCB Add Inserted Code
    /***[INSERTED$$$$]***//*x*/ 
     <YOUR CODE HERE>
    /***[/INSERTED$$$$]***/ 
    JCB Add Replaced Code
    /***[REPLACED$$$$]***//*x*/ 
     <YOUR CODE HERE>
    /***[/REPLACED$$$$]***/ 

    When You Want to Changing Existing Custom Code in the IDE

    Update Inserted Code
    /***[INSERTED<>$$$$]***//*x*/ 
     <YOUR CODE HERE>
    /***[/INSERTED<>$$$$]***/ 
    Update Replaced Code
    /***[REPLACED<>$$$$]***//*x*/ 
     <YOUR CODE HERE>
    /***[/REPLACED<>$$$$]***/ 

    Comment Type HTML

    How You Can Add New Code in the IDE

    Add New Insert Code
    <!--[INSERT<>$$$$]--> 
     <YOUR CODE HERE>
    <!--[/INSERT<>$$$$]--> 
    Add New Replace Code
    <!--[REPLACE<>$$$$]--> 
     <YOUR CODE HERE>
    <!--[/REPLACE<>$$$$]--> 

    When JCB Adds it Back

    JCB Add Inserted Code
    <!--[INSERTED$$$$]--><!--x--> 
     <YOUR CODE HERE>
    <!--[/INSERTED$$$$]--> 
    JCB Add Replaced Code
    <!--[REPLACED$$$$]--><!--x--> 
     <YOUR CODE HERE>
    <!--[/REPLACED$$$$]--> 

    When You Want to Changing Existing Custom Code in the IDE

    Update Inserted Code
    <!--[INSERTED<>$$$$]--><!--x--> 
     <YOUR CODE HERE>
    <!--[/INSERTED<>$$$$]--> 
    Update Replaced Code
    <!--[REPLACED<>$$$$]--><!--x--> 
     <YOUR CODE HERE>
    <!--[/REPLACED<>$$$$]--> 

    x is the ID of the code in the system don't change it when you edit the code in your IDE outside of JCB!

    " COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_PLACEHOLDERS_EXPLAINED_LABEL="Information Area." COM_COMPONENTBUILDER_CUSTOM_CODE_NOT_REQUIRED="Not Required" COM_COMPONENTBUILDER_CUSTOM_CODE_ORDERING_LABEL="Ordering" @@ -4356,10 +4228,8 @@ COM_COMPONENTBUILDER_DASH="Dashboard" COM_COMPONENTBUILDER_DASHBOARD="Component Builder Dashboard" COM_COMPONENTBUILDER_DASHBOARD_ADD_RECORD="Dashboard (add record)" COM_COMPONENTBUILDER_DASHBOARD_ADMIN_VIEWS="Admin Views

    " -COM_COMPONENTBUILDER_DASHBOARD_ADMIN_VIEW_ADD="Add Admin View

    " COM_COMPONENTBUILDER_DASHBOARD_COMPILER="Compiler

    " COM_COMPONENTBUILDER_DASHBOARD_CUSTOM_ADMIN_VIEWS="Custom Admin Views

    " -COM_COMPONENTBUILDER_DASHBOARD_CUSTOM_ADMIN_VIEW_ADD="Add Custom Admin View

    " COM_COMPONENTBUILDER_DASHBOARD_CUSTOM_CODES="Custom Codes

    " COM_COMPONENTBUILDER_DASHBOARD_DYNAMIC_GETS="Dynamic Gets

    " COM_COMPONENTBUILDER_DASHBOARD_DYNAMIC_GET_ADD="Add Dynamic Get

    " @@ -4380,9 +4250,9 @@ COM_COMPONENTBUILDER_DASHBOARD_LIBRARIES="Libraries

    " COM_COMPONENTBUILDER_DASHBOARD_LIST_OF_RECORDS="Dashboard (list of records)" COM_COMPONENTBUILDER_DASHBOARD_PLACEHOLDERS="Placeholders

    " COM_COMPONENTBUILDER_DASHBOARD_POWERS="Powers

    " +COM_COMPONENTBUILDER_DASHBOARD_SEARCH="Search

    " COM_COMPONENTBUILDER_DASHBOARD_SERVERS="Servers

    " COM_COMPONENTBUILDER_DASHBOARD_SITE_VIEWS="Site Views

    " -COM_COMPONENTBUILDER_DASHBOARD_SITE_VIEW_ADD="Add Site View

    " COM_COMPONENTBUILDER_DASHBOARD_SNIPPETS="Snippets

    " COM_COMPONENTBUILDER_DASHBOARD_TEMPLATES="Templates

    " COM_COMPONENTBUILDER_DASHBOARD_TEMPLATE_ADD="Add Template

    " @@ -4398,6 +4268,8 @@ COM_COMPONENTBUILDER_DISPLAY_SWITCH_FOR_DYNAMIC_PLACEMENT_IN_RELATION_TO_THE_USE COM_COMPONENTBUILDER_DIVERGED="Diverged" COM_COMPONENTBUILDER_DIVERGED_MEANS_YOUR_BLOCAL_SNIPPETB_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_A_BDIVERGEDB_FROM_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_IN_THAT_IT_DOES_NOT_HAVE_THE_SAME_BCREATIONB_OR_BMODIFIED_DATEB="Diverged means your local snippet (with the same name, library and type) has a diverged from the community snippet (with the same name, library and type) in that it does not have the same creation or modified date." COM_COMPONENTBUILDER_DOES_THIS_PACKAGE_REQUIRE_A_KEY_TO_INSTALL="Does this package require a key to install." +COM_COMPONENTBUILDER_DONATE_TO_JCB="Donate to JCB" +COM_COMPONENTBUILDER_DONATIONS="Donations!" COM_COMPONENTBUILDER_DOWNLOAD_UPDATE="Download Update" COM_COMPONENTBUILDER_DO_NOT_ADD="Do not add" COM_COMPONENTBUILDER_DTCOMPANYDTDDSDD="
    Company
    %s
    " @@ -4406,6 +4278,7 @@ COM_COMPONENTBUILDER_DTEMAILDTDDSDD="
    Email
    %s
    " COM_COMPONENTBUILDER_DTLICENSEDTDDSDD="
    License
    %s
    " COM_COMPONENTBUILDER_DTOWNERDTDDSDD="
    Owner
    %s
    " COM_COMPONENTBUILDER_DTWEBSITEDTDDSDD="
    Website
    %s
    " +COM_COMPONENTBUILDER_DYNAMIC_BUTTON_ERROR="Dynamic Button Error" COM_COMPONENTBUILDER_DYNAMIC_GET="Dynamic Get" COM_COMPONENTBUILDER_DYNAMIC_GETS="Dynamic Gets" COM_COMPONENTBUILDER_DYNAMIC_GETS_ACCESS="Dynamic Gets Access" @@ -4413,7 +4286,7 @@ COM_COMPONENTBUILDER_DYNAMIC_GETS_ACCESS_DESC="Allows the users in this group to COM_COMPONENTBUILDER_DYNAMIC_GETS_BATCH_OPTIONS="Batch process the selected Dynamic Gets" COM_COMPONENTBUILDER_DYNAMIC_GETS_BATCH_TIP="All changes will be applied to all selected Dynamic Gets" COM_COMPONENTBUILDER_DYNAMIC_GETS_BATCH_USE="Dynamic Gets Batch Use" -COM_COMPONENTBUILDER_DYNAMIC_GETS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch dynamic gets" +COM_COMPONENTBUILDER_DYNAMIC_GETS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch dynamic gets" COM_COMPONENTBUILDER_DYNAMIC_GETS_CREATE="Dynamic Gets Create" COM_COMPONENTBUILDER_DYNAMIC_GETS_CREATE_DESC="Allows the users in this group to create create dynamic gets" COM_COMPONENTBUILDER_DYNAMIC_GETS_DASHBOARD_ADD="Dynamic Gets Dashboard Add" @@ -4429,7 +4302,7 @@ COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_OWN_DESC="Allows the users in this group COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_STATE="Dynamic Gets Edit State" COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_STATE_DESC="Allows the users in this group to update the state of the dynamic get" COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_VERSION="Dynamic Gets Edit Version" -COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version dynamic gets" +COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version dynamic gets" COM_COMPONENTBUILDER_DYNAMIC_GETS_EXPORT="Dynamic Gets Export" COM_COMPONENTBUILDER_DYNAMIC_GETS_EXPORT_DESC="Allows the users in this group to export export dynamic gets" COM_COMPONENTBUILDER_DYNAMIC_GETS_IMPORT="Dynamic Gets Import" @@ -4467,7 +4340,7 @@ COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_BEFORE_GETITEMS_LABEL="Add PHP (before COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_BEFORE_GETITEM_LABEL="Add PHP (before getting the Item)" COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_GETLISTQUERY_LABEL="Add PHP (getListQuery - JModelList)" COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_ROUTER_PARSE_DESCRIPTION="The option to override the default JCB implementation of the router parse method for the related view where this dynamicGet is added." -COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_ROUTER_PARSE_LABEL="Add PHP (parse Method) - in Router" +COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_ROUTER_PARSE_LABEL="Add PHP (parse Method) - in Joomla 3 Router" COM_COMPONENTBUILDER_DYNAMIC_GET_ARRAY_VALUE="Array Value" COM_COMPONENTBUILDER_DYNAMIC_GET_ASCENDING="Ascending" COM_COMPONENTBUILDER_DYNAMIC_GET_AS_LABEL="AS" @@ -4504,6 +4377,7 @@ COM_COMPONENTBUILDER_DYNAMIC_GET_EMPTY_LABEL="Allow" COM_COMPONENTBUILDER_DYNAMIC_GET_EQUAL="equal" COM_COMPONENTBUILDER_DYNAMIC_GET_EQUAL_OR_NOT="equal or not" COM_COMPONENTBUILDER_DYNAMIC_GET_ERROR_UNIQUE_ALIAS="Another Dynamic Get has the same alias." +COM_COMPONENTBUILDER_DYNAMIC_GET_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Dynamic Get has the same alias ." COM_COMPONENTBUILDER_DYNAMIC_GET_F="f" COM_COMPONENTBUILDER_DYNAMIC_GET_FF="ff" COM_COMPONENTBUILDER_DYNAMIC_GET_FILTER_DESCRIPTION="Here you can add filters to the query." @@ -4627,7 +4501,9 @@ COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_GETLISTQUERY_DESCRIPTION="Add PHP Here that COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_GETLISTQUERY_LABEL="PHP getListQuery Method
    used to add custom filtering values." COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE_DESCRIPTION="Add your PHP here! [Do not add the php tags]
    Add the php code to override the default JCB implementation of the router parse method for the related view where this dynamicGet is added." COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE_HINT="// PHP Here that should run in the parse Method -> switch | (array) $segments - the segments of the URL to parse | (array) $vars - the URL attributes to be used by the application." -COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE_LABEL="PHP" +COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE_LABEL="PHP (only for Joomla 3)" +COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE_NOTICE_DESCRIPTION="For Joomla 4 and above we move the router related settings to the the Component Site Router area. This can be found in the Joomla Components list view, next to the [add site views button] you will see a button that opens this new Site Router view." +COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE_NOTICE_LABEL="Joomla 4++" COM_COMPONENTBUILDER_DYNAMIC_GET_PLEASE_SELECT="Please select" COM_COMPONENTBUILDER_DYNAMIC_GET_PLUGIN_EVENTS_DESCRIPTION="Select the content plugin events you would like to add to the page that uses this dynamic get. Please note that the onContentPrepare event is added to all textarea and editor field types by default, so no need to add it again." COM_COMPONENTBUILDER_DYNAMIC_GET_PLUGIN_EVENTS_LABEL="Content Plugin Events
    All events added here can
    be accessed in the $this->item->event object.
    " @@ -4708,9 +4584,11 @@ COM_COMPONENTBUILDER_EDIT_CREATED_DATE="Edit Created Date" COM_COMPONENTBUILDER_EDIT_CREATED_DATE_DESC="Allows users in this group to edit created date." COM_COMPONENTBUILDER_EDIT_S="Edit %s" COM_COMPONENTBUILDER_EDIT_S_FOR_THIS_S="Edit %s for this %s" +COM_COMPONENTBUILDER_EDIT_S_S_DIRECTLY="Edit %s (%s) directly" COM_COMPONENTBUILDER_EDIT_VERSIONS="Edit Version" COM_COMPONENTBUILDER_EDIT_VERSIONS_DESC="Allows users in this group to edit versions." COM_COMPONENTBUILDER_EDIT_VIEW="Edit View" +COM_COMPONENTBUILDER_ELEVATE_JCB_TODAY="Elevate JCB Today" COM_COMPONENTBUILDER_EMAIL="Email" COM_COMPONENTBUILDER_EMAIL_S="Email %s" COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SENT="Email with the new key was sent" @@ -4719,8 +4597,12 @@ COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB="Copyright: %s" COM_COMPONENTBUILDER_EMEMAILEM_BSB="Email: %s" COM_COMPONENTBUILDER_EMLICENSEEM_BSB="License: %s" COM_COMPONENTBUILDER_EMOWNEREM_BSB="Owner: %s" +COM_COMPONENTBUILDER_EMPOWER_JCB="Empower JCB" +COM_COMPONENTBUILDER_EMPOWER_THE_FUTURE_WITH_JCB="Empower the Future with JCB" COM_COMPONENTBUILDER_EMPTY_TRASH="Empty trash" COM_COMPONENTBUILDER_EMWEBSITEEM_BSB="Website: %s" +COM_COMPONENTBUILDER_ENTER_YOUR_REPLACE_TEXT="Enter your replace text" +COM_COMPONENTBUILDER_ENTER_YOUR_SEARCH_TEXT="Enter your search text" COM_COMPONENTBUILDER_EQUAL="Equal" COM_COMPONENTBUILDER_EQUAL_MEANS_THAT_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_AND_YOUR_LOCAL_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_THE_SAME_BCREATIONB_AND_BMODIFIED_DATEB="Equal means that the community snippet (with the same name, library and type) and your local snippet (with the same name, library and type) has the same creation and modified date." COM_COMPONENTBUILDER_ERROR="Error" @@ -4751,7 +4633,7 @@ COM_COMPONENTBUILDER_FIELDS_ACCESS_DESC="Allows the users in this group to acces COM_COMPONENTBUILDER_FIELDS_BATCH_OPTIONS="Batch process the selected Fields" COM_COMPONENTBUILDER_FIELDS_BATCH_TIP="All changes will be applied to all selected Fields" COM_COMPONENTBUILDER_FIELDS_BATCH_USE="Fields Batch Use" -COM_COMPONENTBUILDER_FIELDS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch fields" +COM_COMPONENTBUILDER_FIELDS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch fields" COM_COMPONENTBUILDER_FIELDS_CREATE="Fields Create" COM_COMPONENTBUILDER_FIELDS_CREATE_DESC="Allows the users in this group to create create fields" COM_COMPONENTBUILDER_FIELDS_DASHBOARD_ADD="Fields Dashboard Add" @@ -4767,7 +4649,7 @@ COM_COMPONENTBUILDER_FIELDS_EDIT_OWN_DESC="Allows the users in this group to edi COM_COMPONENTBUILDER_FIELDS_EDIT_STATE="Fields Edit State" COM_COMPONENTBUILDER_FIELDS_EDIT_STATE_DESC="Allows the users in this group to update the state of the field" COM_COMPONENTBUILDER_FIELDS_EDIT_VERSION="Fields Edit Version" -COM_COMPONENTBUILDER_FIELDS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version fields" +COM_COMPONENTBUILDER_FIELDS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version fields" COM_COMPONENTBUILDER_FIELDS_EXPORT="Fields Export" COM_COMPONENTBUILDER_FIELDS_EXPORT_DESC="Allows the users in this group to export export fields" COM_COMPONENTBUILDER_FIELDS_IMPORT="Fields Import" @@ -4793,6 +4675,7 @@ COM_COMPONENTBUILDER_FIELDS_N_ITEMS_UNPUBLISHED="%s Fields unpublished." COM_COMPONENTBUILDER_FIELDS_N_ITEMS_UNPUBLISHED_1="%s Field unpublished." COM_COMPONENTBUILDER_FIELDS_SUBMENU="Fields Submenu" COM_COMPONENTBUILDER_FIELDS_SUBMENU_DESC="Allows the users in this group to submenu of field" +COM_COMPONENTBUILDER_FIELDS_THAT_HAD="fields that had" COM_COMPONENTBUILDER_FIELDTYPE="Fieldtype" COM_COMPONENTBUILDER_FIELDTYPES="Fieldtypes" COM_COMPONENTBUILDER_FIELDTYPES_ACCESS="Fieldtypes Access" @@ -4800,7 +4683,7 @@ COM_COMPONENTBUILDER_FIELDTYPES_ACCESS_DESC="Allows the users in this group to a COM_COMPONENTBUILDER_FIELDTYPES_BATCH_OPTIONS="Batch process the selected Fieldtypes" COM_COMPONENTBUILDER_FIELDTYPES_BATCH_TIP="All changes will be applied to all selected Fieldtypes" COM_COMPONENTBUILDER_FIELDTYPES_BATCH_USE="Fieldtypes Batch Use" -COM_COMPONENTBUILDER_FIELDTYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch fieldtypes" +COM_COMPONENTBUILDER_FIELDTYPES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch fieldtypes" COM_COMPONENTBUILDER_FIELDTYPES_CREATE="Fieldtypes Create" COM_COMPONENTBUILDER_FIELDTYPES_CREATE_DESC="Allows the users in this group to create create fieldtypes" COM_COMPONENTBUILDER_FIELDTYPES_DASHBOARD_LIST="Fieldtypes Dashboard List" @@ -4814,7 +4697,7 @@ COM_COMPONENTBUILDER_FIELDTYPES_EDIT_OWN_DESC="Allows the users in this group to COM_COMPONENTBUILDER_FIELDTYPES_EDIT_STATE="Fieldtypes Edit State" COM_COMPONENTBUILDER_FIELDTYPES_EDIT_STATE_DESC="Allows the users in this group to update the state of the fieldtype" COM_COMPONENTBUILDER_FIELDTYPES_EDIT_VERSION="Fieldtypes Edit Version" -COM_COMPONENTBUILDER_FIELDTYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version fieldtypes" +COM_COMPONENTBUILDER_FIELDTYPES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version fieldtypes" COM_COMPONENTBUILDER_FIELDTYPES_EXPORT="Fieldtypes Export" COM_COMPONENTBUILDER_FIELDTYPES_EXPORT_DESC="Allows the users in this group to export export fieldtypes" COM_COMPONENTBUILDER_FIELDTYPES_IMPORT="Fieldtypes Import" @@ -4844,6 +4727,8 @@ COM_COMPONENTBUILDER_FIELDTYPE_ADJUSTABLE_DESCRIPTION="Select if the value is ad COM_COMPONENTBUILDER_FIELDTYPE_ADJUSTABLE_LABEL="Adjustable" COM_COMPONENTBUILDER_FIELDTYPE_BASE64="base64" COM_COMPONENTBUILDER_FIELDTYPE_BASIC_ENCRYPTION_LOCALDBKEY="Basic Encryption (local-DB-key)" +COM_COMPONENTBUILDER_FIELDTYPE_BASIC_ENCRYPTION_NOTE_DESCRIPTION="

    Since basic encryption makes use of the FOF encryption suite, we need to deprecate this method.
    Hence, please refrain from using this method in new projects!

    Removing this basic encryption method from an existing project is challenging, and incorrect removal may result in data loss, or breach. For this reason, we've ported the FOF encryption suite into JCB powers, enabling its use in PHP 8+ and Joomla 4.

    As a result, you should be able to continue using it in existing projects.

    We plan to establish a migration path to another encryption option, like PHPSecLib, in the future. We will announce the removal date of the Basic Encryption feature only after this migration path is in place.

    " +COM_COMPONENTBUILDER_FIELDTYPE_BASIC_ENCRYPTION_NOTE_LABEL="Basic Encryption" COM_COMPONENTBUILDER_FIELDTYPE_BIGINT="BIGINT" COM_COMPONENTBUILDER_FIELDTYPE_BLOB="BLOB" COM_COMPONENTBUILDER_FIELDTYPE_CATID_DESCRIPTION="select one of the following categories" @@ -4881,6 +4766,7 @@ COM_COMPONENTBUILDER_FIELDTYPE_DOUBLE="DOUBLE" COM_COMPONENTBUILDER_FIELDTYPE_EDIT="Editing the Fieldtype" COM_COMPONENTBUILDER_FIELDTYPE_ELEVEN="11" COM_COMPONENTBUILDER_FIELDTYPE_ERROR_UNIQUE_ALIAS="Another Fieldtype has the same alias." +COM_COMPONENTBUILDER_FIELDTYPE_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Fieldtype has the same alias ." COM_COMPONENTBUILDER_FIELDTYPE_EXAMPLE_DESCRIPTION="Text Area" COM_COMPONENTBUILDER_FIELDTYPE_EXAMPLE_HINT="Value/Example Here" COM_COMPONENTBUILDER_FIELDTYPE_EXAMPLE_LABEL="Value/Example" @@ -4907,6 +4793,8 @@ COM_COMPONENTBUILDER_FIELDTYPE_MANDATORY_LABEL="Mandatory" COM_COMPONENTBUILDER_FIELDTYPE_MEDIUMBLOB="MEDIUMBLOB" COM_COMPONENTBUILDER_FIELDTYPE_MEDIUMTEXT="MEDIUMTEXT" COM_COMPONENTBUILDER_FIELDTYPE_MEDIUM_ENCRYPTION_LOCALFILEKEY="Medium Encryption (local-file-key)" +COM_COMPONENTBUILDER_FIELDTYPE_MEDIUM_ENCRYPTION_NOTE_DESCRIPTION="

    Since medium encryption makes use of the FOF encryption suite, we need to deprecate this method.
    Hence, please refrain from using this method in new projects!

    Removing this medium encryption method from an existing project is challenging, and incorrect removal may result in data loss, or breach. For this reason, we've ported the FOF encryption suite into JCB powers, enabling its use in PHP 8+ and Joomla 4.

    As a result, you should be able to continue using it in existing projects.

    We plan to establish a migration path to another encryption option, like PHPSecLib, in the future. We will announce the removal date of the Medium Encryption feature only after this migration path is in place.

    " +COM_COMPONENTBUILDER_FIELDTYPE_MEDIUM_ENCRYPTION_NOTE_LABEL="Medium Encryption" COM_COMPONENTBUILDER_FIELDTYPE_MODIFIED_BY_DESC="The last user that modified this Fieldtype." COM_COMPONENTBUILDER_FIELDTYPE_MODIFIED_BY_LABEL="Modified By" COM_COMPONENTBUILDER_FIELDTYPE_MODIFIED_DATE_DESC="The date this Fieldtype was modified." @@ -4921,9 +4809,7 @@ COM_COMPONENTBUILDER_FIELDTYPE_NONE="None" COM_COMPONENTBUILDER_FIELDTYPE_NONE_SET="None Set" COM_COMPONENTBUILDER_FIELDTYPE_NOTE_ON_FIELDS_DESCRIPTION="To get more form field settings go to https://docs.joomla.org/Form_field" COM_COMPONENTBUILDER_FIELDTYPE_NOTE_ON_FIELDS_LABEL="More Standard form field types" -COM_COMPONENTBUILDER_FIELDTYPE_NOTE_WHMCS_ENCRYPTION_DESCRIPTION="

    When using the WHMCS encryption you need to get a WHMCS key from:
    https://www.vdm.io, or your own WHMCS install.

    Please note that you will need to enable the add-on in the Joomla Component area (Add WHMCS)->Yes.

    You can get more info about the WHMCS licensing add-on at the following links.

    Helpful Links:
    -https://www.whmcs.com/software-licensing/
    -http://docs.whmcs.com/Licensing_Addon/

    Support JCB and use our affiliate link (https://www.whmcs.com/members/aff.php?aff=37513) to sign-up with WHMCS.

    " +COM_COMPONENTBUILDER_FIELDTYPE_NOTE_WHMCS_ENCRYPTION_DESCRIPTION="

    When using the WHMCS encryption you need to get a WHMCS key from:
    https://www.vdm.io, or your own WHMCS install.

    Please note that you will need to enable the add-on in the Joomla Component area (Add WHMCS)->Yes.

    You can get more info about the WHMCS licensing add-on at the following links.

    Helpful Links:
    https://www.whmcs.com/software-licensing/
    http://docs.whmcs.com/Licensing_Addon/

    Support JCB and use our affiliate link (https://www.whmcs.com/members/aff.php?aff=37513) to sign-up with WHMCS.

    " COM_COMPONENTBUILDER_FIELDTYPE_NOTE_WHMCS_ENCRYPTION_LABEL="The WHMCS Encryption" COM_COMPONENTBUILDER_FIELDTYPE_NOT_NULL="NOT NULL" COM_COMPONENTBUILDER_FIELDTYPE_NOT_REQUIRED="Not Required" @@ -4948,7 +4834,7 @@ COM_COMPONENTBUILDER_FIELDTYPE_SHORT_DESCRIPTION_MESSAGE="Error! Please add some COM_COMPONENTBUILDER_FIELDTYPE_SIXTY_FOUR="64" COM_COMPONENTBUILDER_FIELDTYPE_STATUS="Status" COM_COMPONENTBUILDER_FIELDTYPE_STORE_DESCRIPTION="How should the field value be modeled during saving and getting of the value. Default is the Joomla basic normal storing way of dealing with this field type." -COM_COMPONENTBUILDER_FIELDTYPE_STORE_LABEL="Modeling Method" +COM_COMPONENTBUILDER_FIELDTYPE_STORE_LABEL="Modelling Method" COM_COMPONENTBUILDER_FIELDTYPE_TEN="10" COM_COMPONENTBUILDER_FIELDTYPE_TEXT="TEXT" COM_COMPONENTBUILDER_FIELDTYPE_TIME="TIME" @@ -4971,6 +4857,8 @@ COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEWS_FOOTER_LABEL="Add JavaScript (vi COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEW_FOOTER_LABEL="Add JavaScript (view-footer)" COM_COMPONENTBUILDER_FIELD_BASE64="base64" COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY="Basic Encryption (local-DB-key)" +COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_NOTE_DESCRIPTION="

    Since basic encryption makes use of the FOF encryption suite, we need to deprecate this method.
    Hence, please refrain from using this method in new projects!

    Removing this basic encryption method from an existing project is challenging, and incorrect removal may result in data loss, or breach. For this reason, we've ported the FOF encryption suite into JCB powers, enabling its use in PHP 8+ and Joomla 4.

    As a result, you should be able to continue using it in existing projects.

    We plan to establish a migration path to another encryption option, like PHPSecLib, in the future. We will announce the removal date of the Basic Encryption feature only after this migration path is in place.

    " +COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_NOTE_LABEL="Basic Encryption" COM_COMPONENTBUILDER_FIELD_BIGINT="BIGINT" COM_COMPONENTBUILDER_FIELD_BLOB="BLOB" COM_COMPONENTBUILDER_FIELD_BSB_NOT_FOUND_IN_LOCAL_DATABASE_TABLE_S_SO_IMPORTED_OF_ITS_VALUES_FAILED_PLEASE_UPDATE_YOUR_JCB_INSTALL_AND_TRY_AGAIN="Field %s not found in local database table (%s) so imported of its values failed, please update your JCB install and try again." @@ -5009,6 +4897,7 @@ COM_COMPONENTBUILDER_FIELD_DOUBLE="DOUBLE" COM_COMPONENTBUILDER_FIELD_EDIT="Editing the Field" COM_COMPONENTBUILDER_FIELD_ELEVEN="11" COM_COMPONENTBUILDER_FIELD_ERROR_UNIQUE_ALIAS="Another Field has the same alias." +COM_COMPONENTBUILDER_FIELD_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Field has the same alias ." COM_COMPONENTBUILDER_FIELD_EXPERT_MODE_CUSTOM="Expert Mode - Custom" COM_COMPONENTBUILDER_FIELD_FIELDS_CATEGORIES="Fields Categories" COM_COMPONENTBUILDER_FIELD_FIELDTYPE_DESCRIPTION="Set the field type" @@ -5022,18 +4911,13 @@ COM_COMPONENTBUILDER_FIELD_HELPNOTE_LABEL="Field Information" COM_COMPONENTBUILDER_FIELD_ID="Id" COM_COMPONENTBUILDER_FIELD_INDEXES_LABEL="Indexes Type" COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_GET_MODEL_DESCRIPTION="The initiator to on get model this field. If JCB finds that there is more then one field with the same initiator code in one view it will only load it once. You could also leave this blank if you already have the on get model initiator set in another field of the same admin_view." -COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_GET_MODEL_HINT="// Get the medium decryption. -$mediumkey = ComponentbuilderHelper::getCryptKey('medium'); -// Get the encryption object. -$medium = new FOFEncryptAes($mediumkey);" +COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_GET_MODEL_HINT="// Get the medium decryption.$mediumkey = ComponentbuilderHelper::getCryptKey('medium');// Get the encryption object.$medium = new FOFEncryptAes($mediumkey);" COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_GET_MODEL_LABEL="Initiator
    on get model" COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_DESCRIPTION="The initiator to on save model this field. If JCB finds that there is more then one field with the same initiator code in one view it will only load it once. You could also leave this blank if you already have the on save model initiator set in another field of the same admin_view." -COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_HINT="// Get the medium encryption. -$mediumkey = ComponentbuilderHelper::getCryptKey('medium'); -// Get the encryption object. -$medium = new FOFEncryptAes($mediumkey);" +COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_HINT="// Get the medium encryption.$mediumkey = ComponentbuilderHelper::getCryptKey('medium');// Get the encryption object.$medium = new FOFEncryptAes($mediumkey);" COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_LABEL="Initiator
    on save model" COM_COMPONENTBUILDER_FIELD_INT="INT" +COM_COMPONENTBUILDER_FIELD_IN_THE="field in the" COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEWS_FOOTER_DESCRIPTION="Add JavaScript for the list view that is loaded in the footer inside script tags. Do not add the script tags." COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEWS_FOOTER_LABEL="Javascript (list view footer)" COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_DESCRIPTION="Add JavaScript for the edit view that is loaded in the footer inside script tags. Do not add the script tags." @@ -5045,6 +4929,8 @@ COM_COMPONENTBUILDER_FIELD_LONGTEXT="LONGTEXT" COM_COMPONENTBUILDER_FIELD_MEDIUMBLOB="MEDIUMBLOB" COM_COMPONENTBUILDER_FIELD_MEDIUMTEXT="MEDIUMTEXT" COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY="Medium Encryption (local-file-key)" +COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_NOTE_DESCRIPTION="

    Since medium encryption makes use of the FOF encryption suite, we need to deprecate this method.
    Hence, please refrain from using this method in new projects!

    Removing this medium encryption method from an existing project is challenging, and incorrect removal may result in data loss, or breach. For this reason, we've ported the FOF encryption suite into JCB powers, enabling its use in PHP 8+ and Joomla 4.

    As a result, you should be able to continue using it in existing projects.

    We plan to establish a migration path to another encryption option, like PHPSecLib, in the future. We will announce the removal date of the Medium Encryption feature only after this migration path is in place.

    " +COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_NOTE_LABEL="Medium Encryption" COM_COMPONENTBUILDER_FIELD_MODIFIED_BY_DESC="The last user that modified this Field." COM_COMPONENTBUILDER_FIELD_MODIFIED_BY_LABEL="Modified By" COM_COMPONENTBUILDER_FIELD_MODIFIED_DATE_DESC="The date this Field was modified." @@ -5059,103 +4945,14 @@ COM_COMPONENTBUILDER_FIELD_NONE="None" COM_COMPONENTBUILDER_FIELD_NONE_SET="None Set" COM_COMPONENTBUILDER_FIELD_NOTE_DATABASE_SETTINGS_NEEDED_DESCRIPTION="

    Set the database column for this field here. The column will have the same name as the field. Please take care to select these settings in the correct relationship. The nature of this area is to give you as much freedom/power as you would like, but with that comes responsibility.

    You therefore need to insure that you know what the correct values should be. A great way to learn, is to look at the Joomla core components fields and the corresponding mySql columns.

    " COM_COMPONENTBUILDER_FIELD_NOTE_DATABASE_SETTINGS_NEEDED_LABEL="Database Settings" -COM_COMPONENTBUILDER_FIELD_NOTE_EXPERT_FIELD_SAVE_MODE_DESCRIPTION="

    When using the EXPERT mode you need to be that expert.

    -

    Bellow you must add the required code to on save model and on get model the set value. Usually if we start modeling values, we first load the needed classes, so for that purpose you have the initiator input areas.

    " +COM_COMPONENTBUILDER_FIELD_NOTE_EXPERT_FIELD_SAVE_MODE_DESCRIPTION="

    When using the EXPERT mode you need to be that expert.

    Bellow you must add the required code to on save model and on get model the set value. Usually if we start modeling values, we first load the needed classes, so for that purpose you have the initiator input areas.

    " COM_COMPONENTBUILDER_FIELD_NOTE_EXPERT_FIELD_SAVE_MODE_LABEL="The Expert Mode" -COM_COMPONENTBUILDER_FIELD_NOTE_FILTER_INFORMATION_DESCRIPTION="
    -
    -

    Filter Information

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    The available values for the filter attribute are:
    FilterDescription
    INTAn integer
    UINTAn unsigned integer
    FLOATA floating point number
    BOOLEANA boolean value
    WORDA string containing A-Z or underscores only (not case sensitive)
    ALNUMA string containing A-Z or 0-9 only (not case sensitive)
    CMDA string containing A-Z, 0-9, underscores, periods or hyphens (not case sensitive)
    BASE64A string containing A-Z, 0-9, forward slashes, plus or equals (not case sensitive)
    STRINGA fully decoded and sanitized string (default)
    HTMLA sanitized string
    ARRAYAn array
    PATHA sanitized file path
    USERNAMEDo not use (use an application specific filter)
    RAWThe raw string is returned with no filtering
    unknownAn unknown filter will act like STRING. If the input is an array it will return an array of fully decoded and sanitized strings.
    -
    -
    -

    Validation Rules

    - -
    Searching the system.
    -
    -
    -

    Linked To

    - -
    Searching the database.
    -
    -
    " +COM_COMPONENTBUILDER_FIELD_NOTE_FILTER_INFORMATION_DESCRIPTION="

    Filter Information

    The available values for the filter attribute are:
    Filter Description
    INT An integer
    UINT An unsigned integer
    FLOAT A floating point number
    BOOLEAN A boolean value
    WORD A string containing A-Z or underscores only (not case sensitive)
    ALNUM A string containing A-Z or 0-9 only (not case sensitive)
    CMD A string containing A-Z, 0-9, underscores, periods or hyphens (not case sensitive)
    BASE64 A string containing A-Z, 0-9, forward slashes, plus or equals (not case sensitive)
    STRING A fully decoded and sanitized string (default)
    HTML A sanitized string
    ARRAY An array
    PATH A sanitized file path
    USERNAME Do not use (use an application specific filter)
    RAW The raw string is returned with no filtering
    unknown An unknown filter will act like STRING. If the input is an array it will return an array of fully decoded and sanitized strings.

    Validation Rules

    Searching the system.

    Linked To

    Searching the database.
    " COM_COMPONENTBUILDER_FIELD_NOTE_NO_DATABASE_SETTINGS_NEEDED_DESCRIPTION="This field does not require any database settings to function correctly." COM_COMPONENTBUILDER_FIELD_NOTE_NO_DATABASE_SETTINGS_NEEDED_LABEL="No Database Require" COM_COMPONENTBUILDER_FIELD_NOTE_SELECT_FIELD_TYPE_DESCRIPTION="Please select a field type that you would like to build." COM_COMPONENTBUILDER_FIELD_NOTE_SELECT_FIELD_TYPE_LABEL="Building a field" -COM_COMPONENTBUILDER_FIELD_NOTE_WHMCS_ENCRYPTION_DESCRIPTION="

    When using the WHMCS encryption you need to get a WHMCS key from:
    https://www.vdm.io, or your own WHMCS install.

    Please note that you will need to enable the add-on in the Joomla Component area (Add WHMCS)->Yes.

    You can get more info about the WHMCS licensing add-on at the following links.

    Helpful Links:
    -https://www.whmcs.com/software-licensing/
    -http://docs.whmcs.com/Licensing_Addon/

    Support JCB and use our affiliate link (https://www.whmcs.com/members/aff.php?aff=37513) to sign-up with WHMCS.

    " +COM_COMPONENTBUILDER_FIELD_NOTE_WHMCS_ENCRYPTION_DESCRIPTION="

    When using the WHMCS encryption you need to get a WHMCS key from:
    https://www.vdm.io, or your own WHMCS install.

    Please note that you will need to enable the add-on in the Joomla Component area (Add WHMCS)->Yes.

    You can get more info about the WHMCS licensing add-on at the following links.

    Helpful Links:
    https://www.whmcs.com/software-licensing/
    http://docs.whmcs.com/Licensing_Addon/

    Support JCB and use our affiliate link (https://www.whmcs.com/members/aff.php?aff=37513) to sign-up with WHMCS.

    " COM_COMPONENTBUILDER_FIELD_NOTE_WHMCS_ENCRYPTION_LABEL="The WHMCS Encryption" COM_COMPONENTBUILDER_FIELD_NOT_NULL="NOT NULL" COM_COMPONENTBUILDER_FIELD_NOT_REQUIRED="Not Required" @@ -5165,11 +4962,7 @@ COM_COMPONENTBUILDER_FIELD_ONE="1" COM_COMPONENTBUILDER_FIELD_ONE_HUNDRED="100" COM_COMPONENTBUILDER_FIELD_ONE_THOUSAND_AND_TWENTY_FOUR="1024" COM_COMPONENTBUILDER_FIELD_ON_GET_MODEL_FIELD_DESCRIPTION="To on get model the field value" -COM_COMPONENTBUILDER_FIELD_ON_GET_MODEL_FIELD_HINT="if (!empty([[[field]]]) && $mediumkey && !is_numeric([[[field]]]) && [[[field]]] === base64_encode(base64_decode([[[field]]], true))) -{ - // medium decrypt field - [[[field]]] = rtrim($medium->decryptString([[[field]]]), "\0"); -}" +COM_COMPONENTBUILDER_FIELD_ON_GET_MODEL_FIELD_HINT="if (!empty([[[field]]]) && $mediumkey && !is_numeric([[[field]]]) && [[[field]]] === base64_encode(base64_decode([[[field]]], true))){ // medium decrypt field [[[field]]] = rtrim($medium->decryptString([[[field]]]), "\0");}" COM_COMPONENTBUILDER_FIELD_ON_GET_MODEL_FIELD_LABEL="On Get Model" COM_COMPONENTBUILDER_FIELD_ON_SAVE_MODEL_FIELD_DESCRIPTION="To on save model the field value" COM_COMPONENTBUILDER_FIELD_ON_SAVE_MODEL_FIELD_HINT="[[[field]]] = $medium->encryptString([[[field]]]);" @@ -5188,7 +4981,7 @@ COM_COMPONENTBUILDER_FIELD_SEVEN="7" COM_COMPONENTBUILDER_FIELD_SIXTY_FOUR="64" COM_COMPONENTBUILDER_FIELD_STATUS="Status" COM_COMPONENTBUILDER_FIELD_STORE_DESCRIPTION="How should the field value be modeled during saving and getting of the value. Default is the Joomla basic normal storing way of dealing with this field type." -COM_COMPONENTBUILDER_FIELD_STORE_LABEL="Modeling Method" +COM_COMPONENTBUILDER_FIELD_STORE_LABEL="Modelling Method" COM_COMPONENTBUILDER_FIELD_TEN="10" COM_COMPONENTBUILDER_FIELD_TEXT="TEXT" COM_COMPONENTBUILDER_FIELD_TIME="TIME" @@ -5206,6 +4999,7 @@ COM_COMPONENTBUILDER_FIELD_XML="Xml" COM_COMPONENTBUILDER_FIELD_YES="Yes" COM_COMPONENTBUILDER_FIELD_ZERO="0" COM_COMPONENTBUILDER_FILE="File" +COM_COMPONENTBUILDER_FILE_BSB_COULD_NOT_BE_STORED="File %s could not be stored!" COM_COMPONENTBUILDER_FILE_BSB_COULD_NOT_BE_UNLOCKED="File %s could not be unlocked!" COM_COMPONENTBUILDER_FILE_BSB_WAS_MOVED_TO_BSB="File %s was moved to %s" COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVED_TO_BSB="File %s was not moved to %s" @@ -5247,6 +5041,8 @@ COM_COMPONENTBUILDER_FILTER_INDEXES_TYPE_ASCENDING="Indexes Type ascending" COM_COMPONENTBUILDER_FILTER_INDEXES_TYPE_DESCENDING="Indexes Type descending" COM_COMPONENTBUILDER_FILTER_JOOMLA_PLUGIN_GROUP_ASCENDING="Joomla Plugin Group ascending" COM_COMPONENTBUILDER_FILTER_JOOMLA_PLUGIN_GROUP_DESCENDING="Joomla Plugin Group descending" +COM_COMPONENTBUILDER_FILTER_JOOMLA_VERSION_ASCENDING="Joomla Version ascending" +COM_COMPONENTBUILDER_FILTER_JOOMLA_VERSION_DESCENDING="Joomla Version descending" COM_COMPONENTBUILDER_FILTER_LANGUAGE_TAG_ASCENDING="Language Tag ascending" COM_COMPONENTBUILDER_FILTER_LANGUAGE_TAG_DESCENDING="Language Tag descending" COM_COMPONENTBUILDER_FILTER_LIBRARY_ASCENDING="Library ascending" @@ -5257,22 +5053,18 @@ COM_COMPONENTBUILDER_FILTER_MAIN_GET_ASCENDING="Main Get ascending" COM_COMPONENTBUILDER_FILTER_MAIN_GET_DESCENDING="Main Get descending" COM_COMPONENTBUILDER_FILTER_MAIN_SOURCE_ASCENDING="Main Source ascending" COM_COMPONENTBUILDER_FILTER_MAIN_SOURCE_DESCENDING="Main Source descending" -COM_COMPONENTBUILDER_FILTER_MODELING_METHOD_ASCENDING="Modeling Method ascending" -COM_COMPONENTBUILDER_FILTER_MODELING_METHOD_DESCENDING="Modeling Method descending" +COM_COMPONENTBUILDER_FILTER_MODELLING_METHOD_ASCENDING="Modelling Method ascending" +COM_COMPONENTBUILDER_FILTER_MODELLING_METHOD_DESCENDING="Modelling Method descending" COM_COMPONENTBUILDER_FILTER_MODIFIED_DATE_ASCENDING="Modified Date ascending" COM_COMPONENTBUILDER_FILTER_MODIFIED_DATE_DESCENDING="Modified Date descending" COM_COMPONENTBUILDER_FILTER_NAMESPACE_ASCENDING="Namespace ascending" COM_COMPONENTBUILDER_FILTER_NAMESPACE_DESCENDING="Namespace descending" COM_COMPONENTBUILDER_FILTER_NAME_ASCENDING="Name ascending" COM_COMPONENTBUILDER_FILTER_NAME_DESCENDING="Name descending" -COM_COMPONENTBUILDER_FILTER_NAME_IN_CODE_NAMING_CONVENTIONS_ASCENDING="Name in Code -Naming Conventions ascending" -COM_COMPONENTBUILDER_FILTER_NAME_IN_CODE_NAMING_CONVENTIONS_DESCENDING="Name in Code -Naming Conventions descending" -COM_COMPONENTBUILDER_FILTER_NAME_SINGLE_RECORD_NAMING_CONVENTIONS_ASCENDING="Name (single record) -Naming Conventions ascending" -COM_COMPONENTBUILDER_FILTER_NAME_SINGLE_RECORD_NAMING_CONVENTIONS_DESCENDING="Name (single record) -Naming Conventions descending" +COM_COMPONENTBUILDER_FILTER_NAME_IN_CODENAMING_CONVENTIONS_ASCENDING="Name in CodeNaming Conventions ascending" +COM_COMPONENTBUILDER_FILTER_NAME_IN_CODENAMING_CONVENTIONS_DESCENDING="Name in CodeNaming Conventions descending" +COM_COMPONENTBUILDER_FILTER_NAME_SINGLE_RECORDNAMING_CONVENTIONS_ASCENDING="Name (single record)Naming Conventions ascending" +COM_COMPONENTBUILDER_FILTER_NAME_SINGLE_RECORDNAMING_CONVENTIONS_DESCENDING="Name (single record)Naming Conventions descending" COM_COMPONENTBUILDER_FILTER_NULL_SWITCH_ASCENDING="Null Switch ascending" COM_COMPONENTBUILDER_FILTER_NULL_SWITCH_DESCENDING="Null Switch descending" COM_COMPONENTBUILDER_FILTER_PROTOCOL_ASCENDING="Protocol ascending" @@ -5296,6 +5088,7 @@ COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_MODULES="Status options for com COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_MYSQL_TWEAKS="Status options for components mysql tweaks" COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_PLACEHOLDERS="Status options for components placeholders" COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_PLUGINS="Status options for components plugins" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_ROUTERS="Status options for components routers" COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_SITE_VIEWS="Status options for components site views" COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_UPDATES="Status options for components updates" COM_COMPONENTBUILDER_FILTER_PUBLISHED_CUSTOM_ADMIN_VIEWS="Status options for custom admin views" @@ -5312,6 +5105,7 @@ COM_COMPONENTBUILDER_FILTER_PUBLISHED_JOOMLA_PLUGINS="Status options for joomla COM_COMPONENTBUILDER_FILTER_PUBLISHED_JOOMLA_PLUGINS_FILES_FOLDERS_URLS="Status options for joomla plugins files folders urls" COM_COMPONENTBUILDER_FILTER_PUBLISHED_JOOMLA_PLUGINS_UPDATES="Status options for joomla plugins updates" COM_COMPONENTBUILDER_FILTER_PUBLISHED_JOOMLA_PLUGIN_GROUPS="Status options for joomla plugin groups" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_JOOMLA_POWERS="Status options for joomla powers" COM_COMPONENTBUILDER_FILTER_PUBLISHED_LANGUAGES="Status options for languages" COM_COMPONENTBUILDER_FILTER_PUBLISHED_LANGUAGE_TRANSLATIONS="Status options for language translations" COM_COMPONENTBUILDER_FILTER_PUBLISHED_LAYOUTS="Status options for layouts" @@ -5345,6 +5139,7 @@ COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_MODULES="Search the component modu COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_MYSQL_TWEAKS="Search the component mysql tweaks items. Prefix with ID: to search for an item by ID." COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_PLACEHOLDERS="Search the component placeholders items. Prefix with ID: to search for an item by ID." COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_PLUGINS="Search the component plugins items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_ROUTERS="Search the component router items. Prefix with ID: to search for an item by ID." COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_SITE_VIEWS="Search the component site views items. Prefix with ID: to search for an item by ID." COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_UPDATES="Search the component updates items. Prefix with ID: to search for an item by ID." COM_COMPONENTBUILDER_FILTER_SEARCH_CUSTOM_ADMIN_VIEWS="Search the custom admin view items. Prefix with ID: to search for an item by ID." @@ -5361,6 +5156,7 @@ COM_COMPONENTBUILDER_FILTER_SEARCH_JOOMLA_PLUGINS="Search the joomla plugin item COM_COMPONENTBUILDER_FILTER_SEARCH_JOOMLA_PLUGINS_FILES_FOLDERS_URLS="Search the joomla plugin files folders urls items. Prefix with ID: to search for an item by ID." COM_COMPONENTBUILDER_FILTER_SEARCH_JOOMLA_PLUGINS_UPDATES="Search the joomla plugin updates items. Prefix with ID: to search for an item by ID." COM_COMPONENTBUILDER_FILTER_SEARCH_JOOMLA_PLUGIN_GROUPS="Search the joomla plugin group items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_JOOMLA_POWERS="Search the joomla power items. Prefix with ID: to search for an item by ID." COM_COMPONENTBUILDER_FILTER_SEARCH_LANGUAGES="Search the language items. Prefix with ID: to search for an item by ID." COM_COMPONENTBUILDER_FILTER_SEARCH_LANGUAGE_TRANSLATIONS="Search the language translation items. Prefix with ID: to search for an item by ID." COM_COMPONENTBUILDER_FILTER_SEARCH_LAYOUTS="Search the layout items. Prefix with ID: to search for an item by ID." @@ -5400,18 +5196,21 @@ COM_COMPONENTBUILDER_FILTER_SELECT_LIBRARY="Select Library" COM_COMPONENTBUILDER_FILTER_SELECT_LOCATION="Select Location" COM_COMPONENTBUILDER_FILTER_SELECT_MAIN_GET="Select Main Get" COM_COMPONENTBUILDER_FILTER_SELECT_MAIN_SOURCE="Select Main Source" -COM_COMPONENTBUILDER_FILTER_SELECT_MODELING_METHOD="Select Modeling Method" +COM_COMPONENTBUILDER_FILTER_SELECT_MODELLING_METHOD="Select Modelling Method" COM_COMPONENTBUILDER_FILTER_SELECT_NAME="Select Name" COM_COMPONENTBUILDER_FILTER_SELECT_NULL_SWITCH="Select Null Switch" COM_COMPONENTBUILDER_FILTER_SELECT_PROTOCOL="Select Protocol" +COM_COMPONENTBUILDER_FILTER_SELECT_ROUTER_MODECONSTRUCTOR_AFTER_PARENT="Select Router Mode[constructor_after_parent]" +COM_COMPONENTBUILDER_FILTER_SELECT_ROUTER_MODECONSTRUCTOR_BEFORE_PARENT="Select Router Mode[constructor_before_parent]" +COM_COMPONENTBUILDER_FILTER_SELECT_ROUTER_MODEMETHODS="Select Router Mode[methods]" COM_COMPONENTBUILDER_FILTER_SELECT_SITE_VIEWS="Select Site Views" +COM_COMPONENTBUILDER_FILTER_SELECT_SUPER_POWER="Select Super Power" COM_COMPONENTBUILDER_FILTER_SELECT_TARGET="Select Target" COM_COMPONENTBUILDER_FILTER_SELECT_TARGET_AREA="Select Target Area" COM_COMPONENTBUILDER_FILTER_SELECT_TARGET_FOLDER="Select Target Folder" COM_COMPONENTBUILDER_FILTER_SELECT_TYPE="Select Type" COM_COMPONENTBUILDER_FILTER_SELECT_TYPE_BEHAVIOR="Select Type Behavior" COM_COMPONENTBUILDER_FILTER_SELECT_TYPE_OF_POWER="Select Type of Power" -COM_COMPONENTBUILDER_FILTER_SELECT_VERSION="Select Version" COM_COMPONENTBUILDER_FILTER_SELECT_VISIBILITY="Select Visibility" COM_COMPONENTBUILDER_FILTER_SET_STRING_VALUE_ASCENDING="Set String Value ascending" COM_COMPONENTBUILDER_FILTER_SET_STRING_VALUE_DESCENDING="Set String Value descending" @@ -5448,6 +5247,9 @@ COM_COMPONENTBUILDER_FOLDER_BSB_WAS_MOVED_TO_BSB="Folder %s was moved to COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVED_TO_BSB="Folder %s was not moved to %s" COM_COMPONENTBUILDER_FORCE_LOCAL_UPDATE="Force Local Update" COM_COMPONENTBUILDER_FORCE_THAT_THIS_JCB_PACKAGE_IMPORT_SEARCH_FOR_LOCAL_ITEMS_TO_BE_DONE_WITH_GUID_VALUE_ONLY_IF_BMERGEB_IS_SET_TO_YES_ABOVE="Force that this JCB package import (search for local items) to be done with GUID value only, if Merge is set to yes above." +COM_COMPONENTBUILDER_FOUND="Found" +COM_COMPONENTBUILDER_FOUND_TEXT="Found Text" +COM_COMPONENTBUILDER_FOUR_SPACES="4 Spaces" COM_COMPONENTBUILDER_FREEOPEN="Free/Open" COM_COMPONENTBUILDER_FULL_WIDTH_IN_TAB="Full Width in Tab" COM_COMPONENTBUILDER_FUNCTION_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN="Function name already taken, please try again." @@ -5484,6 +5286,7 @@ COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_INSTALL_IT_LOCALLY="Get the COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_UPDATE_THE_LOCAL_VERSION="Get the snippet from gitHub and update the local version" COM_COMPONENTBUILDER_GET_TOKEN="Get Token" COM_COMPONENTBUILDER_GET_TOKEN_FROM_VDM_TO_GET_UPDATE_NOTICE_AND_ADD_IT_TO_YOUR_GLOBAL_OPTIONS="Get token from VDM to get update notice, and add it to your global options." +COM_COMPONENTBUILDER_GIVE_TO_JCB="Give to JCB" COM_COMPONENTBUILDER_GLOBAL="Global" COM_COMPONENTBUILDER_GLUECODE="Glue/Code" COM_COMPONENTBUILDER_GREAT_THIS_FUNCTION_NAME_WILL_WORK="Great, this function name will work!" @@ -5491,6 +5294,7 @@ COM_COMPONENTBUILDER_GREAT_THIS_PLACEHOLDER_WILL_WORK="Great, this placeholder w COM_COMPONENTBUILDER_GREAT_THIS_VALIDATION_RULE_NAME_S_WILL_WORK="Great, this validation rule name (%s) will work!" COM_COMPONENTBUILDER_GROUP="group" COM_COMPONENTBUILDER_HAS_METADATA="Has Metadata" +COM_COMPONENTBUILDER_HEADERS="Headers" COM_COMPONENTBUILDER_HELP_DOCUMENT="Help Document" COM_COMPONENTBUILDER_HELP_DOCUMENTS="Help Documents" COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS="Help Documents Access" @@ -5498,7 +5302,7 @@ COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS_DESC="Allows the users in this group COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_OPTIONS="Batch process the selected Help Documents" COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_TIP="All changes will be applied to all selected Help Documents" COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE="Help Documents Batch Use" -COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch help documents" +COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch help documents" COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE="Help Documents Create" COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents" COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List" @@ -5512,7 +5316,7 @@ COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_OWN_DESC="Allows the users in this grou COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_STATE="Help Documents Edit State" COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_STATE_DESC="Allows the users in this group to update the state of the help document" COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_VERSION="Help Documents Edit Version" -COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version help documents" +COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version help documents" COM_COMPONENTBUILDER_HELP_DOCUMENTS_EXPORT="Help Documents Export" COM_COMPONENTBUILDER_HELP_DOCUMENTS_EXPORT_DESC="Allows the users in this group to export export help documents" COM_COMPONENTBUILDER_HELP_DOCUMENTS_IMPORT="Help Documents Import" @@ -5553,6 +5357,7 @@ COM_COMPONENTBUILDER_HELP_DOCUMENT_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_HELP_DOCUMENT_DETAILS="Details" COM_COMPONENTBUILDER_HELP_DOCUMENT_EDIT="Editing the Help Document" COM_COMPONENTBUILDER_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS="Another Help Document has the same alias." +COM_COMPONENTBUILDER_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Help Document has the same alias ." COM_COMPONENTBUILDER_HELP_DOCUMENT_GROUPS_DESCRIPTION="Select a group/s" COM_COMPONENTBUILDER_HELP_DOCUMENT_GROUPS_LABEL="Group/s" COM_COMPONENTBUILDER_HELP_DOCUMENT_ID="Id" @@ -5590,16 +5395,38 @@ COM_COMPONENTBUILDER_HELP_DOCUMENT_URL_LABEL="URL" COM_COMPONENTBUILDER_HELP_DOCUMENT_URL_MESSAGE="Error! Please add url here." COM_COMPONENTBUILDER_HELP_DOCUMENT_VERSION_DESC="A count of the number of times this Help Document has been revised." COM_COMPONENTBUILDER_HELP_DOCUMENT_VERSION_LABEL="Version" +COM_COMPONENTBUILDER_HELP_JCB_GROW="Help JCB Grow" COM_COMPONENTBUILDER_HELP_MANAGER="Help" +COM_COMPONENTBUILDER_HERE_YOU_CAN_ENTER_THE_REPLACE_TEXT_THAT_YOU_WOULD_LIKE_TO_USE_AS_REPLACEMENT_FOR_THE_SEARCH_TEXT_FOUND="Here you can enter the replace text that you would like to use as replacement for the search text found." +COM_COMPONENTBUILDER_HERE_YOU_CAN_ENTER_YOUR_SEARCH_TEXT="Here you can enter your search text." +COM_COMPONENTBUILDER_HERE_YOU_CAN_SET_THE_PATH_TO_THE_SUPER_POWERS_LOCAL_REPOSITORY_FOLDER_WHERE_BLAYERCOREB_AND_ALL_TARGETED_BLAYEROWNB_SUB_PATHS_WILL_BE_PLACED_WITH_THEIR_SELECTIVE_BSWITCHAPPROVEDB_POWERS="Here you can set the path to the super powers local repository folder, where [layer:core] and all targeted [layer:own] sub paths will be placed with their selective [switch:approved] powers." COM_COMPONENTBUILDER_HFOUR_CLASSNAVHEADERCOPYRIGHTHFOURPSP="

    %s

    " COM_COMPONENTBUILDER_HFOUR_CLASSNAVHEADERLICENSEHFOURPSP="

    %s

    " COM_COMPONENTBUILDER_HI="Hi" COM_COMPONENTBUILDER_HIDE_ONLY="Hide Only" COM_COMPONENTBUILDER_HIDE_TOGGLE="Hide Toggle" COM_COMPONENTBUILDER_HOW_TO_GET_A_S_FREE_KEYSA_FROM_VDM="How to get free keys from VDM." +COM_COMPONENTBUILDER_HR_HTHREEASSETS_TABLE_NOTICEHTHREE="

    Assets Table Notice

    " +COM_COMPONENTBUILDER_HR_HTHREEASSETS_TABLE_WARNINGHTHREE="

    Assets Table Warning

    " +COM_COMPONENTBUILDER_HR_HTHREECONDITIONAL_SCRIPT_WARNINGHTHREE="

    Conditional Script Warning

    " +COM_COMPONENTBUILDER_HR_HTHREECUSTOM_CODES_WARNINGHTHREE="

    Custom Codes Warning

    " +COM_COMPONENTBUILDER_HR_HTHREECUSTOM_CODE_WARNINGHTHREE="

    Custom Code Warning

    " +COM_COMPONENTBUILDER_HR_HTHREECZEROMPZERONTHREENT_ISSUE_FOUNDHTHREEPTHE_PATH_S_COULD_NOT_BE_USEDP="

    c0mp0n3nt issue found

    The path (%s) could not be used.

    " +COM_COMPONENTBUILDER_HR_HTHREEDASHBOARD_ERRORHTHREE="

    Dashboard Error

    " +COM_COMPONENTBUILDER_HR_HTHREEDYNAMIC_FOLDERS_WERE_DETECTEDHTHREE="

    Dynamic folder(s) were detected.

    " COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_ERRORHTHREE="

    External Code Error

    " COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_NOTICEHTHREE="

    External Code Notice

    " COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_WARNINGHTHREE="

    External Code Warning

    " +COM_COMPONENTBUILDER_HR_HTHREEFIELD_NOTICEHTHREE="

    Field Notice

    " +COM_COMPONENTBUILDER_HR_HTHREEFIELD_WARNINGHTHREE="

    Field Warning

    " +COM_COMPONENTBUILDER_HR_HTHREEFILE_PATH_ERRORHTHREE="

    File Path Error

    " +COM_COMPONENTBUILDER_HR_HTHREEFOLDER_PATH_ERRORHTHREE="

    Folder Path Error

    " +COM_COMPONENTBUILDER_HR_HTHREELANGUAGE_NOTICEHTHREE="

    Language Notice

    " +COM_COMPONENTBUILDER_HR_HTHREELANGUAGE_WARNINGHTHREE="

    Language Warning

    " +COM_COMPONENTBUILDER_HR_HTHREEMULTI_FILTER_ERRORHTHREE="

    Multi Filter Error

    " +COM_COMPONENTBUILDER_HR_HTHREES_WARNINGHTHREE="

    %s Warning

    " +COM_COMPONENTBUILDER_HR_HTHREETIDY_ERRORHTHREE="

    Tidy Error

    " +COM_COMPONENTBUILDER_HR_HTHREEWHMCS_ERRORHTHREE="

    WHMCS Error

    " COM_COMPONENTBUILDER_HTHREEPLACEHOLDER_REMOVEDHTHREEPBTHISB_CUSTOM_CODE_CAN_ONLY_BE_USED_IN_BOTHERB_CUSTOM_CODE_NOT_IN_IT_SELF_SINCE_THAT_WILL_CAUSE_A_INFINITE_LOOP_IN_THE_COMPILERP="

    Placeholder Removed!

    This custom code can only be used in other custom code, not in it self! Since that will cause a infinite loop in the compiler.

    " COM_COMPONENTBUILDER_HTHREESHTHREEPCUSTOM_CODE_CAN_ONLY_BE_USED_IN_OTHER_CUSTOM_CODE_IF_SET_AS_BJCB_MANUALB_YOU_CAN_NOT_ADD_THEM_TO_EMHASH_AUTOMATIONEM_CODE_AT_THIS_POINTP="

    %s

    Custom code can only be used in other custom code if set as JCB (manual), you can not add them to Hash (Automation) code at this point.

    " COM_COMPONENTBUILDER_HTHREES_NAMESPACE_ERROR_SHTHREEPYOU_MUST_ATLEAST_HAVE_TWO_SECTIONS_IN_YOUR_NAMESPACE_YOU_JUST_HAVE_ONE_S_THIS_IS_AN_UNACCEPTABLE_ACTION_PLEASE_SEE_A_HREFS_PSRFOURA_FOR_MORE_INFOPPTHIS_S_WAS_THEREFORE_REMOVED_A_HREFSCLICK_HEREA_TO_FIX_THIS_ISSUEP="

    %s namespace error (%s)

    You must at-least have two sections in your namespace, you just have one (%s). This is an unacceptable action, please see psr-4 for more info.

    This %s was therefore removed, click here to fix this issue.

    " @@ -5607,11 +5434,12 @@ COM_COMPONENTBUILDER_HTHREES_NAMESPACE_ERROR_SHTHREEPYOU_MUST_ATLEAST_HAVE_TWO_S COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP="

    Curl Not Found!

    Please setup curl on your system, or componentbuilder will not function correctly!

    " COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BKEY_ERRORB_OR_BROKEN_PACKAGE="

    Data is corrupt!

    This could be due to key error, or broken package!" COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BROKEN_PACKAGE="

    Data is corrupt!

    This could be due to broken package!" -COM_COMPONENTBUILDER_HTWOWE_COULD_NOT_OPEN_THE_ENCRYPT_DATAHTWO_THIS_COULD_BE_DUE_TO_THE_FOFENCRYPTION_THAT_IS_NO_LONGER_SUPPORTED_IN_JOOMLABR_PLEASE_EXPORT_YOUR_PACKAGES_WITH_JCB_VTHREEZEROELEVENPRO_OR_VTWOONETWOSEVENTEENPUBLIC_OR_HIGHER_TO_BE_ABLE_TO_IMPORT_IT_INTO_THIS_VERSION_OF_JCB="

    We could not open the encrypt data!

    This could be due to the FOFEncryption that is no longer supported in Joomla.
    Please export your packages with JCB v3.0.11(pro) or v2.12.17(public) or higher to be able to import it into this version of JCB." +COM_COMPONENTBUILDER_HTWOWE_COULD_NOT_OPEN_THE_ENCRYPT_DATAHTWO_THIS_COULD_BE_DUE_TO_THE_FOFENCRYPTION_THAT_IS_NO_LONGER_SUPPORTED_IN_JOOMLABR_PLEASE_EXPORT_YOUR_PACKAGES_WITH_JCB_VTHREEONEONEEIGHT_OR_HIGHER_TO_BE_ABLE_TO_IMPORT_IT_INTO_THIS_VERSION_OF_JCB="

    We could not open the encrypt data!

    This could be due to the FOFEncryption that is no longer supported in Joomla.
    Please export your packages with JCB v3.1.18 or higher to be able to import it into this version of JCB." COM_COMPONENTBUILDER_HTWOWE_COULD_NOT_OPEN_THE_PACKAGEHTWOTHIS_COULD_BE_DUE_TO_THE_FOFENCRYPTION_THAT_IS_NO_LONGER_SUPPORTED_IN_JOOMLA_PLEASE_EXPORT_YOUR_PACKAGES_WITH_JCB_VTHREEZEROELEVENPRO_OR_VTWOONETWOSEVENTEENPUBLIC_OR_HIGHER_TO_BE_ABLE_TO_IMPORT_IT_INTO_THIS_VERSION_OF_JCB="

    We could not open the package!

    This could be due to the FOFEncryption that is no longer supported in Joomla. Please export your packages with JCB v3.0.11(pro) or v2.12.17(public) or higher to be able to import it into this version of JCB." COM_COMPONENTBUILDER_IAUTHORI_BSB="Author: %s" COM_COMPONENTBUILDER_ICOMPANYI_BSB="Company: %s" COM_COMPONENTBUILDER_ICON="Icon" +COM_COMPONENTBUILDER_ID="id" COM_COMPONENTBUILDER_ID_MISMATCH_WAS_DETECTED_WITH_THE_SSSS_GUI_CODE_FIELD_SO_THE_PLACEHOLDER_WAS_NOT_SET="ID mismatch was detected with the %s.%s.%s.%s GUI code field. So the placeholder was not set." COM_COMPONENTBUILDER_IEMAILI_BSB="Email: %s" COM_COMPONENTBUILDER_IMPORT_BY_GUID_ONLY="Import by GUID only!" @@ -5673,20 +5501,78 @@ COM_COMPONENTBUILDER_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE="Package to import not COM_COMPONENTBUILDER_IMPORT_UPDATE_DATA="Import Data" COM_COMPONENTBUILDER_IMPORT_UPLOAD_BOTTON="Upload File" COM_COMPONENTBUILDER_INACTIVE="Inactive" +COM_COMPONENTBUILDER_INDENTATION_OPTIONS="Indentation Options" +COM_COMPONENTBUILDER_INIT="Init" +COM_COMPONENTBUILDER_INITIALIZATION_FAILED="Initialization Failed!" +COM_COMPONENTBUILDER_INVEST_IN_JCB="Invest in JCB" +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="Invest in the future of Joomla Component Builder (JCB) by making a financial contribution, 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 open-source project, you are securing its future as a vital tool for PHP programmers." +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="Invest in the future of Joomla Component Builder (JCB) by making a financial donation. Support the necessary development and maintenance of this open-source project, ensuring its continued growth and relevance for the community. Your contribution will help secure the future of this vital tool for PHP programmers." COM_COMPONENTBUILDER_IN_SYNC="In Sync" COM_COMPONENTBUILDER_ISOLATE="Isolate" COM_COMPONENTBUILDER_IS_BEING_COMPILED="is being compiled" COM_COMPONENTBUILDER_IS_NOT_ONLY_FOUR_LISTRADIOCHECKBOXES="Is Not (only 4 list/radio/checkboxes)" COM_COMPONENTBUILDER_IS_ONLY_FOUR_LISTRADIOCHECKBOXES="Is (only 4 list/radio/checkboxes)" +COM_COMPONENTBUILDER_ITEM_CODE="Item Code" COM_COMPONENTBUILDER_IWEBSITEI_BSB="Website: %s" +COM_COMPONENTBUILDER_JCB_BE_THE_CHANGE="JCB: Be the Change" +COM_COMPONENTBUILDER_JCB_BUILDS_A_BETTER_FUTURE="JCB Builds a Better Future" COM_COMPONENTBUILDER_JCB_COMMUNITY="JCB Community" COM_COMPONENTBUILDER_JCB_COMMUNITY_PACKAGES="JCB Community Packages" COM_COMPONENTBUILDER_JCB_COMMUNITY_SNIPPETS="JCB Community Snippets" +COM_COMPONENTBUILDER_JCB_CONTRIBUTES_TO_OPENSOURCE="JCB Contributes to Open-Source" +COM_COMPONENTBUILDER_JCB_EMPOWERS_PHP_DEVELOPERS="JCB Empowers PHP Developers" +COM_COMPONENTBUILDER_JCB_ENABLES_PHP_DEVELOPMENT="JCB Enables PHP Development" +COM_COMPONENTBUILDER_JCB_ENHANCES_PRODUCTIVITY="JCB Enhances Productivity" +COM_COMPONENTBUILDER_JCB_FOSTERS_A_STRONG_COMMUNITY="JCB Fosters a Strong Community" +COM_COMPONENTBUILDER_JCB_HELPS_GROW_BUSINESSES="JCB Helps Grow Businesses" +COM_COMPONENTBUILDER_JCB_HELPS_PHP_THRIVE="JCB Helps PHP Thrive" +COM_COMPONENTBUILDER_JCB_IMPROVES_PHPS_REPUTATION="JCB Improves PHP's Reputation" +COM_COMPONENTBUILDER_JCB_IMPROVES_PHP_DEVELOPMENT="JCB Improves PHP Development" +COM_COMPONENTBUILDER_JCB_IMPROVES_USER_EXPERIENCE="JCB Improves User Experience" +COM_COMPONENTBUILDER_JCB_IMPROVES_WORKFLOW="JCB Improves Workflow" +COM_COMPONENTBUILDER_JCB_INCREASES_DEVELOPMENT_SPEED="JCB Increases Development Speed" +COM_COMPONENTBUILDER_JCB_INCREASES_REVENUE="JCB Increases Revenue" +COM_COMPONENTBUILDER_JCB_INCREASES_USER_SATISFACTION="JCB Increases User Satisfaction" +COM_COMPONENTBUILDER_JCB_INVESTS_IN_PHPS_SUCCESS="JCB Invests in PHP's Success" +COM_COMPONENTBUILDER_JCB_INVEST_IN_CHANGE="JCB: Invest in Change" +COM_COMPONENTBUILDER_JCB_INVEST_IN_IMPACT="JCB: Invest in Impact" +COM_COMPONENTBUILDER_JCB_INVEST_IN_PROGRESS="JCB: Invest in Progress" +COM_COMPONENTBUILDER_JCB_INVEST_IN_PROGRESS_TODAY="JCB: Invest in Progress Today" +COM_COMPONENTBUILDER_JCB_INVEST_IN_SUCCESS="JCB: Invest in Success" +COM_COMPONENTBUILDER_JCB_INVEST_IN_THE_COMMUNITY="JCB: Invest in the Community" +COM_COMPONENTBUILDER_JCB_INVEST_IN_THE_FUTURE="JCB: Invest in the Future" +COM_COMPONENTBUILDER_JCB_INVEST_IN_YOUR_FUTURE="JCB: Invest in Your Future" +COM_COMPONENTBUILDER_JCB_LOWERS_DEVELOPMENT_STRESS="JCB Lowers Development Stress" +COM_COMPONENTBUILDER_JCB_NEEDS_YOU="JCB Needs You" +COM_COMPONENTBUILDER_JCB_OFFERS_A_STRONGER_SOLUTION="JCB Offers a Stronger Solution" +COM_COMPONENTBUILDER_JCB_OFFERS_MORE_FEATURES="JCB Offers More Features" COM_COMPONENTBUILDER_JCB_PACKAGE_IMPORT="JCB Package Import" COM_COMPONENTBUILDER_JCB_PACKAGE_INFO_PATH_DOES_NOT_WORK_WE_ADVICE_YOU_BNOT_TO_CONTINUEB_WITH_THE_IMPORT_OF_THE_SELECTED_PACKAGE="JCB Package info path does not work, we advice you not to continue with the import of the selected package!" +COM_COMPONENTBUILDER_JCB_PROMOTES_EFFICIENCY="JCB Promotes Efficiency" +COM_COMPONENTBUILDER_JCB_PROMOTES_GOODWILL="JCB Promotes Goodwill" +COM_COMPONENTBUILDER_JCB_PROVIDES_A_BETTER_EXPERIENCE="JCB Provides a Better Experience" COM_COMPONENTBUILDER_JCB_PRO_BOARD="JCB Pro board" COM_COMPONENTBUILDER_JCB_PRO_NOTICE_BOARD="JCB Pro Notice Board" +COM_COMPONENTBUILDER_JCB_REDUCES_DEVELOPMENT_COSTS="JCB Reduces Development Costs" +COM_COMPONENTBUILDER_JCB_SAVES_TIME="JCB Saves Time" +COM_COMPONENTBUILDER_JCB_STREAMLINES_DEVELOPMENT="JCB Streamlines Development" +COM_COMPONENTBUILDER_JCB_SUPPORTS_A_THRIVING_ECOSYSTEM="JCB Supports a Thriving Ecosystem" +COM_COMPONENTBUILDER_JCB_SUPPORTS_A_WORTHY_CAUSE="JCB Supports a Worthy Cause" +COM_COMPONENTBUILDER_JCB_SUPPORTS_OPENSOURCE="JCB Supports Open-Source" +COM_COMPONENTBUILDER_JCB_SUPPORTS_PHP_INNOVATION="JCB Supports PHP Innovation" +COM_COMPONENTBUILDER_JCB_SUPPORTS_THE_PHP_COMMUNITY="JCB Supports the PHP Community" +COM_COMPONENTBUILDER_JCB_YOUR_CONTRIBUTION_MATTERS="JCB: Your Contribution Matters" +COM_COMPONENTBUILDER_JCB_YOUR_DONATION_MATTERS="JCB: Your Donation Matters" +COM_COMPONENTBUILDER_JCB_YOUR_SUPPORT_COUNTS="JCB: Your Support Counts" +COM_COMPONENTBUILDER_JCB_YOUR_SUPPORT_IS_KEY="JCB: Your Support is Key" +COM_COMPONENTBUILDER_JCB_YOUR_SUPPORT_MATTERS="JCB: Your Support Matters" +COM_COMPONENTBUILDER_JCB_YOUR_SUPPORT_MATTERS_MOST="JCB: Your Support Matters Most" COM_COMPONENTBUILDER_JOIN_FIELDS="Join Fields" +COM_COMPONENTBUILDER_JOIN_JCBS_COMMUNITY="Join JCB's Community" +COM_COMPONENTBUILDER_JOIN_JCBS_JOURNEY="Join JCB's Journey" +COM_COMPONENTBUILDER_JOIN_JCBS_MISSION="Join JCB's Mission" +COM_COMPONENTBUILDER_JOIN_JCBS_SUCCESS="Join JCB's Success" +COM_COMPONENTBUILDER_JOIN_JCBS_VISION="Join JCB's Vision" COM_COMPONENTBUILDER_JOIN_TYPE="Join Type" COM_COMPONENTBUILDER_JOOMLA_COMPONENT="Joomla Component" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS="Joomla Components" @@ -5695,7 +5581,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_ACCESS_DESC="Allows the users in this gro COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_OPTIONS="Batch process the selected Joomla Components" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_TIP="All changes will be applied to all selected Joomla Components" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE="Joomla Components Batch Use" -COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla components" +COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla components" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CODE_NAME="Code Name" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_COMPANY_DETAILS="Company Details" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CREATE="Joomla Components Create" @@ -5716,7 +5602,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_OWN_DESC="Allows the users in this g COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE="Joomla Components Edit State" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla component" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION="Joomla Components Edit Version" -COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla components" +COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla components" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_N_ITEMS_ARCHIVED="%s Joomla Components archived." COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_N_ITEMS_ARCHIVED_1="%s Joomla Component archived." COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_N_ITEMS_CHECKED_IN_0="No Joomla Component successfully checked in." @@ -5745,6 +5631,8 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDREADME_LABEL="Add README" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDUIKIT_DESCRIPTION="Select the version of Uikit you would like to use." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDUIKIT_LABEL="Add Uikit" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_ADMIN_EVENT_LABEL="Add Global Admin Event" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_BACKUP_FOLDER_PATH_DESCRIPTION="Would you like to override the global backup folder path for this component?" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_BACKUP_FOLDER_PATH_LABEL="Backup Folder Path" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_BOTH_V2_AMP_V3="Add Both v2 & v3" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_CSS_ADMIN_LABEL="Add CSS (admin)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_CSS_SITE_LABEL="Add CSS (site)" @@ -5752,19 +5640,26 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER_DESCRIPTION="Adding the e COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER_LABEL="Add Email Helper" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_FOOTABLE_V2="Add FooTable V2" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_FOOTABLE_V3="Add FooTable V3" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_GIT_FOLDER_PATH_DESCRIPTION="Would you like to override the global git folder path for this component?" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_GIT_FOLDER_PATH_LABEL="Git Folder Path" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_JAVASCRIPT_LABEL="Add Javascript" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_JCB_POWERS_PATH_DESCRIPTION="Would you like to override the global jcb powers path for this component?" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_JCB_POWERS_PATH_LABEL="JCB Powers Path" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_LICENSE_DESCRIPTION="Add the option to use the whmcs license add-on in the component." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_LICENSE_LABEL="Add WHMCS
    (license add-on)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_MENU_PREFIX_DESCRIPTION="Would you like to add a prefix to the Joomla menu name of this component" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_MENU_PREFIX_LABEL="Add Menu Prefix" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_NAMESPACE_PREFIX_DESCRIPTION="Override the namespace prefix, or use the global value found under the component builder global option under the compiler tab." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_NAMESPACE_PREFIX_LABEL="Add Namespace Prefix" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_HELPER_ADMIN_LABEL="Add PHP (helper_admin Class)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_HELPER_BOTH_LABEL="Add PHP (helper Classes - Both admin & site)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_HELPER_SITE_LABEL="Add PHP (helper_site Class)" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_METHOD_UNINSTALL_LABEL="Add PHP Method (uninstall)" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_POSTFLIGHT_INSTALL_LABEL="Add PHP Postflight (install)" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_POSTFLIGHT_UPDATE_LABEL="Add PHP Postflight (update)" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_PREFLIGHT_INSTALL_LABEL="Add PHP Preflight (install)" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_PREFLIGHT_UPDATE_LABEL="Add PHP Preflight (update)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_METHOD_INSTALL_LABEL="Add PHP Methods to Class (in install/update class)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_METHOD_UNINSTALL_LABEL="Add PHP to the uninstall method" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_POSTFLIGHT_INSTALL_LABEL="Add PHP in the postflight install (event)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_POSTFLIGHT_UPDATE_LABEL="Add PHP in the postflight update (event)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_PREFLIGHT_INSTALL_LABEL="Add PHP in the preflight install (event)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_PREFLIGHT_UPDATE_LABEL="Add PHP in the preflight update (event)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PLACEHOLDERS_DESCRIPTION="Should JCB insert the custom code placeholders? This is only applicable if this component has custom code." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PLACEHOLDERS_LABEL="Custom Code Placeholders" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_POWERS_DESCRIPTION="Should JCB add any powers that are connected to this component? This may be helpful if you are loading powers via another component, and would like to avoid adding it to both, just remember that in this case you need to load the powers via a plugin." @@ -5777,9 +5672,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UIKIT_V2="Add Uikit v2" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UIKIT_V3="Add Uikit v3" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UPDATE_SERVER_LABEL="Add Update Server" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADMIN_VIEWS="Admin Views" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ASSETS_TABLE_FIX_DESCRIPTION="How to apply the assets table fix in JCB.
    -SQL (add&remove) this is the default which adds the SQL fix and removes it once the component is uninstalled.
    -Intelligent (add&remove+if) same as default, but on uninstall will only remove this fix if no other component needs it. Note that this option will only work with other components that also use the intelligent path." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ASSETS_TABLE_FIX_DESCRIPTION="How to apply the assets table fix in JCB.
    SQL (add&remove) this is the default which adds the SQL fix and removes it once the component is uninstalled.
    Intelligent (add&remove+if) same as default, but on uninstall will only remove this fix if no other component needs it. Note that this option will only work with other components that also use the intelligent path." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ASSETS_TABLE_FIX_LABEL="Assets Table Fix" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_DESCRIPTION="The Author's Name & Surname." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_HINT="Author Name & Surname Here" @@ -5788,6 +5681,10 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_MESSAGE="Error! Please add author n COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACK="Back" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_BUTTON_ACCESS="Joomla Component Backup Button Access" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_BUTTON_ACCESS_DESC="Allows the users in this group to access the backup button." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_FOLDER_PATH_DESCRIPTION="Here you can set the path to the backup folder." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_FOLDER_PATH_HINT="/home/user/backup" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_FOLDER_PATH_LABEL="Backup Folder Path" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_FOLDER_PATH_MESSAGE="Error! Please add folder path here." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BOM_DESCRIPTION="Select the file that should be used for licensing all files (files found in: administrator/components/com_componentbuilder/compiler)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BOM_LABEL="Licensing Template" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BOTH="Both" @@ -5797,6 +5694,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDCOMPSQL_LABEL="MySQL" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDCOMP_DESCRIPTION="To build the component fields and back-end views dynamically using a mySQL table file." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDCOMP_LABEL="Build Backend-views Dynamically" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY="Joomla Component Builder - Backup Key" +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="Joomla Component Builder (JCB) is a crucial tool for PHP programmers who use Joomla to earn a living. By making a financial donation, 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 project's team and the wider community." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CLEAR_TMP_BUTTON_ACCESS="Joomla Component Clear tmp Button Access" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CLEAR_TMP_BUTTON_ACCESS_DESC="Allows the users in this group to access the clear tmp button." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CLONE_BUTTON_ACCESS="Joomla Component Clone Button Access" @@ -5852,7 +5750,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_LABEL="Description" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DETAILS="Details" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DO_NOT_ADD_FIX_EVER="Do not add fix ever" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DYNAMIC="Dynamic" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DYNAMIC_BUILD_BETA="Dynamic Build (beta)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DYNAMIC_BUILD="Dynamic Build" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DYNAMIC_INTEGRATION="Dynamic Integration" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EDIT="Editing the Joomla Component" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EMAIL="Email" @@ -5863,6 +5761,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EMAIL_MESSAGE="Error! Please author email COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EMPTYCONTRIBUTORS_DESCRIPTION="Set if a list of empty contributor fields should be added." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EMPTYCONTRIBUTORS_LABEL="Empty Contributor Fields" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ERROR_UNIQUE_ALIAS="Another Joomla Component has the same alias." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Joomla Component has the same alias ." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_BUY_LINK_DESCRIPTION="Enter link where your JCB package key can be bought." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_BUY_LINK_HINT="http://www.example.com/buy-keys" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_BUY_LINK_LABEL="Buy Link
    (to get key)" @@ -5874,6 +5773,11 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_KEY_HINT="Export Key Here" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_KEY_LABEL="Export Key
    (encrypted field)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_KEY_MESSAGE="Error! Please add export key here." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_FRONT="Front" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_GIT_FOLDER_PATH_DESCRIPTION="Here you can set the path to the git folder." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_GIT_FOLDER_PATH_HINT="/home/user/git" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_GIT_FOLDER_PATH_LABEL="Git Folder Path" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_GIT_FOLDER_PATH_MESSAGE="Error! Please add folder path here." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_GLOBAL="Global" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_GUID_DESCRIPTION="Globally Unique Identifier" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_GUID_HINT="Auto Generated" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_GUID_LABEL="GUID" @@ -5887,6 +5791,10 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_DESCRIPTION="Add JavaScript for COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_LABEL="Javascript" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JCB_EXPORT_PACKAGE_NOTE_DESCRIPTION="The settings below are used when you export this component as a JCB Package, for more info on how this works please review the following tutorial (https://youtu.be/lkE0ZiSWufg)." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JCB_EXPORT_PACKAGE_NOTE_LABEL="JCB Package Export Settings" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JCB_POWERS_PATH_DESCRIPTION="Here you can set the path to the powers folder. Recommended that you always place it inside the libraries. You don't need to add a full path here, so libraries/jcb_powers will mean /home/username/public_html/libraries/jcb_powers when installed. You should always use two folders here, libraries + one more for example:
    libraries/jcb_powers" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JCB_POWERS_PATH_HINT="libraries/jcb_powers" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JCB_POWERS_PATH_LABEL="JCB Powers Path
    example: libraries/jcb_powers" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JCB_POWERS_PATH_MESSAGE="Error! Please add folder path here." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JOOMLA_SOURCE_LINK_DESCRIPTION="Enter link where this Joomla component's source code can be found on gitHub. Where those who want to use this package, can review and contribute to the code." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JOOMLA_SOURCE_LINK_HINT="https://github.com/vdm-io/Joomla-Component-Builder" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JOOMLA_SOURCE_LINK_LABEL="Joomla Source Link
    (where the Joomla source code is found)" @@ -5900,10 +5808,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_LICENSE_TYPE_LABEL="Implementation" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_LOCK_DOWN_USE_USED_TO_VERIFY_OWNERSHIP="Lock Down Use (used to verify ownership)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MENU_PREFIX_DESCRIPTION="Add the prefix you would like to use. Make sure that it is HTML Character Entities since it is being used in XML." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MENU_PREFIX_HINT="»" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MENU_PREFIX_LABEL="Prefix
    -Check out these lists:
    -Char-ref or -Emoji
    " +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MENU_PREFIX_LABEL="Prefix
    Check out these lists:
    Char-ref or Emoji
    " COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MENU_PREFIX_MESSAGE="Error! Please add some text here." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MODIFIED_BY_DESC="The last user that modified this Joomla Component." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MODIFIED_BY_LABEL="Modified By" @@ -5914,10 +5819,13 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MODIFIED_LABEL="Modified Date" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MVC_VERSIONDATE_DESCRIPTION="Here you can tweak the way JCB implements versions in the code commenting of your component." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MVC_VERSIONDATE_LABEL="Version Options" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MYSQL="MySQL" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAMESPACE_PREFIX_DESCRIPTION="Add the namespace prefix. Like your company name in a code formate. So it will have no spaces and starting with an uppercase letter, and only be alphabetical characters.
    Example: VastDevelopmentMethod
    This will be used as a prefix to namespacing when targeting Joomla 4 and above." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAMESPACE_PREFIX_HINT="VastDevelopmentMethod" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAMESPACE_PREFIX_LABEL="Namespace Prefix" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAMESPACE_PREFIX_MESSAGE="Error! Please add namespace prefix here." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_CODE_DESCRIPTION="Add Name in Code Here" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_CODE_HINT="codename" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_CODE_LABEL="Name in Code
    -Naming Conventions" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_CODE_LABEL="Name in Code
    Naming Conventions" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_CODE_MESSAGE="Error! Please add name in code here." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_DESCRIPTION="Enter Name Here" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_HINT="Name Here" @@ -5930,34 +5838,23 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_ADD_CONFIG_DESCRIPTION="You can add c COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_ADD_CONFIG_LABEL="Adding Custom Config Fields" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_ADD_CUSTOM_MENUS_DESCRIPTION="You can add custom menus to the component here. The normal Menus are already being added so only add custom Menus that you would like to use for custom scripts." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_ADD_CUSTOM_MENUS_LABEL="Adding Custom Menus" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BACKUP_FOLDER_PATH_DESCRIPTION="You component, and all other linked extensions will be placed as zip files inside this folder." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BACKUP_FOLDER_PATH_LABEL="Adding a backup folder export option" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BOTTON_COMPONENT_DASHBOARD_DESCRIPTION="

    The default dashboard has all the icons of the views you have selected as Dashboard (add record) or Dashboard (list of records), to expand it you can add more tabs.

    " COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BOTTON_COMPONENT_DASHBOARD_LABEL="Default Dashboard Option" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BUILDCOMP_DYNAMIC_MYSQL_DESCRIPTION="You can dynamically build the components back-end views and fields by adding a mySql table dump, that has all the tables, or some more tables with its columns and data types. A very basic and generic set of fields and tables will be created, and added to the existing fields and tables of this component." -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BUILDCOMP_DYNAMIC_MYSQL_LABEL="Dynamic Builder (mySql) Option" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BUILDCOMP_DYNAMIC_MYSQL_DESCRIPTION="

    You can dynamically build the components back-end views and fields by adding a MySQL table dump that includes all or additional tables with their respective columns and data types. A basic and generic set of fields and tables will be created and integrated with the existing fields and tables of this component.

    It is critical that the SQL provided be valid; otherwise, the process will fail. Additionally, you have the option to specify the field type and other properties directly in the MySQL column COMMENT. This is done using JSON formatting in the comments section of each column/field.

    For example, to define a field as a list with predefined options, use the following comment format:
    COMMENT '{"type":"List", "label":"Name"}'

    This JSON format allows you to specify various field properties, such as "type", "label", and "option", which will be used to generate corresponding fields in the JCB Field configuration area.

    " +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BUILDCOMP_DYNAMIC_MYSQL_LABEL="Dynamic Builder (MySql) Option" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_COMPONENT_FILES_FOLDERS_DESCRIPTION="You can add custom files and folders to the component, simply add the files to the administrator/components/com_componentbuilder/custom folder and then select them here." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_COMPONENT_FILES_FOLDERS_LABEL="Adding Custom Files & Folder" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_CROWDIN_DESCRIPTION="
    -

    Feature not ready?

    -

    We are still working on this integration, so it is not fully ready.

    -
    -
    -
    -

    How to use Crowdin with JCB?

    -

    You will need an account with Crowdin https://crowdin.com/, then setup a project following these steps https://support.crowdin.com/creating-project/
    -Once your project is created get the project API key following these steps https://support.crowdin.com/api/api-integration-setup/
    -Then add the Project API key and identifier details below, and your done! Next time you compile this component JCB will automatically sync your project with Crowdin.

    -
    -
    -
    -
    -
    -
    " +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_CROWDIN_DESCRIPTION="

    Feature not ready?

    We are still working on this integration, so it is not fully ready.

    How to use Crowdin with JCB?

    You will need an account with Crowdin https://crowdin.com/, then setup a project following these steps https://support.crowdin.com/creating-project/
    Once your project is created get the project API key following these steps https://support.crowdin.com/api/api-integration-setup/
    Then add the Project API key and identifier details below, and your done! Next time you compile this component JCB will automatically sync your project with Crowdin.

    " COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_CROWDIN_LABEL="Crowdin" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_DISPLAY_COMPONENT_ADMIN_VIEWS_DESCRIPTION="

    Linked Admin Views

    Display of the admin views will load here!
    " COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_DISPLAY_COMPONENT_CUSTOM_ADMIN_VIEWS_DESCRIPTION="

    Linked Custom Admin Views

    Display of the custom admin views will load here!
    " COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_DISPLAY_COMPONENT_SITE_VIEWS_DESCRIPTION="

    Linked Site Views

    Display of the site views will load here!
    " COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_DYNAMIC_DASHBOARD_DESCRIPTION="The dynamic dashboard is basically the option of taking an Admin View or Custom Admin View that is already linked to this component, and making it the dashboard." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_DYNAMIC_DASHBOARD_LABEL="Dynamic Dashboard Option" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_GIT_FOLDER_PATH_DESCRIPTION="You must set the folder where the component and all linked extensions should be deployed for git. You will have to still do your git commit and other git commands yourself. Each extension will create their own folder inside this git folder." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_GIT_FOLDER_PATH_LABEL="Adding a git path to your component" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_MOVED_VIEWS_DESCRIPTION="We have moved the views in to their own tabs for your convenience." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_MOVED_VIEWS_LABEL="To add views, please open the corresponding tab." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_MYSQL_TWEAK_OPTIONS_DESCRIPTION="In each admin view you can add data from a MySQL Table (this is done in the admin view MySQL tab). Here you can limit that data in relation to this component. This feature is useful when an admin view with demo data is used in more then one component, and you would like to exclude some demo data without creating a new admin view." @@ -5970,61 +5867,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_ON_CUSTOM_ADMIN_VIEWS_DESCRIPTION="Do COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_ON_CUSTOM_ADMIN_VIEWS_LABEL="Setting Custom Admin Views" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_ON_SITE_VIEWS_DESCRIPTION="Do not add the same view twice it will not work. Please watch this tutorial for more help." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_ON_SITE_VIEWS_LABEL="Setting Site Views" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_README_DESCRIPTION="

    Need help, visit Markdown-Cheatsheet

    - -# ###Component_name### (###VERSION###)
    -
    -###DESCRIPTION###
    -
    -# Build Details
    -
    -+ *Company*: [###COMPANYNAME###](###AUTHORWEBSITE###)
    -+ *Author*: [###AUTHOR###](mailto:###AUTHOREMAIL###)
    -+ *Name*: [###Component_name###](###AUTHORWEBSITE###)
    -+ *First Build*: ###CREATIONDATE###
    -+ *Last Build*: ###BUILDDATE###
    -+ *Version*: ###VERSION###
    -+ *Copyright*: ###COPYRIGHT###
    -+ *License*: ###LICENSE###
    -
    -## Build Time
    -
    -**###totalHours### Hours** or **###totalDays### Eight Hour Days** (actual time the author saved -
    -due to [Automated Component Builder](http://joomlacomponentbuilder.com))
    -
    -> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
    -> never making one mistake or taking any coffee break.)
    -
    -+ *Line count*: **###LINE_COUNT###**
    -+ *File count*: **###FILE_COUNT###**
    -+ *Folder count*: **###FOLDER_COUNT###**
    -
    -**###actualHoursSpent### Hours** or **###actualDaysSpent### Eight Hour Days** (the actual time the author spent)
    -
    -> (with the following break down:
    -> **debugging @###debuggingHours###hours** = codingtime / 4;
    -> **planning @###planningHours###hours** = codingtime / 7;
    -> **mapping @###mappingHours###hours** = codingtime / 10;
    -> **office @###officeHours###hours** = codingtime / 6;)
    -
    -**###actualTotalHours### Hours** or **###actualTotalDays### Eight Hour Days**
    -(a total of the realistic time frame for this project)
    -
    -> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
    -> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
    -
    -Project duration: **###projectWeekTime### weeks** or **###projectMonthTime### months**
    -
    -> This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com).
    -> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
    -
    -## Donations
    -
    - If you want to support this project, please consider donating:
    - * PayPal: [paypal.me/donationgeek](https://www.paypal.me/donationgeek)
    - * Bitcoin: 18vURxYpPFjvNk8BnUy1ovCAyQmY3MzkSf
    - * Ethereum: 0x9548144662b47327c954f3e214edb96662d51218 -
    " +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_README_DESCRIPTION="

    Need help, visit Markdown-Cheatsheet

    # ###Component_name### (###VERSION###)

    ###DESCRIPTION###

    # Build Details

    + *Company*: [###COMPANYNAME###](###AUTHORWEBSITE###)
    + *Author*: [###AUTHOR###](mailto:###AUTHOREMAIL###)
    + *Name*: [###Component_name###](###AUTHORWEBSITE###)
    + *First Build*: ###CREATIONDATE###
    + *Last Build*: ###BUILDDATE###
    + *Version*: ###VERSION###
    + *Copyright*: ###COPYRIGHT###
    + *License*: ###LICENSE###

    ## Build Time

    **###totalHours### Hours** or **###totalDays### Eight Hour Days** (actual time the author saved -
    due to [Automated Component Builder](https://www.joomlacomponentbuilder.com))

    > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
    > never making one mistake or taking any coffee break.)

    + *Line count*: **###LINE_COUNT###**
    + *File count*: **###FILE_COUNT###**
    + *Folder count*: **###FOLDER_COUNT###**

    **###actualHoursSpent### Hours** or **###actualDaysSpent### Eight Hour Days** (the actual time the author spent)

    > (with the following break down:
    > **debugging @###debuggingHours###hours** = codingtime / 4;
    > **planning @###planningHours###hours** = codingtime / 7;
    > **mapping @###mappingHours###hours** = codingtime / 10;
    > **office @###officeHours###hours** = codingtime / 6;)

    **###actualTotalHours### Hours** or **###actualTotalDays### Eight Hour Days**
    (a total of the realistic time frame for this project)

    > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
    > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)

    Project duration: **###projectWeekTime### weeks** or **###projectMonthTime### months**

    > This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com).
    > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

    ## Donations

    If you want to support this project, please consider donating:
    * Open Collective: [Joomla-Component-Builder](https://opencollective.com/Joomla-Component-Builder)
    " COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_README_LABEL="Demo README (with all place-holders)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_FTP_DESCRIPTION="During compilation the file will be moved to the server. You still need to point the above update server url to the xml file location on your server for it to work correctly." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_FTP_LABEL="Select the server used for your update server." @@ -6041,6 +5884,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOT_REQUIRED="Not Required" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NUMBER_LABEL="Number" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ORDERING_LABEL="Ordering" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_OTHER="Other" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_OVERRIDE="Override" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PERMISSION="Permissions" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_ADMIN_EVENT_DESCRIPTION="PHP script for the global helper admin event method." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_ADMIN_EVENT_LABEL="Global Helper Admin Event (method)" @@ -6050,18 +5894,21 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_BOTH_DESCRIPTION="Add The PHP a COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_BOTH_LABEL="PHP (for both admin & site)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_SITE_DESCRIPTION="Add the PHP abstract Methods to add to the component helper class. Only Methods! as it will directly be add as methods to the helper class! Do not add the php tags." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_SITE_LABEL="PHP (site helper)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_METHOD_INSTALL_DESCRIPTION="PHP methods that should be added to the install/update class of the component." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_METHOD_INSTALL_LABEL="PHP Class Methods (in install/update class)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_METHOD_UNINSTALL_DESCRIPTION="PHP script that should run during uninstall." -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_METHOD_UNINSTALL_LABEL="PHP Method (uninstall)" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_INSTALL_DESCRIPTION="PHP script that should run postflight during install." -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_INSTALL_LABEL="PHP Postflight (install)" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_UPDATE_DESCRIPTION="PHP script that should run postflight during update." -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_UPDATE_LABEL="PHP Postflight (update)" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_INSTALL_DESCRIPTION="PHP script that should run preflight during install." -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_INSTALL_LABEL="PHP Preflight (install)" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_UPDATE_DESCRIPTION="PHP script that should run preflight during update." -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_UPDATE_LABEL="PHP Preflight (update)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_METHOD_UNINSTALL_LABEL="PHP in the uninstall method" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_INSTALL_DESCRIPTION="PHP code that should run postflight during install." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_INSTALL_LABEL="PHP in the postflight install (event)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_UPDATE_DESCRIPTION="PHP code that should run postflight during update." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_UPDATE_LABEL="PHP in the postflight update (event)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_INSTALL_DESCRIPTION="PHP code that should run preflight during install." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_INSTALL_LABEL="PHP in the preflight install (event)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_UPDATE_DESCRIPTION="PHP code that should run preflight during update." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_UPDATE_LABEL="PHP in the preflight update (event)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_SITE_EVENT_DESCRIPTION="PHP script for the global helper site event method." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_SITE_EVENT_LABEL="Global Helper Site Event (method)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PREFERRED_JOOMLA_VERSION_LABEL="Preferred Joomla Version" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PUBLISHING="Publishing" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_README="Readme" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_README_LABEL="README.md" @@ -6142,6 +5989,8 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_URL_MESSAGE="Error! Please add websi COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES="Yes" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ZIP="ZIP" COM_COMPONENTBUILDER_JOOMLA_FIELDS="Joomla fields" +COM_COMPONENTBUILDER_JOOMLA_FIVE="Joomla 5" +COM_COMPONENTBUILDER_JOOMLA_FOUR="Joomla 4" COM_COMPONENTBUILDER_JOOMLA_MODULE="Joomla Module" COM_COMPONENTBUILDER_JOOMLA_MODULES="Joomla Modules" COM_COMPONENTBUILDER_JOOMLA_MODULES_ACCESS="Joomla Modules Access" @@ -6149,7 +5998,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_ACCESS_DESC="Allows the users in this group COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_OPTIONS="Batch process the selected Joomla Modules" COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_TIP="All changes will be applied to all selected Joomla Modules" COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_USE="Joomla Modules Batch Use" -COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla modules" +COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla modules" COM_COMPONENTBUILDER_JOOMLA_MODULES_CREATE="Joomla Modules Create" COM_COMPONENTBUILDER_JOOMLA_MODULES_CREATE_DESC="Allows the users in this group to create create joomla modules" COM_COMPONENTBUILDER_JOOMLA_MODULES_DASHBOARD_LIST="Joomla Modules Dashboard List" @@ -6167,7 +6016,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_EDIT_OWN_DESC="Allows the users in this grou COM_COMPONENTBUILDER_JOOMLA_MODULES_EDIT_STATE="Joomla Modules Edit State" COM_COMPONENTBUILDER_JOOMLA_MODULES_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla module" COM_COMPONENTBUILDER_JOOMLA_MODULES_EDIT_VERSION="Joomla Modules Edit Version" -COM_COMPONENTBUILDER_JOOMLA_MODULES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla modules" +COM_COMPONENTBUILDER_JOOMLA_MODULES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla modules" COM_COMPONENTBUILDER_JOOMLA_MODULES_EXPORT="Joomla Modules Export" COM_COMPONENTBUILDER_JOOMLA_MODULES_EXPORT_DESC="Allows the users in this group to export export joomla modules" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS="Joomla Modules Files, Folders & URLs" @@ -6176,7 +6025,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_ACCESS_DESC="Allows the u COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_BATCH_OPTIONS="Batch process the selected Joomla Modules Files, Folders & URLs" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_BATCH_TIP="All changes will be applied to all selected Joomla Modules Files, Folders & URLs" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_BATCH_USE="Joomla Modules Files Folders Urls Batch Use" -COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla modules files folders urls" +COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla modules files folders urls" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_CREATE="Joomla Modules Files Folders Urls Create" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_CREATE_DESC="Allows the users in this group to create create joomla modules files folders urls" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_DELETE="Joomla Modules Files Folders Urls Delete" @@ -6192,7 +6041,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_EDIT_OWN_DESC="Allows the COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_EDIT_STATE="Joomla Modules Files Folders Urls Edit State" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla module files folders urls" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_EDIT_VERSION="Joomla Modules Files Folders Urls Edit Version" -COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla modules files folders urls" +COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla modules files folders urls" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_N_ITEMS_ARCHIVED="%s Joomla Modules Files, Folders & URLs archived." COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_N_ITEMS_ARCHIVED_1="%s Joomla Module Files, Folders & URLs archived." COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_N_ITEMS_CHECKED_IN_0="No Joomla Module Files, Folders & URLs successfully checked in." @@ -6241,7 +6090,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_ACCESS_DESC="Allows the users in thi COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_BATCH_OPTIONS="Batch process the selected Joomla Modules Updates" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_BATCH_TIP="All changes will be applied to all selected Joomla Modules Updates" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_BATCH_USE="Joomla Modules Updates Batch Use" -COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla modules updates" +COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla modules updates" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_CREATE="Joomla Modules Updates Create" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_CREATE_DESC="Allows the users in this group to create create joomla modules updates" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_DELETE="Joomla Modules Updates Delete" @@ -6257,7 +6106,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_OWN_DESC="Allows the users in t COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_STATE="Joomla Modules Updates Edit State" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla module updates" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_VERSION="Joomla Modules Updates Edit Version" -COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla modules updates" +COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla modules updates" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_ARCHIVED="%s Joomla Modules Updates archived." COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_ARCHIVED_1="%s Joomla Module Updates archived." COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_CHECKED_IN_0="No Joomla Module Updates successfully checked in." @@ -6287,12 +6136,12 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_DESCRIPTION="You can add a h COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_HEADER_DESCRIPTION="You can add your own custom helper header script." COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_HEADER_LABEL="Add Class Helper Header" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_LABEL="Add Class Helper" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_METHOD_UNINSTALL_LABEL="Add PHP Method (uninstall)" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_POSTFLIGHT_INSTALL_LABEL="Add PHP Postflight (install)" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_POSTFLIGHT_UPDATE_LABEL="Add PHP Postflight (update)" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_PREFLIGHT_INSTALL_LABEL="Add PHP Preflight (install)" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_PREFLIGHT_UNINSTALL_LABEL="Add PHP Preflight (uninstall)" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_PREFLIGHT_UPDATE_LABEL="Add PHP Preflight (update)" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_METHOD_UNINSTALL_LABEL="Add PHP to the uninstall method" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_POSTFLIGHT_INSTALL_LABEL="Add PHP in the postflight install (event)" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_POSTFLIGHT_UPDATE_LABEL="Add PHP in the postflight update (event)" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_PREFLIGHT_INSTALL_LABEL="Add PHP in the preflight install (event)" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_PREFLIGHT_UNINSTALL_LABEL="Add PHP in the preflight uninstall (event)" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_PREFLIGHT_UPDATE_LABEL="Add PHP in the preflight update (event)" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_SCRIPT_CONSTRUCT_LABEL="Add PHP Script Construct" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_SALES_SERVER_LABEL="Add Sales Server" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_SQL_LABEL="Add MySQL - (Install)" @@ -6323,6 +6172,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_DESCRIPTION_LABEL="Description" COM_COMPONENTBUILDER_JOOMLA_MODULE_DYNAMIC_INTEGRATION="Dynamic Integration" COM_COMPONENTBUILDER_JOOMLA_MODULE_EDIT="Editing the Joomla Module" COM_COMPONENTBUILDER_JOOMLA_MODULE_ERROR_UNIQUE_ALIAS="Another Joomla Module has the same alias." +COM_COMPONENTBUILDER_JOOMLA_MODULE_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Joomla Module has the same alias ." COM_COMPONENTBUILDER_JOOMLA_MODULE_FIELD="Field" COM_COMPONENTBUILDER_JOOMLA_MODULE_FIELDSET_DESCRIPTION="Leave default if you don't know what this should be" COM_COMPONENTBUILDER_JOOMLA_MODULE_FIELDSET_HINT="basic" @@ -6356,6 +6206,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_CREATED_DATE_LABEL="Create COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_DEFAULT_LINK="Default (link)" COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_EDIT="Editing the Joomla Module Files, Folders & URLs" COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS="Another Joomla Module Files, Folders & URLs has the same alias." +COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Joomla Module Files, Folders & URLs has the same alias ." COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_FILE="File" COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_FILEPATH_DESCRIPTION="Full System Path" COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_FILEPATH_HINT="/home/user/folder/file.php" @@ -6389,42 +6240,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_FULLPATH_ COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_LABEL="Adding Custom Folders" COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_NOTE_ADD_URLS_DESCRIPTION="You can add urls here, and it can be used in three ways. As a direct link (default) or to get the file content and add it to the component (get) or as both local and link (dynamic)" COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_NOTE_ADD_URLS_LABEL="Adding Urls" -COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_NOTE_CONSTANT_PATHS_DESCRIPTION="

    // The path to the administrator folder.
    -JPATH_ADMINISTRATOR
    -// The path to the installed Joomla! site, or JPATH_ROOT/administrator if executed from the backend.
    -JPATH_BASE
    -// The path to the cache folder.
    -JPATH_CACHE
    -// The path to the administration folder of JCB component.
    -JPATH_COMPONENT_ADMINISTRATOR no ideal to use
    -// The path to the site folder of JCB component.
    -JPATH_COMPONENT_SITE no ideal to use
    -// The path to the JCB component.
    -JPATH_COMPONENT no ideal to use
    -// The path to folder containing the configuration.php file.
    -JPATH_CONFIGURATION
    -// The path to the installation folder.
    -JPATH_INSTALLATION
    -// The path to the libraries folder.
    -JPATH_LIBRARIES
    -// The path to the plugins folder.
    -JPATH_PLUGINS
    -// The path to the installed Joomla! site.
    -JPATH_ROOT
    -// The path to the installed Joomla! site.
    -JPATH_SITE
    -// The path to the templates folder.
    -JPATH_THEMES

    - -

    JPATH_SITE is meant to represent the root path of the JSite application,
    -just as JPATH_ADMINISTRATOR is mean to represent the root path of the JAdministrator application.
    -JPATH_BASE is the root path for the current requested application.... so if you are in the administrator application:
    -JPATH_BASE == JPATH_ADMINISTRATOR
    -If you are in the site application:
    -JPATH_BASE == JPATH_SITE
    -If you are in the installation application:
    -JPATH_BASE == JPATH_INSTALLATION.
    -JPATH_ROOT is the root path for the Joomla install and does not depend upon any application.

    " +COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_NOTE_CONSTANT_PATHS_DESCRIPTION="

    // The path to the administrator folder.
    JPATH_ADMINISTRATOR
    // The path to the installed Joomla! site, or JPATH_ROOT/administrator if executed from the backend.
    JPATH_BASE
    // The path to the cache folder.
    JPATH_CACHE
    // The path to the administration folder of JCB component.
    JPATH_COMPONENT_ADMINISTRATOR no ideal to use
    // The path to the site folder of JCB component.
    JPATH_COMPONENT_SITE no ideal to use
    // The path to the JCB component.
    JPATH_COMPONENT no ideal to use
    // The path to folder containing the configuration.php file.
    JPATH_CONFIGURATION
    // The path to the installation folder.
    JPATH_INSTALLATION
    // The path to the libraries folder.
    JPATH_LIBRARIES
    // The path to the plugins folder.
    JPATH_PLUGINS
    // The path to the installed Joomla! site.
    JPATH_ROOT
    // The path to the installed Joomla! site.
    JPATH_SITE
    // The path to the templates folder.
    JPATH_THEMES

    JPATH_SITE is meant to represent the root path of the JSite application,
    just as JPATH_ADMINISTRATOR is mean to represent the root path of the JAdministrator application.
    JPATH_BASE is the root path for the current requested application.... so if you are in the administrator application:
    JPATH_BASE == JPATH_ADMINISTRATOR
    If you are in the site application:
    JPATH_BASE == JPATH_SITE
    If you are in the installation application:
    JPATH_BASE == JPATH_INSTALLATION.
    JPATH_ROOT is the root path for the Joomla install and does not depend upon any application.

    " COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_NOTE_CONSTANT_PATHS_LABEL="Constant Paths" COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_NOTNEW_DESCRIPTION="Should file be updated." COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_NOTNEW_LABEL="Update" @@ -6484,13 +6300,9 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_NAME_MESSAGE="Error! Please add name here." COM_COMPONENTBUILDER_JOOMLA_MODULE_NEW="A New Joomla Module" COM_COMPONENTBUILDER_JOOMLA_MODULE_NO="No" COM_COMPONENTBUILDER_JOOMLA_MODULE_NONE="None" -COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo JText::_('Text'); ?>
    -<?php echo JText::sprintf('Hello %s', $this->user->name); ?>
    -Just get UPPERCASE language string:
    -<?php echo JustTEXT::_('Text'); ?>" +COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo Text::_('Text'); ?>
    <?php echo Text::sprintf('Hello %s', $this->user->name); ?>
    Just get UPPERCASE language string:
    <?php echo JustTEXT::_('Text'); ?>" COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_ADD_PHP_LANGUAGE_STRING_LABEL="Add PHP Language String" -COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LIBRARIES_OPTIONS_DESCRIPTION="

    All libraries added to modules are added to the component media folder for now

    -

    So over here you are able to manually add HTML code to your model default tmpl.

    " +COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LIBRARIES_OPTIONS_DESCRIPTION="

    All libraries added to modules are added to the component media folder for now

    So over here you are able to manually add HTML code to your model default tmpl.

    " COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LIBRARIES_OPTIONS_LABEL="Libraries Options" COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LINKED_TO_NOTICE_DESCRIPTION="
    Searching the database.
    " COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LINKED_TO_NOTICE_LABEL="Linked To" @@ -6511,17 +6323,17 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_PATH_LABEL="Path" COM_COMPONENTBUILDER_JOOMLA_MODULE_PATH_MESSAGE="Error! Please add extra field path here." COM_COMPONENTBUILDER_JOOMLA_MODULE_PERMISSION="Permissions" COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_METHOD_UNINSTALL_DESCRIPTION="PHP script that should run during uninstall." -COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_METHOD_UNINSTALL_LABEL="PHP Method (uninstall)" -COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_POSTFLIGHT_INSTALL_DESCRIPTION="PHP script that should run postflight during install." -COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_POSTFLIGHT_INSTALL_LABEL="PHP Postflight (install)" -COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_POSTFLIGHT_UPDATE_DESCRIPTION="PHP script that should run postflight during update." -COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_POSTFLIGHT_UPDATE_LABEL="PHP Postflight (update)" -COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_INSTALL_DESCRIPTION="PHP script that should run preflight during install." -COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_INSTALL_LABEL="PHP Preflight (install)" -COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_UNINSTALL_DESCRIPTION="PHP script that should run preflight during uninstall." -COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_UNINSTALL_LABEL="PHP Preflight (uninstall)" -COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_UPDATE_DESCRIPTION="PHP script that should run preflight during update." -COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_UPDATE_LABEL="PHP Preflight (update)" +COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_METHOD_UNINSTALL_LABEL="PHP in the uninstall method" +COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_POSTFLIGHT_INSTALL_DESCRIPTION="PHP code that should run postflight during install." +COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_POSTFLIGHT_INSTALL_LABEL="PHP in the postflight install (event)" +COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_POSTFLIGHT_UPDATE_DESCRIPTION="PHP code that should run postflight during update." +COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_POSTFLIGHT_UPDATE_LABEL="PHP in the postflight update (event)" +COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_INSTALL_DESCRIPTION="PHP code that should run preflight during install." +COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_INSTALL_LABEL="PHP in the preflight install (event)" +COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_UNINSTALL_DESCRIPTION="PHP code that should run preflight during uninstall." +COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_UNINSTALL_LABEL="PHP in the preflight uninstall (event)" +COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_UPDATE_DESCRIPTION="PHP code that should run preflight during update." +COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_UPDATE_LABEL="PHP in the preflight update (event)" COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_SCRIPT_CONSTRUCT_DESCRIPTION="PHP script that should run in __construct of script." COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_SCRIPT_CONSTRUCT_LABEL="PHP Script Construct" COM_COMPONENTBUILDER_JOOMLA_MODULE_PUBLISHING="Publishing" @@ -6557,6 +6369,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_CREATED_DATE_DESC="The date this Joom COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_EDIT="Editing the Joomla Module Updates" COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_ERROR_UNIQUE_ALIAS="Another Joomla Module Updates has the same alias." +COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Joomla Module Updates has the same alias ." COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_ID="Id" COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_JOOMLA_MODULE_LABEL="Joomla Modules" COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_MODIFIED_BY_DESC="The last user that modified this Joomla Module Updates." @@ -6603,7 +6416,7 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGINS_ACCESS_DESC="Allows the users in this group COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_OPTIONS="Batch process the selected Joomla Plugins" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_TIP="All changes will be applied to all selected Joomla Plugins" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_USE="Joomla Plugins Batch Use" -COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla plugins" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_CREATE="Joomla Plugins Create" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_CREATE_DESC="Allows the users in this group to create create joomla plugins" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_DASHBOARD_LIST="Joomla Plugins Dashboard List" @@ -6621,14 +6434,14 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_OWN_DESC="Allows the users in this grou COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_STATE="Joomla Plugins Edit State" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla plugin" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_VERSION="Joomla Plugins Edit Version" -COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla plugins" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS="Joomla Plugins Files, Folders & URLs" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_ACCESS="Joomla Plugins Files Folders Urls Access" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_ACCESS_DESC="Allows the users in this group to access access joomla plugins files folders urls" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_OPTIONS="Batch process the selected Joomla Plugins Files, Folders & URLs" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_TIP="All changes will be applied to all selected Joomla Plugins Files, Folders & URLs" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_USE="Joomla Plugins Files Folders Urls Batch Use" -COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla plugins files folders urls" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_CREATE="Joomla Plugins Files Folders Urls Create" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_CREATE_DESC="Allows the users in this group to create create joomla plugins files folders urls" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_DELETE="Joomla Plugins Files Folders Urls Delete" @@ -6644,7 +6457,7 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_OWN_DESC="Allows the COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_STATE="Joomla Plugins Files Folders Urls Edit State" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla plugin files folders urls" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_VERSION="Joomla Plugins Files Folders Urls Edit Version" -COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla plugins files folders urls" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_ARCHIVED="%s Joomla Plugins Files, Folders & URLs archived." COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_ARCHIVED_1="%s Joomla Plugin Files, Folders & URLs archived." COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_N_ITEMS_CHECKED_IN_0="No Joomla Plugin Files, Folders & URLs successfully checked in." @@ -6691,7 +6504,7 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_ACCESS_DESC="Allows the users in thi COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_OPTIONS="Batch process the selected Joomla Plugins Updates" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_TIP="All changes will be applied to all selected Joomla Plugins Updates" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_USE="Joomla Plugins Updates Batch Use" -COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla plugins updates" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_CREATE="Joomla Plugins Updates Create" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_CREATE_DESC="Allows the users in this group to create create joomla plugins updates" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_DELETE="Joomla Plugins Updates Delete" @@ -6707,7 +6520,7 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_OWN_DESC="Allows the users in t COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE="Joomla Plugins Updates Edit State" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla plugin updates" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION="Joomla Plugins Updates Edit Version" -COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla plugins updates" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_ARCHIVED="%s Joomla Plugins Updates archived." COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_ARCHIVED_1="%s Joomla Plugin Updates archived." COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_CHECKED_IN_0="No Joomla Plugin Updates successfully checked in." @@ -6734,12 +6547,12 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDRULEPATH_DESCRIPTION="Set other rule path" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDRULEPATH_LABEL="Other Rule Path" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_HEAD_DESCRIPTION="You can add your own custom header script, combined with the default header script that make the extended class work." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_HEAD_LABEL="Add Custom Class Header" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_METHOD_UNINSTALL_LABEL="Add PHP Method (uninstall)" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_POSTFLIGHT_INSTALL_LABEL="Add PHP Postflight (install)" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_POSTFLIGHT_UPDATE_LABEL="Add PHP Postflight (update)" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_INSTALL_LABEL="Add PHP Preflight (install)" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_UNINSTALL_LABEL="Add PHP Preflight (uninstall)" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_UPDATE_LABEL="Add PHP Preflight (update)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_METHOD_UNINSTALL_LABEL="Add PHP to the uninstall method" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_POSTFLIGHT_INSTALL_LABEL="Add PHP in the postflight install (event)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_POSTFLIGHT_UPDATE_LABEL="Add PHP in the postflight update (event)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_INSTALL_LABEL="Add PHP in the preflight install (event)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_UNINSTALL_LABEL="Add PHP in the preflight uninstall (event)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_UPDATE_LABEL="Add PHP in the preflight update (event)" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_SCRIPT_CONSTRUCT_LABEL="Add PHP Script Construct" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_SALES_SERVER_LABEL="Add Sales Server" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_SQL_LABEL="Add MySQL - (Install)" @@ -6761,6 +6574,7 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_DESCRIPTION_LABEL="Description" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_DYNAMIC_INTEGRATION="Dynamic Integration" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_EDIT="Editing the Joomla Plugin" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ERROR_UNIQUE_ALIAS="Another Joomla Plugin has the same alias." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Joomla Plugin has the same alias ." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELD="Field" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDSET_DESCRIPTION="Leave default if you don't know what this should be" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDSET_HINT="basic" @@ -6794,6 +6608,7 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_CREATED_DATE_LABEL="Create COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_DEFAULT_LINK="Default (link)" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_EDIT="Editing the Joomla Plugin Files, Folders & URLs" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS="Another Joomla Plugin Files, Folders & URLs has the same alias." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Joomla Plugin Files, Folders & URLs has the same alias ." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FILE="File" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FILEPATH_DESCRIPTION="Full System Path" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_FILEPATH_HINT="/home/user/folder/file.php" @@ -6827,42 +6642,7 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_FULLPATH_ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_LABEL="Adding Custom Folders" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_ADD_URLS_DESCRIPTION="You can add urls here, and it can be used in three ways. As a direct link (default) or to get the file content and add it to the component (get) or as both local and link (dynamic)" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_ADD_URLS_LABEL="Adding Urls" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_CONSTANT_PATHS_DESCRIPTION="

    // The path to the administrator folder.
    -JPATH_ADMINISTRATOR
    -// The path to the installed Joomla! site, or JPATH_ROOT/administrator if executed from the backend.
    -JPATH_BASE
    -// The path to the cache folder.
    -JPATH_CACHE
    -// The path to the administration folder of JCB component.
    -JPATH_COMPONENT_ADMINISTRATOR no ideal to use
    -// The path to the site folder of JCB component.
    -JPATH_COMPONENT_SITE no ideal to use
    -// The path to the JCB component.
    -JPATH_COMPONENT no ideal to use
    -// The path to folder containing the configuration.php file.
    -JPATH_CONFIGURATION
    -// The path to the installation folder.
    -JPATH_INSTALLATION
    -// The path to the libraries folder.
    -JPATH_LIBRARIES
    -// The path to the plugins folder.
    -JPATH_PLUGINS
    -// The path to the installed Joomla! site.
    -JPATH_ROOT
    -// The path to the installed Joomla! site.
    -JPATH_SITE
    -// The path to the templates folder.
    -JPATH_THEMES

    - -

    JPATH_SITE is meant to represent the root path of the JSite application,
    -just as JPATH_ADMINISTRATOR is mean to represent the root path of the JAdministrator application.
    -JPATH_BASE is the root path for the current requested application.... so if you are in the administrator application:
    -JPATH_BASE == JPATH_ADMINISTRATOR
    -If you are in the site application:
    -JPATH_BASE == JPATH_SITE
    -If you are in the installation application:
    -JPATH_BASE == JPATH_INSTALLATION.
    -JPATH_ROOT is the root path for the Joomla install and does not depend upon any application.

    " +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_CONSTANT_PATHS_DESCRIPTION="

    // The path to the administrator folder.
    JPATH_ADMINISTRATOR
    // The path to the installed Joomla! site, or JPATH_ROOT/administrator if executed from the backend.
    JPATH_BASE
    // The path to the cache folder.
    JPATH_CACHE
    // The path to the administration folder of JCB component.
    JPATH_COMPONENT_ADMINISTRATOR no ideal to use
    // The path to the site folder of JCB component.
    JPATH_COMPONENT_SITE no ideal to use
    // The path to the JCB component.
    JPATH_COMPONENT no ideal to use
    // The path to folder containing the configuration.php file.
    JPATH_CONFIGURATION
    // The path to the installation folder.
    JPATH_INSTALLATION
    // The path to the libraries folder.
    JPATH_LIBRARIES
    // The path to the plugins folder.
    JPATH_PLUGINS
    // The path to the installed Joomla! site.
    JPATH_ROOT
    // The path to the installed Joomla! site.
    JPATH_SITE
    // The path to the templates folder.
    JPATH_THEMES

    JPATH_SITE is meant to represent the root path of the JSite application,
    just as JPATH_ADMINISTRATOR is mean to represent the root path of the JAdministrator application.
    JPATH_BASE is the root path for the current requested application.... so if you are in the administrator application:
    JPATH_BASE == JPATH_ADMINISTRATOR
    If you are in the site application:
    JPATH_BASE == JPATH_SITE
    If you are in the installation application:
    JPATH_BASE == JPATH_INSTALLATION.
    JPATH_ROOT is the root path for the Joomla install and does not depend upon any application.

    " COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTE_CONSTANT_PATHS_LABEL="Constant Paths" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTNEW_DESCRIPTION="Should file be updated." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_NOTNEW_LABEL="Update" @@ -6897,9 +6677,9 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_ACCESS_DESC="Allows the users in this COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_OPTIONS="Batch process the selected Joomla Plugin Groups" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_TIP="All changes will be applied to all selected Joomla Plugin Groups" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_USE="Joomla Plugin Groups Batch Use" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugin groups" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla plugin groups" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_EDIT_VERSION="Joomla Plugin Groups Edit Version" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugin groups" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla plugin groups" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_ARCHIVED="%s Joomla Plugin Groups archived." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_ARCHIVED_1="%s Joomla Plugin Group archived." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_N_ITEMS_CHECKED_IN_0="No Joomla Plugin Group successfully checked in." @@ -6927,6 +6707,7 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_DETAILS="Details" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_EDIT="Editing the Joomla Plugin Group" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_ERROR_UNIQUE_ALIAS="Another Joomla Plugin Group has the same alias." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Joomla Plugin Group has the same alias ." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_ID="Id" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_MODIFIED_BY_DESC="The last user that modified this Joomla Plugin Group." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_MODIFIED_BY_LABEL="Modified By" @@ -6990,17 +6771,17 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PATH_LABEL="Path" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PATH_MESSAGE="Error! Please add extra field path here." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PERMISSION="Permissions" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_METHOD_UNINSTALL_DESCRIPTION="PHP script that should run during uninstall." -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_METHOD_UNINSTALL_LABEL="PHP Method (uninstall)" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_INSTALL_DESCRIPTION="PHP script that should run postflight during install." -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_INSTALL_LABEL="PHP Postflight (install)" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_UPDATE_DESCRIPTION="PHP script that should run postflight during update." -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_UPDATE_LABEL="PHP Postflight (update)" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_INSTALL_DESCRIPTION="PHP script that should run preflight during install." -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_INSTALL_LABEL="PHP Preflight (install)" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UNINSTALL_DESCRIPTION="PHP script that should run preflight during uninstall." -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UNINSTALL_LABEL="PHP Preflight (uninstall)" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UPDATE_DESCRIPTION="PHP script that should run preflight during update." -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UPDATE_LABEL="PHP Preflight (update)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_METHOD_UNINSTALL_LABEL="PHP in the uninstall method" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_INSTALL_DESCRIPTION="PHP code that should run postflight during install." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_INSTALL_LABEL="PHP in the postflight install (event)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_UPDATE_DESCRIPTION="PHP code that should run postflight during update." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_UPDATE_LABEL="PHP in the postflight update (event)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_INSTALL_DESCRIPTION="PHP code that should run preflight during install." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_INSTALL_LABEL="PHP in the preflight install (event)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UNINSTALL_DESCRIPTION="PHP code that should run preflight during uninstall." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UNINSTALL_LABEL="PHP in the preflight uninstall (event)" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UPDATE_DESCRIPTION="PHP code that should run preflight during update." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UPDATE_LABEL="PHP in the preflight update (event)" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_SCRIPT_CONSTRUCT_DESCRIPTION="PHP script that should run in __construct of script." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_SCRIPT_CONSTRUCT_LABEL="PHP Script Construct" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PLUGIN="Plugin" @@ -7044,6 +6825,7 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_CREATED_DATE_DESC="The date this Joom COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_EDIT="Editing the Joomla Plugin Updates" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_ERROR_UNIQUE_ALIAS="Another Joomla Plugin Updates has the same alias." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Joomla Plugin Updates has the same alias ." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_ID="Id" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_JOOMLA_PLUGIN_LABEL="Joomla Plugins" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_MODIFIED_BY_DESC="The last user that modified this Joomla Plugin Updates." @@ -7083,6 +6865,100 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_VERSION_DESC="A count of the number of times COM_COMPONENTBUILDER_JOOMLA_PLUGIN_VERSION_LABEL="Version" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_YES="Yes" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ZIP="ZIP" +COM_COMPONENTBUILDER_JOOMLA_POWER="Joomla Power" +COM_COMPONENTBUILDER_JOOMLA_POWERS="Joomla Powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_ACCESS="Joomla Powers Access" +COM_COMPONENTBUILDER_JOOMLA_POWERS_ACCESS_DESC="Allows the users in this group to access access joomla powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_BATCH_OPTIONS="Batch process the selected Joomla Powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_BATCH_TIP="All changes will be applied to all selected Joomla Powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_BATCH_USE="Joomla Powers Batch Use" +COM_COMPONENTBUILDER_JOOMLA_POWERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_CREATE="Joomla Powers Create" +COM_COMPONENTBUILDER_JOOMLA_POWERS_CREATE_DESC="Allows the users in this group to create create joomla powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_DELETE="Joomla Powers Delete" +COM_COMPONENTBUILDER_JOOMLA_POWERS_DELETE_DESC="Allows the users in this group to delete delete joomla powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT="Joomla Powers Edit" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_BY="Joomla Powers Edit Created By" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by joomla powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_DATE="Joomla Powers Edit Created Date" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created joomla powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_DESC="Allows the users in this group to edit the joomla power" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_OWN="Joomla Powers Edit Own" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_OWN_DESC="Allows the users in this group to edit edit own joomla powers created by them" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_STATE="Joomla Powers Edit State" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla power" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_VERSION="Joomla Powers Edit Version" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_NAME="Name" +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_ARCHIVED="%s Joomla Powers archived." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_ARCHIVED_1="%s Joomla Power archived." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_CHECKED_IN_0="No Joomla Power successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_CHECKED_IN_1="%d Joomla Power successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_CHECKED_IN_MORE="%d Joomla Powers successfully checked in." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_DELETED="%s Joomla Powers deleted." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_DELETED_1="%s Joomla Power deleted." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_FAILED_PUBLISHING="%s Joomla Powers failed publishing." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_FAILED_PUBLISHING_1="%s Joomla Power failed publishing." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_FEATURED="%s Joomla Powers featured." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_FEATURED_1="%s Joomla Power featured." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_PUBLISHED="%s Joomla Powers published." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_PUBLISHED_1="%s Joomla Power published." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_TRASHED="%s Joomla Powers trashed." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_TRASHED_1="%s Joomla Power trashed." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_UNFEATURED="%s Joomla Powers unfeatured." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_UNFEATURED_1="%s Joomla Power unfeatured." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_UNPUBLISHED="%s Joomla Powers unpublished." +COM_COMPONENTBUILDER_JOOMLA_POWERS_N_ITEMS_UNPUBLISHED_1="%s Joomla Power unpublished." +COM_COMPONENTBUILDER_JOOMLA_POWERS_SUBMENU="Joomla Powers Submenu" +COM_COMPONENTBUILDER_JOOMLA_POWERS_SUBMENU_DESC="Allows the users in this group to submenu of joomla power" +COM_COMPONENTBUILDER_JOOMLA_POWER_ALL="All" +COM_COMPONENTBUILDER_JOOMLA_POWER_CREATED_BY_DESC="The user that created this Joomla Power." +COM_COMPONENTBUILDER_JOOMLA_POWER_CREATED_BY_LABEL="Created By" +COM_COMPONENTBUILDER_JOOMLA_POWER_CREATED_DATE_DESC="The date this Joomla Power was created." +COM_COMPONENTBUILDER_JOOMLA_POWER_CREATED_DATE_LABEL="Created Date" +COM_COMPONENTBUILDER_JOOMLA_POWER_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_COMPONENTBUILDER_JOOMLA_POWER_DESCRIPTION_HINT="Add Description Here" +COM_COMPONENTBUILDER_JOOMLA_POWER_DESCRIPTION_LABEL="Description" +COM_COMPONENTBUILDER_JOOMLA_POWER_EDIT="Editing the Joomla Power" +COM_COMPONENTBUILDER_JOOMLA_POWER_ERROR_UNIQUE_ALIAS="Another Joomla Power has the same alias." +COM_COMPONENTBUILDER_JOOMLA_POWER_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Joomla Power has the same alias ." +COM_COMPONENTBUILDER_JOOMLA_POWER_GUID_DESCRIPTION="Globally Unique Identifier" +COM_COMPONENTBUILDER_JOOMLA_POWER_GUID_HINT="Auto Generated" +COM_COMPONENTBUILDER_JOOMLA_POWER_GUID_LABEL="GUID" +COM_COMPONENTBUILDER_JOOMLA_POWER_ID="Id" +COM_COMPONENTBUILDER_JOOMLA_POWER_INIT_BUTTON_ACCESS="Joomla Power Init Button Access" +COM_COMPONENTBUILDER_JOOMLA_POWER_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button." +COM_COMPONENTBUILDER_JOOMLA_POWER_JOOMLA_3="Joomla 3" +COM_COMPONENTBUILDER_JOOMLA_POWER_JOOMLA_4="Joomla 4" +COM_COMPONENTBUILDER_JOOMLA_POWER_JOOMLA_5="Joomla 5" +COM_COMPONENTBUILDER_JOOMLA_POWER_JOOMLA_POWER="Joomla Power" +COM_COMPONENTBUILDER_JOOMLA_POWER_JOOMLA_VERSION_DESCRIPTION="Joomla Target" +COM_COMPONENTBUILDER_JOOMLA_POWER_JOOMLA_VERSION_LABEL="Joomla Version" +COM_COMPONENTBUILDER_JOOMLA_POWER_MODIFIED_BY_DESC="The last user that modified this Joomla Power." +COM_COMPONENTBUILDER_JOOMLA_POWER_MODIFIED_BY_LABEL="Modified By" +COM_COMPONENTBUILDER_JOOMLA_POWER_MODIFIED_DATE_DESC="The date this Joomla Power was modified." +COM_COMPONENTBUILDER_JOOMLA_POWER_MODIFIED_DATE_LABEL="Modified Date" +COM_COMPONENTBUILDER_JOOMLA_POWER_NAMESPACE_DESCRIPTION="Add the namespace of this class." +COM_COMPONENTBUILDER_JOOMLA_POWER_NAMESPACE_HINT="ComponentName\Powers\ClassName" +COM_COMPONENTBUILDER_JOOMLA_POWER_NAMESPACE_LABEL="Namespace" +COM_COMPONENTBUILDER_JOOMLA_POWER_NAMESPACE_MESSAGE="Error! Please add namespace here." +COM_COMPONENTBUILDER_JOOMLA_POWER_NEW="A New Joomla Power" +COM_COMPONENTBUILDER_JOOMLA_POWER_ORDERING_LABEL="Ordering" +COM_COMPONENTBUILDER_JOOMLA_POWER_PERMISSION="Permissions" +COM_COMPONENTBUILDER_JOOMLA_POWER_PUBLISHING="Publishing" +COM_COMPONENTBUILDER_JOOMLA_POWER_RESET_BUTTON_ACCESS="Joomla Power Reset Button Access" +COM_COMPONENTBUILDER_JOOMLA_POWER_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button." +COM_COMPONENTBUILDER_JOOMLA_POWER_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Joomla Power to customise the alias." +COM_COMPONENTBUILDER_JOOMLA_POWER_SETTINGS_LABEL="Settings" +COM_COMPONENTBUILDER_JOOMLA_POWER_STATUS="Status" +COM_COMPONENTBUILDER_JOOMLA_POWER_SYSTEM_NAME_DESCRIPTION="Used only in the system." +COM_COMPONENTBUILDER_JOOMLA_POWER_SYSTEM_NAME_HINT="The System Name Here" +COM_COMPONENTBUILDER_JOOMLA_POWER_SYSTEM_NAME_LABEL="System Name" +COM_COMPONENTBUILDER_JOOMLA_POWER_SYSTEM_NAME_MESSAGE="Error! Please add some text here." +COM_COMPONENTBUILDER_JOOMLA_POWER_VERSION_DESC="A count of the number of times this Joomla Power has been revised." +COM_COMPONENTBUILDER_JOOMLA_POWER_VERSION_LABEL="Version" +COM_COMPONENTBUILDER_JOOMLA_THREE="Joomla 3" +COM_COMPONENTBUILDER_JOOMLA_VERSION="Joomla Version" COM_COMPONENTBUILDER_JUST_GET_ALL_SNIPPETS="Just Get All Snippets" COM_COMPONENTBUILDER_KEEP_HISTORY="Keep History" COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS="- Keep Original Access -" @@ -7101,7 +6977,7 @@ COM_COMPONENTBUILDER_LANGUAGES_ACCESS_DESC="Allows the users in this group to ac COM_COMPONENTBUILDER_LANGUAGES_BATCH_OPTIONS="Batch process the selected Languages" COM_COMPONENTBUILDER_LANGUAGES_BATCH_TIP="All changes will be applied to all selected Languages" COM_COMPONENTBUILDER_LANGUAGES_BATCH_USE="Languages Batch Use" -COM_COMPONENTBUILDER_LANGUAGES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch languages" +COM_COMPONENTBUILDER_LANGUAGES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch languages" COM_COMPONENTBUILDER_LANGUAGES_CREATE="Languages Create" COM_COMPONENTBUILDER_LANGUAGES_CREATE_DESC="Allows the users in this group to create create languages" COM_COMPONENTBUILDER_LANGUAGES_DELETE="Languages Delete" @@ -7113,7 +6989,7 @@ COM_COMPONENTBUILDER_LANGUAGES_EDIT_OWN_DESC="Allows the users in this group to COM_COMPONENTBUILDER_LANGUAGES_EDIT_STATE="Languages Edit State" COM_COMPONENTBUILDER_LANGUAGES_EDIT_STATE_DESC="Allows the users in this group to update the state of the language" COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION="Languages Edit Version" -COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version languages" +COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version languages" COM_COMPONENTBUILDER_LANGUAGES_EXPORT="Languages Export" COM_COMPONENTBUILDER_LANGUAGES_EXPORT_DESC="Allows the users in this group to export export languages" COM_COMPONENTBUILDER_LANGUAGES_IMPORT="Languages Import" @@ -7148,6 +7024,7 @@ COM_COMPONENTBUILDER_LANGUAGE_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_LANGUAGE_DETAILS="Details" COM_COMPONENTBUILDER_LANGUAGE_EDIT="Editing the Language" COM_COMPONENTBUILDER_LANGUAGE_ERROR_UNIQUE_ALIAS="Another Language has the same alias." +COM_COMPONENTBUILDER_LANGUAGE_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Language has the same alias ." COM_COMPONENTBUILDER_LANGUAGE_ID="Id" COM_COMPONENTBUILDER_LANGUAGE_LANGTAG_DESCRIPTION="Enter the language tag – example: en-GB for English (UK). This should be the exact prefix used for the language installed or to be installed." COM_COMPONENTBUILDER_LANGUAGE_LANGTAG_HINT="en-GB" @@ -7174,7 +7051,7 @@ COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS_DESC="Allows the users in this COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_OPTIONS="Batch process the selected Language Translations" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_TIP="All changes will be applied to all selected Language Translations" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE="Language Translations Batch Use" -COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch language translations" +COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch language translations" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_CREATE="Language Translations Create" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_CREATE_DESC="Allows the users in this group to create create language translations" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_DASHBOARD_LIST="Language Translations Dashboard List" @@ -7188,7 +7065,7 @@ COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_OWN_DESC="Allows the users in th COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_STATE="Language Translations Edit State" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_STATE_DESC="Allows the users in this group to update the state of the language translation" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_VERSION="Language Translations Edit Version" -COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version language translations" +COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version language translations" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EXPORT="Language Translations Export" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EXPORT_DESC="Allows the users in this group to export export language translations" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_IMPORT="Language Translations Import" @@ -7222,6 +7099,7 @@ COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_DETAILS="Details" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_EDIT="Editing the Language Translation" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_ERROR_UNIQUE_ALIAS="Another Language Translation has the same alias." +COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Language Translation has the same alias ." COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_ID="Id" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_LANGUAGE="Language" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_LANGUAGE_LABEL="Language" @@ -7255,7 +7133,7 @@ COM_COMPONENTBUILDER_LAYOUTS_ACCESS_DESC="Allows the users in this group to acce COM_COMPONENTBUILDER_LAYOUTS_BATCH_OPTIONS="Batch process the selected Layouts" COM_COMPONENTBUILDER_LAYOUTS_BATCH_TIP="All changes will be applied to all selected Layouts" COM_COMPONENTBUILDER_LAYOUTS_BATCH_USE="Layouts Batch Use" -COM_COMPONENTBUILDER_LAYOUTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch layouts" +COM_COMPONENTBUILDER_LAYOUTS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch layouts" COM_COMPONENTBUILDER_LAYOUTS_CREATE="Layouts Create" COM_COMPONENTBUILDER_LAYOUTS_CREATE_DESC="Allows the users in this group to create create layouts" COM_COMPONENTBUILDER_LAYOUTS_DASHBOARD_LIST="Layouts Dashboard List" @@ -7270,7 +7148,7 @@ COM_COMPONENTBUILDER_LAYOUTS_EDIT_OWN_DESC="Allows the users in this group to ed COM_COMPONENTBUILDER_LAYOUTS_EDIT_STATE="Layouts Edit State" COM_COMPONENTBUILDER_LAYOUTS_EDIT_STATE_DESC="Allows the users in this group to update the state of the layout" COM_COMPONENTBUILDER_LAYOUTS_EDIT_VERSION="Layouts Edit Version" -COM_COMPONENTBUILDER_LAYOUTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version layouts" +COM_COMPONENTBUILDER_LAYOUTS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version layouts" COM_COMPONENTBUILDER_LAYOUTS_EXPORT="Layouts Export" COM_COMPONENTBUILDER_LAYOUTS_EXPORT_DESC="Allows the users in this group to export export layouts" COM_COMPONENTBUILDER_LAYOUTS_IMPORT="Layouts Import" @@ -7319,6 +7197,7 @@ COM_COMPONENTBUILDER_LAYOUT_DYNAMIC_VALUES_DESCRIPTION="Only use dynamic get val COM_COMPONENTBUILDER_LAYOUT_DYNAMIC_VALUES_LABEL="Dynamic Values" COM_COMPONENTBUILDER_LAYOUT_EDIT="Editing the Layout" COM_COMPONENTBUILDER_LAYOUT_ERROR_UNIQUE_ALIAS="Another Layout has the same alias." +COM_COMPONENTBUILDER_LAYOUT_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Layout has the same alias ." COM_COMPONENTBUILDER_LAYOUT_GET_SNIPPETS_BUTTON_ACCESS="Layout Get Snippets Button Access" COM_COMPONENTBUILDER_LAYOUT_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the get snippets button." COM_COMPONENTBUILDER_LAYOUT_ID="Id" @@ -7336,10 +7215,7 @@ COM_COMPONENTBUILDER_LAYOUT_NAME_LABEL="Name" COM_COMPONENTBUILDER_LAYOUT_NAME_MESSAGE="Error! Please add name here." COM_COMPONENTBUILDER_LAYOUT_NEW="A New Layout" COM_COMPONENTBUILDER_LAYOUT_NO="No" -COM_COMPONENTBUILDER_LAYOUT_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo JText::_('Text'); ?>
    -<?php echo JText::sprintf('Hello %s', $this->user->name); ?>
    -Just get UPPERCASE language string:
    -<?php echo JustTEXT::_('Text'); ?>" +COM_COMPONENTBUILDER_LAYOUT_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo Text::_('Text'); ?>
    <?php echo Text::sprintf('Hello %s', $this->user->name); ?>
    Just get UPPERCASE language string:
    <?php echo JustTEXT::_('Text'); ?>" COM_COMPONENTBUILDER_LAYOUT_NOTE_ADD_PHP_LANGUAGE_STRING_LABEL="Add PHP Language String" COM_COMPONENTBUILDER_LAYOUT_NOTE_LIBRARIES_SELECTION_DESCRIPTION="All libraries you select will dynamically be added to the header of the page according to the settings of the selected library. Each library will also get its respective buttons added to the component global options if it has any set. Please take a look at the libraries for more details." COM_COMPONENTBUILDER_LAYOUT_NOTE_LIBRARIES_SELECTION_LABEL="Select libraries you would like to use in your code" @@ -7366,14 +7242,14 @@ COM_COMPONENTBUILDER_LIBRARIES_ACCESS_DESC="Allows the users in this group to ac COM_COMPONENTBUILDER_LIBRARIES_BATCH_OPTIONS="Batch process the selected Libraries" COM_COMPONENTBUILDER_LIBRARIES_BATCH_TIP="All changes will be applied to all selected Libraries" COM_COMPONENTBUILDER_LIBRARIES_BATCH_USE="Libraries Batch Use" -COM_COMPONENTBUILDER_LIBRARIES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch libraries" +COM_COMPONENTBUILDER_LIBRARIES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch libraries" COM_COMPONENTBUILDER_LIBRARIES_CONFIG="Libraries Config" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_ACCESS="Libraries Config Access" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_ACCESS_DESC="Allows the users in this group to access access libraries config" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_BATCH_OPTIONS="Batch process the selected Libraries Config" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_BATCH_TIP="All changes will be applied to all selected Libraries Config" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_BATCH_USE="Libraries Config Batch Use" -COM_COMPONENTBUILDER_LIBRARIES_CONFIG_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch libraries config" +COM_COMPONENTBUILDER_LIBRARIES_CONFIG_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch libraries config" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_CREATE="Libraries Config Create" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_CREATE_DESC="Allows the users in this group to create create libraries config" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_DELETE="Libraries Config Delete" @@ -7389,7 +7265,7 @@ COM_COMPONENTBUILDER_LIBRARIES_CONFIG_EDIT_OWN_DESC="Allows the users in this gr COM_COMPONENTBUILDER_LIBRARIES_CONFIG_EDIT_STATE="Libraries Config Edit State" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_EDIT_STATE_DESC="Allows the users in this group to update the state of the library config" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_EDIT_VERSION="Libraries Config Edit Version" -COM_COMPONENTBUILDER_LIBRARIES_CONFIG_EDIT_VERSION_DESC="Allows users in this group to edit versions of version libraries config" +COM_COMPONENTBUILDER_LIBRARIES_CONFIG_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version libraries config" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_N_ITEMS_ARCHIVED="%s Libraries Config archived." COM_COMPONENTBUILDER_LIBRARIES_CONFIG_N_ITEMS_ARCHIVED_1="%s Library Config archived." COM_COMPONENTBUILDER_LIBRARIES_CONFIG_N_ITEMS_CHECKED_IN_0="No Library Config successfully checked in." @@ -7422,14 +7298,14 @@ COM_COMPONENTBUILDER_LIBRARIES_EDIT_OWN_DESC="Allows the users in this group to COM_COMPONENTBUILDER_LIBRARIES_EDIT_STATE="Libraries Edit State" COM_COMPONENTBUILDER_LIBRARIES_EDIT_STATE_DESC="Allows the users in this group to update the state of the library" COM_COMPONENTBUILDER_LIBRARIES_EDIT_VERSION="Libraries Edit Version" -COM_COMPONENTBUILDER_LIBRARIES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version libraries" +COM_COMPONENTBUILDER_LIBRARIES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version libraries" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS="Libraries Files, Folders & URLs" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_ACCESS="Libraries Files Folders Urls Access" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_ACCESS_DESC="Allows the users in this group to access access libraries files folders urls" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_BATCH_OPTIONS="Batch process the selected Libraries Files, Folders & URLs" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_BATCH_TIP="All changes will be applied to all selected Libraries Files, Folders & URLs" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_BATCH_USE="Libraries Files Folders Urls Batch Use" -COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch libraries files folders urls" +COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch libraries files folders urls" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_CREATE="Libraries Files Folders Urls Create" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_CREATE_DESC="Allows the users in this group to create create libraries files folders urls" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_DELETE="Libraries Files Folders Urls Delete" @@ -7445,7 +7321,7 @@ COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_OWN_DESC="Allows the user COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_STATE="Libraries Files Folders Urls Edit State" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_STATE_DESC="Allows the users in this group to update the state of the library files folders urls" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_VERSION="Libraries Files Folders Urls Edit Version" -COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version libraries files folders urls" +COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version libraries files folders urls" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_N_ITEMS_ARCHIVED="%s Libraries Files, Folders & URLs archived." COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_N_ITEMS_ARCHIVED_1="%s Library Files, Folders & URLs archived." COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_N_ITEMS_CHECKED_IN_0="No Library Files, Folders & URLs successfully checked in." @@ -7506,6 +7382,7 @@ COM_COMPONENTBUILDER_LIBRARY_CONFIG_CUSTOM_VALUE_HINT="Custom Value Here" COM_COMPONENTBUILDER_LIBRARY_CONFIG_CUSTOM_VALUE_LABEL="Custom Value" COM_COMPONENTBUILDER_LIBRARY_CONFIG_EDIT="Editing the Library Config" COM_COMPONENTBUILDER_LIBRARY_CONFIG_ERROR_UNIQUE_ALIAS="Another Library Config has the same alias." +COM_COMPONENTBUILDER_LIBRARY_CONFIG_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Library Config has the same alias ." COM_COMPONENTBUILDER_LIBRARY_CONFIG_FIELD="Field" COM_COMPONENTBUILDER_LIBRARY_CONFIG_FIELD_DESCRIPTION="Select a field" COM_COMPONENTBUILDER_LIBRARY_CONFIG_FIELD_LABEL="Field" @@ -7539,6 +7416,7 @@ COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_LABEL="Description" COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_MESSAGE="Error! Please add description here." COM_COMPONENTBUILDER_LIBRARY_EDIT="Editing the Library" COM_COMPONENTBUILDER_LIBRARY_ERROR_UNIQUE_ALIAS="Another Library has the same alias." +COM_COMPONENTBUILDER_LIBRARY_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Library has the same alias ." COM_COMPONENTBUILDER_LIBRARY_EXACT_LENGTH_ONLY_4_TEXT_FIELD="Exact Length (only 4 text_field)" COM_COMPONENTBUILDER_LIBRARY_EXCLUDE="exclude" COM_COMPONENTBUILDER_LIBRARY_FIELD_OPTIONS_HINT="Options here" @@ -7564,6 +7442,7 @@ COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_CREATED_DATE_LABEL="Created Date COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_DEFAULT_LINK="Default (link)" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_EDIT="Editing the Library Files, Folders & URLs" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS="Another Library Files, Folders & URLs has the same alias." +COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Library Files, Folders & URLs has the same alias ." COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_FILE="File" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_FILEPATH_DESCRIPTION="Full System Path" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_FILEPATH_HINT="/home/user/folder/file.php" @@ -7598,42 +7477,7 @@ COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_FULLPATH_LABEL= COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_LABEL="Adding Custom Folders" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_URLS_DESCRIPTION="You can add urls here, and it can be used in three ways. As a direct link (default) or to get the file content and add it to the component (get) or as both local and link (dynamic)" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_URLS_LABEL="Adding Urls" -COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_CONSTANT_PATHS_DESCRIPTION="

    // The path to the administrator folder.
    -JPATH_ADMINISTRATOR
    -// The path to the installed Joomla! site, or JPATH_ROOT/administrator if executed from the backend.
    -JPATH_BASE
    -// The path to the cache folder.
    -JPATH_CACHE
    -// The path to the administration folder of JCB component.
    -JPATH_COMPONENT_ADMINISTRATOR no ideal to use
    -// The path to the site folder of JCB component.
    -JPATH_COMPONENT_SITE no ideal to use
    -// The path to the JCB component.
    -JPATH_COMPONENT no ideal to use
    -// The path to folder containing the configuration.php file.
    -JPATH_CONFIGURATION
    -// The path to the installation folder.
    -JPATH_INSTALLATION
    -// The path to the libraries folder.
    -JPATH_LIBRARIES
    -// The path to the plugins folder.
    -JPATH_PLUGINS
    -// The path to the installed Joomla! site.
    -JPATH_ROOT
    -// The path to the installed Joomla! site.
    -JPATH_SITE
    -// The path to the templates folder.
    -JPATH_THEMES

    - -

    JPATH_SITE is meant to represent the root path of the JSite application,
    -just as JPATH_ADMINISTRATOR is mean to represent the root path of the JAdministrator application.
    -JPATH_BASE is the root path for the current requested application.... so if you are in the administrator application:
    -JPATH_BASE == JPATH_ADMINISTRATOR
    -If you are in the site application:
    -JPATH_BASE == JPATH_SITE
    -If you are in the installation application:
    -JPATH_BASE == JPATH_INSTALLATION.
    -JPATH_ROOT is the root path for the Joomla install and does not depend upon any application.

    " +COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_CONSTANT_PATHS_DESCRIPTION="

    // The path to the administrator folder.
    JPATH_ADMINISTRATOR
    // The path to the installed Joomla! site, or JPATH_ROOT/administrator if executed from the backend.
    JPATH_BASE
    // The path to the cache folder.
    JPATH_CACHE
    // The path to the administration folder of JCB component.
    JPATH_COMPONENT_ADMINISTRATOR no ideal to use
    // The path to the site folder of JCB component.
    JPATH_COMPONENT_SITE no ideal to use
    // The path to the JCB component.
    JPATH_COMPONENT no ideal to use
    // The path to folder containing the configuration.php file.
    JPATH_CONFIGURATION
    // The path to the installation folder.
    JPATH_INSTALLATION
    // The path to the libraries folder.
    JPATH_LIBRARIES
    // The path to the plugins folder.
    JPATH_PLUGINS
    // The path to the installed Joomla! site.
    JPATH_ROOT
    // The path to the installed Joomla! site.
    JPATH_SITE
    // The path to the templates folder.
    JPATH_THEMES

    JPATH_SITE is meant to represent the root path of the JSite application,
    just as JPATH_ADMINISTRATOR is mean to represent the root path of the JAdministrator application.
    JPATH_BASE is the root path for the current requested application.... so if you are in the administrator application:
    JPATH_BASE == JPATH_ADMINISTRATOR
    If you are in the site application:
    JPATH_BASE == JPATH_SITE
    If you are in the installation application:
    JPATH_BASE == JPATH_INSTALLATION.
    JPATH_ROOT is the root path for the Joomla install and does not depend upon any application.

    " COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_CONSTANT_PATHS_LABEL="Constant Paths" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTNEW_DESCRIPTION="Should file be updated." COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTNEW_LABEL="Update" @@ -7741,17 +7585,26 @@ COM_COMPONENTBUILDER_LIBRARY_VERSION_DESC="A count of the number of times this L COM_COMPONENTBUILDER_LIBRARY_VERSION_LABEL="Version" COM_COMPONENTBUILDER_LICENSE="License" COM_COMPONENTBUILDER_LICENSE_S="License: %s" +COM_COMPONENTBUILDER_LINE="line" +COM_COMPONENTBUILDER_LINES="lines" COM_COMPONENTBUILDER_LINK="Link" COM_COMPONENTBUILDER_LINK_LOCAL_DYNAMIC="Link & Local (dynamic)" COM_COMPONENTBUILDER_LINK_TO_THE_CONTRIBUTOR="Link to the contributor" COM_COMPONENTBUILDER_LIST_FIELD="List Field" COM_COMPONENTBUILDER_LIST_VIEW="List View" COM_COMPONENTBUILDER_LOADING="loading" +COM_COMPONENTBUILDER_LOADING_THE_PRIVATE_KEY_FILE_FAILED="Loading the private key file failed" +COM_COMPONENTBUILDER_LOADING_THE_PRIVATE_KEY_TEXT_FAILED="Loading the private key text failed" COM_COMPONENTBUILDER_LOCAL="Local" COM_COMPONENTBUILDER_LOCAL_GET="Local (get)" +COM_COMPONENTBUILDER_LOCAL_POWERS_REPOSITORY_PATH="Local Powers Repository Path" COM_COMPONENTBUILDER_LOCAL_SNIPPET="Local snippet" +COM_COMPONENTBUILDER_LOGIN_FAILED="Login failed" COM_COMPONENTBUILDER_MAIN_MENU="Main Menu" +COM_COMPONENTBUILDER_MAKE_A_DIFFERENCE_WITH_JCB="Make a Difference with JCB" +COM_COMPONENTBUILDER_MANUAL="Manual" COM_COMPONENTBUILDER_MATCH_BEHAVIOUR="Match Behaviour" +COM_COMPONENTBUILDER_MATCH_CASE="Match Case" COM_COMPONENTBUILDER_MATCH_FIELD="Match Field" COM_COMPONENTBUILDER_MATCH_OPTIONS="Match Options" COM_COMPONENTBUILDER_MAX_LENGTH_ONLY_FOUR_TEXT_FIELD="Max Length (only 4 text_field)" @@ -7759,11 +7612,13 @@ COM_COMPONENTBUILDER_MERGE="Merge" COM_COMPONENTBUILDER_METHODS="Methods" COM_COMPONENTBUILDER_MINIFY_JAVASCRIPT="Minify JavaScript" COM_COMPONENTBUILDER_MIN_LENGTH_ONLY_FOUR_TEXT_FIELD="Min Length (only 4 text_field)" +COM_COMPONENTBUILDER_MODE="Mode" COM_COMPONENTBUILDER_MODEL_AFTER_MODELLING="Model (after modelling)" COM_COMPONENTBUILDER_MODEL_BEFORE_MODELLING="Model (before modelling)" COM_COMPONENTBUILDER_MODULE="Module" COM_COMPONENTBUILDER_MODULES="Modules" COM_COMPONENTBUILDER_MOVE="Move" +COM_COMPONENTBUILDER_MOVING_OF_THE_S_FAILED="Moving of the %s failed" COM_COMPONENTBUILDER_NAME="Name" COM_COMPONENTBUILDER_NAME_ASC="Name (Asc)" COM_COMPONENTBUILDER_NAME_DESC="Name (Desc)" @@ -7780,6 +7635,7 @@ COM_COMPONENTBUILDER_NONE_SELECTED="None selected" COM_COMPONENTBUILDER_NOTICE_BOARD="Notice Board" COM_COMPONENTBUILDER_NOTRANSLATION="no-translation" COM_COMPONENTBUILDER_NOT_FOUND_OR_ACCESS_DENIED="Not found, or access denied." +COM_COMPONENTBUILDER_NOT_SAVED="Not saved!" COM_COMPONENTBUILDER_NOT_SET="not set" COM_COMPONENTBUILDER_NOT_TRANSLATED_IN="Not translated in" COM_COMPONENTBUILDER_NO_ACCESS_GRANTED="No Access Granted!" @@ -7791,14 +7647,19 @@ COM_COMPONENTBUILDER_NO_COMPONENT_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_OF_ONE_CO COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_FOR_S="No cronjob path found for (%s)" COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_SINCE_INCORRECT_TYPE_REQUESTED="No cronjob path found since incorrect type requested." COM_COMPONENTBUILDER_NO_DESCRIPTION_FOUND="No description found." +COM_COMPONENTBUILDER_NO_FIELDS_WHERE_SELECTED="No fields where selected!" COM_COMPONENTBUILDER_NO_FILES_LINKED="No Files Linked" COM_COMPONENTBUILDER_NO_FOUND="No Found" +COM_COMPONENTBUILDER_NO_INSTANCES_WHERE_FOUND_IN_S="No instances where found in %s" COM_COMPONENTBUILDER_NO_ITEM_FOUND="No Item Found" COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY="No keys were found. To add an export key simply open the component, go to the tab called settings, bottom right there is a field called Export Key." COM_COMPONENTBUILDER_NO_LANGUAGES_FOUND="No Languages Found" COM_COMPONENTBUILDER_NO_LANGUAGES_UPDATE_SERVER_FOUND="No Languages Update server found." +COM_COMPONENTBUILDER_NO_NAMESPACE_FOUND="No Namespace Found" COM_COMPONENTBUILDER_NO_NEED_TO_GET_IT_SINCE_IT_IS_ALREADY_IN_SYNC_WITH_YOUR_LOCAL_VERSION="No need to get it since it is already in sync with your local version" +COM_COMPONENTBUILDER_NO_PATHS_FOUND="No Paths Found" COM_COMPONENTBUILDER_NO_RESULTS_MATCH="No results match" +COM_COMPONENTBUILDER_NO_SELECTION_DETECTED="No selection detected" COM_COMPONENTBUILDER_NO_SNIPPETS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN="No snippets were selected, please make a selection and try again!" COM_COMPONENTBUILDER_NO_S_FOUND="No %s Found" COM_COMPONENTBUILDER_NO_S_HAVE_BEEN_LINKED_TO_THIS_VIEW_SOON_AS_THIS_IS_DONE_IT_WILL_BE_DISPLAYED_HERE="No %s have been linked to this view. Soon as this is done it will be displayed here." @@ -7829,6 +7690,9 @@ COM_COMPONENTBUILDER_PAIDLOCKED="Paid/Locked" COM_COMPONENTBUILDER_PATH_CODESCODE="Path: %s" COM_COMPONENTBUILDER_PATH_TO_THE_ZIPPED_PACKAGE_IS_CODESCODE_BR_S_S="Path to the zipped package is: %s
    %s %s" COM_COMPONENTBUILDER_PERMISSIONS="Permissions" +COM_COMPONENTBUILDER_PERMISSION_DENIED="Permission Denied!" +COM_COMPONENTBUILDER_PFILE_AT_BSSB_GAVE_THE_FOLLOWING_ERRORBR_SP="

    File at %s/%s gave the following error!
    %s

    " +COM_COMPONENTBUILDER_PJOOMLA_POWER_BGUIDSB_NOT_FOUNDP="

    Joomla Power guid:%s not found!

    " COM_COMPONENTBUILDER_PLACEHOLDER="Placeholder" COM_COMPONENTBUILDER_PLACEHOLDERS="Placeholders" COM_COMPONENTBUILDER_PLACEHOLDERS_ACCESS="Placeholders Access" @@ -7836,7 +7700,7 @@ COM_COMPONENTBUILDER_PLACEHOLDERS_ACCESS_DESC="Allows the users in this group to COM_COMPONENTBUILDER_PLACEHOLDERS_BATCH_OPTIONS="Batch process the selected Placeholders" COM_COMPONENTBUILDER_PLACEHOLDERS_BATCH_TIP="All changes will be applied to all selected Placeholders" COM_COMPONENTBUILDER_PLACEHOLDERS_BATCH_USE="Placeholders Batch Use" -COM_COMPONENTBUILDER_PLACEHOLDERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch placeholders" +COM_COMPONENTBUILDER_PLACEHOLDERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch placeholders" COM_COMPONENTBUILDER_PLACEHOLDERS_CREATE="Placeholders Create" COM_COMPONENTBUILDER_PLACEHOLDERS_CREATE_DESC="Allows the users in this group to create create placeholders" COM_COMPONENTBUILDER_PLACEHOLDERS_DASHBOARD_LIST="Placeholders Dashboard List" @@ -7850,7 +7714,7 @@ COM_COMPONENTBUILDER_PLACEHOLDERS_EDIT_OWN_DESC="Allows the users in this group COM_COMPONENTBUILDER_PLACEHOLDERS_EDIT_STATE="Placeholders Edit State" COM_COMPONENTBUILDER_PLACEHOLDERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the placeholder" COM_COMPONENTBUILDER_PLACEHOLDERS_EDIT_VERSION="Placeholders Edit Version" -COM_COMPONENTBUILDER_PLACEHOLDERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version placeholders" +COM_COMPONENTBUILDER_PLACEHOLDERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version placeholders" COM_COMPONENTBUILDER_PLACEHOLDERS_EXPORT="Placeholders Export" COM_COMPONENTBUILDER_PLACEHOLDERS_EXPORT_DESC="Allows the users in this group to export export placeholders" COM_COMPONENTBUILDER_PLACEHOLDERS_IMPORT="Placeholders Import" @@ -7885,42 +7749,14 @@ COM_COMPONENTBUILDER_PLACEHOLDER_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_PLACEHOLDER_DETAILS="Details" COM_COMPONENTBUILDER_PLACEHOLDER_EDIT="Editing the Placeholder" COM_COMPONENTBUILDER_PLACEHOLDER_ERROR_UNIQUE_ALIAS="Another Placeholder has the same alias." +COM_COMPONENTBUILDER_PLACEHOLDER_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Placeholder has the same alias ." COM_COMPONENTBUILDER_PLACEHOLDER_ID="Id" COM_COMPONENTBUILDER_PLACEHOLDER_MODIFIED_BY_DESC="The last user that modified this Placeholder." COM_COMPONENTBUILDER_PLACEHOLDER_MODIFIED_BY_LABEL="Modified By" COM_COMPONENTBUILDER_PLACEHOLDER_MODIFIED_DATE_DESC="The date this Placeholder was modified." COM_COMPONENTBUILDER_PLACEHOLDER_MODIFIED_DATE_LABEL="Modified Date" COM_COMPONENTBUILDER_PLACEHOLDER_NEW="A New Placeholder" -COM_COMPONENTBUILDER_PLACEHOLDER_NOTE_PLACEHOLDERS_PLACEDIN_DESCRIPTION="" +COM_COMPONENTBUILDER_PLACEHOLDER_NOTE_PLACEHOLDERS_PLACEDIN_DESCRIPTION="" COM_COMPONENTBUILDER_PLACEHOLDER_ORDERING_LABEL="Ordering" COM_COMPONENTBUILDER_PLACEHOLDER_PERMISSION="Permissions" COM_COMPONENTBUILDER_PLACEHOLDER_PUBLISHING="Publishing" @@ -7940,10 +7776,12 @@ COM_COMPONENTBUILDER_PLACEHOLDER_VERSION_LABEL="Version" COM_COMPONENTBUILDER_PLACES_ACROSS_JCB_WHERE_THIS_S_IS_LINKED="Places across JCB where this %s is linked." COM_COMPONENTBUILDER_PLEASE_ADD_FILES_TO_S="Please add files to (%s)" COM_COMPONENTBUILDER_PLEASE_ADD_FOLDERS_TO_S="Please add folders to (%s)" -COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_LATTER="Please check again latter." +COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_LATER="Please check again later" +COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST="Please first make a selection from the list." COM_COMPONENTBUILDER_PLEASE_NOTE_THAT_THIS_PACKAGE_BHAS_NOB_CHECKSUM_VALIDATION="Please note that this package has no checksum validation!" COM_COMPONENTBUILDER_PLEASE_SELECT_A_COMPONENT_THAT_YOU_WOULD_LIKE_TO_COMPILE="Please select a component that you would like to compile." COM_COMPONENTBUILDER_PLEASE_TRY_AGAIN_LATER="Please try again later" +COM_COMPONENTBUILDER_PLEASE_TRY_AGAIN_THIS_ERROR_USUALLY_HAPPENS_IF_IT_IS_A_NEW_COMPONENT_BECAUSE_WE_NEED_A_COMPONENT_ID_TO_DO_THIS_BUILD_WITH_YOUR_SQL_DUMP="Please try again, this error usually happens if it is a new component, because we need a component ID to do this build with your sql dump." COM_COMPONENTBUILDER_PLEASE_WAIT="Please wait!" COM_COMPONENTBUILDER_PLEASE_WAIT_LOADING="Please wait, loading" COM_COMPONENTBUILDER_PLUGIN="Plugin" @@ -7956,7 +7794,7 @@ COM_COMPONENTBUILDER_POWERS_A_HREFS_TARGET_BLANK_TITLEOPEN_POWERSA_WITH_VERSION_ COM_COMPONENTBUILDER_POWERS_BATCH_OPTIONS="Batch process the selected Powers" COM_COMPONENTBUILDER_POWERS_BATCH_TIP="All changes will be applied to all selected Powers" COM_COMPONENTBUILDER_POWERS_BATCH_USE="Powers Batch Use" -COM_COMPONENTBUILDER_POWERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch powers" +COM_COMPONENTBUILDER_POWERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch powers" COM_COMPONENTBUILDER_POWERS_CREATE="Powers Create" COM_COMPONENTBUILDER_POWERS_CREATE_DESC="Allows the users in this group to create create powers" COM_COMPONENTBUILDER_POWERS_DASHBOARD_LIST="Powers Dashboard List" @@ -7975,7 +7813,7 @@ COM_COMPONENTBUILDER_POWERS_EDIT_OWN_DESC="Allows the users in this group to edi COM_COMPONENTBUILDER_POWERS_EDIT_STATE="Powers Edit State" COM_COMPONENTBUILDER_POWERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the power" 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_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version powers" COM_COMPONENTBUILDER_POWERS_NAME="Name" COM_COMPONENTBUILDER_POWERS_N_ITEMS_ARCHIVED="%s Powers archived." COM_COMPONENTBUILDER_POWERS_N_ITEMS_ARCHIVED_1="%s Power archived." @@ -7999,11 +7837,26 @@ COM_COMPONENTBUILDER_POWERS_N_ITEMS_UNPUBLISHED_1="%s Power unpublished." COM_COMPONENTBUILDER_POWERS_SUBMENU="Powers Submenu" COM_COMPONENTBUILDER_POWERS_SUBMENU_DESC="Allows the users in this group to submenu of power" COM_COMPONENTBUILDER_POWER_ABSTRACT_CLASS="abstract class" +COM_COMPONENTBUILDER_POWER_ACCESS_POINT_DESCRIPTION="Library path to the autoload.php file" +COM_COMPONENTBUILDER_POWER_ACCESS_POINT_HINT="custom_folder/vendor/autoload.php (must be in the .../public_html/library/ folder of Joomla)" +COM_COMPONENTBUILDER_POWER_ACCESS_POINT_LABEL="Access Point" +COM_COMPONENTBUILDER_POWER_ACCESS_POINT_MESSAGE="Error! Please add autoload full path here." COM_COMPONENTBUILDER_POWER_ADD_HEAD_DESCRIPTION="You can add your own custom header script, combined with the default header script that make the extended class work." COM_COMPONENTBUILDER_POWER_ADD_HEAD_LABEL="Add Custom Class Header" +COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_DESCRIPTION="The option to override the licensing template." +COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_LABEL="Add Licensing Template" +COM_COMPONENTBUILDER_POWER_APPROVED="Approved" +COM_COMPONENTBUILDER_POWER_APPROVED_DESCRIPTION="When you approve a power, it will be added to your local powers folder once linked to a component, and this super power feature is activated. There are two ways to activate this feature, one is in the advanced options on the compiler page, and the other is in the global options of JCB." +COM_COMPONENTBUILDER_POWER_APPROVED_LABEL="Super Power" +COM_COMPONENTBUILDER_POWER_APPROVED_PATHS_DESCRIPTION="Select the paths this power should be added to." +COM_COMPONENTBUILDER_POWER_APPROVED_PATHS_LABEL="Approved Paths" COM_COMPONENTBUILDER_POWER_AS_LABEL="as" +COM_COMPONENTBUILDER_POWER_AUTOLOAD_COMPOSER_NOTE_DESCRIPTION="

    Once you have manually pulled composer classes into your own custom folder in libraries area (via composer), you can link it here.

    So this feature gives you the ability to add your own custom composer set of classes to your project. Yes, you will still have to manually pull them into your own custom and unique folder into the libraries area of Joomla (on this JCB development system). But you can link it here and JCB will take care of adding it to your component.

    First and most importantly (due to obvious risk of collusion), avoid pulling classes into your custom set of composer classes that are already included in the Joomla vendor folder. Those classes that Joomla loads are already available to you. To use them, just add the use Namespace; of that class to the header of this power, and the PHP auto linker will take care of the rest.

    So all composer projects =>(vendor folders) has an autoload.php file that is located in the root of the vendor folder. We call this the access point to that cluster of classes. This means you will have one access point for multiple namespaces.

    Due the continued risk of collusion we allow only one access point per/power. But for even more peace of mind, it is best to have only one access point per/project. Which means you should try to consolidate your custom composer additional classes (outside of the Joomla vendor folder) into one vendor folder. This will result in one access point, that you will use multiple times for various powers.

    Should you want JCB to load the composer classes to your component, you will have to manually link it to the Component Files & Folders area. This is the best option for now (and will always work), but we will soon improve the Library area in JCB to also take care of PHP libraries. Once this option becomes available we will give notice of the change here.

    " +COM_COMPONENTBUILDER_POWER_AUTOLOAD_COMPOSER_NOTE_LABEL="When to use Autoloader Composer Powers?" COM_COMPONENTBUILDER_POWER_CLASS="class" COM_COMPONENTBUILDER_POWER_CODE="Code" +COM_COMPONENTBUILDER_POWER_COMPOSER="Composer" +COM_COMPONENTBUILDER_POWER_COMPOSER_LABEL="Autoloader Composer Powers" COM_COMPONENTBUILDER_POWER_CREATED_BY_DESC="The user that created this Power." COM_COMPONENTBUILDER_POWER_CREATED_BY_LABEL="Created By" COM_COMPONENTBUILDER_POWER_CREATED_DATE_DESC="The date this Power was created." @@ -8013,6 +7866,7 @@ COM_COMPONENTBUILDER_POWER_DESCRIPTION_HINT="Add Description Here" COM_COMPONENTBUILDER_POWER_DESCRIPTION_LABEL="Description" COM_COMPONENTBUILDER_POWER_EDIT="Editing the Power" COM_COMPONENTBUILDER_POWER_ERROR_UNIQUE_ALIAS="Another Power has the same alias." +COM_COMPONENTBUILDER_POWER_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Power has the same alias ." COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_DESCRIPTION="The custom class, this class should extend" COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_LABEL="Extends - Custom" COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_MESSAGE="Error! Please add the custom class, this class should extend." @@ -8030,11 +7884,16 @@ COM_COMPONENTBUILDER_POWER_IMPLEMENTS_CUSTOM_LABEL="Implements interface(s) - Cu COM_COMPONENTBUILDER_POWER_IMPLEMENTS_CUSTOM_MESSAGE="Error! Please add the custom interface(s) this class must implement." COM_COMPONENTBUILDER_POWER_IMPLEMENTS_DESCRIPTION="The interface(s), this class should implement." COM_COMPONENTBUILDER_POWER_IMPLEMENTS_LABEL="Implements interface(s)" +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_INTERFACE="interface" +COM_COMPONENTBUILDER_POWER_JOOMLASUPERPOWERS="joomla/super-powers" +COM_COMPONENTBUILDER_POWER_LICENSING="Licensing" +COM_COMPONENTBUILDER_POWER_LICENSING_TEMPLATE_HINT="/** * @package Joomla.Component.Builder * * @created 4th September, 2015 * @author Llewellyn van der Merwe * @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */" +COM_COMPONENTBUILDER_POWER_LICENSING_TEMPLATE_LABEL="Licensing Template" COM_COMPONENTBUILDER_POWER_LOAD="Load" COM_COMPONENTBUILDER_POWER_LOAD_LABEL="load" -COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_DESCRIPTION="

    When you would like to load a power to the project, but you do not want that power to be part of the use namespace declarations in the header of this power.

    -

    You do not need to again select any power that is already selected in the Extends, Implements, or Use Selection fields, since they are already being loaded.

    " +COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_DESCRIPTION="

    When you would like to load a power to the project, but you do not want that power to be part of the use namespace declarations in the header of this power.

    You do not need to again select any power that is already selected in the Extends, Implements, or Use Selection fields, since they are already being loaded.

    " COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_LABEL="When to Load Powers Here?" COM_COMPONENTBUILDER_POWER_LOAD_SELECTION_DESCRIPTION="Select powers that you want to make sure also load when this power is loaded." COM_COMPONENTBUILDER_POWER_LOAD_SELECTION_LABEL="Load Powers" @@ -8049,29 +7908,7 @@ COM_COMPONENTBUILDER_POWER_MODIFIED_BY_LABEL="Modified By" COM_COMPONENTBUILDER_POWER_MODIFIED_DATE_DESC="The date this Power was modified." COM_COMPONENTBUILDER_POWER_MODIFIED_DATE_LABEL="Modified Date" COM_COMPONENTBUILDER_POWER_NAMESPACE_DESCRIPTION="Add the namespace of this class." -COM_COMPONENTBUILDER_POWER_NAMESPACE_DETAILS_DESCRIPTION="
    -

    We will use the namespace value to build the folder structure and filename. This namespace will also directly be used as the use declaration wherever you link this power. Therefore the namespace declared here must end with the filename, and this file name must match the case of the terminating class name.
    -Example (namespace): ComponentName\Sub\ClassName
    -JCB will build the following file path
    -Example (filepath): root/libraries/jcb_powers/ComponentName.Sub/src/ClassName.php
    -With a four section namespace
    -Example (namespace): ComponentName\Sub\Type\ClassName
    -JCB will build the following file path
    -Example (filepath): root/libraries/jcb_powers/ComponentName.Sub.Type/src/ClassName.php
    -To add a folder inside the src folder use [.] in class name
    -Example (namespace): ComponentName\Sub\Util.ClassName
    -Example (JCB builds this namespace): ComponentName\Sub\Util\ClassName
    -JCB will build the following file path
    -Example (filepath): root/libraries/jcb_powers/ComponentName.Sub/src/Util/ClassName.php

    - -

    The component placeholder also works in namespacing, as well as normal placeholders:
    -Example: [[[Component]]]\SubNamespaceNames\ClassName

    - -

    We will also use the namespacing for auto loading in your project wherever you link this power.

    -

    The jcb_powers can be changed globally and per/component (soon).
    Make your powers load system wide with a plugin (soon).

    - -

    For more info on how all this works: https://www.php-fig.org/psr/psr-4/

    -
    " +COM_COMPONENTBUILDER_POWER_NAMESPACE_DETAILS_DESCRIPTION="

    We will use the namespace value to build the folder structure and filename. This namespace will also directly be used as the use declaration wherever you link this power. Therefore the namespace declared here must end with the filename, and this file name must match the case of the terminating class name.
    Example (namespace): ComponentName\Sub\ClassName
    JCB will build the following file path
    Example (filepath): root/libraries/jcb_powers/ComponentName.Sub/src/ClassName.php
    With a four section namespace
    Example (namespace): ComponentName\Sub\Type\ClassName
    JCB will build the following file path
    Example (filepath): root/libraries/jcb_powers/ComponentName.Sub.Type/src/ClassName.php
    To add a folder inside the src folder use [.] in class name
    Example (namespace): ComponentName\Sub\Util.ClassName
    Example (JCB builds this namespace): ComponentName\Sub\Util\ClassName
    JCB will build the following file path
    Example (filepath): root/libraries/jcb_powers/ComponentName.Sub/src/Util/ClassName.php

    The component placeholder also works in namespacing, as well as normal placeholders:
    Example: [[[Component]]]\SubNamespaceNames\ClassName

    We will also use the namespacing for auto loading in your project wherever you link this power.

    The jcb_powers can be changed globally and per/component (soon).
    Make your powers load system wide with a plugin (soon).

    For more info on how all this works: https://www.php-fig.org/psr/psr-4/

    " COM_COMPONENTBUILDER_POWER_NAMESPACE_DETAILS_LABEL="Namespacing in JCB" COM_COMPONENTBUILDER_POWER_NAMESPACE_HINT="ComponentName\Powers\ClassName" COM_COMPONENTBUILDER_POWER_NAMESPACE_LABEL="Namespace" @@ -8082,10 +7919,14 @@ COM_COMPONENTBUILDER_POWER_NAME_LABEL="Name" COM_COMPONENTBUILDER_POWER_NAME_MESSAGE="Error! Please add name here." COM_COMPONENTBUILDER_POWER_NEW="A New Power" COM_COMPONENTBUILDER_POWER_NO="No" +COM_COMPONENTBUILDER_POWER_NOTE_APPROVED_PATHS_DESCRIPTION="

    Select the sub paths inside the local path where you would like to add this power. The default is the core JCB path which is joomla/super-powers (this can be changed in the global options)

    To set the local path, and to add more sub paths, open the JCB global options, and look for the super power tab, there you will find all the instructions needed.

    " +COM_COMPONENTBUILDER_POWER_NOTE_APPROVED_PATHS_LABEL="Super Powers Repositories" COM_COMPONENTBUILDER_POWER_NOTE_LINKED_TO_NOTICE_DESCRIPTION="
    Searching the database.
    " COM_COMPONENTBUILDER_POWER_NOTE_LINKED_TO_NOTICE_LABEL="Linked To" +COM_COMPONENTBUILDER_POWER_NOT_APPROVED="Not Approved" COM_COMPONENTBUILDER_POWER_NOT_REQUIRED="Not Required" COM_COMPONENTBUILDER_POWER_ORDERING_LABEL="Ordering" +COM_COMPONENTBUILDER_POWER_OVERRIDE="Override" COM_COMPONENTBUILDER_POWER_PERMISSION="Permissions" COM_COMPONENTBUILDER_POWER_POWER_VERSION_DESCRIPTION="Add Version Number Here" COM_COMPONENTBUILDER_POWER_POWER_VERSION_HINT="1.0.0" @@ -8096,10 +7937,13 @@ COM_COMPONENTBUILDER_POWER_PROPERTY_LABEL="Properties" COM_COMPONENTBUILDER_POWER_PROPERTY_SELECTION_DESCRIPTION="Select properties you want to use in your power." COM_COMPONENTBUILDER_POWER_PROPERTY_SELECTION_LABEL="Property Selection" COM_COMPONENTBUILDER_POWER_PUBLISHING="Publishing" +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_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Power to customise the alias." COM_COMPONENTBUILDER_POWER_STATUS="Status" +COM_COMPONENTBUILDER_POWER_SUPER_POWER="Super Power" COM_COMPONENTBUILDER_POWER_SYSTEM_NAME_DESCRIPTION="Used only in the system." COM_COMPONENTBUILDER_POWER_SYSTEM_NAME_HINT="The System Name Here" COM_COMPONENTBUILDER_POWER_SYSTEM_NAME_LABEL="System Name" @@ -8108,19 +7952,24 @@ COM_COMPONENTBUILDER_POWER_TRAIT="trait" COM_COMPONENTBUILDER_POWER_TYPE_DESCRIPTION="The type of power being build" COM_COMPONENTBUILDER_POWER_TYPE_LABEL="Type of Power" COM_COMPONENTBUILDER_POWER_USE="Use" -COM_COMPONENTBUILDER_POWER_USE_LABEL="use" +COM_COMPONENTBUILDER_POWER_USE_GLOBAL="Use Global" +COM_COMPONENTBUILDER_POWER_USE_HINT="Name\Project\ClassName" +COM_COMPONENTBUILDER_POWER_USE_LABEL="Use" +COM_COMPONENTBUILDER_POWER_USE_MESSAGE="Error! Please add namespace here." COM_COMPONENTBUILDER_POWER_USE_SELECTION_DESCRIPTION="Select namespace you want to use in your power." COM_COMPONENTBUILDER_POWER_USE_SELECTION_LABEL="Use Selection" COM_COMPONENTBUILDER_POWER_VERSION_DESC="A count of the number of times this Power has been revised." COM_COMPONENTBUILDER_POWER_VERSION_LABEL="Version" COM_COMPONENTBUILDER_POWER_YES="Yes" COM_COMPONENTBUILDER_PPOWER_BGUIDSB_NOT_FOUNDP="

    Power guid:%s not found!

    " +COM_COMPONENTBUILDER_PRE_RELEASE="Pre Release" COM_COMPONENTBUILDER_PROPERTIES="Properties" COM_COMPONENTBUILDER_PROPERTIESBR_SMALLHERE_YOU_CAN_SET_THE_PROPERTIES_FOR_THIS_FIELDSMALL="Properties
    Here you can set the properties for this field." COM_COMPONENTBUILDER_PROPERTY="Property" COM_COMPONENTBUILDER_PROPERTY_ALREADY_SELECTED_TRY_ANOTHER="Property already selected, try another." COM_COMPONENTBUILDER_PROPERTY_NAME="Property Name" COM_COMPONENTBUILDER_PROPERTY_VALUE="Property Value" +COM_COMPONENTBUILDER_PSUPER_POWERB_REPOSITORY_AT_BSSB_GAVE_THE_FOLLOWING_ERRORBR_SP="

    Super Power repository at %s/%s gave the following error!
    %s

    " COM_COMPONENTBUILDER_PS_NAMING_MISMATCH_ERROR_SPPTHE_S_NAME_IS_BSB_AND_THE_ENDING_FILE_NAME_IN_THE_NAMESPACE_IS_BSB_THIS_IS_BAD_CONVENTION_PLEASE_SEE_A_HREFS_PSRFOURA_FOR_MORE_INFOPPA_HREFSCLICK_HEREA_TO_FIX_THIS_ISSUEP="

    %s naming mismatch error (%s)

    The %s name is %s and the ending file name in the namespace is %s. This is bad convention, please see psr-4 for more info.

    Click here to fix this issue.

    " COM_COMPONENTBUILDER_PUBLIC_ACCESS="Public Access" COM_COMPONENTBUILDER_PUBLISHED="Published" @@ -8128,34 +7977,64 @@ COM_COMPONENTBUILDER_PUBLISHING="Publishing" COM_COMPONENTBUILDER_README="Readme" COM_COMPONENTBUILDER_READY_TO_COMPILE_A_COMPONENT="Ready to compile a component" COM_COMPONENTBUILDER_REFRESH="Refresh" +COM_COMPONENTBUILDER_REGEX_SEARCH="Regex Search" COM_COMPONENTBUILDER_REMOVE="Remove" COM_COMPONENTBUILDER_REMOVING_ALL_ZIP_PACKAGES_FROM_THE_TEMPORARY_FOLDER_OF_THE_JOOMLA_INSTALL="Removing all zip packages from the temporary folder of the Joomla install" COM_COMPONENTBUILDER_RENAME="Rename" +COM_COMPONENTBUILDER_REPLACE="Replace" +COM_COMPONENTBUILDER_REPLACED_WITH="replaced with" +COM_COMPONENTBUILDER_REPLACE_PROCESS_COMPLETE="replace process complete" COM_COMPONENTBUILDER_REPORT_AN_ISSUE_BSB="Report an issue: %s" +COM_COMPONENTBUILDER_REQUIRED_FIELDS_MISSING_IN_THE_BMYSQL_TABLES_SOURCE_MAPB_SELECTIONBR_S="Required fields missing in the MySQL -> Tables -> Source Map selection:
    %s" COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_ENTERED_BE_ONE_OF_THE_OPTIONS_IN_AN_ELEMENT_OF_TYPEQUOTLISTQUOT_THAT_IS_THAT_THE_ELEMENT_IS_A_SELECT_LIST="Requires the value entered be one of the options in an element of type="list": that is, that the element is a select list." COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_A_TELEPHONE_NUMBER_COMPLYING_WITH_THE_STANDARDS_OF_NANPA_ITUT_TRECEONE_HUNDRED_AND_SIXTY_FOUR_OR_IETF_RFCFOUR_THOUSAND_NINE_HUNDRED_AND_THIRTY_THREE="Requires the value to be a Telephone number complying with the standards of nanpa, ITU-T T-REC-E.164 or ietf rfc4933." COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_THE_SAME_AS_THAT_HELD_IN_THE_FIELD_NAMED_QUOTFIELDQUOT_EGS="Requires the value to be the same as that held in the field named "field", eg:%s" +COM_COMPONENTBUILDER_RESET="Reset" +COM_COMPONENTBUILDER_RESET_FAILED="Reset Failed!" +COM_COMPONENTBUILDER_REVERTED_THE_B_ASSETSB_TABLE_RULES_COLUMN_BACK_TO_ITS_DEFAULT_SIZE_OF_VARCHARFIVE_THOUSAND_ONE_HUNDRED_AND_TWENTY="Reverted the #__assets table rules column back to its default size of varchar(5120)" COM_COMPONENTBUILDER_REVERT_ALL_AHEAD_SNIPPETS="Revert All Ahead Snippets" COM_COMPONENTBUILDER_RIGHT_IN_TAB="Right in Tab" COM_COMPONENTBUILDER_RIGHT_OF_TABS="Right of Tabs" COM_COMPONENTBUILDER_RUN_EXPANSION="Run Expansion" +COM_COMPONENTBUILDER_SAVE_ALL_CHANGES_MADE_TO_THE_SELECTED_ITEM="Save all changes made to the selected item." +COM_COMPONENTBUILDER_SAVE_ITEM="Save Item" COM_COMPONENTBUILDER_SAVE_SUCCESS="Great! Item successfully saved." COM_COMPONENTBUILDER_SAVE_WARNING="The value already existed so please select another." COM_COMPONENTBUILDER_SBR_YOU_CAN_ADD_A_BGITHUB_ACCESS_TOKENB_TO_COMPONENTBUILDER_GLOBAL_OPTIONS_TO_MAKE_AUTHENTICATED_REQUESTS_TO_GITHUB_AN_ACCESS_TOKEN_WITH_ONLY_PUBLIC_ACCESS_WILL_DO_TO_RETRIEVE_S="%s
    You can add a gitHub Access Token to Componentbuilder global options to make authenticated requests to gitHub. An access token with only public access will do to retrieve %s." +COM_COMPONENTBUILDER_SEARCH="Search" COM_COMPONENTBUILDER_SEARCHABLE="Searchable" +COM_COMPONENTBUILDER_SEARCHED_FOR="searched for" +COM_COMPONENTBUILDER_SEARCHING="searching" +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_DATABASE_AGAIN="Search Database Again" +COM_COMPONENTBUILDER_SEARCH_DESC="JCB Search" +COM_COMPONENTBUILDER_SEARCH_OR_SEARCH_AND_REPLACE="Search, or Search and Replace" +COM_COMPONENTBUILDER_SEARCH_SUBMENU="Search Submenu" +COM_COMPONENTBUILDER_SEARCH_SUBMENU_DESC="Allows the users in this group to submenu of Search" +COM_COMPONENTBUILDER_SECONDS="seconds" COM_COMPONENTBUILDER_SEE_ALL_IMPORT_INFO="See All Import Info" COM_COMPONENTBUILDER_SELECTION="selection" COM_COMPONENTBUILDER_SELECT_ADMIN_VIEW="Select Admin View" COM_COMPONENTBUILDER_SELECT_AN_ADMIN_VIEW="Select an admin view" COM_COMPONENTBUILDER_SELECT_AN_OPTION="Select an option" +COM_COMPONENTBUILDER_SELECT_APPROVED_PATH="Select Approved Path" +COM_COMPONENTBUILDER_SELECT_A_NAMESPACE="Select a Namespace" COM_COMPONENTBUILDER_SELECT_A_PROPERTY="Select a property" COM_COMPONENTBUILDER_SELECT_A_SITE_VIEW="Select a site view" COM_COMPONENTBUILDER_SELECT_A_SNIPPET="select a snippet" +COM_COMPONENTBUILDER_SELECT_BUILD_DATE="Select Build Date" COM_COMPONENTBUILDER_SELECT_COMPONENT="Select Component" COM_COMPONENTBUILDER_SELECT_EXTENSION="Select Extension" COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_TO_COMPILE="Select the component to compile" +COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_TO_SEARCH="Select the component to search" COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_YOUR_WOULD_LIKE_TO_IMPORT="Select the component your would like to import." COM_COMPONENTBUILDER_SELECT_THE_PACKAGE_TO_IMPORT="Select the package to import" +COM_COMPONENTBUILDER_SELECT_THE_TABLE_TO_SEARCH="Select the table to search" COM_COMPONENTBUILDER_SERVER="Server" COM_COMPONENTBUILDER_SERVERS="Servers" COM_COMPONENTBUILDER_SERVERS_ACCESS="Servers Access" @@ -8163,7 +8042,7 @@ COM_COMPONENTBUILDER_SERVERS_ACCESS_DESC="Allows the users in this group to acce COM_COMPONENTBUILDER_SERVERS_BATCH_OPTIONS="Batch process the selected Servers" COM_COMPONENTBUILDER_SERVERS_BATCH_TIP="All changes will be applied to all selected Servers" COM_COMPONENTBUILDER_SERVERS_BATCH_USE="Servers Batch Use" -COM_COMPONENTBUILDER_SERVERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch servers" +COM_COMPONENTBUILDER_SERVERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch servers" COM_COMPONENTBUILDER_SERVERS_CREATE="Servers Create" COM_COMPONENTBUILDER_SERVERS_CREATE_DESC="Allows the users in this group to create create servers" COM_COMPONENTBUILDER_SERVERS_DASHBOARD_LIST="Servers Dashboard List" @@ -8181,7 +8060,7 @@ COM_COMPONENTBUILDER_SERVERS_EDIT_OWN_DESC="Allows the users in this group to ed COM_COMPONENTBUILDER_SERVERS_EDIT_STATE="Servers Edit State" COM_COMPONENTBUILDER_SERVERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the server" COM_COMPONENTBUILDER_SERVERS_EDIT_VERSION="Servers Edit Version" -COM_COMPONENTBUILDER_SERVERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version servers" +COM_COMPONENTBUILDER_SERVERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version servers" COM_COMPONENTBUILDER_SERVERS_EXPORT="Servers Export" COM_COMPONENTBUILDER_SERVERS_EXPORT_DESC="Allows the users in this group to export export servers" COM_COMPONENTBUILDER_SERVERS_IMPORT="Servers Import" @@ -8218,6 +8097,7 @@ COM_COMPONENTBUILDER_SERVER_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_SERVER_DETAILS="Details" COM_COMPONENTBUILDER_SERVER_EDIT="Editing the Server" COM_COMPONENTBUILDER_SERVER_ERROR_UNIQUE_ALIAS="Another Server has the same alias." +COM_COMPONENTBUILDER_SERVER_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Server has the same alias ." COM_COMPONENTBUILDER_SERVER_FTP="FTP" COM_COMPONENTBUILDER_SERVER_HOST_DESCRIPTION="Add the server host name/IP here" COM_COMPONENTBUILDER_SERVER_HOST_HINT="yourhost.com" @@ -8256,21 +8136,7 @@ COM_COMPONENTBUILDER_SERVER_PRIVATE_DESCRIPTION="Set the path to the private key COM_COMPONENTBUILDER_SERVER_PRIVATE_HINT="/home/username/.ssh/id_rsa" COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_DESCRIPTION="Add your private key here! Yes this field is encrypted in the DB, but if your DB gets compromised this key must also be considered compromised! The system path option is considered more secure and seen as best practice." COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_FILE_PATH="Private Key - File Path" -COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_HINT="-----BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQDPF9uyDuHtD+sCYBaEIV34uAc+eRa62souVUcmsVwKUUBbk7sY -bnO6ixjouEbhis1L4m854895tJ99SSPu5cXxYTFimCJDjp47fjro4x8js9em10kK -VCP2fP60/jO+mTruGc25C1SksMtRj5XlsGW3avoOV2RjsqAwKxhk6AUF6QIDAQAB -AoGAYGGlMOB2S2NeJ7PaptH0rz3OuUeXyYzsDdZIj/x5bp/UCQrfR4aYO9hi1mR1 -MKDt3QRcaZ/ZvrXOiHuSyquLjG0R1tVVR+OZE+haBSunUUq05ZFT7zUJRPHVKoSK -QOV/c831tCA5gCUupXiaak/vYMZRf+xs9wHDyuZstEoU8tUCQQD/GGV/8cuiYQK4 -MlpXgvOeYEYayhbQ80qe2aVolQIlRXyY6N9dV1lfbUO8rlTJ2EDVOFc8NDkPHf2f -xzbplDCDAkEAz9PhT8ji8fJgKuDAhWDXF0TuwVWk2hjtYCVGsksE3w16lv9OCwoK -UuWOY2b7wEYh0y8Z9AKBDHM1xhS8Bl7MIwJBANAkNd1Zi5Aom7Fz1GcHQIR/hXQi -ZM+FU+OdLuvQeXmz4uBZUre0qAXG/7gafrBbNTtEx1kmO1BsZh9Syyl3csUCQQDF -MD4pm2tpMRV52YIRi07J70ex/PbLULd5cCTh6jgXAwz71AVSiBY/jTtKqV3YkzJo -09oGIZIcI/wzk1zLloqNAkB8qHxAtmUZFdo5sssaUDTOB82QAPfiHUqIFPaYuc0f -4NqtXZm+fv4liR3QJEo8zkiBs3NjBnm7Hh3BMSqGh3d+ ------END RSA PRIVATE KEY-----" +COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_HINT="-----BEGIN RSA PRIVATE KEY-----MIICXQIBAAKBgQDPF9uyDuHtD+sCYBaEIV34uAc+eRa62souVUcmsVwKUUBbk7sYbnO6ixjouEbhis1L4m854895tJ99SSPu5cXxYTFimCJDjp47fjro4x8js9em10kKVCP2fP60/jO+mTruGc25C1SksMtRj5XlsGW3avoOV2RjsqAwKxhk6AUF6QIDAQABAoGAYGGlMOB2S2NeJ7PaptH0rz3OuUeXyYzsDdZIj/x5bp/UCQrfR4aYO9hi1mR1MKDt3QRcaZ/ZvrXOiHuSyquLjG0R1tVVR+OZE+haBSunUUq05ZFT7zUJRPHVKoSKQOV/c831tCA5gCUupXiaak/vYMZRf+xs9wHDyuZstEoU8tUCQQD/GGV/8cuiYQK4MlpXgvOeYEYayhbQ80qe2aVolQIlRXyY6N9dV1lfbUO8rlTJ2EDVOFc8NDkPHf2fxzbplDCDAkEAz9PhT8ji8fJgKuDAhWDXF0TuwVWk2hjtYCVGsksE3w16lv9OCwoKUuWOY2b7wEYh0y8Z9AKBDHM1xhS8Bl7MIwJBANAkNd1Zi5Aom7Fz1GcHQIR/hXQiZM+FU+OdLuvQeXmz4uBZUre0qAXG/7gafrBbNTtEx1kmO1BsZh9Syyl3csUCQQDFMD4pm2tpMRV52YIRi07J70ex/PbLULd5cCTh6jgXAwz71AVSiBY/jTtKqV3YkzJo09oGIZIcI/wzk1zLloqNAkB8qHxAtmUZFdo5sssaUDTOB82QAPfiHUqIFPaYuc0f4NqtXZm+fv4liR3QJEo8zkiBs3NjBnm7Hh3BMSqGh3d+-----END RSA PRIVATE KEY-----" COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_LABEL="PRIVATE KEY
    (encrypted field)" COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_TEXT_FIELD="Private Key - Text Field" COM_COMPONENTBUILDER_SERVER_PRIVATE_LABEL="Private Key Path
    (encrypted field)" @@ -8296,6 +8162,7 @@ COM_COMPONENTBUILDER_SERVER_VERSION_DESC="A count of the number of times this Se COM_COMPONENTBUILDER_SERVER_VERSION_LABEL="Version" COM_COMPONENTBUILDER_SET_A_CLASS_VALUE_FOR_THE_LIST_VIEW_OF_THIS_FIELD="Set a class value for the list view of this field." COM_COMPONENTBUILDER_SET_CUSTOM="Set Custom" +COM_COMPONENTBUILDER_SET_THE_SEARCH_BEHAVIOUR_HERE="Set the search behaviour here." COM_COMPONENTBUILDER_SHARE_SNIPPETS="Share Snippets" COM_COMPONENTBUILDER_SHOULD_JCB_ADD_ANY_POWERS_THAT_ARE_CONNECTED_TO_THIS_COMPONENT_THIS_MAY_BE_HELPFUL_IF_YOU_ARE_LOADING_POWERS_VIA_ANOTHER_COMPONENT_AND_WOULD_LIKE_TO_AVOID_ADDING_IT_TO_BOTH_JUST_REMEMBER_THAT_IN_THIS_CASE_YOU_NEED_TO_LOAD_THE_POWERS_VIA_A_PLUGIN="Should JCB add any powers that are connected to this component? This may be helpful if you are loading powers via another component, and would like to avoid adding it to both, just remember that in this case you need to load the powers via a plugin." COM_COMPONENTBUILDER_SHOULD_JCB_INSERT_THE_CUSTOM_CODE_PLACEHOLDERS_THIS_IS_ONLY_APPLICABLE_IF_THIS_COMPONENT_HAS_CUSTOM_CODE="Should JCB insert the custom code placeholders? This is only applicable if this component has custom code." @@ -8306,6 +8173,7 @@ COM_COMPONENTBUILDER_SHOULD_THIS_FIELD_BE_ESCAPED_IN_THE_LIST_VIEW="Should this COM_COMPONENTBUILDER_SHOULD_WE_BE_SHOWING_MORE_ELABORATE_INFORMATION_DURING_IMPORT="Should we be showing more elaborate information during import." COM_COMPONENTBUILDER_SHOULD_WE_FORCE_THE_UPDATE_OF_ALL_LOCAL_DATA_EVEN_IF_IT_IS_NEWER_THEN_THE_DATA_BEING_IMPORTED="Should we force the update of all local data, even if it is newer then the data being imported." COM_COMPONENTBUILDER_SHOULD_WE_MERGE_THE_COMPONENTS_WITH_SIMILAR_LOCAL_COMPONENTS_MERGING_THE_COMPONENTS_USE_TO_BE_THE_DEFAULT_BEHAVIOUR_BUT_NOW_YOU_CAN_IMPORT_THE_COMPONENTS_AND_FORCE_IT_NOT_TO_MERGE_THE_FOLLOWING_AREAS_VALIDATION_RULE_FIELDTYPE_SNIPPET_LANGUAGE_LANGUAGE_TRANSLATION_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS_CLASS_PROPERTY_CLASS_METHOD_BMUST_AND_WILL_STILLB_MERGE_EVEN_OF_YOUR_SELECTION_IS_BNOB_BECAUSE_OF_THE_SINGULAR_NATURE_OF_THOSE_AREAS="Should we merge the component/s with similar local component/s. Merging the component/s use to be the default behaviour, but now you can import the component/s and force it not to merge. The following areas (validation_rule, fieldtype, snippet, language, language_translation, joomla_plugin_group, class_extends, class_property, class_method) must and will still merge even of your selection is No, because of the singular nature of those areas." +COM_COMPONENTBUILDER_SHOW_ADVANCED_OPTIONS="Show Advanced Options" COM_COMPONENTBUILDER_SHOW_IN_ALL_LIST_VIEWS="Show in All List Views" COM_COMPONENTBUILDER_SHOW_ONLY="Show Only" COM_COMPONENTBUILDER_SHOW_TOGGLE="Show Toggle" @@ -8318,11 +8186,9 @@ COM_COMPONENTBUILDER_SITE_VIEWS_ACCESS_DESC="Allows the users in this group to a COM_COMPONENTBUILDER_SITE_VIEWS_BATCH_OPTIONS="Batch process the selected Site Views" COM_COMPONENTBUILDER_SITE_VIEWS_BATCH_TIP="All changes will be applied to all selected Site Views" 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_BATCH_USE_DESC="Allows the 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" @@ -8335,7 +8201,7 @@ COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_OWN_DESC="Allows the users in this group to COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_STATE="Site Views Edit State" COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_STATE_DESC="Allows the users in this group to update the state of the site view" COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_VERSION="Site Views Edit Version" -COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version site views" +COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version site views" COM_COMPONENTBUILDER_SITE_VIEWS_EXPORT="Site Views Export" COM_COMPONENTBUILDER_SITE_VIEWS_EXPORT_DESC="Allows the users in this group to export export site views" COM_COMPONENTBUILDER_SITE_VIEWS_IMPORT="Site Views Import" @@ -8371,8 +8237,8 @@ COM_COMPONENTBUILDER_SITE_VIEW_ADD_JAVASCRIPT_FILE_LABEL="Add JavaScript (file)" COM_COMPONENTBUILDER_SITE_VIEW_ADD_JS_DOCUMENT_LABEL="Add JS (custom document script)" COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_AJAX_LABEL="Add PHP (AJAX)" COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_DOCUMENT_LABEL="Add PHP (custom document script)" -COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_JVIEW_DISPLAY_LABEL="Add PHP (custom JViewLegacy display)" -COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_JVIEW_LABEL="Add PHP (custom JViewLegacy methods)" +COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_JVIEW_DISPLAY_LABEL="Add PHP (custom HtmlView display)" +COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_JVIEW_LABEL="Add PHP (custom HtmlView methods)" COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_VIEW_LABEL="Add PHP (custom view script)" COM_COMPONENTBUILDER_SITE_VIEW_AJAX_INPUT_LABEL="Ajax Input" COM_COMPONENTBUILDER_SITE_VIEW_ALLOW_ZERO_DESCRIPTION="null & zero values" @@ -8436,8 +8302,7 @@ COM_COMPONENTBUILDER_SITE_VIEW_CLOCK="Clock" COM_COMPONENTBUILDER_SITE_VIEW_CMD="CMD" COM_COMPONENTBUILDER_SITE_VIEW_CODENAME_DESCRIPTION="Add Name in Code Here" COM_COMPONENTBUILDER_SITE_VIEW_CODENAME_HINT="codename" -COM_COMPONENTBUILDER_SITE_VIEW_CODENAME_LABEL="Name in Code
    -Naming Conventions" +COM_COMPONENTBUILDER_SITE_VIEW_CODENAME_LABEL="Name in Code
    Naming Conventions" COM_COMPONENTBUILDER_SITE_VIEW_CODENAME_MESSAGE="Error! Please add name in code here." COM_COMPONENTBUILDER_SITE_VIEW_COG="Cog" COM_COMPONENTBUILDER_SITE_VIEW_COGS="Cogs" @@ -8488,6 +8353,7 @@ COM_COMPONENTBUILDER_SITE_VIEW_ENVELOPE="Envelope" COM_COMPONENTBUILDER_SITE_VIEW_ENVELOPE_OPENED="Envelope Opened" COM_COMPONENTBUILDER_SITE_VIEW_EQUALIZER="Equalizer" COM_COMPONENTBUILDER_SITE_VIEW_ERROR_UNIQUE_ALIAS="Another Site View has the same alias." +COM_COMPONENTBUILDER_SITE_VIEW_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Site View has the same alias ." COM_COMPONENTBUILDER_SITE_VIEW_EXIT="Exit" COM_COMPONENTBUILDER_SITE_VIEW_EXPAND="Expand" COM_COMPONENTBUILDER_SITE_VIEW_EXPAND_2="Expand 2" @@ -8595,10 +8461,7 @@ COM_COMPONENTBUILDER_SITE_VIEW_NEW_TAB_2="New Tab 2" COM_COMPONENTBUILDER_SITE_VIEW_NEXT="Next" COM_COMPONENTBUILDER_SITE_VIEW_NO="No" COM_COMPONENTBUILDER_SITE_VIEW_NONE="None" -COM_COMPONENTBUILDER_SITE_VIEW_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo JText::_('Text'); ?>
    -<?php echo JText::sprintf('Hello %s', $this->user->name); ?>
    -Just get UPPERCASE language string:
    -<?php echo JustTEXT::_('Text'); ?>" +COM_COMPONENTBUILDER_SITE_VIEW_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo Text::_('Text'); ?>
    <?php echo Text::sprintf('Hello %s', $this->user->name); ?>
    Just get UPPERCASE language string:
    <?php echo JustTEXT::_('Text'); ?>" COM_COMPONENTBUILDER_SITE_VIEW_NOTE_ADD_PHP_LANGUAGE_STRING_LABEL="Add PHP Language String" COM_COMPONENTBUILDER_SITE_VIEW_NOTE_CUSTOM_TOOLBAR_PLACEHOLDER_DESCRIPTION="Use this placeholder in the body [[[SITE_TOOLBAR]]] to add the custom position of the toolbar." COM_COMPONENTBUILDER_SITE_VIEW_NOTE_LIBRARIES_SELECTION_DESCRIPTION="All libraries you select will dynamically be added to the header of the page according to the settings of the selected library. Each library will also get its respective buttons added to the component global options if it has any set. Please take a look at the libraries for more details." @@ -8754,7 +8617,7 @@ COM_COMPONENTBUILDER_SNIPPETS_ACCESS_DESC="Allows the users in this group to acc COM_COMPONENTBUILDER_SNIPPETS_BATCH_OPTIONS="Batch process the selected Snippets" COM_COMPONENTBUILDER_SNIPPETS_BATCH_TIP="All changes will be applied to all selected Snippets" COM_COMPONENTBUILDER_SNIPPETS_BATCH_USE="Snippets Batch Use" -COM_COMPONENTBUILDER_SNIPPETS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch snippets" +COM_COMPONENTBUILDER_SNIPPETS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch snippets" COM_COMPONENTBUILDER_SNIPPETS_COULD_NOT_BE_UPDATEDSAVED="Snippets could not be updated/saved" COM_COMPONENTBUILDER_SNIPPETS_CREATE="Snippets Create" COM_COMPONENTBUILDER_SNIPPETS_CREATE_DESC="Allows the users in this group to create create snippets" @@ -8769,7 +8632,7 @@ COM_COMPONENTBUILDER_SNIPPETS_EDIT_OWN_DESC="Allows the users in this group to e COM_COMPONENTBUILDER_SNIPPETS_EDIT_STATE="Snippets Edit State" COM_COMPONENTBUILDER_SNIPPETS_EDIT_STATE_DESC="Allows the users in this group to update the state of the snippet" COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION="Snippets Edit Version" -COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version snippets" +COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version snippets" COM_COMPONENTBUILDER_SNIPPETS_EXPORT="Snippets Export" COM_COMPONENTBUILDER_SNIPPETS_EXPORT_DESC="Allows the users in this group to export export snippets" COM_COMPONENTBUILDER_SNIPPETS_IMPORT="Snippets Import" @@ -8823,6 +8686,7 @@ COM_COMPONENTBUILDER_SNIPPET_DESCRIPTION_LABEL="Description" COM_COMPONENTBUILDER_SNIPPET_DETAILS="Details" COM_COMPONENTBUILDER_SNIPPET_EDIT="Editing the Snippet" COM_COMPONENTBUILDER_SNIPPET_ERROR_UNIQUE_ALIAS="Another Snippet has the same alias." +COM_COMPONENTBUILDER_SNIPPET_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Snippet has the same alias ." COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS="Snippet Get Snippets Button Access" COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the get snippets button." COM_COMPONENTBUILDER_SNIPPET_GUID_DESCRIPTION="Globally Unique Identifier" @@ -8862,7 +8726,7 @@ COM_COMPONENTBUILDER_SNIPPET_TYPES_ACCESS_DESC="Allows the users in this group t COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_OPTIONS="Batch process the selected Snippet Types" COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_TIP="All changes will be applied to all selected Snippet Types" COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_USE="Snippet Types Batch Use" -COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch snippet types" +COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch snippet types" COM_COMPONENTBUILDER_SNIPPET_TYPES_CREATE="Snippet Types Create" COM_COMPONENTBUILDER_SNIPPET_TYPES_CREATE_DESC="Allows the users in this group to create create snippet types" COM_COMPONENTBUILDER_SNIPPET_TYPES_DELETE="Snippet Types Delete" @@ -8874,7 +8738,7 @@ COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_OWN_DESC="Allows the users in this group COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_STATE="Snippet Types Edit State" COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_STATE_DESC="Allows the users in this group to update the state of the snippet type" COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_VERSION="Snippet Types Edit Version" -COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version snippet types" +COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version snippet types" COM_COMPONENTBUILDER_SNIPPET_TYPES_N_ITEMS_ARCHIVED="%s Snippet Types archived." COM_COMPONENTBUILDER_SNIPPET_TYPES_N_ITEMS_ARCHIVED_1="%s Snippet Type archived." COM_COMPONENTBUILDER_SNIPPET_TYPES_N_ITEMS_CHECKED_IN_0="No Snippet Type successfully checked in." @@ -8906,6 +8770,7 @@ COM_COMPONENTBUILDER_SNIPPET_TYPE_DESCRIPTION_MESSAGE="Error! Please add descrip COM_COMPONENTBUILDER_SNIPPET_TYPE_DETAILS="Details" COM_COMPONENTBUILDER_SNIPPET_TYPE_EDIT="Editing the Snippet Type" COM_COMPONENTBUILDER_SNIPPET_TYPE_ERROR_UNIQUE_ALIAS="Another Snippet Type has the same alias." +COM_COMPONENTBUILDER_SNIPPET_TYPE_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Snippet Type has the same alias ." COM_COMPONENTBUILDER_SNIPPET_TYPE_ID="Id" COM_COMPONENTBUILDER_SNIPPET_TYPE_LABEL="Type" COM_COMPONENTBUILDER_SNIPPET_TYPE_MODIFIED_BY_DESC="The last user that modified this Snippet Type." @@ -8941,6 +8806,10 @@ COM_COMPONENTBUILDER_SORRY_THIS_PLACEHOLDER_IS_ALREADY_IN_USE_IN_THE_COMPILER="S COM_COMPONENTBUILDER_SORRY_THIS_VALIDATION_RULE_NAME_S_ALREADY_EXIST_AS_PART_OF_THE_JOOMLA_CORE_NO_NEED_TO_CREATE_IT_IF_YOU_ARE_ADAPTING_IT_GIVE_IT_YOUR_OWN_UNIQUE_NAME="Sorry this validation rule name (%s) already exist as part of the Joomla core! No need to create it, if you are adapting it give it your own unique name." COM_COMPONENTBUILDER_SORRY_THIS_VALIDATION_RULE_NAME_S_ALREADY_EXIST_IN_YOUR_SYSTEM="Sorry this validation rule name (%s) already exist in your system!" COM_COMPONENTBUILDER_SORTABLE="Sortable" +COM_COMPONENTBUILDER_SOURCE_CODE="source code" +COM_COMPONENTBUILDER_SOURCE_CODE_FOR_JOOMLA_COMPONENT="Source Code for Joomla Component" +COM_COMPONENTBUILDER_START_A_SEARCH="Start a Search" +COM_COMPONENTBUILDER_STOP_A_SEARCH="Stop a Search" COM_COMPONENTBUILDER_SUBMENU="Submenu" COM_COMPONENTBUILDER_SUBMENU_ADMIN_VIEWS="Admin Views" COM_COMPONENTBUILDER_SUBMENU_COMPILER="Compiler" @@ -8955,20 +8824,27 @@ COM_COMPONENTBUILDER_SUBMENU_HELP_DOCUMENTS="Help Documents" COM_COMPONENTBUILDER_SUBMENU_JOOMLA_COMPONENTS="Joomla Components" COM_COMPONENTBUILDER_SUBMENU_JOOMLA_MODULES="Joomla Modules" COM_COMPONENTBUILDER_SUBMENU_JOOMLA_PLUGINS="Joomla Plugins" +COM_COMPONENTBUILDER_SUBMENU_JOOMLA_POWERS="Joomla Powers" COM_COMPONENTBUILDER_SUBMENU_LANGUAGES="Languages" COM_COMPONENTBUILDER_SUBMENU_LANGUAGE_TRANSLATIONS="Language Translations" COM_COMPONENTBUILDER_SUBMENU_LAYOUTS="Layouts" COM_COMPONENTBUILDER_SUBMENU_LIBRARIES="Libraries" COM_COMPONENTBUILDER_SUBMENU_PLACEHOLDERS="Placeholders" COM_COMPONENTBUILDER_SUBMENU_POWERS="Powers" +COM_COMPONENTBUILDER_SUBMENU_SEARCH="Search" COM_COMPONENTBUILDER_SUBMENU_SERVERS="Servers" COM_COMPONENTBUILDER_SUBMENU_SITE_VIEWS="Site Views" COM_COMPONENTBUILDER_SUBMENU_SNIPPETS="Snippets" COM_COMPONENTBUILDER_SUBMENU_TEMPLATES="Templates" COM_COMPONENTBUILDER_SUBMENU_VALIDATION_RULES="Validation Rules" +COM_COMPONENTBUILDER_SUCCESS="Success" +COM_COMPONENTBUILDER_SUCCESSFULLY_INITIALIZED_ALL_REMOTE_JOOMLA_POWERS="Successfully Initialized all Remote Joomla Powers" +COM_COMPONENTBUILDER_SUCCESSFULLY_INITIALIZED_ALL_REMOTE_POWERS="Successfully Initialized all Remote Powers" COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED="Success! The snippet was saved." COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED_BUT_THE_MODIFIED_DATE_COULD_NOT_BE_ADJUSTED_BR_BR_BTHIS_MEANS_THE_SNIPPETS_WILL_CONTINUE_TO_APPEAR_OUT_OF_DATEB="Success! The snippet was saved. But the modified date could not be adjusted.

    This means the snippets will continue to appear out of date." -COM_COMPONENTBUILDER_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM="%szdEQzdmVsMHBtRW50T%sQFlvVXJTM3J2IXM=" +COM_COMPONENTBUILDER_SUPER_POWER="Super Power" +COM_COMPONENTBUILDER_SUPPORT_JCB_TODAY="Support JCB Today" +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="Support Joomla Component Builder (JCB) with a financial donation to show gratitude for the time and effort saved in your development process. Your contribution, no matter the size, will be appreciated by the project's team and the wider community. Help ensure the growth and relevance of this essential tool." COM_COMPONENTBUILDER_SZIP_COULD_NOT_BE_INSTALLED="%s.zip could not be installed!" COM_COMPONENTBUILDER_SZIP_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION="%s.zip was removed the from tmp folder during installation!" COM_COMPONENTBUILDER_S_BEING_IMPORTED="%s Being Imported" @@ -8978,6 +8854,9 @@ COM_COMPONENTBUILDER_S_S_NUMBER_BSB_COULD_NOT_BE_DOWNLOADED_SUCCESSFULLY_TO_THIS COM_COMPONENTBUILDER_S_WE_DETECTED_A_CHANGE_IN_BEXTERNALCODEB_BUT_YOU_DO_NOT_HAVE_PERMISSION_TO_ALLOW_THIS_CHANGE_SO_BSB_WAS_REMOVED_FROM_THE_COMPILATION_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFOBR_SMALLADMIN_ACCESS_REQUIREDSMALL="%s, we detected a change in EXTERNALCODE, but you do not have permission to allow this change so %s was removed from the compilation. Please contact your system administrator for more info!
    (admin access required)" COM_COMPONENTBUILDER_S_WE_DETECTED_BNEW_EXTERNALCODEB_BUT_YOU_DO_NOT_HAVE_PERMISSION_TO_ALLOW_THIS_NEW_CODESTRING_SO_BSB_WAS_REMOVED_FROM_THE_COMPILATION_PLEASE_CONTACT_YOU_SYSTEM_ADMINISTRATOR_FOR_MORE_INFOBR_SMALLADMIN_ACCESS_REQUIREDSMALL="%s, we detected NEW EXTERNALCODE, but you do not have permission to allow this new code/string so %s was removed from the compilation. Please contact you system administrator for more info!
    (admin access required)" COM_COMPONENTBUILDER_TAB="Tab" +COM_COMPONENTBUILDER_TABLE="Table" +COM_COMPONENTBUILDER_TABLES="Tables" +COM_COMPONENTBUILDER_TABLES_WITH="tables with" COM_COMPONENTBUILDER_TABLE_BSB_NOT_FOUND_IN_THE_LOCAL_DATABASE_SO_ITS_VALUES_COULD_NOT_BE_IMPORTED_PLEASE_UPDATE_YOUR_JCB_INSTALL_AND_TRY_AGAIN="Table %s not found in the local database so its values could not be imported, please update your JCB install and try again." COM_COMPONENTBUILDER_TABLE_BSB_NOT_FOUND_IN_THE_LOCAL_DATABASE_SO_ITS_VALUES_COULD_NOT_BE_IMPORTED_THE_WHOLE_POWERS_FEATURE_IS_ONLY_AVAILABLE_TO_A_HREFSPRO_MEMBERSA_AT_THIS_TIME="Table %s not found in the local database so its values could not be imported. The whole powers feature is only available to PRO Members at this time." COM_COMPONENTBUILDER_TARGET_BEHAVIOUR="Target Behaviour" @@ -8991,7 +8870,7 @@ COM_COMPONENTBUILDER_TEMPLATES_ACCESS_DESC="Allows the users in this group to ac COM_COMPONENTBUILDER_TEMPLATES_BATCH_OPTIONS="Batch process the selected Templates" COM_COMPONENTBUILDER_TEMPLATES_BATCH_TIP="All changes will be applied to all selected Templates" COM_COMPONENTBUILDER_TEMPLATES_BATCH_USE="Templates Batch Use" -COM_COMPONENTBUILDER_TEMPLATES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch templates" +COM_COMPONENTBUILDER_TEMPLATES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch templates" COM_COMPONENTBUILDER_TEMPLATES_CREATE="Templates Create" COM_COMPONENTBUILDER_TEMPLATES_CREATE_DESC="Allows the users in this group to create create templates" COM_COMPONENTBUILDER_TEMPLATES_DASHBOARD_ADD="Templates Dashboard Add" @@ -9008,7 +8887,7 @@ COM_COMPONENTBUILDER_TEMPLATES_EDIT_OWN_DESC="Allows the users in this group to COM_COMPONENTBUILDER_TEMPLATES_EDIT_STATE="Templates Edit State" COM_COMPONENTBUILDER_TEMPLATES_EDIT_STATE_DESC="Allows the users in this group to update the state of the template" COM_COMPONENTBUILDER_TEMPLATES_EDIT_VERSION="Templates Edit Version" -COM_COMPONENTBUILDER_TEMPLATES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version templates" +COM_COMPONENTBUILDER_TEMPLATES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version templates" COM_COMPONENTBUILDER_TEMPLATES_EXPORT="Templates Export" COM_COMPONENTBUILDER_TEMPLATES_EXPORT_DESC="Allows the users in this group to export export templates" COM_COMPONENTBUILDER_TEMPLATES_IMPORT="Templates Import" @@ -9057,6 +8936,7 @@ COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_VALUES_DESCRIPTION="Only use dynamic get v COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_VALUES_LABEL="Dynamic Values" COM_COMPONENTBUILDER_TEMPLATE_EDIT="Editing the Template" COM_COMPONENTBUILDER_TEMPLATE_ERROR_UNIQUE_ALIAS="Another Template has the same alias." +COM_COMPONENTBUILDER_TEMPLATE_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Template has the same alias ." COM_COMPONENTBUILDER_TEMPLATE_GET_SNIPPETS_BUTTON_ACCESS="Template Get Snippets Button Access" COM_COMPONENTBUILDER_TEMPLATE_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the get snippets button." COM_COMPONENTBUILDER_TEMPLATE_ID="Id" @@ -9072,10 +8952,7 @@ COM_COMPONENTBUILDER_TEMPLATE_NAME_LABEL="Name" COM_COMPONENTBUILDER_TEMPLATE_NAME_MESSAGE="Error! Please add name here." COM_COMPONENTBUILDER_TEMPLATE_NEW="A New Template" COM_COMPONENTBUILDER_TEMPLATE_NO="No" -COM_COMPONENTBUILDER_TEMPLATE_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo JText::_('Text'); ?>
    -<?php echo JText::sprintf('Hello %s', $this->user->name); ?>
    -Just get UPPERCASE language string:
    -<?php echo JustTEXT::_('Text'); ?>" +COM_COMPONENTBUILDER_TEMPLATE_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo Text::_('Text'); ?>
    <?php echo Text::sprintf('Hello %s', $this->user->name); ?>
    Just get UPPERCASE language string:
    <?php echo JustTEXT::_('Text'); ?>" COM_COMPONENTBUILDER_TEMPLATE_NOTE_ADD_PHP_LANGUAGE_STRING_LABEL="Add PHP Language String" COM_COMPONENTBUILDER_TEMPLATE_NOTE_LIBRARIES_SELECTION_DESCRIPTION="All libraries you select will dynamically be added to the header of the page according to the settings of the selected library. Each library will also get its respective buttons added to the component global options if it has any set. Please take a look at the libraries for more details." COM_COMPONENTBUILDER_TEMPLATE_NOTE_LIBRARIES_SELECTION_LABEL="Select libraries you would like to use in your code" @@ -9104,12 +8981,15 @@ COM_COMPONENTBUILDER_THERE_ARE_NO_NEW_SNIPPETS_AT_THIS_TIME="There are no new sn COM_COMPONENTBUILDER_THERE_ARE_NO_OUT_OF_DATE_SNIPPETS_AT_THIS_TIME="There are no out of date snippets at this time" COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME="There are no snippets to update at this time" COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_IF_THIS_CONTINUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR_OF_A_TYPE_ERROR_IN_THE_FIELDS_DISPLAY_REQUEST="There has been an error, if this continues please inform your system administrator of a type error in the fields display request!" +COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN="There has been an error please try again" COM_COMPONENTBUILDER_THERE_WAS_AN_ERROR_GETTING_THE_PACKAGE_INFO="There was an error getting the package info." COM_COMPONENTBUILDER_THERE_WAS_A_PROBLEM_BNO_VIEW_OR_ID_FOUND_IN_SESSION_OR_VIEW_NOT_ALLOWED_TO_ACCESS_AREAB_WE_COULD_NOT_LOAD_ANY_LINKED_TO_VALUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR="There was a problem, no view or id found in session or view not allowed to access area, we could not load any linked to values. Please inform your system administrator!" COM_COMPONENTBUILDER_THESE_ARE_THE_SAME_PACKAGES_FOUND_ON_A_S_GITHUBA_AND_CAN_BE_IMPORTED_BY_SIMPLY_MAKING_A_SELECTION_AND_THEN_CLICKING_THE_BGET_PACKAGEB_BUTTONBR_SOME_OF_THESE_PACKAGES_WOULD_REQUIRE_A_KEY_SINCE_THEY_ARE_NOT_FREE="These are the same packages found on gitHub and can be imported by simply making a selection and then clicking the [Get Package] button.
    Some of these packages would require a key, since they are not free." COM_COMPONENTBUILDER_THESE_ARE_THE_SAME_PACKAGES_FOUND_ON_A_S_GITHUBA_AND_CAN_BE_IMPORTED_BY_SIMPLY_MAKING_A_SELECTION_AND_THEN_CLICKING_THE_BGET_PACKAGEB_BUTTONBR_SOME_OF_THESE_PACKAGES_WOULD_REQUIRE_A_KEY_SINCE_THEY_ARE_NOT_FREE_A_S_GET_A_KEY_TODAYA="These are the same packages found on gitHub and can be imported by simply making a selection and then clicking the [Get Package] button.
    Some of these packages would require a key, since they are not free. Get a key today!." +COM_COMPONENTBUILDER_THESE_JOOMLA_POWERS_HAVE_SUCCESSFULLY_BEEN_RESET="These Joomla powers have successfully been reset." COM_COMPONENTBUILDER_THESE_OPTIONS_ARE_NOT_AVAILABLE_TO_THE_FIELD_IF_BNONE_DBB_OPTION_IS_SELECTED="These options are not available to the field if None DB option is selected." COM_COMPONENTBUILDER_THESE_OPTIONS_ARE_ONLY_AVAILABLE_TO_THE_FIELD_IF_BSHOW_IN_LIST_VIEWB_OPTION_IS_SELECTED="These options are only available to the field if Show in list view option is selected." +COM_COMPONENTBUILDER_THESE_POWERS_HAVE_SUCCESSFULLY_BEEN_RESET="These powers have successfully been reset." COM_COMPONENTBUILDER_THE_ADMIN_CUSTOM_TABS="The admin custom tabs" COM_COMPONENTBUILDER_THE_ADMIN_FIELDS="The admin fields" COM_COMPONENTBUILDER_THE_ADMIN_FIELDS_CONDITIONS="The admin fields conditions" @@ -9120,6 +9000,7 @@ COM_COMPONENTBUILDER_THE_BNONE_DBB_OPTION_WILL_REMOVE_THIS_FIELD_FROM_BEING_SAVE COM_COMPONENTBUILDER_THE_BONLY_IN_ADMIN_LIST_VIEWB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_ADMIN_LIST_VIEW_NOT_TO_ANY_LINKED_VIEWS="The Only in Admin List View option will only Add this field to the admin list view, not to any linked views." COM_COMPONENTBUILDER_THE_BONLY_IN_LINKED_LIST_VIEWSB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_LINKED_LIST_VIEW_IF_THIS_VIEW_GETS_LINKED_TO_OTHER_VIEW_NOT_TO_THIS_ADMIN_LIST_VIEW="The Only in Linked List Views option will only Add this field to the linked list view, if this view gets linked to other view, not to this admin list view." COM_COMPONENTBUILDER_THE_BPHPSECLIBNETSFTPB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="The phpseclib\NET\SFTP library\class is not available! This library\class should have been added to your libraries/vdm_io/vendor folder. Please contact your system administrator for more info" +COM_COMPONENTBUILDER_THE_BSB_BSB_IS_NOT_AVAILABLE_IN_YOUR_COMPONENT_PLEASE_INSURE_TO_ONLY_USED_S_FOR_A_DYNAMIC_DASHBOARD_THAT_ARE_STILL_LINKED_TO_YOUR_COMPONENT="The %s (%s) is not available in your component! Please insure to only used %s, for a dynamic dashboard, that are still linked to your component." COM_COMPONENTBUILDER_THE_BSB_CUT_SEQUENCE_FAILED_ON_THE_RETURNED_EXTERNAL_CODESTRING_AS_MORE_LINES_HAS_TO_BE_CUT_THEN_WAS_FOUND_IN_THE_CODESTRING_WE_HAVE_COMPLETELY_REMOVED_THE_CODE_PLEASE_CHECK_THIS_CODESTRING="The %s cut sequence failed on the returned external code/string as more lines has to be cut then was found in the code/string. We have completely removed the code. Please check this code/string!" COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_PATH_ON_BSB_SERVER="The %s file could not be moved to %s path on %s server." COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER="The %s file could not be moved to %s server." @@ -9127,11 +9008,13 @@ COM_COMPONENTBUILDER_THE_BSB_IS_NOT_A_VALID_URLPATH="The %s is not a vali COM_COMPONENTBUILDER_THE_BSB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESPHPSECLIBVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="The %s library\class is not available! This library\class should have been added to your libraries/phpseclib/vendor folder. Please contact your system administrator for more info!" COM_COMPONENTBUILDER_THE_BSB_LIBRARY_CAN_NOT_BE_DELETED_OR_THINGS_WILL_BREAK="The %s library can not be deleted, or things will break." COM_COMPONENTBUILDER_THE_BSB_RETURNED_AN_INVALID_STRING="The %s returned an invalid string!" +COM_COMPONENTBUILDER_THE_BSB_VALUE_FOR_THE_DYNAMIC_DASHBOARD_IS_INVALID="The %s value for the dynamic dashboard is invalid." COM_COMPONENTBUILDER_THE_BSHOW_IN_ALL_LIST_VIEWSB_OPTION_WILL_ADD_THIS_FIELD_TO_ALL_LIST_VIEWS_ADMIN_AMP_LINKED="The Show in All List Views option will Add this field to all list views, admin & linked." COM_COMPONENTBUILDER_THE_BSINGLE_FILTERB_SELECTION_OPTION_ALLOWS_THE_USER_TO_SELECT_JUST_ONE_VALUE_IN_THIS_FILTERFIELD="The single filter selection option allows the user to select just one value in this filter/field." COM_COMPONENTBUILDER_THE_CODESTRING_FROM_BSB_HAS_BEEN_ADDED_FOR_THE_BFIRST_TIMEB_PLEASE_IINVESTIGATEI_TO_ENSURE_THE_CORRECT_CODESTRING_WAS_USED_BSHOULD_YOU_NOT_KNOW_ABOUT_THIS_NEW_EXTERNAL_CODESTRING_BEING_ADDED_THEN_THIS_IS_A_SERIOUS_DANGER_AND_REQUIRES_IMMEDIATE_ATTENTIONB_DO_NOT_IGNORE_THIS_WARNING_AS_IT_WILL_ONLY_SHOW_BONCEB="The code/string from %s has been added for the first time. Please investigate to ensure the correct code/string was used! Should you not know about this NEW external code/string being added, then this is a serious danger! and requires immediate attention! Do not ignore this warning as it will only show once." COM_COMPONENTBUILDER_THE_CODESTRING_FROM_BSB_HAS_BEEN_BCHANGEDB_SINCE_THE_LAST_COMPILATION_PLEASE_INVESTIGATE_TO_ENSURE_THE_CHANGES_ARE_SAFE_BSHOULD_YOU_NOT_EXPECT_THIS_CHANGE_TO_THE_EXTERNAL_CODESTRING_BEING_ADDED_THEN_THIS_IS_A_SERIOUS_ISSUE_AND_REQUIRES_IMMEDIATE_ATTENTIONB_DO_NOT_IGNORE_THIS_WARNING_AS_IT_WILL_ONLY_SHOW_BONCEB="The code/string from %s has been changed since the last compilation. Please investigate to ensure the changes are safe! Should you not expect this change to the external code/string being added, then this is a serious issue! and requires immediate attention! Do not ignore this warning as it will only show once." COM_COMPONENTBUILDER_THE_COMPONENT="The Component" +COM_COMPONENTBUILDER_THE_COMPONENTS_LAST_MODIFIED_DATE_WILL_BE_USED="The component's last modified date will be used." COM_COMPONENTBUILDER_THE_COMPONENT_ADMIN_VIEWS="The component admin views" COM_COMPONENTBUILDER_THE_COMPONENT_CONFIG="The component config" COM_COMPONENTBUILDER_THE_COMPONENT_CUSTOM_ADMIN_MENUS="The component custom admin menus" @@ -9142,28 +9025,45 @@ COM_COMPONENTBUILDER_THE_COMPONENT_MODULES="The component modules" COM_COMPONENTBUILDER_THE_COMPONENT_MYSQL_TWEAKS="The component mysql tweaks" COM_COMPONENTBUILDER_THE_COMPONENT_PLACEHOLDERS="The component placeholders" COM_COMPONENTBUILDER_THE_COMPONENT_PLUGINS="The component plugins" +COM_COMPONENTBUILDER_THE_COMPONENT_SITE_ROUTER="The component site router" COM_COMPONENTBUILDER_THE_COMPONENT_SITE_VIEWS="The component site views" COM_COMPONENTBUILDER_THE_COMPONENT_UPDATES="The component updates" 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="The Component with all linked admin views, fields linked to admin views, custom admin views, site views, templates and layouts were cloned successful!" +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="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 JCB's journey." +COM_COMPONENTBUILDER_THE_FILE_PATH_BSB_DOES_NOT_EXIST_AND_WAS_NOT_ADDED="The file path: %s does not exist, and was not added!" +COM_COMPONENTBUILDER_THE_FOLDER_PATH_BSB_DOES_NOT_EXIST_AND_WAS_NOT_ADDED="The folder path: %s does not exist, and was not added!" COM_COMPONENTBUILDER_THE_FTP_CONNECTION_FOR_BSB_COULD_NOT_BE_MADE_PLEASE_CHECK_YOUR_SIGNATURE_DETAILS="The FTP connection for %s could not be made. Please check your signature details!" COM_COMPONENTBUILDER_THE_FTP_SIGNATURE_FOR_BSB_WAS_NOT_WELL_FORMED_PLEASE_CHECK_YOUR_SIGNATURE_DETAILS="The FTP signature for %s was not well formed, please check your signature details!" +COM_COMPONENTBUILDER_THE_INITIALIZATION_OF_THIS_JOOMLA_POWERS_HAS_FAILED="The initialization of this Joomla powers has failed." +COM_COMPONENTBUILDER_THE_INITIALIZATION_OF_THIS_POWERS_HAS_FAILED="The initialization of this powers has failed." +COM_COMPONENTBUILDER_THE_JOOMLA_POWER_HAS_SUCCESSFULLY_BEEN_RESET="The Joomla power has successfully been reset." COM_COMPONENTBUILDER_THE_KEY_OF_THIS_PACKAGE="The key of this package." COM_COMPONENTBUILDER_THE_LIBRARY_CONFIG_FIELDS="The library config fields" COM_COMPONENTBUILDER_THE_LIBRARY_FILES_FOLDERS_URLS="The library files, folders & URLs" +COM_COMPONENTBUILDER_THE_LOCAL_DATABASE_JOOMLA_POWERS_HAS_SUCCESSFULLY_BEEN_SYNCED_WITH_THE_REMOTE_REPOSITORIES="The local database Joomla powers has successfully been synced with the remote repositories." +COM_COMPONENTBUILDER_THE_LOCAL_DATABASE_POWERS_HAS_SUCCESSFULLY_BEEN_SYNCED_WITH_THE_REMOTE_REPOSITORIES="The local database powers has successfully been synced with the remote repositories." COM_COMPONENTBUILDER_THE_LOGIN_TO_BSB_HAS_FAILED_PLEASE_CHECK_THAT_YOUR_DETAILS_ARE_CORRECT="The login to %s has failed, please check that your details are correct!" COM_COMPONENTBUILDER_THE_MODULE_FILES_FOLDERS="The module files & folders" COM_COMPONENTBUILDER_THE_MODULE_UPDATES="The module updates" COM_COMPONENTBUILDER_THE_NAME_OF_THIS_LIBRARY_BSB_CAN_NOT_BE_CHANGED_TO_BSB_OR_THINGS_WILL_BREAK="The name of this library (%s) can not be changed to %s or things will break." COM_COMPONENTBUILDER_THE_NOTICE_BOARD_IS_LOADING="The notice board is loading" +COM_COMPONENTBUILDER_THE_OPTION_TO_ADD_A_DYNAMIC_BUTTON_IS_NOT_AVAILABLE_IN_BOWN_CUSTOM_FIELD_TYPESB_YOU_WILL_HAVE_TO_CUSTOM_CODE_IT="The option to add a dynamic button is not available in own custom field types, you will have to custom code it." COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE="The package key is: %s" COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S="The package key is: %s" COM_COMPONENTBUILDER_THE_PLUGIN_FILES_FOLDERS="The plugin files & folders" COM_COMPONENTBUILDER_THE_PLUGIN_UPDATES="The plugin updates" +COM_COMPONENTBUILDER_THE_POWER_HAS_SUCCESSFULLY_BEEN_RESET="The power has successfully been reset." COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FIELD_COULD_NOT_BE_LOADED_FOR_BSB_SERVER="The private key field could not be loaded for %s server!" COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FILE_COULD_NOT_BE_LOADEDFOUND_FOR_BSB_SERVER="The private key file could not be loaded/found for %s server!" COM_COMPONENTBUILDER_THE_PRO_BOARD_IS_LOADING="The pro board is loading" COM_COMPONENTBUILDER_THE_README_IS_LOADING="The readme is loading" +COM_COMPONENTBUILDER_THE_REPLACE_PROCESS_HAD_AN_ERROR_WITH_TABLE="The replace process had an error with table" +COM_COMPONENTBUILDER_THE_RESET_OF_THESE_JOOMLA_POWERS_HAS_FAILED="The reset of these Joomla powers has failed." +COM_COMPONENTBUILDER_THE_RESET_OF_THESE_POWERS_HAS_FAILED="The reset of these powers has failed." +COM_COMPONENTBUILDER_THE_RESET_OF_THIS_JOOMLA_POWER_HAS_FAILED="The reset of this Joomla power has failed." +COM_COMPONENTBUILDER_THE_RESET_OF_THIS_POWER_HAS_FAILED="The reset of this power has failed." COM_COMPONENTBUILDER_THE_SEARCH_FOR_THE_SNIPPETS_ARE_CASE_SENSITIVE_SO_IF_YOU_CHANGED_THE_LOCAL_BNAMESB_OF_EITHER_OR_THE_BSNIPPET_LIBRARY_OR_SNIPPET_TYPESB_IN_ANY_SMALL_WAY_THE_SYSTEM_WILL_NOT_BE_ABLE_TO_CONNECT_YOUR_LOCAL_SNIPPETS_WITH_THOSE_IN_THE_COMMUNITY_REPOSITORY_SO_WE_STRONGLY_ADVICE_TO_BKEEP_TO_THE_COMMUNITY_NAMINGB_TO_AVOID_MISMATCHING_THAT_WILL_IN_TURN_CAUSE_DUPLICATION_SO_IF_YOU_CHANGED_ANY_NAMES_JUST_CHANGE_THEM_BACK_AND_ALL_WILL_AGAIN_WORK_AS_EXPECTED="The search for the snippets are case sensitive so if you changed the local names of either or the snippet, library or snippet types in any small way, the system will not be able to connect your local snippets with those in the community repository. So we strongly advice to keep to the community naming to avoid mismatching, that will in turn cause duplication. So if you changed any names, just change them back and all will again work as expected." +COM_COMPONENTBUILDER_THE_SEARCH_PROCESS_HAD_AN_ERROR_WITH_TABLE="The search process had an error with table" COM_COMPONENTBUILDER_THE_SERVER_DETAILS_FOR_BID_SB_COULD_NOT_BE_RETRIEVED="The server details for (ID: %s) could not be retrieved!" COM_COMPONENTBUILDER_THE_SNIPPETS_WERE_SUCCESSFULLY_EXPORTED="The Snippets Were Successfully Exported!" COM_COMPONENTBUILDER_THE_SNIPPET_WAS_SUCCESSFULLY_EXPORTED="The Snippet Was Successfully Exported!" @@ -9171,9 +9071,12 @@ COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_S_DAT COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_VALID_DATA="The url (%s) set to retrieve the packages did not return valid data!" COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_EXIST="The url (%s) set to retrieve the packages does not exist!" COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_RETURN_ANY_DATA="The url (%s) set to retrieve the packages does not return any data!" -COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JCB_SYSTEM_HAS_INTERNET_CONNECTION="The wiki can only be loaded when your JCB system has internet connection." +COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JOOMLA_COMPONENT_BUILDER_SYSTEM_HAS_INTERNET_CONNECTION="The wiki can only be loaded when your Joomla Component Builder system has internet connection." COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING="The wiki is loading" +COM_COMPONENTBUILDER_THIS_ADDS_POWERS_TO_A_LOCAL_REPOSITORY_FOLDER_ALL_BAPPROVEDB_POWERS_LINKED_TO_THIS_COMPONENT_WILL_BE_MOVED_TO_YOUR_BLOCALB_POWERS_REPOSITORY_FOLDER_INTO_THEIR_SELECTIVE_TARGET_PATHS_THIS_LOCAL_FOLDER_PATH_MUST_BE_SET_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_BSUPER_POWERB_TAB="This adds powers to a local repository folder. All approved powers, linked to this component, will be moved to your local powers repository folder into their selective target paths. This local folder path must be set in the global options of JCB under the super power tab." COM_COMPONENTBUILDER_THIS_BSB_IS_NOT_LINKED_TO_ANY_OTHER_AREAS_OF_JCB_AT_THIS_TIME="This %s is not linked to any other areas of JCB at this time!" +COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE="This can not be undone, are you sure you want to continue?" +COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_BYOU_HAVE_BEEN_WARNEDB="This can not be undone, you have been warned!" COM_COMPONENTBUILDER_THIS_MAY_TAKE_A_WHILE_DEPENDING_ON_THE_SIZE_OF_YOUR_PROJECT="This may take a while depending on the size of your project." COM_COMPONENTBUILDER_THIS_PACKAGE_BPASSEDB_THE_CHECKSUM_VALIDATIONBR_BR_SMALLMANUALLY_ALSO_VALIDATE_THAT_THE_CORRECT_CHECKSUM_WAS_USEDSMALLBR_THIS_CHECKSUM_BSB_MUST_BE_THE_SAME_AS_THE_ONE_FOUND_A_S_SA="This package PASSED the checksum validation!

    Manually also validate that the correct checksum was used.
    This checksum: %s must be the same as the one found @ " COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY="This package has no key." @@ -9192,6 +9095,7 @@ COM_COMPONENTBUILDER_TRASHED_ITEMS="Trashed items" COM_COMPONENTBUILDER_TRASH_AREA="Trash Area" COM_COMPONENTBUILDER_TUTORIAL_ON_FORKING_JCB_SNIPPETS_BSB="Tutorial on forking JCB snippets: %s" COM_COMPONENTBUILDER_TUTORIAL_ON_MAKING_A_PULL_REQUEST_BSB="Tutorial on making a pull request: %s" +COM_COMPONENTBUILDER_TWO_SPACES="2 Spaces" COM_COMPONENTBUILDER_TYPE="Type" COM_COMPONENTBUILDER_TYPE_ADMIN_CUSTOM_TABS="Admin Custom Tabs" COM_COMPONENTBUILDER_TYPE_ADMIN_FIELDS="Admin Fields" @@ -9212,6 +9116,7 @@ COM_COMPONENTBUILDER_TYPE_COMPONENT_MODULES="Component Modules" COM_COMPONENTBUILDER_TYPE_COMPONENT_MYSQL_TWEAKS="Component mysql Tweaks" COM_COMPONENTBUILDER_TYPE_COMPONENT_PLACEHOLDERS="Component Placeholders" COM_COMPONENTBUILDER_TYPE_COMPONENT_PLUGINS="Component Plugins" +COM_COMPONENTBUILDER_TYPE_COMPONENT_ROUTER="Component Router" COM_COMPONENTBUILDER_TYPE_COMPONENT_SITE_VIEWS="Component Site Views" COM_COMPONENTBUILDER_TYPE_COMPONENT_UPDATES="Component Updates" COM_COMPONENTBUILDER_TYPE_CUSTOM_ADMIN_VIEW="Custom Admin View" @@ -9230,6 +9135,7 @@ COM_COMPONENTBUILDER_TYPE_JOOMLA_PLUGIN="Joomla Plugin" COM_COMPONENTBUILDER_TYPE_JOOMLA_PLUGIN_FILES_FOLDERS_URLS="Joomla Plugin Files, Folders & URLs" COM_COMPONENTBUILDER_TYPE_JOOMLA_PLUGIN_GROUP="Joomla Plugin Group" COM_COMPONENTBUILDER_TYPE_JOOMLA_PLUGIN_UPDATES="Joomla Plugin Updates" +COM_COMPONENTBUILDER_TYPE_JOOMLA_POWER="Joomla Power" COM_COMPONENTBUILDER_TYPE_LANGUAGE="Language" COM_COMPONENTBUILDER_TYPE_LANGUAGE_TRANSLATION="Language Translation" COM_COMPONENTBUILDER_TYPE_LAYOUT="Layout" @@ -9249,7 +9155,9 @@ COM_COMPONENTBUILDER_TYPE_VALIDATION_RULE="Validation Rule" COM_COMPONENTBUILDER_UNACTIVE_ONLY_FOUR_TEXT_FIELD="Unactive (only 4 text_field)" COM_COMPONENTBUILDER_UNDERNEATH_TABS="Underneath Tabs" COM_COMPONENTBUILDER_UPDATE="Update" +COM_COMPONENTBUILDER_UPDATE_ALL="Update All" COM_COMPONENTBUILDER_UPDATE_ALL_DIVERGED_SNIPPETS="Update All Diverged Snippets" +COM_COMPONENTBUILDER_UPDATE_ALL_ITEMS_FOUND_WITH_THIS_DATABASE_SEARCH_WITH_THE_REPLACE_VALUE="Update all items found with this database search, with the replace value." COM_COMPONENTBUILDER_UPDATE_ALL_OUT_DATED_SNIPPETS="Update All Out Dated Snippets" COM_COMPONENTBUILDER_UP_TO_DATE="Up to date" COM_COMPONENTBUILDER_USAGE="Usage" @@ -9267,7 +9175,7 @@ COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS_DESC="Allows the users in this grou COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_OPTIONS="Batch process the selected Validation Rules" COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_TIP="All changes will be applied to all selected Validation Rules" COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE="Validation Rules Batch Use" -COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch validation rules" +COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch validation rules" COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE="Validation Rules Create" COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE_DESC="Allows the users in this group to create create validation rules" COM_COMPONENTBUILDER_VALIDATION_RULES_DASHBOARD_LIST="Validation Rules Dashboard List" @@ -9281,7 +9189,7 @@ COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_OWN_DESC="Allows the users in this gr COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_STATE="Validation Rules Edit State" COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_STATE_DESC="Allows the users in this group to update the state of the validation rule" COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION="Validation Rules Edit Version" -COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version validation rules" +COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version validation rules" COM_COMPONENTBUILDER_VALIDATION_RULES_EXPORT="Validation Rules Export" COM_COMPONENTBUILDER_VALIDATION_RULES_EXPORT_DESC="Allows the users in this group to export export validation rules" COM_COMPONENTBUILDER_VALIDATION_RULES_IMPORT="Validation Rules Import" @@ -9313,6 +9221,7 @@ COM_COMPONENTBUILDER_VALIDATION_RULE_CREATED_DATE_DESC="The date this Validation COM_COMPONENTBUILDER_VALIDATION_RULE_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_VALIDATION_RULE_EDIT="Editing the Validation Rule" COM_COMPONENTBUILDER_VALIDATION_RULE_ERROR_UNIQUE_ALIAS="Another Validation Rule has the same alias." +COM_COMPONENTBUILDER_VALIDATION_RULE_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Validation Rule has the same alias ." COM_COMPONENTBUILDER_VALIDATION_RULE_EXTENDS_FORMRULE="Extends FormRule" COM_COMPONENTBUILDER_VALIDATION_RULE_ID="Id" COM_COMPONENTBUILDER_VALIDATION_RULE_INHERIT_DESCRIPTION="Select an existing validation rule that you would like to adapt." @@ -9360,13 +9269,38 @@ COM_COMPONENTBUILDER_WEBSITE="Website" COM_COMPONENTBUILDER_WEBSITE_OF_S="Website of %s" COM_COMPONENTBUILDER_WEBSITE_S="Website: %s" COM_COMPONENTBUILDER_WE_DID_NOT_CHECK_THE_SNIPPET_IT_SELF_TO_SEE_IF_IT_CHANGED_WE_ONLY_WORK_ON_DATES="We did not check the snippet it self, to see if it changed. We only work on dates." +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="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." +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="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 open-source 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 JCB's journey." +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="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 JCB's journey." COM_COMPONENTBUILDER_WE_FAILED_TO_MOVE_BSB="We failed to move %s!" +COM_COMPONENTBUILDER_WE_FOUND_DYNAMIC_CODE_BALL_IN_ONE_LINEB_AND_IGNORED_IT_PLEASE_REVIEW_S_FOR_MORE_DETAILS="We found dynamic code all in one line, and ignored it! Please review (%s) for more details!" +COM_COMPONENTBUILDER_WE_FOUND_SOME_INSTANCES_IN_S="We found some instances in %s" COM_COMPONENTBUILDER_WE_SUCCESSFULLY_MOVED_BSB="We successfully moved %s!" +COM_COMPONENTBUILDER_WE_WHERE_WAS_UNABLE_TO_TRANSFER_THE_COMPONENT_TO_THE_GIT_REPOSITORY="We where was unable to transfer the component to the git repository:" +COM_COMPONENTBUILDER_WE_WHERE_WAS_UNABLE_TO_TRANSFER_THE_COMPONENT_ZIP_FILE_TO_THE_BACKUP_FOLDER="We where was unable to transfer the component ZIP file to the backup folder:" +COM_COMPONENTBUILDER_WE_WHERE_WAS_UNABLE_TO_TRANSFER_THE_S_MODULE_TO_THE_GIT_REPOSITORY="We where was unable to transfer the (%s) module to the git repository:" +COM_COMPONENTBUILDER_WE_WHERE_WAS_UNABLE_TO_TRANSFER_THE_S_MODULE_ZIP_FILE_TO_THE_BACKUP_FOLDER="We where was unable to transfer the (%s) module zip file to the backup folder:" +COM_COMPONENTBUILDER_WE_WHERE_WAS_UNABLE_TO_TRANSFER_THE_S_PLUGIN_TO_THE_GIT_REPOSITORY="We where was unable to transfer the (%s) plugin to the git repository:" +COM_COMPONENTBUILDER_WE_WHERE_WAS_UNABLE_TO_TRANSFER_THE_S_PLUGIN_ZIP_FILE_TO_THE_BACKUP_FOLDER="We where was unable to transfer the (%s) plugin zip file to the backup folder:" +COM_COMPONENTBUILDER_WHAT_VERSION_OF_JOOMLA_WOULD_YOU_LIKE_TO_TARGET="What version of Joomla would you like to target." +COM_COMPONENTBUILDER_WHICH_TYPE_OF_INDENTATION_WOULD_YOU_LIKE_TO_USE_PLEASE_NOTE_THAT_THIS_DOES_NOT_YET_IMPACT_THE_STATIC_TEMPLATES="Which type of indentation would you like to use? Please note that this does not yet impact the static templates." COM_COMPONENTBUILDER_WHILE_WE_DOWNLOAD_ALL_TWENTY_SIX_COMPILER_GIF_ANIMATIONS_RANDOMLY_USED_IN_THE_COMPILER_GUI_DURING_COMPILATION="While we download all 26 compiler GIF animations randomly used in the compiler GUI during compilation" +COM_COMPONENTBUILDER_WHOLE_WORD="Whole Word" COM_COMPONENTBUILDER_WIKI="Wiki" +COM_COMPONENTBUILDER_WITH="with" +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="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 financial contribution, no matter how small, you are helping to safeguard the future of this open-source project. Neglecting to support JCB could result in its decline and loss as a resource for the community." +COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_DO_A_REVERSE_SEARCH="Would you like to do a reverse search?" +COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_OVERRIDE_THE_BUILD_DATE="Would you like to override the build date." +COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_REPEAT_THE_SAME_SEARCH="Would you like to repeat the same search?" +COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_SEE_THE_ADVANCED_COMPILER_OPTIONS="Would you like to see the advanced compiler options?" COM_COMPONENTBUILDER_YES="Yes" -COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY="Your data is encrypted with a AES 128 bit encryption using the above 32 character key." -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="Your data is encrypted with a AES 128 bit encryption using the above 32 character key. Without this key it will take the current technology with a brute force attack method more then 700 000 000 000 000 000 000 000 000 000 000 years to crack theoretically. Unless they have this key above, so do keep it safe." +COM_COMPONENTBUILDER_YES_UPDATE_ALL="Yes! Update ALL" +COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_UPDATE_BALLB_VALUES_THAT_CAN_BE_FOUND_IN_THE_DATABASE="Your are about to update ALL values that can be found in the database." +COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_UPDATE_ROW="Your are about to update row" +COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_FIVE="Your component will be compiled to work in Joomla 5" +COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_FOUR="Your component will be compiled to work in Joomla 4" +COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_THREE="Your component will be compiled to work in Joomla 3" +COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_TWO_HUNDRED_AND_FIFTY_SIX_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY="Your data is encrypted with a AES 256 bit encryption using the above 32 character key." COM_COMPONENTBUILDER_YOU_ARE_CURRENTLY_VIEWING_THE_TRASHED_ITEMS="You are currently viewing the trashed items." COM_COMPONENTBUILDER_YOU_ARE_CURRENTLY_VIEWING_THE_TRASH_AREA_AND_YOU_DONT_HAVE_ANY_ITEMS_IN_TRASH_AT_THE_MOMENT="You are currently viewing the trash area, and you don't have any items in trash at the moment!" COM_COMPONENTBUILDER_YOU_CAN_DIRECTLY_DOWNLOAD_THE_LATEST_UPDATE_OR_USE_THE_JOOMLA_UPDATE_AREA="You can directly download the latest update, or use the Joomla update area." @@ -9375,10 +9309,14 @@ COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_ACCESS_THE_SERVER_DETAILS_BS_ COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_CLONE_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to clone a component, please contact your system administrator for more help." COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_DOWNLOAD_THE_COMPILER_ANIMATIONS="You do not have permission to download the compiler animations!" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to import a component, please contact your system administrator for more help." +COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INITIALIZE_JOOMLA_POWERS="You do not have permission to initialize Joomla powers" +COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INITIALIZE_POWERS="You do not have permission to initialize powers" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THESE_EXTENSIONS="You do not have permission to install these extensions!" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_COMPONENT="You do not have permission to install the component!" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_MODULE="You do not have permission to install the module!" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_PLUGIN="You do not have permission to install the plugin!" +COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RESET_THIS_JOOMLA_POWER="You do not have permission to reset this Joomla power" +COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RESET_THIS_POWER="You do not have permission to reset this power" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE="You do not have permission to run the expansion module!" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_GET_BOILERPLATE_MODULE="You do not have permission to run the get boilerplate module!" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_TRANSLATOR_MODULE="You do not have permission to run the translator module!" @@ -9388,14 +9326,19 @@ COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_S_S_IS_CONSIDERED_BAD_PRACTIC COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_FUNCTION_NAME="You must add an unique function name." COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_PLACEHOLDER="You must add an unique placeholder." COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_VALIDATION_RULE_NAME="You must add an unique validation rule name." +COM_COMPONENTBUILDER_YOU_MUST_ENABLE_THE_BTIDYB_EXTENSION_IN_YOUR_PHPINI_FILE_SO_WE_CAN_TIDY_UP_YOUR_XML_IF_YOU_NEED_HELP_PLEASE_A_SSTART_HEREA="You must enable the Tidy extension in your php.ini file so we can tidy up your xml! If you need help please start here!" COM_COMPONENTBUILDER_YOU_MUST_FIRST_LINK_AN_ADMIN_OR_A_CUSTOM_ADMIN_VIEW_TO_THIS_COMPONENT_THEN_YOU_CAN_SELECT_IT_HERE="You must first link an admin or a custom admin view to this component, then you can select it here" +COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_JOOMLA_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE="You must first save the Joomla power, before you can use this feature." +COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE="You must first save the power, before you can use this feature." COM_COMPONENTBUILDER_YOU_MUST_SELECT_A_COMPONENT="You must select a component!" COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS="You should add the correct owner details." COM_COMPONENTBUILDER_YOU_SHOULD_ONLY_CONTINUE_THIS_IMPORT_IF_YOU_HAVE_BACKUP_YOUR_COMPONENTS_AND_INSURED_THAT_THE_PACKAGE_OWNER_IS_REPUTABLE="You should only continue this import if you have backup your components, and insured that the package owner is reputable." COM_COMPONENTBUILDER_YOU_WILL_NEED_TO_KNOW_HOW_S_WORKS_BASIC_YOU_WILL_ALSO_NEED_A_S_ACCOUNT_AND_KNOW_HOW_TO_MAKE_A_PULL_REQUEST_ON_GITHUB="you will need to know how %s works (basic). You will also need a %s account and know how to make a pull request on github." +COM_COMPONENTBUILDER_YOU_WILL_REPLACE="You will replace" COM_COMPONENTBUILDER_ZIPPED_FILE_LOCATION="Zipped File Location" COM_COMPONENTBUILDER__ADD_YOUR_PHP_SCRIPT_HERE="// Add your php script here" COM_COMPONENTBUILDER__HAS_BEEN_CHECKED_OUT_BY_S="% has been checked out by %s" +COM_COMPONENTBUILDER__SEARCH_ALL_="- Search All -" COM_COMPONENTBUILDER__SELECT_COMPONENT_="- Select Component -" COM_COMPONENTBUILDER__SELECT_PACKAGE_="- Select Package -" COM_COMPONENTBUILDER__SINCE_YOU_DONT_HAVE_PERMISSION_TO_CREATE_S=", since you don't have permission to create %s!" diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini b/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini index 4e7b3ff77..fb8c2120f 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini @@ -2,7 +2,7 @@ COM_COMPONENTBUILDER="Component Builder" COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_ACCESS="Admins Custom Tabs Access" COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_ACCESS_DESC="Allows the users in this group to access access admins custom tabs" COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_BATCH_USE="Admins Custom Tabs Batch Use" -COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch admins custom tabs" +COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch admins custom tabs" COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_CREATE="Admins Custom Tabs Create" COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_CREATE_DESC="Allows the users in this group to create create admins custom tabs" COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_DELETE="Admins Custom Tabs Delete" @@ -18,15 +18,15 @@ COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_EDIT_OWN_DESC="Allows the users in this COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_EDIT_STATE="Admins Custom Tabs Edit State" COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_EDIT_STATE_DESC="Allows the users in this group to update the state of the admin custom tabs" COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_EDIT_VERSION="Admins Custom Tabs Edit Version" -COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version admins custom tabs" +COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version admins custom tabs" COM_COMPONENTBUILDER_ADMINS_FIELDS_ACCESS="Admins Fields Access" COM_COMPONENTBUILDER_ADMINS_FIELDS_ACCESS_DESC="Allows the users in this group to access access admins fields" COM_COMPONENTBUILDER_ADMINS_FIELDS_BATCH_USE="Admins Fields Batch Use" -COM_COMPONENTBUILDER_ADMINS_FIELDS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch admins fields" +COM_COMPONENTBUILDER_ADMINS_FIELDS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch admins fields" COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_ACCESS="Admins Fields Conditions Access" COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_ACCESS_DESC="Allows the users in this group to access access admins fields conditions" COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_BATCH_USE="Admins Fields Conditions Batch Use" -COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch admins fields conditions" +COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch admins fields conditions" COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_CREATE="Admins Fields Conditions Create" COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_CREATE_DESC="Allows the users in this group to create create admins fields conditions" COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_DELETE="Admins Fields Conditions Delete" @@ -42,7 +42,7 @@ COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_EDIT_OWN_DESC="Allows the users in COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_EDIT_STATE="Admins Fields Conditions Edit State" COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_EDIT_STATE_DESC="Allows the users in this group to update the state of the admin fields conditions" COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_EDIT_VERSION="Admins Fields Conditions Edit Version" -COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version admins fields conditions" +COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version admins fields conditions" COM_COMPONENTBUILDER_ADMINS_FIELDS_CREATE="Admins Fields Create" COM_COMPONENTBUILDER_ADMINS_FIELDS_CREATE_DESC="Allows the users in this group to create create admins fields" COM_COMPONENTBUILDER_ADMINS_FIELDS_DELETE="Admins Fields Delete" @@ -58,11 +58,11 @@ COM_COMPONENTBUILDER_ADMINS_FIELDS_EDIT_OWN_DESC="Allows the users in this group COM_COMPONENTBUILDER_ADMINS_FIELDS_EDIT_STATE="Admins Fields Edit State" COM_COMPONENTBUILDER_ADMINS_FIELDS_EDIT_STATE_DESC="Allows the users in this group to update the state of the admin fields" COM_COMPONENTBUILDER_ADMINS_FIELDS_EDIT_VERSION="Admins Fields Edit Version" -COM_COMPONENTBUILDER_ADMINS_FIELDS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version admins fields" +COM_COMPONENTBUILDER_ADMINS_FIELDS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version admins fields" COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_ACCESS="Admins Fields Relations Access" COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_ACCESS_DESC="Allows the users in this group to access access admins fields relations" COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_BATCH_USE="Admins Fields Relations Batch Use" -COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch admins fields relations" +COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch admins fields relations" COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_CREATE="Admins Fields Relations Create" COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_CREATE_DESC="Allows the users in this group to create create admins fields relations" COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_DELETE="Admins Fields Relations Delete" @@ -78,15 +78,13 @@ COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_EDIT_OWN_DESC="Allows the users in COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_EDIT_STATE="Admins Fields Relations Edit State" COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_EDIT_STATE_DESC="Allows the users in this group to update the state of the admin fields relations" COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_EDIT_VERSION="Admins Fields Relations Edit Version" -COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version admins fields relations" +COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version admins fields relations" COM_COMPONENTBUILDER_ADMIN_VIEWS_ACCESS="Admin Views Access" COM_COMPONENTBUILDER_ADMIN_VIEWS_ACCESS_DESC="Allows the users in this group to access access admin views" 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_BATCH_USE_DESC="Allows the 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" @@ -102,7 +100,7 @@ COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_OWN_DESC="Allows the users in this group t COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_STATE="Admin Views Edit State" COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_STATE_DESC="Allows the users in this group to update the state of the admin view" COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_VERSION="Admin Views Edit Version" -COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version admin views" +COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version admin views" COM_COMPONENTBUILDER_ADMIN_VIEWS_EXPORT="Admin Views Export" COM_COMPONENTBUILDER_ADMIN_VIEWS_EXPORT_DESC="Allows the users in this group to export export admin views" COM_COMPONENTBUILDER_ADMIN_VIEWS_IMPORT="Admin Views Import" @@ -114,7 +112,7 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the use COM_COMPONENTBUILDER_CLASS_EXTENDINGS_ACCESS="Class Extendings Access" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_ACCESS_DESC="Allows the users in this group to access access class extendings" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_USE="Class Extendings Batch Use" -COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch class extendings" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_CREATE="Class Extendings Create" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_CREATE_DESC="Allows the users in this group to create create class extendings" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_DELETE="Class Extendings Delete" @@ -130,11 +128,11 @@ COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_OWN_DESC="Allows the users in this gr COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_STATE="Class Extendings Edit State" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_STATE_DESC="Allows the users in this group to update the state of the class extends" COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_VERSION="Class Extendings Edit Version" -COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version class extendings" +COM_COMPONENTBUILDER_CLASS_EXTENDINGS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version class extendings" COM_COMPONENTBUILDER_CLASS_METHODS_ACCESS="Class Methods Access" COM_COMPONENTBUILDER_CLASS_METHODS_ACCESS_DESC="Allows the users in this group to access access class methods" COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_USE="Class Methods Batch Use" -COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch class methods" COM_COMPONENTBUILDER_CLASS_METHODS_CREATE="Class Methods Create" COM_COMPONENTBUILDER_CLASS_METHODS_CREATE_DESC="Allows the users in this group to create create class methods" COM_COMPONENTBUILDER_CLASS_METHODS_DELETE="Class Methods Delete" @@ -150,7 +148,7 @@ COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_OWN_DESC="Allows the users in this group COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_STATE="Class Methods Edit State" COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_STATE_DESC="Allows the users in this group to update the state of the class method" COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_VERSION="Class Methods Edit Version" -COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version class methods" +COM_COMPONENTBUILDER_CLASS_METHODS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version class methods" COM_COMPONENTBUILDER_CLASS_METHODS_EXPORT="Class Methods Export" COM_COMPONENTBUILDER_CLASS_METHODS_EXPORT_DESC="Allows the users in this group to export export class methods" COM_COMPONENTBUILDER_CLASS_METHODS_IMPORT="Class Methods Import" @@ -158,7 +156,7 @@ COM_COMPONENTBUILDER_CLASS_METHODS_IMPORT_DESC="Allows the users in this group t COM_COMPONENTBUILDER_CLASS_PROPERTIES_ACCESS="Class Properties Access" COM_COMPONENTBUILDER_CLASS_PROPERTIES_ACCESS_DESC="Allows the users in this group to access access class properties" COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_USE="Class Properties Batch Use" -COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch class properties" COM_COMPONENTBUILDER_CLASS_PROPERTIES_CREATE="Class Properties Create" COM_COMPONENTBUILDER_CLASS_PROPERTIES_CREATE_DESC="Allows the users in this group to create create class properties" COM_COMPONENTBUILDER_CLASS_PROPERTIES_DELETE="Class Properties Delete" @@ -174,7 +172,7 @@ COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_OWN_DESC="Allows the users in this gr COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_STATE="Class Properties Edit State" COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_STATE_DESC="Allows the users in this group to update the state of the class property" COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_VERSION="Class Properties Edit Version" -COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version class properties" +COM_COMPONENTBUILDER_CLASS_PROPERTIES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version class properties" COM_COMPONENTBUILDER_CLASS_PROPERTIES_EXPORT="Class Properties Export" COM_COMPONENTBUILDER_CLASS_PROPERTIES_EXPORT_DESC="Allows the users in this group to export export class properties" COM_COMPONENTBUILDER_CLASS_PROPERTIES_IMPORT="Class Properties Import" @@ -196,7 +194,7 @@ COM_COMPONENTBUILDER_COMPILER_TRANSLATE_BUTTON_ACCESS_DESC="Allows the users in COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_ACCESS="Components Admin Views Access" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_ACCESS_DESC="Allows the users in this group to access access components admin views" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_BATCH_USE="Components Admin Views Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components admin views" +COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components admin views" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_CREATE="Components Admin Views Create" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_CREATE_DESC="Allows the users in this group to create create components admin views" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_DELETE="Components Admin Views Delete" @@ -212,11 +210,11 @@ COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_EDIT_OWN_DESC="Allows the users in t COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_EDIT_STATE="Components Admin Views Edit State" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component admin views" COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_EDIT_VERSION="Components Admin Views Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components admin views" +COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components admin views" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_ACCESS="Components Config Access" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_ACCESS_DESC="Allows the users in this group to access access components config" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_BATCH_USE="Components Config Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_CONFIG_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components config" +COM_COMPONENTBUILDER_COMPONENTS_CONFIG_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components config" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_CREATE="Components Config Create" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_CREATE_DESC="Allows the users in this group to create create components config" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_DELETE="Components Config Delete" @@ -232,11 +230,11 @@ COM_COMPONENTBUILDER_COMPONENTS_CONFIG_EDIT_OWN_DESC="Allows the users in this g COM_COMPONENTBUILDER_COMPONENTS_CONFIG_EDIT_STATE="Components Config Edit State" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_EDIT_STATE_DESC="Allows the users in this group to update the state of the component config" COM_COMPONENTBUILDER_COMPONENTS_CONFIG_EDIT_VERSION="Components Config Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_CONFIG_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components config" +COM_COMPONENTBUILDER_COMPONENTS_CONFIG_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components config" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_ACCESS="Components Custom Admin Menus Access" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_ACCESS_DESC="Allows the users in this group to access access components custom admin menus" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_BATCH_USE="Components Custom Admin Menus Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components custom admin menus" +COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components custom admin menus" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_CREATE="Components Custom Admin Menus Create" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_CREATE_DESC="Allows the users in this group to create create components custom admin menus" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_DELETE="Components Custom Admin Menus Delete" @@ -252,11 +250,11 @@ COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_EDIT_OWN_DESC="Allows the use COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_EDIT_STATE="Components Custom Admin Menus Edit State" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component custom admin menus" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_EDIT_VERSION="Components Custom Admin Menus Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components custom admin menus" +COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components custom admin menus" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_ACCESS="Components Custom Admin Views Access" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_ACCESS_DESC="Allows the users in this group to access access components custom admin views" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_BATCH_USE="Components Custom Admin Views Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components custom admin views" +COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components custom admin views" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_CREATE="Components Custom Admin Views Create" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_CREATE_DESC="Allows the users in this group to create create components custom admin views" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_DELETE="Components Custom Admin Views Delete" @@ -272,11 +270,11 @@ COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_EDIT_OWN_DESC="Allows the use COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_EDIT_STATE="Components Custom Admin Views Edit State" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component custom admin views" COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_EDIT_VERSION="Components Custom Admin Views Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components custom admin views" +COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components custom admin views" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_ACCESS="Components Dashboard Access" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_ACCESS_DESC="Allows the users in this group to access access components dashboard" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_BATCH_USE="Components Dashboard Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components dashboard" +COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components dashboard" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_CREATE="Components Dashboard Create" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_CREATE_DESC="Allows the users in this group to create create components dashboard" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_DELETE="Components Dashboard Delete" @@ -292,11 +290,11 @@ COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_EDIT_OWN_DESC="Allows the users in thi COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_EDIT_STATE="Components Dashboard Edit State" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_EDIT_STATE_DESC="Allows the users in this group to update the state of the component dashboard" COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_EDIT_VERSION="Components Dashboard Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components dashboard" +COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components dashboard" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_ACCESS="Components Files Folders Access" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_ACCESS_DESC="Allows the users in this group to access access components files folders" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_BATCH_USE="Components Files Folders Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components files folders" +COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components files folders" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_CREATE="Components Files Folders Create" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_CREATE_DESC="Allows the users in this group to create create components files folders" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_DELETE="Components Files Folders Delete" @@ -312,11 +310,11 @@ COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_OWN_DESC="Allows the users in COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_STATE="Components Files Folders Edit State" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component files folders" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_VERSION="Components Files Folders Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components files folders" +COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components files folders" COM_COMPONENTBUILDER_COMPONENTS_MODULES_ACCESS="Components Modules Access" COM_COMPONENTBUILDER_COMPONENTS_MODULES_ACCESS_DESC="Allows the users in this group to access access components modules" COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_USE="Components Modules Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components modules" COM_COMPONENTBUILDER_COMPONENTS_MODULES_CREATE="Components Modules Create" COM_COMPONENTBUILDER_COMPONENTS_MODULES_CREATE_DESC="Allows the users in this group to create create components modules" COM_COMPONENTBUILDER_COMPONENTS_MODULES_DELETE="Components Modules Delete" @@ -332,11 +330,11 @@ COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_OWN_DESC="Allows the users in this COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_STATE="Components Modules Edit State" COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_STATE_DESC="Allows the users in this group to update the state of the component modules" COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_VERSION="Components Modules Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components modules" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_ACCESS="Components Mysql Tweaks Access" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_ACCESS_DESC="Allows the users in this group to access access components mysql tweaks" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_BATCH_USE="Components Mysql Tweaks Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components mysql tweaks" +COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components mysql tweaks" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_CREATE="Components Mysql Tweaks Create" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_CREATE_DESC="Allows the users in this group to create create components mysql tweaks" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_DELETE="Components Mysql Tweaks Delete" @@ -352,11 +350,11 @@ COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_EDIT_OWN_DESC="Allows the users in COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_EDIT_STATE="Components Mysql Tweaks Edit State" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component mysql tweaks" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_EDIT_VERSION="Components Mysql Tweaks Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components mysql tweaks" +COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components mysql tweaks" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_ACCESS="Components Placeholders Access" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_ACCESS_DESC="Allows the users in this group to access access components placeholders" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_BATCH_USE="Components Placeholders Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components placeholders" +COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components placeholders" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_CREATE="Components Placeholders Create" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_CREATE_DESC="Allows the users in this group to create create components placeholders" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_DELETE="Components Placeholders Delete" @@ -372,11 +370,11 @@ COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_OWN_DESC="Allows the users in COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_STATE="Components Placeholders Edit State" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component placeholders" COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_VERSION="Components Placeholders Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components placeholders" +COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components placeholders" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS="Components Plugins Access" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_ACCESS_DESC="Allows the users in this group to access access components plugins" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE="Components Plugins Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components plugins" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE="Components Plugins Create" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_CREATE_DESC="Allows the users in this group to create create components plugins" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_DELETE="Components Plugins Delete" @@ -392,11 +390,31 @@ COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_OWN_DESC="Allows the users in this COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE="Components Plugins Edit State" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component plugins" COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION="Components Plugins Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components plugins" +COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components plugins" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_ACCESS="Components Routers Access" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_ACCESS_DESC="Allows the users in this group to access access components routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_BATCH_USE="Components Routers Batch Use" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_CREATE="Components Routers Create" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_CREATE_DESC="Allows the users in this group to create create components routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_DELETE="Components Routers Delete" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_DELETE_DESC="Allows the users in this group to delete delete components routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT="Components Routers Edit" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_CREATED_BY="Components Routers Edit Created By" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by components routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_CREATED_DATE="Components Routers Edit Created Date" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created components routers" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_DESC="Allows the users in this group to edit the component router" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_OWN="Components Routers Edit Own" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_OWN_DESC="Allows the users in this group to edit edit own components routers created by them" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_STATE="Components Routers Edit State" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component router" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_VERSION="Components Routers Edit Version" +COM_COMPONENTBUILDER_COMPONENTS_ROUTERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components routers" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_ACCESS="Components Site Views Access" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_ACCESS_DESC="Allows the users in this group to access access components site views" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_BATCH_USE="Components Site Views Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components site views" +COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components site views" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_CREATE="Components Site Views Create" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_CREATE_DESC="Allows the users in this group to create create components site views" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_DELETE="Components Site Views Delete" @@ -412,11 +430,11 @@ COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_EDIT_OWN_DESC="Allows the users in th COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_EDIT_STATE="Components Site Views Edit State" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component site views" COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_EDIT_VERSION="Components Site Views Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components site views" +COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components site views" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_ACCESS="Components Updates Access" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_ACCESS_DESC="Allows the users in this group to access access components updates" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_BATCH_USE="Components Updates Batch Use" -COM_COMPONENTBUILDER_COMPONENTS_UPDATES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components updates" +COM_COMPONENTBUILDER_COMPONENTS_UPDATES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch components updates" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_CREATE="Components Updates Create" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_CREATE_DESC="Allows the users in this group to create create components updates" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_DELETE="Components Updates Delete" @@ -432,16 +450,14 @@ COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_OWN_DESC="Allows the users in this COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_STATE="Components Updates Edit State" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_STATE_DESC="Allows the users in this group to update the state of the component updates" COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_VERSION="Components Updates Edit Version" -COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components updates" +COM_COMPONENTBUILDER_COMPONENTS_UPDATES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version components updates" COM_COMPONENTBUILDER_CONFIGURATION="Component Builder Configuration" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_ACCESS="Custom Admin Views Access" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_ACCESS_DESC="Allows the users in this group to access access custom admin views" 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_BATCH_USE_DESC="Allows the 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" @@ -453,7 +469,7 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_OWN_DESC="Allows the users in this COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_STATE="Custom Admin Views Edit State" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_STATE_DESC="Allows the users in this group to update the state of the custom admin view" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_VERSION="Custom Admin Views Edit Version" -COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version custom admin views" +COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version custom admin views" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EXPORT="Custom Admin Views Export" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EXPORT_DESC="Allows the users in this group to export export custom admin views" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_IMPORT="Custom Admin Views Import" @@ -465,7 +481,7 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows t COM_COMPONENTBUILDER_CUSTOM_CODES_ACCESS="Custom Codes Access" COM_COMPONENTBUILDER_CUSTOM_CODES_ACCESS_DESC="Allows the users in this group to access access custom codes" COM_COMPONENTBUILDER_CUSTOM_CODES_BATCH_USE="Custom Codes Batch Use" -COM_COMPONENTBUILDER_CUSTOM_CODES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch custom codes" +COM_COMPONENTBUILDER_CUSTOM_CODES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch custom codes" COM_COMPONENTBUILDER_CUSTOM_CODES_CREATE="Custom Codes Create" COM_COMPONENTBUILDER_CUSTOM_CODES_CREATE_DESC="Allows the users in this group to create create custom codes" COM_COMPONENTBUILDER_CUSTOM_CODES_DASHBOARD_LIST="Custom Codes Dashboard List" @@ -483,7 +499,7 @@ COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_OWN_DESC="Allows the users in this group COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_STATE="Custom Codes Edit State" COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_STATE_DESC="Allows the users in this group to update the state of the custom code" COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_VERSION="Custom Codes Edit Version" -COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version custom codes" +COM_COMPONENTBUILDER_CUSTOM_CODES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version custom codes" COM_COMPONENTBUILDER_CUSTOM_CODES_EXPORT="Custom Codes Export" COM_COMPONENTBUILDER_CUSTOM_CODES_EXPORT_DESC="Allows the users in this group to export export custom codes" COM_COMPONENTBUILDER_CUSTOM_CODES_IMPORT="Custom Codes Import" @@ -495,7 +511,7 @@ COM_COMPONENTBUILDER_CUSTOM_CODE_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the us COM_COMPONENTBUILDER_DYNAMIC_GETS_ACCESS="Dynamic Gets Access" COM_COMPONENTBUILDER_DYNAMIC_GETS_ACCESS_DESC="Allows the users in this group to access access dynamic gets" COM_COMPONENTBUILDER_DYNAMIC_GETS_BATCH_USE="Dynamic Gets Batch Use" -COM_COMPONENTBUILDER_DYNAMIC_GETS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch dynamic gets" +COM_COMPONENTBUILDER_DYNAMIC_GETS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch dynamic gets" COM_COMPONENTBUILDER_DYNAMIC_GETS_CREATE="Dynamic Gets Create" COM_COMPONENTBUILDER_DYNAMIC_GETS_CREATE_DESC="Allows the users in this group to create create dynamic gets" COM_COMPONENTBUILDER_DYNAMIC_GETS_DASHBOARD_ADD="Dynamic Gets Dashboard Add" @@ -511,7 +527,7 @@ COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_OWN_DESC="Allows the users in this group COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_STATE="Dynamic Gets Edit State" COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_STATE_DESC="Allows the users in this group to update the state of the dynamic get" COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_VERSION="Dynamic Gets Edit Version" -COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version dynamic gets" +COM_COMPONENTBUILDER_DYNAMIC_GETS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version dynamic gets" COM_COMPONENTBUILDER_DYNAMIC_GETS_EXPORT="Dynamic Gets Export" COM_COMPONENTBUILDER_DYNAMIC_GETS_EXPORT_DESC="Allows the users in this group to export export dynamic gets" COM_COMPONENTBUILDER_DYNAMIC_GETS_IMPORT="Dynamic Gets Import" @@ -531,7 +547,7 @@ COM_COMPONENTBUILDER_EXPORT_DATA_DESC="Allows users in this group to export data COM_COMPONENTBUILDER_FIELDS_ACCESS="Fields Access" COM_COMPONENTBUILDER_FIELDS_ACCESS_DESC="Allows the users in this group to access access fields" COM_COMPONENTBUILDER_FIELDS_BATCH_USE="Fields Batch Use" -COM_COMPONENTBUILDER_FIELDS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch fields" +COM_COMPONENTBUILDER_FIELDS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch fields" COM_COMPONENTBUILDER_FIELDS_CREATE="Fields Create" COM_COMPONENTBUILDER_FIELDS_CREATE_DESC="Allows the users in this group to create create fields" COM_COMPONENTBUILDER_FIELDS_DASHBOARD_ADD="Fields Dashboard Add" @@ -547,7 +563,7 @@ COM_COMPONENTBUILDER_FIELDS_EDIT_OWN_DESC="Allows the users in this group to edi COM_COMPONENTBUILDER_FIELDS_EDIT_STATE="Fields Edit State" COM_COMPONENTBUILDER_FIELDS_EDIT_STATE_DESC="Allows the users in this group to update the state of the field" COM_COMPONENTBUILDER_FIELDS_EDIT_VERSION="Fields Edit Version" -COM_COMPONENTBUILDER_FIELDS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version fields" +COM_COMPONENTBUILDER_FIELDS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version fields" COM_COMPONENTBUILDER_FIELDS_EXPORT="Fields Export" COM_COMPONENTBUILDER_FIELDS_EXPORT_DESC="Allows the users in this group to export export fields" COM_COMPONENTBUILDER_FIELDS_IMPORT="Fields Import" @@ -557,7 +573,7 @@ COM_COMPONENTBUILDER_FIELDS_SUBMENU_DESC="Allows the users in this group to subm COM_COMPONENTBUILDER_FIELDTYPES_ACCESS="Fieldtypes Access" COM_COMPONENTBUILDER_FIELDTYPES_ACCESS_DESC="Allows the users in this group to access access fieldtypes" COM_COMPONENTBUILDER_FIELDTYPES_BATCH_USE="Fieldtypes Batch Use" -COM_COMPONENTBUILDER_FIELDTYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch fieldtypes" +COM_COMPONENTBUILDER_FIELDTYPES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch fieldtypes" COM_COMPONENTBUILDER_FIELDTYPES_CREATE="Fieldtypes Create" COM_COMPONENTBUILDER_FIELDTYPES_CREATE_DESC="Allows the users in this group to create create fieldtypes" COM_COMPONENTBUILDER_FIELDTYPES_DASHBOARD_LIST="Fieldtypes Dashboard List" @@ -571,7 +587,7 @@ COM_COMPONENTBUILDER_FIELDTYPES_EDIT_OWN_DESC="Allows the users in this group to COM_COMPONENTBUILDER_FIELDTYPES_EDIT_STATE="Fieldtypes Edit State" COM_COMPONENTBUILDER_FIELDTYPES_EDIT_STATE_DESC="Allows the users in this group to update the state of the fieldtype" COM_COMPONENTBUILDER_FIELDTYPES_EDIT_VERSION="Fieldtypes Edit Version" -COM_COMPONENTBUILDER_FIELDTYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version fieldtypes" +COM_COMPONENTBUILDER_FIELDTYPES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version fieldtypes" COM_COMPONENTBUILDER_FIELDTYPES_EXPORT="Fieldtypes Export" COM_COMPONENTBUILDER_FIELDTYPES_EXPORT_DESC="Allows the users in this group to export export fieldtypes" COM_COMPONENTBUILDER_FIELDTYPES_IMPORT="Fieldtypes Import" @@ -601,7 +617,7 @@ COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS_DESC="Allows the users COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS="Help Documents Access" COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS_DESC="Allows the users in this group to access access help documents" COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE="Help Documents Batch Use" -COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch help documents" +COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch help documents" COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE="Help Documents Create" COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents" COM_COMPONENTBUILDER_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List" @@ -615,7 +631,7 @@ COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_OWN_DESC="Allows the users in this grou COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_STATE="Help Documents Edit State" COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_STATE_DESC="Allows the users in this group to update the state of the help document" COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_VERSION="Help Documents Edit Version" -COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version help documents" +COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version help documents" COM_COMPONENTBUILDER_HELP_DOCUMENTS_EXPORT="Help Documents Export" COM_COMPONENTBUILDER_HELP_DOCUMENTS_EXPORT_DESC="Allows the users in this group to export export help documents" COM_COMPONENTBUILDER_HELP_DOCUMENTS_IMPORT="Help Documents Import" @@ -627,7 +643,7 @@ COM_COMPONENTBUILDER_IMPORT_DATA_DESC="Allows users in this group to import data COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_ACCESS="Joomla Components Access" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_ACCESS_DESC="Allows the users in this group to access access joomla components" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE="Joomla Components Batch Use" -COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla components" +COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla components" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CREATE="Joomla Components Create" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CREATE_DESC="Allows the users in this group to create create joomla components" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_LIST="Joomla Components Dashboard List" @@ -645,7 +661,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_OWN_DESC="Allows the users in this g COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE="Joomla Components Edit State" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla component" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION="Joomla Components Edit Version" -COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla components" +COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla components" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU="Joomla Components Submenu" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU_DESC="Allows the users in this group to submenu of joomla component" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_BUTTON_ACCESS="Joomla Component Backup Button Access" @@ -663,7 +679,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows t COM_COMPONENTBUILDER_JOOMLA_MODULES_ACCESS="Joomla Modules Access" COM_COMPONENTBUILDER_JOOMLA_MODULES_ACCESS_DESC="Allows the users in this group to access access joomla modules" COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_USE="Joomla Modules Batch Use" -COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla modules" +COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla modules" COM_COMPONENTBUILDER_JOOMLA_MODULES_CREATE="Joomla Modules Create" COM_COMPONENTBUILDER_JOOMLA_MODULES_CREATE_DESC="Allows the users in this group to create create joomla modules" COM_COMPONENTBUILDER_JOOMLA_MODULES_DASHBOARD_LIST="Joomla Modules Dashboard List" @@ -681,13 +697,13 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_EDIT_OWN_DESC="Allows the users in this grou COM_COMPONENTBUILDER_JOOMLA_MODULES_EDIT_STATE="Joomla Modules Edit State" COM_COMPONENTBUILDER_JOOMLA_MODULES_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla module" COM_COMPONENTBUILDER_JOOMLA_MODULES_EDIT_VERSION="Joomla Modules Edit Version" -COM_COMPONENTBUILDER_JOOMLA_MODULES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla modules" +COM_COMPONENTBUILDER_JOOMLA_MODULES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla modules" COM_COMPONENTBUILDER_JOOMLA_MODULES_EXPORT="Joomla Modules Export" COM_COMPONENTBUILDER_JOOMLA_MODULES_EXPORT_DESC="Allows the users in this group to export export joomla modules" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_ACCESS="Joomla Modules Files Folders Urls Access" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_ACCESS_DESC="Allows the users in this group to access access joomla modules files folders urls" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_BATCH_USE="Joomla Modules Files Folders Urls Batch Use" -COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla modules files folders urls" +COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla modules files folders urls" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_CREATE="Joomla Modules Files Folders Urls Create" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_CREATE_DESC="Allows the users in this group to create create joomla modules files folders urls" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_DELETE="Joomla Modules Files Folders Urls Delete" @@ -703,7 +719,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_EDIT_OWN_DESC="Allows the COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_EDIT_STATE="Joomla Modules Files Folders Urls Edit State" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla module files folders urls" COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_EDIT_VERSION="Joomla Modules Files Folders Urls Edit Version" -COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla modules files folders urls" +COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla modules files folders urls" COM_COMPONENTBUILDER_JOOMLA_MODULES_IMPORT="Joomla Modules Import" COM_COMPONENTBUILDER_JOOMLA_MODULES_IMPORT_DESC="Allows the users in this group to import import joomla modules" COM_COMPONENTBUILDER_JOOMLA_MODULES_SUBMENU="Joomla Modules Submenu" @@ -711,7 +727,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_SUBMENU_DESC="Allows the users in this group COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_ACCESS="Joomla Modules Updates Access" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_ACCESS_DESC="Allows the users in this group to access access joomla modules updates" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_BATCH_USE="Joomla Modules Updates Batch Use" -COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla modules updates" +COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla modules updates" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_CREATE="Joomla Modules Updates Create" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_CREATE_DESC="Allows the users in this group to create create joomla modules updates" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_DELETE="Joomla Modules Updates Delete" @@ -727,7 +743,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_OWN_DESC="Allows the users in t COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_STATE="Joomla Modules Updates Edit State" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla module updates" COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_VERSION="Joomla Modules Updates Edit Version" -COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla modules updates" +COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla modules updates" COM_COMPONENTBUILDER_JOOMLA_MODULE_GET_SNIPPETS_BUTTON_ACCESS="Joomla Module Get Snippets Button Access" COM_COMPONENTBUILDER_JOOMLA_MODULE_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the get snippets button." COM_COMPONENTBUILDER_JOOMLA_MODULE_RUN_EXPANSION_BUTTON_ACCESS="Joomla Module Run Expansion Button Access" @@ -735,7 +751,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the COM_COMPONENTBUILDER_JOOMLA_PLUGINS_ACCESS="Joomla Plugins Access" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_ACCESS_DESC="Allows the users in this group to access access joomla plugins" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_USE="Joomla Plugins Batch Use" -COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla plugins" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_CREATE="Joomla Plugins Create" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_CREATE_DESC="Allows the users in this group to create create joomla plugins" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_DASHBOARD_LIST="Joomla Plugins Dashboard List" @@ -753,11 +769,11 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_OWN_DESC="Allows the users in this grou COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_STATE="Joomla Plugins Edit State" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla plugin" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_VERSION="Joomla Plugins Edit Version" -COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugins" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla plugins" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_ACCESS="Joomla Plugins Files Folders Urls Access" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_ACCESS_DESC="Allows the users in this group to access access joomla plugins files folders urls" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_USE="Joomla Plugins Files Folders Urls Batch Use" -COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla plugins files folders urls" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_CREATE="Joomla Plugins Files Folders Urls Create" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_CREATE_DESC="Allows the users in this group to create create joomla plugins files folders urls" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_DELETE="Joomla Plugins Files Folders Urls Delete" @@ -773,13 +789,13 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_OWN_DESC="Allows the COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_STATE="Joomla Plugins Files Folders Urls Edit State" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla plugin files folders urls" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_VERSION="Joomla Plugins Files Folders Urls Edit Version" -COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugins files folders urls" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla plugins files folders urls" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_SUBMENU="Joomla Plugins Submenu" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_SUBMENU_DESC="Allows the users in this group to submenu of joomla plugin" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_ACCESS="Joomla Plugins Updates Access" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_ACCESS_DESC="Allows the users in this group to access access joomla plugins updates" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_USE="Joomla Plugins Updates Batch Use" -COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla plugins updates" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_CREATE="Joomla Plugins Updates Create" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_CREATE_DESC="Allows the users in this group to create create joomla plugins updates" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_DELETE="Joomla Plugins Updates Delete" @@ -795,25 +811,51 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_OWN_DESC="Allows the users in t COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE="Joomla Plugins Updates Edit State" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla plugin updates" COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION="Joomla Plugins Updates Edit Version" -COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugins updates" +COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla plugins updates" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GET_BOILERPLATE_BUTTON_ACCESS="Joomla Plugin Get Boilerplate Button Access" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GET_BOILERPLATE_BUTTON_ACCESS_DESC="Allows the users in this group to access the get boilerplate button." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_ACCESS="Joomla Plugin Groups Access" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_ACCESS_DESC="Allows the users in this group to access access joomla plugin groups" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_USE="Joomla Plugin Groups Batch Use" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch joomla plugin groups" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla plugin groups" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_EDIT_VERSION="Joomla Plugin Groups Edit Version" -COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version joomla plugin groups" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla plugin groups" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHODS_BUTTON_ACCESS="Joomla Plugin Methods Button Access" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHODS_BUTTON_ACCESS_DESC="Allows the users in this group to access the methods button." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTIES_BUTTON_ACCESS="Joomla Plugin Properties Button Access" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTIES_BUTTON_ACCESS_DESC="Allows the users in this group to access the properties button." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_RUN_EXPANSION_BUTTON_ACCESS="Joomla Plugin Run Expansion Button Access" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button." +COM_COMPONENTBUILDER_JOOMLA_POWERS_ACCESS="Joomla Powers Access" +COM_COMPONENTBUILDER_JOOMLA_POWERS_ACCESS_DESC="Allows the users in this group to access access joomla powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_BATCH_USE="Joomla Powers Batch Use" +COM_COMPONENTBUILDER_JOOMLA_POWERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_CREATE="Joomla Powers Create" +COM_COMPONENTBUILDER_JOOMLA_POWERS_CREATE_DESC="Allows the users in this group to create create joomla powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_DELETE="Joomla Powers Delete" +COM_COMPONENTBUILDER_JOOMLA_POWERS_DELETE_DESC="Allows the users in this group to delete delete joomla powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT="Joomla Powers Edit" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_BY="Joomla Powers Edit Created By" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by joomla powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_DATE="Joomla Powers Edit Created Date" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created joomla powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_DESC="Allows the users in this group to edit the joomla power" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_OWN="Joomla Powers Edit Own" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_OWN_DESC="Allows the users in this group to edit edit own joomla powers created by them" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_STATE="Joomla Powers Edit State" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla power" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_VERSION="Joomla Powers Edit Version" +COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla powers" +COM_COMPONENTBUILDER_JOOMLA_POWERS_SUBMENU="Joomla Powers Submenu" +COM_COMPONENTBUILDER_JOOMLA_POWERS_SUBMENU_DESC="Allows the users in this group to submenu of joomla power" +COM_COMPONENTBUILDER_JOOMLA_POWER_INIT_BUTTON_ACCESS="Joomla Power Init Button Access" +COM_COMPONENTBUILDER_JOOMLA_POWER_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button." +COM_COMPONENTBUILDER_JOOMLA_POWER_RESET_BUTTON_ACCESS="Joomla Power Reset Button Access" +COM_COMPONENTBUILDER_JOOMLA_POWER_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button." COM_COMPONENTBUILDER_LANGUAGES_ACCESS="Languages Access" COM_COMPONENTBUILDER_LANGUAGES_ACCESS_DESC="Allows the users in this group to access access languages" COM_COMPONENTBUILDER_LANGUAGES_BATCH_USE="Languages Batch Use" -COM_COMPONENTBUILDER_LANGUAGES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch languages" +COM_COMPONENTBUILDER_LANGUAGES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch languages" COM_COMPONENTBUILDER_LANGUAGES_CREATE="Languages Create" COM_COMPONENTBUILDER_LANGUAGES_CREATE_DESC="Allows the users in this group to create create languages" COM_COMPONENTBUILDER_LANGUAGES_DELETE="Languages Delete" @@ -825,7 +867,7 @@ COM_COMPONENTBUILDER_LANGUAGES_EDIT_OWN_DESC="Allows the users in this group to COM_COMPONENTBUILDER_LANGUAGES_EDIT_STATE="Languages Edit State" COM_COMPONENTBUILDER_LANGUAGES_EDIT_STATE_DESC="Allows the users in this group to update the state of the language" COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION="Languages Edit Version" -COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version languages" +COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version languages" COM_COMPONENTBUILDER_LANGUAGES_EXPORT="Languages Export" COM_COMPONENTBUILDER_LANGUAGES_EXPORT_DESC="Allows the users in this group to export export languages" COM_COMPONENTBUILDER_LANGUAGES_IMPORT="Languages Import" @@ -837,7 +879,7 @@ COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS_DESC="Allows the users in this COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS="Language Translations Access" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS_DESC="Allows the users in this group to access access language translations" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE="Language Translations Batch Use" -COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch language translations" +COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch language translations" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_CREATE="Language Translations Create" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_CREATE_DESC="Allows the users in this group to create create language translations" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_DASHBOARD_LIST="Language Translations Dashboard List" @@ -851,7 +893,7 @@ COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_OWN_DESC="Allows the users in th COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_STATE="Language Translations Edit State" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_STATE_DESC="Allows the users in this group to update the state of the language translation" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_VERSION="Language Translations Edit Version" -COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version language translations" +COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version language translations" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EXPORT="Language Translations Export" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EXPORT_DESC="Allows the users in this group to export export language translations" COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_IMPORT="Language Translations Import" @@ -861,7 +903,7 @@ COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_SUBMENU_DESC="Allows the users in thi COM_COMPONENTBUILDER_LAYOUTS_ACCESS="Layouts Access" COM_COMPONENTBUILDER_LAYOUTS_ACCESS_DESC="Allows the users in this group to access access layouts" COM_COMPONENTBUILDER_LAYOUTS_BATCH_USE="Layouts Batch Use" -COM_COMPONENTBUILDER_LAYOUTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch layouts" +COM_COMPONENTBUILDER_LAYOUTS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch layouts" COM_COMPONENTBUILDER_LAYOUTS_CREATE="Layouts Create" COM_COMPONENTBUILDER_LAYOUTS_CREATE_DESC="Allows the users in this group to create create layouts" COM_COMPONENTBUILDER_LAYOUTS_DASHBOARD_LIST="Layouts Dashboard List" @@ -875,7 +917,7 @@ COM_COMPONENTBUILDER_LAYOUTS_EDIT_OWN_DESC="Allows the users in this group to ed COM_COMPONENTBUILDER_LAYOUTS_EDIT_STATE="Layouts Edit State" COM_COMPONENTBUILDER_LAYOUTS_EDIT_STATE_DESC="Allows the users in this group to update the state of the layout" COM_COMPONENTBUILDER_LAYOUTS_EDIT_VERSION="Layouts Edit Version" -COM_COMPONENTBUILDER_LAYOUTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version layouts" +COM_COMPONENTBUILDER_LAYOUTS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version layouts" COM_COMPONENTBUILDER_LAYOUTS_EXPORT="Layouts Export" COM_COMPONENTBUILDER_LAYOUTS_EXPORT_DESC="Allows the users in this group to export export layouts" COM_COMPONENTBUILDER_LAYOUTS_IMPORT="Layouts Import" @@ -887,11 +929,11 @@ COM_COMPONENTBUILDER_LAYOUT_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in COM_COMPONENTBUILDER_LIBRARIES_ACCESS="Libraries Access" COM_COMPONENTBUILDER_LIBRARIES_ACCESS_DESC="Allows the users in this group to access access libraries" COM_COMPONENTBUILDER_LIBRARIES_BATCH_USE="Libraries Batch Use" -COM_COMPONENTBUILDER_LIBRARIES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch libraries" +COM_COMPONENTBUILDER_LIBRARIES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch libraries" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_ACCESS="Libraries Config Access" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_ACCESS_DESC="Allows the users in this group to access access libraries config" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_BATCH_USE="Libraries Config Batch Use" -COM_COMPONENTBUILDER_LIBRARIES_CONFIG_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch libraries config" +COM_COMPONENTBUILDER_LIBRARIES_CONFIG_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch libraries config" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_CREATE="Libraries Config Create" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_CREATE_DESC="Allows the users in this group to create create libraries config" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_DELETE="Libraries Config Delete" @@ -907,7 +949,7 @@ COM_COMPONENTBUILDER_LIBRARIES_CONFIG_EDIT_OWN_DESC="Allows the users in this gr COM_COMPONENTBUILDER_LIBRARIES_CONFIG_EDIT_STATE="Libraries Config Edit State" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_EDIT_STATE_DESC="Allows the users in this group to update the state of the library config" COM_COMPONENTBUILDER_LIBRARIES_CONFIG_EDIT_VERSION="Libraries Config Edit Version" -COM_COMPONENTBUILDER_LIBRARIES_CONFIG_EDIT_VERSION_DESC="Allows users in this group to edit versions of version libraries config" +COM_COMPONENTBUILDER_LIBRARIES_CONFIG_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version libraries config" COM_COMPONENTBUILDER_LIBRARIES_CREATE="Libraries Create" COM_COMPONENTBUILDER_LIBRARIES_CREATE_DESC="Allows the users in this group to create create libraries" COM_COMPONENTBUILDER_LIBRARIES_DASHBOARD_LIST="Libraries Dashboard List" @@ -921,11 +963,11 @@ COM_COMPONENTBUILDER_LIBRARIES_EDIT_OWN_DESC="Allows the users in this group to COM_COMPONENTBUILDER_LIBRARIES_EDIT_STATE="Libraries Edit State" COM_COMPONENTBUILDER_LIBRARIES_EDIT_STATE_DESC="Allows the users in this group to update the state of the library" COM_COMPONENTBUILDER_LIBRARIES_EDIT_VERSION="Libraries Edit Version" -COM_COMPONENTBUILDER_LIBRARIES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version libraries" +COM_COMPONENTBUILDER_LIBRARIES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version libraries" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_ACCESS="Libraries Files Folders Urls Access" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_ACCESS_DESC="Allows the users in this group to access access libraries files folders urls" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_BATCH_USE="Libraries Files Folders Urls Batch Use" -COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch libraries files folders urls" +COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch libraries files folders urls" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_CREATE="Libraries Files Folders Urls Create" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_CREATE_DESC="Allows the users in this group to create create libraries files folders urls" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_DELETE="Libraries Files Folders Urls Delete" @@ -941,7 +983,7 @@ COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_OWN_DESC="Allows the user COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_STATE="Libraries Files Folders Urls Edit State" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_STATE_DESC="Allows the users in this group to update the state of the library files folders urls" COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_VERSION="Libraries Files Folders Urls Edit Version" -COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version libraries files folders urls" +COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version libraries files folders urls" COM_COMPONENTBUILDER_LIBRARIES_SUBMENU="Libraries Submenu" COM_COMPONENTBUILDER_LIBRARIES_SUBMENU_DESC="Allows the users in this group to submenu of library" COM_COMPONENTBUILDER_LIBRARY_GET_SNIPPETS_BUTTON_ACCESS="Library Get Snippets Button Access" @@ -958,11 +1000,13 @@ COM_COMPONENTBUILDER_MENU_HELP_DOCUMENTS="Help Documents" COM_COMPONENTBUILDER_MENU_JOOMLA_COMPONENTS="Joomla Components" COM_COMPONENTBUILDER_MENU_JOOMLA_MODULES="Joomla Modules" COM_COMPONENTBUILDER_MENU_JOOMLA_PLUGINS="Joomla Plugins" +COM_COMPONENTBUILDER_MENU_JOOMLA_POWERS="Joomla Powers" COM_COMPONENTBUILDER_MENU_LANGUAGE_TRANSLATIONS="Language Translations" COM_COMPONENTBUILDER_MENU_LAYOUTS="Layouts" COM_COMPONENTBUILDER_MENU_LIBRARIES="Libraries" COM_COMPONENTBUILDER_MENU_PLACEHOLDERS="Placeholders" COM_COMPONENTBUILDER_MENU_POWERS="Powers" +COM_COMPONENTBUILDER_MENU_SEARCH="Search" COM_COMPONENTBUILDER_MENU_SITE_VIEWS="Site Views" COM_COMPONENTBUILDER_MENU_SNIPPETS="Snippets" COM_COMPONENTBUILDER_MENU_TEMPLATES="Templates" @@ -970,7 +1014,7 @@ COM_COMPONENTBUILDER_MENU_VALIDATION_RULES="Validation Rules" COM_COMPONENTBUILDER_PLACEHOLDERS_ACCESS="Placeholders Access" COM_COMPONENTBUILDER_PLACEHOLDERS_ACCESS_DESC="Allows the users in this group to access access placeholders" COM_COMPONENTBUILDER_PLACEHOLDERS_BATCH_USE="Placeholders Batch Use" -COM_COMPONENTBUILDER_PLACEHOLDERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch placeholders" +COM_COMPONENTBUILDER_PLACEHOLDERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch placeholders" COM_COMPONENTBUILDER_PLACEHOLDERS_CREATE="Placeholders Create" COM_COMPONENTBUILDER_PLACEHOLDERS_CREATE_DESC="Allows the users in this group to create create placeholders" COM_COMPONENTBUILDER_PLACEHOLDERS_DASHBOARD_LIST="Placeholders Dashboard List" @@ -984,7 +1028,7 @@ COM_COMPONENTBUILDER_PLACEHOLDERS_EDIT_OWN_DESC="Allows the users in this group COM_COMPONENTBUILDER_PLACEHOLDERS_EDIT_STATE="Placeholders Edit State" COM_COMPONENTBUILDER_PLACEHOLDERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the placeholder" COM_COMPONENTBUILDER_PLACEHOLDERS_EDIT_VERSION="Placeholders Edit Version" -COM_COMPONENTBUILDER_PLACEHOLDERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version placeholders" +COM_COMPONENTBUILDER_PLACEHOLDERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version placeholders" COM_COMPONENTBUILDER_PLACEHOLDERS_EXPORT="Placeholders Export" COM_COMPONENTBUILDER_PLACEHOLDERS_EXPORT_DESC="Allows the users in this group to export export placeholders" COM_COMPONENTBUILDER_PLACEHOLDERS_IMPORT="Placeholders Import" @@ -994,7 +1038,7 @@ COM_COMPONENTBUILDER_PLACEHOLDERS_SUBMENU_DESC="Allows the users in this group t COM_COMPONENTBUILDER_POWERS_ACCESS="Powers Access" COM_COMPONENTBUILDER_POWERS_ACCESS_DESC="Allows the users in this group to access access powers" COM_COMPONENTBUILDER_POWERS_BATCH_USE="Powers Batch Use" -COM_COMPONENTBUILDER_POWERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch powers" +COM_COMPONENTBUILDER_POWERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch powers" COM_COMPONENTBUILDER_POWERS_CREATE="Powers Create" COM_COMPONENTBUILDER_POWERS_CREATE_DESC="Allows the users in this group to create create powers" COM_COMPONENTBUILDER_POWERS_DASHBOARD_LIST="Powers Dashboard List" @@ -1012,15 +1056,27 @@ COM_COMPONENTBUILDER_POWERS_EDIT_OWN_DESC="Allows the users in this group to edi COM_COMPONENTBUILDER_POWERS_EDIT_STATE="Powers Edit State" COM_COMPONENTBUILDER_POWERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the power" 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_EDIT_VERSION_DESC="Allows the 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_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" COM_COMPONENTBUILDER_SERVERS_ACCESS_DESC="Allows the users in this group to access access servers" COM_COMPONENTBUILDER_SERVERS_BATCH_USE="Servers Batch Use" -COM_COMPONENTBUILDER_SERVERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch servers" +COM_COMPONENTBUILDER_SERVERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch servers" COM_COMPONENTBUILDER_SERVERS_CREATE="Servers Create" COM_COMPONENTBUILDER_SERVERS_CREATE_DESC="Allows the users in this group to create create servers" COM_COMPONENTBUILDER_SERVERS_DASHBOARD_LIST="Servers Dashboard List" @@ -1038,7 +1094,7 @@ COM_COMPONENTBUILDER_SERVERS_EDIT_OWN_DESC="Allows the users in this group to ed COM_COMPONENTBUILDER_SERVERS_EDIT_STATE="Servers Edit State" COM_COMPONENTBUILDER_SERVERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the server" COM_COMPONENTBUILDER_SERVERS_EDIT_VERSION="Servers Edit Version" -COM_COMPONENTBUILDER_SERVERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version servers" +COM_COMPONENTBUILDER_SERVERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version servers" COM_COMPONENTBUILDER_SERVERS_EXPORT="Servers Export" COM_COMPONENTBUILDER_SERVERS_EXPORT_DESC="Allows the users in this group to export export servers" COM_COMPONENTBUILDER_SERVERS_IMPORT="Servers Import" @@ -1048,11 +1104,9 @@ COM_COMPONENTBUILDER_SERVERS_SUBMENU_DESC="Allows the users in this group to sub COM_COMPONENTBUILDER_SITE_VIEWS_ACCESS="Site Views Access" COM_COMPONENTBUILDER_SITE_VIEWS_ACCESS_DESC="Allows the users in this group to access access site views" 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_BATCH_USE_DESC="Allows the 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" @@ -1064,7 +1118,7 @@ COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_OWN_DESC="Allows the users in this group to COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_STATE="Site Views Edit State" COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_STATE_DESC="Allows the users in this group to update the state of the site view" COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_VERSION="Site Views Edit Version" -COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version site views" +COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version site views" COM_COMPONENTBUILDER_SITE_VIEWS_EXPORT="Site Views Export" COM_COMPONENTBUILDER_SITE_VIEWS_EXPORT_DESC="Allows the users in this group to export export site views" COM_COMPONENTBUILDER_SITE_VIEWS_IMPORT="Site Views Import" @@ -1076,7 +1130,7 @@ COM_COMPONENTBUILDER_SITE_VIEW_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users COM_COMPONENTBUILDER_SNIPPETS_ACCESS="Snippets Access" COM_COMPONENTBUILDER_SNIPPETS_ACCESS_DESC="Allows the users in this group to access access snippets" COM_COMPONENTBUILDER_SNIPPETS_BATCH_USE="Snippets Batch Use" -COM_COMPONENTBUILDER_SNIPPETS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch snippets" +COM_COMPONENTBUILDER_SNIPPETS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch snippets" COM_COMPONENTBUILDER_SNIPPETS_CREATE="Snippets Create" COM_COMPONENTBUILDER_SNIPPETS_CREATE_DESC="Allows the users in this group to create create snippets" COM_COMPONENTBUILDER_SNIPPETS_DASHBOARD_LIST="Snippets Dashboard List" @@ -1090,7 +1144,7 @@ COM_COMPONENTBUILDER_SNIPPETS_EDIT_OWN_DESC="Allows the users in this group to e COM_COMPONENTBUILDER_SNIPPETS_EDIT_STATE="Snippets Edit State" COM_COMPONENTBUILDER_SNIPPETS_EDIT_STATE_DESC="Allows the users in this group to update the state of the snippet" COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION="Snippets Edit Version" -COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version snippets" +COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version snippets" COM_COMPONENTBUILDER_SNIPPETS_EXPORT="Snippets Export" COM_COMPONENTBUILDER_SNIPPETS_EXPORT_DESC="Allows the users in this group to export export snippets" COM_COMPONENTBUILDER_SNIPPETS_IMPORT="Snippets Import" @@ -1104,7 +1158,7 @@ COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users COM_COMPONENTBUILDER_SNIPPET_TYPES_ACCESS="Snippet Types Access" COM_COMPONENTBUILDER_SNIPPET_TYPES_ACCESS_DESC="Allows the users in this group to access access snippet types" COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_USE="Snippet Types Batch Use" -COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch snippet types" +COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch snippet types" COM_COMPONENTBUILDER_SNIPPET_TYPES_CREATE="Snippet Types Create" COM_COMPONENTBUILDER_SNIPPET_TYPES_CREATE_DESC="Allows the users in this group to create create snippet types" COM_COMPONENTBUILDER_SNIPPET_TYPES_DELETE="Snippet Types Delete" @@ -1116,11 +1170,11 @@ COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_OWN_DESC="Allows the users in this group COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_STATE="Snippet Types Edit State" COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_STATE_DESC="Allows the users in this group to update the state of the snippet type" COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_VERSION="Snippet Types Edit Version" -COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version snippet types" +COM_COMPONENTBUILDER_SNIPPET_TYPES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version snippet types" COM_COMPONENTBUILDER_TEMPLATES_ACCESS="Templates Access" COM_COMPONENTBUILDER_TEMPLATES_ACCESS_DESC="Allows the users in this group to access access templates" COM_COMPONENTBUILDER_TEMPLATES_BATCH_USE="Templates Batch Use" -COM_COMPONENTBUILDER_TEMPLATES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch templates" +COM_COMPONENTBUILDER_TEMPLATES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch templates" COM_COMPONENTBUILDER_TEMPLATES_CREATE="Templates Create" COM_COMPONENTBUILDER_TEMPLATES_CREATE_DESC="Allows the users in this group to create create templates" COM_COMPONENTBUILDER_TEMPLATES_DASHBOARD_ADD="Templates Dashboard Add" @@ -1136,7 +1190,7 @@ COM_COMPONENTBUILDER_TEMPLATES_EDIT_OWN_DESC="Allows the users in this group to COM_COMPONENTBUILDER_TEMPLATES_EDIT_STATE="Templates Edit State" COM_COMPONENTBUILDER_TEMPLATES_EDIT_STATE_DESC="Allows the users in this group to update the state of the template" COM_COMPONENTBUILDER_TEMPLATES_EDIT_VERSION="Templates Edit Version" -COM_COMPONENTBUILDER_TEMPLATES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version templates" +COM_COMPONENTBUILDER_TEMPLATES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version templates" COM_COMPONENTBUILDER_TEMPLATES_EXPORT="Templates Export" COM_COMPONENTBUILDER_TEMPLATES_EXPORT_DESC="Allows the users in this group to export export templates" COM_COMPONENTBUILDER_TEMPLATES_IMPORT="Templates Import" @@ -1150,7 +1204,7 @@ COM_COMPONENTBUILDER_USE_BATCH_DESC="Allows users in this group to use batch cop COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS="Validation Rules Access" COM_COMPONENTBUILDER_VALIDATION_RULES_ACCESS_DESC="Allows the users in this group to access access validation rules" COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE="Validation Rules Batch Use" -COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch validation rules" +COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch validation rules" COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE="Validation Rules Create" COM_COMPONENTBUILDER_VALIDATION_RULES_CREATE_DESC="Allows the users in this group to create create validation rules" COM_COMPONENTBUILDER_VALIDATION_RULES_DASHBOARD_LIST="Validation Rules Dashboard List" @@ -1164,7 +1218,7 @@ COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_OWN_DESC="Allows the users in this gr COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_STATE="Validation Rules Edit State" COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_STATE_DESC="Allows the users in this group to update the state of the validation rule" COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION="Validation Rules Edit Version" -COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version validation rules" +COM_COMPONENTBUILDER_VALIDATION_RULES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version validation rules" COM_COMPONENTBUILDER_VALIDATION_RULES_EXPORT="Validation Rules Export" COM_COMPONENTBUILDER_VALIDATION_RULES_EXPORT_DESC="Allows the users in this group to export export validation rules" COM_COMPONENTBUILDER_VALIDATION_RULES_IMPORT="Validation Rules Import" diff --git a/admin/layouts/admin_custom_tabs/publishing.php b/admin/layouts/admin_custom_tabs/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/admin_custom_tabs/publishing.php +++ b/admin/layouts/admin_custom_tabs/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_custom_tabs/publlshing.php b/admin/layouts/admin_custom_tabs/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/admin_custom_tabs/publlshing.php +++ b/admin/layouts/admin_custom_tabs/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_custom_tabs/tabs_above.php b/admin/layouts/admin_custom_tabs/tabs_above.php index 4e0068392..c779fcdc7 100644 --- a/admin/layouts/admin_custom_tabs/tabs_above.php +++ b/admin/layouts/admin_custom_tabs/tabs_above.php @@ -29,7 +29,7 @@ 'admin_view' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_custom_tabs/tabs_fullwidth.php b/admin/layouts/admin_custom_tabs/tabs_fullwidth.php index 8cdb42655..2366ef74f 100644 --- a/admin/layouts/admin_custom_tabs/tabs_fullwidth.php +++ b/admin/layouts/admin_custom_tabs/tabs_fullwidth.php @@ -29,7 +29,7 @@ 'tabs' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_fields/fields_above.php b/admin/layouts/admin_fields/fields_above.php index 4e0068392..c779fcdc7 100644 --- a/admin/layouts/admin_fields/fields_above.php +++ b/admin/layouts/admin_fields/fields_above.php @@ -29,7 +29,7 @@ 'admin_view' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_fields/fields_fullwidth.php b/admin/layouts/admin_fields/fields_fullwidth.php index ac1636573..9355bbd2f 100644 --- a/admin/layouts/admin_fields/fields_fullwidth.php +++ b/admin/layouts/admin_fields/fields_fullwidth.php @@ -30,7 +30,7 @@ 'addfields' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_fields/publishing.php b/admin/layouts/admin_fields/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/admin_fields/publishing.php +++ b/admin/layouts/admin_fields/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_fields/publlshing.php b/admin/layouts/admin_fields/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/admin_fields/publlshing.php +++ b/admin/layouts/admin_fields/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_fields_conditions/conditions_above.php b/admin/layouts/admin_fields_conditions/conditions_above.php index 4e0068392..c779fcdc7 100644 --- a/admin/layouts/admin_fields_conditions/conditions_above.php +++ b/admin/layouts/admin_fields_conditions/conditions_above.php @@ -29,7 +29,7 @@ 'admin_view' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_fields_conditions/conditions_fullwidth.php b/admin/layouts/admin_fields_conditions/conditions_fullwidth.php index 6a98583c7..ed2efa434 100644 --- a/admin/layouts/admin_fields_conditions/conditions_fullwidth.php +++ b/admin/layouts/admin_fields_conditions/conditions_fullwidth.php @@ -30,7 +30,7 @@ 'addconditions' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_fields_conditions/publishing.php b/admin/layouts/admin_fields_conditions/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/admin_fields_conditions/publishing.php +++ b/admin/layouts/admin_fields_conditions/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_fields_conditions/publlshing.php b/admin/layouts/admin_fields_conditions/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/admin_fields_conditions/publlshing.php +++ b/admin/layouts/admin_fields_conditions/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_fields_relations/publishing.php b/admin/layouts/admin_fields_relations/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/admin_fields_relations/publishing.php +++ b/admin/layouts/admin_fields_relations/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_fields_relations/publlshing.php b/admin/layouts/admin_fields_relations/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/admin_fields_relations/publlshing.php +++ b/admin/layouts/admin_fields_relations/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_fields_relations/relations_above.php b/admin/layouts/admin_fields_relations/relations_above.php index 4e0068392..c779fcdc7 100644 --- a/admin/layouts/admin_fields_relations/relations_above.php +++ b/admin/layouts/admin_fields_relations/relations_above.php @@ -29,7 +29,7 @@ 'admin_view' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_fields_relations/relations_fullwidth.php b/admin/layouts/admin_fields_relations/relations_fullwidth.php index f90e77fef..2bc1f28a3 100644 --- a/admin/layouts/admin_fields_relations/relations_fullwidth.php +++ b/admin/layouts/admin_fields_relations/relations_fullwidth.php @@ -30,7 +30,7 @@ 'addrelations' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/css_fullwidth.php b/admin/layouts/admin_view/css_fullwidth.php index 253eb58bd..96e44de92 100644 --- a/admin/layouts/admin_view/css_fullwidth.php +++ b/admin/layouts/admin_view/css_fullwidth.php @@ -32,7 +32,7 @@ 'css_views' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/custom_buttons_fullwidth.php b/admin/layouts/admin_view/custom_buttons_fullwidth.php index 4d465133a..b923f43de 100644 --- a/admin/layouts/admin_view/custom_buttons_fullwidth.php +++ b/admin/layouts/admin_view/custom_buttons_fullwidth.php @@ -32,7 +32,7 @@ 'php_model_list' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/custom_buttons_left.php b/admin/layouts/admin_view/custom_buttons_left.php index 0f09a8578..14e6b3be7 100644 --- a/admin/layouts/admin_view/custom_buttons_left.php +++ b/admin/layouts/admin_view/custom_buttons_left.php @@ -30,7 +30,7 @@ 'custom_button' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/custom_import_fullwidth.php b/admin/layouts/admin_view/custom_import_fullwidth.php index 45e9c641c..d7581768d 100644 --- a/admin/layouts/admin_view/custom_import_fullwidth.php +++ b/admin/layouts/admin_view/custom_import_fullwidth.php @@ -38,7 +38,7 @@ 'php_import_ext' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/details_above.php b/admin/layouts/admin_view/details_above.php index 87bb562cb..ca79cda0b 100644 --- a/admin/layouts/admin_view/details_above.php +++ b/admin/layouts/admin_view/details_above.php @@ -29,7 +29,7 @@ 'system_name' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/details_fullwidth.php b/admin/layouts/admin_view/details_fullwidth.php index 4c12d1b6e..ca6a32f57 100644 --- a/admin/layouts/admin_view/details_fullwidth.php +++ b/admin/layouts/admin_view/details_fullwidth.php @@ -29,7 +29,7 @@ 'note_linked_to_notice' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/details_left.php b/admin/layouts/admin_view/details_left.php index ac95961ad..5ba739e4f 100644 --- a/admin/layouts/admin_view/details_left.php +++ b/admin/layouts/admin_view/details_left.php @@ -34,7 +34,7 @@ 'icon_category' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/details_right.php b/admin/layouts/admin_view/details_right.php index cc8a1136b..08e45d724 100644 --- a/admin/layouts/admin_view/details_right.php +++ b/admin/layouts/admin_view/details_right.php @@ -31,7 +31,7 @@ 'add_fadein' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/details_under.php b/admin/layouts/admin_view/details_under.php index 68af44f9c..33d83cb4e 100644 --- a/admin/layouts/admin_view/details_under.php +++ b/admin/layouts/admin_view/details_under.php @@ -29,7 +29,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/fields_fullwidth.php b/admin/layouts/admin_view/fields_fullwidth.php index c0c5e3d13..9ddd4f127 100644 --- a/admin/layouts/admin_view/fields_fullwidth.php +++ b/admin/layouts/admin_view/fields_fullwidth.php @@ -29,7 +29,7 @@ 'note_create_edit_display' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/fields_left.php b/admin/layouts/admin_view/fields_left.php index 06e630cfb..94f05ff70 100644 --- a/admin/layouts/admin_view/fields_left.php +++ b/admin/layouts/admin_view/fields_left.php @@ -35,7 +35,7 @@ 'add_category_submenu' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/fields_right.php b/admin/layouts/admin_view/fields_right.php index fe2333e2d..d18a73428 100644 --- a/admin/layouts/admin_view/fields_right.php +++ b/admin/layouts/admin_view/fields_right.php @@ -29,7 +29,7 @@ 'note_create_edit_buttons' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/javascript_fullwidth.php b/admin/layouts/admin_view/javascript_fullwidth.php index 4730f04a4..ac14aa1ca 100644 --- a/admin/layouts/admin_view/javascript_fullwidth.php +++ b/admin/layouts/admin_view/javascript_fullwidth.php @@ -36,7 +36,7 @@ 'javascript_views_footer' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/mysql_fullwidth.php b/admin/layouts/admin_view/mysql_fullwidth.php index e49958274..044a98f0e 100644 --- a/admin/layouts/admin_view/mysql_fullwidth.php +++ b/admin/layouts/admin_view/mysql_fullwidth.php @@ -29,7 +29,7 @@ 'sql' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/mysql_left.php b/admin/layouts/admin_view/mysql_left.php index 10141576d..be363eb8f 100644 --- a/admin/layouts/admin_view/mysql_left.php +++ b/admin/layouts/admin_view/mysql_left.php @@ -35,7 +35,7 @@ 'addtables' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/php_fullwidth.php b/admin/layouts/admin_view/php_fullwidth.php index 7f3e7e491..8594c257c 100644 --- a/admin/layouts/admin_view/php_fullwidth.php +++ b/admin/layouts/admin_view/php_fullwidth.php @@ -69,7 +69,7 @@ 'php_document' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/publishing.php b/admin/layouts/admin_view/publishing.php index 97a901504..865bcf382 100644 --- a/admin/layouts/admin_view/publishing.php +++ b/admin/layouts/admin_view/publishing.php @@ -34,7 +34,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/publlshing.php b/admin/layouts/admin_view/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/admin_view/publlshing.php +++ b/admin/layouts/admin_view/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/admin_view/settings_fullwidth.php b/admin/layouts/admin_view/settings_fullwidth.php index 99653b635..432f6f109 100644 --- a/admin/layouts/admin_view/settings_fullwidth.php +++ b/admin/layouts/admin_view/settings_fullwidth.php @@ -35,7 +35,7 @@ 'addlinked_views' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/batchselection.php b/admin/layouts/batchselection.php index 7e45fe25a..e16530a29 100644 --- a/admin/layouts/batchselection.php +++ b/admin/layouts/batchselection.php @@ -12,6 +12,7 @@ // No direct access to this file defined('JPATH_BASE') or die; +use Joomla\CMS\Language\Text; JHtmlBehavior::core(); $divWrapper = range(1,120,2); $counter = 0; @@ -19,8 +20,8 @@ ListSelection) : ?>
    ListSelection as $ListSelection) : ?> -
    -
    +
    +
    -
    +
    - +
    - - -
    + + +
    \ No newline at end of file diff --git a/admin/layouts/class_extends/details_fullwidth.php b/admin/layouts/class_extends/details_fullwidth.php index f7dc8078c..5384b8666 100644 --- a/admin/layouts/class_extends/details_fullwidth.php +++ b/admin/layouts/class_extends/details_fullwidth.php @@ -29,7 +29,7 @@ 'head' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/class_extends/details_left.php b/admin/layouts/class_extends/details_left.php index 978f1cc38..93997fd08 100644 --- a/admin/layouts/class_extends/details_left.php +++ b/admin/layouts/class_extends/details_left.php @@ -30,7 +30,7 @@ 'extension_type' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/class_extends/details_right.php b/admin/layouts/class_extends/details_right.php index 19e2f8dbb..c0a0b9647 100644 --- a/admin/layouts/class_extends/details_right.php +++ b/admin/layouts/class_extends/details_right.php @@ -29,7 +29,7 @@ 'comment' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/class_extends/publishing.php b/admin/layouts/class_extends/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/class_extends/publishing.php +++ b/admin/layouts/class_extends/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/class_extends/publlshing.php b/admin/layouts/class_extends/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/class_extends/publlshing.php +++ b/admin/layouts/class_extends/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/class_method/details_fullwidth.php b/admin/layouts/class_method/details_fullwidth.php index 8551ba464..61779f18c 100644 --- a/admin/layouts/class_method/details_fullwidth.php +++ b/admin/layouts/class_method/details_fullwidth.php @@ -29,7 +29,7 @@ 'code' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/class_method/details_left.php b/admin/layouts/class_method/details_left.php index c6ec62819..ac29eeb68 100644 --- a/admin/layouts/class_method/details_left.php +++ b/admin/layouts/class_method/details_left.php @@ -33,7 +33,7 @@ 'joomla_plugin_group' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/class_method/details_right.php b/admin/layouts/class_method/details_right.php index 19e2f8dbb..c0a0b9647 100644 --- a/admin/layouts/class_method/details_right.php +++ b/admin/layouts/class_method/details_right.php @@ -29,7 +29,7 @@ 'comment' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/class_method/publishing.php b/admin/layouts/class_method/publishing.php index 97a901504..865bcf382 100644 --- a/admin/layouts/class_method/publishing.php +++ b/admin/layouts/class_method/publishing.php @@ -34,7 +34,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/class_method/publlshing.php b/admin/layouts/class_method/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/class_method/publlshing.php +++ b/admin/layouts/class_method/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/class_property/details_left.php b/admin/layouts/class_property/details_left.php index 042b458dd..db307ef39 100644 --- a/admin/layouts/class_property/details_left.php +++ b/admin/layouts/class_property/details_left.php @@ -33,7 +33,7 @@ 'joomla_plugin_group' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/class_property/details_right.php b/admin/layouts/class_property/details_right.php index 19e2f8dbb..c0a0b9647 100644 --- a/admin/layouts/class_property/details_right.php +++ b/admin/layouts/class_property/details_right.php @@ -29,7 +29,7 @@ 'comment' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/class_property/publishing.php b/admin/layouts/class_property/publishing.php index 97a901504..865bcf382 100644 --- a/admin/layouts/class_property/publishing.php +++ b/admin/layouts/class_property/publishing.php @@ -34,7 +34,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/class_property/publlshing.php b/admin/layouts/class_property/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/class_property/publlshing.php +++ b/admin/layouts/class_property/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_admin_views/clone_left.php b/admin/layouts/component_admin_views/clone_left.php index 25c4eb0c1..ff98ff5d9 100644 --- a/admin/layouts/component_admin_views/clone_left.php +++ b/admin/layouts/component_admin_views/clone_left.php @@ -30,7 +30,7 @@ 'clone_me' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_admin_views/publishing.php b/admin/layouts/component_admin_views/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/component_admin_views/publishing.php +++ b/admin/layouts/component_admin_views/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_admin_views/publlshing.php b/admin/layouts/component_admin_views/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/component_admin_views/publlshing.php +++ b/admin/layouts/component_admin_views/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_admin_views/views_above.php b/admin/layouts/component_admin_views/views_above.php index cf841da92..49a90ad8b 100644 --- a/admin/layouts/component_admin_views/views_above.php +++ b/admin/layouts/component_admin_views/views_above.php @@ -29,7 +29,7 @@ 'joomla_component' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_admin_views/views_fullwidth.php b/admin/layouts/component_admin_views/views_fullwidth.php index 1673841f2..5c7f56822 100644 --- a/admin/layouts/component_admin_views/views_fullwidth.php +++ b/admin/layouts/component_admin_views/views_fullwidth.php @@ -30,7 +30,7 @@ 'addadmin_views' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_config/clone_left.php b/admin/layouts/component_config/clone_left.php index 25c4eb0c1..ff98ff5d9 100644 --- a/admin/layouts/component_config/clone_left.php +++ b/admin/layouts/component_config/clone_left.php @@ -30,7 +30,7 @@ 'clone_me' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_config/options_above.php b/admin/layouts/component_config/options_above.php index cf841da92..49a90ad8b 100644 --- a/admin/layouts/component_config/options_above.php +++ b/admin/layouts/component_config/options_above.php @@ -29,7 +29,7 @@ 'joomla_component' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_config/options_fullwidth.php b/admin/layouts/component_config/options_fullwidth.php index f05e0e794..3d2a9a8c5 100644 --- a/admin/layouts/component_config/options_fullwidth.php +++ b/admin/layouts/component_config/options_fullwidth.php @@ -29,7 +29,7 @@ 'addconfig' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_config/publishing.php b/admin/layouts/component_config/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/component_config/publishing.php +++ b/admin/layouts/component_config/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_config/publlshing.php b/admin/layouts/component_config/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/component_config/publlshing.php +++ b/admin/layouts/component_config/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_custom_admin_menus/clone_left.php b/admin/layouts/component_custom_admin_menus/clone_left.php index 25c4eb0c1..ff98ff5d9 100644 --- a/admin/layouts/component_custom_admin_menus/clone_left.php +++ b/admin/layouts/component_custom_admin_menus/clone_left.php @@ -30,7 +30,7 @@ 'clone_me' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_custom_admin_menus/menus_above.php b/admin/layouts/component_custom_admin_menus/menus_above.php index cf841da92..49a90ad8b 100644 --- a/admin/layouts/component_custom_admin_menus/menus_above.php +++ b/admin/layouts/component_custom_admin_menus/menus_above.php @@ -29,7 +29,7 @@ 'joomla_component' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_custom_admin_menus/menus_fullwidth.php b/admin/layouts/component_custom_admin_menus/menus_fullwidth.php index bbc75d620..789f83fb1 100644 --- a/admin/layouts/component_custom_admin_menus/menus_fullwidth.php +++ b/admin/layouts/component_custom_admin_menus/menus_fullwidth.php @@ -29,7 +29,7 @@ 'addcustommenus' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_custom_admin_menus/publishing.php b/admin/layouts/component_custom_admin_menus/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/component_custom_admin_menus/publishing.php +++ b/admin/layouts/component_custom_admin_menus/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_custom_admin_menus/publlshing.php b/admin/layouts/component_custom_admin_menus/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/component_custom_admin_menus/publlshing.php +++ b/admin/layouts/component_custom_admin_menus/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_custom_admin_views/clone_left.php b/admin/layouts/component_custom_admin_views/clone_left.php index 25c4eb0c1..ff98ff5d9 100644 --- a/admin/layouts/component_custom_admin_views/clone_left.php +++ b/admin/layouts/component_custom_admin_views/clone_left.php @@ -30,7 +30,7 @@ 'clone_me' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_custom_admin_views/publishing.php b/admin/layouts/component_custom_admin_views/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/component_custom_admin_views/publishing.php +++ b/admin/layouts/component_custom_admin_views/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_custom_admin_views/publlshing.php b/admin/layouts/component_custom_admin_views/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/component_custom_admin_views/publlshing.php +++ b/admin/layouts/component_custom_admin_views/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_custom_admin_views/views_above.php b/admin/layouts/component_custom_admin_views/views_above.php index cf841da92..49a90ad8b 100644 --- a/admin/layouts/component_custom_admin_views/views_above.php +++ b/admin/layouts/component_custom_admin_views/views_above.php @@ -29,7 +29,7 @@ 'joomla_component' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_custom_admin_views/views_fullwidth.php b/admin/layouts/component_custom_admin_views/views_fullwidth.php index 6a4ad5855..10c57b3c7 100644 --- a/admin/layouts/component_custom_admin_views/views_fullwidth.php +++ b/admin/layouts/component_custom_admin_views/views_fullwidth.php @@ -30,7 +30,7 @@ 'addcustom_admin_views' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_dashboard/clone_left.php b/admin/layouts/component_dashboard/clone_left.php index 25c4eb0c1..ff98ff5d9 100644 --- a/admin/layouts/component_dashboard/clone_left.php +++ b/admin/layouts/component_dashboard/clone_left.php @@ -30,7 +30,7 @@ 'clone_me' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_dashboard/dashboard_above.php b/admin/layouts/component_dashboard/dashboard_above.php index cf841da92..49a90ad8b 100644 --- a/admin/layouts/component_dashboard/dashboard_above.php +++ b/admin/layouts/component_dashboard/dashboard_above.php @@ -29,7 +29,7 @@ 'joomla_component' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_dashboard/dashboard_fullwidth.php b/admin/layouts/component_dashboard/dashboard_fullwidth.php index aade82bb5..c842e18d8 100644 --- a/admin/layouts/component_dashboard/dashboard_fullwidth.php +++ b/admin/layouts/component_dashboard/dashboard_fullwidth.php @@ -31,7 +31,7 @@ 'dashboard_tab' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_dashboard/publishing.php b/admin/layouts/component_dashboard/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/component_dashboard/publishing.php +++ b/admin/layouts/component_dashboard/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_dashboard/publlshing.php b/admin/layouts/component_dashboard/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/component_dashboard/publlshing.php +++ b/admin/layouts/component_dashboard/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_files_folders/advance_fullwidth.php b/admin/layouts/component_files_folders/advance_fullwidth.php index 5fd19b54f..3d510dcae 100644 --- a/admin/layouts/component_files_folders/advance_fullwidth.php +++ b/admin/layouts/component_files_folders/advance_fullwidth.php @@ -33,7 +33,7 @@ 'note_constant_paths' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_files_folders/basic_above.php b/admin/layouts/component_files_folders/basic_above.php index cf841da92..49a90ad8b 100644 --- a/admin/layouts/component_files_folders/basic_above.php +++ b/admin/layouts/component_files_folders/basic_above.php @@ -29,7 +29,7 @@ 'joomla_component' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_files_folders/basic_fullwidth.php b/admin/layouts/component_files_folders/basic_fullwidth.php index 62e58dc11..223f7bf06 100644 --- a/admin/layouts/component_files_folders/basic_fullwidth.php +++ b/admin/layouts/component_files_folders/basic_fullwidth.php @@ -32,7 +32,7 @@ 'addfolders' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_files_folders/clone_left.php b/admin/layouts/component_files_folders/clone_left.php index 25c4eb0c1..ff98ff5d9 100644 --- a/admin/layouts/component_files_folders/clone_left.php +++ b/admin/layouts/component_files_folders/clone_left.php @@ -30,7 +30,7 @@ 'clone_me' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_files_folders/publishing.php b/admin/layouts/component_files_folders/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/component_files_folders/publishing.php +++ b/admin/layouts/component_files_folders/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_files_folders/publlshing.php b/admin/layouts/component_files_folders/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/component_files_folders/publlshing.php +++ b/admin/layouts/component_files_folders/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_modules/clone_left.php b/admin/layouts/component_modules/clone_left.php index 25c4eb0c1..ff98ff5d9 100644 --- a/admin/layouts/component_modules/clone_left.php +++ b/admin/layouts/component_modules/clone_left.php @@ -30,7 +30,7 @@ 'clone_me' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_modules/modules_above.php b/admin/layouts/component_modules/modules_above.php index cf841da92..49a90ad8b 100644 --- a/admin/layouts/component_modules/modules_above.php +++ b/admin/layouts/component_modules/modules_above.php @@ -29,7 +29,7 @@ 'joomla_component' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_modules/modules_fullwidth.php b/admin/layouts/component_modules/modules_fullwidth.php index 41348c16e..463450154 100644 --- a/admin/layouts/component_modules/modules_fullwidth.php +++ b/admin/layouts/component_modules/modules_fullwidth.php @@ -30,7 +30,7 @@ 'addjoomla_modules' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_modules/publishing.php b/admin/layouts/component_modules/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/component_modules/publishing.php +++ b/admin/layouts/component_modules/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_modules/publlshing.php b/admin/layouts/component_modules/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/component_modules/publlshing.php +++ b/admin/layouts/component_modules/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_mysql_tweaks/clone_left.php b/admin/layouts/component_mysql_tweaks/clone_left.php index 25c4eb0c1..ff98ff5d9 100644 --- a/admin/layouts/component_mysql_tweaks/clone_left.php +++ b/admin/layouts/component_mysql_tweaks/clone_left.php @@ -30,7 +30,7 @@ 'clone_me' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_mysql_tweaks/mysql_tweaks_above.php b/admin/layouts/component_mysql_tweaks/mysql_tweaks_above.php index cf841da92..49a90ad8b 100644 --- a/admin/layouts/component_mysql_tweaks/mysql_tweaks_above.php +++ b/admin/layouts/component_mysql_tweaks/mysql_tweaks_above.php @@ -29,7 +29,7 @@ 'joomla_component' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_mysql_tweaks/mysql_tweaks_fullwidth.php b/admin/layouts/component_mysql_tweaks/mysql_tweaks_fullwidth.php index c8066789a..7ea3bdef4 100644 --- a/admin/layouts/component_mysql_tweaks/mysql_tweaks_fullwidth.php +++ b/admin/layouts/component_mysql_tweaks/mysql_tweaks_fullwidth.php @@ -29,7 +29,7 @@ 'sql_tweak' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_mysql_tweaks/publishing.php b/admin/layouts/component_mysql_tweaks/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/component_mysql_tweaks/publishing.php +++ b/admin/layouts/component_mysql_tweaks/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_mysql_tweaks/publlshing.php b/admin/layouts/component_mysql_tweaks/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/component_mysql_tweaks/publlshing.php +++ b/admin/layouts/component_mysql_tweaks/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_placeholders/clone_left.php b/admin/layouts/component_placeholders/clone_left.php index 25c4eb0c1..ff98ff5d9 100644 --- a/admin/layouts/component_placeholders/clone_left.php +++ b/admin/layouts/component_placeholders/clone_left.php @@ -30,7 +30,7 @@ 'clone_me' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_placeholders/details_above.php b/admin/layouts/component_placeholders/details_above.php index cf841da92..49a90ad8b 100644 --- a/admin/layouts/component_placeholders/details_above.php +++ b/admin/layouts/component_placeholders/details_above.php @@ -29,7 +29,7 @@ 'joomla_component' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_placeholders/details_fullwidth.php b/admin/layouts/component_placeholders/details_fullwidth.php index fd57fc4a6..f664fa009 100644 --- a/admin/layouts/component_placeholders/details_fullwidth.php +++ b/admin/layouts/component_placeholders/details_fullwidth.php @@ -29,7 +29,7 @@ 'addplaceholders' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_placeholders/publishing.php b/admin/layouts/component_placeholders/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/component_placeholders/publishing.php +++ b/admin/layouts/component_placeholders/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_placeholders/publlshing.php b/admin/layouts/component_placeholders/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/component_placeholders/publlshing.php +++ b/admin/layouts/component_placeholders/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_plugins/clone_left.php b/admin/layouts/component_plugins/clone_left.php index 25c4eb0c1..ff98ff5d9 100644 --- a/admin/layouts/component_plugins/clone_left.php +++ b/admin/layouts/component_plugins/clone_left.php @@ -30,7 +30,7 @@ 'clone_me' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_plugins/plugins_above.php b/admin/layouts/component_plugins/plugins_above.php index cf841da92..49a90ad8b 100644 --- a/admin/layouts/component_plugins/plugins_above.php +++ b/admin/layouts/component_plugins/plugins_above.php @@ -29,7 +29,7 @@ 'joomla_component' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_plugins/plugins_fullwidth.php b/admin/layouts/component_plugins/plugins_fullwidth.php index 77bd19357..5c70f9f8d 100644 --- a/admin/layouts/component_plugins/plugins_fullwidth.php +++ b/admin/layouts/component_plugins/plugins_fullwidth.php @@ -30,7 +30,7 @@ 'addjoomla_plugins' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_plugins/publishing.php b/admin/layouts/component_plugins/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/component_plugins/publishing.php +++ b/admin/layouts/component_plugins/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_plugins/publlshing.php b/admin/layouts/component_plugins/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/component_plugins/publlshing.php +++ b/admin/layouts/component_plugins/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/helpers/extrusion/index.html b/admin/layouts/component_router/index.html similarity index 100% rename from admin/helpers/extrusion/index.html rename to admin/layouts/component_router/index.html diff --git a/admin/layouts/component_router/publishing.php b/admin/layouts/component_router/publishing.php new file mode 100644 index 000000000..e8b5798d7 --- /dev/null +++ b/admin/layouts/component_router/publishing.php @@ -0,0 +1,46 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// 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( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: []; + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/component_router/publlshing.php b/admin/layouts/component_router/publlshing.php new file mode 100644 index 000000000..9b1e77c16 --- /dev/null +++ b/admin/layouts/component_router/publlshing.php @@ -0,0 +1,47 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// 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( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: []; + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/component_router/settings_above.php b/admin/layouts/component_router/settings_above.php new file mode 100644 index 000000000..49a90ad8b --- /dev/null +++ b/admin/layouts/component_router/settings_above.php @@ -0,0 +1,44 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// 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( + 'joomla_component' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: []; + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/component_router/settings_fullwidth.php b/admin/layouts/component_router/settings_fullwidth.php new file mode 100644 index 000000000..81a7d5be6 --- /dev/null +++ b/admin/layouts/component_router/settings_fullwidth.php @@ -0,0 +1,54 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// 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( + 'router_settings_details_switch', + 'note_router_settings', + 'note_router_settings_advance', + 'mode_constructor_before_parent', + 'note_mode_constructor_before_parent_manual', + 'constructor_before_parent_code', + 'constructor_before_parent_manual', + 'mode_constructor_after_parent', + 'constructor_after_parent_code', + 'mode_methods', + 'methods_code' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: []; + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/component_site_views/clone_left.php b/admin/layouts/component_site_views/clone_left.php index 25c4eb0c1..ff98ff5d9 100644 --- a/admin/layouts/component_site_views/clone_left.php +++ b/admin/layouts/component_site_views/clone_left.php @@ -30,7 +30,7 @@ 'clone_me' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_site_views/publishing.php b/admin/layouts/component_site_views/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/component_site_views/publishing.php +++ b/admin/layouts/component_site_views/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_site_views/publlshing.php b/admin/layouts/component_site_views/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/component_site_views/publlshing.php +++ b/admin/layouts/component_site_views/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_site_views/views_above.php b/admin/layouts/component_site_views/views_above.php index cf841da92..49a90ad8b 100644 --- a/admin/layouts/component_site_views/views_above.php +++ b/admin/layouts/component_site_views/views_above.php @@ -29,7 +29,7 @@ 'joomla_component' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_site_views/views_fullwidth.php b/admin/layouts/component_site_views/views_fullwidth.php index 89afa4ba2..b98a52057 100644 --- a/admin/layouts/component_site_views/views_fullwidth.php +++ b/admin/layouts/component_site_views/views_fullwidth.php @@ -30,7 +30,7 @@ 'addsite_views' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_updates/clone_left.php b/admin/layouts/component_updates/clone_left.php index 25c4eb0c1..ff98ff5d9 100644 --- a/admin/layouts/component_updates/clone_left.php +++ b/admin/layouts/component_updates/clone_left.php @@ -30,7 +30,7 @@ 'clone_me' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_updates/publishing.php b/admin/layouts/component_updates/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/component_updates/publishing.php +++ b/admin/layouts/component_updates/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_updates/publlshing.php b/admin/layouts/component_updates/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/component_updates/publlshing.php +++ b/admin/layouts/component_updates/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_updates/updates_above.php b/admin/layouts/component_updates/updates_above.php index cf841da92..49a90ad8b 100644 --- a/admin/layouts/component_updates/updates_above.php +++ b/admin/layouts/component_updates/updates_above.php @@ -29,7 +29,7 @@ 'joomla_component' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/component_updates/updates_fullwidth.php b/admin/layouts/component_updates/updates_fullwidth.php index ccf6866f5..c7b1a2d6c 100644 --- a/admin/layouts/component_updates/updates_fullwidth.php +++ b/admin/layouts/component_updates/updates_fullwidth.php @@ -29,7 +29,7 @@ 'version_update' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_admin_view/custom_buttons_fullwidth.php b/admin/layouts/custom_admin_view/custom_buttons_fullwidth.php index 554de9d8c..a0036b262 100644 --- a/admin/layouts/custom_admin_view/custom_buttons_fullwidth.php +++ b/admin/layouts/custom_admin_view/custom_buttons_fullwidth.php @@ -30,7 +30,7 @@ 'php_model' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_admin_view/custom_buttons_left.php b/admin/layouts/custom_admin_view/custom_buttons_left.php index 0f09a8578..14e6b3be7 100644 --- a/admin/layouts/custom_admin_view/custom_buttons_left.php +++ b/admin/layouts/custom_admin_view/custom_buttons_left.php @@ -30,7 +30,7 @@ 'custom_button' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_admin_view/details_above.php b/admin/layouts/custom_admin_view/details_above.php index 019a14081..f4c751c3f 100644 --- a/admin/layouts/custom_admin_view/details_above.php +++ b/admin/layouts/custom_admin_view/details_above.php @@ -30,7 +30,7 @@ 'context' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_admin_view/details_fullwidth.php b/admin/layouts/custom_admin_view/details_fullwidth.php index 8c0c8e83e..4588be130 100644 --- a/admin/layouts/custom_admin_view/details_fullwidth.php +++ b/admin/layouts/custom_admin_view/details_fullwidth.php @@ -29,7 +29,7 @@ 'default' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_admin_view/details_left.php b/admin/layouts/custom_admin_view/details_left.php index df266c7f1..701581d58 100644 --- a/admin/layouts/custom_admin_view/details_left.php +++ b/admin/layouts/custom_admin_view/details_left.php @@ -34,7 +34,7 @@ 'note_add_php_language_string' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_admin_view/details_right.php b/admin/layouts/custom_admin_view/details_right.php index c97f5422e..45fb83312 100644 --- a/admin/layouts/custom_admin_view/details_right.php +++ b/admin/layouts/custom_admin_view/details_right.php @@ -32,7 +32,7 @@ 'note_snippet_usage' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_admin_view/details_rightside.php b/admin/layouts/custom_admin_view/details_rightside.php index d7ea40a77..41d309d7d 100644 --- a/admin/layouts/custom_admin_view/details_rightside.php +++ b/admin/layouts/custom_admin_view/details_rightside.php @@ -32,7 +32,7 @@ 'dynamic_values' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_admin_view/details_under.php b/admin/layouts/custom_admin_view/details_under.php index 68af44f9c..33d83cb4e 100644 --- a/admin/layouts/custom_admin_view/details_under.php +++ b/admin/layouts/custom_admin_view/details_under.php @@ -29,7 +29,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_admin_view/javascript_css_fullwidth.php b/admin/layouts/custom_admin_view/javascript_css_fullwidth.php index 2d215335d..2b81ca60e 100644 --- a/admin/layouts/custom_admin_view/javascript_css_fullwidth.php +++ b/admin/layouts/custom_admin_view/javascript_css_fullwidth.php @@ -36,7 +36,7 @@ 'css' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_admin_view/linked_components_fullwidth.php b/admin/layouts/custom_admin_view/linked_components_fullwidth.php index 4c12d1b6e..ca6a32f57 100644 --- a/admin/layouts/custom_admin_view/linked_components_fullwidth.php +++ b/admin/layouts/custom_admin_view/linked_components_fullwidth.php @@ -29,7 +29,7 @@ 'note_linked_to_notice' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_admin_view/php_fullwidth.php b/admin/layouts/custom_admin_view/php_fullwidth.php index deb10e126..84d3fe3d7 100644 --- a/admin/layouts/custom_admin_view/php_fullwidth.php +++ b/admin/layouts/custom_admin_view/php_fullwidth.php @@ -39,7 +39,7 @@ 'php_jview' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_admin_view/publishing.php b/admin/layouts/custom_admin_view/publishing.php index 97a901504..865bcf382 100644 --- a/admin/layouts/custom_admin_view/publishing.php +++ b/admin/layouts/custom_admin_view/publishing.php @@ -34,7 +34,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_admin_view/publlshing.php b/admin/layouts/custom_admin_view/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/custom_admin_view/publlshing.php +++ b/admin/layouts/custom_admin_view/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_code/details_above.php b/admin/layouts/custom_code/details_above.php index 68ce3e65c..0eb3d4b75 100644 --- a/admin/layouts/custom_code/details_above.php +++ b/admin/layouts/custom_code/details_above.php @@ -28,10 +28,11 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'target', 'system_name', + 'joomla_version', 'function_name' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_code/details_fullwidth.php b/admin/layouts/custom_code/details_fullwidth.php index 2e431c66e..8729b857b 100644 --- a/admin/layouts/custom_code/details_fullwidth.php +++ b/admin/layouts/custom_code/details_fullwidth.php @@ -32,7 +32,7 @@ 'note_placeholders_explained' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_code/details_left.php b/admin/layouts/custom_code/details_left.php index 3e3621fab..e93f38b47 100644 --- a/admin/layouts/custom_code/details_left.php +++ b/admin/layouts/custom_code/details_left.php @@ -32,7 +32,7 @@ 'hashtarget' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_code/details_right.php b/admin/layouts/custom_code/details_right.php index 2e65f13a0..8227678a0 100644 --- a/admin/layouts/custom_code/details_right.php +++ b/admin/layouts/custom_code/details_right.php @@ -31,7 +31,7 @@ 'hashendtarget' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_code/details_under.php b/admin/layouts/custom_code/details_under.php index 68af44f9c..33d83cb4e 100644 --- a/admin/layouts/custom_code/details_under.php +++ b/admin/layouts/custom_code/details_under.php @@ -29,7 +29,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_code/publishing.php b/admin/layouts/custom_code/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/custom_code/publishing.php +++ b/admin/layouts/custom_code/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/custom_code/publlshing.php b/admin/layouts/custom_code/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/custom_code/publlshing.php +++ b/admin/layouts/custom_code/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/dynamic_get/abacus_fullwidth.php b/admin/layouts/dynamic_get/abacus_fullwidth.php index 3ab1f0e03..fe4717716 100644 --- a/admin/layouts/dynamic_get/abacus_fullwidth.php +++ b/admin/layouts/dynamic_get/abacus_fullwidth.php @@ -31,7 +31,7 @@ 'php_calculation' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/dynamic_get/abacus_left.php b/admin/layouts/dynamic_get/abacus_left.php index bbf798601..d4598b9f6 100644 --- a/admin/layouts/dynamic_get/abacus_left.php +++ b/admin/layouts/dynamic_get/abacus_left.php @@ -29,7 +29,7 @@ 'addcalculation' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/dynamic_get/custom_script_fullwidth.php b/admin/layouts/dynamic_get/custom_script_fullwidth.php index d529430e0..35156aedf 100644 --- a/admin/layouts/dynamic_get/custom_script_fullwidth.php +++ b/admin/layouts/dynamic_get/custom_script_fullwidth.php @@ -37,10 +37,11 @@ 'add_php_after_getitems', 'php_after_getitems', 'add_php_router_parse', + 'php_router_parse_notice', 'php_router_parse' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/dynamic_get/joint_fullwidth.php b/admin/layouts/dynamic_get/joint_fullwidth.php index d1c05074c..dd56f9b4c 100644 --- a/admin/layouts/dynamic_get/joint_fullwidth.php +++ b/admin/layouts/dynamic_get/joint_fullwidth.php @@ -30,7 +30,7 @@ 'join_db_table' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/dynamic_get/main_above.php b/admin/layouts/dynamic_get/main_above.php index d15037af5..9b4cf461f 100644 --- a/admin/layouts/dynamic_get/main_above.php +++ b/admin/layouts/dynamic_get/main_above.php @@ -32,7 +32,7 @@ 'pagination' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/dynamic_get/main_fullwidth.php b/admin/layouts/dynamic_get/main_fullwidth.php index dd170b76d..a752fe44d 100644 --- a/admin/layouts/dynamic_get/main_fullwidth.php +++ b/admin/layouts/dynamic_get/main_fullwidth.php @@ -30,7 +30,7 @@ 'note_linked_to_notice' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/dynamic_get/main_left.php b/admin/layouts/dynamic_get/main_left.php index 48761754b..9f5f64a50 100644 --- a/admin/layouts/dynamic_get/main_left.php +++ b/admin/layouts/dynamic_get/main_left.php @@ -34,7 +34,7 @@ 'db_selection' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/dynamic_get/main_right.php b/admin/layouts/dynamic_get/main_right.php index a504903ec..6573eab2f 100644 --- a/admin/layouts/dynamic_get/main_right.php +++ b/admin/layouts/dynamic_get/main_right.php @@ -29,7 +29,7 @@ 'plugin_events' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/dynamic_get/main_under.php b/admin/layouts/dynamic_get/main_under.php index 68af44f9c..33d83cb4e 100644 --- a/admin/layouts/dynamic_get/main_under.php +++ b/admin/layouts/dynamic_get/main_under.php @@ -29,7 +29,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/dynamic_get/publishing.php b/admin/layouts/dynamic_get/publishing.php index 97a901504..865bcf382 100644 --- a/admin/layouts/dynamic_get/publishing.php +++ b/admin/layouts/dynamic_get/publishing.php @@ -34,7 +34,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/dynamic_get/publlshing.php b/admin/layouts/dynamic_get/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/dynamic_get/publlshing.php +++ b/admin/layouts/dynamic_get/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/dynamic_get/tweak_fullwidth.php b/admin/layouts/dynamic_get/tweak_fullwidth.php index 9d340c48d..bf3be56ad 100644 --- a/admin/layouts/dynamic_get/tweak_fullwidth.php +++ b/admin/layouts/dynamic_get/tweak_fullwidth.php @@ -33,7 +33,7 @@ 'global' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/field/database_fullwidth.php b/admin/layouts/field/database_fullwidth.php index f3dde1361..e1f9066b7 100644 --- a/admin/layouts/field/database_fullwidth.php +++ b/admin/layouts/field/database_fullwidth.php @@ -30,7 +30,7 @@ 'note_database_settings_needed' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/field/database_left.php b/admin/layouts/field/database_left.php index c312abeba..28043f64e 100644 --- a/admin/layouts/field/database_left.php +++ b/admin/layouts/field/database_left.php @@ -33,7 +33,7 @@ 'datadefault_other' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/field/database_right.php b/admin/layouts/field/database_right.php index d2af03303..13a86167b 100644 --- a/admin/layouts/field/database_right.php +++ b/admin/layouts/field/database_right.php @@ -29,6 +29,8 @@ 'indexes', 'null_switch', 'store', + 'medium_encryption_note', + 'basic_encryption_note', 'note_whmcs_encryption', 'note_expert_field_save_mode', 'initiator_on_save_model', @@ -37,7 +39,7 @@ 'on_get_model_field' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/field/publishing.php b/admin/layouts/field/publishing.php index 97a901504..865bcf382 100644 --- a/admin/layouts/field/publishing.php +++ b/admin/layouts/field/publishing.php @@ -34,7 +34,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/field/publlshing.php b/admin/layouts/field/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/field/publlshing.php +++ b/admin/layouts/field/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/field/scripts_left.php b/admin/layouts/field/scripts_left.php index 726f3fe4a..2b6ac97dd 100644 --- a/admin/layouts/field/scripts_left.php +++ b/admin/layouts/field/scripts_left.php @@ -32,7 +32,7 @@ 'css_views' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/field/scripts_right.php b/admin/layouts/field/scripts_right.php index 8ff91e5f2..f3d723ecf 100644 --- a/admin/layouts/field/scripts_right.php +++ b/admin/layouts/field/scripts_right.php @@ -32,7 +32,7 @@ 'javascript_views_footer' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/field/set_properties_above.php b/admin/layouts/field/set_properties_above.php index a899861d3..dfa26042d 100644 --- a/admin/layouts/field/set_properties_above.php +++ b/admin/layouts/field/set_properties_above.php @@ -31,7 +31,7 @@ 'catid' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/field/set_properties_fullwidth.php b/admin/layouts/field/set_properties_fullwidth.php index 77f331121..4a6aa70e4 100644 --- a/admin/layouts/field/set_properties_fullwidth.php +++ b/admin/layouts/field/set_properties_fullwidth.php @@ -30,7 +30,7 @@ 'note_filter_information' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/field/set_properties_under.php b/admin/layouts/field/set_properties_under.php index 68af44f9c..33d83cb4e 100644 --- a/admin/layouts/field/set_properties_under.php +++ b/admin/layouts/field/set_properties_under.php @@ -29,7 +29,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/field/type_info_fullwidth.php b/admin/layouts/field/type_info_fullwidth.php index c310d8d68..beeb5186c 100644 --- a/admin/layouts/field/type_info_fullwidth.php +++ b/admin/layouts/field/type_info_fullwidth.php @@ -30,7 +30,7 @@ 'xml' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/fieldtype/database_defaults_left.php b/admin/layouts/fieldtype/database_defaults_left.php index b0ea19849..8f786f5e8 100644 --- a/admin/layouts/fieldtype/database_defaults_left.php +++ b/admin/layouts/fieldtype/database_defaults_left.php @@ -34,7 +34,7 @@ 'datadefault_other' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/fieldtype/database_defaults_right.php b/admin/layouts/fieldtype/database_defaults_right.php index ceb67b129..7feeeaac0 100644 --- a/admin/layouts/fieldtype/database_defaults_right.php +++ b/admin/layouts/fieldtype/database_defaults_right.php @@ -29,10 +29,12 @@ 'indexes', 'null_switch', 'store', + 'basic_encryption_note', + 'medium_encryption_note', 'note_whmcs_encryption' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/fieldtype/details_above.php b/admin/layouts/fieldtype/details_above.php index 4b44cd601..4cf7932ce 100644 --- a/admin/layouts/fieldtype/details_above.php +++ b/admin/layouts/fieldtype/details_above.php @@ -29,7 +29,7 @@ 'name' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/fieldtype/details_fullwidth.php b/admin/layouts/fieldtype/details_fullwidth.php index e150a3b3e..e3315a49c 100644 --- a/admin/layouts/fieldtype/details_fullwidth.php +++ b/admin/layouts/fieldtype/details_fullwidth.php @@ -31,7 +31,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/fieldtype/details_left.php b/admin/layouts/fieldtype/details_left.php index 0e67b869b..e04cc70b7 100644 --- a/admin/layouts/fieldtype/details_left.php +++ b/admin/layouts/fieldtype/details_left.php @@ -30,7 +30,7 @@ 'short_description' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/fieldtype/details_right.php b/admin/layouts/fieldtype/details_right.php index 37215496b..bd0ef9952 100644 --- a/admin/layouts/fieldtype/details_right.php +++ b/admin/layouts/fieldtype/details_right.php @@ -29,7 +29,7 @@ 'description' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/fieldtype/fields_fullwidth.php b/admin/layouts/fieldtype/fields_fullwidth.php index badb9937b..12843da04 100644 --- a/admin/layouts/fieldtype/fields_fullwidth.php +++ b/admin/layouts/fieldtype/fields_fullwidth.php @@ -12,22 +12,28 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper; + // set the defaults -$items = $displayData->vycfields; -$user = JFactory::getUser(); +$items = $displayData->vxtfields; +$user = Factory::getUser(); $id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit"; // set a return value $return = ($id) ? "index.php?option=com_componentbuilder&view=fieldtype&layout=edit&id=" . $id : ""; // check for a return value -$jinput = JFactory::getApplication()->input; +$jinput = Factory::getApplication()->input; if ($_return = $jinput->get('return', null, 'base64')) { $return .= "&return=" . $_return; } // check if return value was set -if (ComponentbuilderHelper::checkString($return)) +if (StringHelper::check($return)) { // set the referral values $ref = ($id) ? "&ref=fieldtype&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return)); @@ -47,40 +53,40 @@
    get('field.create')): ?>
    - - + +


    - + @@ -88,7 +94,7 @@ $item): ?> authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); + $userChkOut = Factory::getUser($item->checked_out); $canDo = ComponentbuilderHelper::getActions('field',$item,'fields'); ?> @@ -96,7 +102,7 @@ get('field.edit')): ?> escape($item->name); ?>checked_out): ?> - name, $item->checked_out_time, 'fields.', $canCheckin); ?> + name, $item->checked_out_time, 'fields.', $canCheckin); ?> escape($item->name); ?> @@ -106,16 +112,16 @@ escape($item->fieldtype_name); ?> published == 1): ?> published == 0): ?> published == 2): ?> published == -2): ?> @@ -158,7 +164,7 @@
    - + - + - + - + - + - + - + - + - +
    - datatype); ?> + datatype); ?> - indexes); ?> + indexes); ?> - null_switch); ?> + null_switch); ?> - store); ?> + store); ?> authorise('core.edit', 'com_componentbuilder.field.category.' . (int)$item->catid)): ?> @@ -126,26 +132,26 @@ - - + + - - + + - - + + - - + +
    - +
    diff --git a/admin/layouts/fieldtype/publishing.php b/admin/layouts/fieldtype/publishing.php index 97a901504..865bcf382 100644 --- a/admin/layouts/fieldtype/publishing.php +++ b/admin/layouts/fieldtype/publishing.php @@ -34,7 +34,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/fieldtype/publlshing.php b/admin/layouts/fieldtype/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/fieldtype/publlshing.php +++ b/admin/layouts/fieldtype/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/help_document/details_above.php b/admin/layouts/help_document/details_above.php index 5d8ed3d98..f3a8e7abf 100644 --- a/admin/layouts/help_document/details_above.php +++ b/admin/layouts/help_document/details_above.php @@ -30,7 +30,7 @@ 'alias' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/help_document/details_fullwidth.php b/admin/layouts/help_document/details_fullwidth.php index 2d71a04d6..913080e6e 100644 --- a/admin/layouts/help_document/details_fullwidth.php +++ b/admin/layouts/help_document/details_fullwidth.php @@ -29,7 +29,7 @@ 'content' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/help_document/details_left.php b/admin/layouts/help_document/details_left.php index f72ddc06e..695279e92 100644 --- a/admin/layouts/help_document/details_left.php +++ b/admin/layouts/help_document/details_left.php @@ -33,7 +33,7 @@ 'site_view' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/help_document/details_right.php b/admin/layouts/help_document/details_right.php index 5dcfa71db..b986a65f5 100644 --- a/admin/layouts/help_document/details_right.php +++ b/admin/layouts/help_document/details_right.php @@ -31,7 +31,7 @@ 'article' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/help_document/details_under.php b/admin/layouts/help_document/details_under.php index 68af44f9c..33d83cb4e 100644 --- a/admin/layouts/help_document/details_under.php +++ b/admin/layouts/help_document/details_under.php @@ -29,7 +29,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/help_document/publishing.php b/admin/layouts/help_document/publishing.php index 09643bbaa..07e9d9a2a 100644 --- a/admin/layouts/help_document/publishing.php +++ b/admin/layouts/help_document/publishing.php @@ -32,7 +32,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/help_document/publlshing.php b/admin/layouts/help_document/publlshing.php index cb41f62bc..d54df3db0 100644 --- a/admin/layouts/help_document/publlshing.php +++ b/admin/layouts/help_document/publlshing.php @@ -33,7 +33,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/jcbnoticeboardpro.php b/admin/layouts/jcbnoticeboardpro.php index 1d0e53a8c..43533de2d 100644 --- a/admin/layouts/jcbnoticeboardpro.php +++ b/admin/layouts/jcbnoticeboardpro.php @@ -12,11 +12,16 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?>
    - -
    .
    + +
    .
    diff --git a/admin/layouts/jcbnoticeboardtabs.php b/admin/layouts/jcbnoticeboardtabs.php index 6a6ca9fbe..7e7693314 100644 --- a/admin/layouts/jcbnoticeboardtabs.php +++ b/admin/layouts/jcbnoticeboardtabs.php @@ -12,18 +12,23 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> -
    - $displayData['active'] . '-noticeboard')) ?> - - -
    - - - -
    - - +
    + $displayData['active'] . '-noticeboard')); ?> + + +
    + + + +
    + +
    diff --git a/admin/layouts/jcbnoticeboardvdm.php b/admin/layouts/jcbnoticeboardvdm.php index 04dec6150..99bc2f1f4 100644 --- a/admin/layouts/jcbnoticeboardvdm.php +++ b/admin/layouts/jcbnoticeboardvdm.php @@ -12,11 +12,16 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?>
    - -
    .
    + +
    .
    diff --git a/admin/layouts/jcbsupportmessage.php b/admin/layouts/jcbsupportmessage.php new file mode 100644 index 000000000..4a242848c --- /dev/null +++ b/admin/layouts/jcbsupportmessage.php @@ -0,0 +1,121 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('JPATH_BASE') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + +// Different support requests/appreciation +$support = [ + Text::_("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"), + Text::_("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"), + Text::_("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"), + Text::_("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"), + Text::_("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"), + Text::_("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"), + Text::_("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"), + Text::_("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"), + Text::_("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 = [ + Text::_("COM_COMPONENTBUILDER_JCB_ENABLES_PHP_DEVELOPMENT"), + Text::_("COM_COMPONENTBUILDER_JCB_SUPPORTS_OPENSOURCE"), + Text::_("COM_COMPONENTBUILDER_JCB_SAVES_TIME"), + Text::_("COM_COMPONENTBUILDER_JCB_IMPROVES_WORKFLOW"), + Text::_("COM_COMPONENTBUILDER_JCB_EMPOWERS_PHP_DEVELOPERS"), + Text::_("COM_COMPONENTBUILDER_JCB_STREAMLINES_DEVELOPMENT"), + Text::_("COM_COMPONENTBUILDER_JCB_PROMOTES_EFFICIENCY"), + Text::_("COM_COMPONENTBUILDER_JCB_ENHANCES_PRODUCTIVITY"), + Text::_("COM_COMPONENTBUILDER_JCB_INCREASES_REVENUE"), + Text::_("COM_COMPONENTBUILDER_JCB_REDUCES_DEVELOPMENT_COSTS"), + Text::_("COM_COMPONENTBUILDER_JCB_SUPPORTS_THE_PHP_COMMUNITY"), + Text::_("COM_COMPONENTBUILDER_JCB_IMPROVES_PHP_DEVELOPMENT"), + Text::_("COM_COMPONENTBUILDER_JCB_HELPS_GROW_BUSINESSES"), + Text::_("COM_COMPONENTBUILDER_JCB_SUPPORTS_PHP_INNOVATION"), + Text::_("COM_COMPONENTBUILDER_JCB_CONTRIBUTES_TO_OPENSOURCE"), + Text::_("COM_COMPONENTBUILDER_JCB_PROVIDES_A_BETTER_EXPERIENCE"), + Text::_("COM_COMPONENTBUILDER_JCB_OFFERS_MORE_FEATURES"), + Text::_("COM_COMPONENTBUILDER_JCB_INCREASES_DEVELOPMENT_SPEED"), + Text::_("COM_COMPONENTBUILDER_JCB_IMPROVES_USER_EXPERIENCE"), + Text::_("COM_COMPONENTBUILDER_JCB_INCREASES_USER_SATISFACTION"), + Text::_("COM_COMPONENTBUILDER_JCB_LOWERS_DEVELOPMENT_STRESS"), + Text::_("COM_COMPONENTBUILDER_JCB_PROMOTES_GOODWILL"), + Text::_("COM_COMPONENTBUILDER_JCB_OFFERS_A_STRONGER_SOLUTION"), + Text::_("COM_COMPONENTBUILDER_JCB_SUPPORTS_A_WORTHY_CAUSE"), + Text::_("COM_COMPONENTBUILDER_JCB_BUILDS_A_BETTER_FUTURE"), + Text::_("COM_COMPONENTBUILDER_JCB_FOSTERS_A_STRONG_COMMUNITY"), + Text::_("COM_COMPONENTBUILDER_JCB_IMPROVES_PHPS_REPUTATION"), + Text::_("COM_COMPONENTBUILDER_JCB_SUPPORTS_A_THRIVING_ECOSYSTEM"), + Text::_("COM_COMPONENTBUILDER_JCB_HELPS_PHP_THRIVE"), + Text::_("COM_COMPONENTBUILDER_JCB_INVESTS_IN_PHPS_SUCCESS") +]; + +// build the support button +$support_titles = $titles[random_int(0, 29)]; + +// the button names +$button_names = [ + Text::_("COM_COMPONENTBUILDER_DONATE_TO_JCB"), + Text::_("COM_COMPONENTBUILDER_SUPPORT_JCB_TODAY"), + Text::_("COM_COMPONENTBUILDER_CONTRIBUTE_TO_JCB"), + Text::_("COM_COMPONENTBUILDER_INVEST_IN_JCB"), + Text::_("COM_COMPONENTBUILDER_GIVE_TO_JCB"), + Text::_("COM_COMPONENTBUILDER_JOIN_JCBS_MISSION"), + Text::_("COM_COMPONENTBUILDER_HELP_JCB_GROW"), + Text::_("COM_COMPONENTBUILDER_BE_A_PART_OF_JCB"), + Text::_("COM_COMPONENTBUILDER_JCB_NEEDS_YOU"), + Text::_("COM_COMPONENTBUILDER_BECOME_A_CONTRIBUTOR"), + Text::_("COM_COMPONENTBUILDER_EMPOWER_JCB"), + Text::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_IMPACT"), + Text::_("COM_COMPONENTBUILDER_JOIN_JCBS_COMMUNITY"), + Text::_("COM_COMPONENTBUILDER_MAKE_A_DIFFERENCE_WITH_JCB"), + Text::_("COM_COMPONENTBUILDER_JCB_YOUR_SUPPORT_MATTERS"), + Text::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_THE_FUTURE"), + Text::_("COM_COMPONENTBUILDER_JOIN_JCBS_JOURNEY"), + Text::_("COM_COMPONENTBUILDER_JCB_YOUR_SUPPORT_COUNTS"), + Text::_("COM_COMPONENTBUILDER_EMPOWER_THE_FUTURE_WITH_JCB"), + Text::_("COM_COMPONENTBUILDER_JCB_YOUR_CONTRIBUTION_MATTERS"), + Text::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_PROGRESS"), + Text::_("COM_COMPONENTBUILDER_JOIN_JCBS_VISION"), + Text::_("COM_COMPONENTBUILDER_ELEVATE_JCB_TODAY"), + Text::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_CHANGE"), + Text::_("COM_COMPONENTBUILDER_JCB_YOUR_DONATION_MATTERS"), + Text::_("COM_COMPONENTBUILDER_JCB_BE_THE_CHANGE"), + Text::_("COM_COMPONENTBUILDER_JOIN_JCBS_SUCCESS"), + Text::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_SUCCESS"), + Text::_("COM_COMPONENTBUILDER_JCB_YOUR_SUPPORT_IS_KEY"), + Text::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_THE_COMMUNITY"), + Text::_("COM_COMPONENTBUILDER_JCB_YOUR_SUPPORT_MATTERS_MOST"), + Text::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_YOUR_FUTURE"), + Text::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_PROGRESS_TODAY") +]; + +// build the support button +$support_button = $button_names[random_int(0, 32)]; + +?> + +

    + +

    + + + +
    diff --git a/admin/layouts/joomla_component/admin_views_fullwidth.php b/admin/layouts/joomla_component/admin_views_fullwidth.php index 49ecdf8a6..5c81e30d0 100644 --- a/admin/layouts/joomla_component/admin_views_fullwidth.php +++ b/admin/layouts/joomla_component/admin_views_fullwidth.php @@ -30,7 +30,7 @@ 'note_display_component_admin_views' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/custom_admin_views_fullwidth.php b/admin/layouts/joomla_component/custom_admin_views_fullwidth.php index 0b1cc116a..66d27edee 100644 --- a/admin/layouts/joomla_component/custom_admin_views_fullwidth.php +++ b/admin/layouts/joomla_component/custom_admin_views_fullwidth.php @@ -30,7 +30,7 @@ 'note_display_component_custom_admin_views' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/dash_install_fullwidth.php b/admin/layouts/joomla_component/dash_install_fullwidth.php index 7eccffe1f..73a740bb6 100644 --- a/admin/layouts/joomla_component/dash_install_fullwidth.php +++ b/admin/layouts/joomla_component/dash_install_fullwidth.php @@ -35,10 +35,12 @@ 'add_php_postflight_update', 'php_postflight_update', 'add_php_method_uninstall', - 'php_method_uninstall' + 'php_method_uninstall', + 'add_php_method_install', + 'php_method_install' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/dash_install_left.php b/admin/layouts/joomla_component/dash_install_left.php index 636e104f9..cb832413a 100644 --- a/admin/layouts/joomla_component/dash_install_left.php +++ b/admin/layouts/joomla_component/dash_install_left.php @@ -29,7 +29,7 @@ 'dashboard_type' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/dash_install_right.php b/admin/layouts/joomla_component/dash_install_right.php index 510a9183e..3bd773f74 100644 --- a/admin/layouts/joomla_component/dash_install_right.php +++ b/admin/layouts/joomla_component/dash_install_right.php @@ -31,7 +31,7 @@ 'note_botton_component_dashboard' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/details_above.php b/admin/layouts/joomla_component/details_above.php index 6cbed1d15..38514f015 100644 --- a/admin/layouts/joomla_component/details_above.php +++ b/admin/layouts/joomla_component/details_above.php @@ -27,10 +27,11 @@ // get the fields $fields = $displayData->get($fields_tab_layout) ?: array( 'system_name', + 'preferred_joomla_version', 'add_powers' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/details_left.php b/admin/layouts/joomla_component/details_left.php index 9ddb7a9a8..6f450a888 100644 --- a/admin/layouts/joomla_component/details_left.php +++ b/admin/layouts/joomla_component/details_left.php @@ -40,7 +40,7 @@ 'description' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/details_right.php b/admin/layouts/joomla_component/details_right.php index 2015302da..72051362e 100644 --- a/admin/layouts/joomla_component/details_right.php +++ b/admin/layouts/joomla_component/details_right.php @@ -42,7 +42,7 @@ 'copyright' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/details_under.php b/admin/layouts/joomla_component/details_under.php index 68af44f9c..33d83cb4e 100644 --- a/admin/layouts/joomla_component/details_under.php +++ b/admin/layouts/joomla_component/details_under.php @@ -29,7 +29,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/dynamic_build_beta_fullwidth.php b/admin/layouts/joomla_component/dynamic_build_fullwidth.php similarity index 96% rename from admin/layouts/joomla_component/dynamic_build_beta_fullwidth.php rename to admin/layouts/joomla_component/dynamic_build_fullwidth.php index 8f152abbf..903b1f9e6 100644 --- a/admin/layouts/joomla_component/dynamic_build_beta_fullwidth.php +++ b/admin/layouts/joomla_component/dynamic_build_fullwidth.php @@ -31,7 +31,7 @@ 'buildcompsql' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/dynamic_integration_left.php b/admin/layouts/joomla_component/dynamic_integration_left.php index c35d75f98..62c76d716 100644 --- a/admin/layouts/joomla_component/dynamic_integration_left.php +++ b/admin/layouts/joomla_component/dynamic_integration_left.php @@ -34,10 +34,18 @@ 'note_update_server_note_other', 'update_server', 'add_sales_server', - 'sales_server' + 'sales_server', + 'add_backup_folder_path', + 'note_backup_folder_path', + 'backup_folder_path', + 'add_git_folder_path', + 'note_git_folder_path', + 'git_folder_path', + 'add_jcb_powers_path', + 'jcb_powers_path' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/dynamic_integration_right.php b/admin/layouts/joomla_component/dynamic_integration_right.php index 36d48a06f..9cabdf06f 100644 --- a/admin/layouts/joomla_component/dynamic_integration_right.php +++ b/admin/layouts/joomla_component/dynamic_integration_right.php @@ -34,7 +34,7 @@ 'crowdin_account_api_key' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/libs_helpers_fullwidth.php b/admin/layouts/joomla_component/libs_helpers_fullwidth.php index 4bb7292fb..8eb3abfc8 100644 --- a/admin/layouts/joomla_component/libs_helpers_fullwidth.php +++ b/admin/layouts/joomla_component/libs_helpers_fullwidth.php @@ -48,7 +48,7 @@ 'css_site' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/metadata.php b/admin/layouts/joomla_component/metadata.php index 47d8b22df..be4510d01 100644 --- a/admin/layouts/joomla_component/metadata.php +++ b/admin/layouts/joomla_component/metadata.php @@ -12,6 +12,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + $form = $displayData->getForm(); // JLayout for standard handling of metadata fields in the administrator content edit screens. @@ -20,7 +22,7 @@ $fieldSet) : ?> description) && trim($fieldSet->description)) : ?> -

    escape(JText::_($fieldSet->description)); ?>

    +

    escape(Text::_($fieldSet->description)); ?>

    get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/publishing.php b/admin/layouts/joomla_component/publishing.php index 0375c1a3a..048dfd556 100644 --- a/admin/layouts/joomla_component/publishing.php +++ b/admin/layouts/joomla_component/publishing.php @@ -40,7 +40,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/readme_left.php b/admin/layouts/joomla_component/readme_left.php index 767d64d89..50544b2fc 100644 --- a/admin/layouts/joomla_component/readme_left.php +++ b/admin/layouts/joomla_component/readme_left.php @@ -30,7 +30,7 @@ 'readme' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/readme_right.php b/admin/layouts/joomla_component/readme_right.php index 8d81512fc..c51b74829 100644 --- a/admin/layouts/joomla_component/readme_right.php +++ b/admin/layouts/joomla_component/readme_right.php @@ -29,7 +29,7 @@ 'note_readme' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/settings_fullwidth.php b/admin/layouts/joomla_component/settings_fullwidth.php index f8b075556..4e723c4b7 100644 --- a/admin/layouts/joomla_component/settings_fullwidth.php +++ b/admin/layouts/joomla_component/settings_fullwidth.php @@ -26,14 +26,14 @@ // get the fields $fields = $displayData->get($fields_tab_layout) ?: array( - 'spacer_hr_7', + 'spacer_hr_8', 'note_on_contributors', 'addcontributors', 'emptycontributors', 'number' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/settings_left.php b/admin/layouts/joomla_component/settings_left.php index 55a1ee310..5a9966cdf 100644 --- a/admin/layouts/joomla_component/settings_left.php +++ b/admin/layouts/joomla_component/settings_left.php @@ -35,7 +35,7 @@ 'note_add_config' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/settings_right.php b/admin/layouts/joomla_component/settings_right.php index 9b45ab209..32fff8939 100644 --- a/admin/layouts/joomla_component/settings_right.php +++ b/admin/layouts/joomla_component/settings_right.php @@ -28,19 +28,22 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'note_component_files_folders', 'spacer_hr_4', + 'add_namespace_prefix', + 'namespace_prefix', + 'spacer_hr_5', 'add_menu_prefix', 'menu_prefix', - 'spacer_hr_5', + 'spacer_hr_6', 'to_ignore_note', 'toignore', - 'spacer_hr_6', + 'spacer_hr_7', 'jcb_export_package_note', 'export_key', 'joomla_source_link', 'export_buy_link' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_component/site_views_fullwidth.php b/admin/layouts/joomla_component/site_views_fullwidth.php index 5ea3ff9a1..4807ed09c 100644 --- a/admin/layouts/joomla_component/site_views_fullwidth.php +++ b/admin/layouts/joomla_component/site_views_fullwidth.php @@ -30,7 +30,7 @@ 'note_display_component_site_views' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/code_fullwidth.php b/admin/layouts/joomla_module/code_fullwidth.php index 7ba3cd28c..09ee16e40 100644 --- a/admin/layouts/joomla_module/code_fullwidth.php +++ b/admin/layouts/joomla_module/code_fullwidth.php @@ -29,7 +29,7 @@ 'mod_code' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/code_left.php b/admin/layouts/joomla_module/code_left.php index 224902240..b1336905b 100644 --- a/admin/layouts/joomla_module/code_left.php +++ b/admin/layouts/joomla_module/code_left.php @@ -29,7 +29,7 @@ 'custom_get' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/code_right.php b/admin/layouts/joomla_module/code_right.php index 8a59d48d4..1fa0b3736 100644 --- a/admin/layouts/joomla_module/code_right.php +++ b/admin/layouts/joomla_module/code_right.php @@ -29,7 +29,7 @@ 'note_mod_file_options' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/dynamic_integration_left.php b/admin/layouts/joomla_module/dynamic_integration_left.php index c35d75f98..198c4d093 100644 --- a/admin/layouts/joomla_module/dynamic_integration_left.php +++ b/admin/layouts/joomla_module/dynamic_integration_left.php @@ -37,7 +37,7 @@ 'sales_server' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/forms_fields_fullwidth.php b/admin/layouts/joomla_module/forms_fields_fullwidth.php index 7de237af2..f193193b7 100644 --- a/admin/layouts/joomla_module/forms_fields_fullwidth.php +++ b/admin/layouts/joomla_module/forms_fields_fullwidth.php @@ -29,7 +29,7 @@ 'fields' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/helper_fullwidth.php b/admin/layouts/joomla_module/helper_fullwidth.php index ebfea4515..1ab63004b 100644 --- a/admin/layouts/joomla_module/helper_fullwidth.php +++ b/admin/layouts/joomla_module/helper_fullwidth.php @@ -30,7 +30,7 @@ 'class_helper_code' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/helper_left.php b/admin/layouts/joomla_module/helper_left.php index ff4aab6f6..a4769693f 100644 --- a/admin/layouts/joomla_module/helper_left.php +++ b/admin/layouts/joomla_module/helper_left.php @@ -29,7 +29,7 @@ 'add_class_helper' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/helper_right.php b/admin/layouts/joomla_module/helper_right.php index 0778bbd69..306e6e1a6 100644 --- a/admin/layouts/joomla_module/helper_right.php +++ b/admin/layouts/joomla_module/helper_right.php @@ -29,7 +29,7 @@ 'add_class_helper_header' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/html_above.php b/admin/layouts/joomla_module/html_above.php index 85fb585df..bb1bb1a53 100644 --- a/admin/layouts/joomla_module/html_above.php +++ b/admin/layouts/joomla_module/html_above.php @@ -31,7 +31,7 @@ 'target' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/html_fullwidth.php b/admin/layouts/joomla_module/html_fullwidth.php index 84d9224f9..2a0879327 100644 --- a/admin/layouts/joomla_module/html_fullwidth.php +++ b/admin/layouts/joomla_module/html_fullwidth.php @@ -31,7 +31,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/html_left.php b/admin/layouts/joomla_module/html_left.php index 5e6a487b9..b42bff411 100644 --- a/admin/layouts/joomla_module/html_left.php +++ b/admin/layouts/joomla_module/html_left.php @@ -33,7 +33,7 @@ 'note_add_php_language_string' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/html_right.php b/admin/layouts/joomla_module/html_right.php index f7e79a421..d26d9c258 100644 --- a/admin/layouts/joomla_module/html_right.php +++ b/admin/layouts/joomla_module/html_right.php @@ -31,7 +31,7 @@ 'note_snippet_usage' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/mysql_fullwidth.php b/admin/layouts/joomla_module/mysql_fullwidth.php index acde25167..c51f898bb 100644 --- a/admin/layouts/joomla_module/mysql_fullwidth.php +++ b/admin/layouts/joomla_module/mysql_fullwidth.php @@ -32,7 +32,7 @@ 'sql_uninstall' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/publishing.php b/admin/layouts/joomla_module/publishing.php index 97a901504..865bcf382 100644 --- a/admin/layouts/joomla_module/publishing.php +++ b/admin/layouts/joomla_module/publishing.php @@ -34,7 +34,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/publlshing.php b/admin/layouts/joomla_module/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/joomla_module/publlshing.php +++ b/admin/layouts/joomla_module/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/readme_left.php b/admin/layouts/joomla_module/readme_left.php index 767d64d89..50544b2fc 100644 --- a/admin/layouts/joomla_module/readme_left.php +++ b/admin/layouts/joomla_module/readme_left.php @@ -30,7 +30,7 @@ 'readme' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module/script_file_fullwidth.php b/admin/layouts/joomla_module/script_file_fullwidth.php index 8c37a873c..f49d7850b 100644 --- a/admin/layouts/joomla_module/script_file_fullwidth.php +++ b/admin/layouts/joomla_module/script_file_fullwidth.php @@ -42,7 +42,7 @@ 'php_method_uninstall' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module_files_folders_urls/advance_fullwidth.php b/admin/layouts/joomla_module_files_folders_urls/advance_fullwidth.php index 5fd19b54f..3d510dcae 100644 --- a/admin/layouts/joomla_module_files_folders_urls/advance_fullwidth.php +++ b/admin/layouts/joomla_module_files_folders_urls/advance_fullwidth.php @@ -33,7 +33,7 @@ 'note_constant_paths' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module_files_folders_urls/basic_above.php b/admin/layouts/joomla_module_files_folders_urls/basic_above.php index 91f5cad4c..1845b0a09 100644 --- a/admin/layouts/joomla_module_files_folders_urls/basic_above.php +++ b/admin/layouts/joomla_module_files_folders_urls/basic_above.php @@ -29,7 +29,7 @@ 'joomla_module' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module_files_folders_urls/basic_fullwidth.php b/admin/layouts/joomla_module_files_folders_urls/basic_fullwidth.php index 5026c32d6..ad3ccb77b 100644 --- a/admin/layouts/joomla_module_files_folders_urls/basic_fullwidth.php +++ b/admin/layouts/joomla_module_files_folders_urls/basic_fullwidth.php @@ -34,7 +34,7 @@ 'addfolders' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module_files_folders_urls/publishing.php b/admin/layouts/joomla_module_files_folders_urls/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/joomla_module_files_folders_urls/publishing.php +++ b/admin/layouts/joomla_module_files_folders_urls/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module_files_folders_urls/publlshing.php b/admin/layouts/joomla_module_files_folders_urls/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/joomla_module_files_folders_urls/publlshing.php +++ b/admin/layouts/joomla_module_files_folders_urls/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module_updates/publishing.php b/admin/layouts/joomla_module_updates/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/joomla_module_updates/publishing.php +++ b/admin/layouts/joomla_module_updates/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module_updates/publlshing.php b/admin/layouts/joomla_module_updates/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/joomla_module_updates/publlshing.php +++ b/admin/layouts/joomla_module_updates/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module_updates/updates_above.php b/admin/layouts/joomla_module_updates/updates_above.php index 91f5cad4c..1845b0a09 100644 --- a/admin/layouts/joomla_module_updates/updates_above.php +++ b/admin/layouts/joomla_module_updates/updates_above.php @@ -29,7 +29,7 @@ 'joomla_module' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_module_updates/updates_fullwidth.php b/admin/layouts/joomla_module_updates/updates_fullwidth.php index ccf6866f5..c7b1a2d6c 100644 --- a/admin/layouts/joomla_module_updates/updates_fullwidth.php +++ b/admin/layouts/joomla_module_updates/updates_fullwidth.php @@ -29,7 +29,7 @@ 'version_update' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin/code_above.php b/admin/layouts/joomla_plugin/code_above.php index 8af6e74c1..08459ee0e 100644 --- a/admin/layouts/joomla_plugin/code_above.php +++ b/admin/layouts/joomla_plugin/code_above.php @@ -30,7 +30,7 @@ 'plugin_version' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin/code_fullwidth.php b/admin/layouts/joomla_plugin/code_fullwidth.php index 7b0382906..241bfebc7 100644 --- a/admin/layouts/joomla_plugin/code_fullwidth.php +++ b/admin/layouts/joomla_plugin/code_fullwidth.php @@ -32,7 +32,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin/code_left.php b/admin/layouts/joomla_plugin/code_left.php index 6bbaf6c61..124c62611 100644 --- a/admin/layouts/joomla_plugin/code_left.php +++ b/admin/layouts/joomla_plugin/code_left.php @@ -34,7 +34,7 @@ 'note_plugin' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin/code_right.php b/admin/layouts/joomla_plugin/code_right.php index cce180871..bac079e74 100644 --- a/admin/layouts/joomla_plugin/code_right.php +++ b/admin/layouts/joomla_plugin/code_right.php @@ -30,7 +30,7 @@ 'method_selection' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin/dynamic_integration_left.php b/admin/layouts/joomla_plugin/dynamic_integration_left.php index c35d75f98..198c4d093 100644 --- a/admin/layouts/joomla_plugin/dynamic_integration_left.php +++ b/admin/layouts/joomla_plugin/dynamic_integration_left.php @@ -37,7 +37,7 @@ 'sales_server' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin/forms_fields_fullwidth.php b/admin/layouts/joomla_plugin/forms_fields_fullwidth.php index 7de237af2..f193193b7 100644 --- a/admin/layouts/joomla_plugin/forms_fields_fullwidth.php +++ b/admin/layouts/joomla_plugin/forms_fields_fullwidth.php @@ -29,7 +29,7 @@ 'fields' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin/mysql_fullwidth.php b/admin/layouts/joomla_plugin/mysql_fullwidth.php index acde25167..c51f898bb 100644 --- a/admin/layouts/joomla_plugin/mysql_fullwidth.php +++ b/admin/layouts/joomla_plugin/mysql_fullwidth.php @@ -32,7 +32,7 @@ 'sql_uninstall' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin/publishing.php b/admin/layouts/joomla_plugin/publishing.php index 97a901504..865bcf382 100644 --- a/admin/layouts/joomla_plugin/publishing.php +++ b/admin/layouts/joomla_plugin/publishing.php @@ -34,7 +34,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin/publlshing.php b/admin/layouts/joomla_plugin/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/joomla_plugin/publlshing.php +++ b/admin/layouts/joomla_plugin/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin/readme_left.php b/admin/layouts/joomla_plugin/readme_left.php index 767d64d89..50544b2fc 100644 --- a/admin/layouts/joomla_plugin/readme_left.php +++ b/admin/layouts/joomla_plugin/readme_left.php @@ -30,7 +30,7 @@ 'readme' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin/script_file_fullwidth.php b/admin/layouts/joomla_plugin/script_file_fullwidth.php index 8c37a873c..f49d7850b 100644 --- a/admin/layouts/joomla_plugin/script_file_fullwidth.php +++ b/admin/layouts/joomla_plugin/script_file_fullwidth.php @@ -42,7 +42,7 @@ 'php_method_uninstall' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin_files_folders_urls/advance_fullwidth.php b/admin/layouts/joomla_plugin_files_folders_urls/advance_fullwidth.php index 5fd19b54f..3d510dcae 100644 --- a/admin/layouts/joomla_plugin_files_folders_urls/advance_fullwidth.php +++ b/admin/layouts/joomla_plugin_files_folders_urls/advance_fullwidth.php @@ -33,7 +33,7 @@ 'note_constant_paths' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin_files_folders_urls/basic_above.php b/admin/layouts/joomla_plugin_files_folders_urls/basic_above.php index 0aa6bd601..74d3b5c8f 100644 --- a/admin/layouts/joomla_plugin_files_folders_urls/basic_above.php +++ b/admin/layouts/joomla_plugin_files_folders_urls/basic_above.php @@ -29,7 +29,7 @@ 'joomla_plugin' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin_files_folders_urls/basic_fullwidth.php b/admin/layouts/joomla_plugin_files_folders_urls/basic_fullwidth.php index 5026c32d6..ad3ccb77b 100644 --- a/admin/layouts/joomla_plugin_files_folders_urls/basic_fullwidth.php +++ b/admin/layouts/joomla_plugin_files_folders_urls/basic_fullwidth.php @@ -34,7 +34,7 @@ 'addfolders' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin_files_folders_urls/publishing.php b/admin/layouts/joomla_plugin_files_folders_urls/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/joomla_plugin_files_folders_urls/publishing.php +++ b/admin/layouts/joomla_plugin_files_folders_urls/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin_files_folders_urls/publlshing.php b/admin/layouts/joomla_plugin_files_folders_urls/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/joomla_plugin_files_folders_urls/publlshing.php +++ b/admin/layouts/joomla_plugin_files_folders_urls/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin_group/details_left.php b/admin/layouts/joomla_plugin_group/details_left.php index 10724a9ed..698053efe 100644 --- a/admin/layouts/joomla_plugin_group/details_left.php +++ b/admin/layouts/joomla_plugin_group/details_left.php @@ -29,7 +29,7 @@ 'name' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin_group/details_right.php b/admin/layouts/joomla_plugin_group/details_right.php index 5e8f3f7a9..586dcd2ef 100644 --- a/admin/layouts/joomla_plugin_group/details_right.php +++ b/admin/layouts/joomla_plugin_group/details_right.php @@ -29,7 +29,7 @@ 'class_extends' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin_group/publishing.php b/admin/layouts/joomla_plugin_group/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/joomla_plugin_group/publishing.php +++ b/admin/layouts/joomla_plugin_group/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin_group/publlshing.php b/admin/layouts/joomla_plugin_group/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/joomla_plugin_group/publlshing.php +++ b/admin/layouts/joomla_plugin_group/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin_updates/publishing.php b/admin/layouts/joomla_plugin_updates/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/joomla_plugin_updates/publishing.php +++ b/admin/layouts/joomla_plugin_updates/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin_updates/publlshing.php b/admin/layouts/joomla_plugin_updates/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/joomla_plugin_updates/publlshing.php +++ b/admin/layouts/joomla_plugin_updates/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin_updates/updates_above.php b/admin/layouts/joomla_plugin_updates/updates_above.php index 0aa6bd601..74d3b5c8f 100644 --- a/admin/layouts/joomla_plugin_updates/updates_above.php +++ b/admin/layouts/joomla_plugin_updates/updates_above.php @@ -29,7 +29,7 @@ 'joomla_plugin' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/joomla_plugin_updates/updates_fullwidth.php b/admin/layouts/joomla_plugin_updates/updates_fullwidth.php index ccf6866f5..c7b1a2d6c 100644 --- a/admin/layouts/joomla_plugin_updates/updates_fullwidth.php +++ b/admin/layouts/joomla_plugin_updates/updates_fullwidth.php @@ -29,7 +29,7 @@ 'version_update' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/libraries/jcb_powers/VDM.Gitea/index.html b/admin/layouts/joomla_power/index.html similarity index 100% rename from libraries/jcb_powers/VDM.Gitea/index.html rename to admin/layouts/joomla_power/index.html diff --git a/admin/layouts/joomla_power/joomla_power_above.php b/admin/layouts/joomla_power/joomla_power_above.php new file mode 100644 index 000000000..ca79cda0b --- /dev/null +++ b/admin/layouts/joomla_power/joomla_power_above.php @@ -0,0 +1,44 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// 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( + 'system_name' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: []; + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/joomla_power/joomla_power_fullwidth.php b/admin/layouts/joomla_power/joomla_power_fullwidth.php new file mode 100644 index 000000000..3fe8fb131 --- /dev/null +++ b/admin/layouts/joomla_power/joomla_power_fullwidth.php @@ -0,0 +1,45 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// 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( + 'description', + 'settings' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: []; + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/joomla_power/publishing.php b/admin/layouts/joomla_power/publishing.php new file mode 100644 index 000000000..865bcf382 --- /dev/null +++ b/admin/layouts/joomla_power/publishing.php @@ -0,0 +1,47 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// 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( + 'guid', + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: []; + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/joomla_power/publlshing.php b/admin/layouts/joomla_power/publlshing.php new file mode 100644 index 000000000..9b1e77c16 --- /dev/null +++ b/admin/layouts/joomla_power/publlshing.php @@ -0,0 +1,47 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// 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( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: []; + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/language/details_left.php b/admin/layouts/language/details_left.php index 10724a9ed..698053efe 100644 --- a/admin/layouts/language/details_left.php +++ b/admin/layouts/language/details_left.php @@ -29,7 +29,7 @@ 'name' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/language/details_right.php b/admin/layouts/language/details_right.php index 5c45f24bd..a975654a4 100644 --- a/admin/layouts/language/details_right.php +++ b/admin/layouts/language/details_right.php @@ -29,7 +29,7 @@ 'langtag' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/language/publishing.php b/admin/layouts/language/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/language/publishing.php +++ b/admin/layouts/language/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/language/publlshing.php b/admin/layouts/language/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/language/publlshing.php +++ b/admin/layouts/language/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/language_translation/details_fullwidth.php b/admin/layouts/language_translation/details_fullwidth.php index 46179d851..4fe520946 100644 --- a/admin/layouts/language_translation/details_fullwidth.php +++ b/admin/layouts/language_translation/details_fullwidth.php @@ -33,7 +33,7 @@ 'plugins' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/language_translation/publishing.php b/admin/layouts/language_translation/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/language_translation/publishing.php +++ b/admin/layouts/language_translation/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/language_translation/publlshing.php b/admin/layouts/language_translation/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/language_translation/publlshing.php +++ b/admin/layouts/language_translation/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/layout/custom_script_fullwidth.php b/admin/layouts/layout/custom_script_fullwidth.php index edba69106..ea6db0d57 100644 --- a/admin/layouts/layout/custom_script_fullwidth.php +++ b/admin/layouts/layout/custom_script_fullwidth.php @@ -30,7 +30,7 @@ 'php_view' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/layout/details_fullwidth.php b/admin/layouts/layout/details_fullwidth.php index 4bc5550c6..19e53b0b0 100644 --- a/admin/layouts/layout/details_fullwidth.php +++ b/admin/layouts/layout/details_fullwidth.php @@ -29,7 +29,7 @@ 'layout' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/layout/details_left.php b/admin/layouts/layout/details_left.php index 876f27db5..5a2389916 100644 --- a/admin/layouts/layout/details_left.php +++ b/admin/layouts/layout/details_left.php @@ -34,7 +34,7 @@ 'note_add_php_language_string' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/layout/details_right.php b/admin/layouts/layout/details_right.php index f7e79a421..d26d9c258 100644 --- a/admin/layouts/layout/details_right.php +++ b/admin/layouts/layout/details_right.php @@ -31,7 +31,7 @@ 'note_snippet_usage' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/layout/details_rightside.php b/admin/layouts/layout/details_rightside.php index 466f72e12..18568c5ee 100644 --- a/admin/layouts/layout/details_rightside.php +++ b/admin/layouts/layout/details_rightside.php @@ -30,7 +30,7 @@ 'dynamic_values' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/layout/details_under.php b/admin/layouts/layout/details_under.php index 68af44f9c..33d83cb4e 100644 --- a/admin/layouts/layout/details_under.php +++ b/admin/layouts/layout/details_under.php @@ -29,7 +29,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/layout/publishing.php b/admin/layouts/layout/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/layout/publishing.php +++ b/admin/layouts/layout/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/layout/publlshing.php b/admin/layouts/layout/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/layout/publlshing.php +++ b/admin/layouts/layout/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library/behaviour_above.php b/admin/layouts/library/behaviour_above.php index e1a453bf9..4190834f1 100644 --- a/admin/layouts/library/behaviour_above.php +++ b/admin/layouts/library/behaviour_above.php @@ -32,7 +32,7 @@ 'type' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library/behaviour_fullwidth.php b/admin/layouts/library/behaviour_fullwidth.php index 0e3318e96..c80202b74 100644 --- a/admin/layouts/library/behaviour_fullwidth.php +++ b/admin/layouts/library/behaviour_fullwidth.php @@ -34,7 +34,7 @@ 'php_setdocument' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library/behaviour_left.php b/admin/layouts/library/behaviour_left.php index d2e6922bd..cbb497a40 100644 --- a/admin/layouts/library/behaviour_left.php +++ b/admin/layouts/library/behaviour_left.php @@ -30,7 +30,7 @@ 'libraries' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library/behaviour_right.php b/admin/layouts/library/behaviour_right.php index 37215496b..bd0ef9952 100644 --- a/admin/layouts/library/behaviour_right.php +++ b/admin/layouts/library/behaviour_right.php @@ -29,7 +29,7 @@ 'description' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library/behaviour_under.php b/admin/layouts/library/behaviour_under.php index 68af44f9c..33d83cb4e 100644 --- a/admin/layouts/library/behaviour_under.php +++ b/admin/layouts/library/behaviour_under.php @@ -29,7 +29,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library/config_fullwidth.php b/admin/layouts/library/config_fullwidth.php index 03f0a08a7..7f0044561 100644 --- a/admin/layouts/library/config_fullwidth.php +++ b/admin/layouts/library/config_fullwidth.php @@ -32,7 +32,7 @@ 'note_display_library_config' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library/files_folders_urls_fullwidth.php b/admin/layouts/library/files_folders_urls_fullwidth.php index 3f3f9ac75..4e443a475 100644 --- a/admin/layouts/library/files_folders_urls_fullwidth.php +++ b/admin/layouts/library/files_folders_urls_fullwidth.php @@ -31,7 +31,7 @@ 'note_display_library_files_folders_urls' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library/linked_fullwidth.php b/admin/layouts/library/linked_fullwidth.php index 4c12d1b6e..ca6a32f57 100644 --- a/admin/layouts/library/linked_fullwidth.php +++ b/admin/layouts/library/linked_fullwidth.php @@ -29,7 +29,7 @@ 'note_linked_to_notice' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library/publishing.php b/admin/layouts/library/publishing.php index 97a901504..865bcf382 100644 --- a/admin/layouts/library/publishing.php +++ b/admin/layouts/library/publishing.php @@ -34,7 +34,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library/publlshing.php b/admin/layouts/library/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/library/publlshing.php +++ b/admin/layouts/library/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library_config/publishing.php b/admin/layouts/library_config/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/library_config/publishing.php +++ b/admin/layouts/library_config/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library_config/publlshing.php b/admin/layouts/library_config/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/library_config/publlshing.php +++ b/admin/layouts/library_config/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library_config/tweaks_above.php b/admin/layouts/library_config/tweaks_above.php index 91cb40ee7..a28024f97 100644 --- a/admin/layouts/library_config/tweaks_above.php +++ b/admin/layouts/library_config/tweaks_above.php @@ -29,7 +29,7 @@ 'library' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library_config/tweaks_fullwidth.php b/admin/layouts/library_config/tweaks_fullwidth.php index f05e0e794..3d2a9a8c5 100644 --- a/admin/layouts/library_config/tweaks_fullwidth.php +++ b/admin/layouts/library_config/tweaks_fullwidth.php @@ -29,7 +29,7 @@ 'addconfig' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library_files_folders_urls/advance_fullwidth.php b/admin/layouts/library_files_folders_urls/advance_fullwidth.php index 5fd19b54f..3d510dcae 100644 --- a/admin/layouts/library_files_folders_urls/advance_fullwidth.php +++ b/admin/layouts/library_files_folders_urls/advance_fullwidth.php @@ -33,7 +33,7 @@ 'note_constant_paths' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library_files_folders_urls/basic_above.php b/admin/layouts/library_files_folders_urls/basic_above.php index 91cb40ee7..a28024f97 100644 --- a/admin/layouts/library_files_folders_urls/basic_above.php +++ b/admin/layouts/library_files_folders_urls/basic_above.php @@ -29,7 +29,7 @@ 'library' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library_files_folders_urls/basic_fullwidth.php b/admin/layouts/library_files_folders_urls/basic_fullwidth.php index 5026c32d6..ad3ccb77b 100644 --- a/admin/layouts/library_files_folders_urls/basic_fullwidth.php +++ b/admin/layouts/library_files_folders_urls/basic_fullwidth.php @@ -34,7 +34,7 @@ 'addfolders' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library_files_folders_urls/publishing.php b/admin/layouts/library_files_folders_urls/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/library_files_folders_urls/publishing.php +++ b/admin/layouts/library_files_folders_urls/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/library_files_folders_urls/publlshing.php b/admin/layouts/library_files_folders_urls/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/library_files_folders_urls/publlshing.php +++ b/admin/layouts/library_files_folders_urls/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/placeholder/details_fullwidth.php b/admin/layouts/placeholder/details_fullwidth.php index 71cab66d0..ef5ca0e12 100644 --- a/admin/layouts/placeholder/details_fullwidth.php +++ b/admin/layouts/placeholder/details_fullwidth.php @@ -29,7 +29,7 @@ 'note_placeholders_placedin' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/placeholder/details_left.php b/admin/layouts/placeholder/details_left.php index 0baf316e5..8297ca542 100644 --- a/admin/layouts/placeholder/details_left.php +++ b/admin/layouts/placeholder/details_left.php @@ -29,7 +29,7 @@ 'target' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/placeholder/details_right.php b/admin/layouts/placeholder/details_right.php index 76c8df47c..1aa0b4512 100644 --- a/admin/layouts/placeholder/details_right.php +++ b/admin/layouts/placeholder/details_right.php @@ -29,7 +29,7 @@ 'value' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/placeholder/publishing.php b/admin/layouts/placeholder/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/placeholder/publishing.php +++ b/admin/layouts/placeholder/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/placeholder/publlshing.php b/admin/layouts/placeholder/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/placeholder/publlshing.php +++ b/admin/layouts/placeholder/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/power/code_above.php b/admin/layouts/power/code_above.php index cf6f7cec8..5ab82172b 100644 --- a/admin/layouts/power/code_above.php +++ b/admin/layouts/power/code_above.php @@ -31,7 +31,7 @@ 'power_version' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/power/code_fullwidth.php b/admin/layouts/power/code_fullwidth.php index d96752827..dccfbf694 100644 --- a/admin/layouts/power/code_fullwidth.php +++ b/admin/layouts/power/code_fullwidth.php @@ -35,7 +35,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/power/code_left.php b/admin/layouts/power/code_left.php index 098dc960b..754b1e245 100644 --- a/admin/layouts/power/code_left.php +++ b/admin/layouts/power/code_left.php @@ -29,14 +29,14 @@ 'name', 'description', 'extends', - 'implements_custom', + 'extends_custom', 'implements', + 'implements_custom', 'namespace', - 'extends_custom', 'add_head' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/power/code_right.php b/admin/layouts/power/code_right.php index 31be74664..13965517a 100644 --- a/admin/layouts/power/code_right.php +++ b/admin/layouts/power/code_right.php @@ -31,7 +31,7 @@ 'namespace_details' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/power/composer_fullwidth.php b/admin/layouts/power/composer_fullwidth.php new file mode 100644 index 000000000..c22125db4 --- /dev/null +++ b/admin/layouts/power/composer_fullwidth.php @@ -0,0 +1,45 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// 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') ?: []; + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/power/licensing_fullwidth.php b/admin/layouts/power/licensing_fullwidth.php new file mode 100644 index 000000000..27bcb582d --- /dev/null +++ b/admin/layouts/power/licensing_fullwidth.php @@ -0,0 +1,45 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// 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( + 'add_licensing_template', + 'licensing_template' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: []; + +?> + +
    + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
    + diff --git a/admin/layouts/power/publishing.php b/admin/layouts/power/publishing.php index 97a901504..865bcf382 100644 --- a/admin/layouts/power/publishing.php +++ b/admin/layouts/power/publishing.php @@ -34,7 +34,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/power/publlshing.php b/admin/layouts/power/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/power/publlshing.php +++ b/admin/layouts/power/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/power/super_power_left.php b/admin/layouts/power/super_power_left.php new file mode 100644 index 000000000..b52853eda --- /dev/null +++ b/admin/layouts/power/super_power_left.php @@ -0,0 +1,43 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// 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') ?: []; + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/power/super_power_right.php b/admin/layouts/power/super_power_right.php new file mode 100644 index 000000000..9f9100729 --- /dev/null +++ b/admin/layouts/power/super_power_right.php @@ -0,0 +1,42 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// 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') ?: []; + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/repeatablejcb.php b/admin/layouts/repeatablejcb.php index 1140563ac..b267b7fe0 100644 --- a/admin/layouts/repeatablejcb.php +++ b/admin/layouts/repeatablejcb.php @@ -12,6 +12,11 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + /** * Make thing clear * @@ -30,8 +35,8 @@ extract($displayData); // Add script -JHtml::_('jquery.ui', array('core', 'sortable')); -JHtml::_('script', 'system/subform-repeatable.js', array('version' => 'auto', 'relative' => true)); +Html::_('jquery.ui', array('core', 'sortable')); +Html::_('script', 'system/subform-repeatable.js', array('version' => 'auto', 'relative' => true)); $sublayout = 'sectionjcb'; @@ -49,7 +54,7 @@
    @@ -57,7 +62,7 @@ $form) : - echo JLayoutHelper::render( + echo LayoutHelper::render( $sublayout, array( 'form' => $form, @@ -76,7 +81,7 @@ array('<', '>'), array('SUBFORMLT', 'SUBFORMGT'), trim( - JLayoutHelper::render( + LayoutHelper::render( $sublayout, array( 'form' => $tmpl, diff --git a/admin/layouts/rows.php b/admin/layouts/rows.php new file mode 100644 index 000000000..bb4739667 --- /dev/null +++ b/admin/layouts/rows.php @@ -0,0 +1,48 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('JPATH_BASE') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + +$headers = $displayData['headers']; +$items = $displayData['items']; + +?> + + $values): ?> + + + + + + + + + + +    + + + + + + + +    + + + + diff --git a/admin/layouts/sectionjcb.php b/admin/layouts/sectionjcb.php index d4c471711..0480635c8 100644 --- a/admin/layouts/sectionjcb.php +++ b/admin/layouts/sectionjcb.php @@ -12,6 +12,11 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + /** * Make thing clear * @@ -32,17 +37,17 @@ class="subform-repeatable-group subform-repeatable-jcb-group-
    - + - + - + diff --git a/admin/layouts/server/details_above.php b/admin/layouts/server/details_above.php index c3294693f..260e4acac 100644 --- a/admin/layouts/server/details_above.php +++ b/admin/layouts/server/details_above.php @@ -30,7 +30,7 @@ 'protocol' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/server/details_fullwidth.php b/admin/layouts/server/details_fullwidth.php index bf273a8fd..0606486ab 100644 --- a/admin/layouts/server/details_fullwidth.php +++ b/admin/layouts/server/details_fullwidth.php @@ -32,7 +32,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/server/details_left.php b/admin/layouts/server/details_left.php index e62eb25c4..24d94700e 100644 --- a/admin/layouts/server/details_left.php +++ b/admin/layouts/server/details_left.php @@ -32,7 +32,7 @@ 'path' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/server/details_right.php b/admin/layouts/server/details_right.php index 650fb35b5..a79175534 100644 --- a/admin/layouts/server/details_right.php +++ b/admin/layouts/server/details_right.php @@ -33,7 +33,7 @@ 'secret' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/server/linked_components_fullwidth.php b/admin/layouts/server/linked_components_fullwidth.php index b34bfea22..a63f14529 100644 --- a/admin/layouts/server/linked_components_fullwidth.php +++ b/admin/layouts/server/linked_components_fullwidth.php @@ -12,22 +12,29 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\GetHelper; + // set the defaults -$items = $displayData->vymlinked_components; -$user = JFactory::getUser(); +$items = $displayData->vydlinked_components; +$user = Factory::getUser(); $id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit"; // set a return value $return = ($id) ? "index.php?option=com_componentbuilder&view=server&layout=edit&id=" . $id : ""; // check for a return value -$jinput = JFactory::getApplication()->input; +$jinput = Factory::getApplication()->input; if ($_return = $jinput->get('return', null, 'base64')) { $return .= "&return=" . $_return; } // check if return value was set -if (ComponentbuilderHelper::checkString($return)) +if (StringHelper::check($return)) { // set the referral values $ref = ($id) ? "&ref=server&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return)); @@ -39,27 +46,27 @@ ?>
    - + @@ -67,7 +74,7 @@ $item): ?> authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); + $userChkOut = Factory::getUser($item->checked_out); $canDo = ComponentbuilderHelper::getActions('joomla_component',$item,'joomla_components'); ?> @@ -76,7 +83,7 @@ get('joomla_component.edit')): ?> escape($item->system_name); ?>checked_out): ?> - name, $item->checked_out_time, 'joomla_components.', $canCheckin); ?> + name, $item->checked_out_time, 'joomla_components.', $canCheckin); ?> escape($item->system_name); ?> @@ -87,88 +94,94 @@ // always make sure the $this->return_here is set if (!isset($this->return_here)) { - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); } // setup the buttons - if (!isset($_buttons) || !ComponentbuilderHelper::checkArray($_buttons)) + if (!isset($_buttons) || !ArrayHelper::check($_buttons)) { $_buttons = array(); $_buttons[0] = array( array( 'view' => 'component_admin_views', 'views' => 'components_admin_views', - 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_ADMIN_VIEWS'), + 'title' => Text::_('COM_COMPONENTBUILDER_THE_COMPONENT_ADMIN_VIEWS'), 'icon' => 'stack'), array( 'view' => 'component_custom_admin_views', 'views' => 'components_custom_admin_views', - 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_CUSTOM_ADMIN_VIEWS'), + 'title' => Text::_('COM_COMPONENTBUILDER_THE_COMPONENT_CUSTOM_ADMIN_VIEWS'), 'icon' => 'screen'), array( 'view' => 'component_site_views', 'views' => 'components_site_views', - 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_SITE_VIEWS'), + 'title' => Text::_('COM_COMPONENTBUILDER_THE_COMPONENT_SITE_VIEWS'), 'icon' => 'palette'), + array( + 'view' => 'component_router', + 'views' => 'components_routers', + 'title' => Text::_('COM_COMPONENTBUILDER_THE_COMPONENT_SITE_ROUTER'), + 'icon' => 'tree-2'), array( 'view' => 'component_config', 'views' => 'components_config', - 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_CONFIG'), + 'title' => Text::_('COM_COMPONENTBUILDER_THE_COMPONENT_CONFIG'), 'icon' => 'options') ); $_buttons[1] = array( array( 'view' => 'component_placeholders', 'views' => 'components_placeholders', - 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_PLACEHOLDERS'), + 'title' => Text::_('COM_COMPONENTBUILDER_THE_COMPONENT_PLACEHOLDERS'), 'icon' => 'search'), array( 'view' => 'component_updates', 'views' => 'components_updates', - 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_UPDATES'), + 'title' => Text::_('COM_COMPONENTBUILDER_THE_COMPONENT_UPDATES'), 'icon' => 'database'), array( 'view' => 'component_mysql_tweaks', 'views' => 'components_mysql_tweaks', - 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_MYSQL_TWEAKS'), + 'title' => Text::_('COM_COMPONENTBUILDER_THE_COMPONENT_MYSQL_TWEAKS'), 'icon' => 'screwdriver'), array( 'view' => 'component_files_folders', 'views' => 'components_files_folders', - 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_FILES_FOLDERS'), + 'title' => Text::_('COM_COMPONENTBUILDER_THE_COMPONENT_FILES_FOLDERS'), 'icon' => 'briefcase') ); $_buttons[2] = array( array( 'view' => 'component_custom_admin_menus', 'views' => 'components_custom_admin_menus', - 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_CUSTOM_ADMIN_MENUS'), + 'title' => Text::_('COM_COMPONENTBUILDER_THE_COMPONENT_CUSTOM_ADMIN_MENUS'), 'icon' => 'plus'), array( 'view' => 'component_dashboard', 'views' => 'components_dashboard', - 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_DASHBOARD'), + 'title' => Text::_('COM_COMPONENTBUILDER_THE_COMPONENT_DASHBOARD'), 'icon' => 'dashboard'), array( 'view' => 'component_modules', 'views' => 'components_modules', - 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_MODULES'), + 'title' => Text::_('COM_COMPONENTBUILDER_THE_COMPONENT_MODULES'), 'icon' => 'cube'), array( 'view' => 'component_plugins', 'views' => 'components_plugins', - 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_PLUGINS'), + 'title' => Text::_('COM_COMPONENTBUILDER_THE_COMPONENT_PLUGINS'), 'icon' => 'power-cord') ); } ?>
    - get($_button['view'].'.edit') && ($id = ComponentbuilderHelper::getVar($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?> + get($_button['view'].'.edit') && ($id = GetHelper::var($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?> get($_button['view'].'.create')): ?> - + +
    published == 1): ?> published == 0): ?> published == 2): ?> published == -2): ?> @@ -251,7 +264,7 @@
    - + - + - + - + - + - +
    @@ -177,7 +190,7 @@
    - get($_button['view'].'.edit') && ($id = ComponentbuilderHelper::getVar($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?> + get($_button['view'].'.edit') && ($id = GetHelper::var($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?> get($_button['view'].'.create')): ?> @@ -191,7 +204,7 @@
    - get($_button['view'].'.edit') && ($id = ComponentbuilderHelper::getVar($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?> + get($_button['view'].'.edit') && ($id = GetHelper::var($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?> get($_button['view'].'.create')): ?> @@ -201,17 +214,17 @@
    escape($item->companyname); ?>
    - author)) : ?> + author)) : ?> escape($item->author); ?>
    - email) && ComponentbuilderHelper::checkString($item->author)) : ?> - + email) && StringHelper::check($item->author)) : ?> + escape($item->email); ?>
    - website) && ComponentbuilderHelper::checkString($item->author)) : ?> - + website) && StringHelper::check($item->author)) : ?> + escape($item->website); ?> @@ -219,26 +232,26 @@
    - - + + - - + + - - + + - - + +
    - +
    diff --git a/admin/layouts/server/publishing.php b/admin/layouts/server/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/server/publishing.php +++ b/admin/layouts/server/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/server/publlshing.php b/admin/layouts/server/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/server/publlshing.php +++ b/admin/layouts/server/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/site_view/custom_buttons_fullwidth.php b/admin/layouts/site_view/custom_buttons_fullwidth.php index fef43f97c..fe8891fc9 100644 --- a/admin/layouts/site_view/custom_buttons_fullwidth.php +++ b/admin/layouts/site_view/custom_buttons_fullwidth.php @@ -32,7 +32,7 @@ 'php_model' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/site_view/custom_buttons_left.php b/admin/layouts/site_view/custom_buttons_left.php index a4498e425..ed88d47f8 100644 --- a/admin/layouts/site_view/custom_buttons_left.php +++ b/admin/layouts/site_view/custom_buttons_left.php @@ -29,7 +29,7 @@ 'add_custom_button' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/site_view/custom_buttons_right.php b/admin/layouts/site_view/custom_buttons_right.php index ec870325d..cd8031b00 100644 --- a/admin/layouts/site_view/custom_buttons_right.php +++ b/admin/layouts/site_view/custom_buttons_right.php @@ -29,7 +29,7 @@ 'button_position' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/site_view/details_above.php b/admin/layouts/site_view/details_above.php index 019a14081..f4c751c3f 100644 --- a/admin/layouts/site_view/details_above.php +++ b/admin/layouts/site_view/details_above.php @@ -30,7 +30,7 @@ 'context' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/site_view/details_fullwidth.php b/admin/layouts/site_view/details_fullwidth.php index 8c0c8e83e..4588be130 100644 --- a/admin/layouts/site_view/details_fullwidth.php +++ b/admin/layouts/site_view/details_fullwidth.php @@ -29,7 +29,7 @@ 'default' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/site_view/details_left.php b/admin/layouts/site_view/details_left.php index df266c7f1..701581d58 100644 --- a/admin/layouts/site_view/details_left.php +++ b/admin/layouts/site_view/details_left.php @@ -34,7 +34,7 @@ 'note_add_php_language_string' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/site_view/details_right.php b/admin/layouts/site_view/details_right.php index f7e79a421..d26d9c258 100644 --- a/admin/layouts/site_view/details_right.php +++ b/admin/layouts/site_view/details_right.php @@ -31,7 +31,7 @@ 'note_snippet_usage' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/site_view/details_rightside.php b/admin/layouts/site_view/details_rightside.php index d7ea40a77..41d309d7d 100644 --- a/admin/layouts/site_view/details_rightside.php +++ b/admin/layouts/site_view/details_rightside.php @@ -32,7 +32,7 @@ 'dynamic_values' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/site_view/details_under.php b/admin/layouts/site_view/details_under.php index 68af44f9c..33d83cb4e 100644 --- a/admin/layouts/site_view/details_under.php +++ b/admin/layouts/site_view/details_under.php @@ -29,7 +29,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/site_view/javascript_css_fullwidth.php b/admin/layouts/site_view/javascript_css_fullwidth.php index af32af44d..c081c7d95 100644 --- a/admin/layouts/site_view/javascript_css_fullwidth.php +++ b/admin/layouts/site_view/javascript_css_fullwidth.php @@ -36,7 +36,7 @@ 'css' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/site_view/linked_components_fullwidth.php b/admin/layouts/site_view/linked_components_fullwidth.php index 4c12d1b6e..ca6a32f57 100644 --- a/admin/layouts/site_view/linked_components_fullwidth.php +++ b/admin/layouts/site_view/linked_components_fullwidth.php @@ -29,7 +29,7 @@ 'note_linked_to_notice' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/site_view/php_fullwidth.php b/admin/layouts/site_view/php_fullwidth.php index deb10e126..84d3fe3d7 100644 --- a/admin/layouts/site_view/php_fullwidth.php +++ b/admin/layouts/site_view/php_fullwidth.php @@ -39,7 +39,7 @@ 'php_jview' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/site_view/publishing.php b/admin/layouts/site_view/publishing.php index 97a901504..865bcf382 100644 --- a/admin/layouts/site_view/publishing.php +++ b/admin/layouts/site_view/publishing.php @@ -34,7 +34,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/site_view/publlshing.php b/admin/layouts/site_view/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/site_view/publlshing.php +++ b/admin/layouts/site_view/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/snippet/contributor_fullwidth.php b/admin/layouts/snippet/contributor_fullwidth.php index 775ce5c44..6b3984e9a 100644 --- a/admin/layouts/snippet/contributor_fullwidth.php +++ b/admin/layouts/snippet/contributor_fullwidth.php @@ -29,7 +29,7 @@ 'note_contributor_details' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/snippet/contributor_left.php b/admin/layouts/snippet/contributor_left.php index e60f6bd57..36a156c78 100644 --- a/admin/layouts/snippet/contributor_left.php +++ b/admin/layouts/snippet/contributor_left.php @@ -30,7 +30,7 @@ 'contributor_website' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/snippet/contributor_right.php b/admin/layouts/snippet/contributor_right.php index 6c4cbc3ef..b6501baf9 100644 --- a/admin/layouts/snippet/contributor_right.php +++ b/admin/layouts/snippet/contributor_right.php @@ -30,7 +30,7 @@ 'contributor_email' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/snippet/details_above.php b/admin/layouts/snippet/details_above.php index c32593c09..aabfe2019 100644 --- a/admin/layouts/snippet/details_above.php +++ b/admin/layouts/snippet/details_above.php @@ -31,7 +31,7 @@ 'library' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/snippet/details_left.php b/admin/layouts/snippet/details_left.php index ad9163876..50a1c050f 100644 --- a/admin/layouts/snippet/details_left.php +++ b/admin/layouts/snippet/details_left.php @@ -32,7 +32,7 @@ 'usage' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/snippet/details_right.php b/admin/layouts/snippet/details_right.php index 722eb549b..7d903d4bd 100644 --- a/admin/layouts/snippet/details_right.php +++ b/admin/layouts/snippet/details_right.php @@ -29,7 +29,7 @@ 'snippet' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/snippet/publishing.php b/admin/layouts/snippet/publishing.php index 97a901504..865bcf382 100644 --- a/admin/layouts/snippet/publishing.php +++ b/admin/layouts/snippet/publishing.php @@ -34,7 +34,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/snippet/publlshing.php b/admin/layouts/snippet/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/snippet/publlshing.php +++ b/admin/layouts/snippet/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/snippet_type/details_left.php b/admin/layouts/snippet_type/details_left.php index 10724a9ed..698053efe 100644 --- a/admin/layouts/snippet_type/details_left.php +++ b/admin/layouts/snippet_type/details_left.php @@ -29,7 +29,7 @@ 'name' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/snippet_type/details_right.php b/admin/layouts/snippet_type/details_right.php index 37215496b..bd0ef9952 100644 --- a/admin/layouts/snippet_type/details_right.php +++ b/admin/layouts/snippet_type/details_right.php @@ -29,7 +29,7 @@ 'description' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/snippet_type/publishing.php b/admin/layouts/snippet_type/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/snippet_type/publishing.php +++ b/admin/layouts/snippet_type/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/snippet_type/publlshing.php b/admin/layouts/snippet_type/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/snippet_type/publlshing.php +++ b/admin/layouts/snippet_type/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/table.php b/admin/layouts/table.php new file mode 100644 index 000000000..c5609cdde --- /dev/null +++ b/admin/layouts/table.php @@ -0,0 +1,80 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('JPATH_BASE') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use VDM\Joomla\Utilities\StringHelper; + +$table_id = (isset($displayData['id'])) ? $displayData['id'] : StringHelper::random(7); +$name = (isset($displayData['name'])) ? $displayData['name'] : false; +$table_class = (isset($displayData['table_class'])) ? $displayData['table_class'] : 'uk-table'; +$table_container_class = (isset($displayData['table_container_class'])) ? $displayData['table_container_class'] : 'uk-overflow-auto'; +$headers = (isset($displayData['headers'])) ? $displayData['headers'] : [Text::_('COM_COMPONENTBUILDER_NO'), Text::_('COM_COMPONENTBUILDER_HEADERS'), Text::_('COM_COMPONENTBUILDER_FOUND')]; +$items = (isset($displayData['items'])) ? $displayData['items'] : 6; + +?> +
    + + + + + + + + + + $header): ?> + + + + + + + + + + + + + + + + + + + $headers, 'items' => $items]); ?> + +
    +
    + + + diff --git a/admin/layouts/template/custom_script_fullwidth.php b/admin/layouts/template/custom_script_fullwidth.php index edba69106..ea6db0d57 100644 --- a/admin/layouts/template/custom_script_fullwidth.php +++ b/admin/layouts/template/custom_script_fullwidth.php @@ -30,7 +30,7 @@ 'php_view' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/template/details_fullwidth.php b/admin/layouts/template/details_fullwidth.php index 5267cc235..fcb615751 100644 --- a/admin/layouts/template/details_fullwidth.php +++ b/admin/layouts/template/details_fullwidth.php @@ -29,7 +29,7 @@ 'template' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/template/details_left.php b/admin/layouts/template/details_left.php index 876f27db5..5a2389916 100644 --- a/admin/layouts/template/details_left.php +++ b/admin/layouts/template/details_left.php @@ -34,7 +34,7 @@ 'note_add_php_language_string' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/template/details_right.php b/admin/layouts/template/details_right.php index d23e83227..b45923f97 100644 --- a/admin/layouts/template/details_right.php +++ b/admin/layouts/template/details_right.php @@ -31,7 +31,7 @@ 'note_uikit_snippet' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/template/details_rightside.php b/admin/layouts/template/details_rightside.php index 466f72e12..18568c5ee 100644 --- a/admin/layouts/template/details_rightside.php +++ b/admin/layouts/template/details_rightside.php @@ -30,7 +30,7 @@ 'dynamic_values' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/template/details_under.php b/admin/layouts/template/details_under.php index 68af44f9c..33d83cb4e 100644 --- a/admin/layouts/template/details_under.php +++ b/admin/layouts/template/details_under.php @@ -29,7 +29,7 @@ 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/template/publishing.php b/admin/layouts/template/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/template/publishing.php +++ b/admin/layouts/template/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/template/publlshing.php b/admin/layouts/template/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/template/publlshing.php +++ b/admin/layouts/template/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/trashhelper.php b/admin/layouts/trashhelper.php index 31ae2c720..ffac982d1 100644 --- a/admin/layouts/trashhelper.php +++ b/admin/layouts/trashhelper.php @@ -12,6 +12,11 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> @@ -26,7 +31,7 @@ function emptyTrash() { document.adminForm.elements['checkall-toggle'].checked=1; Joomla.checkAll(document.adminForm.elements['checkall-toggle']); // check to confirm the deletion - if(confirm('')) { + if(confirm('')) { Joomla.submitbutton('get("name") ?>.delete'); } else { document.adminForm.elements['checkall-toggle'].checked=0; @@ -34,7 +39,7 @@ function emptyTrash() { } } else { // confirm deletion of those selected - if (confirm('')) { + if (confirm('')) { Joomla.submitbutton('get("name") ?>.delete'); }; } @@ -51,23 +56,23 @@ function exitTrash() { items)): ?>

    - +

    -

    +

    - +

    -

    +

    diff --git a/admin/layouts/validation_rule/extends_formrule_above.php b/admin/layouts/validation_rule/extends_formrule_above.php index ce86bf700..3d0bfe6f8 100644 --- a/admin/layouts/validation_rule/extends_formrule_above.php +++ b/admin/layouts/validation_rule/extends_formrule_above.php @@ -29,7 +29,7 @@ 'inherit' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/validation_rule/extends_formrule_fullwidth.php b/admin/layouts/validation_rule/extends_formrule_fullwidth.php index dc6475433..7f8636f71 100644 --- a/admin/layouts/validation_rule/extends_formrule_fullwidth.php +++ b/admin/layouts/validation_rule/extends_formrule_fullwidth.php @@ -29,7 +29,7 @@ 'php' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/validation_rule/extends_formrule_left.php b/admin/layouts/validation_rule/extends_formrule_left.php index 10724a9ed..698053efe 100644 --- a/admin/layouts/validation_rule/extends_formrule_left.php +++ b/admin/layouts/validation_rule/extends_formrule_left.php @@ -29,7 +29,7 @@ 'name' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/validation_rule/extends_formrule_right.php b/admin/layouts/validation_rule/extends_formrule_right.php index 53636fa82..2d2e02148 100644 --- a/admin/layouts/validation_rule/extends_formrule_right.php +++ b/admin/layouts/validation_rule/extends_formrule_right.php @@ -29,7 +29,7 @@ 'short_description' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/validation_rule/publishing.php b/admin/layouts/validation_rule/publishing.php index 24144d6d4..e8b5798d7 100644 --- a/admin/layouts/validation_rule/publishing.php +++ b/admin/layouts/validation_rule/publishing.php @@ -33,7 +33,7 @@ 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/validation_rule/publlshing.php b/admin/layouts/validation_rule/publlshing.php index 7ac64fe22..9b1e77c16 100644 --- a/admin/layouts/validation_rule/publlshing.php +++ b/admin/layouts/validation_rule/publlshing.php @@ -34,7 +34,7 @@ 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/models/admin_custom_tabs.php b/admin/models/admin_custom_tabs.php index 63b715029..7617f0a4d 100644 --- a/admin/models/admin_custom_tabs.php +++ b/admin/models/admin_custom_tabs.php @@ -12,10 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Admin_custom_tabs Admin Model @@ -59,18 +69,18 @@ class ComponentbuilderModelAdmin_custom_tabs extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'admin_custom_tabs', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'admin_custom_tabs', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -123,7 +133,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -150,7 +160,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -163,7 +173,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -229,13 +239,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/admin_custom_tabs.js'; } - + /** * Method to test whether a record can be deleted. * @@ -254,7 +264,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('admin_custom_tabs.delete', 'com_componentbuilder.admin_custom_tabs.' . (int) $record->id); } @@ -272,8 +282,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -284,31 +294,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('admin_custom_tabs.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('admin_custom_tabs.edit', 'com_componentbuilder.admin_custom_tabs.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('admin_custom_tabs.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -316,19 +326,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -340,7 +350,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_admin_custom_tabs')); @@ -355,7 +365,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -370,10 +380,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.admin_custom_tabs.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.admin_custom_tabs.data', []); if (empty($data)) { @@ -396,7 +406,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -412,7 +422,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -432,10 +442,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -461,30 +471,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('admin_custom_tabs'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('admin_custom_tabs'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -521,8 +531,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -548,7 +557,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('admin_custom_tabs'); @@ -574,7 +583,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -587,7 +596,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('admin_custom_tabs.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -603,19 +612,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->admin_view) && !is_numeric($this->table->admin_view)) + if (UtilitiesStringHelper::check($this->table->admin_view) && !is_numeric($this->table->admin_view)) { $this->table->admin_view = $this->generateUnique('admin_view',$this->table->admin_view); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -627,7 +636,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -691,7 +700,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('admin_custom_tabs'); @@ -699,7 +708,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('admin_custom_tabs.edit') && !$this->canDo->get('admin_custom_tabs.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -716,7 +725,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('admin_custom_tabs.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -732,13 +741,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -782,7 +791,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -794,15 +803,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -810,7 +819,7 @@ public function save($data) // Set the tabs items to data. if (isset($data['tabs']) && is_array($data['tabs'])) { - $tabs = new JRegistry; + $tabs = new Registry; $tabs->loadArray($data['tabs']); $data['tabs'] = (string) $tabs; } @@ -819,11 +828,11 @@ public function save($data) // Set the empty tabs to data $data['tabs'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -833,7 +842,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -841,14 +850,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -861,7 +870,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -887,7 +895,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/admin_fields.php b/admin/models/admin_fields.php index 43284a4b2..67f51dfbc 100644 --- a/admin/models/admin_fields.php +++ b/admin/models/admin_fields.php @@ -12,10 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Admin_fields Admin Model @@ -60,18 +70,18 @@ class ComponentbuilderModelAdmin_fields extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'admin_fields', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'admin_fields', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -123,7 +133,7 @@ public function getItem($pk = null) } $item->addfields = $bucket; // update the fields in the DB - $fieldsUpdate = new stdClass(); + $fieldsUpdate = new \stdClass(); $fieldsUpdate->id = (int) $item->id; $fieldsUpdate->addfields = json_encode($bucket); $this->_db->updateObject('#__componentbuilder_admin_fields', $fieldsUpdate, 'id'); @@ -144,7 +154,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -171,7 +181,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -184,7 +194,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -250,13 +260,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/admin_fields.js'; } - + /** * Method to test whether a record can be deleted. * @@ -275,7 +285,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('admin_fields.delete', 'com_componentbuilder.admin_fields.' . (int) $record->id); } @@ -293,8 +303,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -305,31 +315,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('admin_fields.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('admin_fields.edit', 'com_componentbuilder.admin_fields.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('admin_fields.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -337,19 +347,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -361,7 +371,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_admin_fields')); @@ -376,7 +386,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -391,10 +401,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.admin_fields.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.admin_fields.data', []); if (empty($data)) { @@ -417,7 +427,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -433,7 +443,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -453,10 +463,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -482,30 +492,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('admin_fields'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('admin_fields'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -542,8 +552,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -569,7 +578,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('admin_fields'); @@ -595,7 +604,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -608,7 +617,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('admin_fields.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -624,19 +633,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->admin_view) && !is_numeric($this->table->admin_view)) + if (UtilitiesStringHelper::check($this->table->admin_view) && !is_numeric($this->table->admin_view)) { $this->table->admin_view = $this->generateUnique('admin_view',$this->table->admin_view); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -648,7 +657,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -712,7 +721,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('admin_fields'); @@ -720,7 +729,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('admin_fields.edit') && !$this->canDo->get('admin_fields.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -737,7 +746,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('admin_fields.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -753,13 +762,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -803,7 +812,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -815,20 +824,20 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } - if (isset($data['addfields']) && ComponentbuilderHelper::checkArray($data['addfields'])) + if (isset($data['addfields']) && UtilitiesArrayHelper::check($data['addfields'])) { // Sort fields by 'Tab' ASC, 'Alignment' ASC, 'Order in Edit' ASC usort($data['addfields'], function ($a, $b) { @@ -841,7 +850,7 @@ public function save($data) // Set the addfields items to data. if (isset($data['addfields']) && is_array($data['addfields'])) { - $addfields = new JRegistry; + $addfields = new Registry; $addfields->loadArray($data['addfields']); $data['addfields'] = (string) $addfields; } @@ -850,11 +859,11 @@ public function save($data) // Set the empty addfields to data $data['addfields'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -864,7 +873,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -872,14 +881,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -892,7 +901,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -918,7 +926,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/admin_fields_conditions.php b/admin/models/admin_fields_conditions.php index bee9651dd..39f81cf26 100644 --- a/admin/models/admin_fields_conditions.php +++ b/admin/models/admin_fields_conditions.php @@ -12,10 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Admin_fields_conditions Admin Model @@ -60,18 +70,18 @@ class ComponentbuilderModelAdmin_fields_conditions extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'admin_fields_conditions', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'admin_fields_conditions', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -123,7 +133,7 @@ public function getItem($pk = null) } $item->addconditions = $bucket; // update the fields - $conditionsUpdate = new stdClass(); + $conditionsUpdate = new \stdClass(); $conditionsUpdate->id = (int) $item->id; $conditionsUpdate->addconditions = json_encode($bucket); $this->_db->updateObject('#__componentbuilder_admin_fields_conditions', $conditionsUpdate, 'id'); @@ -144,7 +154,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -171,7 +181,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -184,7 +194,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -250,13 +260,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/admin_fields_conditions.js'; } - + /** * Method to test whether a record can be deleted. * @@ -275,7 +285,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('admin_fields_conditions.delete', 'com_componentbuilder.admin_fields_conditions.' . (int) $record->id); } @@ -293,8 +303,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -305,31 +315,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('admin_fields_conditions.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('admin_fields_conditions.edit', 'com_componentbuilder.admin_fields_conditions.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('admin_fields_conditions.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -337,19 +347,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -361,7 +371,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_admin_fields_conditions')); @@ -376,7 +386,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -391,10 +401,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.admin_fields_conditions.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.admin_fields_conditions.data', []); if (empty($data)) { @@ -417,7 +427,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -433,7 +443,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -453,10 +463,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -482,30 +492,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('admin_fields_conditions'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('admin_fields_conditions'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -542,8 +552,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -569,7 +578,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('admin_fields_conditions'); @@ -595,7 +604,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -608,7 +617,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('admin_fields_conditions.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -624,19 +633,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->admin_view) && !is_numeric($this->table->admin_view)) + if (UtilitiesStringHelper::check($this->table->admin_view) && !is_numeric($this->table->admin_view)) { $this->table->admin_view = $this->generateUnique('admin_view',$this->table->admin_view); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -648,7 +657,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -712,7 +721,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('admin_fields_conditions'); @@ -720,7 +729,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('admin_fields_conditions.edit') && !$this->canDo->get('admin_fields_conditions.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -737,7 +746,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('admin_fields_conditions.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -753,13 +762,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -803,7 +812,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -815,15 +824,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -831,7 +840,7 @@ public function save($data) // Set the addconditions items to data. if (isset($data['addconditions']) && is_array($data['addconditions'])) { - $addconditions = new JRegistry; + $addconditions = new Registry; $addconditions->loadArray($data['addconditions']); $data['addconditions'] = (string) $addconditions; } @@ -840,11 +849,11 @@ public function save($data) // Set the empty addconditions to data $data['addconditions'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -854,7 +863,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -862,14 +871,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -882,7 +891,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -908,7 +916,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/admin_fields_relations.php b/admin/models/admin_fields_relations.php index 492168f4d..f8f8295fb 100644 --- a/admin/models/admin_fields_relations.php +++ b/admin/models/admin_fields_relations.php @@ -12,10 +12,22 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Admin_fields_relations Admin Model @@ -60,16 +72,16 @@ class ComponentbuilderModelAdmin_fields_relations extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'admin_fields_relations', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'admin_fields_relations', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -101,17 +113,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'admin_fields_relations__'.$id); ComponentbuilderHelper::set('admin_fields_relations__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -120,7 +131,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -175,17 +186,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'admin_fields_relations__'.$id); ComponentbuilderHelper::set('admin_fields_relations__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -206,7 +216,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -233,7 +243,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -246,7 +256,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -312,13 +322,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/admin_fields_relations.js'; } - + /** * Method to test whether a record can be deleted. * @@ -337,7 +347,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('admin_fields_relations.delete', 'com_componentbuilder.admin_fields_relations.' . (int) $record->id); } @@ -355,8 +365,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -367,31 +377,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('admin_fields_relations.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('admin_fields_relations.edit', 'com_componentbuilder.admin_fields_relations.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('admin_fields_relations.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -399,19 +409,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -423,7 +433,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_admin_fields_relations')); @@ -438,7 +448,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -453,10 +463,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.admin_fields_relations.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.admin_fields_relations.data', []); if (empty($data)) { @@ -479,7 +489,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -495,7 +505,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -515,10 +525,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -544,30 +554,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('admin_fields_relations'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('admin_fields_relations'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -604,8 +614,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -631,7 +640,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('admin_fields_relations'); @@ -657,7 +666,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -670,7 +679,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('admin_fields_relations.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -686,19 +695,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->admin_view) && !is_numeric($this->table->admin_view)) + if (UtilitiesStringHelper::check($this->table->admin_view) && !is_numeric($this->table->admin_view)) { $this->table->admin_view = $this->generateUnique('admin_view',$this->table->admin_view); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -710,7 +719,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -774,7 +783,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('admin_fields_relations'); @@ -782,7 +791,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('admin_fields_relations.edit') && !$this->canDo->get('admin_fields_relations.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -799,7 +808,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('admin_fields_relations.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -815,13 +824,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -865,7 +874,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -877,15 +886,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -893,7 +902,7 @@ public function save($data) // Set the addrelations items to data. if (isset($data['addrelations']) && is_array($data['addrelations'])) { - $addrelations = new JRegistry; + $addrelations = new Registry; $addrelations->loadArray($data['addrelations']); $data['addrelations'] = (string) $addrelations; } @@ -902,11 +911,11 @@ public function save($data) // Set the empty addrelations to data $data['addrelations'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -916,7 +925,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -924,14 +933,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -944,7 +953,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -970,7 +978,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/admin_view.php b/admin/models/admin_view.php index fcd4b6339..4009a3dd5 100644 --- a/admin/models/admin_view.php +++ b/admin/models/admin_view.php @@ -12,10 +12,23 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Admin_view Admin Model @@ -208,16 +221,16 @@ class ComponentbuilderModelAdmin_view extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'admin_view', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'admin_view', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -249,17 +262,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'admin_view__'.$id); ComponentbuilderHelper::set('admin_view__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -268,7 +280,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -599,23 +611,22 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'admin_view__'.$id); ComponentbuilderHelper::set('admin_view__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } } // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; // repeatable values to check $arrayChecker = array( @@ -682,7 +693,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -709,7 +720,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -722,7 +733,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -781,11 +792,11 @@ public function getForm($data = array(), $loadData = true, $options = array('con } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -800,7 +811,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con // Only load the GUID if new item (or empty) if (0 == $id || !($val = $form->getValue('guid'))) { - $form->setValue('guid', null, ComponentbuilderHelper::GUID()); + $form->setValue('guid', null, GuidHelper::get()); } return $form; @@ -809,13 +820,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/admin_view.js'; } - + /** * Method to test whether a record can be deleted. * @@ -834,7 +845,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('admin_view.delete', 'com_componentbuilder.admin_view.' . (int) $record->id); } @@ -852,8 +863,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -864,31 +875,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('admin_view.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('admin_view.edit', 'com_componentbuilder.admin_view.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('admin_view.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -896,19 +907,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -920,7 +931,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_admin_view')); @@ -935,7 +946,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -950,10 +961,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.admin_view.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.admin_view.data', []); if (empty($data)) { @@ -981,7 +992,7 @@ protected function loadFormData() public function validate($form, $data, $group = null) { // check if the not_required field is set - if (isset($data['not_required']) && ComponentbuilderHelper::checkString($data['not_required'])) + if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required'])) { $requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = array_unique($requiredFields); @@ -989,7 +1000,7 @@ public function validate($form, $data, $group = null) foreach ($requiredFields as $requiredField) { // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) + if (UtilitiesStringHelper::check($requiredField)) { // change to false $form->setFieldAttribute($requiredField, 'required', 'false'); @@ -1012,7 +1023,7 @@ protected function getUniqueFields() { return array('guid'); } - + /** * Method to delete one or more records. * @@ -1030,7 +1041,7 @@ public function delete(&$pks) } // we must also delete the linked tables found - if (ComponentbuilderHelper::checkArray($pks)) + if (UtilitiesArrayHelper::check($pks)) { $_tablesArray = array( 'admin_fields', @@ -1050,7 +1061,7 @@ public function delete(&$pks) } } } - + return true; } @@ -1072,7 +1083,7 @@ public function publish(&$pks, $value = 1) } // we must also update all linked tables - if (ComponentbuilderHelper::checkArray($pks)) + if (UtilitiesArrayHelper::check($pks)) { $_tablesArray = array( 'admin_fields', @@ -1092,10 +1103,10 @@ public function publish(&$pks, $value = 1) } } } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -1121,30 +1132,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('admin_view'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('admin_view'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -1181,8 +1192,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -1208,7 +1218,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('admin_view'); @@ -1234,7 +1244,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -1247,7 +1257,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('admin_view.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -1263,13 +1273,13 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -1281,7 +1291,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1365,7 +1375,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('admin_view'); @@ -1373,7 +1383,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('admin_view.edit') && !$this->canDo->get('admin_view.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1390,7 +1400,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('admin_view.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1406,13 +1416,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -1456,7 +1466,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -1468,43 +1478,49 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // if system name is empty create a system name from the name_single - 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_single']; } + + // validate that the list and single view name are not the same + if ($data['name_single'] === $data['name_list']) + { + $data['name_list'] .= '_s'; + } // Set the GUID if empty or not valid if (empty($data['guid']) && $data['id'] > 0) { // get the existing one - $data['guid'] = (string) ComponentbuilderHelper::getVar('admin_view', $data['id'], 'id', 'guid'); + $data['guid'] = (string) GetHelper::var('admin_view', $data['id'], 'id', 'guid'); } + // Set the GUID if empty or not valid - while (!ComponentbuilderHelper::validGUID($data['guid'], "admin_view", $data['id'])) + while (!GuidHelper::valid($data['guid'], "admin_view", $data['id'])) { // must always be set - $data['guid'] = (string) ComponentbuilderHelper::GUID(); - } - + $data['guid'] = (string) GuidHelper::get(); + } // Set the addpermissions items to data. if (isset($data['addpermissions']) && is_array($data['addpermissions'])) { - $addpermissions = new JRegistry; + $addpermissions = new Registry; $addpermissions->loadArray($data['addpermissions']); $data['addpermissions'] = (string) $addpermissions; } @@ -1517,7 +1533,7 @@ public function save($data) // Set the addtabs items to data. if (isset($data['addtabs']) && is_array($data['addtabs'])) { - $addtabs = new JRegistry; + $addtabs = new Registry; $addtabs->loadArray($data['addtabs']); $data['addtabs'] = (string) $addtabs; } @@ -1530,7 +1546,7 @@ public function save($data) // Set the addlinked_views items to data. if (isset($data['addlinked_views']) && is_array($data['addlinked_views'])) { - $addlinked_views = new JRegistry; + $addlinked_views = new Registry; $addlinked_views->loadArray($data['addlinked_views']); $data['addlinked_views'] = (string) $addlinked_views; } @@ -1543,7 +1559,7 @@ public function save($data) // Set the alias_builder items to data. if (isset($data['alias_builder']) && is_array($data['alias_builder'])) { - $alias_builder = new JRegistry; + $alias_builder = new Registry; $alias_builder->loadArray($data['alias_builder']); $data['alias_builder'] = (string) $alias_builder; } @@ -1556,7 +1572,7 @@ public function save($data) // Set the custom_button items to data. if (isset($data['custom_button']) && is_array($data['custom_button'])) { - $custom_button = new JRegistry; + $custom_button = new Registry; $custom_button->loadArray($data['custom_button']); $data['custom_button'] = (string) $custom_button; } @@ -1569,7 +1585,7 @@ public function save($data) // Set the addtables items to data. if (isset($data['addtables']) && is_array($data['addtables'])) { - $addtables = new JRegistry; + $addtables = new Registry; $addtables->loadArray($data['addtables']); $data['addtables'] = (string) $addtables; } @@ -1582,7 +1598,7 @@ public function save($data) // Set the ajax_input items to data. if (isset($data['ajax_input']) && is_array($data['ajax_input'])) { - $ajax_input = new JRegistry; + $ajax_input = new Registry; $ajax_input->loadArray($data['ajax_input']); $data['ajax_input'] = (string) $ajax_input; } @@ -1819,11 +1835,11 @@ public function save($data) { $data['php_getitems'] = base64_encode($data['php_getitems']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1833,7 +1849,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1841,14 +1857,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1861,7 +1877,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/models/admin_views.php b/admin/models/admin_views.php index 6c5fee144..3f3db6ae4 100644 --- a/admin/models/admin_views.php +++ b/admin/models/admin_views.php @@ -12,18 +12,28 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper; +use VDM\Joomla\Utilities\FormHelper as JCBFormHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Admin_views List Model */ class ComponentbuilderModelAdmin_views extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -67,19 +77,19 @@ public function getFilterForm($data = array(), $loadData = true) 'onchange' => 'this.form.submit();', ); $options = array( - '' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_FOUND') . ' -' + '' => '- ' . Text::_('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') . ' -' + '' => '- ' . Text::_('COM_COMPONENTBUILDER_SELECT_COMPONENT') . ' -' ); // make sure we do not lose the key values in normal merge $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 +98,8 @@ public function getFilterForm($data = array(), $loadData = true) array_push($this->filter_fields, 'joomla_component'); return $form; - } + } + /** * Method to auto-populate the model state. @@ -103,7 +114,7 @@ public function getFilterForm($data = array(), $loadData = true) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -195,7 +206,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -210,12 +221,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -231,7 +242,7 @@ public function getItems() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -248,7 +259,7 @@ public function getItems() } } - + // return items return $items; } @@ -256,7 +267,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -268,7 +279,7 @@ public function selectionTranslation($value,$name) 0 => 'COM_COMPONENTBUILDER_ADMIN_VIEW_REMOVE' ); // Now check if value is found in this array - if (isset($add_fadeinArray[$value]) && ComponentbuilderHelper::checkString($add_fadeinArray[$value])) + if (isset($add_fadeinArray[$value]) && StringHelper::check($add_fadeinArray[$value])) { return $add_fadeinArray[$value]; } @@ -281,7 +292,7 @@ public function selectionTranslation($value,$name) 2 => 'COM_COMPONENTBUILDER_ADMIN_VIEW_READONLY' ); // Now check if value is found in this array - if (isset($typeArray[$value]) && ComponentbuilderHelper::checkString($typeArray[$value])) + if (isset($typeArray[$value]) && StringHelper::check($typeArray[$value])) { return $typeArray[$value]; } @@ -294,7 +305,7 @@ public function selectionTranslation($value,$name) 0 => 'COM_COMPONENTBUILDER_ADMIN_VIEW_NO' ); // Now check if value is found in this array - if (isset($add_custom_buttonArray[$value]) && ComponentbuilderHelper::checkString($add_custom_buttonArray[$value])) + if (isset($add_custom_buttonArray[$value]) && StringHelper::check($add_custom_buttonArray[$value])) { return $add_custom_buttonArray[$value]; } @@ -307,7 +318,7 @@ public function selectionTranslation($value,$name) 0 => 'COM_COMPONENTBUILDER_ADMIN_VIEW_NO' ); // Now check if value is found in this array - if (isset($add_php_ajaxArray[$value]) && ComponentbuilderHelper::checkString($add_php_ajaxArray[$value])) + if (isset($add_php_ajaxArray[$value]) && StringHelper::check($add_php_ajaxArray[$value])) { return $add_php_ajaxArray[$value]; } @@ -320,25 +331,25 @@ public function selectionTranslation($value,$name) 0 => 'COM_COMPONENTBUILDER_ADMIN_VIEW_NO' ); // Now check if value is found in this array - if (isset($add_custom_importArray[$value]) && ComponentbuilderHelper::checkString($add_custom_importArray[$value])) + if (isset($add_custom_importArray[$value]) && StringHelper::check($add_custom_importArray[$value])) { return $add_custom_importArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -354,7 +365,7 @@ protected function getListQuery() $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) . ')'); } @@ -386,7 +397,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -427,7 +438,7 @@ protected function getListQuery() $query->where('a.add_fadein = ' . (int) $_add_fadein); } } - elseif (ComponentbuilderHelper::checkString($_add_fadein)) + elseif (StringHelper::check($_add_fadein)) { $query->where('a.add_fadein = ' . $db->quote($db->escape($_add_fadein))); } @@ -444,11 +455,11 @@ protected function getListQuery() $query->where('a.type = ' . (int) $_type); } } - elseif (ComponentbuilderHelper::checkString($_type)) + elseif (StringHelper::check($_type)) { $query->where('a.type = ' . $db->quote($db->escape($_type))); } - elseif (ComponentbuilderHelper::checkArray($_type)) + elseif (UtilitiesArrayHelper::check($_type)) { // Secure the array for the query $_type = array_map( function ($val) use(&$db) { @@ -463,7 +474,7 @@ protected function getListQuery() return (int) $val; } } - elseif (ComponentbuilderHelper::checkString($val)) + elseif (StringHelper::check($val)) { return $db->quote($db->escape($val)); } @@ -484,7 +495,7 @@ protected function getListQuery() $query->where('a.add_custom_button = ' . (int) $_add_custom_button); } } - elseif (ComponentbuilderHelper::checkString($_add_custom_button)) + elseif (StringHelper::check($_add_custom_button)) { $query->where('a.add_custom_button = ' . $db->quote($db->escape($_add_custom_button))); } @@ -501,7 +512,7 @@ protected function getListQuery() $query->where('a.add_php_ajax = ' . (int) $_add_php_ajax); } } - elseif (ComponentbuilderHelper::checkString($_add_php_ajax)) + elseif (StringHelper::check($_add_php_ajax)) { $query->where('a.add_php_ajax = ' . $db->quote($db->escape($_add_php_ajax))); } @@ -518,16 +529,18 @@ protected function getListQuery() $query->where('a.add_custom_import = ' . (int) $_add_custom_import); } } - elseif (ComponentbuilderHelper::checkString($_add_custom_import)) + elseif (StringHelper::check($_add_custom_import)) { $query->where('a.add_custom_import = ' . $db->quote($db->escape($_add_custom_import))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -545,17 +558,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -589,7 +602,7 @@ public function getExportData($pks, $user = null) $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) . ')'); } @@ -618,7 +631,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -714,7 +727,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -732,16 +745,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_admin_view"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -750,7 +763,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -765,13 +778,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -781,13 +794,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.add_fadein'); // Check if the value is an array $_type = $this->getState('filter.type'); - if (ComponentbuilderHelper::checkArray($_type)) + if (UtilitiesArrayHelper::check($_type)) { $id .= ':' . implode(':', $_type); } // Check if this is only an number or string elseif (is_numeric($_type) - || ComponentbuilderHelper::checkString($_type)) + || StringHelper::check($_type)) { $id .= ':' . $_type; } @@ -804,19 +817,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -828,7 +840,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -849,7 +861,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/admins_custom_tabs.php b/admin/models/admins_custom_tabs.php index ee678f0de..49c763e0a 100644 --- a/admin/models/admins_custom_tabs.php +++ b/admin/models/admins_custom_tabs.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Admins_custom_tabs List Model */ class ComponentbuilderModelAdmins_custom_tabs extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/admins_fields.php b/admin/models/admins_fields.php index ebc5c5a57..d1f741799 100644 --- a/admin/models/admins_fields.php +++ b/admin/models/admins_fields.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Admins_fields List Model */ class ComponentbuilderModelAdmins_fields extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/admins_fields_conditions.php b/admin/models/admins_fields_conditions.php index 15a43efeb..d26a125d0 100644 --- a/admin/models/admins_fields_conditions.php +++ b/admin/models/admins_fields_conditions.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Admins_fields_conditions List Model */ class ComponentbuilderModelAdmins_fields_conditions extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/admins_fields_relations.php b/admin/models/admins_fields_relations.php index 5e449ab94..a017b9f77 100644 --- a/admin/models/admins_fields_relations.php +++ b/admin/models/admins_fields_relations.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Admins_fields_relations List Model */ class ComponentbuilderModelAdmins_fields_relations extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 86ab41226..ea8e4c8d5 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -12,10 +12,24 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; 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 VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\Base64Helper; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\FieldHelper; /** * Componentbuilder Ajax List Model @@ -23,64 +37,16 @@ class ComponentbuilderModelAjax extends ListModel { protected $app_params; - - public function __construct() - { - parent::__construct(); + + public function __construct() + { + parent::__construct(); // get params - $this->app_params = JComponentHelper::getParams('com_componentbuilder'); - + $this->app_params = ComponentHelper::getParams('com_componentbuilder'); + } // Used in joomla_component - - /** - * Check and if a vdm notice is new (per/user) - **/ - public function isNew($notice) - { - // first get the file path - $path_filename = ComponentbuilderHelper::getFilePath('path', 'usernotice', 'md', JFactory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR); - // check if the file is set - if (($content = @file_get_contents($path_filename)) !== FALSE) - { - if ($notice == $content) - { - return false; - } - } - return true; - } - - /** - * set That a notice has been read (per/user) - **/ - public function isRead($notice) - { - // first get the file path - $path_filename = ComponentbuilderHelper::getFilePath('path', 'usernotice', 'md', JFactory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR); - // set as read if not already set - if (($content = @file_get_contents($path_filename)) !== FALSE) - { - if ($notice == $content) - { - return true; - } - } - return $this->saveFile($notice,$path_filename); - } - - protected function saveFile($data,$path_filename) - { - if (ComponentbuilderHelper::checkString($data)) - { - $fp = fopen($path_filename, 'w'); - fwrite($fp, $data); - fclose($fp); - return true; - } - return false; - } /** * get the crowdin project details (html) **/ @@ -89,7 +55,7 @@ public function getCrowdinDetails($identifier, $key) // 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 @@ -101,9 +67,9 @@ public function getCrowdinDetails($identifier, $key) if (isset($details['details'])) { $html = '
    '; - $html .= '

    ' . JText::_('COM_COMPONENTBUILDER_COMPONENT_SUCCESSFULLY_LINKED') . '

    '; + $html .= '

    ' . Text::_('COM_COMPONENTBUILDER_COMPONENT_SUCCESSFULLY_LINKED') . '

    '; $html .= '

    ' . $details['details']['name'] . '

    '; - if (ComponentbuilderHelper::checkString($details['details']['description'])) + if (StringHelper::check($details['details']['description'])) { $html .= '

    '; $html .= $details['details']['description']; @@ -127,7 +93,7 @@ public function getCrowdinDetails($identifier, $key) $html .= ''; $html .= ''; $html .= '

    '; - return array('html' => $html); + return ['html' => $html]; } } return false; @@ -139,11 +105,11 @@ public function getCrowdinDetails($identifier, $key) public function getComponentDetails($id) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName(array( 'id','companyname','component_version','copyright','debug_linenr', - 'description','email','image','license','name', + 'description','email','image','license','name','preferred_joomla_version', 'short_description','website','author','add_placeholders', 'system_name','mvc_versiondate'))) ->from($db->quoteName('#__componentbuilder_joomla_component')) @@ -152,7 +118,9 @@ public function getComponentDetails($id) $db->execute(); if ($db->loadRowList()) { - return array( 'html' => $this->componentDetailsDisplay($db->loadObject())); + $object = $db->loadObject(); + + return ['html' => $this->componentDetailsDisplay($object), 'preferred_joomla_version' => $object->preferred_joomla_version ?? 0]; } return false; } @@ -165,47 +133,33 @@ public function getJCBpackageInfo($package) // 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 - $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') + ]; } /** @@ -214,29 +168,29 @@ public function getJCBpackageInfo($package) protected function componentDetailsDisplay($object) { // set some vars - $image = (ComponentbuilderHelper::checkString($object->image)) ? 'Joomla Component Image': ''; - $desc = (ComponentbuilderHelper::checkString($object->description)) ? $object->description : $object->short_description; - $placeholder = ($object->add_placeholders == 1) ? ' ' . JText::_('COM_COMPONENTBUILDER_YES') . ' ' : ' ' .JText::_('COM_COMPONENTBUILDER_NO') . ' ' ; - $debug = ($object->debug_linenr == 1) ? ' ' .JText::_('COM_COMPONENTBUILDER_YES') . '' : ' ' .JText::_('COM_COMPONENTBUILDER_NO') . ' ' ; + $image = (StringHelper::check($object->image)) ? 'Joomla Component Image': ''; + $desc = (StringHelper::check($object->description)) ? $object->description : $object->short_description; + $placeholder = ($object->add_placeholders == 1) ? ' ' . Text::_('COM_COMPONENTBUILDER_YES') . ' ' : ' ' .Text::_('COM_COMPONENTBUILDER_NO') . ' ' ; + $debug = ($object->debug_linenr == 1) ? ' ' .Text::_('COM_COMPONENTBUILDER_YES') . '' : ' ' .Text::_('COM_COMPONENTBUILDER_NO') . ' ' ; $html = array(); $html[] = '

    ' . $object->name . ' (v' . $object->component_version . ')

    '; $html[] = '

    ' . $desc . $image . '

    '; $html[] = '
      '; - $html[] = '
    • ' . JText::_('COM_COMPONENTBUILDER_COMPANY') . ': ' . $object->companyname . '
    • '; - $html[] = '
    • ' . JText::_('COM_COMPONENTBUILDER_AUTHOR') . ': ' . $object->author . '
    • '; - $html[] = '
    • ' . JText::_('COM_COMPONENTBUILDER_EMAIL') . ': ' . $object->email . '
    • '; - $html[] = '
    • ' . JText::_('COM_COMPONENTBUILDER_WEBSITE') . ': ' . $object->website . '
    • '; + $html[] = '
    • ' . Text::_('COM_COMPONENTBUILDER_COMPANY') . ': ' . $object->companyname . '
    • '; + $html[] = '
    • ' . Text::_('COM_COMPONENTBUILDER_AUTHOR') . ': ' . $object->author . '
    • '; + $html[] = '
    • ' . Text::_('COM_COMPONENTBUILDER_EMAIL') . ': ' . $object->email . '
    • '; + $html[] = '
    • ' . Text::_('COM_COMPONENTBUILDER_WEBSITE') . ': ' . $object->website . '
    • '; $html[] = '
    '; - $html[] = '

    ' . JText::_('COM_COMPONENTBUILDER_COMPONENT_GLOBAL_SETTINGS') . '

    '; + $html[] = '

    ' . Text::_('COM_COMPONENTBUILDER_COMPONENT_GLOBAL_SETTINGS') . '

    '; $html[] = '

    '; - $html[] = JText::_('COM_COMPONENTBUILDER_ADD_CUSTOM_CODE_PLACEHOLDERS') . '
    ' . $placeholder . '
    '; - $html[] = JText::_('COM_COMPONENTBUILDER_DEBUG_LINE_NUMBERS') . '
    ' . $debug ; + $html[] = Text::_('COM_COMPONENTBUILDER_ADD_CUSTOM_CODE_PLACEHOLDERS') . '
    ' . $placeholder . '
    '; + $html[] = Text::_('COM_COMPONENTBUILDER_DEBUG_LINE_NUMBERS') . '
    ' . $debug ; $html[] = '

    '; - $html[] = '

    ' . JText::_('COM_COMPONENTBUILDER_LICENSE') . '

    '; + $html[] = '

    ' . Text::_('COM_COMPONENTBUILDER_LICENSE') . '

    '; $html[] = '

    ' . $object->license . '

    '; - $html[] = '

    ' . JText::_('COM_COMPONENTBUILDER_COPYRIGHT') . '

    '; + $html[] = '

    ' . Text::_('COM_COMPONENTBUILDER_COPYRIGHT') . '

    '; $html[] = '

    ' . $object->copyright . '

    '; - $html[] = ' ' . JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' .$object->system_name . '

    '; + $html[] = ' ' . Text::_('COM_COMPONENTBUILDER_EDIT') . ' ' .$object->system_name . '

    '; // now return the diplay return implode("\n", $html); } @@ -246,30 +200,30 @@ protected function componentDetailsDisplay($object) **/ public function getCronPath($type) { - $result = array('error' => '' . JText::_('COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_SINCE_INCORRECT_TYPE_REQUESTED') . ''); + $result = array('error' => '' . Text::_('COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_SINCE_INCORRECT_TYPE_REQUESTED') . ''); if ('backup' === $type) { - $result['error'] = '' . JText::sprintf('COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_FOR_S', $type) . ''; + $result['error'] = '' . Text::sprintf('COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_FOR_S', $type) . ''; if ($this->hasCurl()) { - $path = '*/5 * * * * curl -s "' .JURI::root() . 'index.php?option=com_componentbuilder&task=api.backup" >/dev/null 2>&1'; + $path = '*/5 * * * * curl -s "' .\JUri::root() . 'index.php?option=com_componentbuilder&task=api.backup" >/dev/null 2>&1'; } else { - $path = '*/5 * * * * wget "' .JURI::root() . 'index.php?option=com_componentbuilder&task=api.backup" >/dev/null 2>&1'; + $path = '*/5 * * * * wget "' .\JUri::root() . 'index.php?option=com_componentbuilder&task=api.backup" >/dev/null 2>&1'; } $result['path'] = '' . $path . ''; } elseif ('expand' === $type) { - $result['error'] = '' . JText::sprintf('COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_FOR_S', $type) . ''; + $result['error'] = '' . Text::sprintf('COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_FOR_S', $type) . ''; if ($this->hasCurl()) { - $path = '* * * * * curl -s "' .JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand" >/dev/null 2>&1'; + $path = '* * * * * curl -s "' .\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand" >/dev/null 2>&1'; } else { - $path = '* * * * * wget "' .JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand" >/dev/null 2>&1'; + $path = '* * * * * wget "' .\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand" >/dev/null 2>&1'; } $result['path'] = '' . $path . ''; } @@ -280,134 +234,147 @@ protected function hasCurl() { return function_exists('curl_version'); } - - public function getWiki($name = 'Home') + + /** + * Check and if a notice is new (per/user) + * + * @param string|null $notice The current notice + * + * @return bool true if is new + * @since 2.0.0 + */ + public function isNew(?string $notice): bool { - // get the token if set - $token = JComponentHelper::getParams('com_componentbuilder')->get('gitea_token', false); + // first get the file path + $path_filename = FileHelper::getPath('path', 'usernotice', 'md', Factory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR); + + // check if the file is set + if (($content = FileHelper::getContent($path_filename, FALSE)) !== FALSE) + { + if ($notice == $content) + { + return false; + } + } + return true; + } - // setup a registry - $options = new Registry; + /** + * Check if a notice has been read (per/user) + * + * @param string|null $notice The current notice + * + * @return bool true if is read + * @since 2.0.0 + */ + public function isRead(?string $notice): bool + { + // first get the file path + $path_filename = FileHelper::getPath('path', 'usernotice', 'md', Factory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR); - // only add if token is set - if ($token) + // set as read if not already set + if (($content = FileHelper::getContent($path_filename, FALSE)) !== FALSE) { - $options->set('access.token', $token); + if ($notice == $content) + { + return true; + } } + return FileHelper::write($path_filename, $notice); + } + + /** + * get Current Version + * + * @param string|null $message The error messages if any. + * + * @return array The array of the notice or error message + * @since 2.3.0 + */ + public function getVersion($version = null) + { try { - // get gitea object - $gitea = new Gitea($options); - - // get the gitea wiki page TODO: we hard coded the page name - $page = $gitea->repo->wiki->getHtml('joomla', 'Component-Builder', 'Home'); + // get the repository tags + $tags = GiteaFactory::_('Gitea.Repository.Tags')->list('joomla', 'Component-Builder'); } catch (DomainException $e) { - return $this->getTokenForWiki($e->getMessage()); + return $this->getTokenForVersion($e->getMessage()); } catch (InvalidArgumentException $e) { - return $this->getTokenForWiki($e->getMessage()); + return $this->getTokenForVersion($e->getMessage()); } catch (Exception $e) { - return $this->getTokenForWiki($e->getMessage()); + return $this->getTokenForVersion($e->getMessage()); } - - // get the html - if (isset($page)) + // do we have tags returned + if (isset($tags[0]) && isset($tags[0]->name)) { - return ['page' => $page]; - } + // get the local version + $manifest = ComponentbuilderHelper::manifest(); + $local_version = (string) $manifest->version; + $latest_version = '1.0.0'; + $download_link = "https://git.vdm.dev/api/v1/joomla/Component-Builder"; - return $this->getTokenForWiki(); - } + // Filter tags by major version matching the local version's major number + $major_version = explode('.', $local_version)[0]; + $filtered_tags = array_filter($tags, function($tag) use ($major_version) { + return strpos($tag->name, "v$major_version") === 0; + }); - protected function getTokenForWiki($message = null) - { - if ($message) - { - return ['error' => $message]; - } + if (!empty($filtered_tags)) + { + // Sort versions to find the latest one + usort($filtered_tags, function($a, $b) { + return \version_compare($b->name, $a->name); + }); - return ['error' => JText::_('COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JCB_SYSTEM_HAS_INTERNET_CONNECTION')]; - } + $latest_version = trim($filtered_tags[0]->name, 'vV'); - public function getVersion($version = null) - { - // get the token if set - $token = JComponentHelper::getParams('com_componentbuilder')->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'); + // download link of the latest version + $download_link = $filtered_tags[0]->zipball_url; } - catch (DomainException $e) - { - return $this->getTokenForVersion($e->getMessage()); - } - catch (InvalidArgumentException $e) - { - return $this->getTokenForVersion($e->getMessage()); - } - catch (Exception $e) + + // now check if this version is out dated + if (\version_compare($local_version, $latest_version) === 0) { - return $this->getTokenForVersion($e->getMessage()); + return ['notice' => ' ' . Text::_('COM_COMPONENTBUILDER_UP_TO_DATE') . '']; } - // do we have tags returned - if (isset($tags[0]) && isset($tags[0]->name)) + else { - // get the version - $manifest = ComponentbuilderHelper::manifest(); - $local_version = (string) $manifest->version; - $current_version = trim($tags[0]->name, 'vV'); - - // now check if this version is out dated - if ($current_version === $local_version) + // check if this is beta version + if (\version_compare($local_version, $latest_version) > 0) { - return ['notice' => '' . JText::_('COM_COMPONENTBUILDER_UP_TO_DATE') . '']; + return ['notice' => ' ' . Text::_('COM_COMPONENTBUILDER_PRE_RELEASE') . '']; } else { - // check if this is beta version - $current_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $current_version)); - $local_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $local_version)); - if (($local_array[0] > $current_array[0]) || - ($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' => '' . JText::_('COM_COMPONENTBUILDER_BETA_RELEASE') . '']; - } - 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' => '' . JText::_('COM_COMPONENTBUILDER_OUT_OF_DATE') . '! ' . JText::_('COM_COMPONENTBUILDER_DOWNLOAD_UPDATE') . '!']; - } + return ['notice' => ' ' . Text::_('COM_COMPONENTBUILDER_OUT_OF_DATE') . '! ' . Text::_('COM_COMPONENTBUILDER_DOWNLOAD_UPDATE') . '!']; } } } return $this->getTokenForVersion(); } - - protected function getTokenForVersion($message = null) + + /** + * Instructions to get Token for version + * + * @param string|null $message The error messages if any. + * + * @return array The array of the error message + * @since 2.3.0 + */ + protected function getTokenForVersion(?string $message = null): array { // the URL $url = 'https://git.vdm.dev/user/settings/applications'; + // create link $a = ''; @@ -415,19 +382,76 @@ protected function getTokenForVersion($message = null) 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]; } + /** + * get Wiki Page + * + * @param string|null $message The error messages if any. + * + * @return array The array of the page or error message + * @since 2.3.0 + */ + public function getWiki(string $name = 'Home'): array + { + try + { + // get the gitea wiki page im markdown + $wiki = GiteaFactory::_('Gitea.Repository.Wiki')->get('joomla', 'Component-Builder', $name); + + // now render the page in HTML + $page = $wiki->content ?? null; + } + catch (\DomainException $e) + { + return $this->getTokenForWiki($e->getMessage()); + } + catch (\InvalidArgumentException $e) + { + return $this->getTokenForWiki($e->getMessage()); + } + catch (\Exception $e) + { + return $this->getTokenForWiki($e->getMessage()); + } + + // get the html + if (isset($page)) + { + return ['page' => $page]; + } + + return $this->getTokenForWiki(); + } + + /** + * Instructions to get Token for wiki + * + * @param string|null $message The error messages if any. + * + * @return array The array of the error message + * @since 2.3.0 + */ + protected function getTokenForWiki(?string $message = null): array + { + if ($message) + { + return ['error' => $message]; + } + + return ['error' => Text::_('COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JOOMLA_COMPONENT_BUILDER_SYSTEM_HAS_INTERNET_CONNECTION')]; + } // Used in joomla_module public function getModuleCode($data) { // reset the return array $code = array(); - if (ComponentbuilderHelper::checkJson($data)) + if (JsonHelper::check($data)) { // convert the data to object $data = json_decode($data); @@ -443,7 +467,7 @@ public function getModuleCode($data) $code['class']['merge_target'] = 'prepend'; } // get data - if (isset($data->get) && ComponentbuilderHelper::checkArray($data->get)) + if (isset($data->get) && UtilitiesArrayHelper::check($data->get)) { $code['get'] = array(); // add the code @@ -454,7 +478,7 @@ public function getModuleCode($data) $code['get']['merge_target'] = 'prepend'; } // get libraries - if (isset($data->lib) && ComponentbuilderHelper::checkArray($data->lib)) + if (isset($data->lib) && UtilitiesArrayHelper::check($data->lib)) { $code['lib'] = array(); // add the code @@ -495,29 +519,28 @@ public function getClassCodeIds($id, $type, $key) // we get the plugin group, or the powers if ($key == 1) { - return ComponentbuilderHelper::getVars('class_' . $type, $id, 'joomla_plugin_group', 'id'); + return GetHelper::vars('class_' . $type, $id, 'joomla_plugin_group', 'id'); } elseif ($key == 2) { - return ComponentbuilderHelper::getVars('class_' . $type, 'powers', 'extension_type', 'id'); + return GetHelper::vars('class_' . $type, 'powers', 'extension_type', 'id'); } } elseif ('joomla_plugin_group' === $type) { - return ComponentbuilderHelper::getVars($type, $id, 'class_extends', 'id'); + return GetHelper::vars($type, $id, 'class_extends', 'id'); } return false; } public function getClassHeaderCode($id, $type) { - if ('extends' === $type && ($head = ComponentbuilderHelper::getVar('class_' . $type, $id, 'id', 'head')) !== false && ComponentbuilderHelper::checkString($head)) + if ('extends' === $type && ($head = GetHelper::var('class_' . $type, $id, 'id', 'head')) !== false && StringHelper::check($head)) { return base64_decode($head); } return false; - } - + } // Used in admin_view protected $rowNumbers = array( @@ -553,13 +576,13 @@ public function checkAliasField($type) if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']) && in_array($values['a_view'], $this->allowedViewsArray)) { // get the fields - if ($fields = ComponentbuilderHelper::getVar('admin_fields', $values['a_id'], 'admin_view', 'addfields')) + if ($fields = GetHelper::var('admin_fields', $values['a_id'], 'admin_view', 'addfields')) { // open the fields - if (ComponentbuilderHelper::checkJson($fields)) + if (JsonHelper::check($fields)) { $fields = json_decode($fields, true); - if (ComponentbuilderHelper::checkArray($fields)) + if (UtilitiesArrayHelper::check($fields)) { foreach($fields as $field) { @@ -582,13 +605,13 @@ public function checkCategoryField($type) if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']) && in_array($values['a_view'], $this->allowedViewsArray)) { // get the fields - if ($fields = ComponentbuilderHelper::getVar('admin_fields', $values['a_id'], 'admin_view', 'addfields')) + if ($fields = GetHelper::var('admin_fields', $values['a_id'], 'admin_view', 'addfields')) { // open the fields - if (ComponentbuilderHelper::checkJson($fields)) + if (JsonHelper::check($fields)) { $fields = json_decode($fields, true); - if (ComponentbuilderHelper::checkArray($fields)) + if (UtilitiesArrayHelper::check($fields)) { foreach($fields as $field) { @@ -666,55 +689,55 @@ protected function getLanguage($key) { $language = array( // Library (folder file url) - 'rename' => JText::_('COM_COMPONENTBUILDER_RENAME'), - 'path' => JText::_('COM_COMPONENTBUILDER_TARGET_PATH'), - 'update' => JText::_('COM_COMPONENTBUILDER_UPDATE'), + 'rename' => Text::_('COM_COMPONENTBUILDER_RENAME'), + 'path' => Text::_('COM_COMPONENTBUILDER_TARGET_PATH'), + 'update' => Text::_('COM_COMPONENTBUILDER_UPDATE'), // Admin View (fields) - 'field' => JText::_('COM_COMPONENTBUILDER_FIELD'), - 'listfield' => JText::_('COM_COMPONENTBUILDER_LIST_FIELD'), - 'joinfields' => JText::_('COM_COMPONENTBUILDER_JOIN_FIELDS'), - 'set' => JText::_('COM_COMPONENTBUILDER_GLUECODE'), - 'join_type' => JText::_('COM_COMPONENTBUILDER_JOIN_TYPE'), - 'list' => JText::_('COM_COMPONENTBUILDER_ADMIN_BEHAVIOUR'), - 'order_list' => JText::_('COM_COMPONENTBUILDER_ORDER_IN_LIST_VIEWS'), - 'title' => JText::_('COM_COMPONENTBUILDER_TITLE'), - 'alias' => JText::_('COM_COMPONENTBUILDER_ALIAS'), - 'sort' => JText::_('COM_COMPONENTBUILDER_SORTABLE'), - 'search' => JText::_('COM_COMPONENTBUILDER_SEARCHABLE'), - 'filter' => JText::_('COM_COMPONENTBUILDER_FILTER'), - 'link' => JText::_('COM_COMPONENTBUILDER_LINK'), - 'permission' => JText::_('COM_COMPONENTBUILDER_PERMISSIONS'), - 'tab' => JText::_('COM_COMPONENTBUILDER_TAB'), - 'alignment' => JText::_('COM_COMPONENTBUILDER_ALIGNMENT'), - 'order_edit' => JText::_('COM_COMPONENTBUILDER_ORDER_IN_EDIT'), + 'field' => Text::_('COM_COMPONENTBUILDER_FIELD'), + 'listfield' => Text::_('COM_COMPONENTBUILDER_LIST_FIELD'), + 'joinfields' => Text::_('COM_COMPONENTBUILDER_JOIN_FIELDS'), + 'set' => Text::_('COM_COMPONENTBUILDER_GLUECODE'), + 'join_type' => Text::_('COM_COMPONENTBUILDER_JOIN_TYPE'), + 'list' => Text::_('COM_COMPONENTBUILDER_ADMIN_BEHAVIOUR'), + 'order_list' => Text::_('COM_COMPONENTBUILDER_ORDER_IN_LIST_VIEWS'), + 'title' => Text::_('COM_COMPONENTBUILDER_TITLE'), + 'alias' => Text::_('COM_COMPONENTBUILDER_ALIAS'), + 'sort' => Text::_('COM_COMPONENTBUILDER_SORTABLE'), + 'search' => Text::_('COM_COMPONENTBUILDER_SEARCHABLE'), + 'filter' => Text::_('COM_COMPONENTBUILDER_FILTER'), + 'link' => Text::_('COM_COMPONENTBUILDER_LINK'), + 'permission' => Text::_('COM_COMPONENTBUILDER_PERMISSIONS'), + 'tab' => Text::_('COM_COMPONENTBUILDER_TAB'), + 'alignment' => Text::_('COM_COMPONENTBUILDER_ALIGNMENT'), + 'order_edit' => Text::_('COM_COMPONENTBUILDER_ORDER_IN_EDIT'), // Admin View (conditions) - 'target_field' => JText::_('COM_COMPONENTBUILDER_TARGET_FIELDS'), - 'target_behavior' => JText::_('COM_COMPONENTBUILDER_TARGET_BEHAVIOUR'), - 'target_relation' => JText::_('COM_COMPONENTBUILDER_TARGET_RELATION'), - 'match_field' => JText::_('COM_COMPONENTBUILDER_MATCH_FIELD'), - 'match_behavior' => JText::_('COM_COMPONENTBUILDER_MATCH_BEHAVIOUR'), - 'match_options' => JText::_('COM_COMPONENTBUILDER_MATCH_OPTIONS'), + 'target_field' => Text::_('COM_COMPONENTBUILDER_TARGET_FIELDS'), + 'target_behavior' => Text::_('COM_COMPONENTBUILDER_TARGET_BEHAVIOUR'), + 'target_relation' => Text::_('COM_COMPONENTBUILDER_TARGET_RELATION'), + 'match_field' => Text::_('COM_COMPONENTBUILDER_MATCH_FIELD'), + 'match_behavior' => Text::_('COM_COMPONENTBUILDER_MATCH_BEHAVIOUR'), + 'match_options' => Text::_('COM_COMPONENTBUILDER_MATCH_OPTIONS'), // Joomla Component - 'menu' => JText::_('COM_COMPONENTBUILDER_ADD_MENU'), - 'metadata' => JText::_('COM_COMPONENTBUILDER_HAS_METADATA'), - 'default_view' => JText::_('COM_COMPONENTBUILDER_DEFAULT_VIEW'), - 'access' => JText::_('COM_COMPONENTBUILDER_ADD_ACCESS'), - 'public_access' => JText::_('COM_COMPONENTBUILDER_PUBLIC_ACCESS'), - 'mainmenu' => JText::_('COM_COMPONENTBUILDER_MAIN_MENU'), - 'dashboard_list' => JText::_('COM_COMPONENTBUILDER_DASHBOARD_LIST_OF_RECORDS'), - 'dashboard_add' => JText::_('COM_COMPONENTBUILDER_DASHBOARD_ADD_RECORD'), - 'submenu' => JText::_('COM_COMPONENTBUILDER_SUBMENU'), - 'checkin' => JText::_('COM_COMPONENTBUILDER_AUTO_CHECKIN'), - 'history' => JText::_('COM_COMPONENTBUILDER_KEEP_HISTORY'), - 'joomla_fields' => JText::_('COM_COMPONENTBUILDER_JOOMLA_FIELDS'), - 'port' => JText::_('COM_COMPONENTBUILDER_EXPORTIMPORT_DATA'), - 'edit_create_site_view' => JText::_('COM_COMPONENTBUILDER_EDITCREATE_SITE_VIEW'), - 'icomoon' => JText::_('COM_COMPONENTBUILDER_ICON'), - 'customadminview' => JText::_('COM_COMPONENTBUILDER_VIEW'), - 'adminviews' => JText::_('COM_COMPONENTBUILDER_VIEWS'), - 'adminview' => JText::_('COM_COMPONENTBUILDER_VIEW'), - 'siteview' => JText::_('COM_COMPONENTBUILDER_VIEW'), - 'before' => JText::_('COM_COMPONENTBUILDER_ORDER_BEFORE') + 'menu' => Text::_('COM_COMPONENTBUILDER_ADD_MENU'), + 'metadata' => Text::_('COM_COMPONENTBUILDER_HAS_METADATA'), + 'default_view' => Text::_('COM_COMPONENTBUILDER_DEFAULT_VIEW'), + 'access' => Text::_('COM_COMPONENTBUILDER_ADD_ACCESS'), + 'public_access' => Text::_('COM_COMPONENTBUILDER_PUBLIC_ACCESS'), + 'mainmenu' => Text::_('COM_COMPONENTBUILDER_MAIN_MENU'), + 'dashboard_list' => Text::_('COM_COMPONENTBUILDER_DASHBOARD_LIST_OF_RECORDS'), + 'dashboard_add' => Text::_('COM_COMPONENTBUILDER_DASHBOARD_ADD_RECORD'), + 'submenu' => Text::_('COM_COMPONENTBUILDER_SUBMENU'), + 'checkin' => Text::_('COM_COMPONENTBUILDER_AUTO_CHECKIN'), + 'history' => Text::_('COM_COMPONENTBUILDER_KEEP_HISTORY'), + 'joomla_fields' => Text::_('COM_COMPONENTBUILDER_JOOMLA_FIELDS'), + 'port' => Text::_('COM_COMPONENTBUILDER_EXPORTIMPORT_DATA'), + 'edit_create_site_view' => Text::_('COM_COMPONENTBUILDER_EDITCREATE_SITE_VIEW'), + 'icomoon' => Text::_('COM_COMPONENTBUILDER_ICON'), + 'customadminview' => Text::_('COM_COMPONENTBUILDER_VIEW'), + 'adminviews' => Text::_('COM_COMPONENTBUILDER_VIEWS'), + 'adminview' => Text::_('COM_COMPONENTBUILDER_VIEW'), + 'siteview' => Text::_('COM_COMPONENTBUILDER_VIEW'), + 'before' => Text::_('COM_COMPONENTBUILDER_ORDER_BEFORE') ); // check if a unique value is available if (isset($language[$key])) @@ -730,7 +753,7 @@ protected function getLanguage($key) return $language[$keys[1]]; } } - return ComponentbuilderHelper::safeString($keys[1], 'Ww'); + return StringHelper::safe($keys[1], 'Ww'); } protected $ref; @@ -785,7 +808,7 @@ protected function getLanguage($key) protected function checkRepeatableConversion($type, &$fieldsData, $fieldsArrayType, $id, $linked_id_name) { - if (ComponentbuilderHelper::checkJson($fieldsData) && isset($this->conversionCheck[$fieldsArrayType])) + if (JsonHelper::check($fieldsData) && isset($this->conversionCheck[$fieldsArrayType])) { $fieldsData = json_decode($fieldsData, true); if (isset($fieldsData[$this->conversionCheck[$fieldsArrayType]])) @@ -800,10 +823,10 @@ protected function checkRepeatableConversion($type, &$fieldsData, $fieldsArrayTy } $fieldsData = json_encode($bucket); // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->{$linked_id_name} = (int) $id; $objectUpdate->{$fieldsArrayType} = $fieldsData; - JFactory::getDbo()->updateObject('#__componentbuilder_' . $type, $objectUpdate, 'admin_view'); + Factory::getDbo()->updateObject('#__componentbuilder_' . $type, $objectUpdate, 'admin_view'); } } } @@ -821,12 +844,12 @@ protected function getFieldNameAndType($id) protected function setPermissions($header, $values) { // check if value is array - if (!ComponentbuilderHelper::checkArray($values)) + if (!UtilitiesArrayHelper::check($values)) { $values = array($values); } // check if value is array - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { // Editing, Access, View $bucket = array(); @@ -835,23 +858,23 @@ protected function setPermissions($header, $values) switch ($value) { case 1: - $bucket[] = JText::_('COM_COMPONENTBUILDER_EDITING'); + $bucket[] = Text::_('COM_COMPONENTBUILDER_EDITING'); break; case 2: - $bucket[] = JText::_('COM_COMPONENTBUILDER_ACCESS'); + $bucket[] = Text::_('COM_COMPONENTBUILDER_ACCESS'); break; case 3: - $bucket[] = JText::_('COM_COMPONENTBUILDER_VIEW'); + $bucket[] = Text::_('COM_COMPONENTBUILDER_VIEW'); break; } } // check if value is array - if (ComponentbuilderHelper::checkArray($bucket)) + if (UtilitiesArrayHelper::check($bucket)) { return implode(', ', $bucket); } } - return JText::_('COM_COMPONENTBUILDER_NONE'); + return Text::_('COM_COMPONENTBUILDER_NONE'); } protected function setJoinType($header, $value) @@ -859,13 +882,13 @@ protected function setJoinType($header, $value) switch ($value) { case 1: - return JText::_('COM_COMPONENTBUILDER_CONCATENATE'); + return Text::_('COM_COMPONENTBUILDER_CONCATENATE'); break; case 2: - return JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE'); + return Text::_('COM_COMPONENTBUILDER_CUSTOM_CODE'); break; } - return JText::_('COM_COMPONENTBUILDER_NOT_SET'); + return Text::_('COM_COMPONENTBUILDER_NOT_SET'); } protected function setURLType($header, $value) @@ -873,21 +896,21 @@ protected function setURLType($header, $value) switch ($value) { case 1: - return JText::_('COM_COMPONENTBUILDER_DEFAULT_LINK'); + return Text::_('COM_COMPONENTBUILDER_DEFAULT_LINK'); break; case 2: - return JText::_('COM_COMPONENTBUILDER_LOCAL_GET'); + return Text::_('COM_COMPONENTBUILDER_LOCAL_GET'); break; case 3: - return JText::_('COM_COMPONENTBUILDER_LINK_LOCAL_DYNAMIC'); + return Text::_('COM_COMPONENTBUILDER_LINK_LOCAL_DYNAMIC'); break; } - return JText::_('COM_COMPONENTBUILDER_NOT_SET'); + return Text::_('COM_COMPONENTBUILDER_NOT_SET'); } protected function setIcoMoon($header, $value) { - if (ComponentbuilderHelper::checkString($value)) + if (StringHelper::check($value)) { return ''; } @@ -899,28 +922,28 @@ protected function setAlignmentName($header, $value) switch ($value) { case 1: - return JText::_('COM_COMPONENTBUILDER_LEFT_IN_TAB'); + return Text::_('COM_COMPONENTBUILDER_LEFT_IN_TAB'); break; case 2: - return JText::_('COM_COMPONENTBUILDER_RIGHT_IN_TAB'); + return Text::_('COM_COMPONENTBUILDER_RIGHT_IN_TAB'); break; case 3: - return JText::_('COM_COMPONENTBUILDER_FULL_WIDTH_IN_TAB'); + return Text::_('COM_COMPONENTBUILDER_FULL_WIDTH_IN_TAB'); break; case 4: - return JText::_('COM_COMPONENTBUILDER_ABOVE_TABS'); + return Text::_('COM_COMPONENTBUILDER_ABOVE_TABS'); break; case 5: - return JText::_('COM_COMPONENTBUILDER_UNDERNEATH_TABS'); + return Text::_('COM_COMPONENTBUILDER_UNDERNEATH_TABS'); break; case 6: - return JText::_('COM_COMPONENTBUILDER_LEFT_OF_TABS'); + return Text::_('COM_COMPONENTBUILDER_LEFT_OF_TABS'); break; case 7: - return JText::_('COM_COMPONENTBUILDER_RIGHT_OF_TABS'); + return Text::_('COM_COMPONENTBUILDER_RIGHT_OF_TABS'); break; } - return JText::_('COM_COMPONENTBUILDER_NOT_SET'); + return Text::_('COM_COMPONENTBUILDER_NOT_SET'); } protected function setAdminBehaviour($header, $value) @@ -928,19 +951,19 @@ protected function setAdminBehaviour($header, $value) switch ($value) { case 1: - return JText::_('COM_COMPONENTBUILDER_SHOW_IN_ALL_LIST_VIEWS'); + return Text::_('COM_COMPONENTBUILDER_SHOW_IN_ALL_LIST_VIEWS'); break; case 2: - return JText::_('COM_COMPONENTBUILDER_NONE_DB'); + return Text::_('COM_COMPONENTBUILDER_NONE_DB'); break; case 3: - return JText::_('COM_COMPONENTBUILDER_ONLY_IN_ADMIN_LIST_VIEW'); + return Text::_('COM_COMPONENTBUILDER_ONLY_IN_ADMIN_LIST_VIEW'); break; case 4: - return JText::_('COM_COMPONENTBUILDER_ONLY_IN_LINKED_LIST_VIEWS'); + return Text::_('COM_COMPONENTBUILDER_ONLY_IN_LINKED_LIST_VIEWS'); break; default: - return JText::_('COM_COMPONENTBUILDER_DEFAULT'); + return Text::_('COM_COMPONENTBUILDER_DEFAULT'); break; } } @@ -952,23 +975,23 @@ protected function setTabName($header, $value) // return published if set to 15 (since this is the default number for it) if (15 == $value) { - return JText::_('COM_COMPONENTBUILDER_PUBLISHING'); + return Text::_('COM_COMPONENTBUILDER_PUBLISHING'); } - if (!ComponentbuilderHelper::checkArray($this->tabNames)) + if (!UtilitiesArrayHelper::check($this->tabNames)) { // get the view name & id $values = $this->getViewID(); if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']) && $values['a_view'] === 'admin_view') { - if ($tabs = ComponentbuilderHelper::getVar('admin_view', $values['a_id'], 'id', 'addtabs')) + if ($tabs = GetHelper::var('admin_view', $values['a_id'], 'id', 'addtabs')) { $tabs = json_decode($tabs, true); - if (ComponentbuilderHelper::checkArray($tabs)) + if (UtilitiesArrayHelper::check($tabs)) { $nr = 1; foreach ($tabs as $tab) { - if (ComponentbuilderHelper::checkArray($tab) && isset($tab['name'])) + if (UtilitiesArrayHelper::check($tab) && isset($tab['name'])) { $this->tabNames[$nr] = $tab['name']; $nr++; @@ -979,11 +1002,11 @@ protected function setTabName($header, $value) } } // has it been set - if (ComponentbuilderHelper::checkArray($this->tabNames) && isset($this->tabNames[$value])) + if (UtilitiesArrayHelper::check($this->tabNames) && isset($this->tabNames[$value])) { return $this->tabNames[$value]; } - return JText::_('COM_COMPONENTBUILDER_DETAILS'); + return Text::_('COM_COMPONENTBUILDER_DETAILS'); } protected function setAreaName($header, $value) @@ -991,16 +1014,16 @@ protected function setAreaName($header, $value) switch ($value) { case 1: - return JText::_('COM_COMPONENTBUILDER_MODEL_BEFORE_MODELLING'); + return Text::_('COM_COMPONENTBUILDER_MODEL_BEFORE_MODELLING'); break; case 2: - return JText::_('COM_COMPONENTBUILDER_VIEW'); + return Text::_('COM_COMPONENTBUILDER_VIEW'); break; case 3: - return JText::_('COM_COMPONENTBUILDER_MODEL_AFTER_MODELLING'); + return Text::_('COM_COMPONENTBUILDER_MODEL_AFTER_MODELLING'); break; } - return JText::_('COM_COMPONENTBUILDER_NOT_SET'); + return Text::_('COM_COMPONENTBUILDER_NOT_SET'); } protected function setCode($header, $value) @@ -1021,17 +1044,17 @@ protected function setTargetBehavior($header, $value) { if (1 == $value) { - return JText::_('COM_COMPONENTBUILDER_SHOW_TOGGLE'); + return Text::_('COM_COMPONENTBUILDER_SHOW_TOGGLE'); } elseif (3 == $value) { - return JText::_('COM_COMPONENTBUILDER_SHOW_ONLY'); + return Text::_('COM_COMPONENTBUILDER_SHOW_ONLY'); } elseif (4 == $value) { - return JText::_('COM_COMPONENTBUILDER_HIDE_ONLY'); + return Text::_('COM_COMPONENTBUILDER_HIDE_ONLY'); } - return JText::_('COM_COMPONENTBUILDER_HIDE_TOGGLE'); + return Text::_('COM_COMPONENTBUILDER_HIDE_TOGGLE'); } protected function setTargetRelation($header, $value) @@ -1039,13 +1062,13 @@ protected function setTargetRelation($header, $value) switch ($value) { case 0: - return JText::_('COM_COMPONENTBUILDER_ISOLATE'); + return Text::_('COM_COMPONENTBUILDER_ISOLATE'); break; case 1: - return JText::_('COM_COMPONENTBUILDER_CHAIN'); + return Text::_('COM_COMPONENTBUILDER_CHAIN'); break; } - return JText::_('COM_COMPONENTBUILDER_NOT_SET'); + return Text::_('COM_COMPONENTBUILDER_NOT_SET'); } protected function setMatchBehavior($header, $value) @@ -1053,43 +1076,43 @@ protected function setMatchBehavior($header, $value) switch ($value) { case 1: - return JText::_('COM_COMPONENTBUILDER_IS_ONLY_FOUR_LISTRADIOCHECKBOXES'); + return Text::_('COM_COMPONENTBUILDER_IS_ONLY_FOUR_LISTRADIOCHECKBOXES'); break; case 2: - return JText::_('COM_COMPONENTBUILDER_IS_NOT_ONLY_FOUR_LISTRADIOCHECKBOXES'); + return Text::_('COM_COMPONENTBUILDER_IS_NOT_ONLY_FOUR_LISTRADIOCHECKBOXES'); break; case 3: - return JText::_('COM_COMPONENTBUILDER_ANY_SELECTION_ONLY_FOUR_LISTRADIOCHECKBOXESDYNAMIC_LIST'); + return Text::_('COM_COMPONENTBUILDER_ANY_SELECTION_ONLY_FOUR_LISTRADIOCHECKBOXESDYNAMIC_LIST'); break; case 4: - return JText::_('COM_COMPONENTBUILDER_ACTIVE_ONLY_FOUR_TEXT_FIELD'); + return Text::_('COM_COMPONENTBUILDER_ACTIVE_ONLY_FOUR_TEXT_FIELD'); break; case 5: - return JText::_('COM_COMPONENTBUILDER_UNACTIVE_ONLY_FOUR_TEXT_FIELD'); + return Text::_('COM_COMPONENTBUILDER_UNACTIVE_ONLY_FOUR_TEXT_FIELD'); break; case 6: - return JText::_('COM_COMPONENTBUILDER_KEY_WORD_ALL_CASESENSITIVE_ONLY_FOUR_TEXT_FIELD'); + return Text::_('COM_COMPONENTBUILDER_KEY_WORD_ALL_CASESENSITIVE_ONLY_FOUR_TEXT_FIELD'); break; case 7: - return JText::_('COM_COMPONENTBUILDER_KEY_WORD_ANY_CASESENSITIVE_ONLY_FOUR_TEXT_FIELD'); + return Text::_('COM_COMPONENTBUILDER_KEY_WORD_ANY_CASESENSITIVE_ONLY_FOUR_TEXT_FIELD'); break; case 8: - return JText::_('COM_COMPONENTBUILDER_KEY_WORD_ALL_CASEINSENSITIVE_ONLY_FOUR_TEXT_FIELD'); + return Text::_('COM_COMPONENTBUILDER_KEY_WORD_ALL_CASEINSENSITIVE_ONLY_FOUR_TEXT_FIELD'); break; case 9: - return JText::_('COM_COMPONENTBUILDER_KEY_WORD_ANY_CASEINSENSITIVE_ONLY_FOUR_TEXT_FIELD'); + return Text::_('COM_COMPONENTBUILDER_KEY_WORD_ANY_CASEINSENSITIVE_ONLY_FOUR_TEXT_FIELD'); break; case 10: - return JText::_('COM_COMPONENTBUILDER_MIN_LENGTH_ONLY_FOUR_TEXT_FIELD'); + return Text::_('COM_COMPONENTBUILDER_MIN_LENGTH_ONLY_FOUR_TEXT_FIELD'); break; case 11: - return JText::_('COM_COMPONENTBUILDER_MAX_LENGTH_ONLY_FOUR_TEXT_FIELD'); + return Text::_('COM_COMPONENTBUILDER_MAX_LENGTH_ONLY_FOUR_TEXT_FIELD'); break; case 12: - return JText::_('COM_COMPONENTBUILDER_EXACT_LENGTH_ONLY_FOUR_TEXT_FIELD'); + return Text::_('COM_COMPONENTBUILDER_EXACT_LENGTH_ONLY_FOUR_TEXT_FIELD'); break; } - return JText::_('COM_COMPONENTBUILDER_NOT_SET'); + return Text::_('COM_COMPONENTBUILDER_NOT_SET'); } protected function setMatchOptions($header, $value) @@ -1119,7 +1142,7 @@ public function getFieldSelectOptions($id) // load the values form params $xml = json_decode($result->xml); - $xmlOptions = ComponentbuilderHelper::getBetween($xml,'option="','"'); + $xmlOptions = GetHelper::between($xml,'option="','"'); $optionSet = ''; if (strpos($xmlOptions,',') !== false) @@ -1129,7 +1152,7 @@ public function getFieldSelectOptions($id) foreach ($options as $option) { // return both value and text - if (ComponentbuilderHelper::checkString($optionSet)) + if (StringHelper::check($optionSet)) { // no add to option set $optionSet .= "\n".$option; @@ -1144,7 +1167,7 @@ public function getFieldSelectOptions($id) else { // return both value and text - if (ComponentbuilderHelper::checkString($optionSet)) + if (StringHelper::check($optionSet)) { // no add to option set $optionSet .= "\n".$xmlOptions; @@ -1182,7 +1205,7 @@ public function getTableColumns($tableName) { // get the columns $columns = $this->_db->getTableColumns("#__".$tableName); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // build the return string $tableColumns = array(); @@ -1276,8 +1299,8 @@ public function getLinked($type) { // just return it for now a table $table = '
    '; - $table .= ''; - $table .= ''; + $table .= ''; + $table .= ''; $table .= '
    '.JText::sprintf('COM_COMPONENTBUILDER_PLACES_ACROSS_JCB_WHERE_THIS_S_IS_LINKED', ComponentbuilderHelper::safeString($values['a_view'], 'w')).'
    '.JText::_('COM_COMPONENTBUILDER_TYPE_NAME').'
    '.Text::sprintf('COM_COMPONENTBUILDER_PLACES_ACROSS_JCB_WHERE_THIS_S_IS_LINKED', StringHelper::safe($values['a_view'], 'w')).'
    '.Text::_('COM_COMPONENTBUILDER_TYPE_NAME').'
    ' .implode('
    ', $linked) . '
    '; return $table; } @@ -1286,10 +1309,10 @@ public function getLinked($type) // if not found but has session view name if (strlen($values['a_view'])) { - return '

    ' . JText::sprintf('COM_COMPONENTBUILDER_S_NOT_LINKED', ComponentbuilderHelper::safeString($values['a_view'], 'Ww')) . '

    ' . JText::sprintf('COM_COMPONENTBUILDER_THIS_BSB_IS_NOT_LINKED_TO_ANY_OTHER_AREAS_OF_JCB_AT_THIS_TIME', $values['a_view']) . '

    '; + return '

    ' . Text::sprintf('COM_COMPONENTBUILDER_S_NOT_LINKED', StringHelper::safe($values['a_view'], 'Ww')) . '

    ' . Text::sprintf('COM_COMPONENTBUILDER_THIS_BSB_IS_NOT_LINKED_TO_ANY_OTHER_AREAS_OF_JCB_AT_THIS_TIME', $values['a_view']) . '

    '; } // no view or id found in session, or view not allowed to access area - return '

    ' . JText::_('COM_COMPONENTBUILDER_ERROR') . '

    ' . JText::_('COM_COMPONENTBUILDER_THERE_WAS_A_PROBLEM_BNO_VIEW_OR_ID_FOUND_IN_SESSION_OR_VIEW_NOT_ALLOWED_TO_ACCESS_AREAB_WE_COULD_NOT_LOAD_ANY_LINKED_TO_VALUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR') . '

    '; + return '

    ' . Text::_('COM_COMPONENTBUILDER_ERROR') . '

    ' . Text::_('COM_COMPONENTBUILDER_THERE_WAS_A_PROBLEM_BNO_VIEW_OR_ID_FOUND_IN_SESSION_OR_VIEW_NOT_ALLOWED_TO_ACCESS_AREAB_WE_COULD_NOT_LOAD_ANY_LINKED_TO_VALUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR') . '

    '; } /** @@ -1362,12 +1385,12 @@ protected function getLinkedTo($view, $id, $guid) else { // check if we have a json - if (ComponentbuilderHelper::checkJson($item->{$key})) + if (JsonHelper::check($item->{$key})) { $item->{$key} = json_decode($item->{$key}, true); } // if array - if (ComponentbuilderHelper::checkArray($item->{$key})) + if (UtilitiesArrayHelper::check($item->{$key})) { if ('ARRAY' === $target) { @@ -1387,7 +1410,7 @@ protected function getLinkedTo($view, $id, $guid) { $_target = (array) explode('.', $target); // check that we have an array and get the size - if (($_size = ComponentbuilderHelper::checkArray($_target)) !== false) + if (($_size = UtilitiesArrayHelper::check($_target)) !== false) { foreach ($item->{$key} as $row) { @@ -1398,7 +1421,7 @@ protected function getLinkedTo($view, $id, $guid) $found = true; } } - elseif ($_size == 3 && isset($row[$_target[0]]) && ComponentbuilderHelper::checkArray($row[$_target[0]])) + elseif ($_size == 3 && isset($row[$_target[0]]) && UtilitiesArrayHelper::check($row[$_target[0]])) { foreach ($row[$_target[0]] as $_row) { @@ -1415,7 +1438,7 @@ protected function getLinkedTo($view, $id, $guid) { $_target = (array) explode(':', $target); // check that we have an array and get the size - if (($_size = ComponentbuilderHelper::checkArray($_target)) == 2) + if (($_size = UtilitiesArrayHelper::check($_target)) == 2) { foreach ($item->{$key} as $field_name => $row) { @@ -1432,7 +1455,7 @@ protected function getLinkedTo($view, $id, $guid) } } // check that we have an array and get the size - if (($_size = ComponentbuilderHelper::checkArray($_target)) == 3) + if (($_size = UtilitiesArrayHelper::check($_target)) == 3) { foreach ($item->{$key} as $field_name => $row) { @@ -1468,18 +1491,18 @@ protected function getLinkedTo($view, $id, $guid) } } // if string (fields) - if (!$found && 'xml' === $key && ComponentbuilderHelper::checkString($item->{$key}) + if (!$found && 'xml' === $key && StringHelper::check($item->{$key}) && strpos($item->{$key}, $target.'="') !== false) { // now get the fields between - $_fields = ComponentbuilderHelper::getBetween($item->{$key}, $target.'="', '"'); + $_fields = GetHelper::between($item->{$key}, $target.'="', '"'); // check the result - if (ComponentbuilderHelper::checkString($_fields)) + if (StringHelper::check($_fields)) { // get the ids of all the fields linked here $_fields = array_map('trim', (array) explode(',', $_fields)); // check the result - if (ComponentbuilderHelper::checkArray($_fields)) + if (UtilitiesArrayHelper::check($_fields)) { foreach ($_fields as $_field) { @@ -1501,16 +1524,16 @@ protected function getLinkedTo($view, $id, $guid) $edit = true; if (is_numeric($linked_name) && isset($search['linked_name'])) { - if (!$linked_name = ComponentbuilderHelper::getVar($linked_nameTable, (int) $linked_name, 'id', $search['linked_name'])) + if (!$linked_name = GetHelper::var($linked_nameTable, (int) $linked_name, 'id', $search['linked_name'])) { - $linked_name = JText::_('COM_COMPONENTBUILDER_NO_FOUND'); + $linked_name = Text::_('COM_COMPONENTBUILDER_NO_FOUND'); $edit = false; } } // build the local type if (is_numeric($type_name) && isset($search['type_name'])) { - if (!$type_name = ComponentbuilderHelper::getVar($type_nameTable, (int) $type_name, 'id', $search['type_name'])) + if (!$type_name = GetHelper::var($type_nameTable, (int) $type_name, 'id', $search['type_name'])) { $type_name = ''; } @@ -1519,20 +1542,20 @@ protected function getLinkedTo($view, $id, $guid) $type_name = ' (' . $type_name . ') '; } } - elseif (ComponentbuilderHelper::checkString($type_name) || is_numeric($type_name)) + elseif (StringHelper::check($type_name) || is_numeric($type_name)) { $type_name = ' (' . $type_name . ') '; } // set edit link $link = ($edit) ? ComponentbuilderHelper::getEditButton($item->id, $search['table'], $search['tables'], $this->ref) : ''; // build the linked - $linked[] = JText::_($search['linked']) . $type_name . ' - ' . $linked_name . ' ' . $link; + $linked[] = Text::_($search['linked']) . $type_name . ' - ' . $linked_name . ' ' . $link; } } } } // check if we found any - if (ComponentbuilderHelper::checkArray($linked)) + if (UtilitiesArrayHelper::check($linked)) { return $linked; } @@ -1551,9 +1574,9 @@ protected function getLinkedTo($view, $id, $guid) protected function linkedGuid($guid, $setGuid): bool { // check if GUID is valid - if ($guid && ComponentbuilderHelper::validGUID($guid)) + if ($guid && GuidHelper::valid($guid)) { - if (is_string($setGuid) && ComponentbuilderHelper::validGUID($setGuid) && $guid === $setGuid) + if (is_string($setGuid) && GuidHelper::valid($setGuid) && $guid === $setGuid) { return true; } @@ -1571,7 +1594,7 @@ protected function linkedGuid($guid, $setGuid): bool * @var array * @since 3.0.13 */ - protected $viewid = array(); + protected $viewid = []; /** * Get the view details via the session @@ -1586,7 +1609,7 @@ protected function getViewID($call = 'table') if (!isset($this->viewid[$call])) { // get the vdm key - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $vdm = $jinput->get('vdm', null, 'WORD'); if ($vdm) { @@ -1594,7 +1617,7 @@ protected function getViewID($call = 'table') if ($view = ComponentbuilderHelper::get($vdm)) { $current = (array) explode('__', $view); - if (ComponentbuilderHelper::checkString($current[0]) && isset($current[1]) && is_numeric($current[1])) + if (StringHelper::check($current[0]) && isset($current[1]) && is_numeric($current[1])) { // get the view name & id $this->viewid[$call] = array( @@ -1604,9 +1627,9 @@ protected function getViewID($call = 'table') } } // set GUID if found - if (($guid = ComponentbuilderHelper::get($vdm . '__guid')) !== false && method_exists('ComponentbuilderHelper', 'validGUID')) + if (($guid = ComponentbuilderHelper::get($vdm . '__guid')) !== false) { - if (ComponentbuilderHelper::validGUID($guid)) + if (GuidHelper::valid($guid)) { $this->viewid[$call]['a_guid'] = $guid; } @@ -1614,7 +1637,7 @@ protected function getViewID($call = 'table') // set return if found if (($return = ComponentbuilderHelper::get($vdm . '__return')) !== false) { - if (ComponentbuilderHelper::checkString($return)) + if (StringHelper::check($return)) { $this->viewid[$call]['a_return'] = $return; } @@ -1633,7 +1656,7 @@ public function getButton($type, $size) { if (isset($this->buttonArray[$type])) { - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create if ($user->authorise($type.'.create', 'com_componentbuilder')) { @@ -1653,7 +1676,7 @@ public function getButton($type, $size) $ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id'] . '&return=' . urlencode(base64_encode($return_url)); } // build url (A tag) - $startAtag = 'onclick="UIkit2.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \'index.php?option=com_componentbuilder&view=' . $type . '&layout=edit' . $ref . '\' })" href="javascript:void(0)" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', ComponentbuilderHelper::safeString($type, 'W')).'">'; + $startAtag = 'onclick="UIkit2.modal.confirm(\''.Text::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \'index.php?option=com_componentbuilder&view=' . $type . '&layout=edit' . $ref . '\' })" href="javascript:void(0)" title="'.Text::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', StringHelper::safe($type, 'W')).'">'; // build the smallest button if (3 == $size) { @@ -1662,7 +1685,7 @@ public function getButton($type, $size) // build the smaller button elseif (2 == $size) { - $button = '
    ' . JText::_('COM_COMPONENTBUILDER_CREATE') . ''; + $button = ' ' . Text::_('COM_COMPONENTBUILDER_CREATE') . ''; } else // build the big button @@ -1673,7 +1696,7 @@ public function getButton($type, $size)
    '; @@ -1690,14 +1713,14 @@ public function getButtonID($type, $size) { if (isset($this->buttonArray[$type])) { - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create if ($user->authorise($type.'.create', 'com_componentbuilder')) { // get the view name & id $values = $this->getViewID(); // set the button ID - $css_class = 'control-group-'.ComponentbuilderHelper::safeString($type. '-' . $size, 'L', '-'); + $css_class = 'control-group-'.StringHelper::safe($type. '-' . $size, 'L', '-'); // check if new item $ref = ''; if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view'])) @@ -1719,17 +1742,17 @@ public function getButtonID($type, $size) // $key_get_value = $values['a_guid']; //} // get item id - if (($id = ComponentbuilderHelper::getVar($type, $key_get_value, $values['a_view'], 'id')) !== false && $id > 0) + if (($id = GetHelper::var($type, $key_get_value, $values['a_view'], 'id')) !== false && $id > 0) { - $buttonText = JText::sprintf('COM_COMPONENTBUILDER_EDIT_S_FOR_THIS_S', ComponentbuilderHelper::safeString($type, 'w'), ComponentbuilderHelper::safeString($values['a_view'], 'w')); - $buttonTextSmall = JText::_('COM_COMPONENTBUILDER_EDIT'); + $buttonText = Text::sprintf('COM_COMPONENTBUILDER_EDIT_S_FOR_THIS_S', StringHelper::safe($type, 'w'), StringHelper::safe($values['a_view'], 'w')); + $buttonTextSmall = Text::_('COM_COMPONENTBUILDER_EDIT'); $editThis = 'index.php?option=com_componentbuilder&view='.$this->buttonArray[$type].'&task='.$type.'.edit&id='.$id; $icon = 'icon-apply'; } else { - $buttonText = JText::sprintf('COM_COMPONENTBUILDER_CREATE_S_FOR_THIS_S', ComponentbuilderHelper::safeString($type, 'w'), ComponentbuilderHelper::safeString($values['a_view'], 'w')); - $buttonTextSmall = JText::_('COM_COMPONENTBUILDER_CREATE'); + $buttonText = Text::sprintf('COM_COMPONENTBUILDER_CREATE_S_FOR_THIS_S', StringHelper::safe($type, 'w'), StringHelper::safe($values['a_view'], 'w')); + $buttonTextSmall = Text::_('COM_COMPONENTBUILDER_CREATE'); $editThis = 'index.php?option=com_componentbuilder&view='.$type.'&layout=edit'; $icon = 'icon-new'; } @@ -1739,11 +1762,11 @@ public function getButtonID($type, $size) { $button[] = '
    '; $button[] = '
    '; - $button[] = ''; + $button[] = ''; $button[] = '
    '; $button[] = '
    '; } - $button[] = ''; + $button[] = ''; if (1 == $size) { $button[] = ''; @@ -1764,7 +1787,7 @@ public function getButtonID($type, $size) // only return notice if big button if (1 == $size) { - return '
    ' . JText::sprintf('COM_COMPONENTBUILDER_BUTTON_TO_CREATE_S_WILL_SHOW_ONCE_S_IS_SAVED_FOR_THE_FIRST_TIME', ComponentbuilderHelper::safeString($type, 'w'), ComponentbuilderHelper::safeString($values['a_view'], 'w')) . '
    '; + return '
    ' . Text::sprintf('COM_COMPONENTBUILDER_BUTTON_TO_CREATE_S_WILL_SHOW_ONCE_S_IS_SAVED_FOR_THE_FIRST_TIME', StringHelper::safe($type, 'w'), StringHelper::safe($values['a_view'], 'w')) . '
    '; } } } @@ -1774,12 +1797,12 @@ public function getButtonID($type, $size) protected function getSubformTable($idName, $data) { // make sure we convert the json to array - if (ComponentbuilderHelper::checkJson($data)) + if (JsonHelper::check($data)) { $data = json_decode($data, true); } // make sure we have an array - if (ComponentbuilderHelper::checkArray($data) && ComponentbuilderHelper::checkString($idName)) + if (UtilitiesArrayHelper::check($data) && StringHelper::check($idName)) { // Build heading $head = array(); @@ -1795,7 +1818,7 @@ protected function getSubformTable($idName, $data) } // build the rows $rows = array(); - if (ComponentbuilderHelper::checkArray($data) && ComponentbuilderHelper::checkArray($head)) + if (UtilitiesArrayHelper::check($data) && UtilitiesArrayHelper::check($head)) { foreach ($data as $nr => $values) { @@ -1814,7 +1837,7 @@ protected function getSubformTable($idName, $data) } } // build table - if (ComponentbuilderHelper::checkArray($rows) && ComponentbuilderHelper::checkArray($head)) + if (UtilitiesArrayHelper::check($rows) && UtilitiesArrayHelper::check($head)) { // set the number of rows $this->rowNumber = count($rows); @@ -1832,7 +1855,7 @@ protected function setSubformValue($header, $value) $value = $this->{$this->functionArray[$header]}($header, $value); } // if no value are set - if (!ComponentbuilderHelper::checkString($value)) + if (!StringHelper::check($value)) { $value = '-'; } @@ -1857,7 +1880,7 @@ public function getAjaxDisplay($type) if (isset($this->fieldsArray[$type])) { // set type name - $typeName = ComponentbuilderHelper::safeString($type, 'w'); + $typeName = StringHelper::safe($type, 'w'); // get the view name & id $values = $this->getViewID(); // check if we are in the correct view. @@ -1883,7 +1906,7 @@ public function getAjaxDisplay($type) // load the results $result = array(); // return field table - if (ComponentbuilderHelper::checkArray($this->fieldsArray[$type])) + if (UtilitiesArrayHelper::check($this->fieldsArray[$type])) { foreach ($this->fieldsArray[$type] as $fieldName) { @@ -1893,7 +1916,7 @@ public function getAjaxDisplay($type) } } } - elseif (ComponentbuilderHelper::checkString($this->fieldsArray[$type])) + elseif (StringHelper::check($this->fieldsArray[$type])) { if ($table = $this->getFieldTable($type, $key_get_value, $values['a_view'], $this->fieldsArray[$type], $typeName)) { @@ -1901,20 +1924,20 @@ public function getAjaxDisplay($type) } } // check if we have results - if (ComponentbuilderHelper::checkArray($result) && count($result) == 1) + if (UtilitiesArrayHelper::check($result) && count($result) == 1) { // return the display return implode('', $result); } - elseif (ComponentbuilderHelper::checkArray($result)) + elseif (UtilitiesArrayHelper::check($result)) { // return the display return '
    ' . implode('
    ', $result) . '
    '; } } - return '
    ' . JText::sprintf('COM_COMPONENTBUILDER_NO_S_HAVE_BEEN_LINKED_TO_THIS_VIEW_SOON_AS_THIS_IS_DONE_IT_WILL_BE_DISPLAYED_HERE', $typeName) . '
    '; + return '
    ' . Text::sprintf('COM_COMPONENTBUILDER_NO_S_HAVE_BEEN_LINKED_TO_THIS_VIEW_SOON_AS_THIS_IS_DONE_IT_WILL_BE_DISPLAYED_HERE', $typeName) . '
    '; } - return '

    ' . JText::_('COM_COMPONENTBUILDER_TYPE_ERROR') . '

    ' . JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_IF_THIS_CONTINUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR_OF_A_TYPE_ERROR_IN_THE_FIELDS_DISPLAY_REQUEST') . '

    '; + return '

    ' . Text::_('COM_COMPONENTBUILDER_TYPE_ERROR') . '

    ' . Text::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_IF_THIS_CONTINUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR_OF_A_TYPE_ERROR_IN_THE_FIELDS_DISPLAY_REQUEST') . '

    '; } @@ -1935,20 +1958,20 @@ protected function setItemNames($header, $value) $getEdit = method_exists('ComponentbuilderHelper', 'getEditButton'); // reset bucket $bucket = array(); - if (ComponentbuilderHelper::checkArray($value)) + if (UtilitiesArrayHelper::check($value)) { foreach ($value as $item) { $edit = true; if (!isset($this->itemNames[$this->itemKeys[$header]['table']][$item])) { - if (($this->itemNames[$this->itemKeys[$header]['table']][$item] = ComponentbuilderHelper::getVar($this->itemKeys[$header]['table'], $item, $this->itemKeys[$header]['id'], $this->itemKeys[$header]['name'])) === false) + if (($this->itemNames[$this->itemKeys[$header]['table']][$item] = GetHelper::var($this->itemKeys[$header]['table'], $item, $this->itemKeys[$header]['id'], $this->itemKeys[$header]['name'])) === false) { - $this->itemNames[$this->itemKeys[$header]['table']][$item] = JText::sprintf('COM_COMPONENTBUILDER_NO_S_FOUND', $this->itemKeys[$header]['text']); + $this->itemNames[$this->itemKeys[$header]['table']][$item] = Text::sprintf('COM_COMPONENTBUILDER_NO_S_FOUND', $this->itemKeys[$header]['text']); $edit = false; } // check if we should load some get - if ($edit && isset($this->itemKeys[$header]['get']) && ComponentbuilderHelper::checkString($this->itemKeys[$header]['get']) && method_exists(__CLASS__, $this->itemKeys[$header]['get'])) + if ($edit && isset($this->itemKeys[$header]['get']) && StringHelper::check($this->itemKeys[$header]['get']) && method_exists(__CLASS__, $this->itemKeys[$header]['get'])) { // gets $this->itemNames[$this->itemKeys[$header]['table']][$item] .= $this->{$this->itemKeys[$header]['get']}($item); @@ -1974,13 +1997,13 @@ protected function setItemNames($header, $value) $edit = true; if (!isset($this->itemNames[$this->itemKeys[$header]['table']][$value])) { - if (($this->itemNames[$this->itemKeys[$header]['table']][$value] = ComponentbuilderHelper::getVar($this->itemKeys[$header]['table'], $value, $this->itemKeys[$header]['id'], $this->itemKeys[$header]['name'])) === false) + if (($this->itemNames[$this->itemKeys[$header]['table']][$value] = GetHelper::var($this->itemKeys[$header]['table'], $value, $this->itemKeys[$header]['id'], $this->itemKeys[$header]['name'])) === false) { - $this->itemNames[$this->itemKeys[$header]['table']][$value] = JText::sprintf('COM_COMPONENTBUILDER_NO_S_FOUND', $this->itemKeys[$header]['text']); + $this->itemNames[$this->itemKeys[$header]['table']][$value] = Text::sprintf('COM_COMPONENTBUILDER_NO_S_FOUND', $this->itemKeys[$header]['text']); $edit = false; } // check if we should load some get - if ($edit && isset($this->itemKeys[$header]['get']) && ComponentbuilderHelper::checkString($this->itemKeys[$header]['get']) && method_exists(__CLASS__, $this->itemKeys[$header]['get'])) + if ($edit && isset($this->itemKeys[$header]['get']) && StringHelper::check($this->itemKeys[$header]['get']) && method_exists(__CLASS__, $this->itemKeys[$header]['get'])) { // gets $this->itemNames[$this->itemKeys[$header]['table']][$value] .= $this->{$this->itemKeys[$header]['get']}($value); @@ -2001,20 +2024,20 @@ protected function setItemNames($header, $value) $bucket[] = $this->itemNames[$this->itemKeys[$header]['table']][$value] . $link; } // return found items - if (ComponentbuilderHelper::checkArray($bucket)) + if (UtilitiesArrayHelper::check($bucket)) { return implode('
    ', $bucket); } - return JText::sprintf('COM_COMPONENTBUILDER_NO_S_FOUND', $this->itemKeys[$header]['text']); + return Text::sprintf('COM_COMPONENTBUILDER_NO_S_FOUND', $this->itemKeys[$header]['text']); } - return JText::_('COM_COMPONENTBUILDER_NO_ITEM_FOUND'); + return Text::_('COM_COMPONENTBUILDER_NO_ITEM_FOUND'); } protected function getFieldTable($type, $id, $idName, $fieldName, $typeName) { // get the field data - if (($fieldsData = ComponentbuilderHelper::getVar($type, $id, $idName, $fieldName)) !== false) + if (($fieldsData = GetHelper::var($type, $id, $idName, $fieldName)) !== false) { // check repeatable conversion if (method_exists(__CLASS__, 'checkRepeatableConversion')) @@ -2029,11 +2052,11 @@ protected function getFieldTable($type, $id, $idName, $fieldName, $typeName) $notice = ''; if ($number && isset($this->rowNumber) && $this->rowNumber > $number) { - $notice = '
    ' . JText::sprintf('COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_S_S_IS_CONSIDERED_BAD_PRACTICE_YOUR_S_PAGE_LOAD_IN_JCB_WILL_SLOWDOWN_YOU_SHOULD_CONSIDER_DECOUPLING_SOME_OF_THESE_S', $this->rowNumber, $typeName, $number, $typeName, $typeName, $typeName) . '
    '; + $notice = '
    ' . Text::sprintf('COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_S_S_IS_CONSIDERED_BAD_PRACTICE_YOUR_S_PAGE_LOAD_IN_JCB_WILL_SLOWDOWN_YOU_SHOULD_CONSIDER_DECOUPLING_SOME_OF_THESE_S', $this->rowNumber, $typeName, $number, $typeName, $typeName, $typeName) . '
    '; } elseif ($number && isset($this->rowNumber)) { - $notice = '
    ' . JText::sprintf('COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_S_S_IS_CONSIDERED_BAD_PRACTICE', $this->rowNumber, $typeName, $number, $typeName) . '
    '; + $notice = '
    ' . Text::sprintf('COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_S_S_IS_CONSIDERED_BAD_PRACTICE', $this->rowNumber, $typeName, $number, $typeName) . '
    '; } // return table return $notice . $table; @@ -2048,7 +2071,7 @@ public function getTemplateDetails($id) // set table $table = false; // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); $query->select($db->quoteName(array('a.id', 'a.alias', 'a.template', 'b.name', 'a.dynamic_get'))); @@ -2083,13 +2106,13 @@ public function getTemplateDetails($id) { $edit = (($button = ComponentbuilderHelper::getEditButton($result->id, 'template', 'templates', $ref)) !== false) ? $button : ''; $editget = (isset($result->dynamic_get) && $result->dynamic_get > 0 && ($button = ComponentbuilderHelper::getEditButton($result->dynamic_get, 'dynamic_get', 'dynamic_gets', $ref)) !== false) ? $button : ''; - $result->name = (ComponentbuilderHelper::checkString($result->name)) ? $result->name : JText::_('COM_COMPONENTBUILDER_NONE_SELECTED'); - $templateString[] = "".$result->name." ".$editget."<?php echo \$this->loadTemplate('".ComponentbuilderHelper::safeString($result->alias)."'); ?> ".$edit.""; + $result->name = (StringHelper::check($result->name)) ? $result->name : Text::_('COM_COMPONENTBUILDER_NONE_SELECTED'); + $templateString[] = "".$result->name." ".$editget."<?php echo \$this->loadTemplate('".StringHelper::safe($result->alias)."'); ?> ".$edit.""; } // build the table - $table = '

    ' . JText::_('COM_COMPONENTBUILDER_TEMPLATE_CODE_SNIPPETS') . '

    '; - $table .= ''; - $table .= ''; + $table = '

    ' . Text::_('COM_COMPONENTBUILDER_TEMPLATE_CODE_SNIPPETS') . '

    ' . JText::_('COM_COMPONENTBUILDER_TO_ADD_SIMPLY_COPY_AND_PAST_THE_SNIPPET_INTO_YOUR_CODE') . '
    ' . JText::_('COM_COMPONENTBUILDER_NAME_OF_DYNAMICGET') . '' . JText::_('COM_COMPONENTBUILDER_SNIPPET') . '
    '; + $table .= ''; + $table .= ''; $table .= '' . implode("", $templateString) . "
    ' . Text::_('COM_COMPONENTBUILDER_TO_ADD_SIMPLY_COPY_AND_PAST_THE_SNIPPET_INTO_YOUR_CODE') . '
    ' . Text::_('COM_COMPONENTBUILDER_NAME_OF_DYNAMICGET') . '' . Text::_('COM_COMPONENTBUILDER_SNIPPET') . '
    "; } return $table; @@ -2101,7 +2124,7 @@ public function getLayoutDetails($id) // set table $table = false; // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); $query->select($db->quoteName(array('a.id','a.alias','a.layout','b.getcustom','b.gettype','b.name','a.dynamic_get'))); @@ -2135,22 +2158,22 @@ public function getLayoutDetails($id) { $edit = (($button = ComponentbuilderHelper::getEditButton($result->id, 'layout', 'layouts', $ref)) !== false) ? $button : ''; $editget = (isset($result->dynamic_get) && $result->dynamic_get > 0 && ($button = ComponentbuilderHelper::getEditButton($result->dynamic_get, 'dynamic_get', 'dynamic_gets', $ref)) !== false) ? $button : ''; - $result->name = (ComponentbuilderHelper::checkString($result->name)) ? $result->name : JText::_('COM_COMPONENTBUILDER_NONE_SELECTED'); + $result->name = (StringHelper::check($result->name)) ? $result->name : Text::_('COM_COMPONENTBUILDER_NONE_SELECTED'); switch ($result->gettype) { case 1: // single - $layoutString[] = "" . $result->name . " " . $editget . "<?php echo JLayoutHelper::render('" . ComponentbuilderHelper::safeString($result->alias) . "', \$this->item); ?> " . $edit . ""; + $layoutString[] = "" . $result->name . " " . $editget . "<?php echo LayoutHelper::render('" . StringHelper::safe($result->alias) . "', \$this->item); ?> " . $edit . ""; break; case 2: // list - $layoutString[] = "" . $result->name . " " . $editget . "<?php echo JLayoutHelper::render('" . ComponentbuilderHelper::safeString($result->alias) . "', \$this->items); ?> " . $edit . ""; + $layoutString[] = "" . $result->name . " " . $editget . "<?php echo LayoutHelper::render('" . StringHelper::safe($result->alias) . "', \$this->items); ?> " . $edit . ""; break; case 3: case 4: // custom - $result->getcustom = ComponentbuilderHelper::safeString($result->getcustom); + $result->getcustom = StringHelper::safe($result->getcustom); if (substr($result->getcustom, 0, strlen('get')) == 'get') { $varName = substr($result->getcustom, strlen('get')); @@ -2159,18 +2182,18 @@ public function getLayoutDetails($id) { $varName = $result->getcustom; } - $layoutString[] = "" . $result->name . " " . $editget . "<?php echo JLayoutHelper::render('" . ComponentbuilderHelper::safeString($result->alias) . "', \$this->" . $varName . "); ?> " . $edit . ""; + $layoutString[] = "" . $result->name . " " . $editget . "<?php echo LayoutHelper::render('" . StringHelper::safe($result->alias) . "', \$this->" . $varName . "); ?> " . $edit . ""; break; default: // no get - $layoutString[] = "" . JText::_('COM_COMPONENTBUILDER_NONE_SELECTED') . "<?php echo JLayoutHelper::render('" . ComponentbuilderHelper::safeString($result->alias) . "', [?]); ?> " . $edit . ""; + $layoutString[] = "" . Text::_('COM_COMPONENTBUILDER_NONE_SELECTED') . "<?php echo LayoutHelper::render('" . StringHelper::safe($result->alias) . "', [?]); ?> " . $edit . ""; break; } } // build the table - $table = '

    ' . JText::_('COM_COMPONENTBUILDER_LAYOUT_CODE_SNIPPETS') . '

    '; - $table .= ''; - $table .= ''; + $table = '

    ' . Text::_('COM_COMPONENTBUILDER_LAYOUT_CODE_SNIPPETS') . '

    ' . JText::_('COM_COMPONENTBUILDER_TO_ADD_SIMPLY_COPY_AND_PAST_THE_SNIPPET_INTO_YOUR_CODE') . '
    ' . JText::_('COM_COMPONENTBUILDER_NAME_OF_DYNAMICGET') . '' . JText::_('COM_COMPONENTBUILDER_SNIPPET') . '
    '; + $table .= ''; + $table .= ''; $table .= '' . implode("",$layoutString) . "
    ' . Text::_('COM_COMPONENTBUILDER_TO_ADD_SIMPLY_COPY_AND_PAST_THE_SNIPPET_INTO_YOUR_CODE') . '
    ' . Text::_('COM_COMPONENTBUILDER_NAME_OF_DYNAMICGET') . '' . Text::_('COM_COMPONENTBUILDER_SNIPPET') . '
    "; } return $table; @@ -2190,7 +2213,7 @@ public function getDbTableColumns($tableName, $as, $type) public function getDynamicValues($id, $view) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -2231,17 +2254,17 @@ public function getDynamicValues($id, $view) } // get the joined values (name) $result->join_view_table = json_decode($result->join_view_table, true); - if (!ComponentbuilderHelper::checkArray($result->join_view_table)) + if (!UtilitiesArrayHelper::check($result->join_view_table)) { unset($result->join_view_table); } $result->join_db_table = json_decode($result->join_db_table, true); - if (!ComponentbuilderHelper::checkArray($result->join_db_table)) + if (!UtilitiesArrayHelper::check($result->join_db_table)) { unset($result->join_db_table); } // now load the joined values to the selection set - if (isset($result->join_view_table) && ComponentbuilderHelper::checkArray($result->join_view_table)) + if (isset($result->join_view_table) && UtilitiesArrayHelper::check($result->join_view_table)) { foreach ($result->join_view_table as $join_view_table) { @@ -2263,7 +2286,7 @@ public function getDynamicValues($id, $view) } unset($result->join_view_table); } - if (isset($result->join_db_table) && ComponentbuilderHelper::checkArray($result->join_db_table)) + if (isset($result->join_db_table) && UtilitiesArrayHelper::check($result->join_db_table)) { foreach ($result->join_db_table as $join_db_table) { @@ -2289,7 +2312,7 @@ public function getDynamicValues($id, $view) if ($result->addcalculation == 1) { $php_calculation = base64_decode($result->php_calculation); - $phpSelections = ComponentbuilderHelper::getAllBetween($php_calculation,'cal__',' '); + $phpSelections = GetHelper::allBetween($php_calculation,'cal__',' '); $selections[] = array_unique($phpSelections); unset($php_calculation); unset($phpSelections); @@ -2311,7 +2334,7 @@ public function getDynamicValues($id, $view) case 3: case 4: // custom - $result->getcustom = ComponentbuilderHelper::safeString($result->getcustom); + $result->getcustom = StringHelper::safe($result->getcustom); if (substr($result->getcustom, 0, strlen('get')) == 'get') { $varName = substr($result->getcustom, strlen('get')); @@ -2329,7 +2352,7 @@ public function getDynamicValues($id, $view) $buketName = 'displayData'; } // now build the return values - if (ComponentbuilderHelper::checkArray($selections)) + if (UtilitiesArrayHelper::check($selections)) { $buket = array(); switch ($result->gettype) @@ -2350,7 +2373,7 @@ public function getDynamicValues($id, $view) } foreach ($selections as $selection) { - if (ComponentbuilderHelper::checkArray($selection)) + if (UtilitiesArrayHelper::check($selection)) { foreach ($selection as $value) { @@ -2366,12 +2389,12 @@ public function getDynamicValues($id, $view) } } } - if (ComponentbuilderHelper::checkArray($selectionsList)) + if (UtilitiesArrayHelper::check($selectionsList)) { $buket[] = '
    '; foreach ($selectionsList as $name => $selectionList) { - if (ComponentbuilderHelper::checkArray($selectionList)) + if (UtilitiesArrayHelper::check($selectionList)) { $ur = '<?php echo $'.$name; $cf = '; ?>'; @@ -2409,11 +2432,11 @@ public function getDynamicValues($id, $view) protected function setListMethodName($names, $table, $as, $type) { $methodNames = array(); - if (ComponentbuilderHelper::checkArray($names)) + if (UtilitiesArrayHelper::check($names)) { foreach ($names as $nr => $name) { - if (ComponentbuilderHelper::checkString($name)) + if (StringHelper::check($name)) { if (strpos($name,'.') !== false) { @@ -2425,11 +2448,11 @@ protected function setListMethodName($names, $table, $as, $type) } if ($nr > 0) { - $methodNames[] = ComponentbuilderHelper::safeString($var,'F'); + $methodNames[] = StringHelper::safe($var,'F'); } else { - $methodNames[] = ComponentbuilderHelper::safeString($var); + $methodNames[] = StringHelper::safe($var); } } } @@ -2438,23 +2461,23 @@ protected function setListMethodName($names, $table, $as, $type) { // set view name case 1: - $methodNames[] = ComponentbuilderHelper::safeString($this->getViewName($table),'F'); + $methodNames[] = StringHelper::safe($this->getViewName($table),'F'); break; // set db name case 2: - $methodNames[] = ComponentbuilderHelper::safeString($table,'F'); + $methodNames[] = StringHelper::safe($table,'F'); break; } // make sure there is uniqe method names - $methodNames[] = ComponentbuilderHelper::safeString($as,'U'); + $methodNames[] = StringHelper::safe($as,'U'); return $methodNames; } protected function getViewName($id) { // Get the view name - if ($name = ComponentbuilderHelper::getVar('admin_view', (int) $id, 'id', 'name_single')) + if ($name = GetHelper::var('admin_view', (int) $id, 'id', 'name_single')) { return $name; } @@ -2473,10 +2496,10 @@ public function getEditCustomCodeButtons($id) // some helper for some fields (I am sorry) $helper = array('xml' => 'note_filter_information'); // get input - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return_here = $jinput->get('return_here', null, 'base64'); // set the return here value if not found - if (ComponentbuilderHelper::checkString($return_here)) + if (StringHelper::check($return_here)) { $return_here = '&return=' . $return_here; } @@ -2485,7 +2508,7 @@ public function getEditCustomCodeButtons($id) $return_here = '&ref=' . $view['a_view'] . '&refid=' . (int) $id; } // start db query - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName($target['select'])) ->from($db->quoteName('#__componentbuilder_' . $target['table'], 'a')) @@ -2503,7 +2526,7 @@ public function getEditCustomCodeButtons($id) { if (!isset($target['not_base64'][$key])) { - $value = ComponentbuilderHelper::openValidBase64($value, null); + $value = Base64Helper::open($value, null); } elseif ('json' === $target['not_base64'][$key] && 'xml' === $key) // just for field search { @@ -2520,17 +2543,17 @@ public function getEditCustomCodeButtons($id) if (strpos($value, '[CUSTOMC' . 'ODE=') !== false) { // get all custom codes in value - $bucket[$key] = ComponentbuilderHelper::getAllBetween($value, '[CUSTOMC' . 'ODE=', ']'); + $bucket[$key] = GetHelper::allBetween($value, '[CUSTOMC' . 'ODE=', ']'); } // check if field has string length - if (ComponentbuilderHelper::checkString($value)) + if (StringHelper::check($value)) { // see if the field needs some help :) $_key = (isset($helper[$key])) ? $helper[$key] : $key; // build the buttons $buttons[$_key] = array(); - if (($button = $this->getButton('custom_code', 3)) && ComponentbuilderHelper::checkString($button)) + if (($button = $this->getButton('custom_code', 3)) && StringHelper::check($button)) { $buttons[$_key]['_create'] = $button; } @@ -2538,7 +2561,7 @@ public function getEditCustomCodeButtons($id) } } // check if any values found - if (ComponentbuilderHelper::checkArray($bucket)) + if (UtilitiesArrayHelper::check($bucket)) { foreach ($bucket as $field => $customcodes) { @@ -2552,9 +2575,9 @@ public function getEditCustomCodeButtons($id) // get the customcode name $key = (array) explode('+', $customcode); // see if we can get the button - if (!isset($buttons[$field][$key[0]]) && ($_id = ComponentbuilderHelper::getVar('custom_code', $key[0], 'function_name')) !== false + if (!isset($buttons[$field][$key[0]]) && ($_id = GetHelper::var('custom_code', $key[0], 'function_name')) !== false && ($button = ComponentbuilderHelper::getEditTextButton($edit_icon . $key[0], $_id, 'custom_code', 'custom_codes', $return_here, 'com_componentbuilder', false, 'btn btn-small button-edit" style="margin: 0 0 5px 0;')) - && ComponentbuilderHelper::checkString($button)) + && StringHelper::check($button)) { $buttons[$field][$key[0]] = $button; } @@ -2563,7 +2586,7 @@ public function getEditCustomCodeButtons($id) } } // only continue if we have buttons in array - if (ComponentbuilderHelper::checkArray($buttons, true)) + if (UtilitiesArrayHelper::check($buttons, true)) { return $buttons; } @@ -2574,19 +2597,19 @@ public function getEditCustomCodeButtons($id) public function checkFunctionName($name, $id) { $nameArray = (array) $this->splitAtUpperCase($name); - $name = ComponentbuilderHelper::safeString(implode(' ', $nameArray), 'cA'); - if ($found = ComponentbuilderHelper::getVar('custom_code', $name, 'function_name', 'id')) + $name = StringHelper::safe(implode(' ', $nameArray), 'cA'); + if ($found = GetHelper::var('custom_code', $name, 'function_name', 'id')) { if ((int) $id !== (int) $found) { return array ( - 'message' => JText::_('COM_COMPONENTBUILDER_SORRY_THIS_FUNCTION_NAME_IS_ALREADY_IN_USE'), + 'message' => Text::_('COM_COMPONENTBUILDER_SORRY_THIS_FUNCTION_NAME_IS_ALREADY_IN_USE'), 'status' => 'danger'); } } return array ( 'name' => $name, - 'message' => JText::_('COM_COMPONENTBUILDER_GREAT_THIS_FUNCTION_NAME_WILL_WORK'), + 'message' => Text::_('COM_COMPONENTBUILDER_GREAT_THIS_FUNCTION_NAME_WILL_WORK'), 'status' => 'success'); } @@ -2600,7 +2623,7 @@ public function usedin($functioName, $id, $targeting) // get the table being targeted if ($target = $this->getCodeSearchKeys($targeting, 'query')) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName($target['select'])) ->from($db->quoteName('#__componentbuilder_' . $target['table'], 'a')); @@ -2633,7 +2656,7 @@ public function usedin($functioName, $id, $targeting) { if (!isset($target['not_base64'][$key])) { - $value = ComponentbuilderHelper::openValidBase64($value, null); + $value = Base64Helper::open($value, null); } elseif ('json' === $target['not_base64'][$key] && 'xml' === $key) // just for field search { @@ -2686,13 +2709,13 @@ public function usedin($functioName, $id, $targeting) } } // check if any values found - if (ComponentbuilderHelper::checkArray($bucket)) + if (UtilitiesArrayHelper::check($bucket)) { // get input - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return_here = $jinput->get('return_here', null, 'base64'); // set the return here value if not found - if (ComponentbuilderHelper::checkString($return_here)) + if (StringHelper::check($return_here)) { $return_here = '&return=' . $return_here; } @@ -2704,7 +2727,7 @@ public function usedin($functioName, $id, $targeting) foreach ($bucket as $editId => $values) { if (($button = ComponentbuilderHelper::getEditTextButton($values['name'], $editId, $target['table'], $target['views'], $return_here, 'com_componentbuilder', false, '')) - && ComponentbuilderHelper::checkString($button)) + && StringHelper::check($button)) { $usedin[] = $button. ' (' . implode(', ', $values['fields']) . ')'; } @@ -2734,9 +2757,9 @@ protected function searchOpenBase64(&$value, &$target) if (isset($target['_start'])) { // get all values - $allBetween = ComponentbuilderHelper::getAllBetween($value, $target['start'], $target['_start']); + $allBetween = GetHelper::allBetween($value, $target['start'], $target['_start']); // just again make sure we found some - if (ComponentbuilderHelper::checkArray($allBetween)) + if (UtilitiesArrayHelper::check($allBetween)) { if (count((array) $allBetween) > 1) { @@ -2767,14 +2790,14 @@ protected function searchOpenBase64(&$value, &$target) $starts[] = $target['start']; } // has any been found - if (ComponentbuilderHelper::checkArray($starts)) + if (UtilitiesArrayHelper::check($starts)) { foreach ($starts as $_start) { // get the base64 string - $base64 = ComponentbuilderHelper::getBetween($value, $_start, $target['end']); + $base64 = GetHelper::between($value, $_start, $target['end']); // now open the base64 text - $tmp = ComponentbuilderHelper::openValidBase64($base64); + $tmp = Base64Helper::open($base64); // insert it back into the value (so we still search the whole string) $value = str_replace($base64, $tmp, $value); } @@ -2791,7 +2814,7 @@ protected function searchOpenBase64(&$value, &$target) // #__componentbuilder_joomla_component (a) 'joomla_component' => array( 'search' => array('id', 'system_name', 'php_preflight_install', 'php_postflight_install', - 'php_preflight_update', 'php_postflight_update', 'php_method_uninstall', + 'php_preflight_update', 'php_postflight_update', 'php_method_uninstall', 'php_method_install', 'php_helper_admin', 'php_admin_event', 'php_helper_both', 'php_helper_site', 'php_site_event', 'javascript', 'readme', 'sql', 'sql_uninstall'), 'views' => 'joomla_components', @@ -3022,7 +3045,7 @@ public function placedin($placeholder, $id, $targeting) // get the table being targeted if ($target = $this->getCodeSearchKeys($targeting, 'query')) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName($target['select'])) ->from($db->quoteName('#__componentbuilder_' . $target['table'], 'a')); @@ -3055,7 +3078,7 @@ public function placedin($placeholder, $id, $targeting) { if (!isset($target['not_base64'][$key])) { - $value = ComponentbuilderHelper::openValidBase64($value, null); + $value = Base64Helper::open($value, null); } elseif ('json' === $target['not_base64'][$key] && 'xml' === $key) // just for field search { @@ -3108,13 +3131,13 @@ public function placedin($placeholder, $id, $targeting) } } // check if any values found - if (ComponentbuilderHelper::checkArray($bucket)) + if (UtilitiesArrayHelper::check($bucket)) { // get input - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return_here = $jinput->get('return_here', null, 'base64'); // set the return here value if not found - if (ComponentbuilderHelper::checkString($return_here)) + if (StringHelper::check($return_here)) { $return_here = '&return=' . $return_here; } @@ -3126,7 +3149,7 @@ public function placedin($placeholder, $id, $targeting) foreach ($bucket as $editId => $values) { if (($button = ComponentbuilderHelper::getEditTextButton($values['name'], $editId, $target['table'], $target['views'], $return_here, 'com_componentbuilder', false, '')) - && ComponentbuilderHelper::checkString($button)) + && StringHelper::check($button)) { $placedin[] = $button. ' (' . implode(', ', $values['fields']) . ')'; } @@ -3147,12 +3170,12 @@ public function getExistingValidationRuleCode($name) if ($names = ComponentbuilderHelper::getExistingValidationRuleNames()) { // check that this is a valid rule file - if (ComponentbuilderHelper::checkArray($names) && in_array($name, $names)) + if (UtilitiesArrayHelper::check($names) && in_array($name, $names)) { // get the full path to rule file $path = JPATH_LIBRARIES . '/src/Form/Rule/'.$name.'Rule.php'; // get all the code - if ($code = ComponentbuilderHelper::getFileContents($path)) + if ($code = FileHelper::getContent($path)) { // remove the class details and the ending } $codeArray = (array) explode("FormRule\n{\n", $code); @@ -3168,13 +3191,13 @@ public function getExistingValidationRuleCode($name) public function checkRuleName($name, $id) { - $name = ComponentbuilderHelper::safeString($name); - if ($found = ComponentbuilderHelper::getVar('validation_rule', $name, 'name', 'id')) + $name = StringHelper::safe($name); + if ($found = GetHelper::var('validation_rule', $name, 'name', 'id')) { if ((int) $id !== (int) $found) { return array ( - 'message' => JText::sprintf('COM_COMPONENTBUILDER_SORRY_THIS_VALIDATION_RULE_NAME_S_ALREADY_EXIST_IN_YOUR_SYSTEM', $name), + 'message' => Text::sprintf('COM_COMPONENTBUILDER_SORRY_THIS_VALIDATION_RULE_NAME_S_ALREADY_EXIST_IN_YOUR_SYSTEM', $name), 'status' => 'danger', 'timeout' => 6000); } @@ -3185,14 +3208,14 @@ public function checkRuleName($name, $id) if (in_array($name, $names)) { return array ( - 'message' => JText::sprintf('COM_COMPONENTBUILDER_SORRY_THIS_VALIDATION_RULE_NAME_S_ALREADY_EXIST_AS_PART_OF_THE_JOOMLA_CORE_NO_NEED_TO_CREATE_IT_IF_YOU_ARE_ADAPTING_IT_GIVE_IT_YOUR_OWN_UNIQUE_NAME', $name), + 'message' => Text::sprintf('COM_COMPONENTBUILDER_SORRY_THIS_VALIDATION_RULE_NAME_S_ALREADY_EXIST_AS_PART_OF_THE_JOOMLA_CORE_NO_NEED_TO_CREATE_IT_IF_YOU_ARE_ADAPTING_IT_GIVE_IT_YOUR_OWN_UNIQUE_NAME', $name), 'status' => 'danger', 'timeout' => 10000); } } return array ( 'name' => $name, - 'message' => JText::sprintf('COM_COMPONENTBUILDER_GREAT_THIS_VALIDATION_RULE_NAME_S_WILL_WORK', $name), + 'message' => Text::sprintf('COM_COMPONENTBUILDER_GREAT_THIS_VALIDATION_RULE_NAME_S_WILL_WORK', $name), 'status' => 'success', 'timeout' => 5000); } @@ -3204,13 +3227,13 @@ public function getValidationRulesTable($id) { // build table $table = '
    '; - $table .= ''; - $table .= ''; + $table .= ''; + $table .= ''; $table .= ''; foreach ($rules as $name => $decs) { // just load the values - $decs = (ComponentbuilderHelper::checkString($decs) && !is_numeric($decs)) ? $decs : ''; + $decs = (StringHelper::check($decs) && !is_numeric($decs)) ? $decs : ''; $table .= ''; } return $table.'
    '.JText::sprintf('COM_COMPONENTBUILDER_THE_AVAILABLE_VALIDATION_RULES_FOR_THE_VALIDATE_ATTRIBUTE_ARE').'
    '.JText::_('COM_COMPONENTBUILDER_VALIDATE').''.JText::_('COM_COMPONENTBUILDER_DESCRIPTION').'
    '.Text::sprintf('COM_COMPONENTBUILDER_THE_AVAILABLE_VALIDATION_RULES_FOR_THE_VALIDATE_ATTRIBUTE_ARE').'
    '.Text::_('COM_COMPONENTBUILDER_VALIDATE').''.Text::_('COM_COMPONENTBUILDER_DESCRIPTION').'
    '.$name.''. $decs. '
    '; @@ -3231,16 +3254,16 @@ public function getValidationRules() // convert names to keys $exitingNames = array_flip($exitingNames); // load the descriptions (taken from https://docs.joomla.org/Server-side_form_validation) - $exitingNames["boolean"] = JText::_("COM_COMPONENTBUILDER_ACCEPTS_ONLY_THE_VALUES_ZERO_ONE_TRUE_OR_FALSE_CASEINSENSITIVE"); - $exitingNames["color"] = JText::_("COM_COMPONENTBUILDER_ACCEPTS_ONLY_EMPTY_VALUES_CONVERTED_TO_ZERO_AND_STRINGS_IN_THE_FORM_RGB_OR_RRGGBB_WHERE_R_G_AND_B_ARE_HEX_VALUES"); - $exitingNames["email"] = JText::_("COM_COMPONENTBUILDER_ACCEPTS_AN_EMAIL_ADDRESS_SATISFIES_A_BASIC_SYNTAX_CHECK_IN_THE_PATTERN_OF_QUOTXYZZQUOT_WITH_NO_INVALID_CHARACTERS"); - $exitingNames["equals"] = JText::sprintf("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_THE_SAME_AS_THAT_HELD_IN_THE_FIELD_NAMED_QUOTFIELDQUOT_EGS", '
    <input
      type="text"
      name="email_check"
      validate="equals"
      field="email"
    />
    '); - $exitingNames["options"] = JText::_("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_ENTERED_BE_ONE_OF_THE_OPTIONS_IN_AN_ELEMENT_OF_TYPEQUOTLISTQUOT_THAT_IS_THAT_THE_ELEMENT_IS_A_SELECT_LIST"); - $exitingNames["tel"] = JText::_("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_A_TELEPHONE_NUMBER_COMPLYING_WITH_THE_STANDARDS_OF_NANPA_ITUT_TRECEONE_HUNDRED_AND_SIXTY_FOUR_OR_IETF_RFCFOUR_THOUSAND_NINE_HUNDRED_AND_THIRTY_THREE"); - $exitingNames["url"] = JText::sprintf("COM_COMPONENTBUILDER_VALIDATES_THAT_THE_VALUE_IS_A_URL_WITH_A_VALID_SCHEME_WHICH_CAN_BE_RESTRICTED_BY_THE_OPTIONAL_COMMASEPARATED_FIELD_SCHEME_AND_PASSES_A_BASIC_SYNTAX_CHECK_EGS", '
    <input
      type="text"
      name="link"
      validate="url"
      scheme="http,https,mailto"
    />
    '); - $exitingNames["username"] = JText::_("COM_COMPONENTBUILDER_VALIDATES_THAT_THE_VALUE_DOES_NOT_APPEAR_AS_A_USERNAME_ON_THE_SYSTEM_THAT_IS_THAT_IT_IS_A_VALID_NEW_USERNAME_DOES_NOT_SYNTAX_CHECK_IT_AS_A_VALID_NAME"); + $exitingNames["boolean"] = Text::_("COM_COMPONENTBUILDER_ACCEPTS_ONLY_THE_VALUES_ZERO_ONE_TRUE_OR_FALSE_CASEINSENSITIVE"); + $exitingNames["color"] = Text::_("COM_COMPONENTBUILDER_ACCEPTS_ONLY_EMPTY_VALUES_CONVERTED_TO_ZERO_AND_STRINGS_IN_THE_FORM_RGB_OR_RRGGBB_WHERE_R_G_AND_B_ARE_HEX_VALUES"); + $exitingNames["email"] = Text::_("COM_COMPONENTBUILDER_ACCEPTS_AN_EMAIL_ADDRESS_SATISFIES_A_BASIC_SYNTAX_CHECK_IN_THE_PATTERN_OF_QUOTXYZZQUOT_WITH_NO_INVALID_CHARACTERS"); + $exitingNames["equals"] = Text::sprintf("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_THE_SAME_AS_THAT_HELD_IN_THE_FIELD_NAMED_QUOTFIELDQUOT_EGS", '
    <input
      type="text"
      name="email_check"
      validate="equals"
      field="email"
    />
    '); + $exitingNames["options"] = Text::_("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_ENTERED_BE_ONE_OF_THE_OPTIONS_IN_AN_ELEMENT_OF_TYPEQUOTLISTQUOT_THAT_IS_THAT_THE_ELEMENT_IS_A_SELECT_LIST"); + $exitingNames["tel"] = Text::_("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_A_TELEPHONE_NUMBER_COMPLYING_WITH_THE_STANDARDS_OF_NANPA_ITUT_TRECEONE_HUNDRED_AND_SIXTY_FOUR_OR_IETF_RFCFOUR_THOUSAND_NINE_HUNDRED_AND_THIRTY_THREE"); + $exitingNames["url"] = Text::sprintf("COM_COMPONENTBUILDER_VALIDATES_THAT_THE_VALUE_IS_A_URL_WITH_A_VALID_SCHEME_WHICH_CAN_BE_RESTRICTED_BY_THE_OPTIONAL_COMMASEPARATED_FIELD_SCHEME_AND_PASSES_A_BASIC_SYNTAX_CHECK_EGS", '
    <input
      type="text"
      name="link"
      validate="url"
      scheme="http,https,mailto"
    />
    '); + $exitingNames["username"] = Text::_("COM_COMPONENTBUILDER_VALIDATES_THAT_THE_VALUE_DOES_NOT_APPEAR_AS_A_USERNAME_ON_THE_SYSTEM_THAT_IS_THAT_IT_IS_A_VALID_NEW_USERNAME_DOES_NOT_SYNTAX_CHECK_IT_AS_A_VALID_NAME"); // now get the custom created rules - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); $query->select($db->quoteName(array('a.name','a.short_description'))); @@ -3253,7 +3276,7 @@ public function getValidationRules() $names = $db->loadAssocList('name', 'short_description'); } // merge the arrays - $rules = ComponentbuilderHelper::mergeArrays(array($exitingNames, $names)); + $rules = UtilitiesArrayHelper::merge(array($exitingNames, $names)); // sort the array ksort($rules); // return the validation rules @@ -3290,7 +3313,7 @@ public function getFieldTypeProperties($fieldtype) $field['subform'] = '
    '. $properties->label . '
    ' . $properties->input . '
    '; $field['extra'] = '
    '. $extras->label . '
    ' . $extras->input . '
    '; // check if we have PHP values - if (ComponentbuilderHelper::checkArray($field['php'])) + if (UtilitiesArrayHelper::check($field['php'])) { $field['textarea'] = array(); foreach($field['php'] as $name => $values) @@ -3320,16 +3343,16 @@ protected function getFieldExtraValues($xml, $options) { if (!in_array($extra, $options)) { - $value = ComponentbuilderHelper::getValueFromXMLstring($xml, $extra, $confirmation); + $value = FieldHelper::getValue($xml, $extra, $confirmation); if ($confirmation !== $value) { - $values['extraproperties' . $nr] = array('name' => $extra, 'value' => $value, 'desc' => JText::_($desc)); + $values['extraproperties' . $nr] = array('name' => $extra, 'value' => $value, 'desc' => Text::_($desc)); $nr++; } } } // return only if extras founb - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { return $values; } @@ -3339,9 +3362,9 @@ protected function getFieldExtraValues($xml, $options) protected function buildFieldTextarea($name, $desc, $default, $rows) { // get the textarea - $textarea = JFormHelper::loadFieldType('textarea', true); + $textarea = \JFormHelper::loadFieldType('textarea', true); // start building the name field XML - $textareaXML = new SimpleXMLElement(''); + $textareaXML = new \SimpleXMLElement(''); // textarea attributes $textareaAttribute = array( 'type' => 'textarea', @@ -3365,9 +3388,9 @@ protected function buildFieldTextarea($name, $desc, $default, $rows) protected function buildFieldOptionsSubform($values, $nameListOptions = null, $name = 'properties', $label = 'COM_COMPONENTBUILDER_PROPERTIESBR_SMALLHERE_YOU_CAN_SET_THE_PROPERTIES_FOR_THIS_FIELDSMALL') { // get the subform - $subform = JFormHelper::loadFieldType('subform', true); + $subform = \JFormHelper::loadFieldType('subform', true); // start building the subform field XML - $subformXML = new SimpleXMLElement(''); + $subformXML = new \SimpleXMLElement(''); // subform attributes $subformAttribute = array( 'type' => 'subform', @@ -3376,7 +3399,7 @@ protected function buildFieldOptionsSubform($values, $nameListOptions = null, $n 'layout' => 'joomla.form.field.subform.repeatable-table', 'multiple' => 'true', 'icon' => 'list', - 'max' => (ComponentbuilderHelper::checkArray($nameListOptions)) ? (int) count($nameListOptions) : 4); + 'max' => (UtilitiesArrayHelper::check($nameListOptions)) ? (int) count($nameListOptions) : 4); // load the subform attributes ComponentbuilderHelper::xmlAddAttributes($subformXML, $subformAttribute); // now add the subform child form @@ -3390,18 +3413,18 @@ protected function buildFieldOptionsSubform($values, $nameListOptions = null, $n ComponentbuilderHelper::xmlAddAttributes($childForm, $childFormAttribute); // start building the name field XML - $nameXML = new SimpleXMLElement(''); + $nameXML = new \SimpleXMLElement(''); // subform attributes $nameAttribute = array( - 'type' => (ComponentbuilderHelper::checkArray($nameListOptions)) ? 'list' : 'text', + 'type' => (UtilitiesArrayHelper::check($nameListOptions)) ? 'list' : 'text', 'name' => 'name', 'label' => 'COM_COMPONENTBUILDER_PROPERTY', 'size' => '40', 'maxlength' => '150', - 'class' => (ComponentbuilderHelper::checkArray($nameListOptions)) ? 'list_class field_list_name_options' : 'text_area', + 'class' => (UtilitiesArrayHelper::check($nameListOptions)) ? 'list_class field_list_name_options' : 'text_area', 'filter' => 'STRING'); // add the hint only if not name list and description if name list is an array - if (ComponentbuilderHelper::checkArray($nameListOptions)) + if (UtilitiesArrayHelper::check($nameListOptions)) { $nameAttribute['description'] = 'COM_COMPONENTBUILDER_SELECTION'; $nameAttribute['multiple'] = 'false'; @@ -3414,7 +3437,7 @@ protected function buildFieldOptionsSubform($values, $nameListOptions = null, $n // load the subform attributes ComponentbuilderHelper::xmlAddAttributes($nameXML, $nameAttribute); // add name list if found - if (ComponentbuilderHelper::checkArray($nameListOptions)) + if (UtilitiesArrayHelper::check($nameListOptions)) { ComponentbuilderHelper::xmlAddOptions($nameXML, $nameListOptions); } @@ -3422,7 +3445,7 @@ protected function buildFieldOptionsSubform($values, $nameListOptions = null, $n ComponentbuilderHelper::xmlAppend($childForm, $nameXML); // start building the name field XML - $valueXML = new SimpleXMLElement(''); + $valueXML = new \SimpleXMLElement(''); // subform attributes $valueAttribute = array( 'type' => 'textarea', @@ -3439,7 +3462,7 @@ protected function buildFieldOptionsSubform($values, $nameListOptions = null, $n ComponentbuilderHelper::xmlAppend($childForm, $valueXML); // start building the desc field XML - $descXML = new SimpleXMLElement(''); + $descXML = new \SimpleXMLElement(''); // subform attributes $descAttribute = array( 'type' => 'textarea', @@ -3468,7 +3491,7 @@ public function getFieldPropertyDesc($_property, $fieldtype) if (is_numeric($fieldtype)) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -3490,17 +3513,17 @@ public function getFieldPropertyDesc($_property, $fieldtype) // value to check since there are false and null values even 0 in the values returned $confirmation = '8qvZHoyuFYQqpj0YQbc6F3o5DhBlmS-_-a8pmCZfOVSfANjkmV5LG8pCdAY2JNYu6cB'; // make sure we have an array - if (ComponentbuilderHelper::checkArray($properties)) + if (UtilitiesArrayHelper::check($properties)) { foreach ($properties as $property) { if(isset($property['name']) && $_property === $property['name']) { // check if we should load the value - $value = ComponentbuilderHelper::getValueFromXMLstring($xml, $property['name'], $confirmation); + $value = FieldHelper::getValue($xml, $property['name'], $confirmation); if ($confirmation === $value) { - $value = (isset($property['example']) && ComponentbuilderHelper::checkString($property['example'])) ? $property['example'] : ''; + $value = (isset($property['example']) && StringHelper::check($property['example'])) ? $property['example'] : ''; } // return the found values return array('value' => $value, 'desc' => $property['description']); @@ -3511,7 +3534,7 @@ public function getFieldPropertyDesc($_property, $fieldtype) } elseif (isset($this->extraFieldProperties[$_property])) { - return array('value' => '', 'desc' => JText::_($this->extraFieldProperties[$_property])); + return array('value' => '', 'desc' => Text::_($this->extraFieldProperties[$_property])); } return false; } @@ -3526,10 +3549,10 @@ protected function getFieldXML($fieldtype) if (!is_null($global['a_id']) && $global['a_id'] > 0 && isset($global['a_view']) && 'field' === $global['a_view']) { // first check field type - $_fieldType = ComponentbuilderHelper::getVar('field', $global['a_id'], 'id', 'fieldtype'); - $xmlDB = ComponentbuilderHelper::getVar('field', $global['a_id'], 'id', 'xml'); + $_fieldType = GetHelper::var('field', $global['a_id'], 'id', 'fieldtype'); + $xmlDB = GetHelper::var('field', $global['a_id'], 'id', 'xml'); // check if it is a string - if (ComponentbuilderHelper::checkString($xmlDB)) + if (StringHelper::check($xmlDB)) { $xml = json_decode($xmlDB); } @@ -3584,7 +3607,7 @@ public function getCodeGlueOptions($listfield, $joinfields, $type, $area) } // get field names $names = array_map( function ($id) { - return '[' . $id . ']=> ' . ComponentbuilderHelper::getVar('field', $id, 'id', 'name'); + return '[' . $id . ']=> ' . GetHelper::var('field', $id, 'id', 'name'); }, $fields); // MODEL if ($area == 1 || $area == 3) @@ -3604,22 +3627,242 @@ public function getCodeGlueOptions($listfield, $joinfields, $type, $area) return false; } + // Used in search + /** + * 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 + * @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 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)) + { + try + { + // 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; + + if (($items = SearchFactory::_('Agent')->table($tableName)) !== null) + { + return [ + 'success' => Text::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' => Text::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' => Text::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; + } + + /** + * Search and replace value in a table + * + * @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 + * + * @return array|null + * @since 3.2.0 + **/ + 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)) + { + 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; + + if (($number = SearchFactory::_('Agent')->replace()) !== 0) + { + return ['success' => Text::sprintf('COM_COMPONENTBUILDER_ALL_FOUND_INSTANCES_IN_S_WHERE_REPLACED', $tableName)]; + } + return ['not_found' => Text::sprintf('COM_COMPONENTBUILDER_NO_INSTANCES_WHERE_FOUND_IN_S', $tableName)]; + } + catch(Exception $error) + { + return ['error' => $error->getMessage()]; + } + } + return ['error' => Text::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; + } + + /** + * 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' => Text::_('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' => Text::_('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' => Text::sprintf( + '%s (%s:%s) was successfully updated!', + $tableName, $rowId, $fieldName)]; + } + return ['error' => Text::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; + } + + // Used in get_snippets public function getSnippets($libraries) { - if (ComponentbuilderHelper::checkJson($libraries)) + if (JsonHelper::check($libraries)) { $libraries = json_decode($libraries, true); } // check if we have an array - if (ComponentbuilderHelper::checkArray($libraries)) + if (UtilitiesArrayHelper::check($libraries)) { // insure we only have int values if ($libraries = $this->checkLibraries($libraries)) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); $query->select($db->quoteName( array('a.id') )); @@ -3643,16 +3886,16 @@ protected function checkLibraries($libraries) $bucket = array(); $libraries = array_map( function($id) use (&$bucket) { // now get bundled libraries - $type = ComponentbuilderHelper::getVar('library', (int) $id, 'id', 'type'); - if (2 == $type && $bundled = ComponentbuilderHelper::getVar('library', (int) $id, 'id', 'libraries')) + $type = GetHelper::var('library', (int) $id, 'id', 'type'); + if (2 == $type && $bundled = GetHelper::var('library', (int) $id, 'id', 'libraries')) { // make sure we have an array if it was json - if (ComponentbuilderHelper::checkJson($bundled)) + if (JsonHelper::check($bundled)) { $bundled = json_decode($bundled, true); } // load in the values if we have an array - if (ComponentbuilderHelper::checkArray($bundled)) + if (UtilitiesArrayHelper::check($bundled)) { foreach ($bundled as $lib) { @@ -3670,7 +3913,7 @@ protected function checkLibraries($libraries) } }, $libraries); // check if we have any bundled libraries - if (ComponentbuilderHelper::checkArray($bucket)) + if (UtilitiesArrayHelper::check($bucket)) { foreach ($bucket as $lib) { @@ -3678,11 +3921,11 @@ protected function checkLibraries($libraries) } } // check that we have libraries - if (ComponentbuilderHelper::checkArray($libraries)) + if (UtilitiesArrayHelper::check($libraries)) { $libraries = array_values(array_unique(array_filter($libraries, function($id){return is_int($id);}))); // check if we have any libraries remaining - if (ComponentbuilderHelper::checkArray($libraries)) + if (UtilitiesArrayHelper::check($libraries)) { return $libraries; } @@ -3692,7 +3935,7 @@ protected function checkLibraries($libraries) public function getSnippetDetails($id) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -3721,12 +3964,12 @@ public function getSnippetDetails($id) public function setSnippetGithub($path, $status) { // get user - $user = JFactory::getUser(); + $user = Factory::getUser(); $access = $user->authorise('snippet.access', 'com_componentbuilder'); if ($access) { // secure path - $path = ComponentbuilderHelper::safeString(str_replace('.json','',$path), 'filename', '', false).'.json'; + $path = StringHelper::safe(str_replace('.json','',$path), 'filename', '', false).'.json'; // base path $base_path = basename($path); // set url @@ -3737,23 +3980,23 @@ public function setSnippetGithub($path, $status) return $this->saveSnippet($snippet, $status, $user); } // see if we have any errors from github - if (ComponentbuilderHelper::checkArray(ComponentbuilderHelper::$githubRepoDataErrors)) + if (UtilitiesArrayHelper::check(ComponentbuilderHelper::$githubRepoDataErrors)) { - return array('message' => JText::sprintf('COM_COMPONENTBUILDER_ERROR_BR_S', implode('
    ', ComponentbuilderHelper::$githubRepoDataErrors)), 'status' => 'danger'); + return array('message' => Text::sprintf('COM_COMPONENTBUILDER_ERROR_BR_S', implode('
    ', ComponentbuilderHelper::$githubRepoDataErrors)), 'status' => 'danger'); } - return array('message' => JText::_('COM_COMPONENTBUILDER_ERROR_THE_PATH_HAS_A_MISMATCH_AND_COULD_THEREFORE_NOT_RETRIEVE_THE_SNIPPET_FROM_GITHUB'), 'status' => 'danger'); + return array('message' => Text::_('COM_COMPONENTBUILDER_ERROR_THE_PATH_HAS_A_MISMATCH_AND_COULD_THEREFORE_NOT_RETRIEVE_THE_SNIPPET_FROM_GITHUB'), 'status' => 'danger'); } - return array('message' => JText::_('COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_ACCESS_TO_THE_SNIPPETS'), 'status' => 'danger'); + return array('message' => Text::_('COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_ACCESS_TO_THE_SNIPPETS'), 'status' => 'danger'); } protected function saveSnippet($item, $status, $user) { // set some defaults - $todayDate = JFactory::getDate()->toSql(); + $todayDate = Factory::getDate()->toSql(); // get the type id - $item['type'] = ($id = ComponentbuilderHelper::getVar('snippet_type', $item['type'], 'name', 'id')) ? $id : $this->createNew($item['type'], 'snippet_type', $user, $todayDate); + $item['type'] = ($id = GetHelper::var('snippet_type', $item['type'], 'name', 'id')) ? $id : $this->createNew($item['type'], 'snippet_type', $user, $todayDate); // get the library id - $item['library'] = ($id = ComponentbuilderHelper::getVar('library', $item['library'], 'name', 'id')) ? $id : $this->createNew($item['library'], 'library', $user, $todayDate); + $item['library'] = ($id = GetHelper::var('library', $item['library'], 'name', 'id')) ? $id : $this->createNew($item['library'], 'library', $user, $todayDate); // remove type if zero if ($item['type'] == 0) { @@ -3771,7 +4014,7 @@ protected function saveSnippet($item, $status, $user) $canCreate = $user->authorise('snippet.create', 'com_componentbuilder'); if ('new' === $status && !$canCreate) { - return array('message' => JText::_('COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_PERMISSION_TO_CREATE_THE_SNIPPET'), 'status' => 'danger'); + return array('message' => Text::_('COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_PERMISSION_TO_CREATE_THE_SNIPPET'), 'status' => 'danger'); } } // get the snippet model @@ -3788,29 +4031,29 @@ protected function saveSnippet($item, $status, $user) // we have to force modified date since the model does not allow you if ($this->forchDateFix($item)) { - return array('message' => JText::_('COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED'), 'status' => 'success'); + return array('message' => Text::_('COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED'), 'status' => 'success'); } // return error - return array('message' => JText::_('COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED_BUT_THE_MODIFIED_DATE_COULD_NOT_BE_ADJUSTED_BR_BR_BTHIS_MEANS_THE_SNIPPETS_WILL_CONTINUE_TO_APPEAR_OUT_OF_DATEB'), 'status' => 'warning'); + return array('message' => Text::_('COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED_BUT_THE_MODIFIED_DATE_COULD_NOT_BE_ADJUSTED_BR_BR_BTHIS_MEANS_THE_SNIPPETS_WILL_CONTINUE_TO_APPEAR_OUT_OF_DATEB'), 'status' => 'warning'); } // return error - return array('message' => JText::_('COM_COMPONENTBUILDER_ERROR_THE_SNIPPET_IS_FAULTY_AND_COULD_NOT_BE_SAVED'), 'status' => 'danger'); + return array('message' => Text::_('COM_COMPONENTBUILDER_ERROR_THE_SNIPPET_IS_FAULTY_AND_COULD_NOT_BE_SAVED'), 'status' => 'danger'); } protected function forchDateFix($item) { - $object = new stdClass(); + $object = new \stdClass(); $object->id = (int) $item['id']; $object->created = $item['created']; $object->modified = $item['modified']; // force update - return JFactory::getDbo()->updateObject('#__componentbuilder_snippet', $object, 'id'); + return Factory::getDbo()->updateObject('#__componentbuilder_snippet', $object, 'id'); } protected function getSnippetId($item) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); diff --git a/admin/models/class_extendings.php b/admin/models/class_extendings.php index 9617cb404..d1da5e5cf 100644 --- a/admin/models/class_extendings.php +++ b/admin/models/class_extendings.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Class_extendings List Model */ class ComponentbuilderModelClass_extendings extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -52,7 +60,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -102,7 +110,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -117,12 +125,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -138,7 +146,7 @@ public function getItems() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -147,7 +155,7 @@ public function getItems() } } - + // return items return $items; } @@ -155,7 +163,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -170,25 +178,25 @@ public function selectionTranslation($value,$name) 'modules' => 'COM_COMPONENTBUILDER_CLASS_EXTENDS_MODULES' ); // Now check if value is found in this array - if (isset($extension_typeArray[$value]) && ComponentbuilderHelper::checkString($extension_typeArray[$value])) + if (isset($extension_typeArray[$value]) && StringHelper::check($extension_typeArray[$value])) { return $extension_typeArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -217,7 +225,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -258,22 +266,24 @@ protected function getListQuery() $query->where('a.extension_type = ' . (int) $_extension_type); } } - elseif (ComponentbuilderHelper::checkString($_extension_type)) + elseif (StringHelper::check($_extension_type)) { $query->where('a.extension_type = ' . $db->quote($db->escape($_extension_type))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -288,13 +298,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -310,19 +320,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -334,7 +343,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -355,7 +364,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/class_extends.php b/admin/models/class_extends.php index ac6640a53..d7b0ea4ac 100644 --- a/admin/models/class_extends.php +++ b/admin/models/class_extends.php @@ -12,10 +12,23 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\String\ClassfunctionHelper; /** * Componentbuilder Class_extends Admin Model @@ -63,16 +76,16 @@ class ComponentbuilderModelClass_extends extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'class_extends', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'class_extends', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -104,17 +117,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'class_extends__'.$id); ComponentbuilderHelper::set('class_extends__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -123,7 +135,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -182,17 +194,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'class_extends__'.$id); ComponentbuilderHelper::set('class_extends__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -213,7 +224,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -240,7 +251,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -253,7 +264,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -312,11 +323,11 @@ public function getForm($data = array(), $loadData = true, $options = array('con } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -333,13 +344,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/class_extends.js'; } - + /** * Method to test whether a record can be deleted. * @@ -358,7 +369,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('class_extends.delete', 'com_componentbuilder.class_extends.' . (int) $record->id); } @@ -376,8 +387,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -388,31 +399,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('class_extends.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('class_extends.edit', 'com_componentbuilder.class_extends.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('class_extends.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -420,19 +431,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -444,7 +455,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_class_extends')); @@ -459,7 +470,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -474,10 +485,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.class_extends.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.class_extends.data', []); if (empty($data)) { @@ -500,7 +511,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -516,7 +527,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -536,10 +547,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -565,30 +576,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('class_extends'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('class_extends'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -625,8 +636,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -652,7 +662,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('class_extends'); @@ -678,7 +688,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -691,7 +701,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('class_extends.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -707,19 +717,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -731,7 +741,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -795,7 +805,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('class_extends'); @@ -803,7 +813,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('class_extends.edit') && !$this->canDo->get('class_extends.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -820,7 +830,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('class_extends.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -836,13 +846,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -886,7 +896,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -898,21 +908,21 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // make sure the name is safe to be used as a class name - $data['name'] = ComponentbuilderHelper::safeClassFunctionName($data['name']); + $data['name'] = ClassfunctionHelper::safe($data['name']); // Set the head string to base64 string. if (isset($data['head'])) @@ -925,11 +935,11 @@ public function save($data) { $data['comment'] = base64_encode($data['comment']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -939,7 +949,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -947,14 +957,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -967,7 +977,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -993,7 +1002,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/class_method.php b/admin/models/class_method.php index b1b3fd152..dee338956 100644 --- a/admin/models/class_method.php +++ b/admin/models/class_method.php @@ -12,10 +12,24 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\String\ClassfunctionHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Class_method Admin Model @@ -66,16 +80,16 @@ class ComponentbuilderModelClass_method extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'class_method', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'class_method', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -107,17 +121,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'class_method__'.$id); ComponentbuilderHelper::set('class_method__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -126,7 +139,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -191,17 +204,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'class_method__'.$id); ComponentbuilderHelper::set('class_method__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -222,7 +234,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -249,7 +261,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -262,7 +274,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -321,11 +333,11 @@ public function getForm($data = array(), $loadData = true, $options = array('con } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -340,22 +352,22 @@ public function getForm($data = array(), $loadData = true, $options = array('con // Only load the GUID if new item (or empty) if (0 == $id || !($val = $form->getValue('guid'))) { - $form->setValue('guid', null, ComponentbuilderHelper::GUID()); + $form->setValue('guid', null, GuidHelper::get()); } - + return $form; } /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/class_method.js'; } - + /** * Method to test whether a record can be deleted. * @@ -374,7 +386,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('class_method.delete', 'com_componentbuilder.class_method.' . (int) $record->id); } @@ -392,8 +404,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -404,31 +416,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('class_method.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('class_method.edit', 'com_componentbuilder.class_method.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('class_method.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -436,19 +448,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -460,7 +472,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_class_method')); @@ -475,7 +487,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -490,10 +502,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.class_method.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.class_method.data', []); if (empty($data)) { @@ -521,7 +533,7 @@ protected function loadFormData() public function validate($form, $data, $group = null) { // check if the not_required field is set - if (isset($data['not_required']) && ComponentbuilderHelper::checkString($data['not_required'])) + if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required'])) { $requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = array_unique($requiredFields); @@ -529,7 +541,7 @@ public function validate($form, $data, $group = null) foreach ($requiredFields as $requiredField) { // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) + if (UtilitiesStringHelper::check($requiredField)) { // change to false $form->setFieldAttribute($requiredField, 'required', 'false'); @@ -552,7 +564,7 @@ protected function getUniqueFields() { return array('guid'); } - + /** * Method to delete one or more records. * @@ -568,7 +580,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -588,10 +600,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -617,30 +629,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('class_method'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('class_method'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -677,8 +689,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -704,7 +715,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('class_method'); @@ -730,7 +741,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -743,7 +754,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('class_method.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -759,19 +770,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -783,7 +794,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -847,7 +858,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('class_method'); @@ -855,7 +866,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('class_method.edit') && !$this->canDo->get('class_method.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -872,7 +883,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('class_method.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -888,13 +899,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -938,7 +949,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -950,35 +961,35 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // 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']); // Set the GUID if empty or not valid if (empty($data['guid']) && $data['id'] > 0) { // get the existing one - $data['guid'] = (string) ComponentbuilderHelper::getVar('class_method', $data['id'], 'id', 'guid'); + $data['guid'] = (string) GetHelper::var('class_method', $data['id'], 'id', 'guid'); } + // Set the GUID if empty or not valid - while (!ComponentbuilderHelper::validGUID($data['guid'], "class_method", $data['id'])) + while (!GuidHelper::valid($data['guid'], "class_method", $data['id'])) { // must always be set - $data['guid'] = (string) ComponentbuilderHelper::GUID(); - } - + $data['guid'] = (string) GuidHelper::get(); + } // Set the code string to base64 string. if (isset($data['code'])) @@ -997,11 +1008,11 @@ public function save($data) { $data['arguments'] = base64_encode($data['arguments']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1011,7 +1022,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1019,14 +1030,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1039,7 +1050,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1065,7 +1075,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/class_methods.php b/admin/models/class_methods.php index 038f7a16d..cc64029d7 100644 --- a/admin/models/class_methods.php +++ b/admin/models/class_methods.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Class_methods List Model */ class ComponentbuilderModelClass_methods extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -53,7 +61,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -110,7 +118,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -125,12 +133,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -148,7 +156,7 @@ public function getItems() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -159,7 +167,7 @@ public function getItems() } } - + // return items return $items; } @@ -167,7 +175,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -183,7 +191,7 @@ public function selectionTranslation($value,$name) 'private static' => 'COM_COMPONENTBUILDER_CLASS_METHOD_PRIVATE_STATIC' ); // Now check if value is found in this array - if (isset($visibilityArray[$value]) && ComponentbuilderHelper::checkString($visibilityArray[$value])) + if (isset($visibilityArray[$value]) && StringHelper::check($visibilityArray[$value])) { return $visibilityArray[$value]; } @@ -199,25 +207,25 @@ public function selectionTranslation($value,$name) 'modules' => 'COM_COMPONENTBUILDER_CLASS_METHOD_MODULES' ); // Now check if value is found in this array - if (isset($extension_typeArray[$value]) && ComponentbuilderHelper::checkString($extension_typeArray[$value])) + if (isset($extension_typeArray[$value]) && StringHelper::check($extension_typeArray[$value])) { return $extension_typeArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -250,7 +258,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -291,7 +299,7 @@ protected function getListQuery() $query->where('a.visibility = ' . (int) $_visibility); } } - elseif (ComponentbuilderHelper::checkString($_visibility)) + elseif (StringHelper::check($_visibility)) { $query->where('a.visibility = ' . $db->quote($db->escape($_visibility))); } @@ -308,16 +316,18 @@ protected function getListQuery() $query->where('a.extension_type = ' . (int) $_extension_type); } } - elseif (ComponentbuilderHelper::checkString($_extension_type)) + elseif (StringHelper::check($_extension_type)) { $query->where('a.extension_type = ' . $db->quote($db->escape($_extension_type))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -335,17 +345,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -389,7 +399,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -415,7 +425,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -433,16 +443,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_class_method"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -451,7 +461,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -466,13 +476,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -489,19 +499,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -513,7 +522,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -534,7 +543,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/class_properties.php b/admin/models/class_properties.php index ca8e4dbfe..3ec8140d2 100644 --- a/admin/models/class_properties.php +++ b/admin/models/class_properties.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Class_properties List Model */ class ComponentbuilderModelClass_properties extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -53,7 +61,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -110,7 +118,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -125,12 +133,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -146,7 +154,7 @@ public function getItems() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -157,7 +165,7 @@ public function getItems() } } - + // return items return $items; } @@ -165,7 +173,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -181,7 +189,7 @@ public function selectionTranslation($value,$name) 'private static' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_PRIVATE_STATIC' ); // Now check if value is found in this array - if (isset($visibilityArray[$value]) && ComponentbuilderHelper::checkString($visibilityArray[$value])) + if (isset($visibilityArray[$value]) && StringHelper::check($visibilityArray[$value])) { return $visibilityArray[$value]; } @@ -197,25 +205,25 @@ public function selectionTranslation($value,$name) 'modules' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_MODULES' ); // Now check if value is found in this array - if (isset($extension_typeArray[$value]) && ComponentbuilderHelper::checkString($extension_typeArray[$value])) + if (isset($extension_typeArray[$value]) && StringHelper::check($extension_typeArray[$value])) { return $extension_typeArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -248,7 +256,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -289,7 +297,7 @@ protected function getListQuery() $query->where('a.visibility = ' . (int) $_visibility); } } - elseif (ComponentbuilderHelper::checkString($_visibility)) + elseif (StringHelper::check($_visibility)) { $query->where('a.visibility = ' . $db->quote($db->escape($_visibility))); } @@ -306,16 +314,18 @@ protected function getListQuery() $query->where('a.extension_type = ' . (int) $_extension_type); } } - elseif (ComponentbuilderHelper::checkString($_extension_type)) + elseif (StringHelper::check($_extension_type)) { $query->where('a.extension_type = ' . $db->quote($db->escape($_extension_type))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -333,17 +343,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -387,7 +397,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -411,7 +421,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -429,16 +439,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_class_property"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -447,7 +457,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -462,13 +472,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -485,19 +495,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -509,7 +518,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -530,7 +539,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/class_property.php b/admin/models/class_property.php index 8d13330e9..c306dcb82 100644 --- a/admin/models/class_property.php +++ b/admin/models/class_property.php @@ -12,10 +12,24 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\String\ClassfunctionHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Class_property Admin Model @@ -63,16 +77,16 @@ class ComponentbuilderModelClass_property extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'class_property', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'class_property', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -104,17 +118,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'class_property__'.$id); ComponentbuilderHelper::set('class_property__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -123,7 +136,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -182,17 +195,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'class_property__'.$id); ComponentbuilderHelper::set('class_property__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -213,7 +225,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -240,7 +252,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -253,7 +265,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -312,11 +324,11 @@ public function getForm($data = array(), $loadData = true, $options = array('con } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -331,22 +343,22 @@ public function getForm($data = array(), $loadData = true, $options = array('con // Only load the GUID if new item (or empty) if (0 == $id || !($val = $form->getValue('guid'))) { - $form->setValue('guid', null, ComponentbuilderHelper::GUID()); + $form->setValue('guid', null, GuidHelper::get()); } - + return $form; } /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/class_property.js'; } - + /** * Method to test whether a record can be deleted. * @@ -365,7 +377,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('class_property.delete', 'com_componentbuilder.class_property.' . (int) $record->id); } @@ -383,8 +395,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -395,31 +407,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('class_property.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('class_property.edit', 'com_componentbuilder.class_property.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('class_property.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -427,19 +439,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -451,7 +463,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_class_property')); @@ -466,7 +478,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -481,10 +493,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.class_property.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.class_property.data', []); if (empty($data)) { @@ -512,7 +524,7 @@ protected function loadFormData() public function validate($form, $data, $group = null) { // check if the not_required field is set - if (isset($data['not_required']) && ComponentbuilderHelper::checkString($data['not_required'])) + if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required'])) { $requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = array_unique($requiredFields); @@ -520,7 +532,7 @@ public function validate($form, $data, $group = null) foreach ($requiredFields as $requiredField) { // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) + if (UtilitiesStringHelper::check($requiredField)) { // change to false $form->setFieldAttribute($requiredField, 'required', 'false'); @@ -543,7 +555,7 @@ protected function getUniqueFields() { return array('guid'); } - + /** * Method to delete one or more records. * @@ -559,7 +571,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -579,10 +591,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -608,30 +620,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('class_property'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('class_property'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -668,8 +680,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -695,7 +706,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('class_property'); @@ -721,7 +732,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -734,7 +745,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('class_property.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -750,19 +761,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -774,7 +785,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -838,7 +849,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('class_property'); @@ -846,7 +857,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('class_property.edit') && !$this->canDo->get('class_property.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -863,7 +874,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('class_property.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -879,13 +890,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -929,7 +940,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -941,35 +952,35 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // 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']); // Set the GUID if empty or not valid if (empty($data['guid']) && $data['id'] > 0) { // get the existing one - $data['guid'] = (string) ComponentbuilderHelper::getVar('class_property', $data['id'], 'id', 'guid'); + $data['guid'] = (string) GetHelper::var('class_property', $data['id'], 'id', 'guid'); } + // Set the GUID if empty or not valid - while (!ComponentbuilderHelper::validGUID($data['guid'], "class_property", $data['id'])) + while (!GuidHelper::valid($data['guid'], "class_property", $data['id'])) { // must always be set - $data['guid'] = (string) ComponentbuilderHelper::GUID(); - } - + $data['guid'] = (string) GuidHelper::get(); + } // Set the comment string to base64 string. if (isset($data['comment'])) @@ -982,11 +993,11 @@ public function save($data) { $data['default'] = base64_encode($data['default']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -996,7 +1007,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1004,14 +1015,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1024,7 +1035,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1050,7 +1060,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/compiler.php b/admin/models/compiler.php index d8b405e61..d6899ede9 100644 --- a/admin/models/compiler.php +++ b/admin/models/compiler.php @@ -12,8 +12,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Componentbuilder\Compiler\Helper\Compiler; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\JsonHelper; /** * Componentbuilder List Model for Compiler @@ -42,19 +49,19 @@ class ComponentbuilderModelCompiler extends ListModel protected function getListQuery() { // Get the current user for authorisation checks - $this->user = JFactory::getUser(); + $this->user = Factory::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->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; - $this->initSet = true; + $this->initSet = true; // Make sure all records load, since no pagination allowed. $this->setState('list.limit', 0); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -80,12 +87,12 @@ protected function getListQuery() */ public function getItems() { - $user = JFactory::getUser(); + $user = Factory::getUser(); // check if this user has permission to access items if (!$user->authorise('compiler.access', 'com_componentbuilder')) { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('Not authorised!'), 'error'); + $app = Factory::getApplication(); + $app->enqueueMessage(Text::_('Not authorised!'), 'error'); // redirect away if not a correct (TODO for now we go to default view) $app->redirect('index.php?option=com_componentbuilder'); return false; @@ -94,22 +101,22 @@ public function getItems() $items = parent::getItems(); // Get the global params - $globalParams = JComponentHelper::getParams('com_componentbuilder', true); + $globalParams = ComponentHelper::getParams('com_componentbuilder', true); // Insure all item fields are adapted where needed. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Load the JEvent Dispatcher - JPluginHelper::importPlugin('content'); - $this->_dispatcher = JFactory::getApplication(); + PluginHelper::importPlugin('content'); + $this->_dispatcher = Factory::getApplication(); foreach ($items as $nr => &$item) { // Always create a slug for sef URL's - $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + $item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : ''); // Check if item has params, or pass whole item. - $params = (isset($item->params) && ComponentbuilderHelper::checkJson($item->params)) ? json_decode($item->params) : $item; + $params = (isset($item->params) && JsonHelper::check($item->params)) ? json_decode($item->params) : $item; // Make sure the content prepare plugins fire on copyright - $_copyright = new stdClass(); + $_copyright = new \stdClass(); $_copyright->text =& $item->copyright; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (copyright) to context $this->_dispatcher->triggerEvent("onContentPrepare", array('com_componentbuilder.compiler.copyright', &$_copyright, &$params, 0)); @@ -130,7 +137,7 @@ public function getItems() */ public function getUikitComp() { - if (isset($this->uikitComp) && ComponentbuilderHelper::checkArray($this->uikitComp)) + if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp)) { return $this->uikitComp; } @@ -139,69 +146,6 @@ public function getUikitComp() 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('
    ', $errorMessage); - return false; - } - return true; - } - public function builder() { // run compiler @@ -258,7 +202,7 @@ public function install($p_file) // Set FTP credentials, if given. JClientHelper::setCredentialsFromRequest('ftp'); - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Load installer plugins for assistance if required: JPluginHelper::importPlugin('installer'); @@ -280,7 +224,7 @@ public function install($p_file) return false; } - $config = JFactory::getConfig(); + $config = Factory::getConfig(); $tmp_dest = $config->get('tmp_path'); // Unpack the downloaded package file. @@ -304,7 +248,7 @@ public function install($p_file) // Was the package unpacked? if (!$package || !$package['type']) { - $app->enqueueMessage(JText::_('COM_INSTALLER_UNABLE_TO_FIND_INSTALL_PACKAGE'), 'error'); + $app->enqueueMessage(Text::_('COM_INSTALLER_UNABLE_TO_FIND_INSTALL_PACKAGE'), 'error'); return false; } @@ -315,14 +259,14 @@ public function install($p_file) if (!$installer->install($package['dir'])) { // There was an error installing the package. - $msg = JText::sprintf('COM_INSTALLER_INSTALL_ERROR', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type']))); + $msg = Text::sprintf('COM_INSTALLER_INSTALL_ERROR', Text::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type']))); $result = false; $msgType = 'error'; } else { // Package installed successfully. - $msg = JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type']))); + $msg = Text::sprintf('COM_INSTALLER_INSTALL_SUCCESS', Text::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type']))); $result = true; $msgType = 'message'; } @@ -331,7 +275,7 @@ public function install($p_file) $dispatcher->trigger('onInstallerAfterInstaller', array($this, &$package, $installer, &$result, &$msg)); // Set some model state values. - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $app->enqueueMessage($msg, $msgType); $this->setState('name', $installer->get('name')); $this->setState('result', $result); @@ -342,7 +286,7 @@ public function install($p_file) // Cleanup the install files. if (!is_file($package['packagefile'])) { - $config = JFactory::getConfig(); + $config = Factory::getConfig(); $package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile']; } @@ -359,5 +303,91 @@ public function install($p_file) $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[] = Text::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 (UtilitiesArrayHelper::check($errorMessage)) + { + // flatten the error message array + $errorMessage = implode('
    ', $errorMessage); + + return false; + } + return true; + } + } diff --git a/admin/models/component_admin_views.php b/admin/models/component_admin_views.php index 08852550a..ab8ad8fa0 100644 --- a/admin/models/component_admin_views.php +++ b/admin/models/component_admin_views.php @@ -12,10 +12,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Component_admin_views Admin Model @@ -66,18 +77,18 @@ class ComponentbuilderModelComponent_admin_views extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'component_admin_views', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'component_admin_views', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -116,7 +127,7 @@ public function getItem($pk = null) } // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; // repeatable values to check $arrayChecker = array( @@ -161,7 +172,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -188,7 +199,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -201,7 +212,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -267,13 +278,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/component_admin_views.js'; } - + /** * Method to test whether a record can be deleted. * @@ -292,7 +303,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('component_admin_views.delete', 'com_componentbuilder.component_admin_views.' . (int) $record->id); } @@ -310,8 +321,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -322,31 +333,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_admin_views.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('component_admin_views.edit', 'com_componentbuilder.component_admin_views.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_admin_views.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -354,19 +365,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -378,7 +389,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_component_admin_views')); @@ -393,7 +404,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -408,10 +419,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.component_admin_views.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.component_admin_views.data', []); if (empty($data)) { @@ -434,7 +445,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -450,7 +461,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -470,10 +481,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -499,30 +510,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('component_admin_views'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('component_admin_views'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -559,8 +570,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -586,7 +596,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_admin_views'); @@ -612,7 +622,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -625,7 +635,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('component_admin_views.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -641,19 +651,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) + if (UtilitiesStringHelper::check($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) { $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -665,7 +675,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -729,7 +739,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_admin_views'); @@ -737,7 +747,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('component_admin_views.edit') && !$this->canDo->get('component_admin_views.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -754,7 +764,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('component_admin_views.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -770,13 +780,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -820,7 +830,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -832,15 +842,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -850,14 +860,14 @@ public function save($data) if (isset($data['clone_me']) && $data['clone_me'] > 0) { // get addadmin_views data from clone_me (component_admin_views) - $data['addadmin_views'] = ComponentbuilderHelper::getVar('component_admin_views', $data['clone_me'], 'joomla_component', 'addadmin_views'); + $data['addadmin_views'] = GetHelper::var('component_admin_views', $data['clone_me'], 'joomla_component', 'addadmin_views'); } // Set the addadmin_views items to data. if (isset($data['addadmin_views']) && is_array($data['addadmin_views'])) { - $addadmin_views = new JRegistry; + $addadmin_views = new Registry; $addadmin_views->loadArray($data['addadmin_views']); $data['addadmin_views'] = (string) $addadmin_views; } @@ -866,11 +876,11 @@ public function save($data) // Set the empty addadmin_views to data $data['addadmin_views'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -880,7 +890,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -888,14 +898,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -908,7 +918,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -934,7 +943,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/component_config.php b/admin/models/component_config.php index ad96fb621..a84beb0cc 100644 --- a/admin/models/component_config.php +++ b/admin/models/component_config.php @@ -12,10 +12,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Component_config Admin Model @@ -65,18 +76,18 @@ class ComponentbuilderModelComponent_config extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'component_config', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'component_config', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -115,7 +126,7 @@ public function getItem($pk = null) } // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; // repeatable values to check $arrayChecker = array( @@ -160,7 +171,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -187,7 +198,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -200,7 +211,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -263,13 +274,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/component_config.js'; } - + /** * Method to test whether a record can be deleted. * @@ -288,7 +299,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('component_config.delete', 'com_componentbuilder.component_config.' . (int) $record->id); } @@ -306,8 +317,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -318,31 +329,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_config.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('component_config.edit', 'com_componentbuilder.component_config.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_config.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -350,19 +361,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -374,7 +385,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_component_config')); @@ -389,7 +400,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -404,10 +415,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.component_config.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.component_config.data', []); if (empty($data)) { @@ -430,7 +441,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -446,7 +457,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -466,10 +477,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -495,30 +506,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('component_config'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('component_config'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -555,8 +566,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -582,7 +592,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_config'); @@ -608,7 +618,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -621,7 +631,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('component_config.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -637,19 +647,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) + if (UtilitiesStringHelper::check($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) { $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -661,7 +671,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -725,7 +735,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_config'); @@ -733,7 +743,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('component_config.edit') && !$this->canDo->get('component_config.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -750,7 +760,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('component_config.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -766,13 +776,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -816,7 +826,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -828,15 +838,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -846,14 +856,14 @@ public function save($data) if (isset($data['clone_me']) && $data['clone_me'] > 0) { // get addconfig data from clone_me (component_config) - $data['addconfig'] = ComponentbuilderHelper::getVar('component_config', $data['clone_me'], 'joomla_component', 'addconfig'); + $data['addconfig'] = GetHelper::var('component_config', $data['clone_me'], 'joomla_component', 'addconfig'); } // Set the addconfig items to data. if (isset($data['addconfig']) && is_array($data['addconfig'])) { - $addconfig = new JRegistry; + $addconfig = new Registry; $addconfig->loadArray($data['addconfig']); $data['addconfig'] = (string) $addconfig; } @@ -862,11 +872,11 @@ public function save($data) // Set the empty addconfig to data $data['addconfig'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -876,7 +886,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -884,14 +894,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -904,7 +914,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -930,7 +939,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/component_custom_admin_menus.php b/admin/models/component_custom_admin_menus.php index 9f76ddbec..c87efced5 100644 --- a/admin/models/component_custom_admin_menus.php +++ b/admin/models/component_custom_admin_menus.php @@ -12,10 +12,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Component_custom_admin_menus Admin Model @@ -65,18 +76,18 @@ class ComponentbuilderModelComponent_custom_admin_menus extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'component_custom_admin_menus', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'component_custom_admin_menus', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -115,7 +126,7 @@ public function getItem($pk = null) } // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; // repeatable values to check $arrayChecker = array( @@ -160,7 +171,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -187,7 +198,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -200,7 +211,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -266,13 +277,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/component_custom_admin_menus.js'; } - + /** * Method to test whether a record can be deleted. * @@ -291,7 +302,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('component_custom_admin_menus.delete', 'com_componentbuilder.component_custom_admin_menus.' . (int) $record->id); } @@ -309,8 +320,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -321,31 +332,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_custom_admin_menus.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('component_custom_admin_menus.edit', 'com_componentbuilder.component_custom_admin_menus.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_custom_admin_menus.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -353,19 +364,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -377,7 +388,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_component_custom_admin_menus')); @@ -392,7 +403,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -407,10 +418,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.component_custom_admin_menus.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.component_custom_admin_menus.data', []); if (empty($data)) { @@ -433,7 +444,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -449,7 +460,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -469,10 +480,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -498,30 +509,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('component_custom_admin_menus'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('component_custom_admin_menus'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -558,8 +569,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -585,7 +595,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_custom_admin_menus'); @@ -611,7 +621,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -624,7 +634,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('component_custom_admin_menus.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -640,19 +650,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) + if (UtilitiesStringHelper::check($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) { $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -664,7 +674,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -728,7 +738,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_custom_admin_menus'); @@ -736,7 +746,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('component_custom_admin_menus.edit') && !$this->canDo->get('component_custom_admin_menus.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -753,7 +763,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('component_custom_admin_menus.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -769,13 +779,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -819,7 +829,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -831,15 +841,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -849,14 +859,14 @@ public function save($data) if (isset($data['clone_me']) && $data['clone_me'] > 0) { // get addcustommenus data from clone_me (component_custom_admin_menus) - $data['addcustommenus'] = ComponentbuilderHelper::getVar('component_custom_admin_menus', $data['clone_me'], 'joomla_component', 'addcustommenus'); + $data['addcustommenus'] = GetHelper::var('component_custom_admin_menus', $data['clone_me'], 'joomla_component', 'addcustommenus'); } // Set the addcustommenus items to data. if (isset($data['addcustommenus']) && is_array($data['addcustommenus'])) { - $addcustommenus = new JRegistry; + $addcustommenus = new Registry; $addcustommenus->loadArray($data['addcustommenus']); $data['addcustommenus'] = (string) $addcustommenus; } @@ -865,11 +875,11 @@ public function save($data) // Set the empty addcustommenus to data $data['addcustommenus'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -879,7 +889,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -887,14 +897,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -907,7 +917,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -933,7 +942,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/component_custom_admin_views.php b/admin/models/component_custom_admin_views.php index 7b778cd9a..b27e76ef2 100644 --- a/admin/models/component_custom_admin_views.php +++ b/admin/models/component_custom_admin_views.php @@ -12,10 +12,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Component_custom_admin_views Admin Model @@ -66,18 +77,18 @@ class ComponentbuilderModelComponent_custom_admin_views extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'component_custom_admin_views', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'component_custom_admin_views', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -116,7 +127,7 @@ public function getItem($pk = null) } // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; // repeatable values to check $arrayChecker = array( @@ -161,7 +172,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -188,7 +199,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -201,7 +212,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -267,13 +278,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/component_custom_admin_views.js'; } - + /** * Method to test whether a record can be deleted. * @@ -292,7 +303,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('component_custom_admin_views.delete', 'com_componentbuilder.component_custom_admin_views.' . (int) $record->id); } @@ -310,8 +321,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -322,31 +333,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_custom_admin_views.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('component_custom_admin_views.edit', 'com_componentbuilder.component_custom_admin_views.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_custom_admin_views.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -354,19 +365,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -378,7 +389,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_component_custom_admin_views')); @@ -393,7 +404,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -408,10 +419,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.component_custom_admin_views.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.component_custom_admin_views.data', []); if (empty($data)) { @@ -434,7 +445,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -450,7 +461,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -470,10 +481,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -499,30 +510,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('component_custom_admin_views'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('component_custom_admin_views'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -559,8 +570,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -586,7 +596,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_custom_admin_views'); @@ -612,7 +622,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -625,7 +635,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('component_custom_admin_views.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -641,19 +651,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) + if (UtilitiesStringHelper::check($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) { $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -665,7 +675,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -729,7 +739,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_custom_admin_views'); @@ -737,7 +747,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('component_custom_admin_views.edit') && !$this->canDo->get('component_custom_admin_views.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -754,7 +764,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('component_custom_admin_views.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -770,13 +780,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -820,7 +830,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -832,15 +842,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -850,14 +860,14 @@ public function save($data) if (isset($data['clone_me']) && $data['clone_me'] > 0) { // get addcustom_admin_views data from clone_me (component_custom_admin_views) - $data['addcustom_admin_views'] = ComponentbuilderHelper::getVar('component_custom_admin_views', $data['clone_me'], 'joomla_component', 'addcustom_admin_views'); + $data['addcustom_admin_views'] = GetHelper::var('component_custom_admin_views', $data['clone_me'], 'joomla_component', 'addcustom_admin_views'); } // Set the addcustom_admin_views items to data. if (isset($data['addcustom_admin_views']) && is_array($data['addcustom_admin_views'])) { - $addcustom_admin_views = new JRegistry; + $addcustom_admin_views = new Registry; $addcustom_admin_views->loadArray($data['addcustom_admin_views']); $data['addcustom_admin_views'] = (string) $addcustom_admin_views; } @@ -866,11 +876,11 @@ public function save($data) // Set the empty addcustom_admin_views to data $data['addcustom_admin_views'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -880,7 +890,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -888,14 +898,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -908,7 +918,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -934,7 +943,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/component_dashboard.php b/admin/models/component_dashboard.php index 098711c7d..b31983261 100644 --- a/admin/models/component_dashboard.php +++ b/admin/models/component_dashboard.php @@ -12,10 +12,23 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Component_dashboard Admin Model @@ -67,16 +80,16 @@ class ComponentbuilderModelComponent_dashboard extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'component_dashboard', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'component_dashboard', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -108,17 +121,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'component_dashboard__'.$id); ComponentbuilderHelper::set('component_dashboard__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -127,7 +139,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -188,23 +200,22 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'component_dashboard__'.$id); ComponentbuilderHelper::set('component_dashboard__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } } // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; // repeatable values to check $arrayChecker = array( @@ -249,7 +260,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -276,7 +287,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -289,7 +300,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -355,13 +366,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/component_dashboard.js'; } - + /** * Method to test whether a record can be deleted. * @@ -380,7 +391,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('component_dashboard.delete', 'com_componentbuilder.component_dashboard.' . (int) $record->id); } @@ -398,8 +409,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -410,31 +421,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_dashboard.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('component_dashboard.edit', 'com_componentbuilder.component_dashboard.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_dashboard.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -442,19 +453,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -466,7 +477,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_component_dashboard')); @@ -481,7 +492,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -496,10 +507,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.component_dashboard.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.component_dashboard.data', []); if (empty($data)) { @@ -522,7 +533,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -538,7 +549,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -558,10 +569,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -587,30 +598,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('component_dashboard'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('component_dashboard'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -647,8 +658,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -674,7 +684,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_dashboard'); @@ -700,7 +710,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -713,7 +723,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('component_dashboard.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -729,19 +739,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) + if (UtilitiesStringHelper::check($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) { $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -753,7 +763,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -817,7 +827,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_dashboard'); @@ -825,7 +835,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('component_dashboard.edit') && !$this->canDo->get('component_dashboard.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -842,7 +852,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('component_dashboard.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -858,13 +868,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -908,7 +918,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -920,15 +930,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -941,7 +951,7 @@ public function save($data) $keys = array('php_dashboard_methods','dashboard_tab','params'); foreach ($keys as $key) { - $data[$key] = ComponentbuilderHelper::getVar('component_dashboard', $data['clone_me'], 'joomla_component', $key); + $data[$key] = GetHelper::var('component_dashboard', $data['clone_me'], 'joomla_component', $key); } } @@ -949,7 +959,7 @@ public function save($data) // Set the dashboard_tab items to data. if (isset($data['dashboard_tab']) && is_array($data['dashboard_tab'])) { - $dashboard_tab = new JRegistry; + $dashboard_tab = new Registry; $dashboard_tab->loadArray($data['dashboard_tab']); $data['dashboard_tab'] = (string) $dashboard_tab; } @@ -964,11 +974,11 @@ public function save($data) { $data['php_dashboard_methods'] = base64_encode($data['php_dashboard_methods']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -978,7 +988,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -986,14 +996,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1006,7 +1016,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1032,7 +1041,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/component_files_folders.php b/admin/models/component_files_folders.php index a1bff0d3e..b859f957c 100644 --- a/admin/models/component_files_folders.php +++ b/admin/models/component_files_folders.php @@ -12,10 +12,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Component_files_folders Admin Model @@ -77,18 +88,18 @@ class ComponentbuilderModelComponent_files_folders extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'component_files_folders', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'component_files_folders', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -151,7 +162,7 @@ public function getItem($pk = null) } // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; // repeatable values to check $arrayChecker = array( @@ -197,7 +208,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -224,7 +235,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -237,7 +248,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -300,13 +311,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/component_files_folders.js'; } - + /** * Method to test whether a record can be deleted. * @@ -325,7 +336,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('component_files_folders.delete', 'com_componentbuilder.component_files_folders.' . (int) $record->id); } @@ -343,8 +354,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -355,31 +366,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_files_folders.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('component_files_folders.edit', 'com_componentbuilder.component_files_folders.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_files_folders.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -387,19 +398,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -411,7 +422,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_component_files_folders')); @@ -426,7 +437,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -441,10 +452,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.component_files_folders.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.component_files_folders.data', []); if (empty($data)) { @@ -467,7 +478,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -483,7 +494,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -503,10 +514,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -532,30 +543,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('component_files_folders'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('component_files_folders'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -592,8 +603,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -619,7 +629,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_files_folders'); @@ -645,7 +655,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -658,7 +668,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('component_files_folders.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -674,19 +684,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) + if (UtilitiesStringHelper::check($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) { $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -698,7 +708,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -762,7 +772,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_files_folders'); @@ -770,7 +780,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('component_files_folders.edit') && !$this->canDo->get('component_files_folders.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -787,7 +797,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('component_files_folders.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -803,13 +813,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -853,7 +863,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -865,15 +875,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -886,7 +896,7 @@ public function save($data) $keys = array('addfiles','addfolders','addfilesfullpath','addfoldersfullpath'); foreach ($keys as $key) { - $data[$key] = ComponentbuilderHelper::getVar('component_files_folders', $data['clone_me'], 'joomla_component', $key); + $data[$key] = GetHelper::var('component_files_folders', $data['clone_me'], 'joomla_component', $key); } } @@ -894,7 +904,7 @@ public function save($data) // Set the addfoldersfullpath items to data. if (isset($data['addfoldersfullpath']) && is_array($data['addfoldersfullpath'])) { - $addfoldersfullpath = new JRegistry; + $addfoldersfullpath = new Registry; $addfoldersfullpath->loadArray($data['addfoldersfullpath']); $data['addfoldersfullpath'] = (string) $addfoldersfullpath; } @@ -907,7 +917,7 @@ public function save($data) // Set the addfilesfullpath items to data. if (isset($data['addfilesfullpath']) && is_array($data['addfilesfullpath'])) { - $addfilesfullpath = new JRegistry; + $addfilesfullpath = new Registry; $addfilesfullpath->loadArray($data['addfilesfullpath']); $data['addfilesfullpath'] = (string) $addfilesfullpath; } @@ -920,7 +930,7 @@ public function save($data) // Set the addfolders items to data. if (isset($data['addfolders']) && is_array($data['addfolders'])) { - $addfolders = new JRegistry; + $addfolders = new Registry; $addfolders->loadArray($data['addfolders']); $data['addfolders'] = (string) $addfolders; } @@ -933,7 +943,7 @@ public function save($data) // Set the addfiles items to data. if (isset($data['addfiles']) && is_array($data['addfiles'])) { - $addfiles = new JRegistry; + $addfiles = new Registry; $addfiles->loadArray($data['addfiles']); $data['addfiles'] = (string) $addfiles; } @@ -942,11 +952,11 @@ public function save($data) // Set the empty addfiles to data $data['addfiles'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -956,7 +966,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -964,14 +974,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -984,7 +994,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1010,7 +1019,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/component_modules.php b/admin/models/component_modules.php index 4319154ed..66ca6021b 100644 --- a/admin/models/component_modules.php +++ b/admin/models/component_modules.php @@ -12,10 +12,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Component_modules Admin Model @@ -66,18 +77,18 @@ class ComponentbuilderModelComponent_modules extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'component_modules', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'component_modules', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -130,7 +141,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -157,7 +168,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -170,7 +181,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -233,13 +244,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/component_modules.js'; } - + /** * Method to test whether a record can be deleted. * @@ -258,7 +269,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('component_modules.delete', 'com_componentbuilder.component_modules.' . (int) $record->id); } @@ -276,8 +287,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -288,31 +299,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_modules.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('component_modules.edit', 'com_componentbuilder.component_modules.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_modules.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -320,19 +331,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -344,7 +355,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_component_modules')); @@ -359,7 +370,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -374,10 +385,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.component_modules.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.component_modules.data', []); if (empty($data)) { @@ -400,7 +411,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -416,7 +427,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -436,10 +447,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -465,30 +476,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('component_modules'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('component_modules'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -525,8 +536,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -552,7 +562,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_modules'); @@ -578,7 +588,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -591,7 +601,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('component_modules.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -607,19 +617,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) + if (UtilitiesStringHelper::check($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) { $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -631,7 +641,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -695,7 +705,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_modules'); @@ -703,7 +713,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('component_modules.edit') && !$this->canDo->get('component_modules.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -720,7 +730,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('component_modules.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -736,13 +746,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -786,7 +796,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -798,15 +808,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -816,14 +826,14 @@ public function save($data) if (isset($data['clone_me']) && $data['clone_me'] > 0) { // get addjoomla_modules data from clone_me (component_modules) - $data['addjoomla_modules'] = ComponentbuilderHelper::getVar('component_modules', $data['clone_me'], 'joomla_component', 'addjoomla_modules'); + $data['addjoomla_modules'] = GetHelper::var('component_modules', $data['clone_me'], 'joomla_component', 'addjoomla_modules'); } // Set the addjoomla_modules items to data. if (isset($data['addjoomla_modules']) && is_array($data['addjoomla_modules'])) { - $addjoomla_modules = new JRegistry; + $addjoomla_modules = new Registry; $addjoomla_modules->loadArray($data['addjoomla_modules']); $data['addjoomla_modules'] = (string) $addjoomla_modules; } @@ -832,11 +842,11 @@ public function save($data) // Set the empty addjoomla_modules to data $data['addjoomla_modules'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -846,7 +856,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -854,14 +864,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -874,7 +884,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -900,7 +909,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/component_mysql_tweaks.php b/admin/models/component_mysql_tweaks.php index d09d6297e..b893371c6 100644 --- a/admin/models/component_mysql_tweaks.php +++ b/admin/models/component_mysql_tweaks.php @@ -12,10 +12,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Component_mysql_tweaks Admin Model @@ -65,18 +76,18 @@ class ComponentbuilderModelComponent_mysql_tweaks extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'component_mysql_tweaks', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'component_mysql_tweaks', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -115,7 +126,7 @@ public function getItem($pk = null) } // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; // repeatable values to check $arrayChecker = array( @@ -160,7 +171,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -187,7 +198,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -200,7 +211,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -263,13 +274,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/component_mysql_tweaks.js'; } - + /** * Method to test whether a record can be deleted. * @@ -288,7 +299,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('component_mysql_tweaks.delete', 'com_componentbuilder.component_mysql_tweaks.' . (int) $record->id); } @@ -306,8 +317,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -318,31 +329,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_mysql_tweaks.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('component_mysql_tweaks.edit', 'com_componentbuilder.component_mysql_tweaks.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_mysql_tweaks.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -350,19 +361,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -374,7 +385,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_component_mysql_tweaks')); @@ -389,7 +400,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -404,10 +415,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.component_mysql_tweaks.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.component_mysql_tweaks.data', []); if (empty($data)) { @@ -430,7 +441,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -446,7 +457,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -466,10 +477,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -495,30 +506,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('component_mysql_tweaks'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('component_mysql_tweaks'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -555,8 +566,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -582,7 +592,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_mysql_tweaks'); @@ -608,7 +618,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -621,7 +631,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('component_mysql_tweaks.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -637,19 +647,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) + if (UtilitiesStringHelper::check($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) { $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -661,7 +671,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -725,7 +735,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_mysql_tweaks'); @@ -733,7 +743,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('component_mysql_tweaks.edit') && !$this->canDo->get('component_mysql_tweaks.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -750,7 +760,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('component_mysql_tweaks.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -766,13 +776,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -816,7 +826,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -828,15 +838,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -846,14 +856,14 @@ public function save($data) if (isset($data['clone_me']) && $data['clone_me'] > 0) { // get sql_tweak data from clone_me (component_mysql_tweaks) - $data['sql_tweak'] = ComponentbuilderHelper::getVar('component_mysql_tweaks', $data['clone_me'], 'joomla_component', 'sql_tweak'); + $data['sql_tweak'] = GetHelper::var('component_mysql_tweaks', $data['clone_me'], 'joomla_component', 'sql_tweak'); } // Set the sql_tweak items to data. if (isset($data['sql_tweak']) && is_array($data['sql_tweak'])) { - $sql_tweak = new JRegistry; + $sql_tweak = new Registry; $sql_tweak->loadArray($data['sql_tweak']); $data['sql_tweak'] = (string) $sql_tweak; } @@ -862,11 +872,11 @@ public function save($data) // Set the empty sql_tweak to data $data['sql_tweak'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -876,7 +886,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -884,14 +894,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -904,7 +914,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -930,7 +939,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/component_placeholders.php b/admin/models/component_placeholders.php index a4782f3be..168fd4ac1 100644 --- a/admin/models/component_placeholders.php +++ b/admin/models/component_placeholders.php @@ -12,10 +12,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Component_placeholders Admin Model @@ -65,18 +76,18 @@ class ComponentbuilderModelComponent_placeholders extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'component_placeholders', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'component_placeholders', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -129,7 +140,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -156,7 +167,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -169,7 +180,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -232,13 +243,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/component_placeholders.js'; } - + /** * Method to test whether a record can be deleted. * @@ -257,7 +268,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('component_placeholders.delete', 'com_componentbuilder.component_placeholders.' . (int) $record->id); } @@ -275,8 +286,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -287,31 +298,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_placeholders.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('component_placeholders.edit', 'com_componentbuilder.component_placeholders.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_placeholders.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -319,19 +330,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -343,7 +354,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_component_placeholders')); @@ -358,7 +369,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -373,10 +384,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.component_placeholders.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.component_placeholders.data', []); if (empty($data)) { @@ -399,7 +410,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -415,7 +426,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -435,10 +446,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -464,30 +475,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('component_placeholders'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('component_placeholders'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -524,8 +535,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -551,7 +561,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_placeholders'); @@ -577,7 +587,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -590,7 +600,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('component_placeholders.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -606,19 +616,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) + if (UtilitiesStringHelper::check($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) { $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -630,7 +640,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -694,7 +704,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_placeholders'); @@ -702,7 +712,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('component_placeholders.edit') && !$this->canDo->get('component_placeholders.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -719,7 +729,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('component_placeholders.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -735,13 +745,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -785,7 +795,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -797,15 +807,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -815,14 +825,14 @@ public function save($data) if (isset($data['clone_me']) && $data['clone_me'] > 0) { // get addplaceholders data from clone_me (component_placeholders) - $data['addplaceholders'] = ComponentbuilderHelper::getVar('component_placeholders', $data['clone_me'], 'joomla_component', 'addplaceholders'); + $data['addplaceholders'] = GetHelper::var('component_placeholders', $data['clone_me'], 'joomla_component', 'addplaceholders'); } // Set the addplaceholders items to data. if (isset($data['addplaceholders']) && is_array($data['addplaceholders'])) { - $addplaceholders = new JRegistry; + $addplaceholders = new Registry; $addplaceholders->loadArray($data['addplaceholders']); $data['addplaceholders'] = (string) $addplaceholders; } @@ -831,11 +841,11 @@ public function save($data) // Set the empty addplaceholders to data $data['addplaceholders'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -845,7 +855,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -853,14 +863,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -873,7 +883,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -899,7 +908,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/component_plugins.php b/admin/models/component_plugins.php index 9bfb37af9..a89864817 100644 --- a/admin/models/component_plugins.php +++ b/admin/models/component_plugins.php @@ -12,10 +12,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Component_plugins Admin Model @@ -66,18 +77,18 @@ class ComponentbuilderModelComponent_plugins extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'component_plugins', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'component_plugins', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -130,7 +141,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -157,7 +168,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -170,7 +181,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -233,13 +244,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/component_plugins.js'; } - + /** * Method to test whether a record can be deleted. * @@ -258,7 +269,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('component_plugins.delete', 'com_componentbuilder.component_plugins.' . (int) $record->id); } @@ -276,8 +287,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -288,31 +299,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_plugins.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('component_plugins.edit', 'com_componentbuilder.component_plugins.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_plugins.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -320,19 +331,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -344,7 +355,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_component_plugins')); @@ -359,7 +370,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -374,10 +385,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.component_plugins.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.component_plugins.data', []); if (empty($data)) { @@ -400,7 +411,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -416,7 +427,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -436,10 +447,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -465,30 +476,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('component_plugins'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('component_plugins'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -525,8 +536,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -552,7 +562,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_plugins'); @@ -578,7 +588,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -591,7 +601,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('component_plugins.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -607,19 +617,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) + if (UtilitiesStringHelper::check($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) { $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -631,7 +641,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -695,7 +705,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_plugins'); @@ -703,7 +713,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('component_plugins.edit') && !$this->canDo->get('component_plugins.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -720,7 +730,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('component_plugins.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -736,13 +746,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -786,7 +796,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -798,15 +808,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -816,14 +826,14 @@ public function save($data) if (isset($data['clone_me']) && $data['clone_me'] > 0) { // get addjoomla_plugins data from clone_me (component_plugins) - $data['addjoomla_plugins'] = ComponentbuilderHelper::getVar('component_plugins', $data['clone_me'], 'joomla_component', 'addjoomla_plugins'); + $data['addjoomla_plugins'] = GetHelper::var('component_plugins', $data['clone_me'], 'joomla_component', 'addjoomla_plugins'); } // Set the addjoomla_plugins items to data. if (isset($data['addjoomla_plugins']) && is_array($data['addjoomla_plugins'])) { - $addjoomla_plugins = new JRegistry; + $addjoomla_plugins = new Registry; $addjoomla_plugins->loadArray($data['addjoomla_plugins']); $data['addjoomla_plugins'] = (string) $addjoomla_plugins; } @@ -832,11 +842,11 @@ public function save($data) // Set the empty addjoomla_plugins to data $data['addjoomla_plugins'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -846,7 +856,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -854,14 +864,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -874,7 +884,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -900,7 +909,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/component_router.php b/admin/models/component_router.php new file mode 100644 index 000000000..e4134d45e --- /dev/null +++ b/admin/models/component_router.php @@ -0,0 +1,1050 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; +use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; + +/** + * Componentbuilder Component_router Admin Model + */ +class ComponentbuilderModelComponent_router extends AdminModel +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'settings' => array( + 'fullwidth' => array( + 'router_settings_details_switch', + 'note_router_settings', + 'note_router_settings_advance', + 'mode_constructor_before_parent', + 'note_mode_constructor_before_parent_manual', + 'constructor_before_parent_code', + 'constructor_before_parent_manual', + 'mode_constructor_after_parent', + 'constructor_after_parent_code', + 'mode_methods', + 'methods_code' + ), + 'above' => array( + 'joomla_component' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_componentbuilder.component_router'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return Table A database object + * + * @since 1.6 + */ + public function getTable($type = 'component_router', $prefix = 'ComponentbuilderTable', $config = []) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); + // get instance of the table + return Table::getInstance($type, $prefix, $config); + } + + + /** + * get VDM internal session key + * + * @return string the session key + * + */ + public function getVDM() + { + if (!isset($this->vastDevMod)) + { + $_id = 0; // new item probably (since it was not set in the getItem method) + + if (empty($_id)) + { + $id = 0; + } + else + { + $id = $_id; + } + // set the id and view name to session + if ($vdm = ComponentbuilderHelper::get('component_router__'.$id)) + { + $this->vastDevMod = $vdm; + } + else + { + // set the vast development method key + $this->vastDevMod = UtilitiesStringHelper::random(50); + ComponentbuilderHelper::set($this->vastDevMod, 'component_router__'.$id); + ComponentbuilderHelper::set('component_router__'.$id, $this->vastDevMod); + // set a return value if found + $jinput = Factory::getApplication()->input; + $return = $jinput->get('return', null, 'base64'); + ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); + // set a GUID value if found + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) + { + ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); + } + } + } + return $this->vastDevMod; + } + + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->methods_code)) + { + // base64 Decode methods_code. + $item->methods_code = base64_decode($item->methods_code); + } + + if (!empty($item->constructor_after_parent_code)) + { + // base64 Decode constructor_after_parent_code. + $item->constructor_after_parent_code = base64_decode($item->constructor_after_parent_code); + } + + if (!empty($item->constructor_before_parent_code)) + { + // base64 Decode constructor_before_parent_code. + $item->constructor_before_parent_code = base64_decode($item->constructor_before_parent_code); + } + + if (!empty($item->constructor_before_parent_manual)) + { + // Convert the constructor_before_parent_manual field to an array. + $constructor_before_parent_manual = new Registry; + $constructor_before_parent_manual->loadString($item->constructor_before_parent_manual); + $item->constructor_before_parent_manual = $constructor_before_parent_manual->toArray(); + } + + + if (empty($item->id)) + { + $id = 0; + } + else + { + $id = $item->id; + } + // set the id and view name to session + if ($vdm = ComponentbuilderHelper::get('component_router__'.$id)) + { + $this->vastDevMod = $vdm; + } + else + { + // set the vast development method key + $this->vastDevMod = UtilitiesStringHelper::random(50); + ComponentbuilderHelper::set($this->vastDevMod, 'component_router__'.$id); + ComponentbuilderHelper::set('component_router__'.$id, $this->vastDevMod); + // set a return value if found + $jinput = Factory::getApplication()->input; + $return = $jinput->get('return', null, 'base64'); + ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); + // set a GUID value if found + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) + { + ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); + } + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_componentbuilder.component_router', 'component_router', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = Factory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = Factory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('component_router.edit.state', 'com_componentbuilder.component_router.' . (int) $id)) + || ($id == 0 && !$user->authorise('component_router.edit.state', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if ($id != 0 && (!$user->authorise('component_router.edit.created_by', 'com_componentbuilder.component_router.' . (int) $id)) + || ($id == 0 && !$user->authorise('component_router.edit.created_by', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if ($id != 0 && (!$user->authorise('component_router.edit.created', 'com_componentbuilder.component_router.' . (int) $id)) + || ($id == 0 && !$user->authorise('component_router.edit.created', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + + // update all editors to use this components global editor + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + // now get all the editor fields + $editors = $form->getXml()->xpath("//field[@type='editor']"); + // check if we found any + if (UtilitiesArrayHelper::check($editors)) + { + foreach ($editors as $editor) + { + // get the field names + $name = (string) $editor['name']; + // set the field editor value (with none as fallback) + $form->setFieldAttribute($name, 'editor', $global_editor . '|none'); + } + } + + + // update the constructor_before_parent_manual (sub form) layout + $form->setFieldAttribute('constructor_before_parent_manual', 'layout', ComponentbuilderHelper::getSubformLayout('component_router', 'constructor_before_parent_manual')); + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_componentbuilder/js/component_router.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = Factory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('component_router.delete', 'com_componentbuilder.component_router.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = Factory::getUser(); + $recordId = $record->id ?? 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('component_router.edit.state', 'com_componentbuilder.component_router.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absence of better information, revert to the component permissions. + return $user->authorise('component_router.edit.state', 'com_componentbuilder'); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = [], $key = 'id') + { + // Check specific edit permission then general edit permission. + $user = Factory::getUser(); + + return $user->authorise('component_router.edit', 'com_componentbuilder.component_router.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_router.edit', 'com_componentbuilder'); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param Table $table A Table object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = Factory::getDate(); + $user = Factory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__componentbuilder_component_router')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.component_router.data', []); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_componentbuilder.component_router', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('component_router'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new UCMType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('component_router'); + } + + if (!$this->canDo->get('component_router.create') && !$this->canDo->get('component_router.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('component_router.edit.state')) + { + $values['published'] = 0; + } + + $newIds = []; + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('component_router.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // Only for strings + if (UtilitiesStringHelper::check($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) + { + $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component); + } + + // insert all set values + if (UtilitiesArrayHelper::check($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (UtilitiesArrayHelper::check($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('component_router'); + } + + if (!$this->canDo->get('component_router.edit') && !$this->canDo->get('component_router.batch')) + { + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('component_router.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('component_router.edit', $contexts[$pk])) + { + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (UtilitiesArrayHelper::check($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new Registry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the constructor_before_parent_manual items to data. + if (isset($data['constructor_before_parent_manual']) && is_array($data['constructor_before_parent_manual'])) + { + $constructor_before_parent_manual = new Registry; + $constructor_before_parent_manual->loadArray($data['constructor_before_parent_manual']); + $data['constructor_before_parent_manual'] = (string) $constructor_before_parent_manual; + } + elseif (!isset($data['constructor_before_parent_manual'])) + { + // Set the empty constructor_before_parent_manual to data + $data['constructor_before_parent_manual'] = ''; + } + + // Set the methods_code string to base64 string. + if (isset($data['methods_code'])) + { + $data['methods_code'] = base64_encode($data['methods_code']); + } + + // Set the constructor_after_parent_code string to base64 string. + if (isset($data['constructor_after_parent_code'])) + { + $data['constructor_after_parent_code'] = base64_encode($data['constructor_after_parent_code']); + } + + // Set the constructor_before_parent_code string to base64 string. + if (isset($data['constructor_before_parent_code'])) + { + $data['constructor_before_parent_code'] = base64_encode($data['constructor_before_parent_code']); + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new Registry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (UtilitiesArrayHelper::check($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title + * + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($title) + { + + // Alter the title + $table = $this->getTable(); + + while ($table->load(['title' => $title])) + { + $title = StringHelper::increment($title); + } + + return $title; + } +} diff --git a/admin/models/component_site_views.php b/admin/models/component_site_views.php index c6d6b1667..f31cf6990 100644 --- a/admin/models/component_site_views.php +++ b/admin/models/component_site_views.php @@ -12,10 +12,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Component_site_views Admin Model @@ -66,18 +77,18 @@ class ComponentbuilderModelComponent_site_views extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'component_site_views', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'component_site_views', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -116,7 +127,7 @@ public function getItem($pk = null) } // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; // repeatable values to check $arrayChecker = array( @@ -161,7 +172,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -188,7 +199,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -201,7 +212,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -267,13 +278,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/component_site_views.js'; } - + /** * Method to test whether a record can be deleted. * @@ -292,7 +303,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('component_site_views.delete', 'com_componentbuilder.component_site_views.' . (int) $record->id); } @@ -310,8 +321,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -322,31 +333,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_site_views.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('component_site_views.edit', 'com_componentbuilder.component_site_views.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_site_views.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -354,19 +365,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -378,7 +389,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_component_site_views')); @@ -393,7 +404,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -408,10 +419,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.component_site_views.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.component_site_views.data', []); if (empty($data)) { @@ -434,7 +445,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -450,7 +461,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -470,10 +481,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -499,30 +510,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('component_site_views'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('component_site_views'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -559,8 +570,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -586,7 +596,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_site_views'); @@ -612,7 +622,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -625,7 +635,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('component_site_views.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -641,19 +651,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) + if (UtilitiesStringHelper::check($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) { $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -665,7 +675,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -729,7 +739,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_site_views'); @@ -737,7 +747,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('component_site_views.edit') && !$this->canDo->get('component_site_views.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -754,7 +764,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('component_site_views.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -770,13 +780,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -820,7 +830,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -832,15 +842,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -850,14 +860,14 @@ public function save($data) if (isset($data['clone_me']) && $data['clone_me'] > 0) { // get addsite_views data from clone_me (component_site_views) - $data['addsite_views'] = ComponentbuilderHelper::getVar('component_site_views', $data['clone_me'], 'joomla_component', 'addsite_views'); + $data['addsite_views'] = GetHelper::var('component_site_views', $data['clone_me'], 'joomla_component', 'addsite_views'); } // Set the addsite_views items to data. if (isset($data['addsite_views']) && is_array($data['addsite_views'])) { - $addsite_views = new JRegistry; + $addsite_views = new Registry; $addsite_views->loadArray($data['addsite_views']); $data['addsite_views'] = (string) $addsite_views; } @@ -866,11 +876,11 @@ public function save($data) // Set the empty addsite_views to data $data['addsite_views'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -880,7 +890,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -888,14 +898,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -908,7 +918,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -934,7 +943,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/component_updates.php b/admin/models/component_updates.php index 3529af608..5a0506612 100644 --- a/admin/models/component_updates.php +++ b/admin/models/component_updates.php @@ -12,10 +12,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Component_updates Admin Model @@ -65,18 +76,18 @@ class ComponentbuilderModelComponent_updates extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'component_updates', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'component_updates', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -115,7 +126,7 @@ public function getItem($pk = null) } // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; // repeatable values to check $arrayChecker = array( @@ -160,7 +171,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -187,7 +198,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -200,7 +211,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -266,13 +277,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/component_updates.js'; } - + /** * Method to test whether a record can be deleted. * @@ -291,7 +302,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('component_updates.delete', 'com_componentbuilder.component_updates.' . (int) $record->id); } @@ -309,8 +320,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -321,31 +332,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('component_updates.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('component_updates.edit', 'com_componentbuilder.component_updates.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('component_updates.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -353,19 +364,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -377,7 +388,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_component_updates')); @@ -392,7 +403,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -407,10 +418,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.component_updates.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.component_updates.data', []); if (empty($data)) { @@ -433,7 +444,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -449,7 +460,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -469,10 +480,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -498,30 +509,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('component_updates'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('component_updates'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -558,8 +569,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -585,7 +595,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_updates'); @@ -611,7 +621,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -624,7 +634,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('component_updates.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -640,19 +650,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) + if (UtilitiesStringHelper::check($this->table->joomla_component) && !is_numeric($this->table->joomla_component)) { $this->table->joomla_component = $this->generateUnique('joomla_component',$this->table->joomla_component); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -664,7 +674,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -728,7 +738,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('component_updates'); @@ -736,7 +746,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('component_updates.edit') && !$this->canDo->get('component_updates.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -753,7 +763,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('component_updates.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -769,13 +779,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -819,7 +829,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -831,15 +841,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -849,14 +859,14 @@ public function save($data) if (isset($data['clone_me']) && $data['clone_me'] > 0) { // get version_update data from clone_me (component_updates) - $data['version_update'] = ComponentbuilderHelper::getVar('component_updates', $data['clone_me'], 'joomla_component', 'version_update'); + $data['version_update'] = GetHelper::var('component_updates', $data['clone_me'], 'joomla_component', 'version_update'); } // Set the version_update items to data. if (isset($data['version_update']) && is_array($data['version_update'])) { - $version_update = new JRegistry; + $version_update = new Registry; $version_update->loadArray($data['version_update']); $data['version_update'] = (string) $version_update; } @@ -865,11 +875,11 @@ public function save($data) // Set the empty version_update to data $data['version_update'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -879,7 +889,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -887,14 +897,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -907,7 +917,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -933,7 +942,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/componentbuilder.php b/admin/models/componentbuilder.php index 32bfb2260..60f02288f 100644 --- a/admin/models/componentbuilder.php +++ b/admin/models/componentbuilder.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Session\Session; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; -use Joomla\Registry\Registry; -use VDM\Gitea\Gitea; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Componentbuilder List Model @@ -25,17 +32,20 @@ class ComponentbuilderModelComponentbuilder extends ListModel public function getIcons() { // load user for access menus - $user = JFactory::getUser(); + $user = Factory::getUser(); // reset icon array - $icons = array(); + $icons = []; // 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( + $viewAccess = [ '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', @@ -53,6 +63,10 @@ public function getIcons() 'joomla_plugin.access' => 'joomla_plugin.access', 'joomla_plugins.submenu' => 'joomla_plugin.submenu', 'joomla_plugins.dashboard_list' => 'joomla_plugin.dashboard_list', + 'joomla_power.create' => 'joomla_power.create', + 'joomla_powers.access' => 'joomla_power.access', + 'joomla_power.access' => 'joomla_power.access', + 'joomla_powers.submenu' => 'joomla_power.submenu', 'power.create' => 'power.create', 'powers.access' => 'power.access', 'power.access' => 'power.access', @@ -63,17 +77,14 @@ public function getIcons() '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', @@ -179,6 +190,9 @@ public function getIcons() 'component_custom_admin_menus.create' => 'component_custom_admin_menus.create', 'components_custom_admin_menus.access' => 'component_custom_admin_menus.access', 'component_custom_admin_menus.access' => 'component_custom_admin_menus.access', + 'component_router.create' => 'component_router.create', + 'components_routers.access' => 'component_router.access', + 'component_router.access' => 'component_router.access', 'component_config.create' => 'component_config.create', 'components_config.access' => 'component_config.access', 'component_config.access' => 'component_config.access', @@ -222,12 +236,13 @@ public function getIcons() 'joomla_plugin_updates.access' => 'joomla_plugin_updates.access', 'joomla_plugin_files_folders_urls.create' => 'joomla_plugin_files_folders_urls.create', 'joomla_plugins_files_folders_urls.access' => 'joomla_plugin_files_folders_urls.access', - 'joomla_plugin_files_folders_urls.access' => 'joomla_plugin_files_folders_urls.access'); + 'joomla_plugin_files_folders_urls.access' => 'joomla_plugin_files_folders_urls.access', + ]; // loop over the $views foreach($viewGroups as $group => $views) { $i = 0; - if (ComponentbuilderHelper::checkArray($views)) + if (UtilitiesArrayHelper::check($views)) { foreach($views as $view) { @@ -239,11 +254,11 @@ public function getIcons() if (count($dwd) == 3) { list($type, $name, $url) = $dwd; - $viewName = $name; - $alt = $name; - $url = $url; - $image = $name . '.' . $type; - $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . ComponentbuilderHelper::safeString($name,'U'); + $viewName = $name; + $alt = $name; + $url = $url; + $image = $name . '.' . $type; + $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . StringHelper::safe($name,'U'); } } // internal views @@ -265,11 +280,11 @@ public function getIcons() switch($action) { case 'add': - $url = 'index.php?option=com_componentbuilder&view=' . $name . '&layout=edit'; - $image = $name . '_' . $action. '.' . $type; - $alt = $name . ' ' . $action; - $name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U').'_ADD'; - $add = true; + $url = 'index.php?option=com_componentbuilder&view=' . $name . '&layout=edit'; + $image = $name . '_' . $action. '.' . $type; + $alt = $name . ' ' . $action; + $name = 'COM_COMPONENTBUILDER_DASHBOARD_'.StringHelper::safe($name,'U').'_ADD'; + $add = true; break; default: // check for new convention (more stable) @@ -282,34 +297,34 @@ public function getIcons() { $extension = 'com_componentbuilder.' . $name; } - $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; - $image = $name . '_' . $action . '.' . $type; - $alt = $viewName . ' ' . $action; - $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . ComponentbuilderHelper::safeString($name,'U') . '_' . ComponentbuilderHelper::safeString($action,'U'); + $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; + $image = $name . '_' . $action . '.' . $type; + $alt = $viewName . ' ' . $action; + $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . StringHelper::safe($name,'U') . '_' . StringHelper::safe($action,'U'); break; } } else { - $viewName = $name; - $alt = $name; - $url = 'index.php?option=com_componentbuilder&view=' . $name; - $image = $name . '.' . $type; - $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . ComponentbuilderHelper::safeString($name,'U'); - $hover = false; + $viewName = $name; + $alt = $name; + $url = 'index.php?option=com_componentbuilder&view=' . $name; + $image = $name . '.' . $type; + $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . StringHelper::safe($name,'U'); + $hover = false; } } else { - $viewName = $view; - $alt = $view; - $url = 'index.php?option=com_componentbuilder&view=' . $view; - $image = $view . '.png'; - $name = ucwords($view).'

    '; - $hover = false; + $viewName = $view; + $alt = $view; + $url = 'index.php?option=com_componentbuilder&view=' . $view; + $image = $view . '.png'; + $name = ucwords($view).'

    '; + $hover = false; } // first make sure the view access is set - if (ComponentbuilderHelper::checkArray($viewAccess)) + if (UtilitiesArrayHelper::check($viewAccess)) { // setup some defaults $dashboard_add = false; @@ -317,11 +332,11 @@ public function getIcons() $accessTo = ''; $accessAdd = ''; // access checking start - $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? ComponentbuilderHelper::checkString($viewAccess[$viewName.'.create']):false; - $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? ComponentbuilderHelper::checkString($viewAccess[$viewName.'.access']):false; + $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? StringHelper::check($viewAccess[$viewName.'.create']):false; + $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? StringHelper::check($viewAccess[$viewName.'.access']):false; // set main controllers - $accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? ComponentbuilderHelper::checkString($viewAccess[$viewName.'.dashboard_add']):false; - $accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? ComponentbuilderHelper::checkString($viewAccess[$viewName.'.dashboard_list']):false; + $accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? StringHelper::check($viewAccess[$viewName.'.dashboard_add']):false; + $accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? StringHelper::check($viewAccess[$viewName.'.dashboard_list']):false; // check for adding access if ($add && $accessCreate) { @@ -339,64 +354,64 @@ public function getIcons() // set main access controllers if ($accessDashboard_add) { - $dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_componentbuilder'); + $dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_componentbuilder'); } if ($accessDashboard_list) { $dashboard_list = $user->authorise($viewAccess[$viewName.'.dashboard_list'], 'com_componentbuilder'); } - if (ComponentbuilderHelper::checkString($accessAdd) && ComponentbuilderHelper::checkString($accessTo)) + if (StringHelper::check($accessAdd) && StringHelper::check($accessTo)) { // check access if($user->authorise($accessAdd, 'com_componentbuilder') && $user->authorise($accessTo, 'com_componentbuilder') && $dashboard_add) { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } - elseif (ComponentbuilderHelper::checkString($accessTo)) + elseif (StringHelper::check($accessTo)) { // check access if($user->authorise($accessTo, 'com_componentbuilder') && $dashboard_list) { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } - elseif (ComponentbuilderHelper::checkString($accessAdd)) + elseif (StringHelper::check($accessAdd)) { // check access if($user->authorise($accessAdd, 'com_componentbuilder') && $dashboard_add) { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } else { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } else { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } $i++; } @@ -413,18 +428,17 @@ public function getIcons() public function getWiki() { // the call URL - $call_url = JUri::base() . 'index.php?option=com_componentbuilder&task=ajax.getWiki&format=json&raw=true&' . JSession::getFormToken() . '=1&name=Home'; - $document = JFactory::getDocument(); + $call_url = Uri::base() . 'index.php?option=com_componentbuilder&task=ajax.getWiki&format=json&raw=true&' . Session::getFormToken() . '=1&name=Home'; + $document = Factory::getDocument(); $document->addScriptDeclaration(' function getWikiPage(){ - fetch("' . $call_url . '").then((response) => { if (response.ok) { return response.json(); } }).then((result) => { if (typeof result.page !== "undefined") { - document.getElementById("wiki-md").innerHTML = result.page; + document.getElementById("wiki-md").innerHTML = marked.parse(result.page); } else if (typeof result.error !== "undefined") { document.getElementById("wiki-md-error").innerHTML = result.error } @@ -432,34 +446,44 @@ function getWikiPage(){ } setTimeout(getWikiPage, 1000);'); - return '
    '.JText::_('COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING').'..
    '; + return '
    '.Text::_('COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING').'..
    '; } public function getNoticeboard() { // get the document to load the scripts - $document = JFactory::getDocument(); - $document->addScript(JURI::root() . "media/com_componentbuilder/js/marked.js"); + $document = Factory::getDocument(); + Html::_('script', "media/com_componentbuilder/js/marked.js", ['version' => 'auto']); $document->addScriptDeclaration(' - var token = "'.JSession::getFormToken().'"; + var token = "' . Session::getFormToken() . '"; var noticeboard = "https://vdm.bz/componentbuilder-noticeboard-md"; - jQuery(document).ready(function () { - jQuery.get(noticeboard) - .success(function(board) { + document.addEventListener("DOMContentLoaded", function() { + fetch(noticeboard) + .then(response => { + if (!response.ok) { + throw new Error("Network response was not ok"); + } + return response.text(); + }) + .then(board => { if (board.length > 5) { - jQuery("#noticeboard-md").html(marked.parse(board)); - getIS(1,board).done(function(result) { - if (result){ - jQuery("#cpanel_tabTabs a").each(function() { - if (this.href.indexOf("#vast_development_method") >= 0 || this.href.indexOf("#notice_board") >= 0) { - var textVDM = jQuery(this).text(); - jQuery(this).html("1 "+textVDM); - jQuery(this).attr("id","vdm-new-notice"); - jQuery("#vdm-new-notice").click(function() { - getIS(2,board).done(function(result) { - if (result) { - jQuery(".vdm-new-notice").fadeOut(500); + document.getElementById("noticeboard-md").innerHTML = marked.parse(board); + getIS(1, board) + .then(result => { + if (result) { + document.querySelectorAll("#cpanel_tabTabs a").forEach(link => { + if (link.href.includes("#vast_development_method") || link.href.includes("#notice_board")) { + var textVDM = link.textContent; + link.innerHTML = "1 " + textVDM; + link.id = "vdm-new-notice"; + document.getElementById("vdm-new-notice").addEventListener("click", () => { + getIS(2, board) + .then(result => { + if (result) { + document.querySelectorAll(".vdm-new-notice").forEach(element => { + element.style.opacity = 0; + }); } }); }); @@ -468,71 +492,91 @@ public function getNoticeboard() } }); } else { - jQuery("#noticeboard-md").html("'.JText::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER').'"); + document.getElementById("noticeboard-md").innerHTML = "'.Text::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATER').'."; } }) - .error(function(jqXHR, textStatus, errorThrown) { - jQuery("#noticeboard-md").html("'.JText::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER').'"); + .catch(error => { + console.error("There was an error!", error); + document.getElementById("noticeboard-md").innerHTML = "'.Text::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATER').'."; }); }); + // to check is READ/NEW - function getIS(type,notice){ - if(type == 1){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.isNew&format=json&raw=true"; - } else if (type == 2) { - var getUrl = "index.php?option=com_componentbuilder&task=ajax.isRead&format=json&raw=true"; - } - if(token.length > 0 && notice.length){ - var request = token+"=1¬ice="+notice; + function getIS(type, notice) { + let getUrl = ""; + if (type === 1) { + getUrl = "index.php?option=com_componentbuilder&task=ajax.isNew&format=json&raw=true"; + } else if (type === 2) { + getUrl = "index.php?option=com_componentbuilder&task=ajax.isRead&format=json&raw=true"; } - return jQuery.ajax({ - type: "POST", - url: getUrl, - dataType: "json", - data: request, - jsonp: false - }); + let request = new URLSearchParams(); + if (token.length > 0 && notice.length) { + request.append(token, "1"); + request.append("notice", notice); + } + return fetch(getUrl, { + method: "POST", + headers: { + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" + }, + body: request + }).then(response => response.json()); } -// nice little dot trick :) -jQuery(document).ready( function($) { - var x=0; - setInterval(function() { - var dots = ""; - x++; - for (var y=0; y < x%8; y++) { - dots+="."; - } - $(".loading-dots").text(dots); - } , 500); +document.addEventListener("DOMContentLoaded", function() { + document.querySelectorAll(".loading-dots").forEach(function(loading_dots) { + let x = 0; + let intervalId = setInterval(function() { + if (!loading_dots.classList.contains("loading-dots")) { + clearInterval(intervalId); + return; + } + let dots = ".".repeat(x % 8); + loading_dots.textContent = dots; + x++; + }, 500); + }); });'); - return '
    '; + return '
    '.JText::_('COM_COMPONENTBUILDER_THE_NOTICE_BOARD_IS_LOADING').'..
    '.Text::_('COM_COMPONENTBUILDER_THE_NOTICE_BOARD_IS_LOADING').'..
    '; } public function getReadme() { - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(' - var getreadme = "'. JURI::root() . 'administrator/components/com_componentbuilder/README.txt"; - jQuery(document).ready(function () { - jQuery.get(getreadme) - .success(function(readme) { - jQuery("#readme-md").html(marked.parse(readme)); + var getreadme = "'. Uri::root() . 'administrator/components/com_componentbuilder/README.txt"; + document.addEventListener("DOMContentLoaded", function () { + fetch(getreadme) + .then(response => { + if (!response.ok) { + throw new Error("Network response was not ok"); + } + return response.text(); + }) + .then(readme => { + document.getElementById("readme-md").innerHTML = marked.parse(readme); }) - .error(function(jqXHR, textStatus, errorThrown) { - jQuery("#readme-md").html("'.JText::_('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_LATTER').'"); + .catch(error => { + console.error("There has been a problem with your fetch operation:", error); + document.getElementById("readme-md").innerHTML = "'.Text::_('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_LATER').'."; }); });'); - return '
    '.JText::_('COM_COMPONENTBUILDER_THE_README_IS_LOADING').'..
    '; + return '
    '.Text::_('COM_COMPONENTBUILDER_THE_README_IS_LOADING').'..
    '; } + /** + * get Current Version Bay adding JavaScript to the Page + * + * @return void + * @since 2.3.0 + */ public function getVersion() { // the call URL - $call_url = JUri::base() . 'index.php?option=com_componentbuilder&task=ajax.getVersion&format=json&raw=true&' . JSession::getFormToken() . '=1&version=1'; - $document = JFactory::getDocument(); + $call_url = Uri::base() . 'index.php?option=com_componentbuilder&task=ajax.getVersion&format=json&raw=true&' . Session::getFormToken() . '=1&version=1'; + $document = Factory::getDocument(); $document->addScriptDeclaration(' function getComponentVersionStatus() { fetch("' . $call_url . '").then((response) => { diff --git a/admin/models/components_admin_views.php b/admin/models/components_admin_views.php index 3f49ed4da..1887bd7c7 100644 --- a/admin/models/components_admin_views.php +++ b/admin/models/components_admin_views.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Components_admin_views List Model */ class ComponentbuilderModelComponents_admin_views extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/components_config.php b/admin/models/components_config.php index f94a35b88..a676412be 100644 --- a/admin/models/components_config.php +++ b/admin/models/components_config.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Components_config List Model */ class ComponentbuilderModelComponents_config extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/components_custom_admin_menus.php b/admin/models/components_custom_admin_menus.php index fb1e3016f..59938b489 100644 --- a/admin/models/components_custom_admin_menus.php +++ b/admin/models/components_custom_admin_menus.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Components_custom_admin_menus List Model */ class ComponentbuilderModelComponents_custom_admin_menus extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/components_custom_admin_views.php b/admin/models/components_custom_admin_views.php index d54b80219..a1eba3710 100644 --- a/admin/models/components_custom_admin_views.php +++ b/admin/models/components_custom_admin_views.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Components_custom_admin_views List Model */ class ComponentbuilderModelComponents_custom_admin_views extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/components_dashboard.php b/admin/models/components_dashboard.php index dc2994017..bf075503a 100644 --- a/admin/models/components_dashboard.php +++ b/admin/models/components_dashboard.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Components_dashboard List Model */ class ComponentbuilderModelComponents_dashboard extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/components_files_folders.php b/admin/models/components_files_folders.php index 433b51633..91b93d723 100644 --- a/admin/models/components_files_folders.php +++ b/admin/models/components_files_folders.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Components_files_folders List Model */ class ComponentbuilderModelComponents_files_folders extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/components_modules.php b/admin/models/components_modules.php index a2bd21a6b..dfaec0acb 100644 --- a/admin/models/components_modules.php +++ b/admin/models/components_modules.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Components_modules List Model */ class ComponentbuilderModelComponents_modules extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/components_mysql_tweaks.php b/admin/models/components_mysql_tweaks.php index f5ab1a6ff..15da40372 100644 --- a/admin/models/components_mysql_tweaks.php +++ b/admin/models/components_mysql_tweaks.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Components_mysql_tweaks List Model */ class ComponentbuilderModelComponents_mysql_tweaks extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/components_placeholders.php b/admin/models/components_placeholders.php index 4c07ee34b..6bf80ed22 100644 --- a/admin/models/components_placeholders.php +++ b/admin/models/components_placeholders.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Components_placeholders List Model */ class ComponentbuilderModelComponents_placeholders extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/components_plugins.php b/admin/models/components_plugins.php index 64c7a2659..c31ff18d0 100644 --- a/admin/models/components_plugins.php +++ b/admin/models/components_plugins.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Components_plugins List Model */ class ComponentbuilderModelComponents_plugins extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/components_routers.php b/admin/models/components_routers.php new file mode 100644 index 000000000..d35831577 --- /dev/null +++ b/admin/models/components_routers.php @@ -0,0 +1,434 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; + +/** + * Components_routers List Model + */ +class ComponentbuilderModelComponents_routers extends ListModel +{ + public function __construct($config = []) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.mode_constructor_before_parent','mode_constructor_before_parent', + 'a.mode_constructor_after_parent','mode_constructor_after_parent', + 'a.mode_methods','mode_methods' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = Factory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $mode_constructor_before_parent = $this->getUserStateFromRequest($this->context . '.filter.mode_constructor_before_parent', 'filter_mode_constructor_before_parent'); + if ($formSubmited) + { + $mode_constructor_before_parent = $app->input->post->get('mode_constructor_before_parent'); + $this->setState('filter.mode_constructor_before_parent', $mode_constructor_before_parent); + } + + $mode_constructor_after_parent = $this->getUserStateFromRequest($this->context . '.filter.mode_constructor_after_parent', 'filter_mode_constructor_after_parent'); + if ($formSubmited) + { + $mode_constructor_after_parent = $app->input->post->get('mode_constructor_after_parent'); + $this->setState('filter.mode_constructor_after_parent', $mode_constructor_after_parent); + } + + $mode_methods = $this->getUserStateFromRequest($this->context . '.filter.mode_methods', 'filter_mode_methods'); + if ($formSubmited) + { + $mode_methods = $app->input->post->get('mode_methods'); + $this->setState('filter.mode_methods', $mode_methods); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // Check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // Set values to display correctly. + if (UtilitiesArrayHelper::check($items)) + { + // Get the user object if not set. + if (!isset($user) || !ObjectHelper::check($user)) + { + $user = Factory::getUser(); + } + foreach ($items as $nr => &$item) + { + // Remove items the user can't access. + $access = ($user->authorise('component_router.access', 'com_componentbuilder.component_router.' . (int) $item->id) && $user->authorise('component_router.access', 'com_componentbuilder')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } + + // set selection value to a translatable value + if (UtilitiesArrayHelper::check($items)) + { + foreach ($items as $nr => &$item) + { + // convert mode_constructor_before_parent + $item->mode_constructor_before_parent = $this->selectionTranslation($item->mode_constructor_before_parent, 'mode_constructor_before_parent'); + // convert mode_constructor_after_parent + $item->mode_constructor_after_parent = $this->selectionTranslation($item->mode_constructor_after_parent, 'mode_constructor_after_parent'); + // convert mode_methods + $item->mode_methods = $this->selectionTranslation($item->mode_methods, 'mode_methods'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return string The translatable string. + */ + public function selectionTranslation($value,$name) + { + // Array of mode_constructor_before_parent language strings + if ($name === 'mode_constructor_before_parent') + { + $mode_constructor_before_parentArray = array( + 1 => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_DEFAULT', + 2 => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_MANUAL', + 3 => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_CODE' + ); + // Now check if value is found in this array + if (isset($mode_constructor_before_parentArray[$value]) && StringHelper::check($mode_constructor_before_parentArray[$value])) + { + return $mode_constructor_before_parentArray[$value]; + } + } + // Array of mode_constructor_after_parent language strings + if ($name === 'mode_constructor_after_parent') + { + $mode_constructor_after_parentArray = array( + 1 => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_NONE', + 3 => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_CODE' + ); + // Now check if value is found in this array + if (isset($mode_constructor_after_parentArray[$value]) && StringHelper::check($mode_constructor_after_parentArray[$value])) + { + return $mode_constructor_after_parentArray[$value]; + } + } + // Array of mode_methods language strings + if ($name === 'mode_methods') + { + $mode_methodsArray = array( + 0 => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_NONE', + 1 => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_DEFAULT', + 3 => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_CODE' + ); + // Now check if value is found in this array + if (isset($mode_methodsArray[$value]) && StringHelper::check($mode_methodsArray[$value])) + { + return $mode_methodsArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = Factory::getUser(); + // Create a new query object. + $db = Factory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the componentbuilder_item table + $query->from($db->quoteName('#__componentbuilder_component_router', 'a')); + + // From the componentbuilder_joomla_component table. + $query->select($db->quoteName('g.system_name','joomla_component_system_name')); + $query->join('LEFT', $db->quoteName('#__componentbuilder_joomla_component', 'g') . ' ON (' . $db->quoteName('a.joomla_component') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (UtilitiesArrayHelper::check($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by Mode_constructor_before_parent. + $_mode_constructor_before_parent = $this->getState('filter.mode_constructor_before_parent'); + if (is_numeric($_mode_constructor_before_parent)) + { + if (is_float($_mode_constructor_before_parent)) + { + $query->where('a.mode_constructor_before_parent = ' . (float) $_mode_constructor_before_parent); + } + else + { + $query->where('a.mode_constructor_before_parent = ' . (int) $_mode_constructor_before_parent); + } + } + elseif (StringHelper::check($_mode_constructor_before_parent)) + { + $query->where('a.mode_constructor_before_parent = ' . $db->quote($db->escape($_mode_constructor_before_parent))); + } + // Filter by Mode_constructor_after_parent. + $_mode_constructor_after_parent = $this->getState('filter.mode_constructor_after_parent'); + if (is_numeric($_mode_constructor_after_parent)) + { + if (is_float($_mode_constructor_after_parent)) + { + $query->where('a.mode_constructor_after_parent = ' . (float) $_mode_constructor_after_parent); + } + else + { + $query->where('a.mode_constructor_after_parent = ' . (int) $_mode_constructor_after_parent); + } + } + elseif (StringHelper::check($_mode_constructor_after_parent)) + { + $query->where('a.mode_constructor_after_parent = ' . $db->quote($db->escape($_mode_constructor_after_parent))); + } + // Filter by Mode_methods. + $_mode_methods = $this->getState('filter.mode_methods'); + if (is_numeric($_mode_methods)) + { + if (is_float($_mode_methods)) + { + $query->where('a.mode_methods = ' . (float) $_mode_methods); + } + else + { + $query->where('a.mode_methods = ' . (int) $_mode_methods); + } + } + elseif (StringHelper::check($_mode_methods)) + { + $query->where('a.mode_methods = ' . $db->quote($db->escape($_mode_methods))); + } + + // Add the list ordering clause. + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); + if ($orderCol != '') + { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (UtilitiesArrayHelper::check($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || StringHelper::check($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.mode_constructor_before_parent'); + $id .= ':' . $this->getState('filter.mode_constructor_after_parent'); + $id .= ':' . $this->getState('filter.mode_methods'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return bool + * @since 3.2.0 + */ + protected function checkInNow(): bool + { + // Get set check in time + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); + + if ($time) + { + // Get a db connection. + $db = Factory::getDbo(); + // Reset query. + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__componentbuilder_component_router')); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date. + $date = Factory::getDate()->modify($time)->toSql(); + // Reset query. + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table. + $query->update($db->quoteName('#__componentbuilder_component_router'))->set($fields)->where($conditions); + + $db->setQuery($query); + + return $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/components_site_views.php b/admin/models/components_site_views.php index 6d5d23650..e56e2e7aa 100644 --- a/admin/models/components_site_views.php +++ b/admin/models/components_site_views.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Components_site_views List Model */ class ComponentbuilderModelComponents_site_views extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/components_updates.php b/admin/models/components_updates.php index 3d3d25ae4..9ee7bd24e 100644 --- a/admin/models/components_updates.php +++ b/admin/models/components_updates.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Components_updates List Model */ class ComponentbuilderModelComponents_updates extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/custom_admin_view.php b/admin/models/custom_admin_view.php index ea3ccfe75..d34f0a455 100644 --- a/admin/models/custom_admin_view.php +++ b/admin/models/custom_admin_view.php @@ -12,10 +12,23 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Custom_admin_view Admin Model @@ -125,16 +138,16 @@ class ComponentbuilderModelCustom_admin_view extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'custom_admin_view', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'custom_admin_view', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -166,17 +179,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'custom_admin_view__'.$id); ComponentbuilderHelper::set('custom_admin_view__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -185,7 +197,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -336,17 +348,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'custom_admin_view__'.$id); ComponentbuilderHelper::set('custom_admin_view__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -366,7 +377,7 @@ public function getItem($pk = null) } $item->custom_button = $bucket; // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; $objectUpdate->custom_button = json_encode($bucket); // be sure to update the table if we found repeatable fields that are still not converted @@ -388,7 +399,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -415,7 +426,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -428,7 +439,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -485,11 +496,11 @@ public function getForm($data = array(), $loadData = true, $options = array('con } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -504,22 +515,22 @@ public function getForm($data = array(), $loadData = true, $options = array('con // Only load the GUID if new item (or empty) if (0 == $id || !($val = $form->getValue('guid'))) { - $form->setValue('guid', null, ComponentbuilderHelper::GUID()); + $form->setValue('guid', null, GuidHelper::get()); } - + return $form; } /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/custom_admin_view.js'; } - + /** * Method to test whether a record can be deleted. * @@ -538,7 +549,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('core.delete', 'com_componentbuilder.custom_admin_view.' . (int) $record->id); } @@ -556,8 +567,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -568,31 +579,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return parent::canEditState($record); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('core.edit', 'com_componentbuilder.custom_admin_view.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('core.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -600,19 +611,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -624,7 +635,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_custom_admin_view')); @@ -639,7 +650,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -654,10 +665,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.custom_admin_view.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.custom_admin_view.data', []); if (empty($data)) { @@ -680,7 +691,7 @@ protected function getUniqueFields() { return array('guid'); } - + /** * Method to delete one or more records. * @@ -696,7 +707,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -716,10 +727,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -745,30 +756,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('custom_admin_view'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('custom_admin_view'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -805,8 +816,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -832,13 +842,13 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('custom_admin_view'); } - if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + if (!$this->canDo->get('core.create') && !$this->canDo->get('custom_admin_view.batch')) { return false; } @@ -858,7 +868,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -871,7 +881,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('core.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -887,19 +897,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -911,7 +921,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -975,15 +985,15 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('custom_admin_view'); } - if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + if (!$this->canDo->get('core.edit') && !$this->canDo->get('custom_admin_view.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1000,7 +1010,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('core.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1016,13 +1026,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -1066,7 +1076,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -1078,15 +1088,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -1094,49 +1104,49 @@ public function save($data) // always reset the snippets $data['snippet'] = 0; // 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']; } // if codename is empty create from name - if (empty($data['codename']) || !ComponentbuilderHelper::checkString($data['codename'])) + if (empty($data['codename']) || !UtilitiesStringHelper::check($data['codename'])) { - $data['codename'] = ComponentbuilderHelper::safeString($data['name']); + $data['codename'] = UtilitiesStringHelper::safe($data['name']); } else { // always make safe string - $data['codename'] = ComponentbuilderHelper::safeString($data['codename']); + $data['codename'] = UtilitiesStringHelper::safe($data['codename']); } // if context is empty create from codename - if (empty($data['context']) || !ComponentbuilderHelper::checkString($data['context'])) + if (empty($data['context']) || !UtilitiesStringHelper::check($data['context'])) { $data['context'] = $data['codename']; } else { // always make safe string - $data['context'] = ComponentbuilderHelper::safeString($data['context']); + $data['context'] = UtilitiesStringHelper::safe($data['context']); } // Set the GUID if empty or not valid if (empty($data['guid']) && $data['id'] > 0) { // get the existing one - $data['guid'] = (string) ComponentbuilderHelper::getVar('custom_admin_view', $data['id'], 'id', 'guid'); + $data['guid'] = (string) GetHelper::var('custom_admin_view', $data['id'], 'id', 'guid'); } + // Set the GUID if empty or not valid - while (!ComponentbuilderHelper::validGUID($data['guid'], "custom_admin_view", $data['id'])) + while (!GuidHelper::valid($data['guid'], "custom_admin_view", $data['id'])) { // must always be set - $data['guid'] = (string) ComponentbuilderHelper::GUID(); - } - + $data['guid'] = (string) GuidHelper::get(); + } // Set the custom_get items to data. if (isset($data['custom_get']) && is_array($data['custom_get'])) { - $custom_get = new JRegistry; + $custom_get = new Registry; $custom_get->loadArray($data['custom_get']); $data['custom_get'] = (string) $custom_get; } @@ -1149,7 +1159,7 @@ public function save($data) // Set the libraries items to data. if (isset($data['libraries']) && is_array($data['libraries'])) { - $libraries = new JRegistry; + $libraries = new Registry; $libraries->loadArray($data['libraries']); $data['libraries'] = (string) $libraries; } @@ -1162,7 +1172,7 @@ public function save($data) // Set the ajax_input items to data. if (isset($data['ajax_input']) && is_array($data['ajax_input'])) { - $ajax_input = new JRegistry; + $ajax_input = new Registry; $ajax_input->loadArray($data['ajax_input']); $data['ajax_input'] = (string) $ajax_input; } @@ -1175,7 +1185,7 @@ public function save($data) // Set the custom_button items to data. if (isset($data['custom_button']) && is_array($data['custom_button'])) { - $custom_button = new JRegistry; + $custom_button = new Registry; $custom_button->loadArray($data['custom_button']); $data['custom_button'] = (string) $custom_button; } @@ -1256,11 +1266,11 @@ public function save($data) { $data['php_model'] = base64_encode($data['php_model']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1270,7 +1280,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1278,14 +1288,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1298,7 +1308,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1324,7 +1333,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/custom_admin_views.php b/admin/models/custom_admin_views.php index 59ad7188a..1a773e067 100644 --- a/admin/models/custom_admin_views.php +++ b/admin/models/custom_admin_views.php @@ -12,18 +12,28 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\FormHelper as JCBFormHelper; +use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Custom_admin_views List Model */ class ComponentbuilderModelCustom_admin_views extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -65,19 +75,19 @@ public function getFilterForm($data = array(), $loadData = true) 'onchange' => 'this.form.submit();', ); $options = array( - '' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_FOUND') . ' -' + '' => '- ' . Text::_('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') . ' -' + '' => '- ' . Text::_('COM_COMPONENTBUILDER_SELECT_COMPONENT') . ' -' ); // make sure we do not lose the key values in normal merge $options = $options + $joomla_components; } - $form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter'); + $form->setField(JCBFormHelper::xml($attributes, $options),'filter'); $form->setValue( 'joomla_component', 'filter', @@ -101,7 +111,7 @@ public function getFilterForm($data = array(), $loadData = true) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -179,7 +189,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -194,12 +204,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -215,7 +225,7 @@ public function getItems() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -226,7 +236,7 @@ public function getItems() } } - + // return items return $items; } @@ -234,7 +244,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -246,7 +256,7 @@ public function selectionTranslation($value,$name) 0 => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO' ); // Now check if value is found in this array - if (isset($add_php_ajaxArray[$value]) && ComponentbuilderHelper::checkString($add_php_ajaxArray[$value])) + if (isset($add_php_ajaxArray[$value]) && StringHelper::check($add_php_ajaxArray[$value])) { return $add_php_ajaxArray[$value]; } @@ -259,25 +269,25 @@ public function selectionTranslation($value,$name) 0 => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO' ); // Now check if value is found in this array - if (isset($add_custom_buttonArray[$value]) && ComponentbuilderHelper::checkString($add_custom_buttonArray[$value])) + if (isset($add_custom_buttonArray[$value]) && StringHelper::check($add_custom_buttonArray[$value])) { return $add_custom_buttonArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -293,7 +303,7 @@ protected function getListQuery() $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) . ')'); } @@ -329,7 +339,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -370,11 +380,11 @@ protected function getListQuery() $query->where('a.main_get = ' . (int) $_main_get); } } - elseif (ComponentbuilderHelper::checkString($_main_get)) + elseif (StringHelper::check($_main_get)) { $query->where('a.main_get = ' . $db->quote($db->escape($_main_get))); } - elseif (ComponentbuilderHelper::checkArray($_main_get)) + elseif (UtilitiesArrayHelper::check($_main_get)) { // Secure the array for the query $_main_get = array_map( function ($val) use(&$db) { @@ -389,7 +399,7 @@ protected function getListQuery() return (int) $val; } } - elseif (ComponentbuilderHelper::checkString($val)) + elseif (StringHelper::check($val)) { return $db->quote($db->escape($val)); } @@ -410,7 +420,7 @@ protected function getListQuery() $query->where('a.add_php_ajax = ' . (int) $_add_php_ajax); } } - elseif (ComponentbuilderHelper::checkString($_add_php_ajax)) + elseif (StringHelper::check($_add_php_ajax)) { $query->where('a.add_php_ajax = ' . $db->quote($db->escape($_add_php_ajax))); } @@ -427,16 +437,18 @@ protected function getListQuery() $query->where('a.add_custom_button = ' . (int) $_add_custom_button); } } - elseif (ComponentbuilderHelper::checkString($_add_custom_button)) + elseif (StringHelper::check($_add_custom_button)) { $query->where('a.add_custom_button = ' . $db->quote($db->escape($_add_custom_button))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -454,17 +466,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -498,7 +510,7 @@ public function getExportData($pks, $user = null) $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) . ')'); } @@ -527,7 +539,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -571,7 +583,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -589,16 +601,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_custom_admin_view"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -607,7 +619,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -622,13 +634,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -637,13 +649,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.modified_by'); // Check if the value is an array $_main_get = $this->getState('filter.main_get'); - if (ComponentbuilderHelper::checkArray($_main_get)) + if (UtilitiesArrayHelper::check($_main_get)) { $id .= ':' . implode(':', $_main_get); } // Check if this is only an number or string elseif (is_numeric($_main_get) - || ComponentbuilderHelper::checkString($_main_get)) + || StringHelper::check($_main_get)) { $id .= ':' . $_main_get; } @@ -659,19 +671,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -683,7 +694,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -704,7 +715,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/custom_code.php b/admin/models/custom_code.php index a07ef2d23..52daa7d24 100644 --- a/admin/models/custom_code.php +++ b/admin/models/custom_code.php @@ -12,10 +12,23 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Custom_code Admin Model @@ -49,6 +62,7 @@ class ComponentbuilderModelCustom_code extends AdminModel 'above' => array( 'target', 'system_name', + 'joomla_version', 'function_name' ), 'under' => array( @@ -78,16 +92,16 @@ class ComponentbuilderModelCustom_code extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'custom_code', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'custom_code', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -119,17 +133,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'custom_code__'.$id); ComponentbuilderHelper::set('custom_code__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -138,7 +151,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -191,17 +204,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'custom_code__'.$id); ComponentbuilderHelper::set('custom_code__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -222,7 +234,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -249,7 +261,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -262,7 +274,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -321,11 +333,11 @@ public function getForm($data = array(), $loadData = true, $options = array('con } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -342,13 +354,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/custom_code.js'; } - + /** * Method to test whether a record can be deleted. * @@ -367,7 +379,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('custom_code.delete', 'com_componentbuilder.custom_code.' . (int) $record->id); } @@ -385,8 +397,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -397,31 +409,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('custom_code.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('custom_code.edit', 'com_componentbuilder.custom_code.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('custom_code.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -429,19 +441,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -453,7 +465,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_custom_code')); @@ -468,7 +480,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -483,10 +495,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.custom_code.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.custom_code.data', []); if (empty($data)) { @@ -514,7 +526,7 @@ protected function loadFormData() public function validate($form, $data, $group = null) { // check if the not_required field is set - if (isset($data['not_required']) && ComponentbuilderHelper::checkString($data['not_required'])) + if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required'])) { $requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = array_unique($requiredFields); @@ -522,7 +534,7 @@ public function validate($form, $data, $group = null) foreach ($requiredFields as $requiredField) { // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) + if (UtilitiesStringHelper::check($requiredField)) { // change to false $form->setFieldAttribute($requiredField, 'required', 'false'); @@ -545,7 +557,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -561,7 +573,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -581,10 +593,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -610,30 +622,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('custom_code'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('custom_code'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -670,8 +682,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -697,7 +708,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('custom_code'); @@ -723,7 +734,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -736,7 +747,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('custom_code.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -752,19 +763,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->component) && !is_numeric($this->table->component)) + if (UtilitiesStringHelper::check($this->table->component) && !is_numeric($this->table->component)) { $this->table->component = $this->generateUnique('component',$this->table->component); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -776,7 +787,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -840,7 +851,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('custom_code'); @@ -848,7 +859,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('custom_code.edit') && !$this->canDo->get('custom_code.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -865,7 +876,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('custom_code.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -881,13 +892,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -931,7 +942,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -943,22 +954,22 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // few checks with the new option of using custom code in custom code - if (isset($data['code']) && ($placeholders = ComponentbuilderHelper::getAllBetween($data['code'], '[CUSTOM' . 'CODE=', ']')) - && ComponentbuilderHelper::checkArray($placeholders)) + if (isset($data['code']) && ($placeholders = GetHelper::allBetween($data['code'], '[CUSTOM' . 'CODE=', ']')) + && UtilitiesArrayHelper::check($placeholders)) { // make sure custom code as Hash (automation) target does not have other custom code placeholders if (isset($data['target']) && 1 == $data['target']) @@ -968,9 +979,9 @@ public function save($data) $data['code'] = str_replace('[CUSTOM' . 'CODE=' . $placeholder . ']', '', $data['code']); } // set title - $title = (count($placeholders) == 1) ? JText::_('COM_COMPONENTBUILDER_PLACEHOLDER_REMOVED') : JText::_('COM_COMPONENTBUILDER_PLACEHOLDERS_REMOVED'); + $title = (count($placeholders) == 1) ? Text::_('COM_COMPONENTBUILDER_PLACEHOLDER_REMOVED') : Text::_('COM_COMPONENTBUILDER_PLACEHOLDERS_REMOVED'); // show message that we have had to remove the custom placeholders - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_HTHREESHTHREEPCUSTOM_CODE_CAN_ONLY_BE_USED_IN_OTHER_CUSTOM_CODE_IF_SET_AS_BJCB_MANUALB_YOU_CAN_NOT_ADD_THEM_TO_EMHASH_AUTOMATIONEM_CODE_AT_THIS_POINTP', $title), 'Warning'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_HTHREESHTHREEPCUSTOM_CODE_CAN_ONLY_BE_USED_IN_OTHER_CUSTOM_CODE_IF_SET_AS_BJCB_MANUALB_YOU_CAN_NOT_ADD_THEM_TO_EMHASH_AUTOMATIONEM_CODE_AT_THIS_POINTP', $title), 'Warning'); } // make sure that the same custom code is not added to itself else @@ -983,7 +994,7 @@ public function save($data) { $data['code'] = str_replace('[CUSTOM' . 'CODE=' . $placeholder . ']', '', $data['code']); // show message that we have had to remove the custom placeholders - JFactory::getApplication()->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTHREEPLACEHOLDER_REMOVEDHTHREEPBTHISB_CUSTOM_CODE_CAN_ONLY_BE_USED_IN_BOTHERB_CUSTOM_CODE_NOT_IN_IT_SELF_SINCE_THAT_WILL_CAUSE_A_INFINITE_LOOP_IN_THE_COMPILERP'), 'Warning'); + Factory::getApplication()->enqueueMessage(Text::_('COM_COMPONENTBUILDER_HTHREEPLACEHOLDER_REMOVEDHTHREEPBTHISB_CUSTOM_CODE_CAN_ONLY_BE_USED_IN_BOTHERB_CUSTOM_CODE_NOT_IN_IT_SELF_SINCE_THAT_WILL_CAUSE_A_INFINITE_LOOP_IN_THE_COMPILERP'), 'Warning'); // stop the loop :) break; } @@ -996,11 +1007,11 @@ public function save($data) { $data['code'] = base64_encode($data['code']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1010,7 +1021,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1018,14 +1029,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1038,7 +1049,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1064,7 +1074,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/custom_codes.php b/admin/models/custom_codes.php index 2723d1153..c8683782d 100644 --- a/admin/models/custom_codes.php +++ b/admin/models/custom_codes.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Custom_codes List Model */ class ComponentbuilderModelCustom_codes extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -35,7 +43,8 @@ public function __construct($config = array()) 'a.target','target', 'a.type','type', 'a.comment_type','comment_type', - 'a.path','path' + 'a.path','path', + 'a.joomla_version','joomla_version' ); } @@ -55,7 +64,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -123,10 +132,17 @@ protected function populateState($ordering = null, $direction = null) $this->setState('filter.path', $path); } + $joomla_version = $this->getUserStateFromRequest($this->context . '.filter.joomla_version', 'filter_joomla_version'); + if ($formSubmited) + { + $joomla_version = $app->input->post->get('joomla_version'); + $this->setState('filter.joomla_version', $joomla_version); + } + // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -141,12 +157,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -158,10 +174,12 @@ public function getItems() continue; } + // [1641]=> Target (code action) + $item->target_code = $item->target; } } - if (ComponentbuilderHelper::checkArray($items) && !isset($_export)) + if (UtilitiesArrayHelper::check($items) && !isset($_export)) { foreach ($items as $nr => &$item) { @@ -169,7 +187,7 @@ public function getItems() { $item->component_system_name = $item->system_name; $item->path = '[CUSTO'.'MCODE='.$item->id.']'; // so it is not detected - if (ComponentbuilderHelper::checkString($item->function_name)) + if (StringHelper::check($item->function_name)) { $item->path = '[CUSTO'.'MCODE='.$item->function_name.']'; // so it is not detected } @@ -179,7 +197,7 @@ public function getItems() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -192,7 +210,7 @@ public function getItems() } } - + // return items return $items; } @@ -200,7 +218,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -212,7 +230,7 @@ public function selectionTranslation($value,$name) 1 => 'COM_COMPONENTBUILDER_CUSTOM_CODE_HASH_AUTOMATION' ); // Now check if value is found in this array - if (isset($targetArray[$value]) && ComponentbuilderHelper::checkString($targetArray[$value])) + if (isset($targetArray[$value]) && StringHelper::check($targetArray[$value])) { return $targetArray[$value]; } @@ -225,7 +243,7 @@ public function selectionTranslation($value,$name) 2 => 'COM_COMPONENTBUILDER_CUSTOM_CODE_INSERTION' ); // Now check if value is found in this array - if (isset($typeArray[$value]) && ComponentbuilderHelper::checkString($typeArray[$value])) + if (isset($typeArray[$value]) && StringHelper::check($typeArray[$value])) { return $typeArray[$value]; } @@ -238,25 +256,25 @@ public function selectionTranslation($value,$name) 2 => 'COM_COMPONENTBUILDER_CUSTOM_CODE_HTML' ); // Now check if value is found in this array - if (isset($comment_typeArray[$value]) && ComponentbuilderHelper::checkString($comment_typeArray[$value])) + if (isset($comment_typeArray[$value]) && StringHelper::check($comment_typeArray[$value])) { return $comment_typeArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -289,7 +307,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -313,7 +331,7 @@ protected function getListQuery() else { $search = $db->quote('%' . $db->escape($search) . '%'); - $query->where('(a.component LIKE '.$search.' OR g.system_name LIKE '.$search.' OR a.path LIKE '.$search.' OR a.comment_type LIKE '.$search.' OR a.function_name LIKE '.$search.' OR a.system_name LIKE '.$search.')'); + $query->where('(a.component LIKE '.$search.' OR g.system_name LIKE '.$search.' OR a.path LIKE '.$search.' OR a.comment_type LIKE '.$search.' OR a.joomla_version LIKE '.$search.' OR a.function_name LIKE '.$search.' OR a.system_name LIKE '.$search.')'); } } @@ -330,7 +348,7 @@ protected function getListQuery() $query->where('a.component = ' . (int) $_component); } } - elseif (ComponentbuilderHelper::checkString($_component)) + elseif (StringHelper::check($_component)) { $query->where('a.component = ' . $db->quote($db->escape($_component))); } @@ -347,7 +365,7 @@ protected function getListQuery() $query->where('a.target = ' . (int) $_target); } } - elseif (ComponentbuilderHelper::checkString($_target)) + elseif (StringHelper::check($_target)) { $query->where('a.target = ' . $db->quote($db->escape($_target))); } @@ -364,7 +382,7 @@ protected function getListQuery() $query->where('a.type = ' . (int) $_type); } } - elseif (ComponentbuilderHelper::checkString($_type)) + elseif (StringHelper::check($_type)) { $query->where('a.type = ' . $db->quote($db->escape($_type))); } @@ -381,16 +399,18 @@ protected function getListQuery() $query->where('a.comment_type = ' . (int) $_comment_type); } } - elseif (ComponentbuilderHelper::checkString($_comment_type)) + elseif (StringHelper::check($_comment_type)) { $query->where('a.comment_type = ' . $db->quote($db->escape($_comment_type))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -408,17 +428,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -462,7 +482,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -474,6 +494,8 @@ public function getExportData($pks, $user = null) continue; } + // [1641]=> Target (code action) + $item->target_code = $item->target; // decode code $item->code = base64_decode($item->code); // unset the values we don't want exported. @@ -484,12 +506,12 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } - if (ComponentbuilderHelper::checkArray($items) && !isset($_export)) + if (UtilitiesArrayHelper::check($items) && !isset($_export)) { foreach ($items as $nr => &$item) { @@ -497,7 +519,7 @@ public function getExportData($pks, $user = null) { $item->component_system_name = $item->system_name; $item->path = '[CUSTO'.'MCODE='.$item->id.']'; // so it is not detected - if (ComponentbuilderHelper::checkString($item->function_name)) + if (StringHelper::check($item->function_name)) { $item->path = '[CUSTO'.'MCODE='.$item->function_name.']'; // so it is not detected } @@ -519,16 +541,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_custom_code"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -537,7 +559,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -552,13 +574,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -570,6 +592,7 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.type'); $id .= ':' . $this->getState('filter.comment_type'); $id .= ':' . $this->getState('filter.path'); + $id .= ':' . $this->getState('filter.joomla_version'); return parent::getStoreId($id); } @@ -577,19 +600,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -601,7 +623,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -622,7 +644,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/dynamic_get.php b/admin/models/dynamic_get.php index 7ddb2db1e..7a8df707a 100644 --- a/admin/models/dynamic_get.php +++ b/admin/models/dynamic_get.php @@ -12,10 +12,23 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Dynamic_get Admin Model @@ -54,6 +67,16 @@ class ComponentbuilderModelDynamic_get extends AdminModel 'not_required' ) ), + 'abacus' => array( + 'left' => array( + 'addcalculation' + ), + 'fullwidth' => array( + 'note_calculation_item', + 'note_calculation_items', + 'php_calculation' + ) + ), 'custom_script' => array( 'fullwidth' => array( 'add_php_before_getitem', @@ -67,19 +90,10 @@ class ComponentbuilderModelDynamic_get extends AdminModel 'add_php_after_getitems', 'php_after_getitems', 'add_php_router_parse', + 'php_router_parse_notice', 'php_router_parse' ) ), - 'abacus' => array( - 'left' => array( - 'addcalculation' - ), - 'fullwidth' => array( - 'note_calculation_item', - 'note_calculation_items', - 'php_calculation' - ) - ), 'joint' => array( 'fullwidth' => array( 'join_view_table', @@ -118,16 +132,16 @@ class ComponentbuilderModelDynamic_get extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'dynamic_get', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'dynamic_get', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -159,17 +173,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'dynamic_get__'.$id); ComponentbuilderHelper::set('dynamic_get__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -178,7 +191,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -208,22 +221,28 @@ public function getItem($pk = null) $item->metadata = $registry->toArray(); } + if (!empty($item->php_calculation)) + { + // base64 Decode php_calculation. + $item->php_calculation = base64_decode($item->php_calculation); + } + if (!empty($item->php_router_parse)) { // base64 Decode php_router_parse. $item->php_router_parse = base64_decode($item->php_router_parse); } - if (!empty($item->php_before_getitems)) + if (!empty($item->php_custom_get)) { - // base64 Decode php_before_getitems. - $item->php_before_getitems = base64_decode($item->php_before_getitems); + // base64 Decode php_custom_get. + $item->php_custom_get = base64_decode($item->php_custom_get); } - if (!empty($item->php_after_getitems)) + if (!empty($item->php_before_getitem)) { - // base64 Decode php_after_getitems. - $item->php_after_getitems = base64_decode($item->php_after_getitems); + // base64 Decode php_before_getitem. + $item->php_before_getitem = base64_decode($item->php_before_getitem); } if (!empty($item->php_after_getitem)) @@ -238,22 +257,16 @@ public function getItem($pk = null) $item->php_getlistquery = base64_decode($item->php_getlistquery); } - if (!empty($item->php_custom_get)) - { - // base64 Decode php_custom_get. - $item->php_custom_get = base64_decode($item->php_custom_get); - } - - if (!empty($item->php_calculation)) + if (!empty($item->php_before_getitems)) { - // base64 Decode php_calculation. - $item->php_calculation = base64_decode($item->php_calculation); + // base64 Decode php_before_getitems. + $item->php_before_getitems = base64_decode($item->php_before_getitems); } - if (!empty($item->php_before_getitem)) + if (!empty($item->php_after_getitems)) { - // base64 Decode php_before_getitem. - $item->php_before_getitem = base64_decode($item->php_before_getitem); + // base64 Decode php_after_getitems. + $item->php_after_getitems = base64_decode($item->php_after_getitems); } if (!empty($item->join_db_table)) @@ -335,24 +348,23 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'dynamic_get__'.$id); ComponentbuilderHelper::set('dynamic_get__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } } // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; // repeatable values to check $arrayChecker = array( @@ -402,7 +414,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -429,7 +441,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -442,7 +454,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -499,11 +511,11 @@ public function getForm($data = array(), $loadData = true, $options = array('con } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -518,9 +530,9 @@ public function getForm($data = array(), $loadData = true, $options = array('con // Only load the GUID if new item (or empty) if (0 == $id || !($val = $form->getValue('guid'))) { - $form->setValue('guid', null, ComponentbuilderHelper::GUID()); + $form->setValue('guid', null, GuidHelper::get()); } - + // update the join_view_table (sub form) layout $form->setFieldAttribute('join_view_table', 'layout', ComponentbuilderHelper::getSubformLayout('dynamic_get', 'join_view_table')); @@ -533,13 +545,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/dynamic_get.js'; } - + /** * Method to test whether a record can be deleted. * @@ -558,7 +570,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('dynamic_get.delete', 'com_componentbuilder.dynamic_get.' . (int) $record->id); } @@ -576,8 +588,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -588,31 +600,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('dynamic_get.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('dynamic_get.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -620,19 +632,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -644,7 +656,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_dynamic_get')); @@ -659,7 +671,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -674,10 +686,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.dynamic_get.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.dynamic_get.data', []); if (empty($data)) { @@ -705,7 +717,7 @@ protected function loadFormData() public function validate($form, $data, $group = null) { // check if the not_required field is set - if (isset($data['not_required']) && ComponentbuilderHelper::checkString($data['not_required'])) + if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required'])) { $requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = array_unique($requiredFields); @@ -713,7 +725,7 @@ public function validate($form, $data, $group = null) foreach ($requiredFields as $requiredField) { // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) + if (UtilitiesStringHelper::check($requiredField)) { // change to false $form->setFieldAttribute($requiredField, 'required', 'false'); @@ -736,7 +748,7 @@ protected function getUniqueFields() { return array('guid'); } - + /** * Method to delete one or more records. * @@ -752,7 +764,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -772,10 +784,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -801,30 +813,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('dynamic_get'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('dynamic_get'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -861,8 +873,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -888,7 +899,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('dynamic_get'); @@ -914,7 +925,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -927,7 +938,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('dynamic_get.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -943,19 +954,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -967,7 +978,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1031,7 +1042,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('dynamic_get'); @@ -1039,7 +1050,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('dynamic_get.edit') && !$this->canDo->get('dynamic_get.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1056,7 +1067,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('dynamic_get.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1072,13 +1083,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -1122,7 +1133,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -1134,15 +1145,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -1152,20 +1163,20 @@ public function save($data) if (empty($data['guid']) && $data['id'] > 0) { // get the existing one - $data['guid'] = (string) ComponentbuilderHelper::getVar('dynamic_get', $data['id'], 'id', 'guid'); + $data['guid'] = (string) GetHelper::var('dynamic_get', $data['id'], 'id', 'guid'); } + // Set the GUID if empty or not valid - while (!ComponentbuilderHelper::validGUID($data['guid'], "dynamic_get", $data['id'])) + while (!GuidHelper::valid($data['guid'], "dynamic_get", $data['id'])) { // must always be set - $data['guid'] = (string) ComponentbuilderHelper::GUID(); - } - + $data['guid'] = (string) GuidHelper::get(); + } // Set the join_db_table items to data. if (isset($data['join_db_table']) && is_array($data['join_db_table'])) { - $join_db_table = new JRegistry; + $join_db_table = new Registry; $join_db_table->loadArray($data['join_db_table']); $data['join_db_table'] = (string) $join_db_table; } @@ -1178,7 +1189,7 @@ public function save($data) // Set the filter items to data. if (isset($data['filter']) && is_array($data['filter'])) { - $filter = new JRegistry; + $filter = new Registry; $filter->loadArray($data['filter']); $data['filter'] = (string) $filter; } @@ -1191,7 +1202,7 @@ public function save($data) // Set the where items to data. if (isset($data['where']) && is_array($data['where'])) { - $where = new JRegistry; + $where = new Registry; $where->loadArray($data['where']); $data['where'] = (string) $where; } @@ -1204,7 +1215,7 @@ public function save($data) // Set the order items to data. if (isset($data['order']) && is_array($data['order'])) { - $order = new JRegistry; + $order = new Registry; $order->loadArray($data['order']); $data['order'] = (string) $order; } @@ -1217,7 +1228,7 @@ public function save($data) // Set the group items to data. if (isset($data['group']) && is_array($data['group'])) { - $group = new JRegistry; + $group = new Registry; $group->loadArray($data['group']); $data['group'] = (string) $group; } @@ -1230,7 +1241,7 @@ public function save($data) // Set the global items to data. if (isset($data['global']) && is_array($data['global'])) { - $global = new JRegistry; + $global = new Registry; $global->loadArray($data['global']); $data['global'] = (string) $global; } @@ -1243,7 +1254,7 @@ public function save($data) // Set the join_view_table items to data. if (isset($data['join_view_table']) && is_array($data['join_view_table'])) { - $join_view_table = new JRegistry; + $join_view_table = new Registry; $join_view_table->loadArray($data['join_view_table']); $data['join_view_table'] = (string) $join_view_table; } @@ -1259,22 +1270,28 @@ public function save($data) $data['plugin_events'] = (string) json_encode($data['plugin_events']); } + // Set the php_calculation string to base64 string. + if (isset($data['php_calculation'])) + { + $data['php_calculation'] = base64_encode($data['php_calculation']); + } + // Set the php_router_parse string to base64 string. if (isset($data['php_router_parse'])) { $data['php_router_parse'] = base64_encode($data['php_router_parse']); } - // Set the php_before_getitems string to base64 string. - if (isset($data['php_before_getitems'])) + // Set the php_custom_get string to base64 string. + if (isset($data['php_custom_get'])) { - $data['php_before_getitems'] = base64_encode($data['php_before_getitems']); + $data['php_custom_get'] = base64_encode($data['php_custom_get']); } - // Set the php_after_getitems string to base64 string. - if (isset($data['php_after_getitems'])) + // Set the php_before_getitem string to base64 string. + if (isset($data['php_before_getitem'])) { - $data['php_after_getitems'] = base64_encode($data['php_after_getitems']); + $data['php_before_getitem'] = base64_encode($data['php_before_getitem']); } // Set the php_after_getitem string to base64 string. @@ -1289,28 +1306,22 @@ public function save($data) $data['php_getlistquery'] = base64_encode($data['php_getlistquery']); } - // Set the php_custom_get string to base64 string. - if (isset($data['php_custom_get'])) + // Set the php_before_getitems string to base64 string. + if (isset($data['php_before_getitems'])) { - $data['php_custom_get'] = base64_encode($data['php_custom_get']); + $data['php_before_getitems'] = base64_encode($data['php_before_getitems']); } - // Set the php_calculation string to base64 string. - if (isset($data['php_calculation'])) + // Set the php_after_getitems string to base64 string. + if (isset($data['php_after_getitems'])) { - $data['php_calculation'] = base64_encode($data['php_calculation']); + $data['php_after_getitems'] = base64_encode($data['php_after_getitems']); } - // Set the php_before_getitem string to base64 string. - if (isset($data['php_before_getitem'])) - { - $data['php_before_getitem'] = base64_encode($data['php_before_getitem']); - } - // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1320,7 +1331,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1328,14 +1339,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1348,7 +1359,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1374,7 +1384,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/dynamic_gets.php b/admin/models/dynamic_gets.php index e7b775be8..8402b4bee 100644 --- a/admin/models/dynamic_gets.php +++ b/admin/models/dynamic_gets.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Dynamic_gets List Model */ class ComponentbuilderModelDynamic_gets extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -53,7 +61,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -110,7 +118,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -125,12 +133,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -146,7 +154,7 @@ public function getItems() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -157,7 +165,7 @@ public function getItems() } } - + // return items return $items; } @@ -165,7 +173,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -179,7 +187,7 @@ public function selectionTranslation($value,$name) 3 => 'COM_COMPONENTBUILDER_DYNAMIC_GET_CUSTOM' ); // Now check if value is found in this array - if (isset($main_sourceArray[$value]) && ComponentbuilderHelper::checkString($main_sourceArray[$value])) + if (isset($main_sourceArray[$value]) && StringHelper::check($main_sourceArray[$value])) { return $main_sourceArray[$value]; } @@ -194,25 +202,25 @@ public function selectionTranslation($value,$name) 4 => 'COM_COMPONENTBUILDER_DYNAMIC_GET_GETCUSTOMS' ); // Now check if value is found in this array - if (isset($gettypeArray[$value]) && ComponentbuilderHelper::checkString($gettypeArray[$value])) + if (isset($gettypeArray[$value]) && StringHelper::check($gettypeArray[$value])) { return $gettypeArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -241,7 +249,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -282,7 +290,7 @@ protected function getListQuery() $query->where('a.main_source = ' . (int) $_main_source); } } - elseif (ComponentbuilderHelper::checkString($_main_source)) + elseif (StringHelper::check($_main_source)) { $query->where('a.main_source = ' . $db->quote($db->escape($_main_source))); } @@ -299,16 +307,18 @@ protected function getListQuery() $query->where('a.gettype = ' . (int) $_gettype); } } - elseif (ComponentbuilderHelper::checkString($_gettype)) + elseif (StringHelper::check($_gettype)) { $query->where('a.gettype = ' . $db->quote($db->escape($_gettype))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -326,17 +336,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -380,7 +390,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -392,22 +402,22 @@ public function getExportData($pks, $user = null) continue; } + // decode php_calculation + $item->php_calculation = base64_decode($item->php_calculation); // decode php_router_parse $item->php_router_parse = base64_decode($item->php_router_parse); - // decode php_before_getitems - $item->php_before_getitems = base64_decode($item->php_before_getitems); - // decode php_after_getitems - $item->php_after_getitems = base64_decode($item->php_after_getitems); - // decode php_after_getitem - $item->php_after_getitem = base64_decode($item->php_after_getitem); - // decode php_getlistquery - $item->php_getlistquery = base64_decode($item->php_getlistquery); // decode php_custom_get $item->php_custom_get = base64_decode($item->php_custom_get); - // decode php_calculation - $item->php_calculation = base64_decode($item->php_calculation); // decode php_before_getitem $item->php_before_getitem = base64_decode($item->php_before_getitem); + // decode php_after_getitem + $item->php_after_getitem = base64_decode($item->php_after_getitem); + // decode php_getlistquery + $item->php_getlistquery = base64_decode($item->php_getlistquery); + // decode php_before_getitems + $item->php_before_getitems = base64_decode($item->php_before_getitems); + // decode php_after_getitems + $item->php_after_getitems = base64_decode($item->php_after_getitems); // unset the values we don't want exported. unset($item->asset_id); unset($item->checked_out); @@ -416,7 +426,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -434,16 +444,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_dynamic_get"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -452,7 +462,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -467,13 +477,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -490,19 +500,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -514,7 +523,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -535,7 +544,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/field.php b/admin/models/field.php index fb00103bb..ff79c7d31 100644 --- a/admin/models/field.php +++ b/admin/models/field.php @@ -12,10 +12,25 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\String\FieldHelper; +use VDM\Joomla\Utilities\String\TypeHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Field Admin Model @@ -54,6 +69,8 @@ class ComponentbuilderModelField extends AdminModel 'indexes', 'null_switch', 'store', + 'medium_encryption_note', + 'basic_encryption_note', 'note_whmcs_encryption', 'note_expert_field_save_mode', 'initiator_on_save_model', @@ -66,6 +83,12 @@ class ComponentbuilderModelField extends AdminModel 'note_database_settings_needed' ) ), + 'type_info' => array( + 'fullwidth' => array( + 'helpnote', + 'xml' + ) + ), 'scripts' => array( 'left' => array( 'add_css_view', @@ -79,12 +102,6 @@ class ComponentbuilderModelField extends AdminModel 'add_javascript_views_footer', 'javascript_views_footer' ) - ), - 'type_info' => array( - 'fullwidth' => array( - 'helpnote', - 'xml' - ) ) ); @@ -109,16 +126,16 @@ class ComponentbuilderModelField extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'field', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'field', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -150,17 +167,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'field__'.$id); ComponentbuilderHelper::set('field__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -169,7 +185,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -199,12 +215,6 @@ public function getItem($pk = null) $item->metadata = $registry->toArray(); } - if (!empty($item->on_get_model_field)) - { - // base64 Decode on_get_model_field. - $item->on_get_model_field = base64_decode($item->on_get_model_field); - } - if (!empty($item->on_save_model_field)) { // base64 Decode on_save_model_field. @@ -217,22 +227,34 @@ public function getItem($pk = null) $item->initiator_on_get_model = base64_decode($item->initiator_on_get_model); } + if (!empty($item->initiator_on_save_model)) + { + // base64 Decode initiator_on_save_model. + $item->initiator_on_save_model = base64_decode($item->initiator_on_save_model); + } + + if (!empty($item->css_views)) + { + // base64 Decode css_views. + $item->css_views = base64_decode($item->css_views); + } + if (!empty($item->css_view)) { // base64 Decode css_view. $item->css_view = base64_decode($item->css_view); } - if (!empty($item->javascript_view_footer)) + if (!empty($item->on_get_model_field)) { - // base64 Decode javascript_view_footer. - $item->javascript_view_footer = base64_decode($item->javascript_view_footer); + // base64 Decode on_get_model_field. + $item->on_get_model_field = base64_decode($item->on_get_model_field); } - if (!empty($item->css_views)) + if (!empty($item->javascript_view_footer)) { - // base64 Decode css_views. - $item->css_views = base64_decode($item->css_views); + // base64 Decode javascript_view_footer. + $item->javascript_view_footer = base64_decode($item->javascript_view_footer); } if (!empty($item->javascript_views_footer)) @@ -241,12 +263,6 @@ public function getItem($pk = null) $item->javascript_views_footer = base64_decode($item->javascript_views_footer); } - if (!empty($item->initiator_on_save_model)) - { - // base64 Decode initiator_on_save_model. - $item->initiator_on_save_model = base64_decode($item->initiator_on_save_model); - } - if (!empty($item->xml)) { // JSON Decode xml. @@ -270,17 +286,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'field__'.$id); ComponentbuilderHelper::set('field__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -301,7 +316,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -328,7 +343,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -341,7 +356,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -398,11 +413,11 @@ public function getForm($data = array(), $loadData = true, $options = array('con } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -417,7 +432,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con // Only load the GUID if new item (or empty) if (0 == $id || !($val = $form->getValue('guid'))) { - $form->setValue('guid', null, ComponentbuilderHelper::GUID()); + $form->setValue('guid', null, GuidHelper::get()); } return $form; @@ -426,13 +441,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/field.js'; } - + /** * Method to test whether a record can be deleted. * @@ -451,7 +466,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('field.delete', 'com_componentbuilder.field.' . (int) $record->id); } @@ -469,8 +484,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -481,31 +496,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('field.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('field.edit', 'com_componentbuilder.field.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('field.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -513,19 +528,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -537,7 +552,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_field')); @@ -552,7 +567,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -567,10 +582,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.field.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.field.data', []); if (empty($data)) { @@ -598,7 +613,7 @@ protected function loadFormData() public function validate($form, $data, $group = null) { // check if the not_required field is set - if (isset($data['not_required']) && ComponentbuilderHelper::checkString($data['not_required'])) + if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required'])) { $requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = array_unique($requiredFields); @@ -606,7 +621,7 @@ public function validate($form, $data, $group = null) foreach ($requiredFields as $requiredField) { // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) + if (UtilitiesStringHelper::check($requiredField)) { // change to false $form->setFieldAttribute($requiredField, 'required', 'false'); @@ -629,7 +644,7 @@ protected function getUniqueFields() { return array('guid'); } - + /** * Method to delete one or more records. * @@ -645,7 +660,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -665,10 +680,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -694,30 +709,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('field'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('field'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -754,8 +769,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -781,7 +795,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('field'); @@ -822,7 +836,7 @@ protected function batchCopy($values, $pks, $contexts) unset($values['category']); } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -835,7 +849,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('field.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -851,13 +865,13 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -869,7 +883,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -933,7 +947,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('field'); @@ -941,7 +955,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('field.edit') && !$this->canDo->get('field.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -974,7 +988,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('field.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -990,13 +1004,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -1040,7 +1054,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -1052,15 +1066,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -1076,14 +1090,14 @@ public function save($data) $typephp[$x] = $input->get('property_type_php' . $x, null, 'RAW'); } // make sure we have an array - if (ComponentbuilderHelper::checkArray($properties)) + if (UtilitiesArrayHelper::check($properties)) { // set the bucket $bucket = array(); foreach($properties as $property) { // make sure we have the correct values - if (ComponentbuilderHelper::checkArray($property) && isset($property['name']) && ComponentbuilderHelper::checkString($property['name']) && (isset($property['value']) || 'default' === $property['name'])) + if (UtilitiesArrayHelper::check($property) && isset($property['name']) && UtilitiesStringHelper::check($property['name']) && (isset($property['value']) || 'default' === $property['name'])) { // some fixes, just in case (more can be added) switch ($property['name']) @@ -1097,11 +1111,11 @@ public function save($data) } else { - $property['value'] = ComponentbuilderHelper::safeFieldName($property['value']); + $property['value'] = FieldHelper::safe($property['value']); } break; case 'type': - $property['value'] = ComponentbuilderHelper::safeTypeName($property['value']); + $property['value'] = TypeHelper::safe($property['value']); break; } // load the property @@ -1109,15 +1123,15 @@ public function save($data) } } // make sure we have an array - if (ComponentbuilderHelper::checkArray($extraproperties)) + if (UtilitiesArrayHelper::check($extraproperties)) { foreach($extraproperties as $xproperty) { // make sure we have the correct values - if (ComponentbuilderHelper::checkArray($xproperty) && isset($xproperty['name']) && ComponentbuilderHelper::checkString($xproperty['name']) && isset($xproperty['value'])) + if (UtilitiesArrayHelper::check($xproperty) && isset($xproperty['name']) && UtilitiesStringHelper::check($xproperty['name']) && isset($xproperty['value'])) { // load the extra property - $bucket[] = "\t" . ComponentbuilderHelper::safeString($xproperty['name']) . '="' . str_replace('"', """, $xproperty['value']) . '"'; + $bucket[] = "\t" . UtilitiesStringHelper::safe($xproperty['name']) . '="' . str_replace('"', """, $xproperty['value']) . '"'; } } } @@ -1125,14 +1139,14 @@ public function save($data) foreach ($typephp as $x => $phpvalue) { // make sure we have a string - if (ComponentbuilderHelper::checkString($phpvalue)) + if (UtilitiesStringHelper::check($phpvalue)) { // load the type_php property $bucket[] = "\t" . 'type_php' . $x . '_1="__.o0=base64=Oo.__' . base64_encode($phpvalue) . '"'; } } // if the bucket has been loaded - if (ComponentbuilderHelper::checkArray($bucket)) + if (UtilitiesArrayHelper::check($bucket)) { $data['xml'] = ""; } @@ -1142,15 +1156,15 @@ public function save($data) if (empty($data['guid']) && $data['id'] > 0) { // get the existing one - $data['guid'] = (string) ComponentbuilderHelper::getVar('field', $data['id'], 'id', 'guid'); + $data['guid'] = (string) GetHelper::var('field', $data['id'], 'id', 'guid'); } + // Set the GUID if empty or not valid - while (!ComponentbuilderHelper::validGUID($data['guid'], "field", $data['id'])) + while (!GuidHelper::valid($data['guid'], "field", $data['id'])) { // must always be set - $data['guid'] = (string) ComponentbuilderHelper::GUID(); - } - + $data['guid'] = (string) GuidHelper::get(); + } // Set the xml string to JSON string. if (isset($data['xml'])) @@ -1158,12 +1172,6 @@ public function save($data) $data['xml'] = (string) json_encode($data['xml']); } - // Set the on_get_model_field string to base64 string. - if (isset($data['on_get_model_field'])) - { - $data['on_get_model_field'] = base64_encode($data['on_get_model_field']); - } - // Set the on_save_model_field string to base64 string. if (isset($data['on_save_model_field'])) { @@ -1176,22 +1184,34 @@ public function save($data) $data['initiator_on_get_model'] = base64_encode($data['initiator_on_get_model']); } + // Set the initiator_on_save_model string to base64 string. + if (isset($data['initiator_on_save_model'])) + { + $data['initiator_on_save_model'] = base64_encode($data['initiator_on_save_model']); + } + + // Set the css_views string to base64 string. + if (isset($data['css_views'])) + { + $data['css_views'] = base64_encode($data['css_views']); + } + // Set the css_view string to base64 string. if (isset($data['css_view'])) { $data['css_view'] = base64_encode($data['css_view']); } - // Set the javascript_view_footer string to base64 string. - if (isset($data['javascript_view_footer'])) + // Set the on_get_model_field string to base64 string. + if (isset($data['on_get_model_field'])) { - $data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']); + $data['on_get_model_field'] = base64_encode($data['on_get_model_field']); } - // Set the css_views string to base64 string. - if (isset($data['css_views'])) + // Set the javascript_view_footer string to base64 string. + if (isset($data['javascript_view_footer'])) { - $data['css_views'] = base64_encode($data['css_views']); + $data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']); } // Set the javascript_views_footer string to base64 string. @@ -1200,16 +1220,10 @@ public function save($data) $data['javascript_views_footer'] = base64_encode($data['javascript_views_footer']); } - // Set the initiator_on_save_model string to base64 string. - if (isset($data['initiator_on_save_model'])) - { - $data['initiator_on_save_model'] = base64_encode($data['initiator_on_save_model']); - } - // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1219,7 +1233,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1227,14 +1241,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1247,7 +1261,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1273,7 +1286,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/fields.php b/admin/models/fields.php index 36c670a60..73e50b632 100644 --- a/admin/models/fields.php +++ b/admin/models/fields.php @@ -12,18 +12,28 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\FormHelper as JCBFormHelper; +use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Fields List Model */ class ComponentbuilderModelFields extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -62,8 +72,8 @@ public function getFilterForm($data = array(), $loadData = true) $form = parent::getFilterForm($data, $loadData); // Create the "extension" filter - $form->setField(new SimpleXMLElement( - ComponentbuilderHelper::getExtensionGroupedListXml() + $form->setField(new \SimpleXMLElement( + JCBFilterHelper::extensions() ),'filter'); $form->setValue( 'extension', @@ -79,19 +89,19 @@ public function getFilterForm($data = array(), $loadData = true) 'onchange' => 'this.form.submit();', ); $options = array( - '' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_ADMIN_VIEWS_FOUND') . ' -' + '' => '- ' . Text::_('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') . ' -' + '' => '- ' . Text::_('COM_COMPONENTBUILDER_SELECT_ADMIN_VIEW') . ' -' ); // make sure we do not lose the key values in normal merge $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 +110,8 @@ public function getFilterForm($data = array(), $loadData = true) array_push($this->filter_fields, 'admin_view'); return $form; - } + } + /** * Method to auto-populate the model state. @@ -115,7 +126,7 @@ public function getFilterForm($data = array(), $loadData = true) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -206,7 +217,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -221,12 +232,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -242,7 +253,7 @@ public function getItems() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -257,7 +268,7 @@ public function getItems() } } - + // return items return $items; } @@ -265,7 +276,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -294,7 +305,7 @@ public function selectionTranslation($value,$name) 'DOUBLE' => 'COM_COMPONENTBUILDER_FIELD_DOUBLE' ); // Now check if value is found in this array - if (isset($datatypeArray[$value]) && ComponentbuilderHelper::checkString($datatypeArray[$value])) + if (isset($datatypeArray[$value]) && StringHelper::check($datatypeArray[$value])) { return $datatypeArray[$value]; } @@ -308,7 +319,7 @@ public function selectionTranslation($value,$name) 0 => 'COM_COMPONENTBUILDER_FIELD_NONE' ); // Now check if value is found in this array - if (isset($indexesArray[$value]) && ComponentbuilderHelper::checkString($indexesArray[$value])) + if (isset($indexesArray[$value]) && StringHelper::check($indexesArray[$value])) { return $indexesArray[$value]; } @@ -321,7 +332,7 @@ public function selectionTranslation($value,$name) 'NOT NULL' => 'COM_COMPONENTBUILDER_FIELD_NOT_NULL' ); // Now check if value is found in this array - if (isset($null_switchArray[$value]) && ComponentbuilderHelper::checkString($null_switchArray[$value])) + if (isset($null_switchArray[$value]) && StringHelper::check($null_switchArray[$value])) { return $null_switchArray[$value]; } @@ -339,25 +350,25 @@ public function selectionTranslation($value,$name) 6 => 'COM_COMPONENTBUILDER_FIELD_EXPERT_MODE_CUSTOM' ); // Now check if value is found in this array - if (isset($storeArray[$value]) && ComponentbuilderHelper::checkString($storeArray[$value])) + if (isset($storeArray[$value]) && StringHelper::check($storeArray[$value])) { return $storeArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -379,7 +390,7 @@ protected function getListQuery() { // 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 +406,7 @@ protected function getListQuery() $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; @@ -408,7 +419,7 @@ protected function getListQuery() } } // now check if we have IDs - if ($get_ids && ComponentbuilderHelper::checkArray($field_ids)) + if ($get_ids && UtilitiesArrayHelper::check($field_ids)) { $query->where($db->quoteName('a.id') . ' IN (' . implode(',', $field_ids) . ')'); } @@ -438,7 +449,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -479,7 +490,7 @@ protected function getListQuery() $query->where('a.fieldtype = ' . (int) $_fieldtype); } } - elseif (ComponentbuilderHelper::checkString($_fieldtype)) + elseif (StringHelper::check($_fieldtype)) { $query->where('a.fieldtype = ' . $db->quote($db->escape($_fieldtype))); } @@ -496,7 +507,7 @@ protected function getListQuery() $query->where('a.datatype = ' . (int) $_datatype); } } - elseif (ComponentbuilderHelper::checkString($_datatype)) + elseif (StringHelper::check($_datatype)) { $query->where('a.datatype = ' . $db->quote($db->escape($_datatype))); } @@ -513,7 +524,7 @@ protected function getListQuery() $query->where('a.indexes = ' . (int) $_indexes); } } - elseif (ComponentbuilderHelper::checkString($_indexes)) + elseif (StringHelper::check($_indexes)) { $query->where('a.indexes = ' . $db->quote($db->escape($_indexes))); } @@ -530,7 +541,7 @@ protected function getListQuery() $query->where('a.null_switch = ' . (int) $_null_switch); } } - elseif (ComponentbuilderHelper::checkString($_null_switch)) + elseif (StringHelper::check($_null_switch)) { $query->where('a.null_switch = ' . $db->quote($db->escape($_null_switch))); } @@ -547,7 +558,7 @@ protected function getListQuery() $query->where('a.store = ' . (int) $_store); } } - elseif (ComponentbuilderHelper::checkString($_store)) + elseif (StringHelper::check($_store)) { $query->where('a.store = ' . $db->quote($db->escape($_store))); } @@ -558,7 +569,7 @@ protected function getListQuery() if (is_numeric($categoryId)) { - $cat_tbl = JTable::getInstance('Category', 'JTable'); + $cat_tbl = Table::getInstance('Category', 'JTable'); $cat_tbl->load($categoryId); $rgt = $cat_tbl->rgt; $lft = $cat_tbl->lft; @@ -575,10 +586,12 @@ protected function getListQuery() // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -596,17 +609,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -644,7 +657,7 @@ public function getExportData($pks, $user = null) { // 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 +673,7 @@ public function getExportData($pks, $user = null) $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; @@ -673,7 +686,7 @@ public function getExportData($pks, $user = null) } } // now check if we have IDs - if ($get_ids && ComponentbuilderHelper::checkArray($field_ids)) + if ($get_ids && UtilitiesArrayHelper::check($field_ids)) { $query->where($db->quoteName('a.id') . ' IN (' . implode(',', $field_ids) . ')'); } @@ -696,7 +709,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -708,22 +721,22 @@ public function getExportData($pks, $user = null) continue; } - // decode on_get_model_field - $item->on_get_model_field = base64_decode($item->on_get_model_field); // decode on_save_model_field $item->on_save_model_field = base64_decode($item->on_save_model_field); // decode initiator_on_get_model $item->initiator_on_get_model = base64_decode($item->initiator_on_get_model); + // decode initiator_on_save_model + $item->initiator_on_save_model = base64_decode($item->initiator_on_save_model); + // decode css_views + $item->css_views = base64_decode($item->css_views); // decode css_view $item->css_view = base64_decode($item->css_view); + // decode on_get_model_field + $item->on_get_model_field = base64_decode($item->on_get_model_field); // decode javascript_view_footer $item->javascript_view_footer = base64_decode($item->javascript_view_footer); - // decode css_views - $item->css_views = base64_decode($item->css_views); // decode javascript_views_footer $item->javascript_views_footer = base64_decode($item->javascript_views_footer); - // decode initiator_on_save_model - $item->initiator_on_save_model = base64_decode($item->initiator_on_save_model); // unset the values we don't want exported. unset($item->asset_id); unset($item->checked_out); @@ -732,7 +745,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -750,16 +763,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_field"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -768,7 +781,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -783,13 +796,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -803,37 +816,37 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.store'); // Check if the value is an array $_category = $this->getState('filter.category'); - if (ComponentbuilderHelper::checkArray($_category)) + if (UtilitiesArrayHelper::check($_category)) { $id .= ':' . implode(':', $_category); } // Check if this is only an number or string elseif (is_numeric($_category) - || ComponentbuilderHelper::checkString($_category)) + || StringHelper::check($_category)) { $id .= ':' . $_category; } // Check if the value is an array $_category_id = $this->getState('filter.category_id'); - if (ComponentbuilderHelper::checkArray($_category_id)) + if (UtilitiesArrayHelper::check($_category_id)) { $id .= ':' . implode(':', $_category_id); } // Check if this is only an number or string elseif (is_numeric($_category_id) - || ComponentbuilderHelper::checkString($_category_id)) + || StringHelper::check($_category_id)) { $id .= ':' . $_category_id; } // Check if the value is an array $_catid = $this->getState('filter.catid'); - if (ComponentbuilderHelper::checkArray($_catid)) + if (UtilitiesArrayHelper::check($_catid)) { $id .= ':' . implode(':', $_catid); } // Check if this is only an number or string elseif (is_numeric($_catid) - || ComponentbuilderHelper::checkString($_catid)) + || StringHelper::check($_catid)) { $id .= ':' . $_catid; } @@ -845,19 +858,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -869,7 +881,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -890,7 +902,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/fields/adminlistvieworderfields.php b/admin/models/fields/adminlistvieworderfields.php index c8618cd71..7bbc112aa 100644 --- a/admin/models/fields/adminlistvieworderfields.php +++ b/admin/models/fields/adminlistvieworderfields.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldAdminlistvieworderfields extends JFormFieldList /** * The adminlistvieworderfields field type. * - * @var string + * @var string */ public $type = 'adminlistvieworderfields'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { @@ -120,8 +124,17 @@ protected function getOptions() foreach($items as $item) { // get the field name (TODO this could slow down the system so we will need to improve on this) - $field_name = ComponentbuilderHelper::safeFieldName(ComponentbuilderHelper::getBetween(json_decode($item->xml),'name="','"')); - $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]'); + if (isset($item->xml) && ComponentbuilderHelper::checkJson($item->xml)) + { + $field_xml = json_decode($item->xml); + $field_name = ComponentbuilderHelper::getBetween($field_xml,'name="','"'); + $field_name = ComponentbuilderHelper::safeFieldName($field_name); + $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]'); + } + else + { + $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ empty - ' . $item->type . ' ]'); + } } } return $options; diff --git a/admin/models/fields/adminsviews.php b/admin/models/fields/adminsviews.php index 1939368a6..9421cd40f 100644 --- a/admin/models/fields/adminsviews.php +++ b/admin/models/fields/adminsviews.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldAdminsviews extends JFormFieldList /** * The adminsviews field type. * - * @var string + * @var string */ public $type = 'adminsviews'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/adminviewfolderlist.php b/admin/models/fields/adminviewfolderlist.php index a57a48a94..8c9062638 100644 --- a/admin/models/fields/adminviewfolderlist.php +++ b/admin/models/fields/adminviewfolderlist.php @@ -12,6 +12,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\StringHelper; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,33 +29,36 @@ class JFormFieldAdminviewfolderlist extends JFormFieldList /** * The adminviewfolderlist field type. * - * @var string + * @var string */ public $type = 'adminviewfolderlist'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // get custom folder files - $localfolder = JPATH_COMPONENT_ADMINISTRATOR.'/views'; + $localfolders = []; + $localfolders[] = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/views'; + $localfolders[] = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/src/View'; // set the default - $options = array(); - // import all needed classes - jimport('joomla.filesystem.folder'); + $options = []; // now check if there are files in the folder - if (JFolder::exists($localfolder) && $folders = JFolder::folders($localfolder)) + foreach ($localfolders as $localfolder) { - if ($this->multiple === false) - { - $options[] = JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_SELECT_AN_ADMIN_VIEW')); - } - foreach ($folders as $folder) + if (is_dir($localfolder) && $folders = \Joomla\Filesystem\Folder::folders($localfolder)) { - $options[] = JHtml::_('select.option', $folder, ComponentbuilderHelper::safeString($folder, 'W')); + if ($this->multiple === false) + { + $options[] = Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_SELECT_AN_ADMIN_VIEW')); + } + foreach ($folders as $folder) + { + $options[] = Html::_('select.option', $folder, StringHelper::safe($folder, 'W')); + } } } return $options; diff --git a/admin/models/fields/adminviews.php b/admin/models/fields/adminviews.php index 56263e78b..c15256f88 100644 --- a/admin/models/fields/adminviews.php +++ b/admin/models/fields/adminviews.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldAdminviews extends JFormFieldList /** * The adminviews field type. * - * @var string + * @var string */ public $type = 'adminviews'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/adminviewsfilteraddcustombutton.php b/admin/models/fields/adminviewsfilteraddcustombutton.php index 7f226d74d..6204055d3 100644 --- a/admin/models/fields/adminviewsfilteraddcustombutton.php +++ b/admin/models/fields/adminviewsfilteraddcustombutton.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldAdminviewsfilteraddcustombutton extends JFormFieldList /** * The adminviewsfilteraddcustombutton field type. * - * @var string + * @var string */ public $type = 'adminviewsfilteraddcustombutton'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_ADD_CUSTOM_BUTTONS') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_CUSTOM_BUTTONS') . ' -'); - if ($results) + if ($_results) { // get admin_viewsmodel - $model = ComponentbuilderHelper::getModel('admin_views'); - $results = array_unique($results); - foreach ($results as $add_custom_button) + $_model = ComponentbuilderHelper::getModel('admin_views'); + $_results = array_unique($_results); + foreach ($_results as $add_custom_button) { // Translate the add_custom_button selection - $text = $model->selectionTranslation($add_custom_button,'add_custom_button'); + $_text = $_model->selectionTranslation($add_custom_button,'add_custom_button'); // Now add the add_custom_button and its text to the options array - $_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($text)); + $_filter[] = Html::_('select.option', $add_custom_button, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/adminviewsfilteraddcustomimport.php b/admin/models/fields/adminviewsfilteraddcustomimport.php index d3deaa8b1..f2a92d413 100644 --- a/admin/models/fields/adminviewsfilteraddcustomimport.php +++ b/admin/models/fields/adminviewsfilteraddcustomimport.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldAdminviewsfilteraddcustomimport extends JFormFieldList /** * The adminviewsfilteraddcustomimport field type. * - * @var string + * @var string */ public $type = 'adminviewsfilteraddcustomimport'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_ADD_CUSTOM_IMPORT') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_CUSTOM_IMPORT') . ' -'); - if ($results) + if ($_results) { // get admin_viewsmodel - $model = ComponentbuilderHelper::getModel('admin_views'); - $results = array_unique($results); - foreach ($results as $add_custom_import) + $_model = ComponentbuilderHelper::getModel('admin_views'); + $_results = array_unique($_results); + foreach ($_results as $add_custom_import) { // Translate the add_custom_import selection - $text = $model->selectionTranslation($add_custom_import,'add_custom_import'); + $_text = $_model->selectionTranslation($add_custom_import,'add_custom_import'); // Now add the add_custom_import and its text to the options array - $_filter[] = JHtml::_('select.option', $add_custom_import, JText::_($text)); + $_filter[] = Html::_('select.option', $add_custom_import, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/adminviewsfilteraddfadein.php b/admin/models/fields/adminviewsfilteraddfadein.php index 61dd5f4d0..3fc5bfe50 100644 --- a/admin/models/fields/adminviewsfilteraddfadein.php +++ b/admin/models/fields/adminviewsfilteraddfadein.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldAdminviewsfilteraddfadein extends JFormFieldList /** * The adminviewsfilteraddfadein field type. * - * @var string + * @var string */ public $type = 'adminviewsfilteraddfadein'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_FADE_IN_AFFECT') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_FADE_IN_AFFECT') . ' -'); - if ($results) + if ($_results) { // get admin_viewsmodel - $model = ComponentbuilderHelper::getModel('admin_views'); - $results = array_unique($results); - foreach ($results as $add_fadein) + $_model = ComponentbuilderHelper::getModel('admin_views'); + $_results = array_unique($_results); + foreach ($_results as $add_fadein) { // Translate the add_fadein selection - $text = $model->selectionTranslation($add_fadein,'add_fadein'); + $_text = $_model->selectionTranslation($add_fadein,'add_fadein'); // Now add the add_fadein and its text to the options array - $_filter[] = JHtml::_('select.option', $add_fadein, JText::_($text)); + $_filter[] = Html::_('select.option', $add_fadein, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/adminviewsfilteraddphpajax.php b/admin/models/fields/adminviewsfilteraddphpajax.php index 62eb83995..bf6899de2 100644 --- a/admin/models/fields/adminviewsfilteraddphpajax.php +++ b/admin/models/fields/adminviewsfilteraddphpajax.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldAdminviewsfilteraddphpajax extends JFormFieldList /** * The adminviewsfilteraddphpajax field type. * - * @var string + * @var string */ public $type = 'adminviewsfilteraddphpajax'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_ADD_PHP_AJAX') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_AJAX') . ' -'); - if ($results) + if ($_results) { // get admin_viewsmodel - $model = ComponentbuilderHelper::getModel('admin_views'); - $results = array_unique($results); - foreach ($results as $add_php_ajax) + $_model = ComponentbuilderHelper::getModel('admin_views'); + $_results = array_unique($_results); + foreach ($_results as $add_php_ajax) { // Translate the add_php_ajax selection - $text = $model->selectionTranslation($add_php_ajax,'add_php_ajax'); + $_text = $_model->selectionTranslation($add_php_ajax,'add_php_ajax'); // Now add the add_php_ajax and its text to the options array - $_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($text)); + $_filter[] = Html::_('select.option', $add_php_ajax, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/adminviewsfiltertype.php b/admin/models/fields/adminviewsfiltertype.php index b2dc7cba7..c99ef44f4 100644 --- a/admin/models/fields/adminviewsfiltertype.php +++ b/admin/models/fields/adminviewsfiltertype.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldAdminviewsfiltertype extends JFormFieldList /** * The adminviewsfiltertype field type. * - * @var string + * @var string */ public $type = 'adminviewsfiltertype'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,20 +53,20 @@ protected function getOptions() // Reset the query using our newly populated query object. $db->setQuery($query); - $results = $db->loadColumn(); - $_filter = array(); + $_results = $db->loadColumn(); + $_filter = []; - if ($results) + if ($_results) { // get admin_viewsmodel - $model = ComponentbuilderHelper::getModel('admin_views'); - $results = array_unique($results); - foreach ($results as $type) + $_model = ComponentbuilderHelper::getModel('admin_views'); + $_results = array_unique($_results); + foreach ($_results as $type) { // Translate the type selection - $text = $model->selectionTranslation($type,'type'); + $_text = $_model->selectionTranslation($type,'type'); // Now add the type and its text to the options array - $_filter[] = JHtml::_('select.option', $type, JText::_($text)); + $_filter[] = Html::_('select.option', $type, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/adminviewsreadonly.php b/admin/models/fields/adminviewsreadonly.php index 0490fbbef..9079b8ca8 100644 --- a/admin/models/fields/adminviewsreadonly.php +++ b/admin/models/fields/adminviewsreadonly.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,18 +28,18 @@ class JFormFieldAdminviewsreadonly extends JFormFieldList /** * The adminviewsreadonly field type. * - * @var string + * @var string */ public $type = 'adminviewsreadonly'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select($db->quoteName(array('a.id','a.system_name'),array('id','admin_view_system_name'))); $query->from($db->quoteName('#__componentbuilder_admin_view', 'a')); @@ -45,10 +49,10 @@ protected function getOptions() $options = array(); if ($items) { - $options[] = JHtml::_('select.option', '', 'Select an option'); + $options[] = Html::_('select.option', '', 'Select an option'); foreach($items as $item) { - $options[] = JHtml::_('select.option', $item->id, $item->admin_view_system_name); + $options[] = Html::_('select.option', $item->id, $item->admin_view_system_name); } } diff --git a/admin/models/fields/aliasbuilder.php b/admin/models/fields/aliasbuilder.php index d09244233..7c70c3220 100644 --- a/admin/models/fields/aliasbuilder.php +++ b/admin/models/fields/aliasbuilder.php @@ -12,6 +12,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\ArrayHelper; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,21 +30,21 @@ class JFormFieldAliasbuilder extends JFormFieldList /** * The aliasbuilder field type. * - * @var string + * @var string */ public $type = 'aliasbuilder'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // load the db object - $db = JFactory::getDBO(); + $db = Factory::getDBO(); // get the input from url - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // get the id $adminView = $jinput->getInt('id', 0); // rest the fields ids @@ -48,10 +54,10 @@ protected function getOptions() // get all the fields linked to the admin view if ($addFields = ComponentbuilderHelper::getVar('admin_fields', (int) $adminView, 'admin_view', 'addfields')) { - if (ComponentbuilderHelper::checkJson($addFields)) + if (JsonHelper::check($addFields)) { $addFields = json_decode($addFields, true); - if (ComponentbuilderHelper::checkArray($addFields)) + if (ArrayHelper::check($addFields)) { foreach($addFields as $addField) { @@ -65,7 +71,7 @@ protected function getOptions() } } // filter by fields linked - if (ComponentbuilderHelper::checkArray($fieldIds)) + if (ArrayHelper::check($fieldIds)) { // get list of field types that does not work in list views (note, spacer) $spacers = ComponentbuilderHelper::getSpacerIds(); @@ -77,7 +83,7 @@ protected function getOptions() // only load these fields $query->where($db->quoteName('a.id') . ' IN (' . implode(',', $fieldIds) . ')'); // none of these field types - if (ComponentbuilderHelper::checkArray($spacers)) + if (ArrayHelper::check($spacers)) { $query->where($db->quoteName('a.fieldtype') . ' NOT IN (' . implode(',', $spacers) . ')'); } @@ -89,11 +95,11 @@ protected function getOptions() { foreach($items as $item) { - $options[] = JHtml::_('select.option', $item->id, $item->name . ' [' . $item->type . ']'); + $options[] = Html::_('select.option', $item->id, $item->name . ' [' . $item->type . ']'); } return $options; } } - return array(JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_ADD_MORE_FIELDS_TO_THIS_ADMIN_VIEW'))); + return array(Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_ADD_MORE_FIELDS_TO_THIS_ADMIN_VIEW'))); } } diff --git a/admin/models/fields/articles.php b/admin/models/fields/articles.php index 100338ed1..f96aa25f8 100644 --- a/admin/models/fields/articles.php +++ b/admin/models/fields/articles.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,34 +28,35 @@ class JFormFieldArticles extends JFormFieldList /** * The articles field type. * - * @var string + * @var string */ public $type = 'articles'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - $query->select($db->quoteName(array('a.id','a.title','a.alias'),array('id','article_title','alias'))); - $query->from($db->quoteName('#__content', 'a')); - $query->where($db->quoteName('a.state') . ' = 1'); - $query->order('a.title ASC'); - $db->setQuery((string)$query); - $items = $db->loadObjectList(); - $options = array(); - if ($items) - { - $options[] = JHtml::_('select.option', '', 'Select an Article'); - foreach($items as $item) - { - $options[] = JHtml::_('select.option', $item->id, $item->article_title . ' (' . $item->alias . ')'); - } - } - return $options; + $db = JFactory::getDBO(); +$query = $db->getQuery(true); +$query->select($db->quoteName(array('a.id','a.title','a.alias'),array('id','article_title','alias'))); +$query->from($db->quoteName('#__content', 'a')); +$query->where($db->quoteName('a.state') . ' = 1'); +$query->order('a.title ASC'); +$db->setQuery((string)$query); +$items = $db->loadObjectList(); +$options = array(); +if ($items) +{ + $options[] = JHtml::_('select.option', '', 'Select an Article'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->article_title . ' (' . $item->alias . ')'); + } +} + +return $options; } } diff --git a/admin/models/fields/classextendingsfilterextensiontype.php b/admin/models/fields/classextendingsfilterextensiontype.php index 11d98adab..01eec44db 100644 --- a/admin/models/fields/classextendingsfilterextensiontype.php +++ b/admin/models/fields/classextendingsfilterextensiontype.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldClassextendingsfilterextensiontype extends JFormFieldList /** * The classextendingsfilterextensiontype field type. * - * @var string + * @var string */ public $type = 'classextendingsfilterextensiontype'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_TYPE') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_TYPE') . ' -'); - if ($results) + if ($_results) { // get class_extendingsmodel - $model = ComponentbuilderHelper::getModel('class_extendings'); - $results = array_unique($results); - foreach ($results as $extension_type) + $_model = ComponentbuilderHelper::getModel('class_extendings'); + $_results = array_unique($_results); + foreach ($_results as $extension_type) { // Translate the extension_type selection - $text = $model->selectionTranslation($extension_type,'extension_type'); + $_text = $_model->selectionTranslation($extension_type,'extension_type'); // Now add the extension_type and its text to the options array - $_filter[] = JHtml::_('select.option', $extension_type, JText::_($text)); + $_filter[] = Html::_('select.option', $extension_type, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/classextends.php b/admin/models/fields/classextends.php index ae65edb28..655ec3788 100644 --- a/admin/models/fields/classextends.php +++ b/admin/models/fields/classextends.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldClassextends extends JFormFieldList /** * The classextends field type. * - * @var string + * @var string */ public $type = 'classextends'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create class_extends - if ($user->authorise('class_extends.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('class_extends.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit class_extends - if ($user->authorise('class_extends.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('class_extends.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,7 +139,7 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/classmethodsfilterextensiontype.php b/admin/models/fields/classmethodsfilterextensiontype.php index ebc580b3a..6f2688a01 100644 --- a/admin/models/fields/classmethodsfilterextensiontype.php +++ b/admin/models/fields/classmethodsfilterextensiontype.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldClassmethodsfilterextensiontype extends JFormFieldList /** * The classmethodsfilterextensiontype field type. * - * @var string + * @var string */ public $type = 'classmethodsfilterextensiontype'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_TYPE') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_TYPE') . ' -'); - if ($results) + if ($_results) { // get class_methodsmodel - $model = ComponentbuilderHelper::getModel('class_methods'); - $results = array_unique($results); - foreach ($results as $extension_type) + $_model = ComponentbuilderHelper::getModel('class_methods'); + $_results = array_unique($_results); + foreach ($_results as $extension_type) { // Translate the extension_type selection - $text = $model->selectionTranslation($extension_type,'extension_type'); + $_text = $_model->selectionTranslation($extension_type,'extension_type'); // Now add the extension_type and its text to the options array - $_filter[] = JHtml::_('select.option', $extension_type, JText::_($text)); + $_filter[] = Html::_('select.option', $extension_type, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/classmethodsfiltervisibility.php b/admin/models/fields/classmethodsfiltervisibility.php index ee4297369..43c13737b 100644 --- a/admin/models/fields/classmethodsfiltervisibility.php +++ b/admin/models/fields/classmethodsfiltervisibility.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldClassmethodsfiltervisibility extends JFormFieldList /** * The classmethodsfiltervisibility field type. * - * @var string + * @var string */ public $type = 'classmethodsfiltervisibility'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_VISIBILITY') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_VISIBILITY') . ' -'); - if ($results) + if ($_results) { // get class_methodsmodel - $model = ComponentbuilderHelper::getModel('class_methods'); - $results = array_unique($results); - foreach ($results as $visibility) + $_model = ComponentbuilderHelper::getModel('class_methods'); + $_results = array_unique($_results); + foreach ($_results as $visibility) { // Translate the visibility selection - $text = $model->selectionTranslation($visibility,'visibility'); + $_text = $_model->selectionTranslation($visibility,'visibility'); // Now add the visibility and its text to the options array - $_filter[] = JHtml::_('select.option', $visibility, JText::_($text)); + $_filter[] = Html::_('select.option', $visibility, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/classpowers.php b/admin/models/fields/classpowers.php index 34bbb2439..166a0c152 100644 --- a/admin/models/fields/classpowers.php +++ b/admin/models/fields/classpowers.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldClasspowers extends JFormFieldList /** * The classpowers field type. * - * @var string + * @var string */ public $type = 'classpowers'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create power - if ($user->authorise('power.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('power.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit power - if ($user->authorise('power.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('power.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,7 +139,7 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/classpropertiesfilterextensiontype.php b/admin/models/fields/classpropertiesfilterextensiontype.php index 5acb6d3e1..679c23d0c 100644 --- a/admin/models/fields/classpropertiesfilterextensiontype.php +++ b/admin/models/fields/classpropertiesfilterextensiontype.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldClasspropertiesfilterextensiontype extends JFormFieldList /** * The classpropertiesfilterextensiontype field type. * - * @var string + * @var string */ public $type = 'classpropertiesfilterextensiontype'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_TYPE') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_TYPE') . ' -'); - if ($results) + if ($_results) { // get class_propertiesmodel - $model = ComponentbuilderHelper::getModel('class_properties'); - $results = array_unique($results); - foreach ($results as $extension_type) + $_model = ComponentbuilderHelper::getModel('class_properties'); + $_results = array_unique($_results); + foreach ($_results as $extension_type) { // Translate the extension_type selection - $text = $model->selectionTranslation($extension_type,'extension_type'); + $_text = $_model->selectionTranslation($extension_type,'extension_type'); // Now add the extension_type and its text to the options array - $_filter[] = JHtml::_('select.option', $extension_type, JText::_($text)); + $_filter[] = Html::_('select.option', $extension_type, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/classpropertiesfiltervisibility.php b/admin/models/fields/classpropertiesfiltervisibility.php index 927d33413..5a2a1c872 100644 --- a/admin/models/fields/classpropertiesfiltervisibility.php +++ b/admin/models/fields/classpropertiesfiltervisibility.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldClasspropertiesfiltervisibility extends JFormFieldList /** * The classpropertiesfiltervisibility field type. * - * @var string + * @var string */ public $type = 'classpropertiesfiltervisibility'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_VISIBILITY') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_VISIBILITY') . ' -'); - if ($results) + if ($_results) { // get class_propertiesmodel - $model = ComponentbuilderHelper::getModel('class_properties'); - $results = array_unique($results); - foreach ($results as $visibility) + $_model = ComponentbuilderHelper::getModel('class_properties'); + $_results = array_unique($_results); + foreach ($_results as $visibility) { // Translate the visibility selection - $text = $model->selectionTranslation($visibility,'visibility'); + $_text = $_model->selectionTranslation($visibility,'visibility'); // Now add the visibility and its text to the options array - $_filter[] = JHtml::_('select.option', $visibility, JText::_($text)); + $_filter[] = Html::_('select.option', $visibility, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/componentadminmenus.php b/admin/models/fields/componentadminmenus.php index 5dd2f48b2..a2180fe2e 100644 --- a/admin/models/fields/componentadminmenus.php +++ b/admin/models/fields/componentadminmenus.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldComponentadminmenus extends JFormFieldList /** * The componentadminmenus field type. * - * @var string + * @var string */ public $type = 'componentadminmenus'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/componentadminviews.php b/admin/models/fields/componentadminviews.php index 951e54196..5d69f09e9 100644 --- a/admin/models/fields/componentadminviews.php +++ b/admin/models/fields/componentadminviews.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldComponentadminviews extends JFormFieldList /** * The componentadminviews field type. * - * @var string + * @var string */ public $type = 'componentadminviews'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/componentsroutersfiltermodeconstructorafterparent.php b/admin/models/fields/componentsroutersfiltermodeconstructorafterparent.php new file mode 100644 index 000000000..470a944e4 --- /dev/null +++ b/admin/models/fields/componentsroutersfiltermodeconstructorafterparent.php @@ -0,0 +1,75 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Componentsroutersfiltermodeconstructorafterparent Form Field class for the Componentbuilder component + */ +class JFormFieldComponentsroutersfiltermodeconstructorafterparent extends JFormFieldList +{ + /** + * The componentsroutersfiltermodeconstructorafterparent field type. + * + * @var string + */ + public $type = 'componentsroutersfiltermodeconstructorafterparent'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of Html options. + */ + protected function getOptions() + { + // Get a db connection. + $db = Factory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('mode_constructor_after_parent')); + $query->from($db->quoteName('#__componentbuilder_component_router')); + $query->order($db->quoteName('mode_constructor_after_parent') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ROUTER_MODECONSTRUCTOR_AFTER_PARENT') . ' -'); + + if ($_results) + { + // get components_routersmodel + $_model = ComponentbuilderHelper::getModel('components_routers'); + $_results = array_unique($_results); + foreach ($_results as $mode_constructor_after_parent) + { + // Translate the mode_constructor_after_parent selection + $_text = $_model->selectionTranslation($mode_constructor_after_parent,'mode_constructor_after_parent'); + // Now add the mode_constructor_after_parent and its text to the options array + $_filter[] = Html::_('select.option', $mode_constructor_after_parent, Text::_($_text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/componentsroutersfiltermodeconstructorbeforeparent.php b/admin/models/fields/componentsroutersfiltermodeconstructorbeforeparent.php new file mode 100644 index 000000000..bb798a6ce --- /dev/null +++ b/admin/models/fields/componentsroutersfiltermodeconstructorbeforeparent.php @@ -0,0 +1,75 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Componentsroutersfiltermodeconstructorbeforeparent Form Field class for the Componentbuilder component + */ +class JFormFieldComponentsroutersfiltermodeconstructorbeforeparent extends JFormFieldList +{ + /** + * The componentsroutersfiltermodeconstructorbeforeparent field type. + * + * @var string + */ + public $type = 'componentsroutersfiltermodeconstructorbeforeparent'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of Html options. + */ + protected function getOptions() + { + // Get a db connection. + $db = Factory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('mode_constructor_before_parent')); + $query->from($db->quoteName('#__componentbuilder_component_router')); + $query->order($db->quoteName('mode_constructor_before_parent') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ROUTER_MODECONSTRUCTOR_BEFORE_PARENT') . ' -'); + + if ($_results) + { + // get components_routersmodel + $_model = ComponentbuilderHelper::getModel('components_routers'); + $_results = array_unique($_results); + foreach ($_results as $mode_constructor_before_parent) + { + // Translate the mode_constructor_before_parent selection + $_text = $_model->selectionTranslation($mode_constructor_before_parent,'mode_constructor_before_parent'); + // Now add the mode_constructor_before_parent and its text to the options array + $_filter[] = Html::_('select.option', $mode_constructor_before_parent, Text::_($_text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/componentsroutersfiltermodemethods.php b/admin/models/fields/componentsroutersfiltermodemethods.php new file mode 100644 index 000000000..c66843fe4 --- /dev/null +++ b/admin/models/fields/componentsroutersfiltermodemethods.php @@ -0,0 +1,75 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Componentsroutersfiltermodemethods Form Field class for the Componentbuilder component + */ +class JFormFieldComponentsroutersfiltermodemethods extends JFormFieldList +{ + /** + * The componentsroutersfiltermodemethods field type. + * + * @var string + */ + public $type = 'componentsroutersfiltermodemethods'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of Html options. + */ + protected function getOptions() + { + // Get a db connection. + $db = Factory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('mode_methods')); + $query->from($db->quoteName('#__componentbuilder_component_router')); + $query->order($db->quoteName('mode_methods') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ROUTER_MODEMETHODS') . ' -'); + + if ($_results) + { + // get components_routersmodel + $_model = ComponentbuilderHelper::getModel('components_routers'); + $_results = array_unique($_results); + foreach ($_results as $mode_methods) + { + // Translate the mode_methods selection + $_text = $_model->selectionTranslation($mode_methods,'mode_methods'); + // Now add the mode_methods and its text to the options array + $_filter[] = Html::_('select.option', $mode_methods, Text::_($_text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/customadminviews.php b/admin/models/fields/customadminviews.php index 9fec6f27d..df6f812cc 100644 --- a/admin/models/fields/customadminviews.php +++ b/admin/models/fields/customadminviews.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldCustomadminviews extends JFormFieldList /** * The customadminviews field type. * - * @var string + * @var string */ public $type = 'customadminviews'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/customadminviewsfilteraddcustombutton.php b/admin/models/fields/customadminviewsfilteraddcustombutton.php index 13a94b21e..3d04f8b8f 100644 --- a/admin/models/fields/customadminviewsfilteraddcustombutton.php +++ b/admin/models/fields/customadminviewsfilteraddcustombutton.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldCustomadminviewsfilteraddcustombutton extends JFormFieldList /** * The customadminviewsfilteraddcustombutton field type. * - * @var string + * @var string */ public $type = 'customadminviewsfilteraddcustombutton'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_ADD_CUSTOM_BUTTONS') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_CUSTOM_BUTTONS') . ' -'); - if ($results) + if ($_results) { // get custom_admin_viewsmodel - $model = ComponentbuilderHelper::getModel('custom_admin_views'); - $results = array_unique($results); - foreach ($results as $add_custom_button) + $_model = ComponentbuilderHelper::getModel('custom_admin_views'); + $_results = array_unique($_results); + foreach ($_results as $add_custom_button) { // Translate the add_custom_button selection - $text = $model->selectionTranslation($add_custom_button,'add_custom_button'); + $_text = $_model->selectionTranslation($add_custom_button,'add_custom_button'); // Now add the add_custom_button and its text to the options array - $_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($text)); + $_filter[] = Html::_('select.option', $add_custom_button, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/customadminviewsfilteraddphpajax.php b/admin/models/fields/customadminviewsfilteraddphpajax.php index 0756975bd..d186b5358 100644 --- a/admin/models/fields/customadminviewsfilteraddphpajax.php +++ b/admin/models/fields/customadminviewsfilteraddphpajax.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldCustomadminviewsfilteraddphpajax extends JFormFieldList /** * The customadminviewsfilteraddphpajax field type. * - * @var string + * @var string */ public $type = 'customadminviewsfilteraddphpajax'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_ADD_PHP_AJAX') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_AJAX') . ' -'); - if ($results) + if ($_results) { // get custom_admin_viewsmodel - $model = ComponentbuilderHelper::getModel('custom_admin_views'); - $results = array_unique($results); - foreach ($results as $add_php_ajax) + $_model = ComponentbuilderHelper::getModel('custom_admin_views'); + $_results = array_unique($_results); + foreach ($_results as $add_php_ajax) { // Translate the add_php_ajax selection - $text = $model->selectionTranslation($add_php_ajax,'add_php_ajax'); + $_text = $_model->selectionTranslation($add_php_ajax,'add_php_ajax'); // Now add the add_php_ajax and its text to the options array - $_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($text)); + $_filter[] = Html::_('select.option', $add_php_ajax, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/customcodesfiltercommenttype.php b/admin/models/fields/customcodesfiltercommenttype.php index d56f38e99..a439d3c99 100644 --- a/admin/models/fields/customcodesfiltercommenttype.php +++ b/admin/models/fields/customcodesfiltercommenttype.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldCustomcodesfiltercommenttype extends JFormFieldList /** * The customcodesfiltercommenttype field type. * - * @var string + * @var string */ public $type = 'customcodesfiltercommenttype'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_COMMENT_TYPE_USED_IN_PLACEHOLDER') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_COMMENT_TYPE_USED_IN_PLACEHOLDER') . ' -'); - if ($results) + if ($_results) { // get custom_codesmodel - $model = ComponentbuilderHelper::getModel('custom_codes'); - $results = array_unique($results); - foreach ($results as $comment_type) + $_model = ComponentbuilderHelper::getModel('custom_codes'); + $_results = array_unique($_results); + foreach ($_results as $comment_type) { // Translate the comment_type selection - $text = $model->selectionTranslation($comment_type,'comment_type'); + $_text = $_model->selectionTranslation($comment_type,'comment_type'); // Now add the comment_type and its text to the options array - $_filter[] = JHtml::_('select.option', $comment_type, JText::_($text)); + $_filter[] = Html::_('select.option', $comment_type, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/customcodesfiltertarget.php b/admin/models/fields/customcodesfiltertarget.php index 2789fe560..123f906ce 100644 --- a/admin/models/fields/customcodesfiltertarget.php +++ b/admin/models/fields/customcodesfiltertarget.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldCustomcodesfiltertarget extends JFormFieldList /** * The customcodesfiltertarget field type. * - * @var string + * @var string */ public $type = 'customcodesfiltertarget'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_TARGET') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_TARGET') . ' -'); - if ($results) + if ($_results) { // get custom_codesmodel - $model = ComponentbuilderHelper::getModel('custom_codes'); - $results = array_unique($results); - foreach ($results as $target) + $_model = ComponentbuilderHelper::getModel('custom_codes'); + $_results = array_unique($_results); + foreach ($_results as $target) { // Translate the target selection - $text = $model->selectionTranslation($target,'target'); + $_text = $_model->selectionTranslation($target,'target'); // Now add the target and its text to the options array - $_filter[] = JHtml::_('select.option', $target, JText::_($text)); + $_filter[] = Html::_('select.option', $target, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/customcodesfiltertype.php b/admin/models/fields/customcodesfiltertype.php index 205711ea0..0b13423c6 100644 --- a/admin/models/fields/customcodesfiltertype.php +++ b/admin/models/fields/customcodesfiltertype.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldCustomcodesfiltertype extends JFormFieldList /** * The customcodesfiltertype field type. * - * @var string + * @var string */ public $type = 'customcodesfiltertype'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_ADD_TYPE') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_TYPE') . ' -'); - if ($results) + if ($_results) { // get custom_codesmodel - $model = ComponentbuilderHelper::getModel('custom_codes'); - $results = array_unique($results); - foreach ($results as $type) + $_model = ComponentbuilderHelper::getModel('custom_codes'); + $_results = array_unique($_results); + foreach ($_results as $type) { // Translate the type selection - $text = $model->selectionTranslation($type,'type'); + $_text = $_model->selectionTranslation($type,'type'); // Now add the type and its text to the options array - $_filter[] = JHtml::_('select.option', $type, JText::_($text)); + $_filter[] = Html::_('select.option', $type, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/customfilelist.php b/admin/models/fields/customfilelist.php index 0e72adcb4..f499158b8 100644 --- a/admin/models/fields/customfilelist.php +++ b/admin/models/fields/customfilelist.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,36 +28,33 @@ class JFormFieldCustomfilelist extends JFormFieldList /** * The customfilelist field type. * - * @var string + * @var string */ public $type = 'customfilelist'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // get custom folder files - $localfolder = JComponentHelper::getParams('com_componentbuilder')->get('custom_folder_path', JPATH_COMPONENT_ADMINISTRATOR.'/custom'); + $localfolder = \JComponentHelper::getParams('com_componentbuilder')->get('custom_folder_path', JPATH_COMPONENT_ADMINISTRATOR . '/custom'); // set the default - $options[] = JHtml::_('select.option', '', JText::sprintf('COM_COMPONENTBUILDER_PLEASE_ADD_FILES_TO_S',$localfolder)); - // inport all needed classes - jimport('joomla.filesystem.file'); - jimport('joomla.filesystem.folder'); + $options[] = Html::_('select.option', '', Text::sprintf('COM_COMPONENTBUILDER_PLEASE_ADD_FILES_TO_S',$localfolder)); // setup the folder if it does not exist - if (!JFolder::exists($localfolder)) + if (!\JFolder::exists($localfolder)) { - JFolder::create($localfolder); + \JFolder::create($localfolder); } // now check if there are files in the folder - if ($files = JFolder::files($localfolder)) + if ($files = \JFolder::files($localfolder)) { $options = array(); foreach ($files as $file) { - $options[] = JHtml::_('select.option', $file, $file); + $options[] = Html::_('select.option', $file, $file); } } return $options; diff --git a/admin/models/fields/customfolderlist.php b/admin/models/fields/customfolderlist.php index fe4f865de..a306f9d08 100644 --- a/admin/models/fields/customfolderlist.php +++ b/admin/models/fields/customfolderlist.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,36 +28,33 @@ class JFormFieldCustomfolderlist extends JFormFieldList /** * The customfolderlist field type. * - * @var string + * @var string */ public $type = 'customfolderlist'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // get custom folder folder - $localfolder = JComponentHelper::getParams('com_componentbuilder')->get('custom_folder_path', JPATH_COMPONENT_ADMINISTRATOR.'/custom'); + $localfolder = ComponentHelper::getParams('com_componentbuilder')->get('custom_folder_path', JPATH_COMPONENT_ADMINISTRATOR.'/custom'); // set the default - $options[] = JHtml::_('select.option', '', JText::sprintf('COM_COMPONENTBUILDER_PLEASE_ADD_FOLDERS_TO_S',$localfolder)); - // import all needed classes - jimport('joomla.filesystem.file'); - jimport('joomla.filesystem.folder'); + $options[] = Html::_('select.option', '', Text::sprintf('COM_COMPONENTBUILDER_PLEASE_ADD_FOLDERS_TO_S',$localfolder)); // setup the folder if it does not exist - if (!JFolder::exists($localfolder)) + if (!\JFolder::exists($localfolder)) { - JFolder::create($localfolder); + \JFolder::create($localfolder); } // now check if there are files in the folder - if ($folders = JFolder::folders($localfolder)) + if ($folders = \JFolder::folders($localfolder)) { - $options = array(); + $options = []; foreach ($folders as $folder) { - $options[] = JHtml::_('select.option', $folder, $folder); + $options[] = Html::_('select.option', $folder, $folder); } } return $options; diff --git a/admin/models/fields/customgets.php b/admin/models/fields/customgets.php index b36a88376..d1680812c 100644 --- a/admin/models/fields/customgets.php +++ b/admin/models/fields/customgets.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,36 +28,37 @@ class JFormFieldCustomgets extends JFormFieldList /** * The customgets field type. * - * @var string + * @var string */ public $type = 'customgets'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - $query->select($db->quoteName(array('a.id','a.name','a.gettype'),array('id','custom_get_name','type'))); - $query->from($db->quoteName('#__componentbuilder_dynamic_get', 'a')); - $query->where($db->quoteName('a.published') . ' = 1'); + $db = JFactory::getDBO(); +$query = $db->getQuery(true); +$query->select($db->quoteName(array('a.id','a.name','a.gettype'),array('id','custom_get_name','type'))); +$query->from($db->quoteName('#__componentbuilder_dynamic_get', 'a')); +$query->where($db->quoteName('a.published') . ' = 1'); $query->where('( '.$db->quoteName('a.gettype') . ' = 3 OR ' . $db->quoteName('a.gettype') . ' = 4 )'); - $query->order('a.name ASC'); - $db->setQuery((string)$query); - $items = $db->loadObjectList(); - $options = array(); - if ($items) - { - $model = ComponentbuilderHelper::getModel('dynamic_gets'); - foreach($items as $item) - { - $type = $model->selectionTranslation($item->type,'gettype'); - $options[] = JHtml::_('select.option', $item->id, $item->custom_get_name . ' (' . JText::_($type) . ')' ); - } - } - return $options; + $query->order('a.name ASC'); +$db->setQuery((string)$query); +$items = $db->loadObjectList(); +$options = array(); +if ($items) +{ + $model = ComponentbuilderHelper::getModel('dynamic_gets'); + foreach($items as $item) + { + $type = $model->selectionTranslation($item->type,'gettype'); + $options[] = JHtml::_('select.option', $item->id, $item->custom_get_name . ' (' . JText::_($type) . ')' ); + } +} + +return $options; } } diff --git a/admin/models/fields/dbtables.php b/admin/models/fields/dbtables.php index 773458749..4d679ddd7 100644 --- a/admin/models/fields/dbtables.php +++ b/admin/models/fields/dbtables.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,26 +28,26 @@ class JFormFieldDbtables extends JFormFieldList /** * The dbtables field type. * - * @var string + * @var string */ public $type = 'dbtables'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // get db object - $db = JFactory::getDBO(); + $db = Factory::getDBO(); // get all tables $tables= $db->getTableList(); // get config - $config = JFactory::getConfig(); - $dbprefix = version_compare(JVERSION,'3.0','lt') ? $config->getValue('config.dbprefix') : $config->get('dbprefix'); + $config = Factory::getConfig(); + $dbprefix = \version_compare(JVERSION,'3.0','lt') ? $config->getValue('config.dbprefix') : $config->get('dbprefix'); $options = array(); - $options[] = JHtml::_('select.option', '', 'Select an option'); + $options[] = Html::_('select.option', '', 'Select an option'); for ($i=0; $i < count($tables); $i++) { //only tables with primary key @@ -51,7 +55,7 @@ protected function getOptions() if ($db->loadResult()) { $key = $i+1; - $options[$key] = new stdClass; + $options[$key] = new \stdClass; $options[$key]->value = str_replace($dbprefix, '', $tables[$i]); $options[$key]->text = $tables[$i]; } diff --git a/admin/models/fields/dynamicdashboard.php b/admin/models/fields/dynamicdashboard.php index bcaaa5a3a..5088f109a 100644 --- a/admin/models/fields/dynamicdashboard.php +++ b/admin/models/fields/dynamicdashboard.php @@ -12,6 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\StringHelper; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,28 +32,28 @@ class JFormFieldDynamicdashboard extends JFormFieldList /** * The dynamicdashboard field type. * - * @var string + * @var string */ public $type = 'dynamicdashboard'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // load the db opbject - $db = JFactory::getDBO(); + $db = Factory::getDBO(); // get the input from url - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // get the id $ID = $jinput->getInt('id', 0); // set the targets - $targets = array('adminview' => 'admin_view', 'customadminview' => 'custom_admin_view'); - $t = array('adminview' => 'A', 'customadminview' => 'C'); + $targets = ['adminview' => 'admin_view', 'customadminview' => 'custom_admin_view']; + $t = ['adminview' => 'A', 'customadminview' => 'C']; // rest the options - $options = array(); + $options = []; // reset the custom admin views array $views = false; if (is_numeric($ID) && $ID >= 1) @@ -53,7 +61,7 @@ protected function getOptions() // get the linked back-end views foreach ($targets as $target => $view) { - if ($result = ComponentbuilderHelper::getVar('component_'.$view.'s', (int) $ID, 'joomla_component', 'add'.$view.'s')) + if ($result = GetHelper::var('component_'.$view.'s', (int) $ID, 'joomla_component', 'add'.$view.'s')) { $views[$target] = $result; } @@ -62,28 +70,28 @@ protected function getOptions() else { // not linked so there is none available - return array(JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_LINK_AN_ADMIN_OR_A_CUSTOM_ADMIN_VIEW_TO_THIS_COMPONENT_THEN_YOU_CAN_SELECT_IT_HERE'))); + return [Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_LINK_AN_ADMIN_OR_A_CUSTOM_ADMIN_VIEW_TO_THIS_COMPONENT_THEN_YOU_CAN_SELECT_IT_HERE'))]; } // check if we found any values - if (ComponentbuilderHelper::checkArray($views)) + if (ArrayHelper::check($views)) { foreach ($targets as $target => $view) { - if (isset($views[$target]) && ComponentbuilderHelper::checkJson($views[$target])) + if (isset($views[$target]) && JsonHelper::check($views[$target])) { // convert to an array $value = json_decode($views[$target], true); - $type = ComponentbuilderHelper::safeString($view, 'w'); - if (ComponentbuilderHelper::checkArray($value)) + $type = StringHelper::safe($view, 'w'); + if (ArrayHelper::check($value)) { foreach ($value as $_view) { if (isset($_view[$target]) && is_numeric($_view[$target])) { // set the view to the selections if found - if ($name = ComponentbuilderHelper::getVar($view, (int) $_view[$target], 'id', 'system_name')) + if ($name = GetHelper::var($view, (int) $_view[$target], 'id', 'system_name')) { - $options[] = JHtml::_('select.option', $t[$target].'_'.$_view[$target], $name.' ['.$type.']'); + $options[] = Html::_('select.option', $t[$target].'_'.$_view[$target], $name.' ['.$type.']'); } } } @@ -92,12 +100,12 @@ protected function getOptions() } } // return found options - if (ComponentbuilderHelper::checkArray($options)) + if (ArrayHelper::check($options)) { - array_unshift($options , JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION'))); + array_unshift($options , Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION'))); return $options; } // not linked so there is none available - return array(JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_LINK_AN_ADMIN_OR_A_CUSTOM_ADMIN_VIEW_TO_THIS_COMPONENT_THEN_YOU_CAN_SELECT_IT_HERE'))); + return [Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_LINK_AN_ADMIN_OR_A_CUSTOM_ADMIN_VIEW_TO_THIS_COMPONENT_THEN_YOU_CAN_SELECT_IT_HERE'))]; } } diff --git a/admin/models/fields/dynamicget.php b/admin/models/fields/dynamicget.php index 2d8d00810..65fdfcf0f 100644 --- a/admin/models/fields/dynamicget.php +++ b/admin/models/fields/dynamicget.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldDynamicget extends JFormFieldList /** * The dynamicget field type. * - * @var string + * @var string */ public $type = 'dynamicget'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create dynamic_get - if ($user->authorise('dynamic_get.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('dynamic_get.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit dynamic_get - if ($user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,7 +139,7 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/dynamicgets.php b/admin/models/fields/dynamicgets.php index 078c4ccce..b3f2faaa5 100644 --- a/admin/models/fields/dynamicgets.php +++ b/admin/models/fields/dynamicgets.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldDynamicgets extends JFormFieldList /** * The dynamicgets field type. * - * @var string + * @var string */ public $type = 'dynamicgets'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/dynamicgetsfiltergettype.php b/admin/models/fields/dynamicgetsfiltergettype.php index 77ddc0e71..9d6293648 100644 --- a/admin/models/fields/dynamicgetsfiltergettype.php +++ b/admin/models/fields/dynamicgetsfiltergettype.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldDynamicgetsfiltergettype extends JFormFieldList /** * The dynamicgetsfiltergettype field type. * - * @var string + * @var string */ public $type = 'dynamicgetsfiltergettype'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_GETTYPE') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_GETTYPE') . ' -'); - if ($results) + if ($_results) { // get dynamic_getsmodel - $model = ComponentbuilderHelper::getModel('dynamic_gets'); - $results = array_unique($results); - foreach ($results as $gettype) + $_model = ComponentbuilderHelper::getModel('dynamic_gets'); + $_results = array_unique($_results); + foreach ($_results as $gettype) { // Translate the gettype selection - $text = $model->selectionTranslation($gettype,'gettype'); + $_text = $_model->selectionTranslation($gettype,'gettype'); // Now add the gettype and its text to the options array - $_filter[] = JHtml::_('select.option', $gettype, JText::_($text)); + $_filter[] = Html::_('select.option', $gettype, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/dynamicgetsfiltermainsource.php b/admin/models/fields/dynamicgetsfiltermainsource.php index 97f27ae89..7d9b1f9d8 100644 --- a/admin/models/fields/dynamicgetsfiltermainsource.php +++ b/admin/models/fields/dynamicgetsfiltermainsource.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldDynamicgetsfiltermainsource extends JFormFieldList /** * The dynamicgetsfiltermainsource field type. * - * @var string + * @var string */ public $type = 'dynamicgetsfiltermainsource'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_MAIN_SOURCE') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_MAIN_SOURCE') . ' -'); - if ($results) + if ($_results) { // get dynamic_getsmodel - $model = ComponentbuilderHelper::getModel('dynamic_gets'); - $results = array_unique($results); - foreach ($results as $main_source) + $_model = ComponentbuilderHelper::getModel('dynamic_gets'); + $_results = array_unique($_results); + foreach ($_results as $main_source) { // Translate the main_source selection - $text = $model->selectionTranslation($main_source,'main_source'); + $_text = $_model->selectionTranslation($main_source,'main_source'); // Now add the main_source and its text to the options array - $_filter[] = JHtml::_('select.option', $main_source, JText::_($text)); + $_filter[] = Html::_('select.option', $main_source, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/excludedlanguages.php b/admin/models/fields/excludedlanguages.php index d0be7d54b..b8c9ebf44 100644 --- a/admin/models/fields/excludedlanguages.php +++ b/admin/models/fields/excludedlanguages.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldExcludedlanguages extends JFormFieldList /** * The excludedlanguages field type. * - * @var string + * @var string */ public $type = 'excludedlanguages'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create language - if ($user->authorise('language.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('language.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit language - if ($user->authorise('language.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('language.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,7 +139,7 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/existingvalidationrules.php b/admin/models/fields/existingvalidationrules.php index b4e8a0c1f..fc759caba 100644 --- a/admin/models/fields/existingvalidationrules.php +++ b/admin/models/fields/existingvalidationrules.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldExistingvalidationrules extends JFormFieldList /** * The existingvalidationrules field type. * - * @var string + * @var string */ public $type = 'existingvalidationrules'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/fields.php b/admin/models/fields/fields.php index 95ce61061..80d3acff9 100644 --- a/admin/models/fields/fields.php +++ b/admin/models/fields/fields.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldFields extends JFormFieldList /** * The fields field type. * - * @var string + * @var string */ public $type = 'fields'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { @@ -51,8 +55,17 @@ protected function getOptions() foreach($items as $item) { // get the field name (TODO this could slow down the system so we will need to improve on this) - $field_name = ComponentbuilderHelper::safeFieldName(ComponentbuilderHelper::getBetween(json_decode($item->xml),'name="','"')); - $options[] = JHtml::_('select.option', $item->id, $item->field_name . ' [ ' . $field_name . ' - ' . $item->type . ' ]'); + if (isset($item->xml) && ComponentbuilderHelper::checkJson($item->xml)) + { + $field_xml = json_decode($item->xml); + $field_name = ComponentbuilderHelper::getBetween($field_xml,'name="','"'); + $field_name = ComponentbuilderHelper::safeFieldName($field_name); + $options[] = JHtml::_('select.option', $item->id, $item->field_name . ' [ ' . $field_name . ' - ' . $item->type . ' ]'); + } + else + { + $options[] = JHtml::_('select.option', $item->id, $item->field_name . ' [ empty - ' . $item->type . ' ]'); + } } } diff --git a/admin/models/fields/fieldsfilterdatatype.php b/admin/models/fields/fieldsfilterdatatype.php index ad7adc9fb..d06128b2e 100644 --- a/admin/models/fields/fieldsfilterdatatype.php +++ b/admin/models/fields/fieldsfilterdatatype.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldFieldsfilterdatatype extends JFormFieldList /** * The fieldsfilterdatatype field type. * - * @var string + * @var string */ public $type = 'fieldsfilterdatatype'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_DATA_TYPE') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_DATA_TYPE') . ' -'); - if ($results) + if ($_results) { // get fieldsmodel - $model = ComponentbuilderHelper::getModel('fields'); - $results = array_unique($results); - foreach ($results as $datatype) + $_model = ComponentbuilderHelper::getModel('fields'); + $_results = array_unique($_results); + foreach ($_results as $datatype) { // Translate the datatype selection - $text = $model->selectionTranslation($datatype,'datatype'); + $_text = $_model->selectionTranslation($datatype,'datatype'); // Now add the datatype and its text to the options array - $_filter[] = JHtml::_('select.option', $datatype, JText::_($text)); + $_filter[] = Html::_('select.option', $datatype, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/fieldsfilterindexes.php b/admin/models/fields/fieldsfilterindexes.php index e5ea7543f..178ea3a7a 100644 --- a/admin/models/fields/fieldsfilterindexes.php +++ b/admin/models/fields/fieldsfilterindexes.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldFieldsfilterindexes extends JFormFieldList /** * The fieldsfilterindexes field type. * - * @var string + * @var string */ public $type = 'fieldsfilterindexes'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_INDEXES_TYPE') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_INDEXES_TYPE') . ' -'); - if ($results) + if ($_results) { // get fieldsmodel - $model = ComponentbuilderHelper::getModel('fields'); - $results = array_unique($results); - foreach ($results as $indexes) + $_model = ComponentbuilderHelper::getModel('fields'); + $_results = array_unique($_results); + foreach ($_results as $indexes) { // Translate the indexes selection - $text = $model->selectionTranslation($indexes,'indexes'); + $_text = $_model->selectionTranslation($indexes,'indexes'); // Now add the indexes and its text to the options array - $_filter[] = JHtml::_('select.option', $indexes, JText::_($text)); + $_filter[] = Html::_('select.option', $indexes, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/fieldsfilternullswitch.php b/admin/models/fields/fieldsfilternullswitch.php index 34eaa5fe5..b5153b095 100644 --- a/admin/models/fields/fieldsfilternullswitch.php +++ b/admin/models/fields/fieldsfilternullswitch.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldFieldsfilternullswitch extends JFormFieldList /** * The fieldsfilternullswitch field type. * - * @var string + * @var string */ public $type = 'fieldsfilternullswitch'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_NULL_SWITCH') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_NULL_SWITCH') . ' -'); - if ($results) + if ($_results) { // get fieldsmodel - $model = ComponentbuilderHelper::getModel('fields'); - $results = array_unique($results); - foreach ($results as $null_switch) + $_model = ComponentbuilderHelper::getModel('fields'); + $_results = array_unique($_results); + foreach ($_results as $null_switch) { // Translate the null_switch selection - $text = $model->selectionTranslation($null_switch,'null_switch'); + $_text = $_model->selectionTranslation($null_switch,'null_switch'); // Now add the null_switch and its text to the options array - $_filter[] = JHtml::_('select.option', $null_switch, JText::_($text)); + $_filter[] = Html::_('select.option', $null_switch, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/fieldsfilterstore.php b/admin/models/fields/fieldsfilterstore.php index 41b975d50..8a18ae273 100644 --- a/admin/models/fields/fieldsfilterstore.php +++ b/admin/models/fields/fieldsfilterstore.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldFieldsfilterstore extends JFormFieldList /** * The fieldsfilterstore field type. * - * @var string + * @var string */ public $type = 'fieldsfilterstore'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_MODELING_METHOD') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_MODELLING_METHOD') . ' -'); - if ($results) + if ($_results) { // get fieldsmodel - $model = ComponentbuilderHelper::getModel('fields'); - $results = array_unique($results); - foreach ($results as $store) + $_model = ComponentbuilderHelper::getModel('fields'); + $_results = array_unique($_results); + foreach ($_results as $store) { // Translate the store selection - $text = $model->selectionTranslation($store,'store'); + $_text = $_model->selectionTranslation($store,'store'); // Now add the store and its text to the options array - $_filter[] = JHtml::_('select.option', $store, JText::_($text)); + $_filter[] = Html::_('select.option', $store, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/fieldtypes.php b/admin/models/fields/fieldtypes.php index 903356048..9614cfaab 100644 --- a/admin/models/fields/fieldtypes.php +++ b/admin/models/fields/fieldtypes.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldFieldtypes extends JFormFieldList /** * The fieldtypes field type. * - * @var string + * @var string */ public $type = 'fieldtypes'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create fieldtype - if ($user->authorise('fieldtype.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('fieldtype.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit fieldtype - if ($user->authorise('fieldtype.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('fieldtype.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,7 +139,7 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/filebehaviour.php b/admin/models/fields/filebehaviour.php index 91ed024a9..9fcdff6cf 100644 --- a/admin/models/fields/filebehaviour.php +++ b/admin/models/fields/filebehaviour.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldFilebehaviour extends JFormFieldList /** * The filebehaviour field type. * - * @var string + * @var string */ public $type = 'filebehaviour'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/helpdocumentsfilterlocation.php b/admin/models/fields/helpdocumentsfilterlocation.php index 57acba003..51e1967d3 100644 --- a/admin/models/fields/helpdocumentsfilterlocation.php +++ b/admin/models/fields/helpdocumentsfilterlocation.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldHelpdocumentsfilterlocation extends JFormFieldList /** * The helpdocumentsfilterlocation field type. * - * @var string + * @var string */ public $type = 'helpdocumentsfilterlocation'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_LOCATION') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_LOCATION') . ' -'); - if ($results) + if ($_results) { // get help_documentsmodel - $model = ComponentbuilderHelper::getModel('help_documents'); - $results = array_unique($results); - foreach ($results as $location) + $_model = ComponentbuilderHelper::getModel('help_documents'); + $_results = array_unique($_results); + foreach ($_results as $location) { // Translate the location selection - $text = $model->selectionTranslation($location,'location'); + $_text = $_model->selectionTranslation($location,'location'); // Now add the location and its text to the options array - $_filter[] = JHtml::_('select.option', $location, JText::_($text)); + $_filter[] = Html::_('select.option', $location, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/helpdocumentsfiltertype.php b/admin/models/fields/helpdocumentsfiltertype.php index 7e9f5b9ea..069b42e72 100644 --- a/admin/models/fields/helpdocumentsfiltertype.php +++ b/admin/models/fields/helpdocumentsfiltertype.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldHelpdocumentsfiltertype extends JFormFieldList /** * The helpdocumentsfiltertype field type. * - * @var string + * @var string */ public $type = 'helpdocumentsfiltertype'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_TYPE') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_TYPE') . ' -'); - if ($results) + if ($_results) { // get help_documentsmodel - $model = ComponentbuilderHelper::getModel('help_documents'); - $results = array_unique($results); - foreach ($results as $type) + $_model = ComponentbuilderHelper::getModel('help_documents'); + $_results = array_unique($_results); + foreach ($_results as $type) { // Translate the type selection - $text = $model->selectionTranslation($type,'type'); + $_text = $_model->selectionTranslation($type,'type'); // Now add the type and its text to the options array - $_filter[] = JHtml::_('select.option', $type, JText::_($text)); + $_filter[] = Html::_('select.option', $type, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/interfacepowers.php b/admin/models/fields/interfacepowers.php index ac797c9a6..676603ef4 100644 --- a/admin/models/fields/interfacepowers.php +++ b/admin/models/fields/interfacepowers.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldInterfacepowers extends JFormFieldList /** * The interfacepowers field type. * - * @var string + * @var string */ public $type = 'interfacepowers'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create power - if ($user->authorise('power.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('power.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit power - if ($user->authorise('power.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('power.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,7 +139,7 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/joinfields.php b/admin/models/fields/joinfields.php index 4c7f4bfa2..033a9d40d 100644 --- a/admin/models/fields/joinfields.php +++ b/admin/models/fields/joinfields.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldJoinfields extends JFormFieldList /** * The joinfields field type. * - * @var string + * @var string */ public $type = 'joinfields'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/joomlacomponent.php b/admin/models/fields/joomlacomponent.php index 1ac208667..813ef12c6 100644 --- a/admin/models/fields/joomlacomponent.php +++ b/admin/models/fields/joomlacomponent.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldJoomlacomponent extends JFormFieldList /** * The joomlacomponent field type. * - * @var string + * @var string */ public $type = 'joomlacomponent'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create joomla_component - if ($user->authorise('joomla_component.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('joomla_component.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit joomla_component - if ($user->authorise('joomla_component.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('joomla_component.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,7 +139,7 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/joomlacomponents.php b/admin/models/fields/joomlacomponents.php index 512150b62..17b7bb1f4 100644 --- a/admin/models/fields/joomlacomponents.php +++ b/admin/models/fields/joomlacomponents.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldJoomlacomponents extends JFormFieldList /** * The joomlacomponents field type. * - * @var string + * @var string */ public $type = 'joomlacomponents'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/joomlacomponentsfilterauthor.php b/admin/models/fields/joomlacomponentsfilterauthor.php index 6931bc349..bfd1027fc 100644 --- a/admin/models/fields/joomlacomponentsfilterauthor.php +++ b/admin/models/fields/joomlacomponentsfilterauthor.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldJoomlacomponentsfilterauthor extends JFormFieldList /** * The joomlacomponentsfilterauthor field type. * - * @var string + * @var string */ public $type = 'joomlacomponentsfilterauthor'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,16 +53,16 @@ protected function getOptions() // Reset the query using our newly populated query object. $db->setQuery($query); - $results = $db->loadColumn(); - $_filter = array(); + $_results = $db->loadColumn(); + $_filter = []; - if ($results) + if ($_results) { - $results = array_unique($results); - foreach ($results as $author) + $_results = array_unique($_results); + foreach ($_results as $author) { // Now add the author and its text to the options array - $_filter[] = JHtml::_('select.option', $author, $author); + $_filter[] = Html::_('select.option', $author, $author); } } return $_filter; diff --git a/admin/models/fields/joomlacomponentsfiltercompanyname.php b/admin/models/fields/joomlacomponentsfiltercompanyname.php index 1b7c3feef..3d1fa0e41 100644 --- a/admin/models/fields/joomlacomponentsfiltercompanyname.php +++ b/admin/models/fields/joomlacomponentsfiltercompanyname.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldJoomlacomponentsfiltercompanyname extends JFormFieldList /** * The joomlacomponentsfiltercompanyname field type. * - * @var string + * @var string */ public $type = 'joomlacomponentsfiltercompanyname'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,16 +53,16 @@ protected function getOptions() // Reset the query using our newly populated query object. $db->setQuery($query); - $results = $db->loadColumn(); - $_filter = array(); + $_results = $db->loadColumn(); + $_filter = []; - if ($results) + if ($_results) { - $results = array_unique($results); - foreach ($results as $companyname) + $_results = array_unique($_results); + foreach ($_results as $companyname) { // Now add the companyname and its text to the options array - $_filter[] = JHtml::_('select.option', $companyname, $companyname); + $_filter[] = Html::_('select.option', $companyname, $companyname); } } return $_filter; diff --git a/admin/models/fields/joomlamodules.php b/admin/models/fields/joomlamodules.php index 18d825eeb..562e36211 100644 --- a/admin/models/fields/joomlamodules.php +++ b/admin/models/fields/joomlamodules.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldJoomlamodules extends JFormFieldList /** * The joomlamodules field type. * - * @var string + * @var string */ public $type = 'joomlamodules'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/joomlamodulesfiltertarget.php b/admin/models/fields/joomlamodulesfiltertarget.php index b6c2167ae..8b411b7e9 100644 --- a/admin/models/fields/joomlamodulesfiltertarget.php +++ b/admin/models/fields/joomlamodulesfiltertarget.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldJoomlamodulesfiltertarget extends JFormFieldList /** * The joomlamodulesfiltertarget field type. * - * @var string + * @var string */ public $type = 'joomlamodulesfiltertarget'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_TARGET_AREA') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_TARGET_AREA') . ' -'); - if ($results) + if ($_results) { // get joomla_modulesmodel - $model = ComponentbuilderHelper::getModel('joomla_modules'); - $results = array_unique($results); - foreach ($results as $target) + $_model = ComponentbuilderHelper::getModel('joomla_modules'); + $_results = array_unique($_results); + foreach ($_results as $target) { // Translate the target selection - $text = $model->selectionTranslation($target,'target'); + $_text = $_model->selectionTranslation($target,'target'); // Now add the target and its text to the options array - $_filter[] = JHtml::_('select.option', $target, JText::_($text)); + $_filter[] = Html::_('select.option', $target, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/joomlaplugingroups.php b/admin/models/fields/joomlaplugingroups.php index 16ca9052e..bb074a5db 100644 --- a/admin/models/fields/joomlaplugingroups.php +++ b/admin/models/fields/joomlaplugingroups.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldJoomlaplugingroups extends JFormFieldList /** * The joomlaplugingroups field type. * - * @var string + * @var string */ public $type = 'joomlaplugingroups'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create joomla_plugin_group - if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('core.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit joomla_plugin_group - if ($user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('core.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,7 +139,7 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/joomlaplugins.php b/admin/models/fields/joomlaplugins.php index 16462c06e..eafb5d2ff 100644 --- a/admin/models/fields/joomlaplugins.php +++ b/admin/models/fields/joomlaplugins.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldJoomlaplugins extends JFormFieldList /** * The joomlaplugins field type. * - * @var string + * @var string */ public $type = 'joomlaplugins'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create joomla_plugin - if ($user->authorise('joomla_plugin.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('joomla_plugin.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit joomla_plugin - if ($user->authorise('joomla_plugin.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('joomla_plugin.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,14 +139,14 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Get the databse object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select($db->quoteName(array('a.id','a.system_name','a.name','b.name','c.name'),array('id','plugin_system_name','name','class_extends_name','joomla_plugin_group_name'))); $query->from($db->quoteName('#__componentbuilder_joomla_plugin', 'a')); @@ -165,11 +169,13 @@ protected function getOptions() $options = array(); if ($items) { - $options[] = JHtml::_('select.option', '', 'Select a plugin'); + $options[] = Html::_('select.option', '', 'Select a plugin'); foreach($items as $item) { // set a full class name - $options[] = JHtml::_('select.option', $item->id, '( ' . $item->plugin_system_name . ' ) class Plg' . ucfirst($item->joomla_plugin_group_name) . $item->name . ' extends ' . $item->class_extends_name); + $group_name = $item->joomla_plugin_group_name ?? ''; + $name = $item->name ?? ''; + $options[] = Html::_('select.option', $item->id, '( ' . $item->plugin_system_name . ' ) class Plg' . $group_name . $name . ' extends ' . $item->class_extends_name); } } return $options; diff --git a/admin/models/fields/lang.php b/admin/models/fields/lang.php index 8bcf2534e..e3254208a 100644 --- a/admin/models/fields/lang.php +++ b/admin/models/fields/lang.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldLang extends JFormFieldList /** * The lang field type. * - * @var string + * @var string */ public $type = 'lang'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/layoutsfilteraddphpview.php b/admin/models/fields/layoutsfilteraddphpview.php index ce34d99c1..6cb0ba62c 100644 --- a/admin/models/fields/layoutsfilteraddphpview.php +++ b/admin/models/fields/layoutsfilteraddphpview.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldLayoutsfilteraddphpview extends JFormFieldList /** * The layoutsfilteraddphpview field type. * - * @var string + * @var string */ public $type = 'layoutsfilteraddphpview'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_ADD_PHP_CUSTOM_VIEW_SCRIPT') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_CUSTOM_VIEW_SCRIPT') . ' -'); - if ($results) + if ($_results) { // get layoutsmodel - $model = ComponentbuilderHelper::getModel('layouts'); - $results = array_unique($results); - foreach ($results as $add_php_view) + $_model = ComponentbuilderHelper::getModel('layouts'); + $_results = array_unique($_results); + foreach ($_results as $add_php_view) { // Translate the add_php_view selection - $text = $model->selectionTranslation($add_php_view,'add_php_view'); + $_text = $_model->selectionTranslation($add_php_view,'add_php_view'); // Now add the add_php_view and its text to the options array - $_filter[] = JHtml::_('select.option', $add_php_view, JText::_($text)); + $_filter[] = Html::_('select.option', $add_php_view, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/libconfigfield.php b/admin/models/fields/libconfigfield.php index 9e472da05..8ec0187a1 100644 --- a/admin/models/fields/libconfigfield.php +++ b/admin/models/fields/libconfigfield.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldLibconfigfield extends JFormFieldList /** * The libconfigfield field type. * - * @var string + * @var string */ public $type = 'libconfigfield'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/libraries.php b/admin/models/fields/libraries.php index 05ea39dfe..676ec298f 100644 --- a/admin/models/fields/libraries.php +++ b/admin/models/fields/libraries.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldLibraries extends JFormFieldList /** * The libraries field type. * - * @var string + * @var string */ public $type = 'libraries'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create library - if ($user->authorise('library.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('library.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit library - if ($user->authorise('library.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('library.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,7 +139,7 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/librariesfiltertarget.php b/admin/models/fields/librariesfiltertarget.php index 81483e192..6b3d5c9ba 100644 --- a/admin/models/fields/librariesfiltertarget.php +++ b/admin/models/fields/librariesfiltertarget.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldLibrariesfiltertarget extends JFormFieldList /** * The librariesfiltertarget field type. * - * @var string + * @var string */ public $type = 'librariesfiltertarget'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_TARGET_FOLDER') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_TARGET_FOLDER') . ' -'); - if ($results) + if ($_results) { // get librariesmodel - $model = ComponentbuilderHelper::getModel('libraries'); - $results = array_unique($results); - foreach ($results as $target) + $_model = ComponentbuilderHelper::getModel('libraries'); + $_results = array_unique($_results); + foreach ($_results as $target) { // Translate the target selection - $text = $model->selectionTranslation($target,'target'); + $_text = $_model->selectionTranslation($target,'target'); // Now add the target and its text to the options array - $_filter[] = JHtml::_('select.option', $target, JText::_($text)); + $_filter[] = Html::_('select.option', $target, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/librariesfiltertype.php b/admin/models/fields/librariesfiltertype.php index d522a9ce5..d7ef85004 100644 --- a/admin/models/fields/librariesfiltertype.php +++ b/admin/models/fields/librariesfiltertype.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldLibrariesfiltertype extends JFormFieldList /** * The librariesfiltertype field type. * - * @var string + * @var string */ public $type = 'librariesfiltertype'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_TYPE_BEHAVIOR') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_TYPE_BEHAVIOR') . ' -'); - if ($results) + if ($_results) { // get librariesmodel - $model = ComponentbuilderHelper::getModel('libraries'); - $results = array_unique($results); - foreach ($results as $type) + $_model = ComponentbuilderHelper::getModel('libraries'); + $_results = array_unique($_results); + foreach ($_results as $type) { // Translate the type selection - $text = $model->selectionTranslation($type,'type'); + $_text = $_model->selectionTranslation($type,'type'); // Now add the type and its text to the options array - $_filter[] = JHtml::_('select.option', $type, JText::_($text)); + $_filter[] = Html::_('select.option', $type, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/librariesx.php b/admin/models/fields/librariesx.php index a7132f23d..de07934d4 100644 --- a/admin/models/fields/librariesx.php +++ b/admin/models/fields/librariesx.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldLibrariesx extends JFormFieldList /** * The librariesx field type. * - * @var string + * @var string */ public $type = 'librariesx'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create library - if ($user->authorise('library.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('library.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit library - if ($user->authorise('library.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('library.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,7 +139,7 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/library.php b/admin/models/fields/library.php index cf5807804..fe9971fff 100644 --- a/admin/models/fields/library.php +++ b/admin/models/fields/library.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldLibrary extends JFormFieldList /** * The library field type. * - * @var string + * @var string */ public $type = 'library'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create library - if ($user->authorise('library.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('library.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit library - if ($user->authorise('library.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('library.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,7 +139,7 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/libraryfiles.php b/admin/models/fields/libraryfiles.php index 2d69510b9..fc16f6394 100644 --- a/admin/models/fields/libraryfiles.php +++ b/admin/models/fields/libraryfiles.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldLibraryfiles extends JFormFieldList /** * The libraryfiles field type. * - * @var string + * @var string */ public $type = 'libraryfiles'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/libraryreadonly.php b/admin/models/fields/libraryreadonly.php index 0f499f144..14916cf27 100644 --- a/admin/models/fields/libraryreadonly.php +++ b/admin/models/fields/libraryreadonly.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldLibraryreadonly extends JFormFieldList /** * The libraryreadonly field type. * - * @var string + * @var string */ public $type = 'libraryreadonly'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/linkedviewsorderfields.php b/admin/models/fields/linkedviewsorderfields.php index 7cfaaa593..66cee402a 100644 --- a/admin/models/fields/linkedviewsorderfields.php +++ b/admin/models/fields/linkedviewsorderfields.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldLinkedviewsorderfields extends JFormFieldList /** * The linkedviewsorderfields field type. * - * @var string + * @var string */ public $type = 'linkedviewsorderfields'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { @@ -87,8 +91,17 @@ protected function getOptions() foreach($items as $item) { // get the field name (TODO this could slow down the system so we will need to improve on this) - $field_name = ComponentbuilderHelper::safeFieldName(ComponentbuilderHelper::getBetween(json_decode($item->xml),'name="','"')); - $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]'); + if (isset($item->xml) && ComponentbuilderHelper::checkJson($item->xml)) + { + $field_xml = json_decode($item->xml); + $field_name = ComponentbuilderHelper::getBetween($field_xml,'name="','"'); + $field_name = ComponentbuilderHelper::safeFieldName($field_name); + $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]'); + } + else + { + $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ empty - ' . $item->type . ' ]'); + } } } return $options; diff --git a/admin/models/fields/listfields.php b/admin/models/fields/listfields.php index 6ae8b010b..92a5f8a7b 100644 --- a/admin/models/fields/listfields.php +++ b/admin/models/fields/listfields.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldListfields extends JFormFieldList /** * The listfields field type. * - * @var string + * @var string */ public $type = 'listfields'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { @@ -94,8 +98,17 @@ protected function getOptions() foreach($items as $item) { // get the field name (TODO this could slow down the system so we will need to improve on this) - $field_name = ComponentbuilderHelper::safeFieldName(ComponentbuilderHelper::getBetween(json_decode($item->xml),'name="','"')); - $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]'); + if (isset($item->xml) && ComponentbuilderHelper::checkJson($item->xml)) + { + $field_xml = json_decode($item->xml); + $field_name = ComponentbuilderHelper::getBetween($field_xml,'name="','"'); + $field_name = ComponentbuilderHelper::safeFieldName($field_name); + $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]'); + } + else + { + $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ empty - ' . $item->type . ' ]'); + } } } return $options; diff --git a/admin/models/fields/maingets.php b/admin/models/fields/maingets.php index f9fa41a56..19da923c1 100644 --- a/admin/models/fields/maingets.php +++ b/admin/models/fields/maingets.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldMaingets extends JFormFieldList /** * The maingets field type. * - * @var string + * @var string */ public $type = 'maingets'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create dynamic_get - if ($user->authorise('dynamic_get.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('dynamic_get.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit dynamic_get - if ($user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,7 +139,7 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/matchfield.php b/admin/models/fields/matchfield.php index 0b45bb643..1c77fc3f4 100644 --- a/admin/models/fields/matchfield.php +++ b/admin/models/fields/matchfield.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldMatchfield extends JFormFieldList /** * The matchfield field type. * - * @var string + * @var string */ public $type = 'matchfield'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/namespaces.php b/admin/models/fields/namespaces.php index 9dae55305..faba7709c 100644 --- a/admin/models/fields/namespaces.php +++ b/admin/models/fields/namespaces.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldNamespaces extends JFormFieldList /** * The namespaces field type. * - * @var string + * @var string */ public $type = 'namespaces'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/pluginsclassmethods.php b/admin/models/fields/pluginsclassmethods.php index 3f8c9a75d..162e7c7c8 100644 --- a/admin/models/fields/pluginsclassmethods.php +++ b/admin/models/fields/pluginsclassmethods.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,22 +28,22 @@ class JFormFieldPluginsclassmethods extends JFormFieldList /** * The pluginsclassmethods field type. * - * @var string + * @var string */ public $type = 'pluginsclassmethods'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Get the databse object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select($db->quoteName(array('a.id','a.name','a.visibility'),array('id','method_name','visibility'))); $query->from($db->quoteName('#__componentbuilder_class_method', 'a')); @@ -58,12 +62,17 @@ protected function getOptions() } $db->setQuery((string)$query); $items = $db->loadObjectList(); - $options = array(); + $options = []; if ($items) { - $options[] = JHtml::_('select.option', '', 'Select a method'); + $options[] = Html::_('select.option', '', 'Select a method'); foreach($items as $item) { + if (!isset($item->visibility)) + { + continue; + } + // we are using this code in more then one field JCB custom_code if ('method' === 'method') { @@ -73,7 +82,8 @@ protected function getOptions() { $select = $item->visibility . ' $' . $item->method_name; } - $options[] = JHtml::_('select.option', $item->id, $select); + + $options[] = Html::_('select.option', $item->id, $select); } } return $options; diff --git a/admin/models/fields/pluginsclassproperties.php b/admin/models/fields/pluginsclassproperties.php index c561bf278..cdfbd9283 100644 --- a/admin/models/fields/pluginsclassproperties.php +++ b/admin/models/fields/pluginsclassproperties.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,22 +28,22 @@ class JFormFieldPluginsclassproperties extends JFormFieldList /** * The pluginsclassproperties field type. * - * @var string + * @var string */ public $type = 'pluginsclassproperties'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Get the databse object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select($db->quoteName(array('a.id','a.name','a.visibility'),array('id','property_name','visibility'))); $query->from($db->quoteName('#__componentbuilder_class_property', 'a')); @@ -58,12 +62,17 @@ protected function getOptions() } $db->setQuery((string)$query); $items = $db->loadObjectList(); - $options = array(); + $options = []; if ($items) { - $options[] = JHtml::_('select.option', '', 'Select a property'); + $options[] = Html::_('select.option', '', 'Select a property'); foreach($items as $item) { + if (!isset($item->visibility)) + { + continue; + } + // we are using this code in more then one field JCB custom_code if ('method' === 'property') { @@ -73,7 +82,8 @@ protected function getOptions() { $select = $item->visibility . ' $' . $item->property_name; } - $options[] = JHtml::_('select.option', $item->id, $select); + + $options[] = Html::_('select.option', $item->id, $select); } } return $options; diff --git a/admin/models/fields/powers.php b/admin/models/fields/powers.php index 5dc827c77..e092696a9 100644 --- a/admin/models/fields/powers.php +++ b/admin/models/fields/powers.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldPowers extends JFormFieldList /** * The powers field type. * - * @var string + * @var string */ public $type = 'powers'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/powersclassmethods.php b/admin/models/fields/powersclassmethods.php new file mode 100644 index 000000000..7744cf169 --- /dev/null +++ b/admin/models/fields/powersclassmethods.php @@ -0,0 +1,91 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Powersclassmethods Form Field class for the Componentbuilder component + */ +class JFormFieldPowersclassmethods extends JFormFieldList +{ + /** + * The powersclassmethods field type. + * + * @var string + */ + public $type = 'powersclassmethods'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of Html options. + */ + protected function getOptions() + { + +// Get the user object. + $user = Factory::getUser(); + // Get the databse object. + $db = Factory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name','a.visibility'),array('id','method_name','visibility'))); + $query->from($db->quoteName('#__componentbuilder_class_method', 'a')); + $query->where($db->quoteName('a.published') . ' >= 1'); + $query->where($db->quoteName('a.extension_type') . ' = ' . $db->quote('powers')); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $columns = $db->getTableColumns('#__componentbuilder_class_method'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = []; + if ($items) + { + $options[] = Html::_('select.option', '', 'Select a method'); + foreach($items as $item) + { + if (!isset($item->visibility)) + { + continue; + } + + // we are using this code in more then one field JCB custom_code + if ('method' === 'method') + { + $select = $item->visibility . ' function ' . $item->method_name . '()'; + } + else + { + $select = $item->visibility . ' $' . $item->method_name; + } + + $options[] = Html::_('select.option', $item->id, $select); + } + } + return $options; + } +} diff --git a/admin/models/fields/powersclassproperties.php b/admin/models/fields/powersclassproperties.php new file mode 100644 index 000000000..6b6a86c18 --- /dev/null +++ b/admin/models/fields/powersclassproperties.php @@ -0,0 +1,91 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Powersclassproperties Form Field class for the Componentbuilder component + */ +class JFormFieldPowersclassproperties extends JFormFieldList +{ + /** + * The powersclassproperties field type. + * + * @var string + */ + public $type = 'powersclassproperties'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of Html options. + */ + protected function getOptions() + { + +// Get the user object. + $user = Factory::getUser(); + // Get the databse object. + $db = Factory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name','a.visibility'),array('id','property_name','visibility'))); + $query->from($db->quoteName('#__componentbuilder_class_property', 'a')); + $query->where($db->quoteName('a.published') . ' >= 1'); + $query->where($db->quoteName('a.extension_type') . ' = ' . $db->quote('powers')); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $columns = $db->getTableColumns('#__componentbuilder_class_property'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = []; + if ($items) + { + $options[] = Html::_('select.option', '', 'Select a property'); + foreach($items as $item) + { + if (!isset($item->visibility)) + { + continue; + } + + // we are using this code in more then one field JCB custom_code + if ('method' === 'property') + { + $select = $item->visibility . ' function ' . $item->property_name . '()'; + } + else + { + $select = $item->visibility . ' $' . $item->property_name; + } + + $options[] = Html::_('select.option', $item->id, $select); + } + } + return $options; + } +} diff --git a/admin/models/fields/powersfilterapproved.php b/admin/models/fields/powersfilterapproved.php new file mode 100644 index 000000000..8db77d3ab --- /dev/null +++ b/admin/models/fields/powersfilterapproved.php @@ -0,0 +1,75 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Powersfilterapproved Form Field class for the Componentbuilder component + */ +class JFormFieldPowersfilterapproved extends JFormFieldList +{ + /** + * The powersfilterapproved field type. + * + * @var string + */ + public $type = 'powersfilterapproved'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of Html options. + */ + protected function getOptions() + { + // Get a db connection. + $db = Factory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('approved')); + $query->from($db->quoteName('#__componentbuilder_power')); + $query->order($db->quoteName('approved') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_SUPER_POWER') . ' -'); + + if ($_results) + { + // get powersmodel + $_model = ComponentbuilderHelper::getModel('powers'); + $_results = array_unique($_results); + foreach ($_results as $approved) + { + // Translate the approved selection + $_text = $_model->selectionTranslation($approved,'approved'); + // Now add the approved and its text to the options array + $_filter[] = Html::_('select.option', $approved, Text::_($_text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/powersfilterpowerversion.php b/admin/models/fields/powersfilterpowerversion.php deleted file mode 100644 index e594e102d..000000000 --- a/admin/models/fields/powersfilterpowerversion.php +++ /dev/null @@ -1,67 +0,0 @@ - - * @git Joomla Component Builder - * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Powersfilterpowerversion Form Field class for the Componentbuilder component - */ -class JFormFieldPowersfilterpowerversion extends JFormFieldList -{ - /** - * The powersfilterpowerversion field type. - * - * @var string - */ - public $type = 'powersfilterpowerversion'; - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - protected function getOptions() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('power_version')); - $query->from($db->quoteName('#__componentbuilder_power')); - $query->order($db->quoteName('power_version') . ' 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') . ' -'); - - if ($results) - { - $results = array_unique($results); - foreach ($results as $power_version) - { - // Now add the power_version and its text to the options array - $_filter[] = JHtml::_('select.option', $power_version, $power_version); - } - } - return $_filter; - } -} diff --git a/admin/models/fields/powersfiltertype.php b/admin/models/fields/powersfiltertype.php index 5fa45b714..03eb46f25 100644 --- a/admin/models/fields/powersfiltertype.php +++ b/admin/models/fields/powersfiltertype.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldPowersfiltertype extends JFormFieldList /** * The powersfiltertype field type. * - * @var string + * @var string */ public $type = 'powersfiltertype'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,20 +53,20 @@ protected function getOptions() // Reset the query using our newly populated query object. $db->setQuery($query); - $results = $db->loadColumn(); - $_filter = array(); + $_results = $db->loadColumn(); + $_filter = []; - if ($results) + if ($_results) { // get powersmodel - $model = ComponentbuilderHelper::getModel('powers'); - $results = array_unique($results); - foreach ($results as $type) + $_model = ComponentbuilderHelper::getModel('powers'); + $_results = array_unique($_results); + foreach ($_results as $type) { // Translate the type selection - $text = $model->selectionTranslation($type,'type'); + $_text = $_model->selectionTranslation($type,'type'); // Now add the type and its text to the options array - $_filter[] = JHtml::_('select.option', $type, JText::_($text)); + $_filter[] = Html::_('select.option', $type, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/servers.php b/admin/models/fields/servers.php index 5b24aa028..8e9ca29a3 100644 --- a/admin/models/fields/servers.php +++ b/admin/models/fields/servers.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldServers extends JFormFieldList /** * The servers field type. * - * @var string + * @var string */ public $type = 'servers'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create server - if ($user->authorise('server.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('server.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit server - if ($user->authorise('server.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('server.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,7 +139,7 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/serversfiltername.php b/admin/models/fields/serversfiltername.php index 5626732d4..628715fd0 100644 --- a/admin/models/fields/serversfiltername.php +++ b/admin/models/fields/serversfiltername.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldServersfiltername extends JFormFieldList /** * The serversfiltername field type. * - * @var string + * @var string */ public $type = 'serversfiltername'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,17 +53,17 @@ protected function getOptions() // 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_NAME') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_NAME') . ' -'); - if ($results) + if ($_results) { - $results = array_unique($results); - foreach ($results as $name) + $_results = array_unique($_results); + foreach ($_results as $name) { // Now add the name and its text to the options array - $_filter[] = JHtml::_('select.option', $name, $name); + $_filter[] = Html::_('select.option', $name, $name); } } return $_filter; diff --git a/admin/models/fields/serversfilterprotocol.php b/admin/models/fields/serversfilterprotocol.php index 01fce0c8e..c3a43425e 100644 --- a/admin/models/fields/serversfilterprotocol.php +++ b/admin/models/fields/serversfilterprotocol.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldServersfilterprotocol extends JFormFieldList /** * The serversfilterprotocol field type. * - * @var string + * @var string */ public $type = 'serversfilterprotocol'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_PROTOCOL') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_PROTOCOL') . ' -'); - if ($results) + if ($_results) { // get serversmodel - $model = ComponentbuilderHelper::getModel('servers'); - $results = array_unique($results); - foreach ($results as $protocol) + $_model = ComponentbuilderHelper::getModel('servers'); + $_results = array_unique($_results); + foreach ($_results as $protocol) { // Translate the protocol selection - $text = $model->selectionTranslation($protocol,'protocol'); + $_text = $_model->selectionTranslation($protocol,'protocol'); // Now add the protocol and its text to the options array - $_filter[] = JHtml::_('select.option', $protocol, JText::_($text)); + $_filter[] = Html::_('select.option', $protocol, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/siteviewfolderlist.php b/admin/models/fields/siteviewfolderlist.php index 33be3f1b2..f95005098 100644 --- a/admin/models/fields/siteviewfolderlist.php +++ b/admin/models/fields/siteviewfolderlist.php @@ -12,6 +12,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\StringHelper; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,33 +29,36 @@ class JFormFieldSiteviewfolderlist extends JFormFieldList /** * The siteviewfolderlist field type. * - * @var string + * @var string */ public $type = 'siteviewfolderlist'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // get custom folder files - $localfolder = JPATH_COMPONENT_SITE.'/views'; + $localfolders = []; + $localfolders[] = JPATH_SITE . '/components/com_componentbuilder/views'; + $localfolders[] = JPATH_SITE . '/components/com_componentbuilder/src/View'; // set the default - $options = array(); - // import all needed classes - jimport('joomla.filesystem.folder'); + $options = []; // now check if there are files in the folder - if (JFolder::exists($localfolder) && $folders = JFolder::folders($localfolder)) + foreach ($localfolders as $localfolder) { - if ($this->multiple === false) - { - $options[] = JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_SELECT_A_SITE_VIEW')); - } - foreach ($folders as $folder) + if (is_dir($localfolder) && $folders = \Joomla\Filesystem\Folder::folders($localfolder)) { - $options[] = JHtml::_('select.option', $folder, ComponentbuilderHelper::safeString($folder, 'W')); + if ($this->multiple === false) + { + $options[] = Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_SELECT_A_SITE_VIEW')); + } + foreach ($folders as $folder) + { + $options[] = Html::_('select.option', $folder, StringHelper::safe($folder, 'W')); + } } } return $options; diff --git a/admin/models/fields/siteviews.php b/admin/models/fields/siteviews.php index c8c643647..72cafe9be 100644 --- a/admin/models/fields/siteviews.php +++ b/admin/models/fields/siteviews.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,34 +28,38 @@ class JFormFieldSiteviews extends JFormFieldList /** * The siteviews field type. * - * @var string + * @var string */ public $type = 'siteviews'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - $query->select($db->quoteName(array('a.id','a.system_name'),array('id','siteview_system_name'))); - $query->from($db->quoteName('#__componentbuilder_site_view', 'a')); - $query->where($db->quoteName('a.published') . ' >= 1'); - $query->order('a.system_name ASC'); - $db->setQuery((string)$query); - $items = $db->loadObjectList(); - $options = array(); - if ($items) - { - $options[] = JHtml::_('select.option', '', 'Select an option'); - foreach($items as $item) - { - $options[] = JHtml::_('select.option', $item->id, $item->siteview_system_name); - } - } + // Get the database object. + $db = Factory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.system_name'),array('id','siteview_system_name'))); + $query->from($db->quoteName('#__componentbuilder_site_view', 'a')); + $query->where($db->quoteName('a.published') . ' >= 1'); + $query->order('a.system_name ASC'); + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = []; + if ($items) + { + if ($this->multiple === false) + { + $options[] = Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION')); + } + foreach($items as $item) + { + $options[] = Html::_('select.option', $item->id, $item->siteview_system_name); + } + } return $options; } } diff --git a/admin/models/fields/siteviewsfilteraddcustombutton.php b/admin/models/fields/siteviewsfilteraddcustombutton.php index 20551f03b..5c5f02af0 100644 --- a/admin/models/fields/siteviewsfilteraddcustombutton.php +++ b/admin/models/fields/siteviewsfilteraddcustombutton.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldSiteviewsfilteraddcustombutton extends JFormFieldList /** * The siteviewsfilteraddcustombutton field type. * - * @var string + * @var string */ public $type = 'siteviewsfilteraddcustombutton'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_ADD_CUSTOM_BUTTONS') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_CUSTOM_BUTTONS') . ' -'); - if ($results) + if ($_results) { // get site_viewsmodel - $model = ComponentbuilderHelper::getModel('site_views'); - $results = array_unique($results); - foreach ($results as $add_custom_button) + $_model = ComponentbuilderHelper::getModel('site_views'); + $_results = array_unique($_results); + foreach ($_results as $add_custom_button) { // Translate the add_custom_button selection - $text = $model->selectionTranslation($add_custom_button,'add_custom_button'); + $_text = $_model->selectionTranslation($add_custom_button,'add_custom_button'); // Now add the add_custom_button and its text to the options array - $_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($text)); + $_filter[] = Html::_('select.option', $add_custom_button, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/siteviewsfilteraddphpajax.php b/admin/models/fields/siteviewsfilteraddphpajax.php index c8f17b499..474be96f7 100644 --- a/admin/models/fields/siteviewsfilteraddphpajax.php +++ b/admin/models/fields/siteviewsfilteraddphpajax.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldSiteviewsfilteraddphpajax extends JFormFieldList /** * The siteviewsfilteraddphpajax field type. * - * @var string + * @var string */ public $type = 'siteviewsfilteraddphpajax'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_ADD_PHP_AJAX') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_AJAX') . ' -'); - if ($results) + if ($_results) { // get site_viewsmodel - $model = ComponentbuilderHelper::getModel('site_views'); - $results = array_unique($results); - foreach ($results as $add_php_ajax) + $_model = ComponentbuilderHelper::getModel('site_views'); + $_results = array_unique($_results); + foreach ($_results as $add_php_ajax) { // Translate the add_php_ajax selection - $text = $model->selectionTranslation($add_php_ajax,'add_php_ajax'); + $_text = $_model->selectionTranslation($add_php_ajax,'add_php_ajax'); // Now add the add_php_ajax and its text to the options array - $_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($text)); + $_filter[] = Html::_('select.option', $add_php_ajax, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/snippets.php b/admin/models/fields/snippets.php index d3cddf9f8..ab0876784 100644 --- a/admin/models/fields/snippets.php +++ b/admin/models/fields/snippets.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,7 +28,7 @@ class JFormFieldSnippets extends JFormFieldList /** * The snippets field type. * - * @var string + * @var string */ public $type = 'snippets'; @@ -48,7 +52,7 @@ protected function getInput() $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -64,7 +68,7 @@ protected function getInput() $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -77,20 +81,20 @@ protected function getInput() $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create snippet - if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('core.create', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit snippet - if ($user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('core.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -123,7 +127,7 @@ function ".$button_code_name."Button(value) { if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
    ' .$html . implode('',$button).'
    '; @@ -135,7 +139,7 @@ function ".$button_code_name."Button(value) { /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/snippettype.php b/admin/models/fields/snippettype.php index 50cd02bb0..642cbc7ca 100644 --- a/admin/models/fields/snippettype.php +++ b/admin/models/fields/snippettype.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldSnippettype extends JFormFieldList /** * The snippettype field type. * - * @var string + * @var string */ public $type = 'snippettype'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/superpowerpaths.php b/admin/models/fields/superpowerpaths.php new file mode 100644 index 000000000..692d55a65 --- /dev/null +++ b/admin/models/fields/superpowerpaths.php @@ -0,0 +1,101 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\Component\Helper; +jimport('joomla.form.helper'); +\JFormHelper::loadFieldClass('checkboxes'); + +/** + * 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); + } +} diff --git a/admin/models/fields/targetfields.php b/admin/models/fields/targetfields.php index 3ad0d1644..a1f58f212 100644 --- a/admin/models/fields/targetfields.php +++ b/admin/models/fields/targetfields.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldTargetfields extends JFormFieldList /** * The targetfields field type. * - * @var string + * @var string */ public $type = 'targetfields'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/templatesfilteraddphpview.php b/admin/models/fields/templatesfilteraddphpview.php index 717e81443..ac59ede07 100644 --- a/admin/models/fields/templatesfilteraddphpview.php +++ b/admin/models/fields/templatesfilteraddphpview.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,19 +28,19 @@ class JFormFieldTemplatesfilteraddphpview extends JFormFieldList /** * The templatesfilteraddphpview field type. * - * @var string + * @var string */ public $type = 'templatesfilteraddphpview'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -49,21 +53,21 @@ protected function getOptions() // 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_ADD_PHP_CUSTOM_VIEW_SCRIPT') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_CUSTOM_VIEW_SCRIPT') . ' -'); - if ($results) + if ($_results) { // get templatesmodel - $model = ComponentbuilderHelper::getModel('templates'); - $results = array_unique($results); - foreach ($results as $add_php_view) + $_model = ComponentbuilderHelper::getModel('templates'); + $_results = array_unique($_results); + foreach ($_results as $add_php_view) { // Translate the add_php_view selection - $text = $model->selectionTranslation($add_php_view,'add_php_view'); + $_text = $_model->selectionTranslation($add_php_view,'add_php_view'); // Now add the add_php_view and its text to the options array - $_filter[] = JHtml::_('select.option', $add_php_view, JText::_($text)); + $_filter[] = Html::_('select.option', $add_php_view, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/viewtabs.php b/admin/models/fields/viewtabs.php index 38b3fff7b..9a2cd81bc 100644 --- a/admin/models/fields/viewtabs.php +++ b/admin/models/fields/viewtabs.php @@ -12,6 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -24,14 +28,14 @@ class JFormFieldViewtabs extends JFormFieldList /** * The viewtabs field type. * - * @var string + * @var string */ public $type = 'viewtabs'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fieldtype.php b/admin/models/fieldtype.php index e10d23415..07df37b8b 100644 --- a/admin/models/fieldtype.php +++ b/admin/models/fieldtype.php @@ -12,10 +12,23 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Fieldtype Admin Model @@ -58,6 +71,8 @@ class ComponentbuilderModelFieldtype extends AdminModel 'indexes', 'null_switch', 'store', + 'basic_encryption_note', + 'medium_encryption_note', 'note_whmcs_encryption' ) ) @@ -84,16 +99,16 @@ class ComponentbuilderModelFieldtype extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'fieldtype', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'fieldtype', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -125,17 +140,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'fieldtype__'.$id); ComponentbuilderHelper::set('fieldtype__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -144,7 +158,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -199,17 +213,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'fieldtype__'.$id); ComponentbuilderHelper::set('fieldtype__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -228,7 +241,7 @@ public function getItem($pk = null) } $item->properties = $bucket; // be sure to update the value in the db - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; $objectUpdate->properties = json_encode($bucket); $this->db->updateObject('#__componentbuilder_fieldtype', $objectUpdate, 'id'); @@ -244,12 +257,12 @@ public function getItem($pk = null) * * @return mixed An array of data items on success, false on failure. */ - public function getVycfields() + public function getVxtfields() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -271,7 +284,7 @@ public function getVycfields() { // 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 +300,7 @@ public function getVycfields() $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; @@ -300,7 +313,7 @@ public function getVycfields() } } // now check if we have IDs - if ($get_ids && ComponentbuilderHelper::checkArray($field_ids)) + if ($get_ids && UtilitiesArrayHelper::check($field_ids)) { $query->where($db->quoteName('a.id') . ' IN (' . implode(',', $field_ids) . ')'); } @@ -334,7 +347,7 @@ public function getVycfields() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -360,12 +373,12 @@ public function getVycfields() $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -381,18 +394,18 @@ public function getVycfields() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { // convert datatype - $item->datatype = $this->selectionTranslationVycfields($item->datatype, 'datatype'); + $item->datatype = $this->selectionTranslationVxtfields($item->datatype, 'datatype'); // convert indexes - $item->indexes = $this->selectionTranslationVycfields($item->indexes, 'indexes'); + $item->indexes = $this->selectionTranslationVxtfields($item->indexes, 'indexes'); // convert null_switch - $item->null_switch = $this->selectionTranslationVycfields($item->null_switch, 'null_switch'); + $item->null_switch = $this->selectionTranslationVxtfields($item->null_switch, 'null_switch'); // convert store - $item->store = $this->selectionTranslationVycfields($item->store, 'store'); + $item->store = $this->selectionTranslationVxtfields($item->store, 'store'); } } @@ -404,9 +417,9 @@ public function getVycfields() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ - public function selectionTranslationVycfields($value,$name) + public function selectionTranslationVxtfields($value,$name) { // Array of datatype language strings if ($name === 'datatype') @@ -433,7 +446,7 @@ public function selectionTranslationVycfields($value,$name) 'DOUBLE' => 'COM_COMPONENTBUILDER_FIELD_DOUBLE' ); // Now check if value is found in this array - if (isset($datatypeArray[$value]) && ComponentbuilderHelper::checkString($datatypeArray[$value])) + if (isset($datatypeArray[$value]) && UtilitiesStringHelper::check($datatypeArray[$value])) { return $datatypeArray[$value]; } @@ -447,7 +460,7 @@ public function selectionTranslationVycfields($value,$name) 0 => 'COM_COMPONENTBUILDER_FIELD_NONE' ); // Now check if value is found in this array - if (isset($indexesArray[$value]) && ComponentbuilderHelper::checkString($indexesArray[$value])) + if (isset($indexesArray[$value]) && UtilitiesStringHelper::check($indexesArray[$value])) { return $indexesArray[$value]; } @@ -460,7 +473,7 @@ public function selectionTranslationVycfields($value,$name) 'NOT NULL' => 'COM_COMPONENTBUILDER_FIELD_NOT_NULL' ); // Now check if value is found in this array - if (isset($null_switchArray[$value]) && ComponentbuilderHelper::checkString($null_switchArray[$value])) + if (isset($null_switchArray[$value]) && UtilitiesStringHelper::check($null_switchArray[$value])) { return $null_switchArray[$value]; } @@ -478,7 +491,7 @@ public function selectionTranslationVycfields($value,$name) 6 => 'COM_COMPONENTBUILDER_FIELD_EXPERT_MODE_CUSTOM' ); // Now check if value is found in this array - if (isset($storeArray[$value]) && ComponentbuilderHelper::checkString($storeArray[$value])) + if (isset($storeArray[$value]) && UtilitiesStringHelper::check($storeArray[$value])) { return $storeArray[$value]; } @@ -497,7 +510,7 @@ public function selectionTranslationVycfields($value,$name) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -524,7 +537,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -537,7 +550,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -599,7 +612,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con // Only load the GUID if new item (or empty) if (0 == $id || !($val = $form->getValue('guid'))) { - $form->setValue('guid', null, ComponentbuilderHelper::GUID()); + $form->setValue('guid', null, GuidHelper::get()); } return $form; @@ -608,13 +621,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/fieldtype.js'; } - + /** * Method to test whether a record can be deleted. * @@ -633,7 +646,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('fieldtype.delete', 'com_componentbuilder.fieldtype.' . (int) $record->id); } @@ -651,8 +664,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -663,31 +676,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('fieldtype.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('fieldtype.edit', 'com_componentbuilder.fieldtype.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('fieldtype.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -695,19 +708,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -719,7 +732,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_fieldtype')); @@ -734,7 +747,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -749,10 +762,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.fieldtype.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.fieldtype.data', []); if (empty($data)) { @@ -780,7 +793,7 @@ protected function loadFormData() public function validate($form, $data, $group = null) { // check if the not_required field is set - if (isset($data['not_required']) && ComponentbuilderHelper::checkString($data['not_required'])) + if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required'])) { $requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = array_unique($requiredFields); @@ -788,7 +801,7 @@ public function validate($form, $data, $group = null) foreach ($requiredFields as $requiredField) { // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) + if (UtilitiesStringHelper::check($requiredField)) { // change to false $form->setFieldAttribute($requiredField, 'required', 'false'); @@ -811,7 +824,7 @@ protected function getUniqueFields() { return array('guid'); } - + /** * Method to delete one or more records. * @@ -827,7 +840,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -847,10 +860,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -876,30 +889,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('fieldtype'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('fieldtype'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -936,8 +949,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -963,7 +975,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('fieldtype'); @@ -1004,7 +1016,7 @@ protected function batchCopy($values, $pks, $contexts) unset($values['category']); } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -1017,7 +1029,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('fieldtype.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -1033,13 +1045,13 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -1051,7 +1063,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1115,7 +1127,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('fieldtype'); @@ -1123,7 +1135,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('fieldtype.edit') && !$this->canDo->get('fieldtype.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1156,7 +1168,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('fieldtype.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1172,13 +1184,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -1222,7 +1234,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -1234,15 +1246,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -1252,20 +1264,20 @@ public function save($data) if (empty($data['guid']) && $data['id'] > 0) { // get the existing one - $data['guid'] = (string) ComponentbuilderHelper::getVar('fieldtype', $data['id'], 'id', 'guid'); + $data['guid'] = (string) GetHelper::var('fieldtype', $data['id'], 'id', 'guid'); } + // Set the GUID if empty or not valid - while (!ComponentbuilderHelper::validGUID($data['guid'], "fieldtype", $data['id'])) + while (!GuidHelper::valid($data['guid'], "fieldtype", $data['id'])) { // must always be set - $data['guid'] = (string) ComponentbuilderHelper::GUID(); - } - + $data['guid'] = (string) GuidHelper::get(); + } // Set the properties items to data. if (isset($data['properties']) && is_array($data['properties'])) { - $properties = new JRegistry; + $properties = new Registry; $properties->loadArray($data['properties']); $data['properties'] = (string) $properties; } @@ -1274,11 +1286,11 @@ public function save($data) // Set the empty properties to data $data['properties'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1288,7 +1300,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1296,14 +1308,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1316,7 +1328,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1342,7 +1353,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/fieldtypes.php b/admin/models/fieldtypes.php index 38c42c195..9e6691599 100644 --- a/admin/models/fieldtypes.php +++ b/admin/models/fieldtypes.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Fieldtypes List Model */ class ComponentbuilderModelFieldtypes extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -55,7 +63,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -118,7 +126,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -133,12 +141,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -152,22 +160,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -198,7 +206,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -233,7 +241,7 @@ protected function getListQuery() if (is_numeric($categoryId)) { - $cat_tbl = JTable::getInstance('Category', 'JTable'); + $cat_tbl = Table::getInstance('Category', 'JTable'); $cat_tbl->load($categoryId); $rgt = $cat_tbl->rgt; $lft = $cat_tbl->lft; @@ -250,10 +258,12 @@ protected function getListQuery() // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -271,17 +281,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -325,7 +335,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -345,7 +355,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -363,16 +373,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_fieldtype"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -381,7 +391,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -396,13 +406,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -411,37 +421,37 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.modified_by'); // Check if the value is an array $_category = $this->getState('filter.category'); - if (ComponentbuilderHelper::checkArray($_category)) + if (UtilitiesArrayHelper::check($_category)) { $id .= ':' . implode(':', $_category); } // Check if this is only an number or string elseif (is_numeric($_category) - || ComponentbuilderHelper::checkString($_category)) + || StringHelper::check($_category)) { $id .= ':' . $_category; } // Check if the value is an array $_category_id = $this->getState('filter.category_id'); - if (ComponentbuilderHelper::checkArray($_category_id)) + if (UtilitiesArrayHelper::check($_category_id)) { $id .= ':' . implode(':', $_category_id); } // Check if this is only an number or string elseif (is_numeric($_category_id) - || ComponentbuilderHelper::checkString($_category_id)) + || StringHelper::check($_category_id)) { $id .= ':' . $_category_id; } // Check if the value is an array $_catid = $this->getState('filter.catid'); - if (ComponentbuilderHelper::checkArray($_catid)) + if (UtilitiesArrayHelper::check($_catid)) { $id .= ':' . implode(':', $_catid); } // Check if this is only an number or string elseif (is_numeric($_catid) - || ComponentbuilderHelper::checkString($_catid)) + || StringHelper::check($_catid)) { $id .= ':' . $_catid; } @@ -454,19 +464,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -478,7 +487,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -499,7 +508,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/forms/admin_custom_tabs.xml b/admin/models/forms/admin_custom_tabs.xml index bf05ddcf6..5a4585468 100644 --- a/admin/models/forms/admin_custom_tabs.xml +++ b/admin/models/forms/admin_custom_tabs.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_VERSION_LABEL" description="COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -153,6 +154,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" @@ -183,7 +186,7 @@
    - +
    diff --git a/admin/models/forms/admin_fields.xml b/admin/models/forms/admin_fields.xml index 4e04676ee..db8ac40eb 100644 --- a/admin/models/forms/admin_fields.xml +++ b/admin/models/forms/admin_fields.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_ADMIN_FIELDS_VERSION_LABEL" description="COM_COMPONENTBUILDER_ADMIN_FIELDS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -302,7 +303,7 @@
    - +
    diff --git a/admin/models/forms/admin_fields_conditions.xml b/admin/models/forms/admin_fields_conditions.xml index c50f64a66..8bf3864e2 100644 --- a/admin/models/forms/admin_fields_conditions.xml +++ b/admin/models/forms/admin_fields_conditions.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_VERSION_LABEL" description="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -232,7 +233,7 @@
    - +
    diff --git a/admin/models/forms/admin_fields_relations.xml b/admin/models/forms/admin_fields_relations.xml index f6fc66bc0..e5fb924d2 100644 --- a/admin/models/forms/admin_fields_relations.xml +++ b/admin/models/forms/admin_fields_relations.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_VERSION_LABEL" description="COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -206,7 +207,7 @@
    - +
    diff --git a/admin/models/forms/admin_view.xml b/admin/models/forms/admin_view.xml index 294612635..2bf33d335 100644 --- a/admin/models/forms/admin_view.xml +++ b/admin/models/forms/admin_view.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_ADMIN_VIEW_VERSION_LABEL" description="COM_COMPONENTBUILDER_ADMIN_VIEW_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -454,7 +455,7 @@ name="source" label="COM_COMPONENTBUILDER_ADMIN_VIEW_SOURCE_LABEL" class="btn-group btn-group-yesno" - default="" + default="0" required="true">
    - +
    diff --git a/admin/models/forms/class_extends.xml b/admin/models/forms/class_extends.xml index 8861f9e1d..054e10921 100644 --- a/admin/models/forms/class_extends.xml +++ b/admin/models/forms/class_extends.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_CLASS_EXTENDS_VERSION_LABEL" description="COM_COMPONENTBUILDER_CLASS_EXTENDS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -102,6 +103,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" @@ -159,7 +162,7 @@ required="false" />
    - +
    diff --git a/admin/models/forms/class_method.xml b/admin/models/forms/class_method.xml index e1c210b54..b10f70547 100644 --- a/admin/models/forms/class_method.xml +++ b/admin/models/forms/class_method.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_CLASS_METHOD_VERSION_LABEL" description="COM_COMPONENTBUILDER_CLASS_METHOD_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -102,6 +103,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" @@ -220,7 +223,7 @@ autocomplete="on" />
    - +
    diff --git a/admin/models/forms/class_property.xml b/admin/models/forms/class_property.xml index 1d95e9cfb..29cba4f30 100644 --- a/admin/models/forms/class_property.xml +++ b/admin/models/forms/class_property.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_CLASS_PROPERTY_VERSION_LABEL" description="COM_COMPONENTBUILDER_CLASS_PROPERTY_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -102,6 +103,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" @@ -204,7 +207,7 @@ hint="COM_COMPONENTBUILDER_CLASS_PROPERTY_DEFAULT_HINT" />
    - +
    diff --git a/admin/models/forms/component_admin_views.xml b/admin/models/forms/component_admin_views.xml index d6bcfc2da..a7a22290d 100644 --- a/admin/models/forms/component_admin_views.xml +++ b/admin/models/forms/component_admin_views.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_VERSION_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -721,7 +722,7 @@
    - +
    diff --git a/admin/models/forms/component_config.xml b/admin/models/forms/component_config.xml index e4d4ec46c..ba3a0b5cc 100644 --- a/admin/models/forms/component_config.xml +++ b/admin/models/forms/component_config.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_COMPONENT_CONFIG_VERSION_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_CONFIG_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -174,7 +175,7 @@
    - +
    diff --git a/admin/models/forms/component_custom_admin_menus.xml b/admin/models/forms/component_custom_admin_menus.xml index fb7ad3a56..8753d54a4 100644 --- a/admin/models/forms/component_custom_admin_menus.xml +++ b/admin/models/forms/component_custom_admin_menus.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_VERSION_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -137,6 +138,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" @@ -226,7 +229,7 @@
    - +
    diff --git a/admin/models/forms/component_custom_admin_views.xml b/admin/models/forms/component_custom_admin_views.xml index 63f8e77a9..45f625a44 100644 --- a/admin/models/forms/component_custom_admin_views.xml +++ b/admin/models/forms/component_custom_admin_views.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_VERSION_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -646,7 +647,7 @@
    - +
    diff --git a/admin/models/forms/component_dashboard.xml b/admin/models/forms/component_dashboard.xml index 78160c848..c2471a5e2 100644 --- a/admin/models/forms/component_dashboard.xml +++ b/admin/models/forms/component_dashboard.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_VERSION_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -138,6 +139,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" @@ -190,7 +193,7 @@
    - +
    diff --git a/admin/models/forms/component_files_folders.xml b/admin/models/forms/component_files_folders.xml index d12e64442..0f158693b 100644 --- a/admin/models/forms/component_files_folders.xml +++ b/admin/models/forms/component_files_folders.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_VERSION_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -337,7 +338,7 @@
    - +
    diff --git a/admin/models/forms/component_modules.xml b/admin/models/forms/component_modules.xml index 1ba103160..bd8e7433b 100644 --- a/admin/models/forms/component_modules.xml +++ b/admin/models/forms/component_modules.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_COMPONENT_MODULES_VERSION_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_MODULES_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -162,7 +163,7 @@
    - +
    diff --git a/admin/models/forms/component_mysql_tweaks.xml b/admin/models/forms/component_mysql_tweaks.xml index 680ccd99d..dfce41c3d 100644 --- a/admin/models/forms/component_mysql_tweaks.xml +++ b/admin/models/forms/component_mysql_tweaks.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_VERSION_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -190,7 +191,7 @@
    - +
    diff --git a/admin/models/forms/component_placeholders.xml b/admin/models/forms/component_placeholders.xml index d6f0a341e..15bd404ee 100644 --- a/admin/models/forms/component_placeholders.xml +++ b/admin/models/forms/component_placeholders.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_VERSION_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -144,24 +145,25 @@ hint="COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_TARGET_HINT" autocomplete="off" /> - +
    - +
    diff --git a/admin/models/forms/component_plugins.xml b/admin/models/forms/component_plugins.xml index 8f1d50847..789eb0570 100644 --- a/admin/models/forms/component_plugins.xml +++ b/admin/models/forms/component_plugins.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_VERSION_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -162,7 +163,7 @@
    - +
    diff --git a/admin/models/forms/component_router.xml b/admin/models/forms/component_router.xml new file mode 100644 index 000000000..d82f36acd --- /dev/null +++ b/admin/models/forms/component_router.xml @@ -0,0 +1,274 @@ + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + + + + +
    + \ No newline at end of file diff --git a/admin/models/forms/component_site_views.xml b/admin/models/forms/component_site_views.xml index 50aaf46a8..b3db4c975 100644 --- a/admin/models/forms/component_site_views.xml +++ b/admin/models/forms/component_site_views.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_VERSION_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -137,7 +138,6 @@ description="COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_SITEVIEW_DESCRIPTION" class="fieldMedium" multiple="false" - default="" required="true" button="false" /> @@ -196,7 +196,7 @@
    - +
    diff --git a/admin/models/forms/component_updates.xml b/admin/models/forms/component_updates.xml index 50996472a..36a51e618 100644 --- a/admin/models/forms/component_updates.xml +++ b/admin/models/forms/component_updates.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_COMPONENT_UPDATES_VERSION_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_UPDATES_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -283,7 +284,7 @@
    - +
    diff --git a/admin/models/forms/custom_admin_view.xml b/admin/models/forms/custom_admin_view.xml index 0576f7735..50fa57b28 100644 --- a/admin/models/forms/custom_admin_view.xml +++ b/admin/models/forms/custom_admin_view.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_VERSION_LABEL" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -116,6 +117,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" @@ -338,8 +341,8 @@ name="custom_get" label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CUSTOM_GET_LABEL" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CUSTOM_GET_DESCRIPTION" + layout="joomla.form.field.list-fancy-select" multiple="true" - default="" />
    - +
    diff --git a/admin/models/forms/custom_code.xml b/admin/models/forms/custom_code.xml index af321b074..281013d2d 100644 --- a/admin/models/forms/custom_code.xml +++ b/admin/models/forms/custom_code.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_CUSTOM_CODE_VERSION_LABEL" description="COM_COMPONENTBUILDER_CUSTOM_CODE_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -161,6 +162,18 @@ + +
    - +
    diff --git a/admin/models/forms/dynamic_get.xml b/admin/models/forms/dynamic_get.xml index bf0b67278..cb338f5f4 100644 --- a/admin/models/forms/dynamic_get.xml +++ b/admin/models/forms/dynamic_get.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_DYNAMIC_GET_VERSION_LABEL" description="COM_COMPONENTBUILDER_DYNAMIC_GET_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -102,6 +103,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" @@ -149,6 +152,22 @@ + + - + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + - - - - - - - - - + + type="radio" + name="select_all" + label="COM_COMPONENTBUILDER_DYNAMIC_GET_SELECT_ALL_LABEL" + description="COM_COMPONENTBUILDER_DYNAMIC_GET_SELECT_ALL_DESCRIPTION" + class="btn-group btn-group-yesno" + default="0"> - - - + + - - - - - - - - - - - - - - - - - - - + - - - - + type="editor" + name="php_after_getitem" + label="COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_AFTER_GETITEM_LABEL" + description="COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_AFTER_GETITEM_DESCRIPTION" + width="100%" + height="450px" + cols="15" + rows="30" + buttons="no" + syntax="php" + editor="codemirror|none" + filter="raw" + validate="code" + /> COM_COMPONENTBUILDER_DYNAMIC_GET_NO - + - - - - + type="editor" + name="php_getlistquery" + label="COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_GETLISTQUERY_LABEL" + description="COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_GETLISTQUERY_DESCRIPTION" + width="100%" + height="450px" + cols="15" + rows="30" + buttons="no" + syntax="php" + editor="codemirror|none" + filter="raw" + validate="code" + /> - + - - - - + type="editor" + name="php_before_getitems" + label="COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_BEFORE_GETITEMS_LABEL" + description="COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_BEFORE_GETITEMS_DESCRIPTION" + width="100%" + height="450px" + cols="15" + rows="30" + buttons="no" + syntax="php" + editor="codemirror|none" + filter="raw" + validate="code" + /> - + - - - - + type="editor" + name="php_after_getitems" + label="COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_AFTER_GETITEMS_LABEL" + description="COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_AFTER_GETITEMS_DESCRIPTION" + width="100%" + height="450px" + cols="15" + rows="30" + buttons="no" + syntax="php" + editor="codemirror|none" + filter="raw" + validate="code" + /> - - - - - - + +
    - +
    diff --git a/admin/models/forms/field.xml b/admin/models/forms/field.xml index 21fc3b1c4..645cb6a71 100644 --- a/admin/models/forms/field.xml +++ b/admin/models/forms/field.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_FIELD_VERSION_LABEL" description="COM_COMPONENTBUILDER_FIELD_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -102,6 +103,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" @@ -237,21 +240,6 @@ description="COM_COMPONENTBUILDER_FIELD_CATID_DESCRIPTION" class="inputbox" /> - - - - + + + + COM_COMPONENTBUILDER_FIELD_OTHER - + + + - - - + - - + + + + + + COM_COMPONENTBUILDER_FIELD_NO - + COM_COMPONENTBUILDER_FIELD_NO - - + + COM_COMPONENTBUILDER_FIELD_NO - - + + COM_COMPONENTBUILDER_FIELD_NO - - + + - - + +
    - +
    diff --git a/admin/models/forms/fieldtype.xml b/admin/models/forms/fieldtype.xml index 2a94aef36..9121f27c6 100644 --- a/admin/models/forms/fieldtype.xml +++ b/admin/models/forms/fieldtype.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_FIELDTYPE_VERSION_LABEL" description="COM_COMPONENTBUILDER_FIELDTYPE_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -102,6 +103,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" @@ -205,20 +208,6 @@ - - + + - - + + COM_COMPONENTBUILDER_FIELDTYPE_OTHER + + + +
    - +
    diff --git a/admin/models/forms/filter_admin_views.xml b/admin/models/forms/filter_admin_views.xml index 57794b43e..b188dcca1 100644 --- a/admin/models/forms/filter_admin_views.xml +++ b/admin/models/forms/filter_admin_views.xml @@ -86,8 +86,8 @@ - - + + diff --git a/admin/models/forms/filter_components_routers.xml b/admin/models/forms/filter_components_routers.xml new file mode 100644 index 000000000..e4e603170 --- /dev/null +++ b/admin/models/forms/filter_components_routers.xml @@ -0,0 +1,86 @@ + +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    \ No newline at end of file diff --git a/admin/models/forms/filter_custom_codes.xml b/admin/models/forms/filter_custom_codes.xml index 4fd5fc0c6..e3073b578 100644 --- a/admin/models/forms/filter_custom_codes.xml +++ b/admin/models/forms/filter_custom_codes.xml @@ -86,6 +86,8 @@ + + diff --git a/admin/models/forms/filter_fields.xml b/admin/models/forms/filter_fields.xml index b626e5592..cbeda70c9 100644 --- a/admin/models/forms/filter_fields.xml +++ b/admin/models/forms/filter_fields.xml @@ -104,8 +104,8 @@ - - + + diff --git a/admin/models/forms/filter_help_documents.xml b/admin/models/forms/filter_help_documents.xml index cd8a0aa83..d025faa01 100644 --- a/admin/models/forms/filter_help_documents.xml +++ b/admin/models/forms/filter_help_documents.xml @@ -73,10 +73,10 @@ - - - - + + + + diff --git a/admin/models/forms/filter_joomla_components.xml b/admin/models/forms/filter_joomla_components.xml index 74fd0fc2d..e1d29ea4b 100644 --- a/admin/models/forms/filter_joomla_components.xml +++ b/admin/models/forms/filter_joomla_components.xml @@ -66,8 +66,8 @@ - - + + diff --git a/admin/models/forms/filter_joomla_powers.xml b/admin/models/forms/filter_joomla_powers.xml new file mode 100644 index 000000000..4f8f0170e --- /dev/null +++ b/admin/models/forms/filter_joomla_powers.xml @@ -0,0 +1,67 @@ + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    \ No newline at end of file diff --git a/admin/models/forms/filter_powers.xml b/admin/models/forms/filter_powers.xml index 6571e0783..173808595 100644 --- a/admin/models/forms/filter_powers.xml +++ b/admin/models/forms/filter_powers.xml @@ -39,16 +39,9 @@ onchange="this.form.submit();" /> - diff --git a/admin/models/forms/help_document.xml b/admin/models/forms/help_document.xml index a5833d977..edd989776 100644 --- a/admin/models/forms/help_document.xml +++ b/admin/models/forms/help_document.xml @@ -73,6 +73,7 @@ label="COM_COMPONENTBUILDER_HELP_DOCUMENT_VERSION_LABEL" description="COM_COMPONENTBUILDER_HELP_DOCUMENT_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -113,9 +114,9 @@ - + @@ -183,6 +185,7 @@ name="article" label="COM_COMPONENTBUILDER_HELP_DOCUMENT_ARTICLE_LABEL" class="list_class" + layout="joomla.form.field.list-fancy-select" multiple="false" default="0" required="true" @@ -228,7 +231,7 @@ hint="COM_COMPONENTBUILDER_HELP_DOCUMENT_ALIAS_HINT" />
    - +
    diff --git a/admin/models/forms/joomla_component.xml b/admin/models/forms/joomla_component.xml index 17abef7d8..51eecaf69 100644 --- a/admin/models/forms/joomla_component.xml +++ b/admin/models/forms/joomla_component.xml @@ -67,6 +67,7 @@ label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VERSION_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -156,55 +157,44 @@ message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_MESSAGE" hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_HINT" /> - + - - - + - - - + + + + + - + + + + + + + + + + + + + + + @@ -274,12 +325,28 @@ - + + + @@ -289,6 +356,27 @@ + + + + + + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO - + - - - - - - - + - + + type="radio" + name="add_backup_folder_path" + label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_BACKUP_FOLDER_PATH_LABEL" + description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_BACKUP_FOLDER_PATH_DESCRIPTION" + class="btn-group btn-group-yesno" + default=""> + + + + - + + type="list" + name="translation_tool" + label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_TRANSLATION_TOOL_LABEL" + class="list_class" + multiple="false" + default="0"> - + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NONE + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO - - + + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CUSTOM_USED_IN_CUSTOM_CODE - - - - - - - - + + + + - + - + - - + + - - + + - + - + - + - - - + + + + + + default="1" + required="true"> + + + + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO - - - + + + - - - + + + - - - - - - + default=""> - + + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_OVERRIDE - - - + + + - - - - - - - - - - - - - - + + + + + + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO - - + + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO - - + + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO - - + + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO - - + + + + + + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO + + + + + + + + + + + + + + + + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO - + - + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEFAULT + - + + + + + @@ -983,35 +1102,22 @@ - - - + + + - + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES + - - - - - + @@ -1040,13 +1146,13 @@ - - - + + + @@ -1058,11 +1164,11 @@ - + @@ -1086,11 +1192,11 @@ message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_KEY_MESSAGE" hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_KEY_HINT" /> - + @@ -1116,11 +1222,11 @@ message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JOOMLA_SOURCE_LINK_MESSAGE" hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JOOMLA_SOURCE_LINK_HINT" /> - + @@ -1146,22 +1252,6 @@ message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_BUY_LINK_MESSAGE" hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_BUY_LINK_HINT" /> - - - - - - - - COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO - - + + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_INTELLIGENT_ADDREMOVEIF + + + + - - - + + default="0" + required="true"> - + + default="0"> - - COM_COMPONENTBUILDER_JOOMLA_COMPONENT_OTHER - - + + - - + + - - + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + - + @@ -1469,23 +1665,19 @@ - + + default="0" + required="true"> - - - + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES + - + - - - - - + type="editor" + name="php_helper_both" + label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_BOTH_LABEL" + description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_BOTH_DESCRIPTION" + width="100%" + height="550px" + cols="15" + rows="80" + buttons="no" + syntax="php" + editor="codemirror|none" + filter="raw" + validate="code" + showon="add_php_helper_both:1" + />
    - +
    diff --git a/admin/models/forms/joomla_module.xml b/admin/models/forms/joomla_module.xml index e4e0579a1..4dde99b15 100644 --- a/admin/models/forms/joomla_module.xml +++ b/admin/models/forms/joomla_module.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_JOOMLA_MODULE_VERSION_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -197,7 +198,8 @@ name="addreadme" label="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDREADME_LABEL" class="btn-group btn-group-yesno" - default="0"> + default="0" + required="true"> @@ -324,6 +326,7 @@ label="COM_COMPONENTBUILDER_JOOMLA_MODULE_LIBRARIES_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_LIBRARIES_DESCRIPTION" class="list_class" + layout="joomla.form.field.list-fancy-select" multiple="true" default="0" required="false" @@ -355,6 +358,7 @@ class="list_class" multiple="false" default="0" + showon="add_sales_server:1" button="true" /> @@ -363,8 +367,8 @@ name="custom_get" label="COM_COMPONENTBUILDER_JOOMLA_MODULE_CUSTOM_GET_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_CUSTOM_GET_DESCRIPTION" + layout="joomla.form.field.list-fancy-select" multiple="true" - default="" /> @@ -399,6 +404,7 @@ editor="codemirror|none" filter="raw" validate="code" + showon="add_php_preflight_uninstall:1" /> @@ -838,6 +849,7 @@ editor="codemirror|none" filter="raw" validate="code" + showon="add_php_preflight_install:1" />
    - +
    diff --git a/admin/models/forms/joomla_module_files_folders_urls.xml b/admin/models/forms/joomla_module_files_folders_urls.xml index 751f2c2f0..b340c9544 100644 --- a/admin/models/forms/joomla_module_files_folders_urls.xml +++ b/admin/models/forms/joomla_module_files_folders_urls.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_VERSION_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -372,7 +373,7 @@
    - +
    diff --git a/admin/models/forms/joomla_module_updates.xml b/admin/models/forms/joomla_module_updates.xml index c79bf1d89..ac3a5ca05 100644 --- a/admin/models/forms/joomla_module_updates.xml +++ b/admin/models/forms/joomla_module_updates.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_VERSION_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -163,7 +164,7 @@
    - +
    diff --git a/admin/models/forms/joomla_plugin.xml b/admin/models/forms/joomla_plugin.xml index 4b587a0a3..f64c854d5 100644 --- a/admin/models/forms/joomla_plugin.xml +++ b/admin/models/forms/joomla_plugin.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_VERSION_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -194,6 +195,7 @@ class="list_class" multiple="false" default="0" + showon="add_sales_server:1" button="true" /> @@ -300,7 +302,8 @@ name="addreadme" label="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDREADME_LABEL" class="btn-group btn-group-yesno" - default="0"> + default="0" + required="true"> @@ -403,6 +406,7 @@ editor="codemirror|none" filter="raw" validate="code" + showon="add_php_postflight_install:1" /> @@ -833,6 +843,7 @@ editor="codemirror|none" filter="raw" validate="code" + showon="add_php_preflight_uninstall:1" />
    - +
    diff --git a/admin/models/forms/joomla_plugin_files_folders_urls.xml b/admin/models/forms/joomla_plugin_files_folders_urls.xml index 30c00dfe6..0738a4388 100644 --- a/admin/models/forms/joomla_plugin_files_folders_urls.xml +++ b/admin/models/forms/joomla_plugin_files_folders_urls.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_VERSION_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -372,7 +373,7 @@
    - +
    diff --git a/admin/models/forms/joomla_plugin_group.xml b/admin/models/forms/joomla_plugin_group.xml index 888298674..25272f623 100644 --- a/admin/models/forms/joomla_plugin_group.xml +++ b/admin/models/forms/joomla_plugin_group.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_VERSION_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -102,6 +103,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" @@ -119,7 +122,7 @@ button="true" />
    - +
    diff --git a/admin/models/forms/joomla_plugin_updates.xml b/admin/models/forms/joomla_plugin_updates.xml index 484d89fa1..23ef0760d 100644 --- a/admin/models/forms/joomla_plugin_updates.xml +++ b/admin/models/forms/joomla_plugin_updates.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_VERSION_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -163,7 +164,7 @@
    - +
    diff --git a/admin/models/forms/joomla_power.xml b/admin/models/forms/joomla_power.xml new file mode 100644 index 000000000..42db5b42c --- /dev/null +++ b/admin/models/forms/joomla_power.xml @@ -0,0 +1,210 @@ + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + + + + +
    + \ No newline at end of file diff --git a/admin/models/forms/language.xml b/admin/models/forms/language.xml index ff794c747..c519af5b5 100644 --- a/admin/models/forms/language.xml +++ b/admin/models/forms/language.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_LANGUAGE_VERSION_LABEL" description="COM_COMPONENTBUILDER_LANGUAGE_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -102,6 +103,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" @@ -122,7 +125,7 @@ hint="COM_COMPONENTBUILDER_LANGUAGE_LANGTAG_HINT" />
    - +
    diff --git a/admin/models/forms/language_translation.xml b/admin/models/forms/language_translation.xml index 65f492259..d1e208f1b 100644 --- a/admin/models/forms/language_translation.xml +++ b/admin/models/forms/language_translation.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_VERSION_LABEL" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -113,6 +114,7 @@ name="plugins" label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_PLUGINS_LABEL" class="list_class span12" + layout="joomla.form.field.list-fancy-select" multiple="true" default="0" button="true" @@ -123,6 +125,7 @@ name="modules" label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_MODULES_LABEL" class="list_class span12" + layout="joomla.form.field.list-fancy-select" multiple="true" default="0" button="true" @@ -133,6 +136,7 @@ name="components" label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_COMPONENTS_LABEL" class="list_class span12" + layout="joomla.form.field.list-fancy-select" multiple="true" default="0" button="false" @@ -166,6 +170,7 @@ name="language" label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_LANGUAGE_LABEL" class="list_class" + layout="joomla.form.field.list-fancy-select" multiple="false" default="en-GB" required="true" @@ -174,7 +179,7 @@
    - +
    diff --git a/admin/models/forms/layout.xml b/admin/models/forms/layout.xml index a12c4c786..8ee45a3d5 100644 --- a/admin/models/forms/layout.xml +++ b/admin/models/forms/layout.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_LAYOUT_VERSION_LABEL" description="COM_COMPONENTBUILDER_LAYOUT_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -102,6 +103,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" @@ -212,6 +215,7 @@ label="COM_COMPONENTBUILDER_LAYOUT_LIBRARIES_LABEL" description="COM_COMPONENTBUILDER_LAYOUT_LIBRARIES_DESCRIPTION" class="list_class" + layout="joomla.form.field.list-fancy-select" multiple="true" default="0" required="false" @@ -234,7 +238,7 @@ hint="COM_COMPONENTBUILDER_LAYOUT_ALIAS_HINT" />
    - +
    diff --git a/admin/models/forms/library.xml b/admin/models/forms/library.xml index d6050a295..cb0b41cd2 100644 --- a/admin/models/forms/library.xml +++ b/admin/models/forms/library.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_LIBRARY_VERSION_LABEL" description="COM_COMPONENTBUILDER_LIBRARY_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -102,6 +103,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" @@ -190,6 +193,7 @@ label="COM_COMPONENTBUILDER_LIBRARY_LIBRARIES_LABEL" description="COM_COMPONENTBUILDER_LIBRARY_LIBRARIES_DESCRIPTION" class="list_class" + layout="joomla.form.field.list-fancy-select" multiple="true" default="0" required="false" @@ -356,7 +360,7 @@
    - +
    diff --git a/admin/models/forms/library_config.xml b/admin/models/forms/library_config.xml index 9c006dc12..a83590a68 100644 --- a/admin/models/forms/library_config.xml +++ b/admin/models/forms/library_config.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_LIBRARY_CONFIG_VERSION_LABEL" description="COM_COMPONENTBUILDER_LIBRARY_CONFIG_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -161,7 +162,7 @@
    - +
    diff --git a/admin/models/forms/library_files_folders_urls.xml b/admin/models/forms/library_files_folders_urls.xml index a80f94a90..6c736112b 100644 --- a/admin/models/forms/library_files_folders_urls.xml +++ b/admin/models/forms/library_files_folders_urls.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_VERSION_LABEL" description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -374,7 +375,7 @@
    - +
    diff --git a/admin/models/forms/placeholder.xml b/admin/models/forms/placeholder.xml index ee814f5c8..f5f32f54b 100644 --- a/admin/models/forms/placeholder.xml +++ b/admin/models/forms/placeholder.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_PLACEHOLDER_VERSION_LABEL" description="COM_COMPONENTBUILDER_PLACEHOLDER_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -109,24 +110,25 @@ hint="COM_COMPONENTBUILDER_PLACEHOLDER_TARGET_HINT" autocomplete="off" /> - +
    - +
    diff --git a/admin/models/forms/power.xml b/admin/models/forms/power.xml index 1b98c8959..7ddba8904 100644 --- a/admin/models/forms/power.xml +++ b/admin/models/forms/power.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_POWER_VERSION_LABEL" description="COM_COMPONENTBUILDER_POWER_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -159,87 +160,78 @@ message="COM_COMPONENTBUILDER_POWER_POWER_VERSION_MESSAGE" hint="COM_COMPONENTBUILDER_POWER_POWER_VERSION_HINT" /> - + + + - - - - - - + -
    - +
    diff --git a/admin/models/forms/server.xml b/admin/models/forms/server.xml index b22cf1557..95df5777f 100644 --- a/admin/models/forms/server.xml +++ b/admin/models/forms/server.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_SERVER_VERSION_LABEL" description="COM_COMPONENTBUILDER_SERVER_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -102,6 +103,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" @@ -294,7 +297,7 @@ hint="COM_COMPONENTBUILDER_SERVER_USERNAME_HINT" />
    - +
    diff --git a/admin/models/forms/site_view.xml b/admin/models/forms/site_view.xml index 754be86b7..514cbfcad 100644 --- a/admin/models/forms/site_view.xml +++ b/admin/models/forms/site_view.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_SITE_VIEW_VERSION_LABEL" description="COM_COMPONENTBUILDER_SITE_VIEW_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -116,6 +117,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" @@ -310,8 +313,8 @@ name="custom_get" label="COM_COMPONENTBUILDER_SITE_VIEW_CUSTOM_GET_LABEL" description="COM_COMPONENTBUILDER_SITE_VIEW_CUSTOM_GET_DESCRIPTION" + layout="joomla.form.field.list-fancy-select" multiple="true" - default="" /> @@ -413,6 +416,7 @@ label="COM_COMPONENTBUILDER_SITE_VIEW_LIBRARIES_LABEL" description="COM_COMPONENTBUILDER_SITE_VIEW_LIBRARIES_DESCRIPTION" class="list_class" + layout="joomla.form.field.list-fancy-select" multiple="true" default="0" required="false" @@ -1137,6 +1141,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" @@ -1256,7 +1262,7 @@ validate="code" />
    - +
    diff --git a/admin/models/forms/snippet.xml b/admin/models/forms/snippet.xml index 31c799b11..60388c13a 100644 --- a/admin/models/forms/snippet.xml +++ b/admin/models/forms/snippet.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_SNIPPET_VERSION_LABEL" description="COM_COMPONENTBUILDER_SNIPPET_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -102,6 +103,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" @@ -270,7 +273,7 @@ hint="COM_COMPONENTBUILDER_SNIPPET_DESCRIPTION_HINT" />
    - +
    diff --git a/admin/models/forms/snippet_type.xml b/admin/models/forms/snippet_type.xml index 8f1a0dd7a..d22ecdaa9 100644 --- a/admin/models/forms/snippet_type.xml +++ b/admin/models/forms/snippet_type.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_SNIPPET_TYPE_VERSION_LABEL" description="COM_COMPONENTBUILDER_SNIPPET_TYPE_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -102,6 +103,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" @@ -124,7 +127,7 @@ hint="COM_COMPONENTBUILDER_SNIPPET_TYPE_DESCRIPTION_HINT" />
    - +
    diff --git a/admin/models/forms/template.xml b/admin/models/forms/template.xml index a2a4495ef..52bfea9bd 100644 --- a/admin/models/forms/template.xml +++ b/admin/models/forms/template.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_TEMPLATE_VERSION_LABEL" description="COM_COMPONENTBUILDER_TEMPLATE_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -102,6 +103,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" @@ -212,6 +215,7 @@ label="COM_COMPONENTBUILDER_TEMPLATE_LIBRARIES_LABEL" description="COM_COMPONENTBUILDER_TEMPLATE_LIBRARIES_DESCRIPTION" class="list_class" + layout="joomla.form.field.list-fancy-select" multiple="true" default="0" required="false" @@ -234,7 +238,7 @@ hint="COM_COMPONENTBUILDER_TEMPLATE_ALIAS_HINT" />
    - +
    diff --git a/admin/models/forms/validation_rule.xml b/admin/models/forms/validation_rule.xml index af0ad9b30..3f57187f5 100644 --- a/admin/models/forms/validation_rule.xml +++ b/admin/models/forms/validation_rule.xml @@ -81,6 +81,7 @@ label="COM_COMPONENTBUILDER_VALIDATION_RULE_VERSION_LABEL" description="COM_COMPONENTBUILDER_VALIDATION_RULE_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -124,6 +125,7 @@ label="COM_COMPONENTBUILDER_VALIDATION_RULE_INHERIT_LABEL" description="COM_COMPONENTBUILDER_VALIDATION_RULE_INHERIT_DESCRIPTION" class="list_class" + layout="joomla.form.field.list-fancy-select" multiple="false" default="0" required="false" @@ -143,7 +145,7 @@ required="true" />
    - +
    diff --git a/admin/models/get_snippets.php b/admin/models/get_snippets.php index f6c8dbb12..894207ddf 100644 --- a/admin/models/get_snippets.php +++ b/admin/models/get_snippets.php @@ -12,8 +12,13 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder List Model for Get_snippets @@ -42,19 +47,19 @@ class ComponentbuilderModelGet_snippets extends ListModel protected function getListQuery() { // Get the current user for authorisation checks - $this->user = JFactory::getUser(); + $this->user = Factory::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->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; - $this->initSet = true; + $this->initSet = true; // Make sure all records load, since no pagination allowed. $this->setState('list.limit', 0); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -88,12 +93,12 @@ protected function getListQuery() */ public function getItems() { - $user = JFactory::getUser(); + $user = Factory::getUser(); // check if this user has permission to access items if (!$user->authorise('get_snippets.access', 'com_componentbuilder')) { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('Not authorised!'), 'error'); + $app = Factory::getApplication(); + $app->enqueueMessage(Text::_('Not authorised!'), 'error'); // redirect away if not a correct (TODO for now we go to default view) $app->redirect('index.php?option=com_componentbuilder'); return false; @@ -102,15 +107,15 @@ public function getItems() $items = parent::getItems(); // Get the global params - $globalParams = JComponentHelper::getParams('com_componentbuilder', true); + $globalParams = ComponentHelper::getParams('com_componentbuilder', true); // Insure all item fields are adapted where needed. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { // Always create a slug for sef URL's - $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + $item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : ''); } } @@ -126,7 +131,7 @@ public function getItems() */ public function getUikitComp() { - if (isset($this->uikitComp) && ComponentbuilderHelper::checkArray($this->uikitComp)) + if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp)) { return $this->uikitComp; } diff --git a/admin/models/help_document.php b/admin/models/help_document.php index 6e8b05ebb..7d073c6ae 100644 --- a/admin/models/help_document.php +++ b/admin/models/help_document.php @@ -12,10 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Help_document Admin Model @@ -75,18 +85,18 @@ class ComponentbuilderModelHelp_document extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'help_document', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'help_document', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -137,7 +147,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -164,7 +174,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -177,7 +187,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -238,13 +248,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/help_document.js'; } - + /** * Method to test whether a record can be deleted. * @@ -263,7 +273,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('help_document.delete', 'com_componentbuilder.help_document.' . (int) $record->id); } @@ -281,8 +291,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -293,31 +303,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('help_document.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('help_document.edit', 'com_componentbuilder.help_document.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('help_document.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -325,19 +335,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -349,7 +359,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_help_document')); @@ -364,7 +374,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -379,10 +389,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.help_document.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.help_document.data', []); if (empty($data)) { @@ -410,7 +420,7 @@ protected function loadFormData() public function validate($form, $data, $group = null) { // check if the not_required field is set - if (isset($data['not_required']) && ComponentbuilderHelper::checkString($data['not_required'])) + if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required'])) { $requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = array_unique($requiredFields); @@ -418,7 +428,7 @@ public function validate($form, $data, $group = null) foreach ($requiredFields as $requiredField) { // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) + if (UtilitiesStringHelper::check($requiredField)) { // change to false $form->setFieldAttribute($requiredField, 'required', 'false'); @@ -441,7 +451,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -457,7 +467,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -477,10 +487,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -506,30 +516,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('help_document'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('help_document'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -566,8 +576,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -593,7 +602,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('help_document'); @@ -619,7 +628,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -632,7 +641,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('help_document.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -648,14 +657,14 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } list($this->table->title, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->title); // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -667,7 +676,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -731,7 +740,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('help_document'); @@ -739,7 +748,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('help_document.edit') && !$this->canDo->get('help_document.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -756,7 +765,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('help_document.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -772,13 +781,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -822,7 +831,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -834,15 +843,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -852,11 +861,11 @@ public function save($data) { $data['groups'] = (string) json_encode($data['groups']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -889,27 +898,27 @@ public function save($data) { if ($data['alias'] == null || empty($data['alias'])) { - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['title']); + $data['alias'] = OutputFilter::stringURLUnicodeSlug($data['title']); } else { - $data['alias'] = JFilterOutput::stringURLSafe($data['title']); + $data['alias'] = OutputFilter::stringURLSafe($data['title']); } - $table = JTable::getInstance('help_document', 'componentbuilderTable'); + $table = clone $this->getTable(); if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) { - $msg = JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_SAVE_WARNING'); + $msg = Text::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_SAVE_WARNING'); } $data['alias'] = $this->_generateNewTitle($data['alias']); if (isset($msg)) { - JFactory::getApplication()->enqueueMessage($msg, 'warning'); + Factory::getApplication()->enqueueMessage($msg, 'warning'); } } } @@ -919,7 +928,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -927,14 +936,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -947,7 +956,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -974,10 +982,10 @@ protected function _generateNewTitle($alias, $title = null) // Alter the title/s & alias $table = $this->getTable(); - while ($table->load(array('alias' => $alias))) + while ($table->load(['alias' => $alias])) { // Check if this is an array of titles - if (ComponentbuilderHelper::checkArray($title)) + if (UtilitiesArrayHelper::check($title)) { foreach($title as $nr => &$_title) { @@ -992,7 +1000,7 @@ protected function _generateNewTitle($alias, $title = null) $alias = StringHelper::increment($alias, 'dash'); } // Check if this is an array of titles - if (ComponentbuilderHelper::checkArray($title)) + if (UtilitiesArrayHelper::check($title)) { $title[] = $alias; return $title; diff --git a/admin/models/help_documents.php b/admin/models/help_documents.php index 7e10c1beb..e5b00d20d 100644 --- a/admin/models/help_documents.php +++ b/admin/models/help_documents.php @@ -12,18 +12,27 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Help_documents List Model */ class ComponentbuilderModelHelp_documents extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -54,7 +63,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -125,7 +134,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -140,12 +149,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -157,22 +166,13 @@ public function getItems() continue; } - // decode groups - $groupsArray = json_decode($item->groups, true); - if (ComponentbuilderHelper::checkArray($groupsArray)) - { - $groupsNames = array(); - foreach ($groupsArray as $groups) - { - $groupsNames[] = ComponentbuilderHelper::getGroupName($groups); - } - $item->groups = implode(', ', $groupsNames); - } + // convert groups + $item->groups = JsonHelper::string($item->groups, ', ', 'groups'); } } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -183,7 +183,7 @@ public function getItems() } } - + // return items return $items; } @@ -191,7 +191,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -205,7 +205,7 @@ public function selectionTranslation($value,$name) 3 => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_URL' ); // Now check if value is found in this array - if (isset($typeArray[$value]) && ComponentbuilderHelper::checkString($typeArray[$value])) + if (isset($typeArray[$value]) && StringHelper::check($typeArray[$value])) { return $typeArray[$value]; } @@ -218,25 +218,25 @@ public function selectionTranslation($value,$name) 2 => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_SITE' ); // Now check if value is found in this array - if (isset($locationArray[$value]) && ComponentbuilderHelper::checkString($locationArray[$value])) + if (isset($locationArray[$value]) && StringHelper::check($locationArray[$value])) { return $locationArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -266,7 +266,7 @@ protected function getListQuery() else { $search = $db->quote('%' . $db->escape($search) . '%'); - $query->where('(a.title LIKE '.$search.' OR a.type LIKE '.$search.' OR a.location LIKE '.$search.' OR a.admin_view LIKE '.$search.' OR g. LIKE '.$search.' OR a.site_view LIKE '.$search.' OR h. LIKE '.$search.')'); + $query->where('(a.title LIKE '.$search.' OR a.type LIKE '.$search.' OR a.location LIKE '.$search.' OR a.admin_view LIKE '.$search.' OR h. LIKE '.$search.' OR a.site_view LIKE '.$search.' OR i. LIKE '.$search.')'); } } @@ -283,7 +283,7 @@ protected function getListQuery() $query->where('a.type = ' . (int) $_type); } } - elseif (ComponentbuilderHelper::checkString($_type)) + elseif (StringHelper::check($_type)) { $query->where('a.type = ' . $db->quote($db->escape($_type))); } @@ -300,7 +300,7 @@ protected function getListQuery() $query->where('a.location = ' . (int) $_location); } } - elseif (ComponentbuilderHelper::checkString($_location)) + elseif (StringHelper::check($_location)) { $query->where('a.location = ' . $db->quote($db->escape($_location))); } @@ -317,7 +317,7 @@ protected function getListQuery() $query->where('a.admin_view = ' . (int) $_admin_view); } } - elseif (ComponentbuilderHelper::checkString($_admin_view)) + elseif (StringHelper::check($_admin_view)) { $query->where('a.admin_view = ' . $db->quote($db->escape($_admin_view))); } @@ -334,16 +334,18 @@ protected function getListQuery() $query->where('a.site_view = ' . (int) $_site_view); } } - elseif (ComponentbuilderHelper::checkString($_site_view)) + elseif (StringHelper::check($_site_view)) { $query->where('a.site_view = ' . $db->quote($db->escape($_site_view))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -361,17 +363,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -409,7 +411,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -429,7 +431,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -447,16 +449,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_help_document"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -465,7 +467,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -493,19 +495,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -517,7 +518,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -538,7 +539,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/import.php b/admin/models/import.php index 659065710..032ab7142 100644 --- a/admin/models/import.php +++ b/admin/models/import.php @@ -12,13 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Filesystem\Path; +use Joomla\CMS\Filter\OutputFilter; +use Joomla\CMS\Installer\InstallerHelper; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; use PhpOffice\PhpSpreadsheet\IOFactory; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; -/** +/*** * Componentbuilder Import Base Database Model */ class ComponentbuilderModelImport extends BaseDatabaseModel @@ -26,8 +33,8 @@ class ComponentbuilderModelImport extends BaseDatabaseModel // set uploading values protected $use_streams = false; protected $allow_unsafe = false; - protected $safeFileOptions = array(); - + protected $safeFileOptions = []; + /** * @var object JTable object */ @@ -44,13 +51,13 @@ class ComponentbuilderModelImport extends BaseDatabaseModel * @var string */ protected $_context = 'com_componentbuilder.import'; - + /** * Import Settings */ - protected $getType = NULL; - protected $dataType = NULL; - + protected $getType = NULL; + protected $dataType = NULL; + /** * Method to auto-populate the model state. * @@ -61,7 +68,7 @@ class ComponentbuilderModelImport extends BaseDatabaseModel */ protected function populateState() { - $app = JFactory::getApplication('administrator'); + $app = Factory::getApplication('administrator'); $this->setState('message', $app->getUserState('com_componentbuilder.message')); $app->setUserState('com_componentbuilder.message', ''); @@ -81,14 +88,14 @@ protected function populateState() public function import() { $this->setState('action', 'import'); - $app = JFactory::getApplication(); - $session = JFactory::getSession(); + $app = Factory::getApplication(); + $session = Factory::getSession(); $package = null; $continue = false; // get import type $this->getType = $app->input->getString('gettype', NULL); // get import type - $this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL); + $this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL); if ($package === null) { @@ -109,9 +116,9 @@ public function import() break; case 'continue': - $continue = true; - $package = $session->get('package', null); - $package = json_decode($package, true); + $continue = true; + $package = $session->get('package', null); + $package = json_decode($package, true); // clear session $session->clear('package'); $session->clear('dataType'); @@ -119,7 +126,7 @@ public function import() break; default: - $app->setUserState('com_componentbuilder.message', JText::_('COM_COMPONENTBUILDER_IMPORT_NO_IMPORT_TYPE_FOUND')); + $app->setUserState('com_componentbuilder.message', Text::_('COM_COMPONENTBUILDER_IMPORT_NO_IMPORT_TYPE_FOUND')); return false; break; @@ -133,10 +140,10 @@ public function import() $this->remove($package['packagename']); } - $app->setUserState('com_componentbuilder.message', JText::_('COM_COMPONENTBUILDER_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); + $app->setUserState('com_componentbuilder.message', Text::_('COM_COMPONENTBUILDER_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); return false; } - + // first link data to table headers if(!$continue){ $package = json_encode($package); @@ -145,13 +152,13 @@ public function import() $session->set('hasPackage', true); return true; } - + // set the data $headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false), true); if (!$this->setData($package,$this->dataType,$headerList)) { // There was an error importing the package - $msg = JText::_('COM_COMPONENTBUILDER_IMPORT_ERROR'); + $msg = Text::_('COM_COMPONENTBUILDER_IMPORT_ERROR'); $back = $session->get('backto_VDM_IMPORT', NULL); if ($back) { @@ -163,12 +170,12 @@ public function import() else { // Package imported sucessfully - $msg = JText::sprintf('COM_COMPONENTBUILDER_IMPORT_SUCCESS', $package['packagename']); + $msg = Text::sprintf('COM_COMPONENTBUILDER_IMPORT_SUCCESS', $package['packagename']); $back = $session->get('backto_VDM_IMPORT', NULL); if ($back) { - $app->setUserState('com_componentbuilder.redirect_url', 'index.php?option=com_componentbuilder&view='.$back); - $session->clear('backto_VDM_IMPORT'); + $app->setUserState('com_componentbuilder.redirect_url', 'index.php?option=com_componentbuilder&view='.$back); + $session->clear('backto_VDM_IMPORT'); } $result = true; } @@ -179,7 +186,7 @@ public function import() // remove file after import $this->remove($package['packagename']); $session->clear($this->getType.'_VDM_IMPORTHEADERS'); - + return $result; } @@ -189,48 +196,47 @@ public function import() * @return spreadsheet definition or false on failure */ protected function _getPackageFromUpload() - { + { // Get the uploaded file information - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get. $userfile = $input->files->get('import_package', null, 'raw'); - + // Make sure that file uploads are enabled in php if (!(bool) ini_get('file_uploads')) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); return false; } // If there is no uploaded file, we have a problem... if (!is_array($userfile)) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); return false; } // Check if there was a problem uploading the file. if ($userfile['error'] || $userfile['size'] < 1) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); return false; } // Build the appropriate paths - $config = JFactory::getConfig(); + $config = Factory::getConfig(); $tmp_dest = $config->get('tmp_path') . '/' . $userfile['name']; $tmp_src = $userfile['tmp_name']; // Move uploaded file - jimport('joomla.filesystem.file'); $p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); // Was the package downloaded? if (!$p_file) { - $session = JFactory::getSession(); + $session = Factory::getSession(); $session->clear('package'); $session->clear('dataType'); $session->clear('hasPackage'); @@ -252,16 +258,16 @@ protected function _getPackageFromUpload() */ protected function _getPackageFromFolder() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Get the path to the package to import $p_dir = $input->getString('import_directory'); - $p_dir = JPath::clean($p_dir); + $p_dir = Path::clean($p_dir); // Did you give us a valid path? if (!file_exists($p_dir)) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); return false; } @@ -271,17 +277,17 @@ protected function _getPackageFromFolder() // Did you give us a valid package? if (!$type) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); } - + // check the extention if(!$this->checkExtension($p_dir)) { // set error message - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); return false; } - + $package['packagename'] = null; $package['dir'] = $p_dir; $package['type'] = $type; @@ -297,26 +303,26 @@ protected function _getPackageFromFolder() */ protected function _getPackageFromUrl() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; - + // Get the URL of the package to import $url = $input->getString('import_url'); // Did you give us a URL? if (!$url) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_ENTER_A_URL'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_ENTER_A_URL'), 'warning'); return false; } // Download the package at the URL given - $p_file = JInstallerHelper::downloadPackage($url); + $p_file = InstallerHelper::downloadPackage($url); // Was the package downloaded? if (!$p_file) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_INVALID_URL'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_INVALID_URL'), 'warning'); return false; } @@ -325,7 +331,7 @@ protected function _getPackageFromUrl() return $package; } - + /** * Check a file and verifies it as a spreadsheet file * Supports .csv .xlsx .xls and .ods @@ -337,29 +343,29 @@ protected function _getPackageFromUrl() */ protected function check($archivename) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Clean the name - $archivename = JPath::clean($archivename); - + $archivename = Path::clean($archivename); + // check the extention if(!$this->checkExtension($archivename)) { // Cleanup the import files $this->remove($archivename); - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); return false; } - - $config = JFactory::getConfig(); + + $config = Factory::getConfig(); // set Package Name $check['packagename'] = $archivename; - + // set directory $check['dir'] = $config->get('tmp_path'). '/' .$archivename; - + // set type $check['type'] = $this->getType; - + return $check; } @@ -396,8 +402,8 @@ protected function checkExtension($file) protected function remove($package) { jimport('joomla.filesystem.file'); - - $config = JFactory::getConfig(); + + $config = Factory::getConfig(); $package = $config->get('tmp_path'). '/' .$package; // Is the package file a valid file? @@ -405,10 +411,10 @@ protected function remove($package) { File::delete($package); } - elseif (is_file(JPath::clean($package))) + elseif (is_file(Path::clean($package))) { // It might also be just a base filename - File::delete(JPath::clean($package)); + File::delete(Path::clean($package)); } } @@ -422,11 +428,11 @@ protected function remove($package) **/ protected function setData($package,$table,$target_headers) { - if (ComponentbuilderHelper::checkArray($target_headers)) + if (UtilitiesArrayHelper::check($target_headers)) { // make sure the file is loaded ComponentbuilderHelper::composerAutoload('phpspreadsheet'); - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; foreach($target_headers as $header) { if (($column = $jinput->getString($header, false)) !== false || @@ -466,10 +472,10 @@ protected function setData($package,$table,$target_headers) protected function save($data,$table) { // import the data if there is any - if(ComponentbuilderHelper::checkArray($data['array'])) + if(UtilitiesArrayHelper::check($data['array'])) { // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // remove header if it has headers $id_key = $data['target_headers']['id']; $published_key = $data['target_headers']['published']; @@ -484,14 +490,14 @@ protected function save($data,$table) } // make sure there is still values in array and that it was not only headers - if(ComponentbuilderHelper::checkArray($data['array']) && $user->authorise($table.'.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) + if(UtilitiesArrayHelper::check($data['array']) && $user->authorise($table.'.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // set target. $target = array_flip($data['target_headers']); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // set some defaults - $todayDate = JFactory::getDate()->toSql(); + $todayDate = Factory::getDate()->toSql(); // get global action permissions $canDo = ComponentbuilderHelper::getActions($table); $canEdit = $canDo->get('core.edit'); @@ -678,13 +684,13 @@ protected function save($data,$table) protected function getAlias($name,$type = false) { // sanitize the name to an alias - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $alias = JFilterOutput::stringURLUnicodeSlug($name); + $alias = OutputFilter::stringURLUnicodeSlug($name); } else { - $alias = JFilterOutput::stringURLSafe($name); + $alias = OutputFilter::stringURLSafe($name); } // must be a uniqe alias if ($type) @@ -693,7 +699,7 @@ protected function getAlias($name,$type = false) } return $alias; } - + /** * Method to generate a uniqe value. * @@ -708,16 +714,16 @@ protected function getUniqe($value,$field,$type) // insure the filed is always uniqe while (isset($this->uniqeValueArray[$type][$field][$value])) { - $value = JString::increment($value, 'dash'); + $value = StringHelper::increment($value, 'dash'); } $this->uniqeValueArray[$type][$field][$value] = $value; return $value; } - + protected function getAliasesUsed($table) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // first we check if there is a alias column $columns = $db->getTableColumns('#__componentbuilder_'.$table); if(isset($columns['alias'])){ diff --git a/admin/models/import_joomla_components.php b/admin/models/import_joomla_components.php index 3751471da..b899a7f60 100644 --- a/admin/models/import_joomla_components.php +++ b/admin/models/import_joomla_components.php @@ -12,11 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Filesystem\Path; +use Joomla\CMS\Filter\OutputFilter; +use Joomla\CMS\Installer\InstallerHelper; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; use PhpOffice\PhpSpreadsheet\IOFactory; +use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\FileHelper; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\GuidHelper; +use Joomla\CMS\Component\ComponentHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Import_joomla_components Base Database Model @@ -26,8 +41,8 @@ class ComponentbuilderModelImport_joomla_components extends BaseDatabaseModel // set uploading values protected $use_streams = false; protected $allow_unsafe = false; - protected $safeFileOptions = array(); - + protected $safeFileOptions = []; + /** * @var object JTable object */ @@ -44,13 +59,13 @@ class ComponentbuilderModelImport_joomla_components extends BaseDatabaseModel * @var string */ protected $_context = 'com_componentbuilder.import_joomla_components'; - + /** * Import Settings */ protected $getType = NULL; protected $dataType = NULL; - + /** * Method to auto-populate the model state. * @@ -61,7 +76,7 @@ class ComponentbuilderModelImport_joomla_components extends BaseDatabaseModel */ protected function populateState() { - $app = JFactory::getApplication('administrator'); + $app = Factory::getApplication('administrator'); $this->setState('message', $app->getUserState('com_componentbuilder.message')); $app->setUserState('com_componentbuilder.message', ''); @@ -108,9 +123,9 @@ public function import() // set the state to import $this->setState('action', 'import'); // get App - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); // get session - $session = JFactory::getSession(); + $session = Factory::getSession(); // some defaults $package = null; $continue = false; @@ -142,10 +157,10 @@ public function import() break; case 'url': - $url = JFactory::getApplication()->input->getString('import_url'); + $url = Factory::getApplication()->input->getString('import_url'); if ($url === base64_encode(base64_decode($url, true))) { - JFactory::getApplication()->input->set('import_url', base64_decode($url)); + Factory::getApplication()->input->set('import_url', base64_decode($url)); } $package = $this->_getPackageFromUrl(); break; @@ -163,7 +178,7 @@ public function import() // now clear it $session->clear('smart_package_info'); // convert to an array if found - if ($packageInfo && ComponentbuilderHelper::checkJson($packageInfo)) + if ($packageInfo && JsonHelper::check($packageInfo)) { $this->packageInfo = json_decode($packageInfo, true); } @@ -171,7 +186,7 @@ public function import() default: $package = $session->get('package', null); - if (ComponentbuilderHelper::checkJson($package)) + if (JsonHelper::check($package)) { // get package $package = json_decode($package, true); @@ -215,7 +230,7 @@ public function import() $this->remove($package['packagename']); } - $this->app->setUserState('com_componentbuilder.message', JText::_('COM_COMPONENTBUILDER_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); + $this->app->setUserState('com_componentbuilder.message', Text::_('COM_COMPONENTBUILDER_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); return false; } @@ -225,7 +240,7 @@ public function import() // check if this a smart package, if true then get info if ($this->dataType !== 'smart_package' || !$this->getInfo($package, $session)) { - $this->app->setUserState('com_componentbuilder.message', JText::_('COM_COMPONENTBUILDER_THERE_WAS_AN_ERROR_GETTING_THE_PACKAGE_INFO')); + $this->app->setUserState('com_componentbuilder.message', Text::_('COM_COMPONENTBUILDER_THERE_WAS_AN_ERROR_GETTING_THE_PACKAGE_INFO')); return false; } // set package to session @@ -251,7 +266,7 @@ public function import() if (!$this->setData($package)) { // There was an error importing the package - $msg = JText::_('COM_COMPONENTBUILDER_IMPORT_ERROR'); + $msg = Text::_('COM_COMPONENTBUILDER_IMPORT_ERROR'); $msgType = 'error'; $back = $session->get('backto_VDM_IMPORT', NULL); if ($back) @@ -264,7 +279,7 @@ public function import() else { // Package imported sucessfully - $msg = JText::sprintf('COM_COMPONENTBUILDER_IMPORT_SUCCESS', $package['packagename']); + $msg = Text::sprintf('COM_COMPONENTBUILDER_IMPORT_SUCCESS', $package['packagename']); $msgType = 'success'; $back = $session->get('backto_VDM_IMPORT', NULL); if ($back) @@ -297,13 +312,13 @@ protected function getInfo(&$package, &$session) // does this package pass a checksum $checksum = false; $checksumStatus = 'warning'; - $checksumMessage = JText::_('COM_COMPONENTBUILDER_PLEASE_NOTE_THAT_THIS_PACKAGE_BHAS_NOB_CHECKSUM_VALIDATION'); + $checksumMessage = Text::_('COM_COMPONENTBUILDER_PLEASE_NOTE_THAT_THIS_PACKAGE_BHAS_NOB_CHECKSUM_VALIDATION'); // do hash validation here for git repos - if (ComponentbuilderHelper::checkString($this->checksum) && isset($this->checksumURLs[$this->checksum])) + if (UtilitiesStringHelper::check($this->checksum) && isset($this->checksumURLs[$this->checksum])) { // get packages checksums - $checksums = ComponentbuilderHelper::getFileContents($this->checksumURLs[$this->checksum].'checksum.json'); - if (ComponentbuilderHelper::checkJson($checksums)) + $checksums = FileHelper::getContent($this->checksumURLs[$this->checksum].'checksum.json'); + if (JsonHelper::check($checksums)) { // convert to array $checksums = json_decode($checksums, true); @@ -316,7 +331,7 @@ protected function getInfo(&$package, &$session) if ($checksums[$packageName] === sha1_file($package['dir'])) { $validator = $this->checksumURLs[$this->checksum].str_replace('.zip', '.sha', $packageName); - $checksumMessage = JText::sprintf('COM_COMPONENTBUILDER_THIS_PACKAGE_BPASSEDB_THE_CHECKSUM_VALIDATIONBR_BR_SMALLMANUALLY_ALSO_VALIDATE_THAT_THE_CORRECT_CHECKSUM_WAS_USEDSMALLBR_THIS_CHECKSUM_BSB_MUST_BE_THE_SAME_AS_THE_ONE_FOUND_A_S_SA', $checksums[$packageName], 'href="'.$validator.'" target="_blank" title="verify checksum">', $validator); + $checksumMessage = Text::sprintf('COM_COMPONENTBUILDER_THIS_PACKAGE_BPASSEDB_THE_CHECKSUM_VALIDATIONBR_BR_SMALLMANUALLY_ALSO_VALIDATE_THAT_THE_CORRECT_CHECKSUM_WAS_USEDSMALLBR_THIS_CHECKSUM_BSB_MUST_BE_THE_SAME_AS_THE_ONE_FOUND_A_S_SA', $checksums[$packageName], 'href="'.$validator.'" target="_blank" title="verify checksum">', $validator); $checksumStatus = 'Success'; $checksum = true; } @@ -324,14 +339,14 @@ protected function getInfo(&$package, &$session) // set error if (!$checksum) { - $checksumMessage = JText::_('COM_COMPONENTBUILDER_BBEST_TO_NOT_CONTINUEBBR_YOU_CAN_REFRESH_AND_TRY_AGAINBR_BUT_NOTE_THAT_THIS_PACKAGE_BFAILEDB_CHECKSUM_VALIDATION_THIS_COULD_BE_A_SERIOUS_SECURITY_BREACH_DO_NOT_CONTINUE'); + $checksumMessage = Text::_('COM_COMPONENTBUILDER_BBEST_TO_NOT_CONTINUEBBR_YOU_CAN_REFRESH_AND_TRY_AGAINBR_BUT_NOTE_THAT_THIS_PACKAGE_BFAILEDB_CHECKSUM_VALIDATION_THIS_COULD_BE_A_SERIOUS_SECURITY_BREACH_DO_NOT_CONTINUE'); $checksumStatus = 'error'; } } // set error else { - $checksumMessage = JText::_('COM_COMPONENTBUILDER_BBEST_TO_NOT_CONTINUEBBR_WE_COULD_NOT_LOAD_THE_CHECKSUM_FOR_THIS_PACKAGE_AND_SO_NO_VALIDATION_WAS_POSSIBLE_THIS_MAY_BE_DUE_TO_YOUR_NETWORK_OR_A_CHANGE_TO_THAT_PACKAGE_NAME'); + $checksumMessage = Text::_('COM_COMPONENTBUILDER_BBEST_TO_NOT_CONTINUEBBR_WE_COULD_NOT_LOAD_THE_CHECKSUM_FOR_THIS_PACKAGE_AND_SO_NO_VALIDATION_WAS_POSSIBLE_THIS_MAY_BE_DUE_TO_YOUR_NETWORK_OR_A_CHANGE_TO_THAT_PACKAGE_NAME'); $checksumStatus = 'error'; } } @@ -348,27 +363,26 @@ protected function getInfo(&$package, &$session) if (JFile::exists($infoFile)) { // load the data - if ($info = @file_get_contents($infoFile)) + if ($info = FileHelper::getContent($infoFile)) { - // Get the password. - $db = 'COM_COMPONENTBUILDER_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM'; - $password = base64_decode(JText::sprintf($db, 'VjR', 'WV0aE9k')); // unlock the info data - if (($info = $this->decrypt($info, $password, true)) !== false && ComponentbuilderHelper::checkJson($info)) + if ((($info_ = PackageFactory::_('Crypt')->decrypt($info, 'local')) !== null && JsonHelper::check($info_)) || + (($info_ = PackageFactory::_('Crypt')->decrypt($info, 'local.legacy')) !== null && JsonHelper::check($info_)) || + (($info_ = PackageFactory::_('Crypt')->decrypt($info, 'local.fof')) !== null && JsonHelper::check($info_))) { // we only continue if info could be opened - $session->set('smart_package_info', $info); + $session->set('smart_package_info', $info_); return true; } // do not have check sum validation - $this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWOWE_COULD_NOT_OPEN_THE_PACKAGEHTWOTHIS_COULD_BE_DUE_TO_THE_FOFENCRYPTION_THAT_IS_NO_LONGER_SUPPORTED_IN_JOOMLA_PLEASE_EXPORT_YOUR_PACKAGES_WITH_JCB_VTHREEZEROELEVENPRO_OR_VTWOONETWOSEVENTEENPUBLIC_OR_HIGHER_TO_BE_ABLE_TO_IMPORT_IT_INTO_THIS_VERSION_OF_JCB'), 'error'); + $this->app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_HTWOWE_COULD_NOT_OPEN_THE_PACKAGEHTWOTHIS_COULD_BE_DUE_TO_THE_FOFENCRYPTION_THAT_IS_NO_LONGER_SUPPORTED_IN_JOOMLA_PLEASE_EXPORT_YOUR_PACKAGES_WITH_JCB_VTHREEZEROELEVENPRO_OR_VTWOONETWOSEVENTEENPUBLIC_OR_HIGHER_TO_BE_ABLE_TO_IMPORT_IT_INTO_THIS_VERSION_OF_JCB'), 'error'); } } ComponentbuilderHelper::removeFolder($this->dir); } } return false; - } + } /** * Works out an importation spreadsheet from a HTTP upload @@ -376,37 +390,37 @@ protected function getInfo(&$package, &$session) * @return spreadsheet definition or false on failure */ protected function _getPackageFromUpload() - { + { // Get the uploaded file information - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get. $userfile = $input->files->get('import_package', null, 'raw'); - + // Make sure that file uploads are enabled in php if (!(bool) ini_get('file_uploads')) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); return false; } // If there is no uploaded file, we have a problem... if (!is_array($userfile)) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); return false; } // Check if there was a problem uploading the file. if ($userfile['error'] || $userfile['size'] < 1) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); return false; } // Build the appropriate paths - $config = JFactory::getConfig(); + $config = Factory::getConfig(); $tmp_dest = $config->get('tmp_path') . '/' . $userfile['name']; $tmp_src = $userfile['tmp_name']; @@ -416,7 +430,7 @@ protected function _getPackageFromUpload() // Was the package downloaded? if (!$p_file) { - $session = JFactory::getSession(); + $session = Factory::getSession(); $session->clear('package'); $session->clear('dataType'); $session->clear('hasPackage'); @@ -438,16 +452,16 @@ protected function _getPackageFromUpload() */ protected function _getPackageFromFolder() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Get the path to the package to import $p_dir = $input->getString('import_directory'); - $p_dir = JPath::clean($p_dir); + $p_dir = Path::clean($p_dir); // Did you give us a valid path? if (!file_exists($p_dir)) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); return false; } @@ -457,17 +471,17 @@ protected function _getPackageFromFolder() // Did you give us a valid package? if (!$type) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); } - + // check the extention if(!$this->checkExtension($p_dir)) { // set error message - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); return false; } - + $package['packagename'] = null; $package['dir'] = $p_dir; $package['type'] = $type; @@ -483,7 +497,7 @@ protected function _getPackageFromFolder() */ protected function _getPackageFromUrl() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Get the URL of the package to import @@ -492,17 +506,17 @@ protected function _getPackageFromUrl() // Did you give us a URL? if (!$url) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_ENTER_A_URL'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_ENTER_A_URL'), 'warning'); return false; } // Download the package at the URL given - $p_file = JInstallerHelper::downloadPackage($url); + $p_file = InstallerHelper::downloadPackage($url); // Was the package downloaded? if (!$p_file) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_INVALID_URL'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_INVALID_URL'), 'warning'); return false; } @@ -511,7 +525,7 @@ protected function _getPackageFromUrl() return $package; } - + /** * Check a file and verifies it as a spreadsheet file * Supports .csv .xlsx .xls and .ods @@ -523,29 +537,29 @@ protected function _getPackageFromUrl() */ protected function check($archivename) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Clean the name - $archivename = JPath::clean($archivename); - + $archivename = Path::clean($archivename); + // check the extention if(!$this->checkExtension($archivename)) { // Cleanup the import files $this->remove($archivename); - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); return false; } - - $config = JFactory::getConfig(); + + $config = Factory::getConfig(); // set Package Name $check['packagename'] = $archivename; - + // set directory $check['dir'] = $config->get('tmp_path'). '/' .$archivename; - + // set type $check['type'] = $this->getType; - + return $check; } @@ -582,9 +596,7 @@ protected function checkExtension($file) */ protected function remove($package) { - jimport('joomla.filesystem.file'); - - $config = JFactory::getConfig(); + $config = Factory::getConfig(); $package = $config->get('tmp_path'). '/' .$package; // Is the package file a valid file? @@ -592,10 +604,10 @@ protected function remove($package) { File::delete($package); } - elseif (is_file(JPath::clean($package))) + elseif (is_file(Path::clean($package))) { // It might also be just a base filename - File::delete(JPath::clean($package)); + File::delete(Path::clean($package)); } } @@ -609,7 +621,7 @@ protected function remove($package) **/ protected function setData($package) { - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // set the data based on the type of import being done if ('continue-ext' === $this->getType) { @@ -636,12 +648,12 @@ protected function setData($package) if (JFile::exists($dbFile)) { // load the data - if ($data = @file_get_contents($dbFile)) + if ($data = FileHelper::getContent($dbFile)) { // prep the data if ($this->extractData($data)) { - if (isset($this->data['joomla_component']) && ComponentbuilderHelper::checkArray($this->data['joomla_component'])) + if (isset($this->data['joomla_component']) && UtilitiesArrayHelper::check($this->data['joomla_component'])) { // save the smart data if ($this->saveSmartComponents()) @@ -671,20 +683,20 @@ protected function setData($package) protected function extractData($data) { // remove all line breaks - if (($data = $this->decrypt($data, $this->sleutle)) !== false) + if (($data = $this->decrypt($data, $this->sleutle)) !== null) { // final check if we have success $data = @unserialize($data); - if (ComponentbuilderHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // set the data global $this->data = $data; return true; } - $this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BKEY_ERRORB_OR_BROKEN_PACKAGE'), 'error'); + $this->app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BKEY_ERRORB_OR_BROKEN_PACKAGE'), 'error'); return false; } - $this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BROKEN_PACKAGE'), 'error'); + $this->app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BROKEN_PACKAGE'), 'error'); return false; } @@ -697,14 +709,14 @@ protected function extractData($data) protected function saveSmartComponents() { // get user object - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // set some defaults - $this->today = JFactory::getDate()->toSql(); + $this->today = Factory::getDate()->toSql(); // if we can't merge add postfix to name if (!$this->canmerge) { // set some postfix - $this->postfix = ' ('.ComponentbuilderHelper::randomkey(2).')'; + $this->postfix = ' ('.UtilitiesStringHelper::random(2).')'; } // the array of tables to store $tables = array( @@ -738,11 +750,11 @@ protected function saveSmartComponents() // check if it is the power table if ($table === 'power') { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_TABLE_BSB_NOT_FOUND_IN_THE_LOCAL_DATABASE_SO_ITS_VALUES_COULD_NOT_BE_IMPORTED_THE_WHOLE_POWERS_FEATURE_IS_ONLY_AVAILABLE_TO_A_HREFSPRO_MEMBERSA_AT_THIS_TIME', '#__componentbuilder_' . $table, '"https://vdm.bz/get-jcb-pro-membership" target="_blank" title="Join PRO Membership today!"'), 'warning'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_TABLE_BSB_NOT_FOUND_IN_THE_LOCAL_DATABASE_SO_ITS_VALUES_COULD_NOT_BE_IMPORTED_THE_WHOLE_POWERS_FEATURE_IS_ONLY_AVAILABLE_TO_A_HREFSPRO_MEMBERSA_AT_THIS_TIME', '#__componentbuilder_' . $table, '"https://vdm.bz/get-jcb-pro-membership" target="_blank" title="Join PRO Membership today!"'), 'warning'); } else { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_TABLE_BSB_NOT_FOUND_IN_THE_LOCAL_DATABASE_SO_ITS_VALUES_COULD_NOT_BE_IMPORTED_PLEASE_UPDATE_YOUR_JCB_INSTALL_AND_TRY_AGAIN', '#__componentbuilder_' . $table), 'warning'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_TABLE_BSB_NOT_FOUND_IN_THE_LOCAL_DATABASE_SO_ITS_VALUES_COULD_NOT_BE_IMPORTED_PLEASE_UPDATE_YOUR_JCB_INSTALL_AND_TRY_AGAIN', '#__componentbuilder_' . $table), 'warning'); } } } @@ -768,7 +780,7 @@ protected function saveSmartComponents() **/ public function saveSmartItems($table) { - if (isset($this->data[$table]) && ComponentbuilderHelper::checkArray($this->data[$table])) + if (isset($this->data[$table]) && UtilitiesArrayHelper::check($this->data[$table])) { // add pre import event $this->preImportEvent($table); @@ -793,7 +805,7 @@ public function saveSmartItems($table) // display more import info if ($this->moreInfo) { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BSB_WAS_FOUND', $table.' id:'.$oldID . '->' . $local->id), 'success'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_BSB_WAS_FOUND', $table.' id:'.$oldID . '->' . $local->id), 'success'); } $dbDate = strtotime($item->modified); $localDate = strtotime($local->modified); @@ -818,7 +830,7 @@ public function saveSmartItems($table) // display more import info if ($this->moreInfo) { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BSB_HAS_BEEN_UPDATED', $table.' id:'.$oldID . '->' . $id), 'success'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_BSB_HAS_BEEN_UPDATED', $table.' id:'.$oldID . '->' . $id), 'success'); } } else @@ -826,9 +838,9 @@ public function saveSmartItems($table) $notice = '!'; if (!$canEdit) { - $notice = JText::sprintf("COM_COMPONENTBUILDER__SINCE_YOU_DONT_HAVE_PERMISSION_TO_EDIT_S", $table); + $notice = Text::sprintf("COM_COMPONENTBUILDER__SINCE_YOU_DONT_HAVE_PERMISSION_TO_EDIT_S", $table); } - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BSB_COULD_NOT_BE_IMPORTEDS', $table.' id:'.$oldID, $notice), 'error'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_BSB_COULD_NOT_BE_IMPORTEDS', $table.' id:'.$oldID, $notice), 'error'); } } // insure to load the local ID to link imported values with it @@ -844,7 +856,7 @@ public function saveSmartItems($table) // display more import info if ($this->moreInfo) { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BSB_HAS_BEEN_IMPORTED', $table.' id:'.$oldID . '->' . $id), 'success'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_BSB_HAS_BEEN_IMPORTED', $table.' id:'.$oldID . '->' . $id), 'success'); } } else @@ -852,9 +864,9 @@ public function saveSmartItems($table) $notice = '!'; if (!$canCreate) { - $notice = JText::sprintf("COM_COMPONENTBUILDER__SINCE_YOU_DONT_HAVE_PERMISSION_TO_CREATE_S", $table); + $notice = Text::sprintf("COM_COMPONENTBUILDER__SINCE_YOU_DONT_HAVE_PERMISSION_TO_CREATE_S", $table); } - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BSB_COULD_NOT_BE_IMPORTEDS', $table.' id:'.$oldID, $notice), 'error'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_BSB_COULD_NOT_BE_IMPORTEDS', $table.' id:'.$oldID, $notice), 'error'); } } } @@ -873,7 +885,7 @@ protected function preImportEvent($table) // remove all custom code linked to these components // since some code may have been removed and changed // best unpublish all and let the import publish those still active - if ('custom_code' === $table && isset($this->newID['joomla_component']) && ComponentbuilderHelper::checkArray($this->newID['joomla_component'])) + if ('custom_code' === $table && isset($this->newID['joomla_component']) && UtilitiesArrayHelper::check($this->newID['joomla_component'])) { $query = $this->_db->getQuery(true); // Field to update. @@ -919,7 +931,7 @@ protected function moveSmartStuff() // make sure to first unlock files $this->unLockFiles(); // set params - $params = JComponentHelper::getParams('com_componentbuilder'); + $params = ComponentHelper::getParams('com_componentbuilder'); // set custom folder path $customPath = str_replace('//', '/', $params->get('custom_folder_path', JPATH_COMPONENT_ADMINISTRATOR.'/custom')); $imagesPath = str_replace('//', '/', JPATH_SITE . '/images'); @@ -931,13 +943,13 @@ protected function moveSmartStuff() // great we have some custom stuff lets move it if (!JFolder::copy($customDir, $customPath,'',true)) { - $this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVED_TO_CORRECT_LOCATION'), 'error'); + $this->app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVED_TO_CORRECT_LOCATION'), 'error'); $success = false; } // display more import info elseif ($this->moreInfo) { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_SOME_BCUSTOM_FILESB_WERE_MOVED_TO_BSB', $customPath), 'success'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_SOME_BCUSTOM_FILESB_WERE_MOVED_TO_BSB', $customPath), 'success'); } } // check if we have images @@ -947,13 +959,13 @@ protected function moveSmartStuff() // great we have some images lets move them if (!JFolder::copy($imageDir, $imagesPath,'',true)) { - $this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_BIMAGESB_NOT_MOVED_TO_CORRECT_LOCATION'), 'error'); + $this->app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_BIMAGESB_NOT_MOVED_TO_CORRECT_LOCATION'), 'error'); $success = false; } // display more import info elseif ($this->moreInfo) { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_SOME_BIMAGESB_WERE_MOVED_TO_BSB', $imagesPath), 'success'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_SOME_BIMAGESB_WERE_MOVED_TO_BSB', $imagesPath), 'success'); } } // now move the dynamic files if found @@ -963,7 +975,7 @@ protected function moveSmartStuff() // get a list of folders $folders = JFolder::folders($dynamicDir); // check if we have files - if(ComponentbuilderHelper::checkArray($folders)) + if(UtilitiesArrayHelper::check($folders)) { foreach ($folders as $folder) { @@ -971,20 +983,20 @@ protected function moveSmartStuff() $fullPath = str_replace('//', '/', $dynamicDir . '/' . $folder); if (!JFolder::exists($fullPath) || !JFolder::copy($fullPath, $destination,'',true)) { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVED_TO_BSB', $folder, $destination), 'error'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVED_TO_BSB', $folder, $destination), 'error'); $success = false; } // display more import info elseif ($this->moreInfo) { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FOLDER_BSB_WAS_MOVED_TO_BSB', $folder, $destination), 'success'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_FOLDER_BSB_WAS_MOVED_TO_BSB', $folder, $destination), 'success'); } } } // get a list of files $files = JFolder::files($dynamicDir); // check if we have files - if(ComponentbuilderHelper::checkArray($files)) + if(UtilitiesArrayHelper::check($files)) { foreach ($files as $file) { @@ -992,13 +1004,13 @@ protected function moveSmartStuff() $fullPath = str_replace('//', '/', $dynamicDir . '/' . $file); if (!JFile::exists($fullPath) || !JFile::copy($fullPath, $destination)) { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVED_TO_BSB', $file, $destination), 'error'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVED_TO_BSB', $file, $destination), 'error'); $success = false; } // display more import info elseif ($this->moreInfo) { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_MOVED_TO_BSB', $file, $destination), 'success'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_MOVED_TO_BSB', $file, $destination), 'success'); } } } @@ -1014,7 +1026,7 @@ protected function moveSmartStuff() protected function unLockFiles() { // lock the data if set - if(ComponentbuilderHelper::checkString($this->sleutle) && strlen($this->sleutle) == 32) + if(UtilitiesStringHelper::check($this->sleutle) && strlen($this->sleutle) == 32) { // we must first store the current working directory $joomla = getcwd(); @@ -1050,24 +1062,24 @@ protected function unLockFile(&$tmpPath) foreach ($files as $file) { // open the file content - if (($data = $this->decrypt(file_get_contents($file), $this->sleutle)) !== false) + if (($data = $this->decrypt(file_get_contents($file), $this->sleutle)) !== null) { // write the decrypted data back to file - if (!ComponentbuilderHelper::writeFile($file, $data)) + if (!FileHelper::write($file, $data)) { // in case file could not be unlocked - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_COULD_NOT_BE_UNLOCKED', $file), 'error'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_FILE_BSB_COULD_NOT_BE_STORED', $file), 'error'); } // display more import info elseif ($this->moreInfo) { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_SUCCESSFULLY_UNLOCKED', $file), 'success'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_SUCCESSFULLY_UNLOCKED', $file), 'success'); } } else { // in case file could not be unlocked - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_COULD_NOT_BE_UNLOCKED', $file), 'error'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_FILE_BSB_COULD_NOT_BE_UNLOCKED', $file), 'error'); } } } @@ -1075,9 +1087,9 @@ protected function unLockFile(&$tmpPath) /** * decrypt data * - * @param string $data The data string - * @param string $password The key to unlock - * @param bool $force Should we force phpseclib decryption + * @param string $data The data string + * @param string $password The key to unlock + * @param bool $force Should we force phpseclib decryption * * @return mixed the data, or false * @@ -1086,57 +1098,155 @@ protected function unLockFile(&$tmpPath) protected function decrypt(string $data, string $password, bool $force = false) { // remove all line breaks - $data = str_replace("\n", '', $data); + $data = $this->removeLineBreaks($data); + // make sure we have base64 - if ($data === base64_encode(base64_decode($data, true))) + if ($this->isBase64Encoded($data)) { // open the data - if(ComponentbuilderHelper::checkString($password) && strlen($password) == 32) + if($this->isValidPassword($password)) { - // check if we should use the phpseclib decryption - $phpseclip = (isset($this->packageInfo['phpseclib']) && $this->packageInfo['phpseclib']) ? true : $force; - // load phpseclib - if($phpseclip && ComponentbuilderHelper::crypt('AES', 'CBC') instanceof \phpseclib\Crypt\Rijndael) + // try phpseclib version 3 + if(($this->isPhpseclib3Enabled() || $force) && + ($data_ = $this->decryptWithPhpseclib3($data, $password)) !== null) { - // load the system password - ComponentbuilderHelper::crypt('AES', 'CBC')->setPassword($password, 'pbkdf2', 'sha256', 'VastDevelopmentMethod/salt'); - // open the data block - $data = ComponentbuilderHelper::crypt('AES', 'CBC')->decrypt(base64_decode($data)); - // check if we had success - if ($data !== false) - { - return $data; - } + return $data_; } - // check if we had success - if (class_exists('FOFEncryptAes')) + + // try phpseclib version 2 + if(($this->isPhpseclib2Enabled() || $force) && + ($data_ = $this->decryptWithPhpseclib2($data, $password)) !== null) { - // Get the encryption object. - if (!$this->noopmaker instanceof FOFEncryptAes) - { - $this->noopmaker = new FOFEncryptAes($password, 128); - } - // open the data block - $data = $this->noopmaker->decryptString($data); - // check if we had success - if ($data !== false) - { - return $data; - } - else - { - $this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWOWE_COULD_NOT_OPEN_THE_ENCRYPT_DATAHTWO_THIS_COULD_BE_DUE_TO_THE_FOFENCRYPTION_THAT_IS_NO_LONGER_SUPPORTED_IN_JOOMLABR_PLEASE_EXPORT_YOUR_PACKAGES_WITH_JCB_VTHREEZEROELEVENPRO_OR_VTWOONETWOSEVENTEENPUBLIC_OR_HIGHER_TO_BE_ABLE_TO_IMPORT_IT_INTO_THIS_VERSION_OF_JCB'), 'error'); - } + return $data_; + } + + // try FOF the outdated method + if (($data_ = $this->decryptWithFof($data, $password)) !== null) + { + return $data_; } + + $this->app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_HTWOWE_COULD_NOT_OPEN_THE_ENCRYPT_DATAHTWO_THIS_COULD_BE_DUE_TO_THE_FOFENCRYPTION_THAT_IS_NO_LONGER_SUPPORTED_IN_JOOMLABR_PLEASE_EXPORT_YOUR_PACKAGES_WITH_JCB_VTHREEONEONEEIGHT_OR_HIGHER_TO_BE_ABLE_TO_IMPORT_IT_INTO_THIS_VERSION_OF_JCB'), 'error'); } else { return base64_decode($data); } } + return false; } + /** + * Removes all line breaks from a string + * + * @param string $data + * + * @return string + */ + private function removeLineBreaks(string $data): string + { + return str_replace("\n", '', $data); + } + + /** + * Check if the data is base64 encoded + * + * @param string $data + * + * @return bool + */ + private function isBase64Encoded(string $data): bool + { + return $data === base64_encode(base64_decode($data, true)); + } + + /** + * Check if a password is set and has a length of 32 characters + * + * @param string $password + * + * @return bool + */ + private function isValidPassword(string $password): bool + { + return UtilitiesStringHelper::check($password) && strlen($password) == 32; + } + + /** + * Check if we can use phpseclib library version 2 + * + * @return bool + */ + private function isPhpseclib2Enabled(): bool + { + return (bool) isset($this->packageInfo['phpseclib']) && $this->packageInfo['phpseclib']; + } + + /** + * Decrypts data using the phpseclib library version 2 + * + * @param string $data + * @param string $password + * + * @return string|null + */ + private function decryptWithPhpseclib2(string $data, string $password): ?string + { + $data_ = PackageFactory::_('Crypt')->decrypt($data, 'legacy', $password); + if ($data_ !== null) + { + return strcmp($data, $data_) !== 0 ? $data_ : null; + } + return null; + } + + /** + * Check if we can use phpseclib library version 3 + * + * @return bool + */ + private function isPhpseclib3Enabled(): bool + { + return (bool) isset($this->packageInfo['phpseclib3']) && $this->packageInfo['phpseclib3']; + } + + /** + * Decrypts data using the phpseclib library version 3 + * + * @param string $data + * @param string $password + * + * @return string|null + */ + private function decryptWithPhpseclib3(string $data, string $password): ?string + { + $data_ = PackageFactory::_('Crypt')->decrypt($data, 'aes', $password); + if ($data_ !== null) + { + return strcmp($data, $data_) !== 0 ? $data_ : null; + } + return null; + } + + /** + * Decrypts data using the FOF library (outdated method) + * + * @param string $data + * @param string $password + * + * @return string|null + */ + private function decryptWithFof(string $data, string $password): ?string + { + $data_ = PackageFactory::_('Crypt')->decrypt($data, 'fof', $password); + if ($data_ !== null) + { + return strcmp($data, $data_) !== 0 ? $data_ : null; + } + return null; + } + /** * Update some items after all * @@ -1146,7 +1256,7 @@ protected function decrypt(string $data, string $password, bool $force = false) public function updateAfterAll() { // update the fields - if (isset($this->updateAfter['field']) && ComponentbuilderHelper::checkArray($this->updateAfter['field'])) + if (isset($this->updateAfter['field']) && UtilitiesArrayHelper::check($this->updateAfter['field'])) { // update repeatable foreach ($this->updateAfter['field'] as $field => $action) @@ -1157,12 +1267,12 @@ public function updateAfterAll() $field = $this->newID['field'][$field]; } // get the field from db - if ($xml = ComponentbuilderHelper::getVar('field', $field, 'id', 'xml')) + if ($xml = GetHelper::var('field', $field, 'id', 'xml')) { - if (ComponentbuilderHelper::checkJson($xml)) + if (JsonHelper::check($xml)) { $xml = json_decode($xml); - $fields = ComponentbuilderHelper::getBetween($xml, 'fields="', '"'); + $fields = GetHelper::between($xml, 'fields="', '"'); $fieldsSets = array(); if (strpos($fields, ',') !== false) { @@ -1175,7 +1285,7 @@ public function updateAfterAll() $fieldsSets[] = (int) $fields; } // update the fields - if (ComponentbuilderHelper::checkArray($fieldsSets)) + if (UtilitiesArrayHelper::check($fieldsSets)) { $bucket = array(); foreach ($fieldsSets as $id) @@ -1186,10 +1296,10 @@ public function updateAfterAll() } else { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BMULTIPLE_FIELD_REPEATABLE_MODEB_IDS_MISMATCH_IN_BFIELDSB_AND_WAS_EMREMOVEDEM_FROM_THE_FIELD', $id, $field), 'warning'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_BMULTIPLE_FIELD_REPEATABLE_MODEB_IDS_MISMATCH_IN_BFIELDSB_AND_WAS_EMREMOVEDEM_FROM_THE_FIELD', $id, $field), 'warning'); } } - if (ComponentbuilderHelper::checkArray($bucket)) + if (UtilitiesArrayHelper::check($bucket)) { $string = implode(',', $bucket); $xml = json_encode(str_replace('fields="' . $fields . '"', 'fields="' . $string . '"', $xml)); @@ -1198,7 +1308,7 @@ public function updateAfterAll() { $xml = ''; } - $object = new stdClass; + $object = new \stdClass; $object->id = $field; $object->xml = $xml; // update the field @@ -1209,7 +1319,7 @@ public function updateAfterAll() } } // do a after all run on admin views that need it - if (isset($this->updateAfter['adminview']) && ComponentbuilderHelper::checkArray($this->updateAfter['adminview'])) + if (isset($this->updateAfter['adminview']) && UtilitiesArrayHelper::check($this->updateAfter['adminview'])) { // update the addlinked_views foreach ($this->updateAfter['adminview'] as $adminview => $action) @@ -1220,24 +1330,24 @@ public function updateAfterAll() $adminview = $this->newID['admin_view'][(int) $adminview]; } // get the field from db - if ($addlinked_views = ComponentbuilderHelper::getVar('admin_view', $adminview, 'id', 'addlinked_views')) + if ($addlinked_views = GetHelper::var('admin_view', $adminview, 'id', 'addlinked_views')) { - if (ComponentbuilderHelper::checkJson($addlinked_views)) + if (JsonHelper::check($addlinked_views)) { $addlinked_views = json_decode($addlinked_views, true); // convert Repeatable Fields - if (ComponentbuilderHelper::checkArray($addlinked_views) && isset($addlinked_views['adminview'])) + if (UtilitiesArrayHelper::check($addlinked_views) && isset($addlinked_views['adminview'])) { $addlinked_views = ComponentbuilderHelper::convertRepeatable($addlinked_views, 'addlinked_views'); } // update the view IDs - if (ComponentbuilderHelper::checkArray($addlinked_views)) + if (UtilitiesArrayHelper::check($addlinked_views)) { // only update the view IDs $addlinked_views = $this->updateIDs($addlinked_views, 'admin_view', array('adminview' => 'admin_view')); } // update the fields - $object = new stdClass; + $object = new \stdClass; $object->id = $adminview; $object->addlinked_views = json_encode($addlinked_views, JSON_FORCE_OBJECT); // update the admin view @@ -1247,7 +1357,7 @@ public function updateAfterAll() } } // update the joomla_component dashboard - if (isset($this->updateAfter['joomla_component']) && ComponentbuilderHelper::checkArray($this->updateAfter['joomla_component'])) + if (isset($this->updateAfter['joomla_component']) && UtilitiesArrayHelper::check($this->updateAfter['joomla_component'])) { // update dashboard of the components foreach ($this->updateAfter['joomla_component'] as $component => $action) @@ -1258,9 +1368,9 @@ public function updateAfterAll() $component = $this->newID['joomla_component'][(int) $component]; } // get the dashboard from db - if ($dashboard = ComponentbuilderHelper::getVar('joomla_component', $component, 'id', 'dashboard')) + if ($dashboard = GetHelper::var('joomla_component', $component, 'id', 'dashboard')) { - if (ComponentbuilderHelper::checkString($dashboard)) + if (UtilitiesStringHelper::check($dashboard)) { // get id $id = (int) preg_replace("/[^0-9]/", "", $dashboard); @@ -1286,7 +1396,7 @@ public function updateAfterAll() if ($update) { // now update the joomla_component dashboard value - $object = new stdClass; + $object = new \stdClass; $object->id = (int) $component; $object->dashboard = $dashboard; // update the admin view @@ -1297,7 +1407,7 @@ public function updateAfterAll() } } // update the admin_fields_relations - if (isset($this->updateAfter['relations']) && ComponentbuilderHelper::checkArray($this->updateAfter['relations'])) + if (isset($this->updateAfter['relations']) && UtilitiesArrayHelper::check($this->updateAfter['relations'])) { // update repeatable foreach ($this->updateAfter['relations'] as $relation => $action) @@ -1310,38 +1420,38 @@ public function updateAfterAll() $relation = $this->newID['admin_fields_relations'][$relation]; } // get the set relation from db - if ($addrelations = ComponentbuilderHelper::getVar('admin_fields_relations', $relation, 'id', 'addrelations')) + if ($addrelations = GetHelper::var('admin_fields_relations', $relation, 'id', 'addrelations')) { - if (ComponentbuilderHelper::checkJson($addrelations)) + if (JsonHelper::check($addrelations)) { $addrelations = json_decode($addrelations, true); - if (ComponentbuilderHelper::checkArray($addrelations)) + if (UtilitiesArrayHelper::check($addrelations)) { foreach ($addrelations as $nr => &$value) { // reset the buckets $bucket = array(); // get fields - $found = ComponentbuilderHelper::getAllBetween($value['set'], '[field=', ']'); + $found = GetHelper::allBetween($value['set'], '[field=', ']'); // if found - if (ComponentbuilderHelper::checkArray($found)) + if (UtilitiesArrayHelper::check($found)) { $bucket[] = $found; } // get fields - $found = ComponentbuilderHelper::getAllBetween($value['set'], '$item->{', '}'); + $found = GetHelper::allBetween($value['set'], '$item->{', '}'); // if found - if (ComponentbuilderHelper::checkArray($found)) + if (UtilitiesArrayHelper::check($found)) { $bucket[] = $found; } // check if we have values - if (ComponentbuilderHelper::checkArray($bucket)) + if (UtilitiesArrayHelper::check($bucket)) { - $fields = ComponentbuilderHelper::mergeArrays($bucket); + $fields = UtilitiesArrayHelper::merge($bucket); // reset the buckets $bucket = array(); - if (ComponentbuilderHelper::checkArray($fields)) + if (UtilitiesArrayHelper::check($fields)) { foreach ($fields as $field) { @@ -1352,11 +1462,11 @@ public function updateAfterAll() } else { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BADMIN_FIELDS_RELATIONSB_IDS_MISMATCH_IN_BFIELDSB_AND_WAS_NOT_UPDATED_IN_THE_CUSTOM_CODE', $relation, $field), 'warning'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_BADMIN_FIELDS_RELATIONSB_IDS_MISMATCH_IN_BFIELDSB_AND_WAS_NOT_UPDATED_IN_THE_CUSTOM_CODE', $relation, $field), 'warning'); } } // check if we have a bucket of values to update - if (ComponentbuilderHelper::checkArray($bucket)) + if (UtilitiesArrayHelper::check($bucket)) { $value['set'] = str_replace(array_keys($bucket), array_values($bucket), $value['set']); $update = true; @@ -1367,7 +1477,7 @@ public function updateAfterAll() // update only if needed if ($update) { - $object = new stdClass; + $object = new \stdClass; $object->id = $relation; $object->addrelations = json_encode($addrelations, JSON_FORCE_OBJECT); // update the field @@ -1379,7 +1489,7 @@ public function updateAfterAll() } } // update the verious power linked to these powers - if (isset($this->updateAfter['power']) && ComponentbuilderHelper::checkArray($this->updateAfter['power'])) + if (isset($this->updateAfter['power']) && UtilitiesArrayHelper::check($this->updateAfter['power'])) { // update repeatable foreach ($this->updateAfter['power'] as $power => $action) @@ -1426,7 +1536,7 @@ public function updateAfterAll() public function moveDivergedData() { // check if there is data to move - if (ComponentbuilderHelper::checkArray($this->divergedDataMover)) + if (UtilitiesArrayHelper::check($this->divergedDataMover)) { foreach($this->divergedDataMover as $table => $values) { @@ -1452,13 +1562,13 @@ public function moveDivergedData() * * @return void */ - protected function updateParamIDs(&$item, $table, $targets) + private function updateParamIDs(&$item, $table, $targets) { // update the params fields if exist - if (isset($item->params) && ComponentbuilderHelper::checkJson($item->params)) + if (isset($item->params) && JsonHelper::check($item->params)) { $paramsArray = json_decode($item->params, true); - if (ComponentbuilderHelper::checkArray($paramsArray)) + if (UtilitiesArrayHelper::check($paramsArray)) { foreach ($targets as $field => $targetArray) { @@ -1481,7 +1591,7 @@ protected function updateParamIDs(&$item, $table, $targets) } } // check if we had some subforms - if (ComponentbuilderHelper::checkArray($target_array)) + if (UtilitiesArrayHelper::check($target_array)) { $paramsArray[$field] = $this->updateIDs($paramsArray[$field], $table, $target_array); } @@ -1502,15 +1612,15 @@ protected function updateParamIDs(&$item, $table, $targets) * * @return void */ - protected function updateSubformsIDs(&$item, $table, $targets) + private function updateSubformsIDs(&$item, $table, $targets) { // update the repeatable fields foreach ($targets as $field => $targetArray) { - if (isset($item->{$field}) && ComponentbuilderHelper::checkJson($item->{$field})) + if (isset($item->{$field}) && JsonHelper::check($item->{$field})) { $updateArray = json_decode($item->{$field}, true); - if (ComponentbuilderHelper::checkArray($updateArray)) + if (UtilitiesArrayHelper::check($updateArray)) { // load it back $item->{$field} = json_encode($this->updateIDs($updateArray, $table, $targetArray), JSON_FORCE_OBJECT); @@ -1522,22 +1632,22 @@ protected function updateSubformsIDs(&$item, $table, $targets) /** * Update IDs * - * @param array $values The values to update the IDs in - * @param string $table The table these values belong to - * @param array $targets The target to update and its type + * @param array $values The values to update the IDs in + * @param string $table The table these values belong to + * @param array $targets The target to update and its type * * @return void */ - protected function updateIDs($values, $table, $targets) + private function updateIDs($values, $table, $targets) { $isJson = false; - if (ComponentbuilderHelper::checkJson($values)) + if (JsonHelper::check($values)) { $values = json_decode($values, true); $isJson = true; } // now update the fields - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $nr => &$value) { @@ -1568,27 +1678,27 @@ protected function updateIDs($values, $table, $targets) * @return boolean True on success * */ - protected function setNewID($item, $target, $type, $table) + private function setNewID($item, $target, $type, $table) { $isJson = false; - if (ComponentbuilderHelper::checkJson($item)) + if (JsonHelper::check($item)) { $item = json_decode($item, true); $isJson = true; } - if (ComponentbuilderHelper::checkArray($item) && isset($item[$target])) + if (UtilitiesArrayHelper::check($item) && isset($item[$target])) { // set item ID $itemId = (isset($item['id'])) ? $item['id'] : 'id_unknow'; // check if it is json $isJsonTarget = false; - if (ComponentbuilderHelper::checkJson($item[$target])) + if (JsonHelper::check($item[$target])) { $item[$target] = json_decode($item[$target], true); $isJsonTarget = true; } // update the target - if (ComponentbuilderHelper::checkString($item[$target]) || is_numeric($item[$target])) + if (UtilitiesStringHelper::check($item[$target]) || is_numeric($item[$target])) { if ($item[$target] <= 0) { @@ -1607,7 +1717,7 @@ protected function setNewID($item, $target, $type, $table) $item[$target] = ''; } } - elseif (ComponentbuilderHelper::checkArray($item[$target])) + elseif (UtilitiesArrayHelper::check($item[$target])) { // the bucket to load the items back $bucket = array(); @@ -1622,7 +1732,7 @@ protected function setNewID($item, $target, $type, $table) // we add negative numbers back $bucket[] = $id; } - elseif ((ComponentbuilderHelper::checkString($id) || is_numeric($id)) && isset($this->newID[$type][(int) $id])) + elseif ((UtilitiesStringHelper::check($id) || is_numeric($id)) && isset($this->newID[$type][(int) $id])) { $bucket[] = $this->newID[$type][(int) $id]; } @@ -1632,7 +1742,7 @@ protected function setNewID($item, $target, $type, $table) } } // set ids back - if (ComponentbuilderHelper::checkArray($bucket)) + if (UtilitiesArrayHelper::check($bucket)) { $item[$target] = $bucket; } @@ -1643,19 +1753,19 @@ protected function setNewID($item, $target, $type, $table) $item[$target] = json_encode($item[$target], JSON_FORCE_OBJECT); } } - elseif (ComponentbuilderHelper::checkObject($item) && isset($item->{$target})) + elseif (ObjectHelper::check($item) && isset($item->{$target})) { // set item ID $itemId = (isset($item->id)) ? $item->id : 'id_unknow'; // check if it is json $isJsonTarget = false; - if (ComponentbuilderHelper::checkJson($item->{$target})) + if (JsonHelper::check($item->{$target})) { $item->{$target} = json_decode($item->{$target}, true); $isJsonTarget = true; } // update the target - if (ComponentbuilderHelper::checkString($item->{$target}) || is_numeric($item->{$target})) + if (UtilitiesStringHelper::check($item->{$target}) || is_numeric($item->{$target})) { if ($item->{$target} <= 0) { @@ -1674,7 +1784,7 @@ protected function setNewID($item, $target, $type, $table) $item->{$target} = ''; } } - elseif (ComponentbuilderHelper::checkArray($item->{$target})) + elseif (UtilitiesArrayHelper::check($item->{$target})) { // the bucket to load the items back $bucket = array(); @@ -1689,7 +1799,7 @@ protected function setNewID($item, $target, $type, $table) // we add negative numbers back $bucket[] = $id; } - elseif ((ComponentbuilderHelper::checkString($id) || is_numeric($id)) && isset($this->newID[$type][(int) $id])) + elseif ((UtilitiesStringHelper::check($id) || is_numeric($id)) && isset($this->newID[$type][(int) $id])) { $bucket[] = $this->newID[$type][(int) $id]; } @@ -1700,7 +1810,7 @@ protected function setNewID($item, $target, $type, $table) } } // set ids back - if (ComponentbuilderHelper::checkArray($bucket)) + if (UtilitiesArrayHelper::check($bucket)) { $item->{$target} = $bucket; } @@ -1731,9 +1841,9 @@ protected function setNewID($item, $target, $type, $table) * @return void * */ - protected function enqueueIdMismatchMessage($id, $itemId, $target, $type, $table) + private function enqueueIdMismatchMessage($id, $itemId, $target, $type, $table) { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BSBS_IN_BSB_HAS_ID_MISMATCH_SO_THE_BSB_WAS_REMOVED', ComponentbuilderHelper::safeString($type, 'Ww'), ComponentbuilderHelper::safeString($target, 'Ww') , ComponentbuilderHelper::safeString($table, 'w').':'.$itemId, $type . ':' . $id), 'warning'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_BSBS_IN_BSB_HAS_ID_MISMATCH_SO_THE_BSB_WAS_REMOVED', UtilitiesStringHelper::safe($type, 'Ww'), UtilitiesStringHelper::safe($target, 'Ww') , UtilitiesStringHelper::safe($table, 'w').':'.$itemId, $type . ':' . $id), 'warning'); } /** @@ -1748,7 +1858,7 @@ protected function enqueueIdMismatchMessage($id, $itemId, $target, $type, $table * object on success * **/ - protected function prepItem($item, $type, $action, $diverged = false) + private function prepItem($item, $type, $action, $diverged = false) { // remove access if (isset($item->access)) @@ -1813,12 +1923,12 @@ protected function prepItem($item, $type, $action, $diverged = false) } elseif (!is_numeric($item->fieldtype) || $item->fieldtype == 0) { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BFIELD_TYPEB_NOT_SET_FOR_BSB', ComponentbuilderHelper::safeString($type, 'w').':'.$item->id), 'warning'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_BFIELD_TYPEB_NOT_SET_FOR_BSB', UtilitiesStringHelper::safe($type, 'w').':'.$item->id), 'warning'); unset($item->fieldtype); } else { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BFIELD_TYPEB_IDS_MISMATCH_IN_BSB', $item->fieldtype, ComponentbuilderHelper::safeString($type, 'w').':'.$item->id), 'error'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_BFIELD_TYPEB_IDS_MISMATCH_IN_BSB', $item->fieldtype, UtilitiesStringHelper::safe($type, 'w').':'.$item->id), 'error'); return false; } // if we can't merge add postfix to name @@ -1906,7 +2016,7 @@ protected function prepItem($item, $type, $action, $diverged = false) unset($item->addtables); } // update the addfields (old dataset) - if (isset($item->addfields) && ComponentbuilderHelper::checkJson($item->addfields)) + if (isset($item->addfields) && JsonHelper::check($item->addfields)) { // move the old data $this->setDivergedDataMover($item->addfields, 'admin_fields', 'addfields', $getter); @@ -1914,7 +2024,7 @@ protected function prepItem($item, $type, $action, $diverged = false) // remove from this dataset unset($item->addfields); // update the addlinked_views - if (isset($item->addlinked_views) && ComponentbuilderHelper::checkJson($item->addlinked_views)) + if (isset($item->addlinked_views) && JsonHelper::check($item->addlinked_views)) { $this->updateAfter['adminview'][(int) $item->id] = $action; // addlinked_views } @@ -1923,7 +2033,7 @@ protected function prepItem($item, $type, $action, $diverged = false) unset($item->addlinked_views); } // update the addconditions (old dataset) - if (isset($item->addconditions) && ComponentbuilderHelper::checkJson($item->addconditions)) + if (isset($item->addconditions) && JsonHelper::check($item->addconditions)) { // move the old data $this->setDivergedDataMover($item->addconditions, 'admin_fields_conditions', 'addconditions', $getter); @@ -1972,7 +2082,7 @@ protected function prepItem($item, $type, $action, $diverged = false) // set the anchors getters $getter = array('joomla_component' => $item->id); // update the addconfig - if (isset($item->addconfig) && ComponentbuilderHelper::checkJson($item->addconfig)) + if (isset($item->addconfig) && JsonHelper::check($item->addconfig)) { // move the old data $this->setDivergedDataMover($item->addconfig, 'component_config', 'addconfig', $getter); @@ -1980,7 +2090,7 @@ protected function prepItem($item, $type, $action, $diverged = false) // remove from this dataset unset($item->addconfig); // update the addadmin_views - if (isset($item->addadmin_views) && ComponentbuilderHelper::checkJson($item->addadmin_views)) + if (isset($item->addadmin_views) && JsonHelper::check($item->addadmin_views)) { // move the old data $this->setDivergedDataMover($item->addadmin_views, 'component_admin_views', 'addadmin_views', $getter); @@ -1988,7 +2098,7 @@ protected function prepItem($item, $type, $action, $diverged = false) // remove from this dataset unset($item->addadmin_views); // update the addcustom_admin_views - if (isset($item->addcustom_admin_views) && ComponentbuilderHelper::checkJson($item->addcustom_admin_views)) + if (isset($item->addcustom_admin_views) && JsonHelper::check($item->addcustom_admin_views)) { // move the old data $this->setDivergedDataMover($item->addcustom_admin_views, 'component_custom_admin_views', 'addcustom_admin_views', $getter); @@ -1996,7 +2106,7 @@ protected function prepItem($item, $type, $action, $diverged = false) // remove from this dataset unset($item->addcustom_admin_views); // update the addsite_views - if (isset($item->addsite_views) && ComponentbuilderHelper::checkJson($item->addsite_views)) + if (isset($item->addsite_views) && JsonHelper::check($item->addsite_views)) { // move the old data $this->setDivergedDataMover($item->addsite_views, 'component_site_views', 'addsite_views', $getter); @@ -2004,7 +2114,7 @@ protected function prepItem($item, $type, $action, $diverged = false) // remove from this dataset unset($item->addsite_views); // update the version_update - if (isset($item->version_update) && ComponentbuilderHelper::checkJson($item->version_update)) + if (isset($item->version_update) && JsonHelper::check($item->version_update)) { // move the old data $this->setDivergedDataMover($item->version_update, 'component_updates', 'version_update', $getter); @@ -2012,7 +2122,7 @@ protected function prepItem($item, $type, $action, $diverged = false) // remove from this dataset unset($item->version_update); // update the sql_tweak - if (isset($item->sql_tweak) && ComponentbuilderHelper::checkJson($item->sql_tweak)) + if (isset($item->sql_tweak) && JsonHelper::check($item->sql_tweak)) { // move the old data $this->setDivergedDataMover($item->sql_tweak, 'component_mysql_tweaks', 'sql_tweak', $getter); @@ -2020,7 +2130,7 @@ protected function prepItem($item, $type, $action, $diverged = false) // remove from this dataset unset($item->sql_tweak); // update the addcustommenus - if (isset($item->addcustommenus) && ComponentbuilderHelper::checkJson($item->addcustommenus)) + if (isset($item->addcustommenus) && JsonHelper::check($item->addcustommenus)) { // move the old data $this->setDivergedDataMover($item->addcustommenus, 'component_custom_admin_menus', 'addcustommenus', $getter); @@ -2028,7 +2138,7 @@ protected function prepItem($item, $type, $action, $diverged = false) // remove from this dataset unset($item->addcustommenus); // update the dashboard_tab - if (isset($item->dashboard_tab) && ComponentbuilderHelper::checkJson($item->dashboard_tab)) + if (isset($item->dashboard_tab) && JsonHelper::check($item->dashboard_tab)) { // move the old data $this->setDivergedDataMover($item->dashboard_tab, 'component_dashboard', 'dashboard_tab', $getter); @@ -2045,7 +2155,7 @@ protected function prepItem($item, $type, $action, $diverged = false) unset($item->php_dashboard_methods); unset($item->add_php_dashboard_methods); // update the addfiles - if (isset($item->addfiles) && ComponentbuilderHelper::checkJson($item->addfiles)) + if (isset($item->addfiles) && JsonHelper::check($item->addfiles)) { // move the old data $this->setDivergedDataMover($item->addfiles, 'component_files_folders', 'addfiles', $getter); @@ -2053,7 +2163,7 @@ protected function prepItem($item, $type, $action, $diverged = false) // remove from this dataset unset($item->addfiles); // update the addfolders - if (isset($item->addfolders) && ComponentbuilderHelper::checkJson($item->addfolders)) + if (isset($item->addfolders) && JsonHelper::check($item->addfolders)) { // move the old data $this->setDivergedDataMover($item->addfolders, 'component_files_folders', 'addfolders', $getter); @@ -2068,7 +2178,7 @@ protected function prepItem($item, $type, $action, $diverged = false) // remove from this dataset unset($item->add_css); // update the css - if (isset($item->css) && ComponentbuilderHelper::checkString($item->css)) + if (isset($item->css) && UtilitiesStringHelper::check($item->css)) { $item->css_admin = $item->css; } @@ -2416,10 +2526,10 @@ protected function prepItem($item, $type, $action, $diverged = false) // update the target ID where needed $item = $this->setNewID($item, $lang['target'], 'joomla_component', $type); // load the local targets if found - if (isset($item->{$lang['local']}) && ComponentbuilderHelper::checkJson($item->{$lang['local']})) + if (isset($item->{$lang['local']}) && JsonHelper::check($item->{$lang['local']})) { $targets = array(); - if (isset($item->{$lang['target']}) && ComponentbuilderHelper::checkJson($item->{$lang['target']})) + if (isset($item->{$lang['target']}) && JsonHelper::check($item->{$lang['target']})) { $targets = json_decode($item->{$lang['target']}, true); } @@ -2443,7 +2553,7 @@ protected function prepItem($item, $type, $action, $diverged = false) unset($item->{$lang['local']}); } // load it back - if (isset($targets) && ComponentbuilderHelper::checkArray($targets)) + if (isset($targets) && UtilitiesArrayHelper::check($targets)) { // load it back $item->{$lang['target']} = json_encode(array_values($targets), JSON_FORCE_OBJECT); @@ -2451,8 +2561,8 @@ protected function prepItem($item, $type, $action, $diverged = false) } // merge the translations where needed if (isset($item->translation) && isset($item->localTranslation) - && ComponentbuilderHelper::checkJson($item->translation) - && ComponentbuilderHelper::checkJson($item->localTranslation)) + && JsonHelper::check($item->translation) + && JsonHelper::check($item->localTranslation)) { $newTranslations = json_decode($item->translation, true); $localTranslations = json_decode($item->localTranslation, true); // always the new format @@ -2479,7 +2589,7 @@ protected function prepItem($item, $type, $action, $diverged = false) } } // okay this is the new format lets merge on that basis - elseif (ComponentbuilderHelper::checkArray($newTranslations)) + elseif (UtilitiesArrayHelper::check($newTranslations)) { $translations = $newTranslations; $pointer = count($translations); @@ -2502,17 +2612,17 @@ protected function prepItem($item, $type, $action, $diverged = false) } } // okay seem to only have local translations - elseif (ComponentbuilderHelper::checkArray($localTranslations)) + elseif (UtilitiesArrayHelper::check($localTranslations)) { $translations = $localTranslations; } // only update if we have translations - if (ComponentbuilderHelper::checkArray($translations)) + if (UtilitiesArrayHelper::check($translations)) { $item->translation = json_encode($translations, JSON_FORCE_OBJECT); } } - elseif (isset($item->localTranslation) && ComponentbuilderHelper::checkJson($item->localTranslation)) + elseif (isset($item->localTranslation) && JsonHelper::check($item->localTranslation)) { $item->translation = $item->localTranslation; } @@ -2584,12 +2694,12 @@ protected function prepItem($item, $type, $action, $diverged = false) } // update the repeatable fields - if (isset($updaterR) && ComponentbuilderHelper::checkArray($updaterR)) + if (isset($updaterR) && UtilitiesArrayHelper::check($updaterR)) { $item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR); } // update the subform ids - if (isset($updaterT) && ComponentbuilderHelper::checkArray($updaterT)) + if (isset($updaterT) && UtilitiesArrayHelper::check($updaterT)) { $this->updateSubformsIDs($item, $type, $updaterT); } @@ -2636,11 +2746,11 @@ protected function prepItem($item, $type, $action, $diverged = false) * * @return viod */ - protected function removingFields($type, &$item) + private function removingFields($type, &$item) { // get the columns $columns = $this->getTableColumns("#__componentbuilder_" . $type); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { foreach ($item as $name => $value) { @@ -2649,7 +2759,7 @@ protected function removingFields($type, &$item) // we must show a warning that this field was not imported (but just once) if (!isset($this->fieldImportErrors[$type.$name])) { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FIELD_BSB_NOT_FOUND_IN_LOCAL_DATABASE_TABLE_S_SO_IMPORTED_OF_ITS_VALUES_FAILED_PLEASE_UPDATE_YOUR_JCB_INSTALL_AND_TRY_AGAIN', $name, '#__componentbuilder_' . $type), 'warning'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_FIELD_BSB_NOT_FOUND_IN_LOCAL_DATABASE_TABLE_S_SO_IMPORTED_OF_ITS_VALUES_FAILED_PLEASE_UPDATE_YOUR_JCB_INSTALL_AND_TRY_AGAIN', $name, '#__componentbuilder_' . $type), 'warning'); // make sure the message is not loaded again $this->fieldImportErrors[$type.$name] = true; } @@ -2667,7 +2777,7 @@ protected function removingFields($type, &$item) * * @return array */ - protected function getTableColumns($table) + private function getTableColumns($table) { // check if the columns are in memory if (!isset($this->tableColumns[$table])) @@ -2688,10 +2798,10 @@ protected function getTableColumns($table) * * @return bool */ - protected function setDivergedDataMover($values, $table, $type, $getters) + private function setDivergedDataMover($values, $table, $type, $getters) { // we need to move this to the new $table based on anchors - if (ComponentbuilderHelper::checkArray($getters)) + if (UtilitiesArrayHelper::check($getters)) { if (!isset($this->divergedDataMover[$table])) { @@ -2701,7 +2811,7 @@ protected function setDivergedDataMover($values, $table, $type, $getters) $uniqueKey = md5(serialize($getters)); if (!isset($this->divergedDataMover[$table][$uniqueKey])) { - $this->divergedDataMover[$table][$uniqueKey] = new stdClass; + $this->divergedDataMover[$table][$uniqueKey] = new \stdClass; foreach ($getters as $name => $value) { $this->divergedDataMover[$table][$uniqueKey]->{$name} = $value; @@ -2712,12 +2822,12 @@ protected function setDivergedDataMover($values, $table, $type, $getters) // display more import info if ($this->moreInfo) { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_WE_SUCCESSFULLY_MOVED_BSB', ComponentbuilderHelper::safeString($type, 'Ww') . ' to ('.ComponentbuilderHelper::safeString($table, 'w').')'), 'success'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_WE_SUCCESSFULLY_MOVED_BSB', UtilitiesStringHelper::safe($type, 'Ww') . ' to ('.UtilitiesStringHelper::safe($table, 'w').')'), 'success'); } // success return true; } - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_WE_FAILED_TO_MOVE_BSB', ComponentbuilderHelper::safeString($type, 'Ww') . ' to ('.ComponentbuilderHelper::safeString($table, 'w').')'), 'warning'); + $this->app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_WE_FAILED_TO_MOVE_BSB', UtilitiesStringHelper::safe($type, 'Ww') . ' to ('.UtilitiesStringHelper::safe($table, 'w').')'), 'warning'); // failure return false; } @@ -2730,7 +2840,7 @@ protected function setDivergedDataMover($values, $table, $type, $getters) * @return bool true on success * */ - protected function checkMultiFields($typeID) + private function checkMultiFields($typeID) { if(isset($this->isMultiple[$typeID])) { @@ -2759,12 +2869,12 @@ protected function checkMultiFields($typeID) * @return string field type * */ - protected function getFieldType($id) + private function getFieldType($id) { if (!isset($this->fieldTypes[$id])) { - $properties = ComponentbuilderHelper::getVar('fieldtype', $id, 'id', 'properties'); - if (ComponentbuilderHelper::checkJson($properties)) + $properties = GetHelper::var('fieldtype', $id, 'id', 'properties'); + if (JsonHelper::check($properties)) { $properties = json_decode($properties, true); // check if this is old values for repeatable fields @@ -2777,7 +2887,7 @@ protected function getFieldType($id) { if ('type' === $property['name']) { - if (isset($property['example']) && ComponentbuilderHelper::checkString($property['example'])) + if (isset($property['example']) && UtilitiesStringHelper::check($property['example'])) { $this->fieldTypes[$id] = $property['example']; break; @@ -2786,9 +2896,9 @@ protected function getFieldType($id) } } // if not found - if (!isset($this->fieldTypes[$id]) && $name = ComponentbuilderHelper::getVar('fieldtype', $id, 'id', 'name')) + if (!isset($this->fieldTypes[$id]) && $name = GetHelper::var('fieldtype', $id, 'id', 'name')) { - $this->fieldTypes[$id] = ComponentbuilderHelper::safeString($name); + $this->fieldTypes[$id] = UtilitiesStringHelper::safe($name); } } // return the type @@ -2810,7 +2920,7 @@ protected function getFieldType($id) * ID int on success * **/ - protected function updateLocalItem(&$item, $type, &$canState) + private function updateLocalItem(&$item, $type, &$canState) { // prep the item if ($update = $this->prepItem($item, $type, 'update')) @@ -2841,7 +2951,7 @@ protected function updateLocalItem(&$item, $type, &$canState) * ID int on success * **/ - protected function addLocalItem(&$item, $type, $diverged = false) + private function addLocalItem(&$item, $type, $diverged = false) { // prep the item if ($add = $this->prepItem($item, $type, 'add', $diverged)) @@ -2872,7 +2982,7 @@ protected function addLocalItem(&$item, $type, $diverged = false) * ID int on success * **/ - protected function getLocalItem($item, $type, $retry = false, $get = 1, $diverged = false) + private function getLocalItem($item, $type, $retry = false, $get = 1, $diverged = false) { $query = $this->_db->getQuery(true); $query->select('a.*'); @@ -2882,7 +2992,7 @@ protected function getLocalItem($item, $type, $retry = false, $get = 1, $diverge // we first try to get the item by GUID if ($get == 1 && isset($item->guid)) { - if (($item = ComponentbuilderHelper::getGUID($item->guid, $type, 'a.*')) !== false) + if (($item = GuidHelper::item($item->guid, $type, 'a.*')) !== false) { return $item; } @@ -2912,7 +3022,7 @@ protected function getLocalItem($item, $type, $retry = false, $get = 1, $diverge // set to run query $runQuery = true; } - elseif (componentbuilderHelper::checkArray($get)) + elseif (UtilitiesArrayHelper::check($get)) { foreach ($get as $field) { @@ -2923,7 +3033,7 @@ protected function getLocalItem($item, $type, $retry = false, $get = 1, $diverge // set the value $value = $item->{$field}; // check if we have special value - if ($this->specialValue && ComponentbuilderHelper::checkArray($this->specialValue) && isset($this->specialValue[$field])) + if ($this->specialValue && UtilitiesArrayHelper::check($this->specialValue) && isset($this->specialValue[$field])) { $value = $this->specialValue[$field]; } @@ -2936,7 +3046,7 @@ protected function getLocalItem($item, $type, $retry = false, $get = 1, $diverge { $query->where($this->_db->quoteName('a.' . $field) . ' = '. (float) $value); } - elseif(componentbuilderHelper::checkString($value)) // do not allow empty strings (since it could be major mis match) + elseif(UtilitiesStringHelper::check($value)) // do not allow empty strings (since it could be major mis match) { $query->where($this->_db->quoteName('a.' . $field) . ' = '. $this->_db->quote($value)); } @@ -2960,7 +3070,7 @@ protected function getLocalItem($item, $type, $retry = false, $get = 1, $diverge // set the value $value = $item->{$get}; // check if we have special value - if ($this->specialValue && ComponentbuilderHelper::checkArray($this->specialValue) && isset($this->specialValue[$get])) + if ($this->specialValue && UtilitiesArrayHelper::check($this->specialValue) && isset($this->specialValue[$get])) { $value = $this->specialValue[$get]; } @@ -2973,7 +3083,7 @@ protected function getLocalItem($item, $type, $retry = false, $get = 1, $diverge { $query->where($this->_db->quoteName('a.' . $get) . ' = '. (float) $value); } - elseif(componentbuilderHelper::checkString($value)) // do not allow empty strings (since it could be major mis match) + elseif(UtilitiesStringHelper::check($value)) // do not allow empty strings (since it could be major mis match) { $query->where($this->_db->quoteName('a.' . $get) . ' = '. $this->_db->quote($value)); } @@ -3137,20 +3247,20 @@ protected function getLocalItem($item, $type, $retry = false, $get = 1, $diverge // get by name ... $getter = array('name', 'gettype', 'main_source'); // risky will look at this again // add some more advanced search - if (isset($item->main_source) && $item->main_source == 1 && isset($item->view_selection) && ComponentbuilderHelper::checkString($item->view_selection)) + if (isset($item->main_source) && $item->main_source == 1 && isset($item->view_selection) && UtilitiesStringHelper::check($item->view_selection)) { $getter[] = 'view_selection'; } - elseif (isset($item->main_source) && $item->main_source == 2 && isset($item->db_selection) && ComponentbuilderHelper::checkString($item->db_selection)) + elseif (isset($item->main_source) && $item->main_source == 2 && isset($item->db_selection) && UtilitiesStringHelper::check($item->db_selection)) { $getter[] = 'db_selection'; } - elseif (isset($item->main_source) && $item->main_source == 3 && isset($item->php_custom_get) && ComponentbuilderHelper::checkString($item->php_custom_get)) + elseif (isset($item->main_source) && $item->main_source == 3 && isset($item->php_custom_get) && UtilitiesStringHelper::check($item->php_custom_get)) { $getter[] = 'php_custom_get'; } // add some extra - if (isset($item->getcustom) && ComponentbuilderHelper::checkString($item->getcustom)) + if (isset($item->getcustom) && UtilitiesStringHelper::check($item->getcustom)) { $getter[] = 'getcustom'; } @@ -3396,7 +3506,7 @@ protected function getLocalItem($item, $type, $retry = false, $get = 1, $diverge * @return string The updated path * */ - protected function setFullPath($path) + private function setFullPath($path) { return str_replace(array_keys(ComponentbuilderHelper::$constantPaths), array_values(ComponentbuilderHelper::$constantPaths), $path); } @@ -3408,24 +3518,25 @@ protected function setFullPath($path) * * @return string The full path * */ - protected function setDynamicPath($path) + private function setDynamicPath($path) { // now convert to path $path = str_replace('__v_d_m__', '/', $path); // add the full path if possible return str_replace('//', '/', $this->setFullPath($path)); - } + } + protected function getAlias($name,$type = false) { // sanitize the name to an alias - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $alias = JFilterOutput::stringURLUnicodeSlug($name); + $alias = OutputFilter::stringURLUnicodeSlug($name); } else { - $alias = JFilterOutput::stringURLSafe($name); + $alias = OutputFilter::stringURLSafe($name); } // must be a uniqe alias if ($type) @@ -3434,7 +3545,7 @@ protected function getAlias($name,$type = false) } return $alias; } - + /** * Method to generate a uniqe value. * @@ -3449,16 +3560,16 @@ protected function getUniqe($value,$field,$type) // insure the filed is always uniqe while (isset($this->uniqeValueArray[$type][$field][$value])) { - $value = JString::increment($value, 'dash'); + $value = StringHelper::increment($value, 'dash'); } $this->uniqeValueArray[$type][$field][$value] = $value; return $value; } - + protected function getAliasesUsed($table) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // first we check if there is a alias column $columns = $db->getTableColumns('#__componentbuilder_'.$table); if(isset($columns['alias'])){ diff --git a/admin/models/import_language_translations.php b/admin/models/import_language_translations.php index 7c85a0328..d38a17ee8 100644 --- a/admin/models/import_language_translations.php +++ b/admin/models/import_language_translations.php @@ -12,11 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Filesystem\Path; +use Joomla\CMS\Filter\OutputFilter; +use Joomla\CMS\Installer\InstallerHelper; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; use PhpOffice\PhpSpreadsheet\IOFactory; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\JsonHelper; /** * Componentbuilder Import_language_translations Base Database Model @@ -26,8 +35,8 @@ class ComponentbuilderModelImport_language_translations extends BaseDatabaseMode // set uploading values protected $use_streams = false; protected $allow_unsafe = false; - protected $safeFileOptions = array(); - + protected $safeFileOptions = []; + /** * @var object JTable object */ @@ -44,13 +53,13 @@ class ComponentbuilderModelImport_language_translations extends BaseDatabaseMode * @var string */ protected $_context = 'com_componentbuilder.import_language_translations'; - + /** * Import Settings */ protected $getType = NULL; protected $dataType = NULL; - + /** * Method to auto-populate the model state. * @@ -61,7 +70,7 @@ class ComponentbuilderModelImport_language_translations extends BaseDatabaseMode */ protected function populateState() { - $app = JFactory::getApplication('administrator'); + $app = Factory::getApplication('administrator'); $this->setState('message', $app->getUserState('com_componentbuilder.message')); $app->setUserState('com_componentbuilder.message', ''); @@ -81,8 +90,8 @@ protected function populateState() public function import() { $this->setState('action', 'import'); - $app = JFactory::getApplication(); - $session = JFactory::getSession(); + $app = Factory::getApplication(); + $session = Factory::getSession(); $package = null; $continue = false; // get import type @@ -119,7 +128,7 @@ public function import() break; default: - $app->setUserState('com_componentbuilder.message', JText::_('COM_COMPONENTBUILDER_IMPORT_NO_IMPORT_TYPE_FOUND')); + $app->setUserState('com_componentbuilder.message', Text::_('COM_COMPONENTBUILDER_IMPORT_NO_IMPORT_TYPE_FOUND')); return false; break; @@ -133,7 +142,7 @@ public function import() $this->remove($package['packagename']); } - $app->setUserState('com_componentbuilder.message', JText::_('COM_COMPONENTBUILDER_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); + $app->setUserState('com_componentbuilder.message', Text::_('COM_COMPONENTBUILDER_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); return false; } @@ -150,7 +159,7 @@ public function import() if (!$this->setData($package,$this->dataType,$headerList)) { // There was an error importing the package - $msg = JText::_('COM_COMPONENTBUILDER_IMPORT_ERROR'); + $msg = Text::_('COM_COMPONENTBUILDER_IMPORT_ERROR'); $back = $session->get('backto_VDM_IMPORT', NULL); if ($back) { @@ -162,7 +171,7 @@ public function import() else { // Package imported sucessfully - $msg = JText::sprintf('COM_COMPONENTBUILDER_IMPORT_SUCCESS', $package['packagename']); + $msg = Text::sprintf('COM_COMPONENTBUILDER_IMPORT_SUCCESS', $package['packagename']); $back = $session->get('backto_VDM_IMPORT', NULL); if ($back) { @@ -179,7 +188,7 @@ public function import() $this->remove($package['packagename']); $session->clear($this->getType.'_VDM_IMPORTHEADERS'); return $result; - } + } /** * Works out an importation spreadsheet from a HTTP upload @@ -187,37 +196,37 @@ public function import() * @return spreadsheet definition or false on failure */ protected function _getPackageFromUpload() - { + { // Get the uploaded file information - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get. $userfile = $input->files->get('import_package', null, 'raw'); - + // Make sure that file uploads are enabled in php if (!(bool) ini_get('file_uploads')) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); return false; } // If there is no uploaded file, we have a problem... if (!is_array($userfile)) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); return false; } // Check if there was a problem uploading the file. if ($userfile['error'] || $userfile['size'] < 1) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); return false; } // Build the appropriate paths - $config = JFactory::getConfig(); + $config = Factory::getConfig(); $tmp_dest = $config->get('tmp_path') . '/' . $userfile['name']; $tmp_src = $userfile['tmp_name']; @@ -227,7 +236,7 @@ protected function _getPackageFromUpload() // Was the package downloaded? if (!$p_file) { - $session = JFactory::getSession(); + $session = Factory::getSession(); $session->clear('package'); $session->clear('dataType'); $session->clear('hasPackage'); @@ -249,16 +258,16 @@ protected function _getPackageFromUpload() */ protected function _getPackageFromFolder() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Get the path to the package to import $p_dir = $input->getString('import_directory'); - $p_dir = JPath::clean($p_dir); + $p_dir = Path::clean($p_dir); // Did you give us a valid path? if (!file_exists($p_dir)) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); return false; } @@ -268,17 +277,17 @@ protected function _getPackageFromFolder() // Did you give us a valid package? if (!$type) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); } - + // check the extention if(!$this->checkExtension($p_dir)) { // set error message - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); return false; } - + $package['packagename'] = null; $package['dir'] = $p_dir; $package['type'] = $type; @@ -294,7 +303,7 @@ protected function _getPackageFromFolder() */ protected function _getPackageFromUrl() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Get the URL of the package to import @@ -303,17 +312,17 @@ protected function _getPackageFromUrl() // Did you give us a URL? if (!$url) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_ENTER_A_URL'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_ENTER_A_URL'), 'warning'); return false; } // Download the package at the URL given - $p_file = JInstallerHelper::downloadPackage($url); + $p_file = InstallerHelper::downloadPackage($url); // Was the package downloaded? if (!$p_file) { - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_INVALID_URL'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_INVALID_URL'), 'warning'); return false; } @@ -322,7 +331,7 @@ protected function _getPackageFromUrl() return $package; } - + /** * Check a file and verifies it as a spreadsheet file * Supports .csv .xlsx .xls and .ods @@ -334,29 +343,29 @@ protected function _getPackageFromUrl() */ protected function check($archivename) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Clean the name - $archivename = JPath::clean($archivename); - + $archivename = Path::clean($archivename); + // check the extention if(!$this->checkExtension($archivename)) { // Cleanup the import files $this->remove($archivename); - $app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); return false; } - - $config = JFactory::getConfig(); + + $config = Factory::getConfig(); // set Package Name $check['packagename'] = $archivename; - + // set directory $check['dir'] = $config->get('tmp_path'). '/' .$archivename; - + // set type $check['type'] = $this->getType; - + return $check; } @@ -392,9 +401,7 @@ protected function checkExtension($file) */ protected function remove($package) { - jimport('joomla.filesystem.file'); - - $config = JFactory::getConfig(); + $config = Factory::getConfig(); $package = $config->get('tmp_path'). '/' .$package; // Is the package file a valid file? @@ -402,10 +409,10 @@ protected function remove($package) { File::delete($package); } - elseif (is_file(JPath::clean($package))) + elseif (is_file(Path::clean($package))) { // It might also be just a base filename - File::delete(JPath::clean($package)); + File::delete(Path::clean($package)); } } @@ -419,11 +426,11 @@ protected function remove($package) **/ protected function setData($package,$table,$target_headers) { - if (ComponentbuilderHelper::checkArray($target_headers)) + if (UtilitiesArrayHelper::check($target_headers)) { // make sure the file is loaded ComponentbuilderHelper::composerAutoload('phpspreadsheet'); - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; foreach($target_headers as $header) { if (($column = $jinput->getString($header, false)) !== false || @@ -463,10 +470,10 @@ protected function setData($package,$table,$target_headers) protected function save($data, $table) { // import the data if there is any - if(ComponentbuilderHelper::checkArray($data['array'])) + if(UtilitiesArrayHelper::check($data['array'])) { // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // remove header if it has headers $id_key = $data['target_headers']['id']; if (isset($data['target_headers']['Source'])) @@ -489,14 +496,14 @@ protected function save($data, $table) array_shift($data['array']); } // make sure there is still values in array and that it was not only headers - if(ComponentbuilderHelper::checkArray($data['array']) && $user->authorise($table.'.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) + if(UtilitiesArrayHelper::check($data['array']) && $user->authorise($table.'.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // set target. $target = array_flip($data['target_headers']); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // set some defaults - $todayDate = JFactory::getDate()->toSql(); + $todayDate = Factory::getDate()->toSql(); // get global action permissions $canDo = ComponentbuilderHelper::getActions($table); $canEdit = $canDo->get('core.edit'); @@ -510,7 +517,7 @@ protected function save($data, $table) $found = false; $has_id = false; // check that we have a string or a number<-(which is weird... but happens at times) - if ($canEdit && isset($row[$source_key]) && (ComponentbuilderHelper::checkString($row[$source_key]) || is_numeric($row[$source_key]))) + if ($canEdit && isset($row[$source_key]) && (UtilitiesStringHelper::check($row[$source_key]) || is_numeric($row[$source_key]))) { // raw items import & update! $query = $db->getQuery(true); @@ -547,7 +554,7 @@ protected function save($data, $table) $item = $db->loadObject(); $id = $item->id; // load previous translation strings - if (ComponentbuilderHelper::checkJson($item->translation)) + if (JsonHelper::check($item->translation)) { $translations = json_decode($item->translation, true); $counter = count($translations) + 2; @@ -584,7 +591,7 @@ protected function save($data, $table) if(in_array($target[$key], $languages)) { // only add if it has a string - if (ComponentbuilderHelper::checkString($cell)) + if (UtilitiesStringHelper::check($cell)) { // remove if was set previously if ($pre) @@ -620,7 +627,7 @@ function($trans) use($tag) { } } // set the translation - if (ComponentbuilderHelper::checkArray($translations)) + if (UtilitiesArrayHelper::check($translations)) { $fields[] = $db->quoteName('translation') . ' = ' . $db->quote(json_encode($translations, JSON_FORCE_OBJECT)); // load the defaults @@ -661,7 +668,7 @@ function($trans) use($tag) { if(in_array($target[$key], $languages)) { // only add if it has a string - if (ComponentbuilderHelper::checkString($cell)) + if (UtilitiesStringHelper::check($cell)) { $translations['translation'.$counter] = array('language' => $target[$key], 'translation' => $cell); $counter++; @@ -692,13 +699,13 @@ function($trans) use($tag) { } } // set the translation - if (ComponentbuilderHelper::checkArray($translations)) + if (UtilitiesArrayHelper::check($translations)) { $columns[] = 'translation'; $values[] = $db->quote(json_encode($translations, JSON_FORCE_OBJECT)); } // check if we have values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { // load the defaults $columns[] = 'created_by'; @@ -723,13 +730,13 @@ function($trans) use($tag) { protected function getAlias($name,$type = false) { // sanitize the name to an alias - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $alias = JFilterOutput::stringURLUnicodeSlug($name); + $alias = OutputFilter::stringURLUnicodeSlug($name); } else { - $alias = JFilterOutput::stringURLSafe($name); + $alias = OutputFilter::stringURLSafe($name); } // must be a uniqe alias if ($type) @@ -738,7 +745,7 @@ protected function getAlias($name,$type = false) } return $alias; } - + /** * Method to generate a uniqe value. * @@ -753,16 +760,16 @@ protected function getUniqe($value,$field,$type) // insure the filed is always uniqe while (isset($this->uniqeValueArray[$type][$field][$value])) { - $value = JString::increment($value, 'dash'); + $value = StringHelper::increment($value, 'dash'); } $this->uniqeValueArray[$type][$field][$value] = $value; return $value; } - + protected function getAliasesUsed($table) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // first we check if there is a alias column $columns = $db->getTableColumns('#__componentbuilder_'.$table); if(isset($columns['alias'])){ diff --git a/admin/models/joomla_component.php b/admin/models/joomla_component.php index 087ddc912..8ef9f3208 100644 --- a/admin/models/joomla_component.php +++ b/admin/models/joomla_component.php @@ -12,10 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\FOF\Encrypt\AES; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\String\ComponentCodeNameHelper; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Componentbuilder\Extrusion\Helper\Extrusion; /** * Componentbuilder Joomla_component Admin Model @@ -61,6 +77,7 @@ class ComponentbuilderModelJoomla_component extends AdminModel ), 'above' => array( 'system_name', + 'preferred_joomla_version', 'add_powers' ), 'under' => array( @@ -101,7 +118,15 @@ class ComponentbuilderModelJoomla_component extends AdminModel 'note_update_server_note_other', 'update_server', 'add_sales_server', - 'sales_server' + 'sales_server', + 'add_backup_folder_path', + 'note_backup_folder_path', + 'backup_folder_path', + 'add_git_folder_path', + 'note_git_folder_path', + 'git_folder_path', + 'add_jcb_powers_path', + 'jcb_powers_path' ), 'right' => array( 'translation_tool', @@ -112,15 +137,6 @@ class ComponentbuilderModelJoomla_component extends AdminModel 'crowdin_account_api_key' ) ), - 'readme' => array( - 'left' => array( - 'addreadme', - 'readme' - ), - 'right' => array( - 'note_readme' - ) - ), 'dash_install' => array( 'left' => array( 'dashboard_type' @@ -140,7 +156,18 @@ class ComponentbuilderModelJoomla_component extends AdminModel 'add_php_postflight_update', 'php_postflight_update', 'add_php_method_uninstall', - 'php_method_uninstall' + 'php_method_uninstall', + 'add_php_method_install', + 'php_method_install' + ) + ), + 'readme' => array( + 'left' => array( + 'addreadme', + 'readme' + ), + 'right' => array( + 'note_readme' ) ), 'mysql' => array( @@ -152,7 +179,7 @@ class ComponentbuilderModelJoomla_component extends AdminModel 'assets_table_fix' ) ), - 'dynamic_build_beta' => array( + 'dynamic_build' => array( 'fullwidth' => array( 'note_buildcomp_dynamic_mysql', 'buildcomp', @@ -172,19 +199,22 @@ class ComponentbuilderModelJoomla_component extends AdminModel 'right' => array( 'note_component_files_folders', 'spacer_hr_4', + 'add_namespace_prefix', + 'namespace_prefix', + 'spacer_hr_5', 'add_menu_prefix', 'menu_prefix', - 'spacer_hr_5', + 'spacer_hr_6', 'to_ignore_note', 'toignore', - 'spacer_hr_6', + 'spacer_hr_7', 'jcb_export_package_note', 'export_key', 'joomla_source_link', 'export_buy_link' ), 'fullwidth' => array( - 'spacer_hr_7', + 'spacer_hr_8', 'note_on_contributors', 'addcontributors', 'emptycontributors', @@ -232,16 +262,16 @@ class ComponentbuilderModelJoomla_component extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'joomla_component', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'joomla_component', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -273,17 +303,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'joomla_component__'.$id); ComponentbuilderHelper::set('joomla_component__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -312,7 +341,7 @@ public function getVDM() ) ); - + /** * Method to get a single record. * @@ -342,16 +371,16 @@ public function getItem($pk = null) $item->metadata = $registry->toArray(); } - if (!empty($item->php_helper_both)) + if (!empty($item->php_site_event)) { - // base64 Decode php_helper_both. - $item->php_helper_both = base64_decode($item->php_helper_both); + // base64 Decode php_site_event. + $item->php_site_event = base64_decode($item->php_site_event); } - if (!empty($item->php_method_uninstall)) + if (!empty($item->php_admin_event)) { - // base64 Decode php_method_uninstall. - $item->php_method_uninstall = base64_decode($item->php_method_uninstall); + // base64 Decode php_admin_event. + $item->php_admin_event = base64_decode($item->php_admin_event); } if (!empty($item->php_preflight_install)) @@ -360,22 +389,16 @@ public function getItem($pk = null) $item->php_preflight_install = base64_decode($item->php_preflight_install); } - if (!empty($item->css_admin)) - { - // base64 Decode css_admin. - $item->css_admin = base64_decode($item->css_admin); - } - - if (!empty($item->php_admin_event)) + if (!empty($item->php_method_uninstall)) { - // base64 Decode php_admin_event. - $item->php_admin_event = base64_decode($item->php_admin_event); + // base64 Decode php_method_uninstall. + $item->php_method_uninstall = base64_decode($item->php_method_uninstall); } - if (!empty($item->php_site_event)) + if (!empty($item->css_admin)) { - // base64 Decode php_site_event. - $item->php_site_event = base64_decode($item->php_site_event); + // base64 Decode css_admin. + $item->css_admin = base64_decode($item->css_admin); } if (!empty($item->php_postflight_install)) @@ -384,10 +407,16 @@ public function getItem($pk = null) $item->php_postflight_install = base64_decode($item->php_postflight_install); } - if (!empty($item->sql_uninstall)) + if (!empty($item->sql)) { - // base64 Decode sql_uninstall. - $item->sql_uninstall = base64_decode($item->sql_uninstall); + // base64 Decode sql. + $item->sql = base64_decode($item->sql); + } + + if (!empty($item->buildcompsql)) + { + // base64 Decode buildcompsql. + $item->buildcompsql = base64_decode($item->buildcompsql); } if (!empty($item->php_helper_admin)) @@ -426,16 +455,16 @@ public function getItem($pk = null) $item->php_postflight_update = base64_decode($item->php_postflight_update); } - if (!empty($item->sql)) + if (!empty($item->php_method_install)) { - // base64 Decode sql. - $item->sql = base64_decode($item->sql); + // base64 Decode php_method_install. + $item->php_method_install = base64_decode($item->php_method_install); } - if (!empty($item->buildcompsql)) + if (!empty($item->sql_uninstall)) { - // base64 Decode buildcompsql. - $item->buildcompsql = base64_decode($item->buildcompsql); + // base64 Decode sql_uninstall. + $item->sql_uninstall = base64_decode($item->sql_uninstall); } if (!empty($item->readme)) @@ -444,16 +473,16 @@ public function getItem($pk = null) $item->readme = base64_decode($item->readme); } + if (!empty($item->php_helper_both)) + { + // base64 Decode php_helper_both. + $item->php_helper_both = base64_decode($item->php_helper_both); + } + // Get the basic encryption. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey); - - if (!empty($item->whmcs_key) && $basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true))) - { - // basic decrypt data whmcs_key. - $item->whmcs_key = rtrim($basic->decryptString($item->whmcs_key), "\0"); - } + $basic = new AES($basickey); if (!empty($item->crowdin_username) && $basickey && !is_numeric($item->crowdin_username) && $item->crowdin_username === base64_encode(base64_decode($item->crowdin_username, true))) { @@ -461,6 +490,12 @@ public function getItem($pk = null) $item->crowdin_username = rtrim($basic->decryptString($item->crowdin_username), "\0"); } + if (!empty($item->whmcs_key) && $basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true))) + { + // basic decrypt data whmcs_key. + $item->whmcs_key = rtrim($basic->decryptString($item->whmcs_key), "\0"); + } + if (!empty($item->export_key) && $basickey && !is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true))) { // basic decrypt data export_key. @@ -504,24 +539,23 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'joomla_component__'.$id); ComponentbuilderHelper::set('joomla_component__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } } // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; // repeatable values to check $arrayChecker = array( @@ -566,7 +600,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -593,7 +627,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -606,7 +640,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -667,20 +701,20 @@ public function getForm($data = array(), $loadData = true, $options = array('con if (0 == $id) { // set company defaults - $form->setValue('companyname', null, JComponentHelper::getParams('com_componentbuilder')->get('export_company', '')); - $form->setValue('author', null, JComponentHelper::getParams('com_componentbuilder')->get('export_owner', '')); - $form->setValue('email', null, JComponentHelper::getParams('com_componentbuilder')->get('export_email', '')); - $form->setValue('website', null, JComponentHelper::getParams('com_componentbuilder')->get('export_website', '')); - $form->setValue('copyright', null, JComponentHelper::getParams('com_componentbuilder')->get('export_copyright', 'Copyright (C) 2015. All Rights Reserved')); - $form->setValue('license', null, JComponentHelper::getParams('com_componentbuilder')->get('export_license', 'GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html')); + $form->setValue('companyname', null, ComponentHelper::getParams('com_componentbuilder')->get('export_company', '')); + $form->setValue('author', null, ComponentHelper::getParams('com_componentbuilder')->get('export_owner', '')); + $form->setValue('email', null, ComponentHelper::getParams('com_componentbuilder')->get('export_email', '')); + $form->setValue('website', null, ComponentHelper::getParams('com_componentbuilder')->get('export_website', '')); + $form->setValue('copyright', null, ComponentHelper::getParams('com_componentbuilder')->get('export_copyright', 'Copyright (C) 2015. All Rights Reserved')); + $form->setValue('license', null, ComponentHelper::getParams('com_componentbuilder')->get('export_license', 'GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html')); } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -695,7 +729,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con // Only load the GUID if new item (or empty) if (0 == $id || !($val = $form->getValue('guid'))) { - $form->setValue('guid', null, ComponentbuilderHelper::GUID()); + $form->setValue('guid', null, GuidHelper::get()); } return $form; @@ -704,13 +738,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/joomla_component.js'; } - + /** * Method to test whether a record can be deleted. * @@ -729,7 +763,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('joomla_component.delete', 'com_componentbuilder.joomla_component.' . (int) $record->id); } @@ -747,8 +781,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -759,31 +793,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('joomla_component.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('joomla_component.edit', 'com_componentbuilder.joomla_component.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('joomla_component.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -791,19 +825,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -815,7 +849,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_joomla_component')); @@ -830,7 +864,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -845,10 +879,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.joomla_component.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.joomla_component.data', []); if (empty($data)) { @@ -876,7 +910,7 @@ protected function loadFormData() public function validate($form, $data, $group = null) { // check if the not_required field is set - if (isset($data['not_required']) && ComponentbuilderHelper::checkString($data['not_required'])) + if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required'])) { $requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = array_unique($requiredFields); @@ -884,7 +918,7 @@ public function validate($form, $data, $group = null) foreach ($requiredFields as $requiredField) { // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) + if (UtilitiesStringHelper::check($requiredField)) { // change to false $form->setFieldAttribute($requiredField, 'required', 'false'); @@ -907,7 +941,7 @@ protected function getUniqueFields() { return array('guid'); } - + /** * Method to delete one or more records. * @@ -925,7 +959,7 @@ public function delete(&$pks) } // we must also delete the linked tables found - if (ComponentbuilderHelper::checkArray($pks)) + if (UtilitiesArrayHelper::check($pks)) { $_tablesArray = array( 'component_admin_views' => 'joomla_component', @@ -938,7 +972,8 @@ public function delete(&$pks) 'component_dashboard' => 'joomla_component', 'component_files_folders' => 'joomla_component', 'component_placeholders' => 'joomla_component', - 'custom_code' => 'component' + 'custom_code' => 'component', + 'component_router' => 'joomla_component' ); foreach($_tablesArray as $_updateTable => $_key) { @@ -952,7 +987,7 @@ public function delete(&$pks) } } } - + return true; } @@ -974,7 +1009,7 @@ public function publish(&$pks, $value = 1) } // we must also update all linked tables - if (ComponentbuilderHelper::checkArray($pks)) + if (UtilitiesArrayHelper::check($pks)) { $_tablesArray = array( 'component_admin_views' => 'joomla_component', @@ -987,7 +1022,8 @@ public function publish(&$pks, $value = 1) 'component_dashboard' => 'joomla_component', 'component_files_folders' => 'joomla_component', 'component_placeholders' => 'joomla_component', - 'custom_code' => 'component' + 'custom_code' => 'component', + 'component_router' => 'joomla_component' ); foreach($_tablesArray as $_updateTable => $_key) { @@ -1001,10 +1037,10 @@ public function publish(&$pks, $value = 1) } } } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -1030,30 +1066,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('joomla_component'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('joomla_component'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -1090,8 +1126,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -1117,7 +1152,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_component'); @@ -1143,7 +1178,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -1156,7 +1191,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('joomla_component.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -1172,19 +1207,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->system_name) && !is_numeric($this->table->system_name)) + if (UtilitiesStringHelper::check($this->table->system_name) && !is_numeric($this->table->system_name)) { $this->table->system_name = $this->generateUnique('system_name',$this->table->system_name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -1196,7 +1231,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1260,7 +1295,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_component'); @@ -1268,7 +1303,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('joomla_component.edit') && !$this->canDo->get('joomla_component.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1285,7 +1320,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('joomla_component.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1301,13 +1336,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -1351,7 +1386,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -1363,43 +1398,48 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // 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']; } + // make sure that the component code name is safe. + if (isset($data['name_code']) && is_string($data['name_code'])) + { + $data['name_code'] = ComponentCodeNameHelper::safe($data['name_code']); + } // Set the GUID if empty or not valid if (empty($data['guid']) && $data['id'] > 0) { // get the existing one - $data['guid'] = (string) ComponentbuilderHelper::getVar('joomla_component', $data['id'], 'id', 'guid'); + $data['guid'] = (string) GetHelper::var('joomla_component', $data['id'], 'id', 'guid'); } + // Set the GUID if empty or not valid - while (!ComponentbuilderHelper::validGUID($data['guid'], "joomla_component", $data['id'])) + while (!GuidHelper::valid($data['guid'], "joomla_component", $data['id'])) { // must always be set - $data['guid'] = (string) ComponentbuilderHelper::GUID(); - } - + $data['guid'] = (string) GuidHelper::get(); + } // Set the addcontributors items to data. if (isset($data['addcontributors']) && is_array($data['addcontributors'])) { - $addcontributors = new JRegistry; + $addcontributors = new Registry; $addcontributors->loadArray($data['addcontributors']); $data['addcontributors'] = (string) $addcontributors; } @@ -1409,16 +1449,16 @@ public function save($data) $data['addcontributors'] = ''; } - // Set the php_helper_both string to base64 string. - if (isset($data['php_helper_both'])) + // Set the php_site_event string to base64 string. + if (isset($data['php_site_event'])) { - $data['php_helper_both'] = base64_encode($data['php_helper_both']); + $data['php_site_event'] = base64_encode($data['php_site_event']); } - // Set the php_method_uninstall string to base64 string. - if (isset($data['php_method_uninstall'])) + // Set the php_admin_event string to base64 string. + if (isset($data['php_admin_event'])) { - $data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']); + $data['php_admin_event'] = base64_encode($data['php_admin_event']); } // Set the php_preflight_install string to base64 string. @@ -1427,22 +1467,16 @@ public function save($data) $data['php_preflight_install'] = base64_encode($data['php_preflight_install']); } - // Set the css_admin string to base64 string. - if (isset($data['css_admin'])) - { - $data['css_admin'] = base64_encode($data['css_admin']); - } - - // Set the php_admin_event string to base64 string. - if (isset($data['php_admin_event'])) + // Set the php_method_uninstall string to base64 string. + if (isset($data['php_method_uninstall'])) { - $data['php_admin_event'] = base64_encode($data['php_admin_event']); + $data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']); } - // Set the php_site_event string to base64 string. - if (isset($data['php_site_event'])) + // Set the css_admin string to base64 string. + if (isset($data['css_admin'])) { - $data['php_site_event'] = base64_encode($data['php_site_event']); + $data['css_admin'] = base64_encode($data['css_admin']); } // Set the php_postflight_install string to base64 string. @@ -1451,10 +1485,16 @@ public function save($data) $data['php_postflight_install'] = base64_encode($data['php_postflight_install']); } - // Set the sql_uninstall string to base64 string. - if (isset($data['sql_uninstall'])) + // Set the sql string to base64 string. + if (isset($data['sql'])) { - $data['sql_uninstall'] = base64_encode($data['sql_uninstall']); + $data['sql'] = base64_encode($data['sql']); + } + + // Set the buildcompsql string to base64 string. + if (isset($data['buildcompsql'])) + { + $data['buildcompsql'] = base64_encode($data['buildcompsql']); } // Set the php_helper_admin string to base64 string. @@ -1493,16 +1533,16 @@ public function save($data) $data['php_postflight_update'] = base64_encode($data['php_postflight_update']); } - // Set the sql string to base64 string. - if (isset($data['sql'])) + // Set the php_method_install string to base64 string. + if (isset($data['php_method_install'])) { - $data['sql'] = base64_encode($data['sql']); + $data['php_method_install'] = base64_encode($data['php_method_install']); } - // Set the buildcompsql string to base64 string. - if (isset($data['buildcompsql'])) + // Set the sql_uninstall string to base64 string. + if (isset($data['sql_uninstall'])) { - $data['buildcompsql'] = base64_encode($data['buildcompsql']); + $data['sql_uninstall'] = base64_encode($data['sql_uninstall']); } // Set the readme string to base64 string. @@ -1511,16 +1551,16 @@ public function save($data) $data['readme'] = base64_encode($data['readme']); } + // Set the php_helper_both string to base64 string. + if (isset($data['php_helper_both'])) + { + $data['php_helper_both'] = base64_encode($data['php_helper_both']); + } + // Get the basic encryption key. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encryption object - $basic = new FOFEncryptAes($basickey); - - // Encrypt data whmcs_key. - if (isset($data['whmcs_key']) && $basickey) - { - $data['whmcs_key'] = $basic->encryptString($data['whmcs_key']); - } + $basic = new AES($basickey); // Encrypt data crowdin_username. if (isset($data['crowdin_username']) && $basickey) @@ -1528,6 +1568,12 @@ public function save($data) $data['crowdin_username'] = $basic->encryptString($data['crowdin_username']); } + // Encrypt data whmcs_key. + if (isset($data['whmcs_key']) && $basickey) + { + $data['whmcs_key'] = $basic->encryptString($data['whmcs_key']); + } + // Encrypt data export_key. if (isset($data['export_key']) && $basickey) { @@ -1549,13 +1595,13 @@ public function save($data) // we check if component should be build from sql file if (isset($data['buildcomp']) && 1 == $data['buildcomp']) { - ComponentbuilderHelper::dynamicBuilder($data, 1); + $extruder__ = new Extrusion($data); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1565,7 +1611,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1573,14 +1619,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1593,7 +1639,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1619,7 +1664,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/joomla_components.php b/admin/models/joomla_components.php index 64d70fde8..1968aa8e6 100644 --- a/admin/models/joomla_components.php +++ b/admin/models/joomla_components.php @@ -12,18 +12,32 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory; +use VDM\Joomla\Utilities\FileHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\Base64Helper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\FOF\Encrypt\AES; /** * Joomla_components List Model */ class ComponentbuilderModelJoomla_components extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -111,14 +125,14 @@ public function cloner($pks) } // has any data been set for this component - if (ComponentbuilderHelper::checkArray($pks)) + if (JCBArrayHelper::check($pks)) { // load the linked stuff $this->getLinkedToComponents($pks); } // has any data been set for this component - if (isset($this->smartBox['joomla_component']) && ComponentbuilderHelper::checkArray($this->smartBox['joomla_component'])) + if (isset($this->smartBox['joomla_component']) && JCBArrayHelper::check($this->smartBox['joomla_component'])) { // set the folder and move the files of each component to the folder return $this->smartCloner(); @@ -140,7 +154,7 @@ public function getSmartExport($pks) // set custom folder path $this->customPath = $this->params->get('custom_folder_path', JPATH_COMPONENT_ADMINISTRATOR.'/custom'); // set the backup paths - $comConfig = JFactory::getConfig(); + $comConfig = Factory::getConfig(); $this->backupPath = $comConfig->get('tmp_path'); // check what type of export or backup this is if ('backup' === $this->activeType || 'manualBackup' === $this->activeType) @@ -155,7 +169,7 @@ public function getSmartExport($pks) $this->backupServer = $this->params->get('cronjob_backup_server', null); } // set the date array - $date = JFactory::getDate(); + $date = Factory::getDate(); $placeholderDate = array(); $placeholderDate['[YEAR]'] = $date->format('Y'); $placeholderDate['[MONTH]'] = $date->format('m'); @@ -180,25 +194,22 @@ public function getSmartExport($pks) $this->packageName = 'JCB_smartPackage'; } } + // set the package path $this->packagePath = rtrim($this->backupPath, '/') . '/' . $this->packageName; $this->zipPath = rtrim($this->zipPath, '/') . '/' . $this->packageName .'.zip'; - if (JFolder::exists($this->packagePath)) + if (FileHelper::exists($this->packagePath)) { // remove if old folder is found ComponentbuilderHelper::removeFolder($this->packagePath); } + // create the folders JFolder::create($this->packagePath); - // Get the basic encryption. - $basickey = ComponentbuilderHelper::getCryptKey('basic'); - // Get the encryption object. - if ($basickey) - { - $basic = new FOFEncryptAes($basickey, 128); - } + // update $pks with returned IDs $pks = array(); + // start loading the components $this->smartBox['joomla_component'] = array(); foreach ($items as $nr => &$item) @@ -210,8 +221,10 @@ public function getSmartExport($pks) unset($items[$nr]); continue; } + // make sure old fields are not exported any more $this->removeOldComponentValues($item); + // build information data set $this->info['name'][$item->id] = $item->name; $this->info['short_description'][$item->id] = $item->short_description; @@ -222,14 +235,15 @@ public function getSmartExport($pks) $this->info['website'][$item->id] = $item->website; $this->info['license'][$item->id] = $item->license; $this->info['copyright'][$item->id] = $item->copyright; + // set the keys - if (isset($item->export_key) && ComponentbuilderHelper::checkString($item->export_key)) + if (isset($item->export_key) && StringHelper::check($item->export_key)) { // keep the key locked for exported data set $export_key = $item->export_key; - if ($basickey && !is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true))) + if (!is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true))) { - $export_key = rtrim($basic->decryptString($item->export_key), "\0"); + $export_key = PackageFactory::_('Crypt')->decrypt($item->export_key, 'basic'); } // make sure we have a string if (strlen($export_key) > 4 ) @@ -237,27 +251,31 @@ public function getSmartExport($pks) $this->key[$item->id] = $export_key; } } + // get name of this item key_name if (isset($item->system_name)) { - $keyName = ComponentbuilderHelper::safeString($item->system_name, 'cAmel'); + $keyName = StringHelper::safe($item->system_name, 'cAmel'); } else { - $keyName = ComponentbuilderHelper::safeString($item->name_code); + $keyName = StringHelper::safe($item->name_code); } + // set the export buy links - if (isset($item->export_buy_link) && ComponentbuilderHelper::checkString($item->export_buy_link)) + if (isset($item->export_buy_link) && StringHelper::check($item->export_buy_link)) { // set the export buy link $this->info['export_buy_link'][$item->id] = $item->export_buy_link; } + // set the export buy links - if (isset($item->joomla_source_link) && ComponentbuilderHelper::checkString($item->joomla_source_link)) + if (isset($item->joomla_source_link) && StringHelper::check($item->joomla_source_link)) { // set the source link $this->info['joomla_source_link'][$item->id] = $item->joomla_source_link; } + // component image $this->moveIt(array($item->image), 'image'); // set the custom code ID's @@ -275,14 +293,14 @@ public function getSmartExport($pks) } // has any data been set for this component - if (ComponentbuilderHelper::checkArray($pks)) + if (JCBArrayHelper::check($pks)) { // load the linked stuff $this->getLinkedToComponents($pks); } // has any data been set for this component - if (isset($this->smartBox['joomla_component']) && ComponentbuilderHelper::checkArray($this->smartBox['joomla_component'])) + if (isset($this->smartBox['joomla_component']) && JCBArrayHelper::check($this->smartBox['joomla_component'])) { // set the folder and move the files of each component to the folder return $this->smartExportBuilder(); @@ -319,7 +337,7 @@ protected function getLinkedToComponents($pks) $this->setData($table, $pks, $field); } // add fields conditions and relations - if (isset($this->smartIDs['admin_view']) && ComponentbuilderHelper::checkArray($this->smartIDs['admin_view'])) + if (isset($this->smartIDs['admin_view']) && JCBArrayHelper::check($this->smartIDs['admin_view'])) { $this->setData('admin_fields', array_values($this->smartIDs['admin_view']), 'admin_view'); $this->setData('admin_fields_conditions', array_values($this->smartIDs['admin_view']), 'admin_view'); @@ -327,41 +345,41 @@ protected function getLinkedToComponents($pks) $this->setData('admin_custom_tabs', array_values($this->smartIDs['admin_view']), 'admin_view'); } // add joomla module - if (isset($this->smartIDs['joomla_module']) && ComponentbuilderHelper::checkArray($this->smartIDs['joomla_module'])) + if (isset($this->smartIDs['joomla_module']) && JCBArrayHelper::check($this->smartIDs['joomla_module'])) { $this->setData('joomla_module', array_values($this->smartIDs['joomla_module']), 'id'); $this->setData('joomla_module_updates', array_values($this->smartIDs['joomla_module']), 'joomla_module'); $this->setData('joomla_module_files_folders_urls', array_values($this->smartIDs['joomla_module']), 'joomla_module'); } // add joomla plugin - if (isset($this->smartIDs['joomla_plugin']) && ComponentbuilderHelper::checkArray($this->smartIDs['joomla_plugin'])) + if (isset($this->smartIDs['joomla_plugin']) && JCBArrayHelper::check($this->smartIDs['joomla_plugin'])) { $this->setData('joomla_plugin', array_values($this->smartIDs['joomla_plugin']), 'id'); $this->setData('joomla_plugin_updates', array_values($this->smartIDs['joomla_plugin']), 'joomla_plugin'); $this->setData('joomla_plugin_files_folders_urls', array_values($this->smartIDs['joomla_plugin']), 'joomla_plugin'); } // add validation rules - if (isset($this->smartIDs['validation_rule']) && ComponentbuilderHelper::checkArray($this->smartIDs['validation_rule'])) + if (isset($this->smartIDs['validation_rule']) && JCBArrayHelper::check($this->smartIDs['validation_rule'])) { $this->setData('validation_rule', array_values($this->smartIDs['validation_rule']), 'name'); } // add field types - if (isset($this->smartIDs['fieldtype']) && ComponentbuilderHelper::checkArray($this->smartIDs['fieldtype'])) + if (isset($this->smartIDs['fieldtype']) && JCBArrayHelper::check($this->smartIDs['fieldtype'])) { $this->setData('fieldtype', array_values($this->smartIDs['fieldtype']), 'id'); } // add templates - if (isset($this->smartIDs['template']) && ComponentbuilderHelper::checkArray($this->smartIDs['template'])) + if (isset($this->smartIDs['template']) && JCBArrayHelper::check($this->smartIDs['template'])) { $this->setData('template', array_values($this->smartIDs['template']), 'id'); } // add layouts - if (isset($this->smartIDs['layout']) && ComponentbuilderHelper::checkArray($this->smartIDs['layout'])) + if (isset($this->smartIDs['layout']) && JCBArrayHelper::check($this->smartIDs['layout'])) { $this->setData('layout', array_values($this->smartIDs['layout']), 'id'); } // add dynamic get - if (isset($this->smartIDs['dynamic_get']) && ComponentbuilderHelper::checkArray($this->smartIDs['dynamic_get'])) + if (isset($this->smartIDs['dynamic_get']) && JCBArrayHelper::check($this->smartIDs['dynamic_get'])) { $this->setData('dynamic_get', array_values($this->smartIDs['dynamic_get']), 'id'); } @@ -369,49 +387,49 @@ protected function getLinkedToComponents($pks) if ('clone' !== $this->activeType) { // add class_property - if (isset($this->smartIDs['class_property']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_property'])) + if (isset($this->smartIDs['class_property']) && JCBArrayHelper::check($this->smartIDs['class_property'])) { $this->setData('class_property', array_values($this->smartIDs['class_property']), 'id'); } // add class_method - if (isset($this->smartIDs['class_method']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_method'])) + if (isset($this->smartIDs['class_method']) && JCBArrayHelper::check($this->smartIDs['class_method'])) { $this->setData('class_method', array_values($this->smartIDs['class_method']), 'id'); } // add joomla_plugin_group - if (isset($this->smartIDs['joomla_plugin_group']) && ComponentbuilderHelper::checkArray($this->smartIDs['joomla_plugin_group'])) + if (isset($this->smartIDs['joomla_plugin_group']) && JCBArrayHelper::check($this->smartIDs['joomla_plugin_group'])) { $this->setData('joomla_plugin_group', array_values($this->smartIDs['joomla_plugin_group']), 'id'); } // add class_extends - if (isset($this->smartIDs['class_extends']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_extends'])) + if (isset($this->smartIDs['class_extends']) && JCBArrayHelper::check($this->smartIDs['class_extends'])) { $this->setData('class_extends', array_values($this->smartIDs['class_extends']), 'id'); } // add snippets - if (isset($this->smartIDs['snippet']) && ComponentbuilderHelper::checkArray($this->smartIDs['snippet'])) + if (isset($this->smartIDs['snippet']) && JCBArrayHelper::check($this->smartIDs['snippet'])) { $this->setData('snippet', array_values($this->smartIDs['snippet']), 'id'); } // add custom code - if (isset($this->smartIDs['custom_code']) && ComponentbuilderHelper::checkArray($this->smartIDs['custom_code'])) + if (isset($this->smartIDs['custom_code']) && JCBArrayHelper::check($this->smartIDs['custom_code'])) { $this->setData('custom_code', array_values($this->smartIDs['custom_code']), 'id'); } // add placeholder - if (isset($this->smartIDs['placeholder']) && ComponentbuilderHelper::checkArray($this->smartIDs['placeholder'])) + if (isset($this->smartIDs['placeholder']) && JCBArrayHelper::check($this->smartIDs['placeholder'])) { $this->setData('placeholder', array_values($this->smartIDs['placeholder']), 'id'); } // add powers - if (isset($this->smartIDs['power']) && ComponentbuilderHelper::checkArray($this->smartIDs['power'])) + if (isset($this->smartIDs['power']) && JCBArrayHelper::check($this->smartIDs['power'])) { $this->setData('power', array_values($this->smartIDs['power']), 'guid'); } // set limiter $limit = 0; // and add those custom codes found in custom codes - while (isset($this->smartIDs['custom_code']) && ComponentbuilderHelper::checkArray($this->smartIDs['custom_code']) && $limit < 100) + while (isset($this->smartIDs['custom_code']) && JCBArrayHelper::check($this->smartIDs['custom_code']) && $limit < 100) { $this->setData('custom_code', array_values($this->smartIDs['custom_code']), 'id'); // make sure we break @@ -428,17 +446,17 @@ protected function getLinkedToComponents($pks) protected function getComponents($pks) { // setup the query - if (ComponentbuilderHelper::checkArray($pks)) + if (JCBArrayHelper::check($pks)) { // Get the user object. - if (!ComponentbuilderHelper::checkObject($this->user)) + if (!ObjectHelper::check($this->user)) { - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); } // Create a new query object. - if (!ComponentbuilderHelper::checkObject($this->_db)) + if (!ObjectHelper::check($this->_db)) { - $this->_db = JFactory::getDBO(); + $this->_db = Factory::getDBO(); } $query = $this->_db->getQuery(true); @@ -467,12 +485,12 @@ protected function getComponents($pks) // load the items from db $items = $this->_db->loadObjectList(); // check if we have items - if (ComponentbuilderHelper::checkArray($items)) + if (JCBArrayHelper::check($items)) { // set params - if (!ComponentbuilderHelper::checkObject($this->params)) + if (!ObjectHelper::check($this->params)) { - $this->params = JComponentHelper::getParams('com_componentbuilder'); + $this->params = ComponentHelper::getParams('com_componentbuilder'); } return $items; } @@ -515,30 +533,30 @@ protected function setSmartIDs($value, $table, $int = true) $this->smartIDs[$table] = array(); } // convert if value is in json - if (ComponentbuilderHelper::checkJson($value)) + if (JsonHelper::check($value)) { $value = json_decode($value, true); } // now update the fields - if (ComponentbuilderHelper::checkArray($value)) + if (JCBArrayHelper::check($value)) { foreach ($value as $id) { - if ($int && (ComponentbuilderHelper::checkString($id) || is_numeric($id)) && 0 !== (int) $id) + if ($int && (StringHelper::check($id) || is_numeric($id)) && 0 !== (int) $id) { $this->smartIDs[$table][(int) $id] = (int) $id; } - elseif (!$int && ComponentbuilderHelper::checkString($id)) + elseif (!$int && StringHelper::check($id)) { $this->smartIDs[$table][$id] = $this->_db->quote($id); } } } - elseif ($int && (ComponentbuilderHelper::checkString($value) || is_numeric($value)) && 0 !== (int) $value) + elseif ($int && (StringHelper::check($value) || is_numeric($value)) && 0 !== (int) $value) { $this->smartIDs[$table][(int) $value] = (int) $value; } - elseif (!$int && ComponentbuilderHelper::checkString($value)) + elseif (!$int && StringHelper::check($value)) { $this->smartIDs[$table][$value] = $this->_db->quote($value); } @@ -554,12 +572,12 @@ protected function getValues($values, $type, $key = null, $prep = 'table') // the ids bucket $bucket = array(); // if json convert to array - if (ComponentbuilderHelper::checkJson($values)) + if (JsonHelper::check($values)) { $values = json_decode($values, true); } // check that the array has values - if (ComponentbuilderHelper::checkArray($values)) + if (JCBArrayHelper::check($values)) { // check if the key is an array (targeting subform) if ('subform' === $type && $key) @@ -572,7 +590,7 @@ protected function getValues($values, $type, $key = null, $prep = 'table') { $bucket[] = $value[$key]; } - elseif (ComponentbuilderHelper::checkString($value[$key])) + elseif (StringHelper::check($value[$key])) { if ('table' === $prep) { @@ -586,7 +604,7 @@ protected function getValues($values, $type, $key = null, $prep = 'table') } } // only return if we set the ids - if (ComponentbuilderHelper::checkArray($bucket)) + if (JCBArrayHelper::check($bucket)) { // now set the values back return array_unique($bucket); @@ -598,7 +616,7 @@ protected function getValues($values, $type, $key = null, $prep = 'table') $_key = explode('.', $key); foreach ($values as $value) { - if (isset($value[$_key[0]]) && ComponentbuilderHelper::checkArray($value[$_key[0]])) + if (isset($value[$_key[0]]) && JCBArrayHelper::check($value[$_key[0]])) { foreach ($value[$_key[0]] as $_value) { @@ -606,7 +624,7 @@ protected function getValues($values, $type, $key = null, $prep = 'table') { $bucket[] = $_value[$_key[1]]; } - elseif (ComponentbuilderHelper::checkString($_value[$_key[1]])) + elseif (StringHelper::check($_value[$_key[1]])) { if ('table' === $prep) { @@ -621,7 +639,7 @@ protected function getValues($values, $type, $key = null, $prep = 'table') } } // only return if we set the ids - if (ComponentbuilderHelper::checkArray($bucket)) + if (JCBArrayHelper::check($bucket)) { // now set the values back return array_unique($bucket); @@ -637,7 +655,7 @@ protected function getValues($values, $type, $key = null, $prep = 'table') { return $value; } - elseif (ComponentbuilderHelper::checkString($value)) + elseif (StringHelper::check($value)) { if ('table' === $prep) { @@ -658,11 +676,11 @@ protected function getValues($values, $type, $key = null, $prep = 'table') { foreach ($values[$key] as $k => $val) { - if (strpos($k, 'power_') !== false && ComponentbuilderHelper::checkArray($val)) + if (strpos($k, 'power_') !== false && JCBArrayHelper::check($val)) { foreach ($val as $v) { - if (ComponentbuilderHelper::checkArray($v) && isset($v['power'])) + if (JCBArrayHelper::check($v) && isset($v['power'])) { $bucket[$v['power']] = $v['power']; } @@ -670,7 +688,7 @@ protected function getValues($values, $type, $key = null, $prep = 'table') } } // only return if we set the ids - if (ComponentbuilderHelper::checkArray($bucket)) + if (JCBArrayHelper::check($bucket)) { // now return the values back return array_values($bucket); @@ -689,21 +707,30 @@ protected function getValues($values, $type, $key = null, $prep = 'table') protected function setData($table, $values, $key, $string = false) { // lets check for json strings - if (ComponentbuilderHelper::checkJson($values)) + if (JsonHelper::check($values)) { $values = json_decode($values, true); } + // let's check for just a string or int + elseif (is_string($values) || (is_numeric($values) && $values > 0)) + { + $values = [$values]; + } + // make sure we have an array of values - if (!ComponentbuilderHelper::checkArray($values, true) || !ComponentbuilderHelper::checkString($table) || !ComponentbuilderHelper::checkString($key)) + if (!JCBArrayHelper::check($values, true) || !StringHelper::check($table) || !StringHelper::check($key)) { return false; } + // start the query $query = $this->_db->getQuery(true); // Select some fields $query->select(array('a.*')); + // From the componentbuilder_ANY table $query->from($this->_db->quoteName('#__componentbuilder_'. $table, 'a')); + // check if this is an array of integers if ($this->is_numeric($values)) { @@ -722,12 +749,14 @@ protected function setData($table, $values, $key, $string = false) return $this->_db->quote($var); }, $values)) . ')'); } + // Implement View Level Access if (!$this->user->authorise('core.options', 'com_componentbuilder')) { $groups = implode(',', $this->user->getAuthorisedViewLevels()); $query->where('a.access IN (' . $groups . ')'); } + // Order the results by ordering $query->order('a.ordering ASC'); // Load the items @@ -740,7 +769,7 @@ protected function setData($table, $values, $key, $string = false) // reset the search array (only search for template/layouts) $searchTLArray = array(); // check if we have items - if (ComponentbuilderHelper::checkArray($items)) + if (JCBArrayHelper::check($items)) { // set search array if site/custom admin view if ('site_view' === $table || 'custom_admin_view' === $table) @@ -892,7 +921,7 @@ protected function setData($table, $values, $key, $string = false) if ('component_modules' === $table) { // we remove those modules not part of the export - if (isset($item->addjoomla_modules) && ComponentbuilderHelper::checkJson($item->addjoomla_modules)) + if (isset($item->addjoomla_modules) && JsonHelper::check($item->addjoomla_modules)) { $item->addjoomla_modules = array_filter( json_decode($item->addjoomla_modules, true), @@ -913,7 +942,7 @@ function ($module) { if ('component_plugins' === $table) { // we remove those plugins not part of the export - if (isset($item->addjoomla_plugins) && ComponentbuilderHelper::checkJson($item->addjoomla_plugins)) + if (isset($item->addjoomla_plugins) && JsonHelper::check($item->addjoomla_plugins)) { $item->addjoomla_plugins = array_filter( json_decode($item->addjoomla_plugins, true), @@ -976,7 +1005,7 @@ function ($plugin) { // check if this field has multiple fields if ($this->checkMultiFields($item->fieldtype)) { - $fields = ComponentbuilderHelper::getBetween(json_decode($item->xml), 'fields="', '"'); + $fields = GetHelper::between(json_decode($item->xml), 'fields="', '"'); $fieldsSets = array(); if (strpos($fields, ',') !== false) { @@ -989,17 +1018,17 @@ function ($plugin) { $fieldsSets[] = (int) $fields; } // get fields - if (ComponentbuilderHelper::checkArray($fieldsSets)) + if (JCBArrayHelper::check($fieldsSets)) { $this->setData('field', $fieldsSets, 'id'); } } // check if validation rule is found - $validationRule = ComponentbuilderHelper::getBetween(json_decode($item->xml), 'validate="', '"'); - if (ComponentbuilderHelper::checkString($validationRule)) + $validationRule = GetHelper::between(json_decode($item->xml), 'validate="', '"'); + if (StringHelper::check($validationRule)) { // make sure it is lowercase - $validationRule = ComponentbuilderHelper::safeString($validationRule); + $validationRule = StringHelper::safe($validationRule); // get core validation rules if ($coreValidationRules = ComponentbuilderHelper::getExistingValidationRuleNames(true)) { @@ -1013,7 +1042,7 @@ function ($plugin) { } } // check if a search is required - if (isset($searchTLArray) && ComponentbuilderHelper::checkArray($searchTLArray)){ + if (isset($searchTLArray) && JCBArrayHelper::check($searchTLArray)){ // add search array templates and layouts foreach ($searchTLArray as $scripter => $add) @@ -1169,7 +1198,7 @@ protected function is_numeric($array) protected function smartCloner() { // check if data is set - if (isset($this->smartBox) && ComponentbuilderHelper::checkArray($this->smartBox)) + if (isset($this->smartBox) && JCBArrayHelper::check($this->smartBox)) { // get the import_joomla_components $model = ComponentbuilderHelper::getModel('import_joomla_components'); @@ -1178,13 +1207,13 @@ protected function smartCloner() // trigger the create new (clone) feature $model->canmerge = 0; // set some postfix - $model->postfix = ' ('.ComponentbuilderHelper::randomkey(2).')'; + $model->postfix = ' ('.StringHelper::random(2).')'; // get App - $model->app = JFactory::getApplication(); + $model->app = Factory::getApplication(); // set user $model->user = $this->user; // set today's date - $model->today = JFactory::getDate()->toSql(); + $model->today = Factory::getDate()->toSql(); // load the data $model->data = $this->smartBox; // remove smart box to safe on memory @@ -1227,10 +1256,11 @@ protected function smartCloner() protected function smartExportBuilder() { // check if data is set - if (isset($this->smartBox) && ComponentbuilderHelper::checkArray($this->smartBox)) + if (isset($this->smartBox) && JCBArrayHelper::check($this->smartBox)) { // set db data $data = serialize($this->smartBox); + // Set the key owner information $this->info['source'] = array(); $this->info['source']['company'] = $this->params->get('export_company', null); @@ -1239,26 +1269,16 @@ protected function smartExportBuilder() $this->info['source']['website'] = $this->params->get('export_website', null); $this->info['source']['license'] = $this->params->get('export_license', null); $this->info['source']['copyright'] = $this->params->get('export_copyright', null); + // lock the data if set - if (ComponentbuilderHelper::checkArray($this->key)) + if (JCBArrayHelper::check($this->key)) { // lock the data $this->key = md5(implode('', $this->key)); - // April 20, 2022 we moved away from FOF for good... sorry that it took this long - // $locker = new FOFEncryptAes($this->key, 128); - // $data = $locker->encryptString($data); - // load phpseclib - if(ComponentbuilderHelper::crypt('AES', 'CBC') instanceof \phpseclib\Crypt\Rijndael) - { - // set the password - ComponentbuilderHelper::crypt('AES', 'CBC')->setPassword($this->key, 'pbkdf2', 'sha256', 'VastDevelopmentMethod/salt'); - // lock the data - $data = base64_encode(ComponentbuilderHelper::crypt('AES', 'CBC')->encrypt($data)); - } - else - { - return false; - } + + // lock the data + $data = PackageFactory::_('Crypt')->encrypt($data, 'aes', $this->key); + // Set the key owner information $this->info['getKeyFrom'] = array(); $this->info['getKeyFrom']['company'] = $this->info['source']['company']; @@ -1268,13 +1288,16 @@ protected function smartExportBuilder() $this->info['getKeyFrom']['license'] = $this->info['source']['license']; $this->info['getKeyFrom']['copyright'] = $this->info['source']['copyright']; // add buy link if only one link is set - if (isset($this->info['export_buy_link']) && ComponentbuilderHelper::checkArray($this->info['export_buy_link']) && count((array) $this->info['export_buy_link']) == 1) + if (isset($this->info['export_buy_link']) + && JCBArrayHelper::check($this->info['export_buy_link']) + && count((array) $this->info['export_buy_link']) == 1) { $this->info['getKeyFrom']['buy_link'] = array_values($this->info['export_buy_link'])[0]; } else { - // use global if more then one component is exported (since they now have one key), or if none has a buy link + // use global if more then one component is exported + // (since they now have one key), or if none has a buy link $this->info['getKeyFrom']['buy_link'] = $this->params->get('export_buy_link', null); } // no remove the buy links @@ -1282,75 +1305,82 @@ protected function smartExportBuilder() // if we have multi links add them also // we started adding this at v2.7.7 $this->info['key'] = true; - // we started adding this at v3.0.11 and v2.12.17 - $this->info['phpseclib'] = true; + // Changed: 25th Feb. 2023 at v3.1.18 + // $this->info['phpseclib'] = false; + // we started adding this at v3.1.18 + $this->info['phpseclib3'] = true; } else { // we started adding this at v2.7.7 $this->info['key'] = false; // we started adding this at v3.0.11 and v2.12.17 - $this->info['phpseclib'] = false; + // $this->info['phpseclib'] = false; + // we started adding this at v3.1.18 + $this->info['phpseclib3'] = false; // base 64 encode the data $data = base64_encode($data); } + // set the path $dbPath = $this->packagePath . '/db.vdm'; + // write the db data to file in package - if (!ComponentbuilderHelper::writeFile($dbPath, wordwrap($data, 128, "\n", true))) + if (!FileHelper::write($dbPath, wordwrap($data, 128, "\n", true))) { return false; } - // set info data - if(ComponentbuilderHelper::crypt('AES', 'CBC') instanceof \phpseclib\Crypt\Rijndael) - { - // set system password - $db = 'COM_COMPONENTBUILDER_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM'; - $password = base64_decode(JText::sprintf($db, 'VjR', 'WV0aE9k')); - // set the password - ComponentbuilderHelper::crypt('AES', 'CBC')->setPassword($password, 'pbkdf2', 'sha256', 'VastDevelopmentMethod/salt'); - // lock the data - $info = base64_encode(ComponentbuilderHelper::crypt('AES', 'CBC')->encrypt(json_encode($this->info))); - // set the path - $infoPath = $this->packagePath . '/info.vdm'; - // write the info data to file in package - if (!ComponentbuilderHelper::writeFile($infoPath, wordwrap($info, 128, "\n", true))) - { - return false; - } - } - else + + // lock the info data + $info = PackageFactory::_('Crypt')->encrypt(json_encode($this->info), 'local'); + + // set the path + $infoPath = $this->packagePath . '/info.vdm'; + + // write the info data to file in package + if (!FileHelper::write($infoPath, wordwrap($info, 128, "\n", true))) { - return false; + return false; } + // lock all files $this->lockFiles(); + // remove old zip files with the same name if (JFile::exists($this->zipPath)) { // remove file if found JFile::delete($this->zipPath); } + // zip the folder - if (!ComponentbuilderHelper::zip($this->packagePath, $this->zipPath)) + if (!FileHelper::zip($this->packagePath, $this->zipPath)) { return false; } + // move to remote server if needed if (2 == $this->backupType) { - if (!ComponentbuilderHelper::moveToServer($this->zipPath, $this->packageName.'.zip', $this->backupServer, null, 'joomla_component.export')) + if (!PackageFactory::_('Server')->legacyMove( + $this->zipPath, $this->packageName.'.zip', + $this->backupServer, null, 'joomla_component.export' + ) + ) { return false; } + // remove the local file JFile::delete($this->zipPath); } + // remove the folder if (!ComponentbuilderHelper::removeFolder($this->packagePath)) { return false; } + return true; } return false; @@ -1364,25 +1394,27 @@ protected function smartExportBuilder() protected function lockFiles() { // lock the data if set - if (ComponentbuilderHelper::checkString($this->key) && strlen($this->key) == 32) + if (StringHelper::check($this->key) && strlen($this->key) == 32) { - // set secure password - ComponentbuilderHelper::crypt('AES', 'CBC')->setPassword($this->key, 'pbkdf2', 'sha256', 'VastDevelopmentMethod/salt'); // we must first store the current working directory $joomla = getcwd(); + // to avoid that it encrypt the db and info file again we must move per/folder $folders = array('images', 'custom', 'dynamic'); + // loop the folders foreach ($folders as $folder) { // the sub path $subPath = $this->packagePath.'/'.$folder; + // go to the package sub folder if found - if (JFolder::exists($subPath)) + if (FileHelper::exists($subPath)) { $this->lock($subPath); } } + // change back to working dir chdir($joomla); } @@ -1397,16 +1429,21 @@ protected function lock(&$tmpPath) { // we are changing the working directory to the tmp path (important) chdir($tmpPath); + // get a list of files in the current directory tree (all) $files = JFolder::files('.', '.', true, true); + // read in the file content foreach ($files as $file) { + // get file content + $content = FileHelper::getContent($file); + // write the encrypted string back to file - if (!ComponentbuilderHelper::writeFile($file, wordwrap(base64_encode(ComponentbuilderHelper::crypt('AES', 'CBC')->encrypt(file_get_contents($file))), 128, "\n", true))) - { - // we should add error handler here in case file could not be locked - } + $content = PackageFactory::_('Crypt')->encrypt($content, 'eac', $this->key); + + // store the encrypted file content in the same file + FileHelper::write($file, wordwrap($content, 128, "\n", true)); } } @@ -1418,10 +1455,11 @@ protected function lock(&$tmpPath) protected function moveIt($paths, $type, $dynamic = false) { // make sure we have an array - if (!ComponentbuilderHelper::checkArray($paths)) + if (!JCBArrayHelper::check($paths)) { return false; } + // set the name of the folder if ('file' === $type || 'folder' === $type) { @@ -1440,19 +1478,22 @@ protected function moveIt($paths, $type, $dynamic = false) { return false; } + // setup the type path $tmpPath = str_replace('//', '/', $this->packagePath . '/' . $folderName); + // create type path if not set - if (!JFolder::exists($tmpPath)) + if (!FileHelper::exists($tmpPath)) { // create the folders if not found JFolder::create($tmpPath); } + // now move it foreach ($paths as $item) { // make sure we have a string - if (ComponentbuilderHelper::checkString($item)) + if (StringHelper::check($item)) { // if the file type if ('file' === $type) @@ -1475,14 +1516,16 @@ protected function moveIt($paths, $type, $dynamic = false) JFile::copy($customFilePath, $tmpFilePath); } } + // if the image type if ('image' === $type) { $imageName = basename($item); $imagePath = str_replace($imageName, '', $item); $imageFolderPath = str_replace('//', '/', $this->packagePath.'/'. $imagePath); + // check if image folder exist - if (!JFolder::exists($imageFolderPath)) + if (!FileHelper::exists($imageFolderPath)) { // create the folders if not found JFolder::create($imageFolderPath); @@ -1495,6 +1538,7 @@ protected function moveIt($paths, $type, $dynamic = false) JFile::copy($customImagePath, $tmpImagePath); } } + // if the folder type if ('folder' === $type) { @@ -1509,7 +1553,8 @@ protected function moveIt($paths, $type, $dynamic = false) $tmpFolderPath = str_replace('//', '/', $tmpPath.'/'.$item); $customFolderPath = str_replace('//', '/', $this->customPath.'/'.$item); } - if (!JFolder::exists($tmpFolderPath) && JFolder::exists($customFolderPath)) + + if (!FileHelper::exists($tmpFolderPath) && FileHelper::exists($customFolderPath)) { // move the folder to its place JFolder::copy($customFolderPath, $tmpFolderPath,'',true); @@ -1561,15 +1606,15 @@ protected function getFieldType($id) { if (!isset($this->fieldTypes[$id])) { - $properties = ComponentbuilderHelper::getVar('fieldtype', $id, 'id', 'properties'); - if (ComponentbuilderHelper::checkJson($properties)) + $properties = GetHelper::var('fieldtype', $id, 'id', 'properties'); + if (JsonHelper::check($properties)) { $properties = json_decode($properties, true); foreach ($properties as $property) { if ('type' === $property['name']) { - if (isset($property['example']) && ComponentbuilderHelper::checkString($property['example'])) + if (isset($property['example']) && StringHelper::check($property['example'])) { $this->fieldTypes[$id] = $property['example']; break; @@ -1578,9 +1623,9 @@ protected function getFieldType($id) } } // if not found - if (!isset($this->fieldTypes[$id]) && $name = ComponentbuilderHelper::getVar('fieldtype', $id, 'id', 'name')) + if (!isset($this->fieldTypes[$id]) && $name = GetHelper::var('fieldtype', $id, 'id', 'name')) { - $this->fieldTypes[$id] = ComponentbuilderHelper::safeString($name); + $this->fieldTypes[$id] = StringHelper::safe($name); } } // return the type @@ -1607,31 +1652,31 @@ protected function getTemplateLayout($default, $user = false) $default = base64_decode($default); } // set the Template data - $temp1 = ComponentbuilderHelper::getAllBetween($default, "\$this->loadTemplate('","')"); - $temp2 = ComponentbuilderHelper::getAllBetween($default, '$this->loadTemplate("','")'); + $temp1 = GetHelper::allBetween($default, "\$this->loadTemplate('","')"); + $temp2 = GetHelper::allBetween($default, '$this->loadTemplate("','")'); $templates = array(); $again = array(); - if (ComponentbuilderHelper::checkArray($temp1) && ComponentbuilderHelper::checkArray($temp2)) + if (JCBArrayHelper::check($temp1) && JCBArrayHelper::check($temp2)) { $templates = array_merge($temp1,$temp2); } else { - if (ComponentbuilderHelper::checkArray($temp1)) + if (JCBArrayHelper::check($temp1)) { $templates = $temp1; } - elseif (ComponentbuilderHelper::checkArray($temp2)) + elseif (JCBArrayHelper::check($temp2)) { $templates = $temp2; } } - if (ComponentbuilderHelper::checkArray($templates)) + if (JCBArrayHelper::check($templates)) { foreach ($templates as $template) { $data = $this->getDataWithAlias($template, 'template'); - if (ComponentbuilderHelper::checkArray($data)) + if (JCBArrayHelper::check($data)) { if (!isset($this->smartIDs['template']) || !isset($this->smartIDs['template'][$data['id']])) { @@ -1644,29 +1689,29 @@ protected function getTemplateLayout($default, $user = false) } } // set the layout data - $lay1 = ComponentbuilderHelper::getAllBetween($default, "JLayoutHelper::render('","',"); - $lay2 = ComponentbuilderHelper::getAllBetween($default, 'JLayoutHelper::render("','",'); - if (ComponentbuilderHelper::checkArray($lay1) && ComponentbuilderHelper::checkArray($lay2)) + $lay1 = GetHelper::allBetween($default, "LayoutHelper::render('","',"); + $lay2 = GetHelper::allBetween($default, 'LayoutHelper::render("','",'); + if (JCBArrayHelper::check($lay1) && JCBArrayHelper::check($lay2)) { $layouts = array_merge($lay1,$lay2); } else { - if (ComponentbuilderHelper::checkArray($lay1)) + if (JCBArrayHelper::check($lay1)) { $layouts = $lay1; } - elseif (ComponentbuilderHelper::checkArray($lay2)) + elseif (JCBArrayHelper::check($lay2)) { $layouts = $lay2; } } - if (isset($layouts) && ComponentbuilderHelper::checkArray($layouts)) + if (isset($layouts) && JCBArrayHelper::check($layouts)) { foreach ($layouts as $layout) { $data = $this->getDataWithAlias($layout, 'layout'); - if (ComponentbuilderHelper::checkArray($data)) + if (JCBArrayHelper::check($data)) { if (!isset($this->smartIDs['layout']) || !isset($this->smartIDs['layout'][$data['id']])) { @@ -1678,7 +1723,7 @@ protected function getTemplateLayout($default, $user = false) } } } - if (ComponentbuilderHelper::checkArray($again)) + if (JCBArrayHelper::check($again)) { foreach ($again as $get) { @@ -1689,12 +1734,12 @@ protected function getTemplateLayout($default, $user = false) if ($user) { // add templates - if (isset($this->smartIDs['template']) && ComponentbuilderHelper::checkArray($this->smartIDs['template'])) + if (isset($this->smartIDs['template']) && JCBArrayHelper::check($this->smartIDs['template'])) { $this->setData('template', array_values($this->smartIDs['template']), 'id'); } // add layouts - if (isset($this->smartIDs['layout']) && ComponentbuilderHelper::checkArray($this->smartIDs['layout'])) + if (isset($this->smartIDs['layout']) && JCBArrayHelper::check($this->smartIDs['layout'])) { $this->setData('layout', array_values($this->smartIDs['layout']), 'id'); } @@ -1721,7 +1766,7 @@ protected function getDataWithAlias($n_ame, $table) $rows = $this->_db->loadObjectList(); foreach ($rows as $row) { - $k_ey = ComponentbuilderHelper::safeString($row->alias); + $k_ey = StringHelper::safe($row->alias); $key = preg_replace("/[^A-Za-z]/", '', $k_ey); $name = preg_replace("/[^A-Za-z]/", '', $n_ame); if ($k_ey == $n_ame || $key == $name) @@ -1761,7 +1806,7 @@ protected function setCodePlaceholdersIds($item, $target, $type = 'custom_code') } elseif (!isset($keys['not_base64'][$key])) { - $value = ComponentbuilderHelper::openValidBase64($item->{$key}, null); + $value = Base64Helper::open($item->{$key}, null); } elseif (isset($keys['not_base64'][$key]) && 'json' === $keys['not_base64'][$key] && 'xml' === $key) // just for field search { @@ -1782,8 +1827,8 @@ protected function setCodePlaceholdersIds($item, $target, $type = 'custom_code') if ('custom_code' === $type) { // search the value to see if it has custom code - $codeArray = ComponentbuilderHelper::getAllBetween($value, '[CUSTOMC' . 'ODE=',']'); - if (ComponentbuilderHelper::checkArray($codeArray)) + $codeArray = GetHelper::allBetween($value, '[CUSTOMC' . 'ODE=',']'); + if (JCBArrayHelper::check($codeArray)) { foreach ($codeArray as $func) { @@ -1801,9 +1846,9 @@ protected function setCodePlaceholdersIds($item, $target, $type = 'custom_code') { $this->setSmartIDs($func, $type); } - elseif (ComponentbuilderHelper::checkString($func)) + elseif (StringHelper::check($func)) { - if (($funcID = ComponentbuilderHelper::getVar($type, $func, 'function_name', 'id')) !== false && is_numeric($funcID)) + if (($funcID = GetHelper::var($type, $func, 'function_name', 'id')) !== false && is_numeric($funcID)) { $this->setSmartIDs($funcID, $type); } @@ -1819,12 +1864,12 @@ protected function setCodePlaceholdersIds($item, $target, $type = 'custom_code') elseif ('placeholder' === $type) { // check if we already have the placeholder search array - if (!componentbuilderHelper::checkArray($this->placeholderM) && !componentbuilderHelper::checkArray($this->placeholderS)) + if (!JCBArrayHelper::check($this->placeholderM) && !JCBArrayHelper::check($this->placeholderS)) { $this->placeholderS = ComponentbuilderHelper::getVars($type, 1, 'published', 'target'); } // only continue search if placeholders found - if (componentbuilderHelper::checkArray($this->placeholderS)) + if (JCBArrayHelper::check($this->placeholderS)) { foreach ($this->placeholderS as $remove => $placeholder) { @@ -1835,7 +1880,7 @@ protected function setCodePlaceholdersIds($item, $target, $type = 'custom_code') $this->placeholderM[$placeholder] = $placeholder; unset($this->placeholderS[$remove]); // get the ID - if (($placeholderID = ComponentbuilderHelper::getVar($type, $placeholder, 'target', 'id')) !== false && is_numeric($placeholderID)) + if (($placeholderID = GetHelper::var($type, $placeholder, 'target', 'id')) !== false && is_numeric($placeholderID)) { $this->setSmartIDs($placeholderID, $type); } @@ -1887,7 +1932,7 @@ protected function setLanguageTranslation(&$id, $target = 'components') { $items = $this->_db->loadObjectList(); // check if we have items - if (ComponentbuilderHelper::checkArray($items)) + if (JCBArrayHelper::check($items)) { if (!isset($this->smartBox['language_translation'])) { @@ -1895,7 +1940,7 @@ protected function setLanguageTranslation(&$id, $target = 'components') } foreach ($items as $item) { - if (!isset($this->smartBox['language_translation'][$item->id]) && ComponentbuilderHelper::checkJson($item->{$target})) + if (!isset($this->smartBox['language_translation'][$item->id]) && JsonHelper::check($item->{$target})) { $targets = json_decode($item->{$target}, true); if (in_array($id, $targets)) @@ -1928,11 +1973,11 @@ protected function getPackageName(&$items) { if (isset($item->system_name)) { - return ComponentbuilderHelper::safeString($item->system_name, 'cAmel'); + return StringHelper::safe($item->system_name, 'cAmel'); } else { - return ComponentbuilderHelper::safeString($item->name_code); + return StringHelper::safe($item->name_code); } } } @@ -1995,9 +2040,9 @@ protected function searchOpenBase64(&$value, &$target) if (isset($target['_start'])) { // get all values - $allBetween = ComponentbuilderHelper::getAllBetween($value, $target['start'], $target['_start']); + $allBetween = GetHelper::allBetween($value, $target['start'], $target['_start']); // just again make sure we found some - if (ComponentbuilderHelper::checkArray($allBetween)) + if (UtilitiesArrayHelper::check($allBetween)) { if (count((array) $allBetween) > 1) { @@ -2028,14 +2073,14 @@ protected function searchOpenBase64(&$value, &$target) $starts[] = $target['start']; } // has any been found - if (ComponentbuilderHelper::checkArray($starts)) + if (UtilitiesArrayHelper::check($starts)) { foreach ($starts as $_start) { // get the base64 string - $base64 = ComponentbuilderHelper::getBetween($value, $_start, $target['end']); + $base64 = GetHelper::between($value, $_start, $target['end']); // now open the base64 text - $tmp = ComponentbuilderHelper::openValidBase64($base64); + $tmp = Base64Helper::open($base64); // insert it back into the value (so we still search the whole string) $value = str_replace($base64, $tmp, $value); } @@ -2052,7 +2097,7 @@ protected function searchOpenBase64(&$value, &$target) // #__componentbuilder_joomla_component (a) 'joomla_component' => array( 'search' => array('id', 'system_name', 'php_preflight_install', 'php_postflight_install', - 'php_preflight_update', 'php_postflight_update', 'php_method_uninstall', + 'php_preflight_update', 'php_postflight_update', 'php_method_uninstall', 'php_method_install', 'php_helper_admin', 'php_admin_event', 'php_helper_both', 'php_helper_site', 'php_site_event', 'javascript', 'readme', 'sql', 'sql_uninstall'), 'views' => 'joomla_components', @@ -2285,7 +2330,7 @@ protected function getCodeSearchKeys($target, $type = null) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -2367,7 +2412,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -2382,12 +2427,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -2401,22 +2446,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -2445,7 +2490,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -2486,11 +2531,11 @@ protected function getListQuery() $query->where('a.companyname = ' . (int) $_companyname); } } - elseif (ComponentbuilderHelper::checkString($_companyname)) + elseif (StringHelper::check($_companyname)) { $query->where('a.companyname = ' . $db->quote($db->escape($_companyname))); } - elseif (ComponentbuilderHelper::checkArray($_companyname)) + elseif (UtilitiesArrayHelper::check($_companyname)) { // Secure the array for the query $_companyname = array_map( function ($val) use(&$db) { @@ -2505,7 +2550,7 @@ protected function getListQuery() return (int) $val; } } - elseif (ComponentbuilderHelper::checkString($val)) + elseif (StringHelper::check($val)) { return $db->quote($db->escape($val)); } @@ -2526,11 +2571,11 @@ protected function getListQuery() $query->where('a.author = ' . (int) $_author); } } - elseif (ComponentbuilderHelper::checkString($_author)) + elseif (StringHelper::check($_author)) { $query->where('a.author = ' . $db->quote($db->escape($_author))); } - elseif (ComponentbuilderHelper::checkArray($_author)) + elseif (UtilitiesArrayHelper::check($_author)) { // Secure the array for the query $_author = array_map( function ($val) use(&$db) { @@ -2545,7 +2590,7 @@ protected function getListQuery() return (int) $val; } } - elseif (ComponentbuilderHelper::checkString($val)) + elseif (StringHelper::check($val)) { return $db->quote($db->escape($val)); } @@ -2555,10 +2600,12 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -2576,17 +2623,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -2632,10 +2679,10 @@ public function getExportData($pks, $user = null) // Get the basic encryption key. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey); + $basic = new AES($basickey); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -2647,31 +2694,36 @@ public function getExportData($pks, $user = null) continue; } - // decode php_helper_both - $item->php_helper_both = base64_decode($item->php_helper_both); - // decode php_method_uninstall - $item->php_method_uninstall = base64_decode($item->php_method_uninstall); + // decode php_site_event + $item->php_site_event = base64_decode($item->php_site_event); + // decode php_admin_event + $item->php_admin_event = base64_decode($item->php_admin_event); + if ($basickey && !is_numeric($item->crowdin_username) && $item->crowdin_username === base64_encode(base64_decode($item->crowdin_username, true))) + { + // decrypt crowdin_username + $item->crowdin_username = $basic->decryptString($item->crowdin_username); + } // decode php_preflight_install $item->php_preflight_install = base64_decode($item->php_preflight_install); + // decode php_method_uninstall + $item->php_method_uninstall = base64_decode($item->php_method_uninstall); // decode css_admin $item->css_admin = base64_decode($item->css_admin); - // decode php_admin_event - $item->php_admin_event = base64_decode($item->php_admin_event); - // decode php_site_event - $item->php_site_event = base64_decode($item->php_site_event); // decode php_postflight_install $item->php_postflight_install = base64_decode($item->php_postflight_install); - // decode sql_uninstall - $item->sql_uninstall = base64_decode($item->sql_uninstall); + // decode sql + $item->sql = base64_decode($item->sql); + // decode buildcompsql + $item->buildcompsql = base64_decode($item->buildcompsql); // decode php_helper_admin $item->php_helper_admin = base64_decode($item->php_helper_admin); + // decode php_helper_site + $item->php_helper_site = base64_decode($item->php_helper_site); if ($basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true))) { // decrypt whmcs_key $item->whmcs_key = $basic->decryptString($item->whmcs_key); } - // decode php_helper_site - $item->php_helper_site = base64_decode($item->php_helper_site); // decode javascript $item->javascript = base64_decode($item->javascript); // decode css_site @@ -2680,15 +2732,10 @@ public function getExportData($pks, $user = null) $item->php_preflight_update = base64_decode($item->php_preflight_update); // decode php_postflight_update $item->php_postflight_update = base64_decode($item->php_postflight_update); - // decode sql - $item->sql = base64_decode($item->sql); - if ($basickey && !is_numeric($item->crowdin_username) && $item->crowdin_username === base64_encode(base64_decode($item->crowdin_username, true))) - { - // decrypt crowdin_username - $item->crowdin_username = $basic->decryptString($item->crowdin_username); - } - // decode buildcompsql - $item->buildcompsql = base64_decode($item->buildcompsql); + // decode php_method_install + $item->php_method_install = base64_decode($item->php_method_install); + // decode sql_uninstall + $item->sql_uninstall = base64_decode($item->sql_uninstall); if ($basickey && !is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true))) { // decrypt export_key @@ -2706,6 +2753,8 @@ public function getExportData($pks, $user = null) // decrypt crowdin_account_api_key $item->crowdin_account_api_key = $basic->decryptString($item->crowdin_account_api_key); } + // decode php_helper_both + $item->php_helper_both = base64_decode($item->php_helper_both); // unset the values we don't want exported. unset($item->asset_id); unset($item->checked_out); @@ -2714,7 +2763,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -2732,16 +2781,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_joomla_component"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -2750,7 +2799,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -2765,13 +2814,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -2780,25 +2829,25 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.modified_by'); // Check if the value is an array $_companyname = $this->getState('filter.companyname'); - if (ComponentbuilderHelper::checkArray($_companyname)) + if (UtilitiesArrayHelper::check($_companyname)) { $id .= ':' . implode(':', $_companyname); } // Check if this is only an number or string elseif (is_numeric($_companyname) - || ComponentbuilderHelper::checkString($_companyname)) + || StringHelper::check($_companyname)) { $id .= ':' . $_companyname; } // Check if the value is an array $_author = $this->getState('filter.author'); - if (ComponentbuilderHelper::checkArray($_author)) + if (UtilitiesArrayHelper::check($_author)) { $id .= ':' . implode(':', $_author); } // Check if this is only an number or string elseif (is_numeric($_author) - || ComponentbuilderHelper::checkString($_author)) + || StringHelper::check($_author)) { $id .= ':' . $_author; } @@ -2814,19 +2863,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -2838,7 +2886,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -2859,7 +2907,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/joomla_module.php b/admin/models/joomla_module.php index 804e2e4e9..592dded5d 100644 --- a/admin/models/joomla_module.php +++ b/admin/models/joomla_module.php @@ -12,10 +12,24 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\String\ClassfunctionHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Joomla_module Admin Model @@ -148,16 +162,16 @@ class ComponentbuilderModelJoomla_module extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'joomla_module', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'joomla_module', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -189,17 +203,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'joomla_module__'.$id); ComponentbuilderHelper::set('joomla_module__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -208,7 +221,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -363,17 +376,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'joomla_module__'.$id); ComponentbuilderHelper::set('joomla_module__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -394,7 +406,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -421,7 +433,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -434,7 +446,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -493,11 +505,11 @@ public function getForm($data = array(), $loadData = true, $options = array('con } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -512,22 +524,22 @@ public function getForm($data = array(), $loadData = true, $options = array('con // Only load the GUID if new item (or empty) if (0 == $id || !($val = $form->getValue('guid'))) { - $form->setValue('guid', null, ComponentbuilderHelper::GUID()); + $form->setValue('guid', null, GuidHelper::get()); } - + return $form; } /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/joomla_module.js'; } - + /** * Method to test whether a record can be deleted. * @@ -546,7 +558,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('joomla_module.delete', 'com_componentbuilder.joomla_module.' . (int) $record->id); } @@ -564,8 +576,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -576,31 +588,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('joomla_module.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('joomla_module.edit', 'com_componentbuilder.joomla_module.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('joomla_module.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -608,19 +620,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -632,7 +644,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_joomla_module')); @@ -647,7 +659,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -662,10 +674,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.joomla_module.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.joomla_module.data', []); if (empty($data)) { @@ -677,42 +689,6 @@ protected function loadFormData() return $data; } - /** - * Method to validate the form data. - * - * @param JForm $form The form to validate against. - * @param array $data The data to validate. - * @param string $group The name of the field group to validate. - * - * @return mixed Array of filtered data if valid, false otherwise. - * - * @see JFormRule - * @see JFilterInput - * @since 12.2 - */ - public function validate($form, $data, $group = null) - { - // check if the not_required field is set - if (isset($data['not_required']) && ComponentbuilderHelper::checkString($data['not_required'])) - { - $requiredFields = (array) explode(',',(string) $data['not_required']); - $requiredFields = array_unique($requiredFields); - // now change the required field attributes value - foreach ($requiredFields as $requiredField) - { - // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) - { - // change to false - $form->setFieldAttribute($requiredField, 'required', 'false'); - // also clear the data set - $data[$requiredField] = ''; - } - } - } - return parent::validate($form, $data, $group); - } - /** * Method to get the unique fields of this table. * @@ -724,7 +700,7 @@ protected function getUniqueFields() { return array('guid'); } - + /** * Method to delete one or more records. * @@ -742,7 +718,7 @@ public function delete(&$pks) } // we must also delete the linked tables found - if (ComponentbuilderHelper::checkArray($pks)) + if (UtilitiesArrayHelper::check($pks)) { // linked tables to update $_tablesArray = array( @@ -762,7 +738,7 @@ public function delete(&$pks) } } - + return true; } @@ -784,7 +760,7 @@ public function publish(&$pks, $value = 1) } // we must also update all linked tables - if (ComponentbuilderHelper::checkArray($pks)) + if (UtilitiesArrayHelper::check($pks)) { // linked tables to update $_tablesArray = array( @@ -804,10 +780,10 @@ public function publish(&$pks, $value = 1) } } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -833,30 +809,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('joomla_module'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('joomla_module'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -893,8 +869,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -920,7 +895,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_module'); @@ -946,7 +921,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -959,7 +934,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('joomla_module.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -975,19 +950,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->system_name) && !is_numeric($this->table->system_name)) + if (UtilitiesStringHelper::check($this->table->system_name) && !is_numeric($this->table->system_name)) { $this->table->system_name = $this->generateUnique('system_name',$this->table->system_name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -999,7 +974,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1063,7 +1038,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_module'); @@ -1071,7 +1046,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('joomla_module.edit') && !$this->canDo->get('joomla_module.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1088,7 +1063,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('joomla_module.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1104,13 +1079,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -1154,7 +1129,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -1166,15 +1141,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -1183,12 +1158,12 @@ public function save($data) 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']); } // always reset the snippets $data['snippet'] = 0; // 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']; } @@ -1197,20 +1172,20 @@ public function save($data) if (empty($data['guid']) && $data['id'] > 0) { // get the existing one - $data['guid'] = (string) ComponentbuilderHelper::getVar('joomla_module', $data['id'], 'id', 'guid'); + $data['guid'] = (string) GetHelper::var('joomla_module', $data['id'], 'id', 'guid'); } + // Set the GUID if empty or not valid - while (!ComponentbuilderHelper::validGUID($data['guid'], "joomla_module", $data['id'])) + while (!GuidHelper::valid($data['guid'], "joomla_module", $data['id'])) { // must always be set - $data['guid'] = (string) ComponentbuilderHelper::GUID(); - } - + $data['guid'] = (string) GuidHelper::get(); + } // Set the libraries items to data. if (isset($data['libraries']) && is_array($data['libraries'])) { - $libraries = new JRegistry; + $libraries = new Registry; $libraries->loadArray($data['libraries']); $data['libraries'] = (string) $libraries; } @@ -1223,7 +1198,7 @@ public function save($data) // Set the custom_get items to data. if (isset($data['custom_get']) && is_array($data['custom_get'])) { - $custom_get = new JRegistry; + $custom_get = new Registry; $custom_get->loadArray($data['custom_get']); $data['custom_get'] = (string) $custom_get; } @@ -1236,7 +1211,7 @@ public function save($data) // Set the fields items to data. if (isset($data['fields']) && is_array($data['fields'])) { - $fields = new JRegistry; + $fields = new Registry; $fields->loadArray($data['fields']); $data['fields'] = (string) $fields; } @@ -1329,11 +1304,11 @@ public function save($data) { $data['php_preflight_install'] = base64_encode($data['php_preflight_install']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1343,7 +1318,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1351,14 +1326,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1371,7 +1346,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1397,7 +1371,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/joomla_module_files_folders_urls.php b/admin/models/joomla_module_files_folders_urls.php index ad402341d..6a01567a7 100644 --- a/admin/models/joomla_module_files_folders_urls.php +++ b/admin/models/joomla_module_files_folders_urls.php @@ -12,10 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Joomla_module_files_folders_urls Admin Model @@ -73,18 +83,18 @@ class ComponentbuilderModelJoomla_module_files_folders_urls extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'joomla_module_files_folders_urls', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'joomla_module_files_folders_urls', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -169,7 +179,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -196,7 +206,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -209,7 +219,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -272,13 +282,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/joomla_module_files_folders_urls.js'; } - + /** * Method to test whether a record can be deleted. * @@ -297,7 +307,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('joomla_module_files_folders_urls.delete', 'com_componentbuilder.joomla_module_files_folders_urls.' . (int) $record->id); } @@ -315,8 +325,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -327,31 +337,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('joomla_module_files_folders_urls.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('joomla_module_files_folders_urls.edit', 'com_componentbuilder.joomla_module_files_folders_urls.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('joomla_module_files_folders_urls.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -359,19 +369,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -383,7 +393,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_joomla_module_files_folders_urls')); @@ -398,7 +408,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -413,10 +423,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.joomla_module_files_folders_urls.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.joomla_module_files_folders_urls.data', []); if (empty($data)) { @@ -439,7 +449,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -455,7 +465,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -475,10 +485,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -504,30 +514,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('joomla_module_files_folders_urls'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('joomla_module_files_folders_urls'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -564,8 +574,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -591,7 +600,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_module_files_folders_urls'); @@ -617,7 +626,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -630,7 +639,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('joomla_module_files_folders_urls.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -646,19 +655,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_module) && !is_numeric($this->table->joomla_module)) + if (UtilitiesStringHelper::check($this->table->joomla_module) && !is_numeric($this->table->joomla_module)) { $this->table->joomla_module = $this->generateUnique('joomla_module',$this->table->joomla_module); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -670,7 +679,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -734,7 +743,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_module_files_folders_urls'); @@ -742,7 +751,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('joomla_module_files_folders_urls.edit') && !$this->canDo->get('joomla_module_files_folders_urls.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -759,7 +768,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('joomla_module_files_folders_urls.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -775,13 +784,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -825,7 +834,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -837,15 +846,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -853,7 +862,7 @@ public function save($data) // Set the addfoldersfullpath items to data. if (isset($data['addfoldersfullpath']) && is_array($data['addfoldersfullpath'])) { - $addfoldersfullpath = new JRegistry; + $addfoldersfullpath = new Registry; $addfoldersfullpath->loadArray($data['addfoldersfullpath']); $data['addfoldersfullpath'] = (string) $addfoldersfullpath; } @@ -866,7 +875,7 @@ public function save($data) // Set the addfilesfullpath items to data. if (isset($data['addfilesfullpath']) && is_array($data['addfilesfullpath'])) { - $addfilesfullpath = new JRegistry; + $addfilesfullpath = new Registry; $addfilesfullpath->loadArray($data['addfilesfullpath']); $data['addfilesfullpath'] = (string) $addfilesfullpath; } @@ -879,7 +888,7 @@ public function save($data) // Set the addfolders items to data. if (isset($data['addfolders']) && is_array($data['addfolders'])) { - $addfolders = new JRegistry; + $addfolders = new Registry; $addfolders->loadArray($data['addfolders']); $data['addfolders'] = (string) $addfolders; } @@ -892,7 +901,7 @@ public function save($data) // Set the addfiles items to data. if (isset($data['addfiles']) && is_array($data['addfiles'])) { - $addfiles = new JRegistry; + $addfiles = new Registry; $addfiles->loadArray($data['addfiles']); $data['addfiles'] = (string) $addfiles; } @@ -905,7 +914,7 @@ public function save($data) // Set the addurls items to data. if (isset($data['addurls']) && is_array($data['addurls'])) { - $addurls = new JRegistry; + $addurls = new Registry; $addurls->loadArray($data['addurls']); $data['addurls'] = (string) $addurls; } @@ -914,11 +923,11 @@ public function save($data) // Set the empty addurls to data $data['addurls'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -928,7 +937,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -936,14 +945,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -956,7 +965,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -982,7 +990,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/joomla_module_updates.php b/admin/models/joomla_module_updates.php index 3b80f2756..f4ce5dab5 100644 --- a/admin/models/joomla_module_updates.php +++ b/admin/models/joomla_module_updates.php @@ -12,10 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Joomla_module_updates Admin Model @@ -59,18 +69,18 @@ class ComponentbuilderModelJoomla_module_updates extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'joomla_module_updates', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'joomla_module_updates', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -123,7 +133,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -150,7 +160,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -163,7 +173,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -229,13 +239,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/joomla_module_updates.js'; } - + /** * Method to test whether a record can be deleted. * @@ -254,7 +264,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('joomla_module_updates.delete', 'com_componentbuilder.joomla_module_updates.' . (int) $record->id); } @@ -272,8 +282,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -284,31 +294,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('joomla_module_updates.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('joomla_module_updates.edit', 'com_componentbuilder.joomla_module_updates.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('joomla_module_updates.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -316,19 +326,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -340,7 +350,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_joomla_module_updates')); @@ -355,7 +365,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -370,10 +380,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.joomla_module_updates.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.joomla_module_updates.data', []); if (empty($data)) { @@ -396,7 +406,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -412,7 +422,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -432,10 +442,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -461,30 +471,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('joomla_module_updates'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('joomla_module_updates'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -521,8 +531,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -548,7 +557,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_module_updates'); @@ -574,7 +583,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -587,7 +596,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('joomla_module_updates.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -603,19 +612,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_module) && !is_numeric($this->table->joomla_module)) + if (UtilitiesStringHelper::check($this->table->joomla_module) && !is_numeric($this->table->joomla_module)) { $this->table->joomla_module = $this->generateUnique('joomla_module',$this->table->joomla_module); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -627,7 +636,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -691,7 +700,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_module_updates'); @@ -699,7 +708,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('joomla_module_updates.edit') && !$this->canDo->get('joomla_module_updates.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -716,7 +725,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('joomla_module_updates.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -732,13 +741,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -782,7 +791,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -794,15 +803,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -810,7 +819,7 @@ public function save($data) // Set the version_update items to data. if (isset($data['version_update']) && is_array($data['version_update'])) { - $version_update = new JRegistry; + $version_update = new Registry; $version_update->loadArray($data['version_update']); $data['version_update'] = (string) $version_update; } @@ -819,11 +828,11 @@ public function save($data) // Set the empty version_update to data $data['version_update'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -833,7 +842,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -841,14 +850,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -861,7 +870,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -887,7 +895,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/joomla_modules.php b/admin/models/joomla_modules.php index 223ce938e..002bad7df 100644 --- a/admin/models/joomla_modules.php +++ b/admin/models/joomla_modules.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Joomla_modules List Model */ class ComponentbuilderModelJoomla_modules extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -53,7 +61,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -110,7 +118,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -125,12 +133,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -146,7 +154,7 @@ public function getItems() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -155,7 +163,7 @@ public function getItems() } } - + // return items return $items; } @@ -163,7 +171,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -175,25 +183,25 @@ public function selectionTranslation($value,$name) 2 => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADMIN' ); // Now check if value is found in this array - if (isset($targetArray[$value]) && ComponentbuilderHelper::checkString($targetArray[$value])) + if (isset($targetArray[$value]) && StringHelper::check($targetArray[$value])) { return $targetArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -222,7 +230,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -263,16 +271,18 @@ protected function getListQuery() $query->where('a.target = ' . (int) $_target); } } - elseif (ComponentbuilderHelper::checkString($_target)) + elseif (StringHelper::check($_target)) { $query->where('a.target = ' . $db->quote($db->escape($_target))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -290,17 +300,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -344,7 +354,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -392,7 +402,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -410,16 +420,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_joomla_module"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -428,7 +438,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -443,13 +453,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -466,19 +476,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -490,7 +499,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -511,7 +520,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/joomla_modules_files_folders_urls.php b/admin/models/joomla_modules_files_folders_urls.php index 2b0db703f..ca2eb47b4 100644 --- a/admin/models/joomla_modules_files_folders_urls.php +++ b/admin/models/joomla_modules_files_folders_urls.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Joomla_modules_files_folders_urls List Model */ class ComponentbuilderModelJoomla_modules_files_folders_urls extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/joomla_modules_updates.php b/admin/models/joomla_modules_updates.php index bdd62ef45..62a5822f4 100644 --- a/admin/models/joomla_modules_updates.php +++ b/admin/models/joomla_modules_updates.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Joomla_modules_updates List Model */ class ComponentbuilderModelJoomla_modules_updates extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/joomla_plugin.php b/admin/models/joomla_plugin.php index 4b6ef7b28..eb8fd4c1a 100644 --- a/admin/models/joomla_plugin.php +++ b/admin/models/joomla_plugin.php @@ -12,10 +12,24 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\String\ClassfunctionHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Joomla_plugin Admin Model @@ -125,16 +139,16 @@ class ComponentbuilderModelJoomla_plugin extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'joomla_plugin', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'joomla_plugin', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -166,17 +180,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'joomla_plugin__'.$id); ComponentbuilderHelper::set('joomla_plugin__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -185,7 +198,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -328,17 +341,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'joomla_plugin__'.$id); ComponentbuilderHelper::set('joomla_plugin__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -359,7 +371,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -386,7 +398,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -399,7 +411,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -458,11 +470,11 @@ public function getForm($data = array(), $loadData = true, $options = array('con } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -477,22 +489,22 @@ public function getForm($data = array(), $loadData = true, $options = array('con // Only load the GUID if new item (or empty) if (0 == $id || !($val = $form->getValue('guid'))) { - $form->setValue('guid', null, ComponentbuilderHelper::GUID()); + $form->setValue('guid', null, GuidHelper::get()); } - + return $form; } /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/joomla_plugin.js'; } - + /** * Method to test whether a record can be deleted. * @@ -511,7 +523,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('joomla_plugin.delete', 'com_componentbuilder.joomla_plugin.' . (int) $record->id); } @@ -529,8 +541,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -541,31 +553,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('joomla_plugin.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('joomla_plugin.edit', 'com_componentbuilder.joomla_plugin.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('joomla_plugin.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -573,19 +585,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -597,7 +609,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_joomla_plugin')); @@ -612,7 +624,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -627,10 +639,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.joomla_plugin.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.joomla_plugin.data', []); if (empty($data)) { @@ -642,42 +654,6 @@ protected function loadFormData() return $data; } - /** - * Method to validate the form data. - * - * @param JForm $form The form to validate against. - * @param array $data The data to validate. - * @param string $group The name of the field group to validate. - * - * @return mixed Array of filtered data if valid, false otherwise. - * - * @see JFormRule - * @see JFilterInput - * @since 12.2 - */ - public function validate($form, $data, $group = null) - { - // check if the not_required field is set - if (isset($data['not_required']) && ComponentbuilderHelper::checkString($data['not_required'])) - { - $requiredFields = (array) explode(',',(string) $data['not_required']); - $requiredFields = array_unique($requiredFields); - // now change the required field attributes value - foreach ($requiredFields as $requiredField) - { - // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) - { - // change to false - $form->setFieldAttribute($requiredField, 'required', 'false'); - // also clear the data set - $data[$requiredField] = ''; - } - } - } - return parent::validate($form, $data, $group); - } - /** * Method to get the unique fields of this table. * @@ -689,7 +665,7 @@ protected function getUniqueFields() { return array('guid'); } - + /** * Method to delete one or more records. * @@ -707,7 +683,7 @@ public function delete(&$pks) } // we must also delete the linked tables found - if (ComponentbuilderHelper::checkArray($pks)) + if (UtilitiesArrayHelper::check($pks)) { // linked tables to update $_tablesArray = array( @@ -727,7 +703,7 @@ public function delete(&$pks) } } - + return true; } @@ -749,7 +725,7 @@ public function publish(&$pks, $value = 1) } // we must also update all linked tables - if (ComponentbuilderHelper::checkArray($pks)) + if (UtilitiesArrayHelper::check($pks)) { // linked tables to update $_tablesArray = array( @@ -769,10 +745,10 @@ public function publish(&$pks, $value = 1) } } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -798,30 +774,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -858,8 +834,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -885,7 +860,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin'); @@ -911,7 +886,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -924,7 +899,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('joomla_plugin.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -940,19 +915,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->system_name) && !is_numeric($this->table->system_name)) + if (UtilitiesStringHelper::check($this->table->system_name) && !is_numeric($this->table->system_name)) { $this->table->system_name = $this->generateUnique('system_name',$this->table->system_name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -964,7 +939,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1028,7 +1003,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin'); @@ -1036,7 +1011,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('joomla_plugin.edit') && !$this->canDo->get('joomla_plugin.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1053,7 +1028,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('joomla_plugin.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1069,13 +1044,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -1119,7 +1094,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -1131,15 +1106,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -1148,10 +1123,10 @@ public function save($data) 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']; } @@ -1160,20 +1135,20 @@ public function save($data) if (empty($data['guid']) && $data['id'] > 0) { // get the existing one - $data['guid'] = (string) ComponentbuilderHelper::getVar('joomla_plugin', $data['id'], 'id', 'guid'); + $data['guid'] = (string) GetHelper::var('joomla_plugin', $data['id'], 'id', 'guid'); } + // Set the GUID if empty or not valid - while (!ComponentbuilderHelper::validGUID($data['guid'], "joomla_plugin", $data['id'])) + while (!GuidHelper::valid($data['guid'], "joomla_plugin", $data['id'])) { // must always be set - $data['guid'] = (string) ComponentbuilderHelper::GUID(); - } - + $data['guid'] = (string) GuidHelper::get(); + } // Set the method_selection items to data. if (isset($data['method_selection']) && is_array($data['method_selection'])) { - $method_selection = new JRegistry; + $method_selection = new Registry; $method_selection->loadArray($data['method_selection']); $data['method_selection'] = (string) $method_selection; } @@ -1186,7 +1161,7 @@ public function save($data) // Set the property_selection items to data. if (isset($data['property_selection']) && is_array($data['property_selection'])) { - $property_selection = new JRegistry; + $property_selection = new Registry; $property_selection->loadArray($data['property_selection']); $data['property_selection'] = (string) $property_selection; } @@ -1199,7 +1174,7 @@ public function save($data) // Set the fields items to data. if (isset($data['fields']) && is_array($data['fields'])) { - $fields = new JRegistry; + $fields = new Registry; $fields->loadArray($data['fields']); $data['fields'] = (string) $fields; } @@ -1280,11 +1255,11 @@ public function save($data) { $data['php_preflight_uninstall'] = base64_encode($data['php_preflight_uninstall']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1294,7 +1269,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1302,14 +1277,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1322,7 +1297,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1348,7 +1322,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/joomla_plugin_files_folders_urls.php b/admin/models/joomla_plugin_files_folders_urls.php index 1f4ef4d6b..6fb2f26a3 100644 --- a/admin/models/joomla_plugin_files_folders_urls.php +++ b/admin/models/joomla_plugin_files_folders_urls.php @@ -12,10 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Joomla_plugin_files_folders_urls Admin Model @@ -73,18 +83,18 @@ class ComponentbuilderModelJoomla_plugin_files_folders_urls extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'joomla_plugin_files_folders_urls', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'joomla_plugin_files_folders_urls', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -169,7 +179,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -196,7 +206,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -209,7 +219,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -272,13 +282,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/joomla_plugin_files_folders_urls.js'; } - + /** * Method to test whether a record can be deleted. * @@ -297,7 +307,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('joomla_plugin_files_folders_urls.delete', 'com_componentbuilder.joomla_plugin_files_folders_urls.' . (int) $record->id); } @@ -315,8 +325,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -327,31 +337,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('joomla_plugin_files_folders_urls.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('joomla_plugin_files_folders_urls.edit', 'com_componentbuilder.joomla_plugin_files_folders_urls.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('joomla_plugin_files_folders_urls.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -359,19 +369,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -383,7 +393,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_joomla_plugin_files_folders_urls')); @@ -398,7 +408,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -413,10 +423,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.joomla_plugin_files_folders_urls.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.joomla_plugin_files_folders_urls.data', []); if (empty($data)) { @@ -439,7 +449,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -455,7 +465,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -475,10 +485,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -504,30 +514,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_files_folders_urls'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_files_folders_urls'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -564,8 +574,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -591,7 +600,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_files_folders_urls'); @@ -617,7 +626,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -630,7 +639,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('joomla_plugin_files_folders_urls.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -646,19 +655,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_plugin) && !is_numeric($this->table->joomla_plugin)) + if (UtilitiesStringHelper::check($this->table->joomla_plugin) && !is_numeric($this->table->joomla_plugin)) { $this->table->joomla_plugin = $this->generateUnique('joomla_plugin',$this->table->joomla_plugin); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -670,7 +679,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -734,7 +743,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_files_folders_urls'); @@ -742,7 +751,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('joomla_plugin_files_folders_urls.edit') && !$this->canDo->get('joomla_plugin_files_folders_urls.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -759,7 +768,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('joomla_plugin_files_folders_urls.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -775,13 +784,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -825,7 +834,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -837,15 +846,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -853,7 +862,7 @@ public function save($data) // Set the addfoldersfullpath items to data. if (isset($data['addfoldersfullpath']) && is_array($data['addfoldersfullpath'])) { - $addfoldersfullpath = new JRegistry; + $addfoldersfullpath = new Registry; $addfoldersfullpath->loadArray($data['addfoldersfullpath']); $data['addfoldersfullpath'] = (string) $addfoldersfullpath; } @@ -866,7 +875,7 @@ public function save($data) // Set the addfilesfullpath items to data. if (isset($data['addfilesfullpath']) && is_array($data['addfilesfullpath'])) { - $addfilesfullpath = new JRegistry; + $addfilesfullpath = new Registry; $addfilesfullpath->loadArray($data['addfilesfullpath']); $data['addfilesfullpath'] = (string) $addfilesfullpath; } @@ -879,7 +888,7 @@ public function save($data) // Set the addfolders items to data. if (isset($data['addfolders']) && is_array($data['addfolders'])) { - $addfolders = new JRegistry; + $addfolders = new Registry; $addfolders->loadArray($data['addfolders']); $data['addfolders'] = (string) $addfolders; } @@ -892,7 +901,7 @@ public function save($data) // Set the addfiles items to data. if (isset($data['addfiles']) && is_array($data['addfiles'])) { - $addfiles = new JRegistry; + $addfiles = new Registry; $addfiles->loadArray($data['addfiles']); $data['addfiles'] = (string) $addfiles; } @@ -905,7 +914,7 @@ public function save($data) // Set the addurls items to data. if (isset($data['addurls']) && is_array($data['addurls'])) { - $addurls = new JRegistry; + $addurls = new Registry; $addurls->loadArray($data['addurls']); $data['addurls'] = (string) $addurls; } @@ -914,11 +923,11 @@ public function save($data) // Set the empty addurls to data $data['addurls'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -928,7 +937,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -936,14 +945,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -956,7 +965,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -982,7 +990,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/joomla_plugin_group.php b/admin/models/joomla_plugin_group.php index b8d9b0bc0..f7d3ce3ca 100644 --- a/admin/models/joomla_plugin_group.php +++ b/admin/models/joomla_plugin_group.php @@ -12,10 +12,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\String\ClassfunctionHelper; /** * Componentbuilder Joomla_plugin_group Admin Model @@ -59,18 +70,18 @@ class ComponentbuilderModelJoomla_plugin_group extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'joomla_plugin_group', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'joomla_plugin_group', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -115,7 +126,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -142,7 +153,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -155,7 +166,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -216,13 +227,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/joomla_plugin_group.js'; } - + /** * Method to test whether a record can be deleted. * @@ -241,7 +252,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('core.delete', 'com_componentbuilder.joomla_plugin_group.' . (int) $record->id); } @@ -259,8 +270,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -271,30 +282,30 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return parent::canEditState($record); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - return JFactory::getUser()->authorise('core.edit', 'com_componentbuilder.joomla_plugin_group.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + return Factory::getUser()->authorise('core.edit', 'com_componentbuilder.joomla_plugin_group.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -302,19 +313,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -326,7 +337,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_joomla_plugin_group')); @@ -341,7 +352,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -356,10 +367,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.joomla_plugin_group.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.joomla_plugin_group.data', []); if (empty($data)) { @@ -382,7 +393,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -398,7 +409,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -418,10 +429,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -447,30 +458,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_group'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_group'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -507,8 +518,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -534,13 +544,13 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_group'); } - if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + if (!$this->canDo->get('core.create') && !$this->canDo->get('joomla_plugin_group.batch')) { return false; } @@ -560,7 +570,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -573,7 +583,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('core.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -589,19 +599,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -613,7 +623,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -677,15 +687,15 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_group'); } - if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + if (!$this->canDo->get('core.edit') && !$this->canDo->get('joomla_plugin_group.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -702,7 +712,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('core.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -718,13 +728,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -768,7 +778,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -780,26 +790,26 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // 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']); + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -809,7 +819,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -817,14 +827,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -837,7 +847,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -863,7 +872,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/joomla_plugin_groups.php b/admin/models/joomla_plugin_groups.php index 397457c15..f056ef6c4 100644 --- a/admin/models/joomla_plugin_groups.php +++ b/admin/models/joomla_plugin_groups.php @@ -12,18 +12,25 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Joomla_plugin_groups List Model */ class ComponentbuilderModelJoomla_plugin_groups extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -52,7 +59,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -102,7 +109,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -115,22 +122,22 @@ public function getItems() // load parent items $items = parent::getItems(); - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -163,7 +170,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -204,22 +211,24 @@ protected function getListQuery() $query->where('a.class_extends = ' . (int) $_class_extends); } } - elseif (ComponentbuilderHelper::checkString($_class_extends)) + elseif (StringHelper::check($_class_extends)) { $query->where('a.class_extends = ' . $db->quote($db->escape($_class_extends))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -234,13 +243,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -256,19 +265,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -280,7 +288,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -301,7 +309,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/joomla_plugin_updates.php b/admin/models/joomla_plugin_updates.php index 7d77ceb19..526d1f9bc 100644 --- a/admin/models/joomla_plugin_updates.php +++ b/admin/models/joomla_plugin_updates.php @@ -12,10 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Joomla_plugin_updates Admin Model @@ -59,18 +69,18 @@ class ComponentbuilderModelJoomla_plugin_updates extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'joomla_plugin_updates', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'joomla_plugin_updates', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -123,7 +133,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -150,7 +160,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -163,7 +173,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -229,13 +239,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/joomla_plugin_updates.js'; } - + /** * Method to test whether a record can be deleted. * @@ -254,7 +264,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('joomla_plugin_updates.delete', 'com_componentbuilder.joomla_plugin_updates.' . (int) $record->id); } @@ -272,8 +282,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -284,31 +294,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('joomla_plugin_updates.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('joomla_plugin_updates.edit', 'com_componentbuilder.joomla_plugin_updates.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('joomla_plugin_updates.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -316,19 +326,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -340,7 +350,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_joomla_plugin_updates')); @@ -355,7 +365,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -370,10 +380,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.joomla_plugin_updates.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.joomla_plugin_updates.data', []); if (empty($data)) { @@ -396,7 +406,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -412,7 +422,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -432,10 +442,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -461,30 +471,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_updates'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_updates'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -521,8 +531,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -548,7 +557,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_updates'); @@ -574,7 +583,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -587,7 +596,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('joomla_plugin_updates.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -603,19 +612,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->joomla_plugin) && !is_numeric($this->table->joomla_plugin)) + if (UtilitiesStringHelper::check($this->table->joomla_plugin) && !is_numeric($this->table->joomla_plugin)) { $this->table->joomla_plugin = $this->generateUnique('joomla_plugin',$this->table->joomla_plugin); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -627,7 +636,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -691,7 +700,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('joomla_plugin_updates'); @@ -699,7 +708,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('joomla_plugin_updates.edit') && !$this->canDo->get('joomla_plugin_updates.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -716,7 +725,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('joomla_plugin_updates.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -732,13 +741,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -782,7 +791,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -794,15 +803,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -810,7 +819,7 @@ public function save($data) // Set the version_update items to data. if (isset($data['version_update']) && is_array($data['version_update'])) { - $version_update = new JRegistry; + $version_update = new Registry; $version_update->loadArray($data['version_update']); $data['version_update'] = (string) $version_update; } @@ -819,11 +828,11 @@ public function save($data) // Set the empty version_update to data $data['version_update'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -833,7 +842,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -841,14 +850,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -861,7 +870,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -887,7 +895,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/joomla_plugins.php b/admin/models/joomla_plugins.php index ada80be0d..8128dca03 100644 --- a/admin/models/joomla_plugins.php +++ b/admin/models/joomla_plugins.php @@ -12,18 +12,27 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Joomla_plugins List Model */ class ComponentbuilderModelJoomla_plugins extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -62,7 +71,7 @@ function($tree) { } )); // make sure we have the correct boilerplate - if (ComponentbuilderHelper::checkArray($found) && count($found) == 1 && method_exists(__CLASS__, 'getPluginsBoilerplate')) + if (UtilitiesArrayHelper::check($found) && count($found) == 1 && method_exists(__CLASS__, 'getPluginsBoilerplate')) { // get the plugins boilerplate return $this->getPluginsBoilerplate($found[0]->url); @@ -83,7 +92,7 @@ protected function getPluginsBoilerplate($url) if (($plugin_tree = ComponentbuilderHelper::getGithubRepoFileList('boilerplate_plugins', $url)) !== false) { // get the app object - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // set the table names $tables = array(); $tables['e'] = 'class_extends'; @@ -99,11 +108,11 @@ protected function getPluginsBoilerplate($url) // get the needed data of each plugin group $groups = array_map( function($tree) use(&$app, &$models, &$tables){ - if (($fooClass = ComponentbuilderHelper::getFileContents(ComponentbuilderHelper::$bolerplatePath . '/plugins/' . $tree->path . '/foo.php')) !== false && ComponentbuilderHelper::checkString($fooClass)) + if (($fooClass = ComponentbuilderHelper::getFileContents(ComponentbuilderHelper::$bolerplatePath . '/plugins/' . $tree->path . '/foo.php')) !== false && StringHelper::check($fooClass)) { // extract the boilerplate class extends and check if already set if (($classExtends = ComponentbuilderHelper::extractBoilerplateClassExtends($fooClass, 'plugins')) !== false && - ($classExtendsID = ComponentbuilderHelper::getVar('class_extends', $classExtends, 'name', 'id')) === false) + ($classExtendsID = GetHelper::var('class_extends', $classExtends, 'name', 'id')) === false) { // load the extends class name $class = array('id' => 0, 'published' => 1, 'version' => 1, 'name' => $classExtends); @@ -116,23 +125,23 @@ function($tree) use(&$app, &$models, &$tables){ // store the class $this->storePluginBoilerplate($tables['e'], $models['e'], $class, $app); // work around - $classExtendsID = ComponentbuilderHelper::getVar('class_extends', $classExtends, 'name', 'id'); + $classExtendsID = GetHelper::var('class_extends', $classExtends, 'name', 'id'); } // set plugin group if not already set - if (($pluginGroupID = ComponentbuilderHelper::getVar('joomla_plugin_group', $tree->path, 'name', 'id')) === false) + if (($pluginGroupID = GetHelper::var('joomla_plugin_group', $tree->path, 'name', 'id')) === false) { // load the plugin group name $pluginGroup = array('id' => 0, 'published' => 1, 'version' => 1, 'name' => $tree->path, 'class_extends' => $classExtendsID); // store the group $this->storePluginBoilerplate($tables['g'], $models['g'], $pluginGroup, $app); // work around - $pluginGroupID = ComponentbuilderHelper::getVar('joomla_plugin_group', $tree->path, 'name', 'id'); + $pluginGroupID = GetHelper::var('joomla_plugin_group', $tree->path, 'name', 'id'); } // extract the boilerplate class property and methods if (($classProperiesMethods = ComponentbuilderHelper::extractBoilerplateClassPropertiesMethods($fooClass, $classExtends, 'plugins', $pluginGroupID)) !== false) { // create the properties found - if (isset($classProperiesMethods['property']) && ComponentbuilderHelper::checkArray($classProperiesMethods['property'])) + if (isset($classProperiesMethods['property']) && UtilitiesArrayHelper::check($classProperiesMethods['property'])) { foreach ($classProperiesMethods['property'] as $_property) { @@ -141,7 +150,7 @@ function($tree) use(&$app, &$models, &$tables){ } } // create the method found (TODO just create for now but we could later add a force update) - if (isset($classProperiesMethods['method']) && ComponentbuilderHelper::checkArray($classProperiesMethods['method'])) + if (isset($classProperiesMethods['method']) && UtilitiesArrayHelper::check($classProperiesMethods['method'])) { foreach ($classProperiesMethods['method'] as $_method) { @@ -203,7 +212,7 @@ protected function storePluginBoilerplate(&$table, &$method, &$boilerplate, &$ap // Attempt to save the data. if (!$method->save($validData)) { - $app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BOILERPLATE_PLUGIN_S_DATA_COULD_NOT_BE_SAVED', $table), 'error'); + $app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_BOILERPLATE_PLUGIN_S_DATA_COULD_NOT_BE_SAVED', $table), 'error'); return false; } return true; @@ -223,7 +232,7 @@ protected function storePluginBoilerplate(&$table, &$method, &$boilerplate, &$ap */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -280,7 +289,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -295,12 +304,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -314,22 +323,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -366,7 +375,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -407,7 +416,7 @@ protected function getListQuery() $query->where('a.class_extends = ' . (int) $_class_extends); } } - elseif (ComponentbuilderHelper::checkString($_class_extends)) + elseif (StringHelper::check($_class_extends)) { $query->where('a.class_extends = ' . $db->quote($db->escape($_class_extends))); } @@ -424,22 +433,24 @@ protected function getListQuery() $query->where('a.joomla_plugin_group = ' . (int) $_joomla_plugin_group); } } - elseif (ComponentbuilderHelper::checkString($_joomla_plugin_group)) + elseif (StringHelper::check($_joomla_plugin_group)) { $query->where('a.joomla_plugin_group = ' . $db->quote($db->escape($_joomla_plugin_group))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -454,13 +465,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -477,19 +488,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -501,7 +511,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -522,7 +532,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/joomla_plugins_files_folders_urls.php b/admin/models/joomla_plugins_files_folders_urls.php index 7e36e78ec..06e539aa9 100644 --- a/admin/models/joomla_plugins_files_folders_urls.php +++ b/admin/models/joomla_plugins_files_folders_urls.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Joomla_plugins_files_folders_urls List Model */ class ComponentbuilderModelJoomla_plugins_files_folders_urls extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/joomla_plugins_updates.php b/admin/models/joomla_plugins_updates.php index 9a5ab6fda..a90085721 100644 --- a/admin/models/joomla_plugins_updates.php +++ b/admin/models/joomla_plugins_updates.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Joomla_plugins_updates List Model */ class ComponentbuilderModelJoomla_plugins_updates extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/joomla_power.php b/admin/models/joomla_power.php new file mode 100644 index 000000000..c1353f556 --- /dev/null +++ b/admin/models/joomla_power.php @@ -0,0 +1,927 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; +use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; + +/** + * Componentbuilder Joomla_power Admin Model + */ +class ComponentbuilderModelJoomla_power extends AdminModel +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'joomla_power' => array( + 'fullwidth' => array( + 'description', + 'settings' + ), + 'above' => array( + 'system_name' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COMPONENTBUILDER'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_componentbuilder.joomla_power'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return Table A database object + * + * @since 1.6 + */ + public function getTable($type = 'joomla_power', $prefix = 'ComponentbuilderTable', $config = []) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); + // get instance of the table + return Table::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->settings)) + { + // Convert the settings field to an array. + $settings = new Registry; + $settings->loadString($item->settings); + $item->settings = $settings->toArray(); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_componentbuilder.joomla_power', 'joomla_power', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = Factory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = Factory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('joomla_power.edit.state', 'com_componentbuilder.joomla_power.' . (int) $id)) + || ($id == 0 && !$user->authorise('joomla_power.edit.state', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if ($id != 0 && (!$user->authorise('joomla_power.edit.created_by', 'com_componentbuilder.joomla_power.' . (int) $id)) + || ($id == 0 && !$user->authorise('joomla_power.edit.created_by', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if ($id != 0 && (!$user->authorise('joomla_power.edit.created', 'com_componentbuilder.joomla_power.' . (int) $id)) + || ($id == 0 && !$user->authorise('joomla_power.edit.created', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + + // Only load the GUID if new item (or empty) + if (0 == $id || !($val = $form->getValue('guid'))) + { + $form->setValue('guid', null, GuidHelper::get()); + } + + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_componentbuilder/js/joomla_power.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = Factory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('joomla_power.delete', 'com_componentbuilder.joomla_power.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = Factory::getUser(); + $recordId = $record->id ?? 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('joomla_power.edit.state', 'com_componentbuilder.joomla_power.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absence of better information, revert to the component permissions. + return $user->authorise('joomla_power.edit.state', 'com_componentbuilder'); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = [], $key = 'id') + { + // Check specific edit permission then general edit permission. + $user = Factory::getUser(); + + return $user->authorise('joomla_power.edit', 'com_componentbuilder.joomla_power.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('joomla_power.edit', 'com_componentbuilder'); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param Table $table A Table object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = Factory::getDate(); + $user = Factory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__componentbuilder_joomla_power')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.joomla_power.data', []); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_componentbuilder.joomla_power', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return array('guid'); + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('joomla_power'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new UCMType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('joomla_power'); + } + + if (!$this->canDo->get('joomla_power.create') && !$this->canDo->get('joomla_power.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('joomla_power.edit.state')) + { + $values['published'] = 0; + } + + $newIds = []; + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('joomla_power.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // Only for strings + if (UtilitiesStringHelper::check($this->table->system_name) && !is_numeric($this->table->system_name)) + { + $this->table->system_name = $this->generateUnique('system_name',$this->table->system_name); + } + + // insert all set values + if (UtilitiesArrayHelper::check($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (UtilitiesArrayHelper::check($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = ComponentbuilderHelper::getActions('joomla_power'); + } + + if (!$this->canDo->get('joomla_power.edit') && !$this->canDo->get('joomla_power.batch')) + { + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('joomla_power.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('joomla_power.edit', $contexts[$pk])) + { + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (UtilitiesArrayHelper::check($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new Registry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + + // Set the GUID if empty or not valid + if (empty($data['guid']) && $data['id'] > 0) + { + // get the existing one + $data['guid'] = (string) GetHelper::var('joomla_power', $data['id'], 'id', 'guid'); + } + + // Set the GUID if empty or not valid + while (!GuidHelper::valid($data['guid'], "joomla_power", $data['id'])) + { + // must always be set + $data['guid'] = (string) GuidHelper::get(); + } + + // Set the settings items to data. + if (isset($data['settings']) && is_array($data['settings'])) + { + $settings = new Registry; + $settings->loadArray($data['settings']); + $data['settings'] = (string) $settings; + } + elseif (!isset($data['settings'])) + { + // Set the empty settings to data + $data['settings'] = ''; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new Registry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (UtilitiesArrayHelper::check($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title + * + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($title) + { + + // Alter the title + $table = $this->getTable(); + + while ($table->load(['title' => $title])) + { + $title = StringHelper::increment($title); + } + + return $title; + } +} diff --git a/admin/models/joomla_powers.php b/admin/models/joomla_powers.php new file mode 100644 index 000000000..9de822f06 --- /dev/null +++ b/admin/models/joomla_powers.php @@ -0,0 +1,312 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; + +/** + * Joomla_powers List Model + */ +class ComponentbuilderModelJoomla_powers extends ListModel +{ + public function __construct($config = []) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.system_name','system_name' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = Factory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name'); + if ($formSubmited) + { + $system_name = $app->input->post->get('system_name'); + $this->setState('filter.system_name', $system_name); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // Check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // Set values to display correctly. + if (UtilitiesArrayHelper::check($items)) + { + // Get the user object if not set. + if (!isset($user) || !ObjectHelper::check($user)) + { + $user = Factory::getUser(); + } + foreach ($items as $nr => &$item) + { + // Remove items the user can't access. + $access = ($user->authorise('joomla_power.access', 'com_componentbuilder.joomla_power.' . (int) $item->id) && $user->authorise('joomla_power.access', 'com_componentbuilder')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + // create the GUID placeholder key + $item->joomla_power_key = 'Joomla_'.'_'.'_' . str_replace('-', '_', $item->guid) . '_'.'_'.'_Power'; + } + } + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = Factory::getUser(); + // Create a new query object. + $db = Factory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the componentbuilder_item table + $query->from($db->quoteName('#__componentbuilder_joomla_power', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (UtilitiesArrayHelper::check($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_componentbuilder')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.system_name LIKE '.$search.' OR a.guid LIKE '.$search.' OR a.description LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); + if ($orderCol != '') + { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (UtilitiesArrayHelper::check($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || StringHelper::check($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.system_name'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return bool + * @since 3.2.0 + */ + protected function checkInNow(): bool + { + // Get set check in time + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); + + if ($time) + { + // Get a db connection. + $db = Factory::getDbo(); + // Reset query. + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__componentbuilder_joomla_power')); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date. + $date = Factory::getDate()->modify($time)->toSql(); + // Reset query. + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table. + $query->update($db->quoteName('#__componentbuilder_joomla_power'))->set($fields)->where($conditions); + + $db->setQuery($query); + + return $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/language.php b/admin/models/language.php index f35e510d3..2fd51d53f 100644 --- a/admin/models/language.php +++ b/admin/models/language.php @@ -12,10 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Language Admin Model @@ -59,18 +69,18 @@ class ComponentbuilderModelLanguage extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'language', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'language', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -115,7 +125,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -142,7 +152,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -155,7 +165,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -216,13 +226,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/language.js'; } - + /** * Method to test whether a record can be deleted. * @@ -241,7 +251,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('language.delete', 'com_componentbuilder.language.' . (int) $record->id); } @@ -259,8 +269,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -271,31 +281,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('language.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('language.edit', 'com_componentbuilder.language.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('language.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -303,19 +313,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -327,7 +337,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_language')); @@ -342,7 +352,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -357,10 +367,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.language.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.language.data', []); if (empty($data)) { @@ -383,7 +393,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -399,7 +409,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -419,10 +429,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -448,30 +458,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('language'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('language'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -508,8 +518,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -535,7 +544,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('language'); @@ -561,7 +570,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -574,7 +583,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('language.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -590,19 +599,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -614,7 +623,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -678,7 +687,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('language'); @@ -686,7 +695,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('language.edit') && !$this->canDo->get('language.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -703,7 +712,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('language.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -719,13 +728,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -769,7 +778,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -781,23 +790,23 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -807,7 +816,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -815,14 +824,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -835,7 +844,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -861,7 +869,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/language_translation.php b/admin/models/language_translation.php index 2f584729a..14057eef7 100644 --- a/admin/models/language_translation.php +++ b/admin/models/language_translation.php @@ -12,10 +12,22 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Language_translation Admin Model @@ -60,16 +72,16 @@ class ComponentbuilderModelLanguage_translation extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'language_translation', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'language_translation', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -101,17 +113,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'language_translation__'.$id); ComponentbuilderHelper::set('language_translation__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -120,7 +131,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -181,17 +192,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'language_translation__'.$id); ComponentbuilderHelper::set('language_translation__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -212,7 +222,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -239,7 +249,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -252,7 +262,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -313,13 +323,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/language_translation.js'; } - + /** * Method to test whether a record can be deleted. * @@ -338,7 +348,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('language_translation.delete', 'com_componentbuilder.language_translation.' . (int) $record->id); } @@ -356,8 +366,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -368,31 +378,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('language_translation.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('language_translation.edit', 'com_componentbuilder.language_translation.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('language_translation.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -400,19 +410,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -424,7 +434,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_language_translation')); @@ -439,7 +449,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -454,10 +464,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.language_translation.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.language_translation.data', []); if (empty($data)) { @@ -480,7 +490,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -496,7 +506,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -516,10 +526,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -545,30 +555,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('language_translation'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('language_translation'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -605,8 +615,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -632,7 +641,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('language_translation'); @@ -658,7 +667,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -671,7 +680,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('language_translation.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -687,19 +696,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->source) && !is_numeric($this->table->source)) + if (UtilitiesStringHelper::check($this->table->source) && !is_numeric($this->table->source)) { $this->table->source = $this->generateUnique('source',$this->table->source); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -711,7 +720,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -775,7 +784,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('language_translation'); @@ -783,7 +792,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('language_translation.edit') && !$this->canDo->get('language_translation.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -800,7 +809,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('language_translation.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -816,13 +825,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -866,7 +875,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -878,15 +887,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -894,7 +903,7 @@ public function save($data) // Set the translation items to data. if (isset($data['translation']) && is_array($data['translation'])) { - $translation = new JRegistry; + $translation = new Registry; $translation->loadArray($data['translation']); $data['translation'] = (string) $translation; } @@ -921,11 +930,11 @@ public function save($data) { $data['components'] = (string) json_encode($data['components']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -935,7 +944,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -943,14 +952,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -963,7 +972,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -989,7 +997,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/language_translations.php b/admin/models/language_translations.php index 13bdfcc66..771d3373e 100644 --- a/admin/models/language_translations.php +++ b/admin/models/language_translations.php @@ -12,18 +12,29 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\FormHelper as JCBFormHelper; +use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\JsonHelper; /** * Language_translations List Model */ class ComponentbuilderModelLanguage_translations extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -54,8 +65,8 @@ public function getFilterForm($data = array(), $loadData = true) $form = parent::getFilterForm($data, $loadData); // Create the "extension" filter - $form->setField(new SimpleXMLElement( - ComponentbuilderHelper::getExtensionGroupedListXml() + $form->setField(new \SimpleXMLElement( + JCBFilterHelper::extensions() ),'filter'); $form->setValue( 'extension', @@ -72,20 +83,20 @@ public function getFilterForm($data = array(), $loadData = true) ); // no languages found notice $options = array( - '' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_LANGUAGES_FOUND') . ' -' + '' => '- ' . Text::_('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') . ' -', - 'all' => JText::_('COM_COMPONENTBUILDER_EVERY_LANGUAGE') + '' => '- ' . Text::_('COM_COMPONENTBUILDER_TRANSLATED_IN') . ' -', + 'all' => Text::_('COM_COMPONENTBUILDER_EVERY_LANGUAGE') ); $options = array_merge($options, $languages); } - $form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter'); + $form->setField(JCBFormHelper::xml($attributes, $options),'filter'); $form->setValue( 'translated', 'filter', @@ -101,20 +112,20 @@ public function getFilterForm($data = array(), $loadData = true) ); // no languages found notice $options = array( - '' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_LANGUAGES_FOUND') . ' -' + '' => '- ' . Text::_('COM_COMPONENTBUILDER_NO_LANGUAGES_FOUND') . ' -' ); // check if we have languages set if ($languages) { $options = array( - '' => '- ' . JText::_('COM_COMPONENTBUILDER_NOT_TRANSLATED_IN') . ' -', - 'none' => JText::_('COM_COMPONENTBUILDER_ANY_LANGUAGE') + '' => '- ' . Text::_('COM_COMPONENTBUILDER_NOT_TRANSLATED_IN') . ' -', + 'none' => Text::_('COM_COMPONENTBUILDER_ANY_LANGUAGE') ); $options = array_merge($options, $languages); } - $form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter'); + $form->setField(JCBFormHelper::xml($attributes, $options),'filter'); $form->setValue( 'not_translated', 'filter', @@ -138,7 +149,7 @@ public function getFilterForm($data = array(), $loadData = true) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -181,7 +192,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -196,12 +207,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -216,12 +227,12 @@ public function getItems() // escape all strings if not being exported if (!isset($_export)) { - $item->source = ComponentbuilderHelper::htmlEscape($item->source, 'UTF-8', true, 150); + $item->source = StringHelper::html($item->source, 'UTF-8', true, 150); } } } // prep the lang strings for export - if (isset($_export) && $_export && ComponentbuilderHelper::checkArray($items)) + if (isset($_export) && $_export && UtilitiesArrayHelper::check($items)) { // insure we have the same order in the languages $languages = ComponentbuilderHelper::getVars('language', 1, 'published', 'langtag'); @@ -249,15 +260,15 @@ public function getItems() $item->{$lanTag} = ''; } // now adapt the source - if (isset($item->translation) && ComponentbuilderHelper::checkJson($item->translation)) + if (isset($item->translation) && JsonHelper::check($item->translation)) { $translations = json_decode($item->translation, true); - if (ComponentbuilderHelper::checkArray($translations)) + if (UtilitiesArrayHelper::check($translations)) { foreach ($translations as $language) { - if (isset($language['translation']) && ComponentbuilderHelper::checkString($language['translation']) - && isset($language['language']) && ComponentbuilderHelper::checkString($language['language'])) + if (isset($language['translation']) && StringHelper::check($language['translation']) + && isset($language['language']) && StringHelper::check($language['language'])) { $item->{$language['language']} = $language['translation']; } @@ -269,22 +280,22 @@ public function getItems() unset($item->translation); } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -300,7 +311,7 @@ protected function getListQuery() $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 +326,7 @@ protected function getListQuery() $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 +343,7 @@ protected function getListQuery() { // 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) . ')'); } @@ -364,7 +375,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -394,10 +405,12 @@ protected function getListQuery() // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -415,17 +428,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -459,7 +472,7 @@ public function getExportData($pks, $user = null) $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 +487,7 @@ public function getExportData($pks, $user = null) $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 +504,7 @@ public function getExportData($pks, $user = null) { // 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) . ')'); } @@ -520,7 +533,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -535,7 +548,7 @@ public function getExportData($pks, $user = null) // escape all strings if not being exported if (!isset($_export)) { - $item->source = ComponentbuilderHelper::htmlEscape($item->source, 'UTF-8', true, 150); + $item->source = StringHelper::html($item->source, 'UTF-8', true, 150); } // unset the values we don't want exported. unset($item->asset_id); @@ -545,13 +558,13 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } // prep the lang strings for export - if (isset($_export) && $_export && ComponentbuilderHelper::checkArray($items)) + if (isset($_export) && $_export && UtilitiesArrayHelper::check($items)) { // insure we have the same order in the languages $languages = ComponentbuilderHelper::getVars('language', 1, 'published', 'langtag'); @@ -579,15 +592,15 @@ public function getExportData($pks, $user = null) $item->{$lanTag} = ''; } // now adapt the source - if (isset($item->translation) && ComponentbuilderHelper::checkJson($item->translation)) + if (isset($item->translation) && JsonHelper::check($item->translation)) { $translations = json_decode($item->translation, true); - if (ComponentbuilderHelper::checkArray($translations)) + if (UtilitiesArrayHelper::check($translations)) { foreach ($translations as $language) { - if (isset($language['translation']) && ComponentbuilderHelper::checkString($language['translation']) - && isset($language['language']) && ComponentbuilderHelper::checkString($language['language'])) + if (isset($language['translation']) && StringHelper::check($language['translation']) + && isset($language['language']) && StringHelper::check($language['language'])) { $item->{$language['language']} = $language['translation']; } @@ -614,11 +627,11 @@ public function getExImPortHeaders() { $languages = ComponentbuilderHelper::getVars('language', 1, 'published', 'langtag'); // start setup of headers - $headers = new stdClass(); + $headers = new \stdClass(); $headers->id = 'id'; $headers->Source = 'Source'; // add the languages - if (ComponentbuilderHelper::checkArray($languages)) + if (UtilitiesArrayHelper::check($languages)) { foreach ($languages as $language) { @@ -627,7 +640,7 @@ public function getExImPortHeaders() } return $headers; } - + /** * Method to get a store id based on model configuration state. * @@ -642,13 +655,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -663,19 +676,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -687,7 +699,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -708,7 +720,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/languages.php b/admin/models/languages.php index 27091efff..d08275885 100644 --- a/admin/models/languages.php +++ b/admin/models/languages.php @@ -12,18 +12,27 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Languages List Model */ class ComponentbuilderModelLanguages extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -51,7 +60,7 @@ public function buildLanguages() if ($languages = $this->getLanguages()) { // make sure we have an array - if (ComponentbuilderHelper::checkArray($languages)) + if (UtilitiesArrayHelper::check($languages)) { // get the model $model = ComponentbuilderHelper::getModel('language'); @@ -66,7 +75,7 @@ public function buildLanguages() $tmp['name'] = (string) $language->name; $tmp['langtag'] = (string) str_replace('pkg_', '', $language->element); // check if already set - if ($id = ComponentbuilderHelper::getVar('language', $tmp['langtag'], 'langtag', 'id')) + if ($id = GetHelper::var('language', $tmp['langtag'], 'langtag', 'id')) { $tmp['id'] = (int) $id; } @@ -105,7 +114,7 @@ protected function getLanguages() if ($response === null || $response->code !== 200) { - JFactory::getApplication()->enqueueMessage(JText::_('COM_COMPONENTBUILDER_NO_LANGUAGES_UPDATE_SERVER_FOUND'), 'warning'); + Factory::getApplication()->enqueueMessage(Text::_('COM_COMPONENTBUILDER_NO_LANGUAGES_UPDATE_SERVER_FOUND'), 'warning'); return; } @@ -115,7 +124,7 @@ protected function getLanguages() foreach ($updateSiteXML->extension as $extension) { - $language = new stdClass; + $language = new \stdClass; foreach ($extension->attributes() as $key => $value) { @@ -126,7 +135,7 @@ protected function getLanguages() } // we must add the British language en-GB (since Joomla Ships with it) - $language = new stdClass; + $language = new \stdClass; $language->name = 'English GB'; $language->element = 'pkg_en-GB'; $language->type = 'package'; @@ -175,7 +184,7 @@ private function getUpdateSite() */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -225,7 +234,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -240,12 +249,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -259,22 +268,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -303,7 +312,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -333,10 +342,12 @@ protected function getListQuery() // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -354,17 +365,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -408,7 +419,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -428,7 +439,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -446,16 +457,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_language"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -464,7 +475,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -479,13 +490,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -501,19 +512,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -525,7 +535,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -546,7 +556,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/layout.php b/admin/models/layout.php index ce6b1cc96..d4f5b2ae9 100644 --- a/admin/models/layout.php +++ b/admin/models/layout.php @@ -12,10 +12,22 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Layout Admin Model @@ -82,16 +94,16 @@ class ComponentbuilderModelLayout extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'layout', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'layout', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -123,17 +135,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'layout__'.$id); ComponentbuilderHelper::set('layout__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -142,7 +153,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -209,17 +220,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'layout__'.$id); ComponentbuilderHelper::set('layout__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -240,7 +250,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -267,7 +277,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -280,7 +290,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -337,11 +347,11 @@ public function getForm($data = array(), $loadData = true, $options = array('con } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -358,13 +368,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/layout.js'; } - + /** * Method to test whether a record can be deleted. * @@ -383,7 +393,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('core.delete', 'com_componentbuilder.layout.' . (int) $record->id); } @@ -401,8 +411,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -413,31 +423,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return parent::canEditState($record); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('core.edit', 'com_componentbuilder.layout.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('core.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -445,19 +455,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -469,7 +479,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_layout')); @@ -484,7 +494,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -499,10 +509,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.layout.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.layout.data', []); if (empty($data)) { @@ -525,7 +535,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -541,7 +551,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -561,10 +571,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -590,30 +600,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('layout'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('layout'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -650,8 +660,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -677,13 +686,13 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('layout'); } - if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + if (!$this->canDo->get('core.create') && !$this->canDo->get('layout.batch')) { return false; } @@ -703,7 +712,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -716,7 +725,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('core.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -732,14 +741,14 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -751,7 +760,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -815,15 +824,15 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('layout'); } - if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + if (!$this->canDo->get('core.edit') && !$this->canDo->get('layout.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -840,7 +849,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('core.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -856,13 +865,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -906,7 +915,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -918,15 +927,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -937,7 +946,7 @@ public function save($data) // Set the libraries items to data. if (isset($data['libraries']) && is_array($data['libraries'])) { - $libraries = new JRegistry; + $libraries = new Registry; $libraries->loadArray($data['libraries']); $data['libraries'] = (string) $libraries; } @@ -958,11 +967,11 @@ public function save($data) { $data['layout'] = base64_encode($data['layout']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -995,27 +1004,27 @@ public function save($data) { if ($data['alias'] == null || empty($data['alias'])) { - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + $data['alias'] = OutputFilter::stringURLUnicodeSlug($data['name']); } else { - $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + $data['alias'] = OutputFilter::stringURLSafe($data['name']); } - $table = JTable::getInstance('layout', 'componentbuilderTable'); + $table = clone $this->getTable(); if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) { - $msg = JText::_('COM_COMPONENTBUILDER_LAYOUT_SAVE_WARNING'); + $msg = Text::_('COM_COMPONENTBUILDER_LAYOUT_SAVE_WARNING'); } $data['alias'] = $this->_generateNewTitle($data['alias']); if (isset($msg)) { - JFactory::getApplication()->enqueueMessage($msg, 'warning'); + Factory::getApplication()->enqueueMessage($msg, 'warning'); } } } @@ -1025,7 +1034,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1033,14 +1042,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1053,7 +1062,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1080,10 +1088,10 @@ protected function _generateNewTitle($alias, $title = null) // Alter the title/s & alias $table = $this->getTable(); - while ($table->load(array('alias' => $alias))) + while ($table->load(['alias' => $alias])) { // Check if this is an array of titles - if (ComponentbuilderHelper::checkArray($title)) + if (UtilitiesArrayHelper::check($title)) { foreach($title as $nr => &$_title) { @@ -1098,7 +1106,7 @@ protected function _generateNewTitle($alias, $title = null) $alias = StringHelper::increment($alias, 'dash'); } // Check if this is an array of titles - if (ComponentbuilderHelper::checkArray($title)) + if (UtilitiesArrayHelper::check($title)) { $title[] = $alias; return $title; diff --git a/admin/models/layouts.php b/admin/models/layouts.php index 4d9b7235f..0fa9addfe 100644 --- a/admin/models/layouts.php +++ b/admin/models/layouts.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Layouts List Model */ class ComponentbuilderModelLayouts extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -54,7 +62,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -118,7 +126,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -133,12 +141,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -154,7 +162,7 @@ public function getItems() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -163,7 +171,7 @@ public function getItems() } } - + // return items return $items; } @@ -171,7 +179,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -183,25 +191,25 @@ public function selectionTranslation($value,$name) 0 => 'COM_COMPONENTBUILDER_LAYOUT_NO' ); // Now check if value is found in this array - if (isset($add_php_viewArray[$value]) && ComponentbuilderHelper::checkString($add_php_viewArray[$value])) + if (isset($add_php_viewArray[$value]) && StringHelper::check($add_php_viewArray[$value])) { return $add_php_viewArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -234,7 +242,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -275,7 +283,7 @@ protected function getListQuery() $query->where('a.dynamic_get = ' . (int) $_dynamic_get); } } - elseif (ComponentbuilderHelper::checkString($_dynamic_get)) + elseif (StringHelper::check($_dynamic_get)) { $query->where('a.dynamic_get = ' . $db->quote($db->escape($_dynamic_get))); } @@ -292,16 +300,18 @@ protected function getListQuery() $query->where('a.add_php_view = ' . (int) $_add_php_view); } } - elseif (ComponentbuilderHelper::checkString($_add_php_view)) + elseif (StringHelper::check($_add_php_view)) { $query->where('a.add_php_view = ' . $db->quote($db->escape($_add_php_view))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -319,17 +329,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -373,7 +383,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -397,7 +407,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -415,16 +425,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_layout"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -433,7 +443,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -448,13 +458,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -472,19 +482,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -496,7 +505,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -517,7 +526,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/libraries.php b/admin/models/libraries.php index 4ea77e13c..eff215d17 100644 --- a/admin/models/libraries.php +++ b/admin/models/libraries.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Libraries List Model */ class ComponentbuilderModelLibraries extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -55,7 +63,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -126,7 +134,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -141,12 +149,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -166,7 +174,7 @@ public function getItems() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -177,7 +185,7 @@ public function getItems() } } - + // return items return $items; } @@ -185,7 +193,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -197,7 +205,7 @@ public function selectionTranslation($value,$name) 2 => 'COM_COMPONENTBUILDER_LIBRARY_LIBRARIES' ); // Now check if value is found in this array - if (isset($targetArray[$value]) && ComponentbuilderHelper::checkString($targetArray[$value])) + if (isset($targetArray[$value]) && StringHelper::check($targetArray[$value])) { return $targetArray[$value]; } @@ -210,7 +218,7 @@ public function selectionTranslation($value,$name) 2 => 'COM_COMPONENTBUILDER_LIBRARY_BUNDLE' ); // Now check if value is found in this array - if (isset($typeArray[$value]) && ComponentbuilderHelper::checkString($typeArray[$value])) + if (isset($typeArray[$value]) && StringHelper::check($typeArray[$value])) { return $typeArray[$value]; } @@ -227,26 +235,26 @@ public function selectionTranslation($value,$name) 0 => 'COM_COMPONENTBUILDER_DO_NOT_ADD' ); // Now check if value is found in this array - if (isset($howArray[$value]) && ComponentbuilderHelper::checkString($howArray[$value])) + if (isset($howArray[$value]) && StringHelper::check($howArray[$value])) { - return JText::_($howArray[$value]); + return Text::_($howArray[$value]); } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -275,7 +283,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -316,7 +324,7 @@ protected function getListQuery() $query->where('a.target = ' . (int) $_target); } } - elseif (ComponentbuilderHelper::checkString($_target)) + elseif (StringHelper::check($_target)) { $query->where('a.target = ' . $db->quote($db->escape($_target))); } @@ -333,7 +341,7 @@ protected function getListQuery() $query->where('a.how = ' . (int) $_how); } } - elseif (ComponentbuilderHelper::checkString($_how)) + elseif (StringHelper::check($_how)) { $query->where('a.how = ' . $db->quote($db->escape($_how))); } @@ -350,22 +358,24 @@ protected function getListQuery() $query->where('a.type = ' . (int) $_type); } } - elseif (ComponentbuilderHelper::checkString($_type)) + elseif (StringHelper::check($_type)) { $query->where('a.type = ' . $db->quote($db->escape($_type))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -380,13 +390,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -405,19 +415,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -429,7 +438,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -450,7 +459,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/libraries_config.php b/admin/models/libraries_config.php index f27a7f79b..70edb476c 100644 --- a/admin/models/libraries_config.php +++ b/admin/models/libraries_config.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Libraries_config List Model */ class ComponentbuilderModelLibraries_config extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/libraries_files_folders_urls.php b/admin/models/libraries_files_folders_urls.php index e1f4000d1..ce96ea4e3 100644 --- a/admin/models/libraries_files_folders_urls.php +++ b/admin/models/libraries_files_folders_urls.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Libraries_files_folders_urls List Model */ class ComponentbuilderModelLibraries_files_folders_urls extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -50,7 +58,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -86,7 +94,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -101,12 +109,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -120,22 +128,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -168,7 +176,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -183,16 +191,18 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -207,13 +217,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -227,19 +237,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -251,7 +260,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -272,7 +281,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/library.php b/admin/models/library.php index 2a35c2fd8..f9df3454b 100644 --- a/admin/models/library.php +++ b/admin/models/library.php @@ -12,10 +12,23 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Library Admin Model @@ -97,16 +110,16 @@ class ComponentbuilderModelLibrary extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'library', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'library', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -138,17 +151,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'library__'.$id); ComponentbuilderHelper::set('library__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -157,7 +169,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -226,17 +238,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'library__'.$id); ComponentbuilderHelper::set('library__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -257,7 +268,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -284,7 +295,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -297,7 +308,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -356,22 +367,22 @@ public function getForm($data = array(), $loadData = true, $options = array('con // Only load the GUID if new item (or empty) if (0 == $id || !($val = $form->getValue('guid'))) { - $form->setValue('guid', null, ComponentbuilderHelper::GUID()); + $form->setValue('guid', null, GuidHelper::get()); } - + return $form; } /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/library.js'; } - + /** * Method to test whether a record can be deleted. * @@ -390,7 +401,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('library.delete', 'com_componentbuilder.library.' . (int) $record->id); } @@ -408,8 +419,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -420,31 +431,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('library.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('library.edit', 'com_componentbuilder.library.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('library.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -452,19 +463,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -476,7 +487,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_library')); @@ -491,7 +502,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -506,10 +517,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.library.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.library.data', []); if (empty($data)) { @@ -537,7 +548,7 @@ protected function loadFormData() public function validate($form, $data, $group = null) { // check if the not_required field is set - if (isset($data['not_required']) && ComponentbuilderHelper::checkString($data['not_required'])) + if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required'])) { $requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = array_unique($requiredFields); @@ -545,7 +556,7 @@ public function validate($form, $data, $group = null) foreach ($requiredFields as $requiredField) { // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) + if (UtilitiesStringHelper::check($requiredField)) { // change to false $form->setFieldAttribute($requiredField, 'required', 'false'); @@ -570,7 +581,7 @@ protected function getUniqueFields() return array('name', 'guid'); } - + /** * Method to delete one or more records. * @@ -583,7 +594,7 @@ protected function getUniqueFields() public function delete(&$pks) { // insure the locked library are not deleted - $app = JFactory::getApplication(); + $app = Factory::getApplication(); foreach ($pks as $nr => $pk) { // remove if it is a locked library @@ -592,11 +603,11 @@ public function delete(&$pks) // do not allow delete unset($pks[$nr]); // set a message to remind them not to delete these libraries (since they are locked) - $app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_BSB_LIBRARY_CAN_NOT_BE_DELETED_OR_THINGS_WILL_BREAK', ComponentbuilderHelper::$libraryNames[$pk]), 'warning'); + $app->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_BSB_LIBRARY_CAN_NOT_BE_DELETED_OR_THINGS_WILL_BREAK', ComponentbuilderHelper::$libraryNames[$pk]), 'warning'); } } // check if we can still continue - if (!ComponentbuilderHelper::checkArray($pks)) + if (!UtilitiesArrayHelper::check($pks)) { return false; } @@ -606,7 +617,7 @@ public function delete(&$pks) } // we must also delete the linked tables found - if (ComponentbuilderHelper::checkArray($pks)) + if (UtilitiesArrayHelper::check($pks)) { $_tablesArray = array( 'snippet', @@ -625,7 +636,7 @@ public function delete(&$pks) } } } - + return true; } @@ -647,7 +658,7 @@ public function publish(&$pks, $value = 1) } // we must also update all linked tables - if (ComponentbuilderHelper::checkArray($pks)) + if (UtilitiesArrayHelper::check($pks)) { $_tablesArray = array( 'snippet', @@ -666,10 +677,10 @@ public function publish(&$pks, $value = 1) } } } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -695,30 +706,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('library'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('library'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -755,8 +766,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -782,7 +792,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('library'); @@ -808,7 +818,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -821,7 +831,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('library.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -837,19 +847,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -861,7 +871,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -925,7 +935,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('library'); @@ -933,7 +943,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('library.edit') && !$this->canDo->get('library.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -950,7 +960,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('library.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -966,13 +976,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -1016,7 +1026,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -1028,15 +1038,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -1046,20 +1056,20 @@ public function save($data) if (empty($data['guid']) && $data['id'] > 0) { // get the existing one - $data['guid'] = (string) ComponentbuilderHelper::getVar('library', $data['id'], 'id', 'guid'); + $data['guid'] = (string) GetHelper::var('library', $data['id'], 'id', 'guid'); } + // Set the GUID if empty or not valid - while (!ComponentbuilderHelper::validGUID($data['guid'], "library", $data['id'])) + while (!GuidHelper::valid($data['guid'], "library", $data['id'])) { // must always be set - $data['guid'] = (string) ComponentbuilderHelper::GUID(); - } - + $data['guid'] = (string) GuidHelper::get(); + } // Set the libraries items to data. if (isset($data['libraries']) && is_array($data['libraries'])) { - $libraries = new JRegistry; + $libraries = new Registry; $libraries->loadArray($data['libraries']); $data['libraries'] = (string) $libraries; } @@ -1072,7 +1082,7 @@ public function save($data) // Set the addconditions items to data. if (isset($data['addconditions']) && is_array($data['addconditions'])) { - $addconditions = new JRegistry; + $addconditions = new Registry; $addconditions->loadArray($data['addconditions']); $data['addconditions'] = (string) $addconditions; } @@ -1099,7 +1109,7 @@ public function save($data) // change it back $data['name'] = ComponentbuilderHelper::$libraryNames[$data['id']]; // give a notice that the name can not be changed - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_NAME_OF_THIS_LIBRARY_BSB_CAN_NOT_BE_CHANGED_TO_BSB_OR_THINGS_WILL_BREAK', $data['name'], $name_), 'warning'); + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_THE_NAME_OF_THIS_LIBRARY_BSB_CAN_NOT_BE_CHANGED_TO_BSB_OR_THINGS_WILL_BREAK', $data['name'], $name_), 'warning'); } // always insure they remain set a main libraries $data['type'] = 1; @@ -1109,11 +1119,11 @@ public function save($data) { $data['name'] = $this->generateUniqe('name', $data['name']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1123,7 +1133,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1131,14 +1141,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1151,7 +1161,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1177,7 +1186,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/library_config.php b/admin/models/library_config.php index a7abd5e3c..1f089ddf2 100644 --- a/admin/models/library_config.php +++ b/admin/models/library_config.php @@ -12,10 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Library_config Admin Model @@ -59,18 +69,18 @@ class ComponentbuilderModelLibrary_config extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'library_config', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'library_config', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -123,7 +133,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -150,7 +160,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -163,7 +173,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -226,13 +236,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/library_config.js'; } - + /** * Method to test whether a record can be deleted. * @@ -251,7 +261,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('library_config.delete', 'com_componentbuilder.library_config.' . (int) $record->id); } @@ -269,8 +279,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -281,31 +291,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('library_config.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('library_config.edit', 'com_componentbuilder.library_config.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('library_config.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -313,19 +323,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -337,7 +347,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_library_config')); @@ -352,7 +362,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -367,10 +377,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.library_config.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.library_config.data', []); if (empty($data)) { @@ -393,7 +403,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -409,7 +419,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -429,10 +439,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -458,30 +468,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('library_config'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('library_config'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -518,8 +528,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -545,7 +554,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('library_config'); @@ -571,7 +580,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -584,7 +593,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('library_config.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -600,19 +609,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->library) && !is_numeric($this->table->library)) + if (UtilitiesStringHelper::check($this->table->library) && !is_numeric($this->table->library)) { $this->table->library = $this->generateUnique('library',$this->table->library); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -624,7 +633,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -688,7 +697,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('library_config'); @@ -696,7 +705,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('library_config.edit') && !$this->canDo->get('library_config.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -713,7 +722,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('library_config.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -729,13 +738,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -779,7 +788,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -791,15 +800,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -807,7 +816,7 @@ public function save($data) // Set the addconfig items to data. if (isset($data['addconfig']) && is_array($data['addconfig'])) { - $addconfig = new JRegistry; + $addconfig = new Registry; $addconfig->loadArray($data['addconfig']); $data['addconfig'] = (string) $addconfig; } @@ -816,11 +825,11 @@ public function save($data) // Set the empty addconfig to data $data['addconfig'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -830,7 +839,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -838,14 +847,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -858,7 +867,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -884,7 +892,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/library_files_folders_urls.php b/admin/models/library_files_folders_urls.php index 38780de8e..92ef54922 100644 --- a/admin/models/library_files_folders_urls.php +++ b/admin/models/library_files_folders_urls.php @@ -12,10 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Library_files_folders_urls Admin Model @@ -73,18 +83,18 @@ class ComponentbuilderModelLibrary_files_folders_urls extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'library_files_folders_urls', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'library_files_folders_urls', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -169,7 +179,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -196,7 +206,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -209,7 +219,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -272,13 +282,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/library_files_folders_urls.js'; } - + /** * Method to test whether a record can be deleted. * @@ -297,7 +307,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('library_files_folders_urls.delete', 'com_componentbuilder.library_files_folders_urls.' . (int) $record->id); } @@ -315,8 +325,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -327,31 +337,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('library_files_folders_urls.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('library_files_folders_urls.edit', 'com_componentbuilder.library_files_folders_urls.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('library_files_folders_urls.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -359,19 +369,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -383,7 +393,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_library_files_folders_urls')); @@ -398,7 +408,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -413,10 +423,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.library_files_folders_urls.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.library_files_folders_urls.data', []); if (empty($data)) { @@ -439,7 +449,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -455,7 +465,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -475,10 +485,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -504,30 +514,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('library_files_folders_urls'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('library_files_folders_urls'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -564,8 +574,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -591,7 +600,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('library_files_folders_urls'); @@ -617,7 +626,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -630,7 +639,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('library_files_folders_urls.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -646,19 +655,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->library) && !is_numeric($this->table->library)) + if (UtilitiesStringHelper::check($this->table->library) && !is_numeric($this->table->library)) { $this->table->library = $this->generateUnique('library',$this->table->library); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -670,7 +679,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -734,7 +743,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('library_files_folders_urls'); @@ -742,7 +751,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('library_files_folders_urls.edit') && !$this->canDo->get('library_files_folders_urls.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -759,7 +768,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('library_files_folders_urls.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -775,13 +784,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -825,7 +834,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -837,15 +846,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -853,7 +862,7 @@ public function save($data) // Set the addfoldersfullpath items to data. if (isset($data['addfoldersfullpath']) && is_array($data['addfoldersfullpath'])) { - $addfoldersfullpath = new JRegistry; + $addfoldersfullpath = new Registry; $addfoldersfullpath->loadArray($data['addfoldersfullpath']); $data['addfoldersfullpath'] = (string) $addfoldersfullpath; } @@ -866,7 +875,7 @@ public function save($data) // Set the addfilesfullpath items to data. if (isset($data['addfilesfullpath']) && is_array($data['addfilesfullpath'])) { - $addfilesfullpath = new JRegistry; + $addfilesfullpath = new Registry; $addfilesfullpath->loadArray($data['addfilesfullpath']); $data['addfilesfullpath'] = (string) $addfilesfullpath; } @@ -879,7 +888,7 @@ public function save($data) // Set the addfolders items to data. if (isset($data['addfolders']) && is_array($data['addfolders'])) { - $addfolders = new JRegistry; + $addfolders = new Registry; $addfolders->loadArray($data['addfolders']); $data['addfolders'] = (string) $addfolders; } @@ -892,7 +901,7 @@ public function save($data) // Set the addfiles items to data. if (isset($data['addfiles']) && is_array($data['addfiles'])) { - $addfiles = new JRegistry; + $addfiles = new Registry; $addfiles->loadArray($data['addfiles']); $data['addfiles'] = (string) $addfiles; } @@ -905,7 +914,7 @@ public function save($data) // Set the addurls items to data. if (isset($data['addurls']) && is_array($data['addurls'])) { - $addurls = new JRegistry; + $addurls = new Registry; $addurls->loadArray($data['addurls']); $data['addurls'] = (string) $addurls; } @@ -914,11 +923,11 @@ public function save($data) // Set the empty addurls to data $data['addurls'] = ''; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -928,7 +937,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -936,14 +945,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -956,7 +965,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -982,7 +990,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/placeholder.php b/admin/models/placeholder.php index 404d097f4..936c497ba 100644 --- a/admin/models/placeholder.php +++ b/admin/models/placeholder.php @@ -12,10 +12,22 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Placeholder Admin Model @@ -62,16 +74,16 @@ class ComponentbuilderModelPlaceholder extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'placeholder', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'placeholder', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -103,17 +115,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'placeholder__'.$id); ComponentbuilderHelper::set('placeholder__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -122,7 +133,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -175,17 +186,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'placeholder__'.$id); ComponentbuilderHelper::set('placeholder__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -206,7 +216,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -233,7 +243,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -246,7 +256,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -307,13 +317,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/placeholder.js'; } - + /** * Method to test whether a record can be deleted. * @@ -332,7 +342,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('placeholder.delete', 'com_componentbuilder.placeholder.' . (int) $record->id); } @@ -350,8 +360,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -362,31 +372,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('placeholder.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('placeholder.edit', 'com_componentbuilder.placeholder.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('placeholder.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -394,19 +404,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -418,7 +428,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_placeholder')); @@ -433,7 +443,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -448,10 +458,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.placeholder.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.placeholder.data', []); if (empty($data)) { @@ -474,7 +484,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -490,7 +500,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -510,10 +520,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -539,30 +549,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('placeholder'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('placeholder'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -599,8 +609,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -626,7 +635,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('placeholder'); @@ -652,7 +661,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -665,7 +674,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('placeholder.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -681,19 +690,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->target) && !is_numeric($this->table->target)) + if (UtilitiesStringHelper::check($this->table->target) && !is_numeric($this->table->target)) { $this->table->target = $this->generateUnique('target',$this->table->target); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -705,7 +714,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -769,7 +778,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('placeholder'); @@ -777,7 +786,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('placeholder.edit') && !$this->canDo->get('placeholder.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -794,7 +803,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('placeholder.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -810,13 +819,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -860,7 +869,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -872,15 +881,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -895,11 +904,11 @@ public function save($data) { $data['value'] = base64_encode($data['value']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -909,7 +918,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -917,14 +926,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -937,7 +946,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -963,7 +971,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/placeholders.php b/admin/models/placeholders.php index 27c215cea..c3b7e8931 100644 --- a/admin/models/placeholders.php +++ b/admin/models/placeholders.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Placeholders List Model */ class ComponentbuilderModelPlaceholders extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -52,7 +60,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -102,7 +110,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -117,12 +125,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -138,22 +146,22 @@ public function getItems() $item->value = base64_decode($item->value); } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -182,7 +190,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -212,10 +220,12 @@ protected function getListQuery() // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -233,17 +243,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -287,7 +297,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -309,7 +319,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -327,16 +337,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_placeholder"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -345,7 +355,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -360,13 +370,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -382,19 +392,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -406,7 +415,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -427,7 +436,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/power.php b/admin/models/power.php index 6c2f82742..052046f28 100644 --- a/admin/models/power.php +++ b/admin/models/power.php @@ -12,10 +12,25 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Componentbuilder\Power\Factory as PowerFactory; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\String\ClassfunctionHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Power Admin Model @@ -33,10 +48,10 @@ class ComponentbuilderModelPower extends AdminModel 'name', 'description', 'extends', - 'implements_custom', + 'extends_custom', 'implements', + 'implements_custom', 'namespace', - 'extends_custom', 'add_head' ), 'right' => array( @@ -58,6 +73,27 @@ class ComponentbuilderModelPower extends AdminModel 'type', 'power_version' ) + ), + 'licensing' => array( + 'fullwidth' => array( + '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' + ) ) ); @@ -82,16 +118,16 @@ class ComponentbuilderModelPower extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'power', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'power', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -123,17 +159,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'power__'.$id); ComponentbuilderHelper::set('power__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -142,7 +177,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -172,10 +207,10 @@ public function getItem($pk = null) $item->metadata = $registry->toArray(); } - if (!empty($item->main_class_code)) + if (!empty($item->licensing_template)) { - // base64 Decode main_class_code. - $item->main_class_code = base64_decode($item->main_class_code); + // base64 Decode licensing_template. + $item->licensing_template = base64_decode($item->licensing_template); } if (!empty($item->head)) @@ -184,6 +219,20 @@ public function getItem($pk = null) $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. @@ -192,12 +241,12 @@ public function getItem($pk = null) $item->load_selection = $load_selection->toArray(); } - if (!empty($item->use_selection)) + if (!empty($item->composer)) { - // Convert the use_selection field to an array. - $use_selection = new Registry; - $use_selection->loadString($item->use_selection); - $item->use_selection = $use_selection->toArray(); + // Convert the composer field to an array. + $composer = new Registry; + $composer->loadString($item->composer); + $item->composer = $composer->toArray(); } if (!empty($item->property_selection)) @@ -216,12 +265,18 @@ public function getItem($pk = null) $item->implements = $implements->toArray(); } - if (!empty($item->method_selection)) + if (!empty($item->use_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(); + // Convert the use_selection field to an array. + $use_selection = new Registry; + $use_selection->loadString($item->use_selection); + $item->use_selection = $use_selection->toArray(); + } + + if (!empty($item->approved_paths)) + { + // JSON Decode approved_paths. + $item->approved_paths = json_decode($item->approved_paths); } @@ -241,17 +296,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'power__'.$id); ComponentbuilderHelper::set('power__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -272,7 +326,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -299,7 +353,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -312,7 +366,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -371,11 +425,11 @@ public function getForm($data = array(), $loadData = true, $options = array('con } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -390,7 +444,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con // Only load the GUID if new item (or empty) if (0 == $id || !($val = $form->getValue('guid'))) { - $form->setValue('guid', null, ComponentbuilderHelper::GUID()); + $form->setValue('guid', null, GuidHelper::get()); } return $form; @@ -399,13 +453,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/power.js'; } - + /** * Method to test whether a record can be deleted. * @@ -424,7 +478,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('power.delete', 'com_componentbuilder.power.' . (int) $record->id); } @@ -442,8 +496,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -454,31 +508,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('power.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('power.edit', 'com_componentbuilder.power.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('power.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -486,19 +540,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -510,7 +564,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_power')); @@ -525,7 +579,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -540,10 +594,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.power.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.power.data', []); if (empty($data)) { @@ -566,7 +620,7 @@ protected function getUniqueFields() { return array('guid'); } - + /** * Method to delete one or more records. * @@ -582,7 +636,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -602,10 +656,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -631,30 +685,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('power'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('power'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -691,8 +745,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -718,7 +771,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('power'); @@ -744,7 +797,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -757,7 +810,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('power.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -773,19 +826,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->system_name) && !is_numeric($this->table->system_name)) + if (UtilitiesStringHelper::check($this->table->system_name) && !is_numeric($this->table->system_name)) { $this->table->system_name = $this->generateUnique('system_name',$this->table->system_name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -797,7 +850,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -861,7 +914,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('power'); @@ -869,7 +922,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('power.edit') && !$this->canDo->get('power.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -886,7 +939,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('power.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -902,13 +955,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -952,7 +1005,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -964,71 +1017,98 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $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) { // class of that version already exist so we reset the version - \JFactory::getApplication()->enqueueMessage(JText::sprintf("COM_COMPONENTBUILDER_POWERS_A_HREFS_TARGET_BLANK_TITLEOPEN_POWERSA_WITH_VERSION_S_ALREADY_EXIST", $existing_id, 'index.php?option=com_componentbuilder&view=powers&task=power.edit&id=' . $existing_id, $data['namespace'] . '\\' . $data['name'], $data['power_version']), 'error'); + \Factory::getApplication()->enqueueMessage(Text::sprintf("COM_COMPONENTBUILDER_POWERS_A_HREFS_TARGET_BLANK_TITLEOPEN_POWERSA_WITH_VERSION_S_ALREADY_EXIST", $existing_id, 'index.php?option=com_componentbuilder&view=powers&task=power.edit&id=' . $existing_id, $data['namespace'] . '\\' . $data['name'], $data['power_version']), 'error'); $data['power_version'] = $old_version; } else { // does not exist so we allow save2copy $data['id'] = 0; - JFactory::getApplication()->input->set('task', 'save2copy'); + Factory::getApplication()->input->set('task', 'save2copy'); } } + + // load dynamic code if relevant + if (($main_class_code = PowerFactory::_('Power.Generator')->get($data)) !== null) + { + $data['main_class_code'] = $main_class_code; + } // Set the GUID if empty or not valid if (empty($data['guid']) && $data['id'] > 0) { // get the existing one - $data['guid'] = (string) ComponentbuilderHelper::getVar('power', $data['id'], 'id', 'guid'); + $data['guid'] = (string) GetHelper::var('power', $data['id'], 'id', 'guid'); } + // Set the GUID if empty or not valid - while (!ComponentbuilderHelper::validGUID($data['guid'], "power", $data['id'])) + while (!GuidHelper::valid($data['guid'], "power", $data['id'])) { // must always be set - $data['guid'] = (string) ComponentbuilderHelper::GUID(); - } + $data['guid'] = (string) GuidHelper::get(); + } + // Set the method_selection items to data. + if (isset($data['method_selection']) && is_array($data['method_selection'])) + { + $method_selection = new Registry; + $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'])) { - $load_selection = new JRegistry; + $load_selection = new Registry; $load_selection->loadArray($data['load_selection']); $data['load_selection'] = (string) $load_selection; } @@ -1038,23 +1118,23 @@ public function save($data) $data['load_selection'] = ''; } - // Set the use_selection items to data. - if (isset($data['use_selection']) && is_array($data['use_selection'])) + // Set the composer items to data. + if (isset($data['composer']) && is_array($data['composer'])) { - $use_selection = new JRegistry; - $use_selection->loadArray($data['use_selection']); - $data['use_selection'] = (string) $use_selection; + $composer = new Registry; + $composer->loadArray($data['composer']); + $data['composer'] = (string) $composer; } - elseif (!isset($data['use_selection'])) + elseif (!isset($data['composer'])) { - // Set the empty use_selection to data - $data['use_selection'] = ''; + // 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'])) { - $property_selection = new JRegistry; + $property_selection = new Registry; $property_selection->loadArray($data['property_selection']); $data['property_selection'] = (string) $property_selection; } @@ -1067,7 +1147,7 @@ public function save($data) // Set the implements items to data. if (isset($data['implements']) && is_array($data['implements'])) { - $implements = new JRegistry; + $implements = new Registry; $implements->loadArray($data['implements']); $data['implements'] = (string) $implements; } @@ -1077,23 +1157,29 @@ public function save($data) $data['implements'] = ''; } - // Set the method_selection items to data. - if (isset($data['method_selection']) && is_array($data['method_selection'])) + // Set the use_selection items to data. + if (isset($data['use_selection']) && is_array($data['use_selection'])) { - $method_selection = new JRegistry; - $method_selection->loadArray($data['method_selection']); - $data['method_selection'] = (string) $method_selection; + $use_selection = new Registry; + $use_selection->loadArray($data['use_selection']); + $data['use_selection'] = (string) $use_selection; } - elseif (!isset($data['method_selection'])) + elseif (!isset($data['use_selection'])) { - // Set the empty method_selection to data - $data['method_selection'] = ''; + // Set the empty use_selection to data + $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. + if (isset($data['licensing_template'])) + { + $data['licensing_template'] = base64_encode($data['licensing_template']); } // Set the head string to base64 string. @@ -1101,11 +1187,17 @@ public function save($data) { $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'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1115,7 +1207,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1123,14 +1215,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1143,7 +1235,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1169,7 +1260,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/powers.php b/admin/models/powers.php index 9a3f0a281..bc6c34958 100644 --- a/admin/models/powers.php +++ b/admin/models/powers.php @@ -12,18 +12,29 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\Component\Helper as JCBHelper; +use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper; +use VDM\Joomla\Utilities\FormHelper as JCBFormHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Powers List Model */ class ComponentbuilderModelPowers extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -32,16 +43,123 @@ public function __construct($config = array()) '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( + '' => '- ' . Text::_('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( + '' => '- ' . Text::_('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( + '' => '- ' . Text::_('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( + '' => '- ' . Text::_('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. * @@ -55,7 +173,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -95,18 +213,11 @@ protected function populateState($ordering = null, $direction = null) $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,10 +234,17 @@ protected function populateState($ordering = null, $direction = null) $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); } - + /** * Method to get an array of data items. * @@ -141,12 +259,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -158,22 +276,29 @@ public function getItems() 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); } } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { // convert type $item->type = $this->selectionTranslation($item->type, 'type'); + // convert approved + $item->approved = $this->selectionTranslation($item->approved, 'approved'); } } - + // return items return $items; } @@ -181,7 +306,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -196,25 +321,38 @@ public function selectionTranslation($value,$name) 'trait' => 'COM_COMPONENTBUILDER_POWER_TRAIT' ); // Now check if value is found in this array - if (isset($typeArray[$value]) && ComponentbuilderHelper::checkString($typeArray[$value])) + if (isset($typeArray[$value]) && StringHelper::check($typeArray[$value])) { 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]) && StringHelper::check($approvedArray[$value])) + { + return $approvedArray[$value]; + } + } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -223,9 +361,43 @@ protected function getListQuery() // 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'); @@ -247,7 +419,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -271,7 +443,7 @@ protected function getListQuery() 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.')'); } } @@ -288,11 +460,11 @@ protected function getListQuery() $query->where('a.type = ' . (int) $_type); } } - elseif (ComponentbuilderHelper::checkString($_type)) + elseif (StringHelper::check($_type)) { $query->where('a.type = ' . $db->quote($db->escape($_type))); } - elseif (ComponentbuilderHelper::checkArray($_type)) + elseif (UtilitiesArrayHelper::check($_type)) { // Secure the array for the query $_type = array_map( function ($val) use(&$db) { @@ -307,7 +479,7 @@ protected function getListQuery() return (int) $val; } } - elseif (ComponentbuilderHelper::checkString($val)) + elseif (StringHelper::check($val)) { return $db->quote($db->escape($val)); } @@ -315,52 +487,37 @@ protected function getListQuery() // 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 (StringHelper::check($_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. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -375,13 +532,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -390,20 +547,20 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.modified_by'); // Check if the value is an array $_type = $this->getState('filter.type'); - if (ComponentbuilderHelper::checkArray($_type)) + if (UtilitiesArrayHelper::check($_type)) { $id .= ':' . implode(':', $_type); } // Check if this is only an number or string elseif (is_numeric($_type) - || ComponentbuilderHelper::checkString($_type)) + || StringHelper::check($_type)) { $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); } @@ -411,19 +568,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -435,7 +591,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -456,7 +612,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/rules/code.php b/admin/models/rules/code.php index 192d4dcc6..58a1c59f4 100644 --- a/admin/models/rules/code.php +++ b/admin/models/rules/code.php @@ -12,9 +12,12 @@ // No direct access to this file defined('JPATH_PLATFORM') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Form\Form; use Joomla\CMS\Form\FormRule; use Joomla\Registry\Registry; +use Joomla\CMS\HTML\HTMLHelper as Html; /** * Form Rule (Code) class for the Joomla Platform. diff --git a/admin/models/rules/guid.php b/admin/models/rules/guid.php index de2ad110a..bac6e54c7 100644 --- a/admin/models/rules/guid.php +++ b/admin/models/rules/guid.php @@ -12,9 +12,12 @@ // No direct access to this file defined('JPATH_PLATFORM') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Form\Form; use Joomla\CMS\Form\FormRule; use Joomla\Registry\Registry; +use Joomla\CMS\HTML\HTMLHelper as Html; /** * Form Rule (Guid) class for the Joomla Platform. diff --git a/admin/models/rules/int.php b/admin/models/rules/int.php index 76b603349..b0ee7456f 100644 --- a/admin/models/rules/int.php +++ b/admin/models/rules/int.php @@ -12,9 +12,12 @@ // No direct access to this file defined('JPATH_PLATFORM') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Form\Form; use Joomla\CMS\Form\FormRule; use Joomla\Registry\Registry; +use Joomla\CMS\HTML\HTMLHelper as Html; /** * Form Rule (Int) class for the Joomla Platform. diff --git a/admin/models/rules/sourcemapchecker.php b/admin/models/rules/sourcemapchecker.php new file mode 100644 index 000000000..6fdb532eb --- /dev/null +++ b/admin/models/rules/sourcemapchecker.php @@ -0,0 +1,138 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('JPATH_PLATFORM') or die; + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\Form; +use Joomla\CMS\Form\FormRule; +use Joomla\Registry\Registry; +use Joomla\CMS\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\ArrayHelper; + +/** + * Form Rule (Sourcemapchecker) class for the Joomla Platform. + */ +class JFormRuleSourcemapchecker extends FormRule +{ + /** + * Method to test if the selected source map has all the fields it would need + * + * @param \SimpleXMLElement $element The SimpleXMLElement object representing the `` tag for the form field object. + * @param mixed $value The form field value to validate. + * @param string $group The field name group control value. This acts as an array container for the field. + * For example if the field has name="foo" and the group value is set to "bar" then the + * full field name would end up being "bar[foo]". + * @param Registry $input An optional Registry object with the entire data set to validate against the entire form. + * @param Form $form The form object for which the field is being tested. + * + * @return boolean True if the value is valid, false otherwise. + * + * @since 3.10.12 + */ + public function test(\SimpleXMLElement $element, $value, $group = null, ?Registry $input = null, ?Form $form = null) + { + $fields = $this->getSelectedFields($value); + + $status = true; + + if ($fields === []) + { + // no fields selected (not good) + $missing = Text::_('COM_COMPONENTBUILDER_NO_FIELDS_WHERE_SELECTED'); + $status = false; + } + // we only test if we have a table name + elseif (($table = $input->get('table')) !== null) + { + // the fields to ignore Since 3.2 + $ignore = [ + 'checked_out_time', + 'checked_out', + 'modified', + 'created', + 'modified_by', + 'created_by' + ]; + + // get the database object. + $db = Factory::getDbo(); + + $columnDetails = $db->getTableColumns('#__' . $table, false); + $requiredColumns = []; + + foreach ($columnDetails as $column => $details) + { + if (in_array($column, $ignore)) + { + continue; + } + + if ($details->Null === 'NO' && ($details->Default === null || strtolower($details->Extra) === 'auto_increment')) + { + $requiredColumns[] = $column; + } + } + + $_missing = array_diff($requiredColumns, $fields); + + if (!empty($_missing)) + { + // Format missing fields for better readability + $missing = implode(', ', $_missing); + $status = false; + } + } + + // when we fail + if (!$status) + { + Factory::getApplication()->enqueueMessage(Text::sprintf('COM_COMPONENTBUILDER_REQUIRED_FIELDS_MISSING_IN_THE_BMYSQL_TABLES_SOURCE_MAPB_SELECTIONBR_S', $missing), 'Error'); + } + + return $status; + } + + /** + * Method to get array of fields + * + * @param string|null $value + * + * @return array + * @since 3.2.0 + */ + private function getSelectedFields(?string $value): array + { + // reset array buckets + $fields = []; + // the other tables + if (is_string($value) && strpos((string) $value, PHP_EOL) !== false) + { + $lines = explode(PHP_EOL, (string) $value); + if (ArrayHelper::check($lines)) + { + foreach ($lines as $field) + { + if (strpos($field, "=>") !== false) + { + list($source) = explode( + "=>", $field, 2 + ); + $fields[] = trim($source); + } + } + } + } + return $fields; + } +} diff --git a/admin/models/rules/uniqueplaceholder.php b/admin/models/rules/uniqueplaceholder.php index 890130747..67d46d271 100644 --- a/admin/models/rules/uniqueplaceholder.php +++ b/admin/models/rules/uniqueplaceholder.php @@ -12,9 +12,12 @@ // No direct access to this file defined('JPATH_PLATFORM') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Form\Form; use Joomla\CMS\Form\FormRule; use Joomla\Registry\Registry; +use Joomla\CMS\HTML\HTMLHelper as Html; /** * Form Rule (Uniqueplaceholder) class for the Joomla Platform. diff --git a/admin/models/search.php b/admin/models/search.php new file mode 100644 index 000000000..ca3a7e1b9 --- /dev/null +++ b/admin/models/search.php @@ -0,0 +1,252 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\MVC\Model\ItemModel; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Uri\Uri; +use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; + +/** + * Componentbuilder Search Item Model + */ +class ComponentbuilderModelSearch extends ItemModel +{ + /** + * Model context string. + * + * @var string + */ + protected $_context = 'com_componentbuilder.search'; + + /** + * Model user data. + * + * @var strings + */ + protected $user; + protected $userId; + protected $guest; + protected $groups; + protected $levels; + protected $app; + protected $input; + protected $uikitComp; + + /** + * @var object item + */ + protected $item; + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @since 1.6 + * + * @return void + */ + protected function populateState() + { + $this->app = Factory::getApplication(); + $this->input = $this->app->input; + // Get the item main id + $id = $this->input->getInt('id', null); + $this->setState('search.id', $id); + + // Load the parameters. + parent::populateState(); + } + + /** + * Method to get article data. + * + * @param integer $pk The id of the article. + * + * @return mixed Menu item data object on success, false on failure. + */ + public function getItem($pk = null) + { + $this->user = Factory::getUser(); + // check if this user has permission to access item + if (!$this->user->authorise('search.access', 'com_componentbuilder')) + { + $app = Factory::getApplication(); + $app->enqueueMessage(Text::_('Not authorised!'), 'error'); + // redirect away if not a correct to cPanel/default view + $app->redirect('index.php?option=com_componentbuilder'); + return false; + } + $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; + + $pk = (!empty($pk)) ? $pk : (int) $this->getState('search.id'); + + $pk = $this->userId; + + if ($this->_item === null) + { + $this->_item = []; + } + + if (!isset($this->_item[$pk])) + { + try + { + // Get a db connection. + $db = Factory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Get data + // load the tables and components + $data = ['tables' => SearchFactory::_('Table')->tables(), 'components' => $this->getComponents()]; + + + if (empty($data)) + { + $app = Factory::getApplication(); + // If no data is found redirect to default page and show warning. + $app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_NOT_FOUND_OR_ACCESS_DENIED'), 'warning'); + $app->redirect('index.php?option=com_componentbuilder'); + return false; + } + + // set data object to item. + $this->_item[$pk] = $data; + } + catch (Exception $e) + { + if ($e->getCode() == 404) + { + // Need to go thru the error handler to allow Redirect to work. + JError::raiseError(404, $e->getMessage()); + } + else + { + $this->setError($e); + $this->_item[$pk] = false; + } + } + } + + 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 = Factory::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 = Factory::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 + * + * @return mixed An array of objects on success. + * + */ + public function getUikitComp() + { + if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp)) + { + return $this->uikitComp; + } + 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(); + } + +} diff --git a/admin/models/server.php b/admin/models/server.php index de6948f84..bb324d5eb 100644 --- a/admin/models/server.php +++ b/admin/models/server.php @@ -12,10 +12,22 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\FOF\Encrypt\AES; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; /** * Componentbuilder Server Admin Model @@ -76,18 +88,18 @@ class ComponentbuilderModelServer extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'server', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'server', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -120,7 +132,7 @@ public function getItem($pk = null) // Get the basic encryption. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey); + $basic = new AES($basickey); if (!empty($item->signature) && $basickey && !is_numeric($item->signature) && $item->signature === base64_encode(base64_decode($item->signature, true))) { @@ -186,12 +198,12 @@ public function getItem($pk = null) * * @return mixed An array of data items on success, false on failure. */ - public function getVymlinked_components() + public function getVydlinked_components() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -224,7 +236,7 @@ public function getVymlinked_components() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -250,12 +262,12 @@ public function getVymlinked_components() $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -285,7 +297,7 @@ public function getVymlinked_components() * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -312,7 +324,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -325,7 +337,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -388,13 +400,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/server.js'; } - + /** * Method to test whether a record can be deleted. * @@ -413,7 +425,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('server.delete', 'com_componentbuilder.server.' . (int) $record->id); } @@ -431,8 +443,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -443,31 +455,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('server.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('server.edit', 'com_componentbuilder.server.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('server.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -475,19 +487,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -499,7 +511,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_server')); @@ -514,7 +526,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -529,10 +541,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.server.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.server.data', []); if (empty($data)) { @@ -560,7 +572,7 @@ protected function loadFormData() public function validate($form, $data, $group = null) { // check if the not_required field is set - if (isset($data['not_required']) && ComponentbuilderHelper::checkString($data['not_required'])) + if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required'])) { $requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = array_unique($requiredFields); @@ -568,7 +580,7 @@ public function validate($form, $data, $group = null) foreach ($requiredFields as $requiredField) { // make sure there is a string value - if (ComponentbuilderHelper::checkString($requiredField)) + if (UtilitiesStringHelper::check($requiredField)) { // change to false $form->setFieldAttribute($requiredField, 'required', 'false'); @@ -591,7 +603,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -607,7 +619,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -627,10 +639,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -656,30 +668,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('server'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('server'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -716,8 +728,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -743,7 +754,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('server'); @@ -769,7 +780,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -782,7 +793,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('server.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -798,19 +809,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -822,7 +833,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -886,7 +897,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('server'); @@ -894,7 +905,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('server.edit') && !$this->canDo->get('server.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -911,7 +922,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('server.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -927,13 +938,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -977,7 +988,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -989,15 +1000,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -1005,7 +1016,7 @@ public function save($data) // Get the basic encryption key. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encryption object - $basic = new FOFEncryptAes($basickey); + $basic = new AES($basickey); // Encrypt data signature. if (isset($data['signature']) && $basickey) @@ -1060,11 +1071,11 @@ public function save($data) { $data['username'] = $basic->encryptString($data['username']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1074,7 +1085,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1082,14 +1093,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1102,7 +1113,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1128,7 +1138,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/servers.php b/admin/models/servers.php index f84fd2a09..16ec2e08e 100644 --- a/admin/models/servers.php +++ b/admin/models/servers.php @@ -12,18 +12,27 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\FOF\Encrypt\AES; /** * Servers List Model */ class ComponentbuilderModelServers extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -52,7 +61,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -102,7 +111,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -117,12 +126,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -138,7 +147,7 @@ public function getItems() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -147,7 +156,7 @@ public function getItems() } } - + // return items return $items; } @@ -155,7 +164,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -168,25 +177,25 @@ public function selectionTranslation($value,$name) 2 => 'COM_COMPONENTBUILDER_SERVER_SFTP' ); // Now check if value is found in this array - if (isset($protocolArray[$value]) && ComponentbuilderHelper::checkString($protocolArray[$value])) + if (isset($protocolArray[$value]) && StringHelper::check($protocolArray[$value])) { return $protocolArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -215,7 +224,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -256,7 +265,7 @@ protected function getListQuery() $query->where('a.name = ' . (int) $_name); } } - elseif (ComponentbuilderHelper::checkString($_name)) + elseif (StringHelper::check($_name)) { $query->where('a.name = ' . $db->quote($db->escape($_name))); } @@ -273,16 +282,18 @@ protected function getListQuery() $query->where('a.protocol = ' . (int) $_protocol); } } - elseif (ComponentbuilderHelper::checkString($_protocol)) + elseif (StringHelper::check($_protocol)) { $query->where('a.protocol = ' . $db->quote($db->escape($_protocol))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -300,17 +311,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -356,10 +367,10 @@ public function getExportData($pks, $user = null) // Get the basic encryption key. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey); + $basic = new AES($basickey); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -424,7 +435,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -442,16 +453,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_server"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -460,7 +471,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -475,13 +486,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -497,19 +508,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -521,7 +531,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -542,7 +552,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/site_view.php b/admin/models/site_view.php index 1b9aee892..c0d25e856 100644 --- a/admin/models/site_view.php +++ b/admin/models/site_view.php @@ -12,10 +12,23 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Site_view Admin Model @@ -128,16 +141,16 @@ class ComponentbuilderModelSite_view extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'site_view', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'site_view', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -169,17 +182,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'site_view__'.$id); ComponentbuilderHelper::set('site_view__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -188,7 +200,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -339,24 +351,23 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'site_view__'.$id); ComponentbuilderHelper::set('site_view__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } } // update the fields - $objectUpdate = new stdClass(); + $objectUpdate = new \stdClass(); $objectUpdate->id = (int) $item->id; // check what type of custom_button array we have here (should be subform... but just incase) // This could happen due to huge data sets @@ -409,7 +420,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -436,7 +447,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -449,7 +460,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -506,11 +517,11 @@ public function getForm($data = array(), $loadData = true, $options = array('con } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -525,22 +536,22 @@ public function getForm($data = array(), $loadData = true, $options = array('con // Only load the GUID if new item (or empty) if (0 == $id || !($val = $form->getValue('guid'))) { - $form->setValue('guid', null, ComponentbuilderHelper::GUID()); + $form->setValue('guid', null, GuidHelper::get()); } - + return $form; } /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/site_view.js'; } - + /** * Method to test whether a record can be deleted. * @@ -559,7 +570,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('core.delete', 'com_componentbuilder.site_view.' . (int) $record->id); } @@ -577,8 +588,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -589,31 +600,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return parent::canEditState($record); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('core.edit', 'com_componentbuilder.site_view.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('core.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -621,19 +632,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -645,7 +656,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_site_view')); @@ -660,7 +671,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -675,10 +686,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.site_view.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.site_view.data', []); if (empty($data)) { @@ -701,7 +712,7 @@ protected function getUniqueFields() { return array('guid'); } - + /** * Method to delete one or more records. * @@ -717,7 +728,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -737,10 +748,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -766,30 +777,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('site_view'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('site_view'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -826,8 +837,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -853,13 +863,13 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('site_view'); } - if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + if (!$this->canDo->get('core.create') && !$this->canDo->get('site_view.batch')) { return false; } @@ -879,7 +889,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -892,7 +902,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('core.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -908,19 +918,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -932,7 +942,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -996,15 +1006,15 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('site_view'); } - if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + if (!$this->canDo->get('core.edit') && !$this->canDo->get('site_view.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1021,7 +1031,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('core.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1037,13 +1047,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -1087,7 +1097,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -1099,15 +1109,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -1115,49 +1125,49 @@ public function save($data) // always reset the snippets $data['snippet'] = 0; // 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']; } // if codename is empty create from name - if (empty($data['codename']) || !ComponentbuilderHelper::checkString($data['codename'])) + if (empty($data['codename']) || !UtilitiesStringHelper::check($data['codename'])) { - $data['codename'] = ComponentbuilderHelper::safeString($data['name']); + $data['codename'] = UtilitiesStringHelper::safe($data['name']); } else { // always make safe string - $data['codename'] = ComponentbuilderHelper::safeString($data['codename']); + $data['codename'] = UtilitiesStringHelper::safe($data['codename']); } // if context is empty create from codename - if (empty($data['context']) || !ComponentbuilderHelper::checkString($data['context'])) + if (empty($data['context']) || !UtilitiesStringHelper::check($data['context'])) { $data['context'] = $data['codename']; } else { // always make safe string - $data['context'] = ComponentbuilderHelper::safeString($data['context']); + $data['context'] = UtilitiesStringHelper::safe($data['context']); } // Set the GUID if empty or not valid if (empty($data['guid']) && $data['id'] > 0) { // get the existing one - $data['guid'] = (string) ComponentbuilderHelper::getVar('site_view', $data['id'], 'id', 'guid'); + $data['guid'] = (string) GetHelper::var('site_view', $data['id'], 'id', 'guid'); } + // Set the GUID if empty or not valid - while (!ComponentbuilderHelper::validGUID($data['guid'], "site_view", $data['id'])) + while (!GuidHelper::valid($data['guid'], "site_view", $data['id'])) { // must always be set - $data['guid'] = (string) ComponentbuilderHelper::GUID(); - } - + $data['guid'] = (string) GuidHelper::get(); + } // Set the custom_get items to data. if (isset($data['custom_get']) && is_array($data['custom_get'])) { - $custom_get = new JRegistry; + $custom_get = new Registry; $custom_get->loadArray($data['custom_get']); $data['custom_get'] = (string) $custom_get; } @@ -1170,7 +1180,7 @@ public function save($data) // Set the libraries items to data. if (isset($data['libraries']) && is_array($data['libraries'])) { - $libraries = new JRegistry; + $libraries = new Registry; $libraries->loadArray($data['libraries']); $data['libraries'] = (string) $libraries; } @@ -1183,7 +1193,7 @@ public function save($data) // Set the ajax_input items to data. if (isset($data['ajax_input']) && is_array($data['ajax_input'])) { - $ajax_input = new JRegistry; + $ajax_input = new Registry; $ajax_input->loadArray($data['ajax_input']); $data['ajax_input'] = (string) $ajax_input; } @@ -1196,7 +1206,7 @@ public function save($data) // Set the custom_button items to data. if (isset($data['custom_button']) && is_array($data['custom_button'])) { - $custom_button = new JRegistry; + $custom_button = new Registry; $custom_button->loadArray($data['custom_button']); $data['custom_button'] = (string) $custom_button; } @@ -1277,11 +1287,11 @@ public function save($data) { $data['php_model'] = base64_encode($data['php_model']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1291,7 +1301,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1299,14 +1309,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1319,7 +1329,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1345,7 +1354,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/site_views.php b/admin/models/site_views.php index 5294f6603..ad7dd297c 100644 --- a/admin/models/site_views.php +++ b/admin/models/site_views.php @@ -12,18 +12,28 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\FormHelper as JCBFormHelper; +use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Site_views List Model */ class ComponentbuilderModelSite_views extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -66,19 +76,19 @@ public function getFilterForm($data = array(), $loadData = true) 'onchange' => 'this.form.submit();', ); $options = array( - '' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_FOUND') . ' -' + '' => '- ' . Text::_('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') . ' -' + '' => '- ' . Text::_('COM_COMPONENTBUILDER_SELECT_COMPONENT') . ' -' ); // make sure we do not lose the key values in normal merge $options = $options + $joomla_components; } - $form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter'); + $form->setField(JCBFormHelper::xml($attributes, $options),'filter'); $form->setValue( 'joomla_component', 'filter', @@ -102,7 +112,7 @@ public function getFilterForm($data = array(), $loadData = true) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -187,7 +197,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -202,12 +212,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -223,7 +233,7 @@ public function getItems() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -234,7 +244,7 @@ public function getItems() } } - + // return items return $items; } @@ -242,7 +252,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -254,7 +264,7 @@ public function selectionTranslation($value,$name) 0 => 'COM_COMPONENTBUILDER_SITE_VIEW_NO' ); // Now check if value is found in this array - if (isset($add_php_ajaxArray[$value]) && ComponentbuilderHelper::checkString($add_php_ajaxArray[$value])) + if (isset($add_php_ajaxArray[$value]) && StringHelper::check($add_php_ajaxArray[$value])) { return $add_php_ajaxArray[$value]; } @@ -267,25 +277,25 @@ public function selectionTranslation($value,$name) 0 => 'COM_COMPONENTBUILDER_SITE_VIEW_NO' ); // Now check if value is found in this array - if (isset($add_custom_buttonArray[$value]) && ComponentbuilderHelper::checkString($add_custom_buttonArray[$value])) + if (isset($add_custom_buttonArray[$value]) && StringHelper::check($add_custom_buttonArray[$value])) { return $add_custom_buttonArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -301,7 +311,7 @@ protected function getListQuery() $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) . ')'); } @@ -337,7 +347,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -378,11 +388,11 @@ protected function getListQuery() $query->where('a.main_get = ' . (int) $_main_get); } } - elseif (ComponentbuilderHelper::checkString($_main_get)) + elseif (StringHelper::check($_main_get)) { $query->where('a.main_get = ' . $db->quote($db->escape($_main_get))); } - elseif (ComponentbuilderHelper::checkArray($_main_get)) + elseif (UtilitiesArrayHelper::check($_main_get)) { // Secure the array for the query $_main_get = array_map( function ($val) use(&$db) { @@ -397,7 +407,7 @@ protected function getListQuery() return (int) $val; } } - elseif (ComponentbuilderHelper::checkString($val)) + elseif (StringHelper::check($val)) { return $db->quote($db->escape($val)); } @@ -418,7 +428,7 @@ protected function getListQuery() $query->where('a.add_php_ajax = ' . (int) $_add_php_ajax); } } - elseif (ComponentbuilderHelper::checkString($_add_php_ajax)) + elseif (StringHelper::check($_add_php_ajax)) { $query->where('a.add_php_ajax = ' . $db->quote($db->escape($_add_php_ajax))); } @@ -435,16 +445,18 @@ protected function getListQuery() $query->where('a.add_custom_button = ' . (int) $_add_custom_button); } } - elseif (ComponentbuilderHelper::checkString($_add_custom_button)) + elseif (StringHelper::check($_add_custom_button)) { $query->where('a.add_custom_button = ' . $db->quote($db->escape($_add_custom_button))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -462,17 +474,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -506,7 +518,7 @@ public function getExportData($pks, $user = null) $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) . ')'); } @@ -535,7 +547,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -579,7 +591,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -597,16 +609,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_site_view"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -615,7 +627,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -630,13 +642,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -645,13 +657,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.modified_by'); // Check if the value is an array $_main_get = $this->getState('filter.main_get'); - if (ComponentbuilderHelper::checkArray($_main_get)) + if (UtilitiesArrayHelper::check($_main_get)) { $id .= ':' . implode(':', $_main_get); } // Check if this is only an number or string elseif (is_numeric($_main_get) - || ComponentbuilderHelper::checkString($_main_get)) + || StringHelper::check($_main_get)) { $id .= ':' . $_main_get; } @@ -668,19 +680,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -692,7 +703,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -713,7 +724,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/snippet.php b/admin/models/snippet.php index 6b875bd09..755e8040f 100644 --- a/admin/models/snippet.php +++ b/admin/models/snippet.php @@ -12,10 +12,22 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Componentbuilder Snippet Admin Model @@ -80,18 +92,18 @@ class ComponentbuilderModelSnippet extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'snippet', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'snippet', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -142,7 +154,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -169,7 +181,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -182,7 +194,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -241,22 +253,22 @@ public function getForm($data = array(), $loadData = true, $options = array('con // Only load the GUID if new item (or empty) if (0 == $id || !($val = $form->getValue('guid'))) { - $form->setValue('guid', null, ComponentbuilderHelper::GUID()); + $form->setValue('guid', null, GuidHelper::get()); } - + return $form; } /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/snippet.js'; } - + /** * Method to test whether a record can be deleted. * @@ -275,7 +287,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('core.delete', 'com_componentbuilder.snippet.' . (int) $record->id); } @@ -293,8 +305,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -305,31 +317,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return parent::canEditState($record); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('core.edit', 'com_componentbuilder.snippet.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('core.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -337,19 +349,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -361,7 +373,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_snippet')); @@ -376,7 +388,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -391,10 +403,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.snippet.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.snippet.data', []); if (empty($data)) { @@ -417,7 +429,7 @@ protected function getUniqueFields() { return array('guid'); } - + /** * Method to delete one or more records. * @@ -433,7 +445,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -453,10 +465,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -482,30 +494,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('snippet'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('snippet'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -542,8 +554,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -569,13 +580,13 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('snippet'); } - if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + if (!$this->canDo->get('core.create') && !$this->canDo->get('snippet.batch')) { return false; } @@ -595,7 +606,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -608,7 +619,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('core.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -624,19 +635,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -648,7 +659,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -712,15 +723,15 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('snippet'); } - if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + if (!$this->canDo->get('core.edit') && !$this->canDo->get('snippet.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -737,7 +748,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('core.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -753,13 +764,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -803,7 +814,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -815,15 +826,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -832,11 +843,11 @@ public function save($data) if (strlen($data['contributor_company']) < 1 || strlen($data['contributor_name']) < 1 || strlen($data['contributor_email']) < 3 || strlen($data['contributor_website']) < 3) { // get the library name - $library = ($name = ComponentbuilderHelper::getVar('library', $item['library'], 'id', 'name')) ? $name:'Common'; + $library = ($name = GetHelper::var('library', $item['library'], 'id', 'name')) ? $name:'Common'; // get the library name - $type = ($name = ComponentbuilderHelper::getVar('snippet_type', $item['type'], 'id', 'name')) ? $name:'No Library'; + $type = ($name = GetHelper::var('snippet_type', $item['type'], 'id', 'name')) ? $name:'No Library'; // build the filename - $filename = ComponentbuilderHelper::safeString($library . ' - (' . $type . ') ' . $item['name'], 'filename', '', false). '.json'; + $filename = UtilitiesStringHelper::safe($library . ' - (' . $type . ') ' . $item['name'], 'filename', '', false). '.json'; // now get the contributor details (slow) $contributor = ComponentbuilderHelper::getContributorDetails($filename); // now update the local snippet contributor details @@ -850,26 +861,26 @@ public function save($data) if (empty($data['guid']) && $data['id'] > 0) { // get the existing one - $data['guid'] = (string) ComponentbuilderHelper::getVar('snippet', $data['id'], 'id', 'guid'); + $data['guid'] = (string) GetHelper::var('snippet', $data['id'], 'id', 'guid'); } + // Set the GUID if empty or not valid - while (!ComponentbuilderHelper::validGUID($data['guid'], "snippet", $data['id'])) + while (!GuidHelper::valid($data['guid'], "snippet", $data['id'])) { // must always be set - $data['guid'] = (string) ComponentbuilderHelper::GUID(); - } - + $data['guid'] = (string) GuidHelper::get(); + } // Set the snippet string to base64 string. if (isset($data['snippet'])) { $data['snippet'] = base64_encode($data['snippet']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -879,7 +890,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -887,14 +898,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -907,7 +918,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -933,7 +943,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/snippet_type.php b/admin/models/snippet_type.php index f4ef6768d..92bfff28f 100644 --- a/admin/models/snippet_type.php +++ b/admin/models/snippet_type.php @@ -12,10 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Snippet_type Admin Model @@ -59,18 +69,18 @@ class ComponentbuilderModelSnippet_type extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'snippet_type', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'snippet_type', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -115,7 +125,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -142,7 +152,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -155,7 +165,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -216,13 +226,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/snippet_type.js'; } - + /** * Method to test whether a record can be deleted. * @@ -241,7 +251,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('snippet_type.delete', 'com_componentbuilder.snippet_type.' . (int) $record->id); } @@ -259,8 +269,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -271,31 +281,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('snippet_type.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('snippet_type.edit', 'com_componentbuilder.snippet_type.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('snippet_type.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -303,19 +313,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -327,7 +337,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_snippet_type')); @@ -342,7 +352,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -357,10 +367,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.snippet_type.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.snippet_type.data', []); if (empty($data)) { @@ -383,7 +393,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -399,7 +409,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -419,10 +429,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -448,30 +458,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('snippet_type'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('snippet_type'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -508,8 +518,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -535,7 +544,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('snippet_type'); @@ -561,7 +570,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -574,7 +583,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('snippet_type.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -590,19 +599,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -614,7 +623,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -678,7 +687,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('snippet_type'); @@ -686,7 +695,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('snippet_type.edit') && !$this->canDo->get('snippet_type.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -703,7 +712,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('snippet_type.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -719,13 +728,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -769,7 +778,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -781,23 +790,23 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -807,7 +816,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -815,14 +824,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -835,7 +844,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -861,7 +869,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/snippet_types.php b/admin/models/snippet_types.php index 4634da332..85c475585 100644 --- a/admin/models/snippet_types.php +++ b/admin/models/snippet_types.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Snippet_types List Model */ class ComponentbuilderModelSnippet_types extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -52,7 +60,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -102,7 +110,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -117,12 +125,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -136,22 +144,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -180,7 +188,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -210,16 +218,18 @@ protected function getListQuery() // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -234,13 +244,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -256,19 +266,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -280,7 +289,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -301,7 +310,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/snippets.php b/admin/models/snippets.php index b02657bc6..1030c0c34 100644 --- a/admin/models/snippets.php +++ b/admin/models/snippets.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Snippets List Model */ class ComponentbuilderModelSnippets extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -53,17 +61,17 @@ public function __construct($config = array()) public function shareSnippets($pks) { // setup the query - if (ComponentbuilderHelper::checkArray($pks)) + if (UtilitiesArrayHelper::check($pks)) { // Get the user object. - if (!ComponentbuilderHelper::checkObject($this->user)) + if (!ObjectHelper::check($this->user)) { - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); } // Create a new query object. - if (!ComponentbuilderHelper::checkObject($this->_db)) + if (!ObjectHelper::check($this->_db)) { - $this->_db = JFactory::getDBO(); + $this->_db = Factory::getDBO(); } $query = $this->_db->getQuery(true); @@ -99,10 +107,10 @@ public function shareSnippets($pks) // load the items from db $items = $this->_db->loadObjectList(); // check if we have items - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // get the shared paths - $this->fullPath = rtrim(ComponentbuilderHelper::getFolderPath('path', 'sharepath', JFactory::getConfig()->get('tmp_path')), '/') . '/snippets'; + $this->fullPath = rtrim(ComponentbuilderHelper::getFolderPath('path', 'sharepath', Factory::getConfig()->get('tmp_path')), '/') . '/snippets'; // remove old folder with the same name if (JFolder::exists($this->fullPath)) { @@ -125,7 +133,7 @@ public function shareSnippets($pks) // just unlock the snippet $item->snippet = base64_decode($item->snippet); // build filename - $fileName = ComponentbuilderHelper::safeString($item->library . ' - (' . $item->type . ') ' . $item->name, 'filename', '', false) . '.json'; + $fileName = StringHelper::safe($item->library . ' - (' . $item->type . ') ' . $item->name, 'filename', '', false) . '.json'; // if the snippet has its own contributor details set, then do not change if (!strlen($item->contributor_company) || !strlen($item->contributor_name) || !strlen($item->contributor_email) || !strlen($item->contributor_website)) { @@ -169,7 +177,7 @@ public function shareSnippets($pks) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -240,7 +248,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -255,12 +263,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -274,22 +282,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -326,7 +334,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -367,7 +375,7 @@ protected function getListQuery() $query->where('a.type = ' . (int) $_type); } } - elseif (ComponentbuilderHelper::checkString($_type)) + elseif (StringHelper::check($_type)) { $query->where('a.type = ' . $db->quote($db->escape($_type))); } @@ -384,16 +392,18 @@ protected function getListQuery() $query->where('a.library = ' . (int) $_library); } } - elseif (ComponentbuilderHelper::checkString($_library)) + elseif (StringHelper::check($_library)) { $query->where('a.library = ' . $db->quote($db->escape($_library))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -411,17 +421,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -465,7 +475,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -487,7 +497,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -505,16 +515,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_snippet"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -523,7 +533,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -538,13 +548,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -563,19 +573,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -587,7 +596,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -608,7 +617,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/template.php b/admin/models/template.php index 751332deb..f38a4edc5 100644 --- a/admin/models/template.php +++ b/admin/models/template.php @@ -12,10 +12,22 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Template Admin Model @@ -82,16 +94,16 @@ class ComponentbuilderModelTemplate extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'template', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'template', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -123,17 +135,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'template__'.$id); ComponentbuilderHelper::set('template__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -142,7 +153,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -209,17 +220,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'template__'.$id); ComponentbuilderHelper::set('template__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -240,7 +250,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -267,7 +277,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -280,7 +290,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -337,11 +347,11 @@ public function getForm($data = array(), $loadData = true, $options = array('con } // update all editors to use this components global editor - $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + $global_editor = ComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); // check if we found any - if (ComponentbuilderHelper::checkArray($editors)) + if (UtilitiesArrayHelper::check($editors)) { foreach ($editors as $editor) { @@ -358,13 +368,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/template.js'; } - + /** * Method to test whether a record can be deleted. * @@ -383,7 +393,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('core.delete', 'com_componentbuilder.template.' . (int) $record->id); } @@ -401,8 +411,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -413,31 +423,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return parent::canEditState($record); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('core.edit', 'com_componentbuilder.template.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('core.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -445,19 +455,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -469,7 +479,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_template')); @@ -484,7 +494,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -499,10 +509,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.template.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.template.data', []); if (empty($data)) { @@ -525,7 +535,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -541,7 +551,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -561,10 +571,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -590,30 +600,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('template'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('template'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -650,8 +660,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -677,13 +686,13 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('template'); } - if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + if (!$this->canDo->get('core.create') && !$this->canDo->get('template.batch')) { return false; } @@ -703,7 +712,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -716,7 +725,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('core.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -732,14 +741,14 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -751,7 +760,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -815,15 +824,15 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('template'); } - if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + if (!$this->canDo->get('core.edit') && !$this->canDo->get('template.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -840,7 +849,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('core.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -856,13 +865,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -906,7 +915,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -918,15 +927,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -937,7 +946,7 @@ public function save($data) // Set the libraries items to data. if (isset($data['libraries']) && is_array($data['libraries'])) { - $libraries = new JRegistry; + $libraries = new Registry; $libraries->loadArray($data['libraries']); $data['libraries'] = (string) $libraries; } @@ -958,11 +967,11 @@ public function save($data) { $data['template'] = base64_encode($data['template']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -995,27 +1004,27 @@ public function save($data) { if ($data['alias'] == null || empty($data['alias'])) { - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + $data['alias'] = OutputFilter::stringURLUnicodeSlug($data['name']); } else { - $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + $data['alias'] = OutputFilter::stringURLSafe($data['name']); } - $table = JTable::getInstance('template', 'componentbuilderTable'); + $table = clone $this->getTable(); if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) { - $msg = JText::_('COM_COMPONENTBUILDER_TEMPLATE_SAVE_WARNING'); + $msg = Text::_('COM_COMPONENTBUILDER_TEMPLATE_SAVE_WARNING'); } $data['alias'] = $this->_generateNewTitle($data['alias']); if (isset($msg)) { - JFactory::getApplication()->enqueueMessage($msg, 'warning'); + Factory::getApplication()->enqueueMessage($msg, 'warning'); } } } @@ -1025,7 +1034,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1033,14 +1042,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1053,7 +1062,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1080,10 +1088,10 @@ protected function _generateNewTitle($alias, $title = null) // Alter the title/s & alias $table = $this->getTable(); - while ($table->load(array('alias' => $alias))) + while ($table->load(['alias' => $alias])) { // Check if this is an array of titles - if (ComponentbuilderHelper::checkArray($title)) + if (UtilitiesArrayHelper::check($title)) { foreach($title as $nr => &$_title) { @@ -1098,7 +1106,7 @@ protected function _generateNewTitle($alias, $title = null) $alias = StringHelper::increment($alias, 'dash'); } // Check if this is an array of titles - if (ComponentbuilderHelper::checkArray($title)) + if (UtilitiesArrayHelper::check($title)) { $title[] = $alias; return $title; diff --git a/admin/models/templates.php b/admin/models/templates.php index 6584a566c..b68183fcc 100644 --- a/admin/models/templates.php +++ b/admin/models/templates.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Templates List Model */ class ComponentbuilderModelTemplates extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -54,7 +62,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -118,7 +126,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -133,12 +141,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -154,7 +162,7 @@ public function getItems() } // set selection value to a translatable value - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -163,7 +171,7 @@ public function getItems() } } - + // return items return $items; } @@ -171,7 +179,7 @@ public function getItems() /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -183,25 +191,25 @@ public function selectionTranslation($value,$name) 0 => 'COM_COMPONENTBUILDER_TEMPLATE_NO' ); // Now check if value is found in this array - if (isset($add_php_viewArray[$value]) && ComponentbuilderHelper::checkString($add_php_viewArray[$value])) + if (isset($add_php_viewArray[$value]) && StringHelper::check($add_php_viewArray[$value])) { return $add_php_viewArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -234,7 +242,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -275,7 +283,7 @@ protected function getListQuery() $query->where('a.dynamic_get = ' . (int) $_dynamic_get); } } - elseif (ComponentbuilderHelper::checkString($_dynamic_get)) + elseif (StringHelper::check($_dynamic_get)) { $query->where('a.dynamic_get = ' . $db->quote($db->escape($_dynamic_get))); } @@ -292,16 +300,18 @@ protected function getListQuery() $query->where('a.add_php_view = ' . (int) $_add_php_view); } } - elseif (ComponentbuilderHelper::checkString($_add_php_view)) + elseif (StringHelper::check($_add_php_view)) { $query->where('a.add_php_view = ' . $db->quote($db->escape($_add_php_view))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -319,17 +329,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -373,7 +383,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -397,7 +407,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -415,16 +425,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_template"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -433,7 +443,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -448,13 +458,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -472,19 +482,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -496,7 +505,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -517,7 +526,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/validation_rule.php b/admin/models/validation_rule.php index ffab04481..43b98b4d1 100644 --- a/admin/models/validation_rule.php +++ b/admin/models/validation_rule.php @@ -12,10 +12,22 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Componentbuilder Validation_rule Admin Model @@ -65,16 +77,16 @@ class ComponentbuilderModelValidation_rule extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'validation_rule', $prefix = 'ComponentbuilderTable', $config = array()) + public function getTable($type = 'validation_rule', $prefix = 'ComponentbuilderTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } @@ -106,17 +118,16 @@ public function getVDM() else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'validation_rule__'.$id); ComponentbuilderHelper::set('validation_rule__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -125,7 +136,7 @@ public function getVDM() return $this->vastDevMod; } - + /** * Method to get a single record. * @@ -178,17 +189,16 @@ public function getItem($pk = null) else { // set the vast development method key - $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + $this->vastDevMod = UtilitiesStringHelper::random(50); ComponentbuilderHelper::set($this->vastDevMod, 'validation_rule__'.$id); ComponentbuilderHelper::set('validation_rule__'.$id, $this->vastDevMod); // set a return value if found - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $return = $jinput->get('return', null, 'base64'); ComponentbuilderHelper::set($this->vastDevMod . '__return', $return); // set a GUID value if found - if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid) - && method_exists('ComponentbuilderHelper', 'validGUID') - && ComponentbuilderHelper::validGUID($item->guid)) + if (isset($item) && ObjectHelper::check($item) && isset($item->guid) + && GuidHelper::valid($item->guid)) { ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid); } @@ -209,7 +219,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -236,7 +246,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -249,7 +259,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -310,13 +320,13 @@ public function getForm($data = array(), $loadData = true, $options = array('con /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_componentbuilder/js/validation_rule.js'; } - + /** * Method to test whether a record can be deleted. * @@ -335,7 +345,7 @@ protected function canDelete($record) return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('validation_rule.delete', 'com_componentbuilder.validation_rule.' . (int) $record->id); } @@ -353,8 +363,8 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -365,31 +375,31 @@ protected function canEditState($record) return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('validation_rule.edit.state', 'com_componentbuilder'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('validation_rule.edit', 'com_componentbuilder.validation_rule.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('validation_rule.edit', 'com_componentbuilder'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -397,19 +407,19 @@ protected function allowEdit($data = array(), $key = 'id') */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -421,7 +431,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__componentbuilder_validation_rule')); @@ -436,7 +446,7 @@ protected function prepareTable($table) $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -451,10 +461,10 @@ protected function prepareTable($table) * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.validation_rule.data', array()); + $data = Factory::getApplication()->getUserState('com_componentbuilder.edit.validation_rule.data', []); if (empty($data)) { @@ -477,7 +487,7 @@ protected function getUniqueFields() { return false; } - + /** * Method to delete one or more records. * @@ -493,7 +503,7 @@ public function delete(&$pks) { return false; } - + return true; } @@ -513,10 +523,10 @@ public function publish(&$pks, $value = 1) { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -542,30 +552,30 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = ComponentbuilderHelper::getActions('validation_rule'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = ComponentbuilderHelper::getActions('validation_rule'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -602,8 +612,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -629,7 +638,7 @@ protected function batchCopy($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('validation_rule'); @@ -655,7 +664,7 @@ protected function batchCopy($values, $pks, $contexts) $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -668,7 +677,7 @@ protected function batchCopy($values, $pks, $contexts) if (!$this->user->authorise('validation_rule.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -684,19 +693,19 @@ protected function batchCopy($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (ComponentbuilderHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } // insert all set values - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -708,7 +717,7 @@ protected function batchCopy($values, $pks, $contexts) } // update all unique fields - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -772,7 +781,7 @@ protected function batchMove($values, $pks, $contexts) if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = ComponentbuilderHelper::getActions('validation_rule'); @@ -780,7 +789,7 @@ protected function batchMove($values, $pks, $contexts) if (!$this->canDo->get('validation_rule.edit') && !$this->canDo->get('validation_rule.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -797,7 +806,7 @@ protected function batchMove($values, $pks, $contexts) { if (!$this->user->authorise('validation_rule.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -813,13 +822,13 @@ protected function batchMove($values, $pks, $contexts) else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (ComponentbuilderHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -863,7 +872,7 @@ protected function batchMove($values, $pks, $contexts) return true; } - + /** * Method to save the form data. * @@ -875,15 +884,15 @@ protected function batchMove($values, $pks, $contexts) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -893,11 +902,11 @@ public function save($data) { $data['php'] = base64_encode($data['php']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -907,7 +916,7 @@ public function save($data) { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (ComponentbuilderHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -915,14 +924,14 @@ public function save($data) } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -935,7 +944,6 @@ public function save($data) */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -961,7 +969,7 @@ protected function _generateNewTitle($title) // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/validation_rules.php b/admin/models/validation_rules.php index 8931eb11d..93b9329cc 100644 --- a/admin/models/validation_rules.php +++ b/admin/models/validation_rules.php @@ -12,18 +12,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Validation_rules List Model */ class ComponentbuilderModelValidation_rules extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -52,7 +60,7 @@ public function __construct($config = array()) */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -102,7 +110,7 @@ protected function populateState($ordering = null, $direction = null) // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -117,12 +125,12 @@ public function getItems() $items = parent::getItems(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -136,22 +144,22 @@ public function getItems() } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -180,7 +188,7 @@ protected function getListQuery() { $query->where('a.access = ' . (int) $_access); } - elseif (ComponentbuilderHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -210,10 +218,12 @@ protected function getListQuery() // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -231,17 +241,17 @@ protected function getListQuery() public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !ComponentbuilderHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -285,7 +295,7 @@ public function getExportData($pks, $user = null) $items = $db->loadObjectList(); // Set values to display correctly. - if (ComponentbuilderHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -307,7 +317,7 @@ public function getExportData($pks, $user = null) } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (ComponentbuilderHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -325,16 +335,16 @@ public function getExportData($pks, $user = null) public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_validation_rule"); - if (ComponentbuilderHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -343,7 +353,7 @@ public function getExImPortHeaders() } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -358,13 +368,13 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (ComponentbuilderHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || ComponentbuilderHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -380,19 +390,18 @@ protected function getStoreId($id = '') /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_componentbuilder')->get('check_in'); + $time = ComponentHelper::getParams('com_componentbuilder')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -404,7 +413,7 @@ protected function checkInNow() if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -425,7 +434,7 @@ protected function checkInNow() $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 15782757b..079faf6f5 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -2,15 +2,20 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_component` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `add_admin_event` TINYINT(1) NOT NULL DEFAULT 0, + `add_backup_folder_path` TINYINT(1) NOT NULL DEFAULT 0, `add_css_admin` TINYINT(1) NOT NULL DEFAULT 0, `add_css_site` TINYINT(1) NOT NULL DEFAULT 0, `add_email_helper` TINYINT(1) NOT NULL DEFAULT 0, + `add_git_folder_path` TINYINT(1) NOT NULL DEFAULT 0, `add_javascript` TINYINT(1) NOT NULL DEFAULT 0, + `add_jcb_powers_path` TINYINT(1) NOT NULL DEFAULT 0, `add_license` TINYINT(1) NOT NULL DEFAULT 0, `add_menu_prefix` CHAR(1) NOT NULL DEFAULT '', + `add_namespace_prefix` CHAR(1) NOT NULL DEFAULT '', `add_php_helper_admin` TINYINT(1) NOT NULL DEFAULT 0, `add_php_helper_both` TINYINT(1) NOT NULL DEFAULT 0, `add_php_helper_site` TINYINT(1) NOT NULL DEFAULT 0, + `add_php_method_install` TINYINT(1) NOT NULL DEFAULT 0, `add_php_method_uninstall` TINYINT(1) NOT NULL DEFAULT 0, `add_php_postflight_install` TINYINT(1) NOT NULL DEFAULT 0, `add_php_postflight_update` TINYINT(1) NOT NULL DEFAULT 0, @@ -29,6 +34,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_component` ( `adduikit` TINYINT(1) NOT NULL DEFAULT 0, `assets_table_fix` TINYINT(1) NOT NULL DEFAULT 3, `author` VARCHAR(255) NOT NULL DEFAULT '', + `backup_folder_path` VARCHAR(255) NOT NULL DEFAULT '', `bom` CHAR(64) NOT NULL DEFAULT '', `buildcomp` TINYINT(1) NOT NULL DEFAULT 0, `buildcompsql` MEDIUMTEXT NOT NULL, @@ -46,14 +52,16 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_component` ( `dashboard` VARCHAR(64) NOT NULL DEFAULT '', `dashboard_type` TINYINT(1) NOT NULL DEFAULT 1, `debug_linenr` TINYINT(1) NOT NULL DEFAULT 0, - `description` TEXT NOT NULL, + `description` TEXT NULL, `email` VARCHAR(255) NOT NULL DEFAULT '', `emptycontributors` TINYINT(1) NOT NULL DEFAULT 0, `export_buy_link` VARCHAR(255) NOT NULL DEFAULT '', `export_key` TEXT NOT NULL, + `git_folder_path` VARCHAR(255) NOT NULL DEFAULT '', `guid` VARCHAR(36) NOT NULL DEFAULT '', - `image` CHAR(64) NOT NULL DEFAULT '', + `image` VARCHAR(255) NOT NULL DEFAULT '', `javascript` TEXT NOT NULL, + `jcb_powers_path` VARCHAR(255) NOT NULL DEFAULT '', `joomla_source_link` VARCHAR(255) NOT NULL DEFAULT '', `license` VARCHAR(255) NOT NULL DEFAULT '', `license_type` TINYINT(1) NOT NULL DEFAULT 0, @@ -62,17 +70,20 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_component` ( `mvc_versiondate` TINYINT(1) NOT NULL DEFAULT 0, `name` CHAR(64) NOT NULL DEFAULT '', `name_code` VARCHAR(255) NOT NULL DEFAULT '', + `namespace_prefix` VARCHAR(255) NOT NULL DEFAULT '', `number` INT(11) NOT NULL DEFAULT 0, `php_admin_event` MEDIUMTEXT NOT NULL, `php_helper_admin` MEDIUMTEXT NOT NULL, `php_helper_both` MEDIUMTEXT NOT NULL, `php_helper_site` MEDIUMTEXT NOT NULL, + `php_method_install` MEDIUMTEXT NOT NULL, `php_method_uninstall` MEDIUMTEXT NOT NULL, `php_postflight_install` MEDIUMTEXT NOT NULL, `php_postflight_update` MEDIUMTEXT NOT NULL, `php_preflight_install` MEDIUMTEXT NOT NULL, `php_preflight_update` MEDIUMTEXT NOT NULL, `php_site_event` MEDIUMTEXT NOT NULL, + `preferred_joomla_version` INT(11) NOT NULL DEFAULT 3, `readme` TEXT NOT NULL, `remove_line_breaks` TINYINT(1) NOT NULL DEFAULT 0, `sales_server` INT(11) NOT NULL DEFAULT 0, @@ -89,7 +100,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_component` ( `whmcs_buy_link` VARCHAR(255) NOT NULL DEFAULT '', `whmcs_key` VARCHAR(255) NOT NULL DEFAULT '', `whmcs_url` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -105,42 +116,48 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_component` ( PRIMARY KEY (`id`), KEY `idx_system_name` (`system_name`), KEY `idx_name_code` (`name_code`), - KEY `idx_mvc_versiondate` (`mvc_versiondate`), KEY `idx_remove_line_breaks` (`remove_line_breaks`), - KEY `idx_add_placeholders` (`add_placeholders`), KEY `idx_debug_linenr` (`debug_linenr`), + KEY `idx_mvc_versiondate` (`mvc_versiondate`), + KEY `idx_addreadme` (`addreadme`), + KEY `idx_add_placeholders` (`add_placeholders`), + KEY `idx_add_backup_folder_path` (`add_backup_folder_path`), + KEY `idx_translation_tool` (`translation_tool`), KEY `idx_add_license` (`add_license`), KEY `idx_license_type` (`license_type`), - KEY `idx_add_email_helper` (`add_email_helper`), - KEY `idx_addreadme` (`addreadme`), - KEY `idx_add_sales_server` (`add_sales_server`), KEY `idx_add_powers` (`add_powers`), - KEY `idx_translation_tool` (`translation_tool`), - KEY `idx_add_php_helper_both` (`add_php_helper_both`), + KEY `idx_add_sales_server` (`add_sales_server`), + KEY `idx_add_jcb_powers_path` (`add_jcb_powers_path`), KEY `idx_add_php_helper_admin` (`add_php_helper_admin`), KEY `idx_add_admin_event` (`add_admin_event`), KEY `idx_add_php_helper_site` (`add_php_helper_site`), KEY `idx_add_site_event` (`add_site_event`), + KEY `idx_add_namespace_prefix` (`add_namespace_prefix`), KEY `idx_add_javascript` (`add_javascript`), - KEY `idx_add_menu_prefix` (`add_menu_prefix`), + KEY `idx_namespace_prefix` (`namespace_prefix`), KEY `idx_add_css_admin` (`add_css_admin`), - KEY `idx_menu_prefix` (`menu_prefix`), KEY `idx_add_css_site` (`add_css_site`), + KEY `idx_add_menu_prefix` (`add_menu_prefix`), + KEY `idx_menu_prefix` (`menu_prefix`), KEY `idx_add_php_preflight_install` (`add_php_preflight_install`), KEY `idx_add_php_preflight_update` (`add_php_preflight_update`), KEY `idx_add_php_postflight_install` (`add_php_postflight_install`), KEY `idx_add_php_postflight_update` (`add_php_postflight_update`), KEY `idx_add_php_method_uninstall` (`add_php_method_uninstall`), + KEY `idx_add_php_method_install` (`add_php_method_install`), KEY `idx_add_sql` (`add_sql`), KEY `idx_add_sql_uninstall` (`add_sql_uninstall`), KEY `idx_assets_table_fix` (`assets_table_fix`), - KEY `idx_emptycontributors` (`emptycontributors`), KEY `idx_add_update_server` (`add_update_server`), + KEY `idx_emptycontributors` (`emptycontributors`), KEY `idx_update_server_target` (`update_server_target`), + KEY `idx_add_git_folder_path` (`add_git_folder_path`), KEY `idx_creatuserhelper` (`creatuserhelper`), KEY `idx_adduikit` (`adduikit`), - KEY `idx_guid` (`guid`), KEY `idx_addfootable` (`addfootable`), + KEY `idx_add_email_helper` (`add_email_helper`), + KEY `idx_add_php_helper_both` (`add_php_helper_both`), + KEY `idx_guid` (`guid`), KEY `idx_access` (`access`), KEY `idx_checkout` (`checked_out`), KEY `idx_createdby` (`created_by`), @@ -169,7 +186,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_module` ( `class_helper_header` TEXT NOT NULL, `custom_get` TEXT NOT NULL, `default` MEDIUMTEXT NOT NULL, - `description` TEXT NOT NULL, + `description` TEXT NULL, `fields` TEXT NOT NULL, `guid` VARCHAR(36) NOT NULL DEFAULT '', `libraries` TEXT NOT NULL, @@ -193,7 +210,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_module` ( `update_server` INT(11) NOT NULL DEFAULT 0, `update_server_target` TINYINT(1) NOT NULL DEFAULT 0, `update_server_url` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -246,10 +263,10 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin` ( `add_update_server` TINYINT(1) NOT NULL DEFAULT 0, `addreadme` TINYINT(1) NOT NULL DEFAULT 0, `class_extends` INT(11) NOT NULL DEFAULT 0, - `description` TEXT NOT NULL, + `description` TEXT NULL, `fields` TEXT NOT NULL, `guid` VARCHAR(36) NOT NULL DEFAULT '', - `head` TEXT NOT NULL, + `head` TEXT NULL, `joomla_plugin_group` INT(11) NOT NULL DEFAULT 0, `main_class_code` MEDIUMTEXT NOT NULL, `method_selection` TEXT NOT NULL, @@ -271,7 +288,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin` ( `update_server` INT(11) NOT NULL DEFAULT 0, `update_server_target` TINYINT(1) NOT NULL DEFAULT 0, `update_server_url` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -309,28 +326,62 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin` ( KEY `idx_state` (`published`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; +CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_power` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `description` TEXT NULL, + `guid` VARCHAR(36) NOT NULL DEFAULT '', + `settings` TEXT NOT NULL, + `system_name` VARCHAR(255) NOT NULL DEFAULT '', + `params` TEXT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_system_name` (`system_name`), + KEY `idx_guid` (`guid`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; + CREATE TABLE IF NOT EXISTS `#__componentbuilder_power` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `add_head` TINYINT(1) NOT NULL DEFAULT 0, - `description` TEXT NOT NULL, + `add_licensing_template` TINYINT(1) NOT NULL DEFAULT 1, + `approved` TINYINT(1) NOT NULL DEFAULT 0, + `approved_paths` TEXT NULL, + `composer` TEXT NULL, + `description` TEXT NULL, `extends` VARCHAR(36) NOT NULL DEFAULT '', - `extends_custom` VARCHAR(64) NOT NULL DEFAULT '', + `extends_custom` VARCHAR(64) NULL DEFAULT '', `guid` VARCHAR(36) NOT NULL DEFAULT '', - `head` TEXT NOT NULL, + `head` TEXT NULL, `implements` TEXT NULL, `implements_custom` VARCHAR(1024) NOT NULL DEFAULT '', - `load_selection` TEXT NOT NULL, + `licensing_template` TEXT NULL, + `load_selection` TEXT NULL, `main_class_code` MEDIUMTEXT NOT NULL, - `method_selection` TEXT NOT NULL, + `method_selection` TEXT NULL, `name` VARCHAR(255) NOT NULL DEFAULT '', `namespace` VARCHAR(255) NOT NULL DEFAULT '', `power_version` CHAR(64) NOT NULL DEFAULT '', - `property_selection` TEXT NOT NULL, + `property_selection` TEXT NULL, `system_name` VARCHAR(255) NOT NULL DEFAULT '', `type` VARCHAR(64) NOT NULL DEFAULT '', - `use_selection` TEXT NOT NULL, - `params` text NULL, + `use_selection` TEXT NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -346,8 +397,9 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_power` ( KEY `idx_system_name` (`system_name`), KEY `idx_namespace` (`namespace`), KEY `idx_type` (`type`), - KEY `idx_implements_custom` (`implements_custom`), KEY `idx_extends_custom` (`extends_custom`), + KEY `idx_implements_custom` (`implements_custom`), + KEY `idx_add_licensing_template` (`add_licensing_template`), KEY `idx_guid` (`guid`), KEY `idx_name` (`name`), KEY `idx_access` (`access`), @@ -397,16 +449,16 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_admin_view` ( `addtabs` TEXT NOT NULL, `ajax_input` TEXT NOT NULL, `alias_builder` VARCHAR(255) NOT NULL DEFAULT '', - `alias_builder_type` CHAR NOT NULL DEFAULT '', + `alias_builder_type` TINYINT(1) NOT NULL DEFAULT 0, `css_view` TEXT NOT NULL, `css_views` TEXT NOT NULL, `custom_button` TEXT NOT NULL, - `description` TEXT NOT NULL, + `description` TEXT NULL, `guid` VARCHAR(36) NOT NULL DEFAULT '', `html_import_view` MEDIUMTEXT NOT NULL, - `icon` CHAR(64) NOT NULL DEFAULT '', - `icon_add` CHAR(64) NOT NULL DEFAULT '', - `icon_category` CHAR(64) NOT NULL DEFAULT '', + `icon` VARCHAR(255) NOT NULL DEFAULT '', + `icon_add` VARCHAR(255) NOT NULL DEFAULT '', + `icon_category` VARCHAR(255) NOT NULL DEFAULT '', `javascript_view_file` TEXT NOT NULL, `javascript_view_footer` TEXT NOT NULL, `javascript_views_file` TEXT NOT NULL, @@ -452,7 +504,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_admin_view` ( `sql` MEDIUMTEXT NOT NULL, `system_name` VARCHAR(255) NOT NULL DEFAULT '', `type` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -536,7 +588,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_custom_admin_view` ( `description` VARCHAR(255) NOT NULL DEFAULT '', `dynamic_get` INT(11) NOT NULL DEFAULT 0, `guid` VARCHAR(36) NOT NULL DEFAULT '', - `icon` CHAR(64) NOT NULL DEFAULT '', + `icon` VARCHAR(255) NOT NULL DEFAULT '', `javascript_file` TEXT NOT NULL, `js_document` TEXT NOT NULL, `libraries` TEXT NOT NULL, @@ -551,7 +603,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_custom_admin_view` ( `php_view` MEDIUMTEXT NOT NULL, `snippet` INT(11) NOT NULL DEFAULT 0, `system_name` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -626,7 +678,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_site_view` ( `php_view` MEDIUMTEXT NOT NULL, `snippet` INT(11) NOT NULL DEFAULT 0, `system_name` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -675,7 +727,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_template` ( `php_view` MEDIUMTEXT NOT NULL, `snippet` INT(11) NOT NULL DEFAULT 0, `template` TEXT NOT NULL, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -711,7 +763,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_layout` ( `name` VARCHAR(255) NOT NULL DEFAULT '', `php_view` MEDIUMTEXT NOT NULL, `snippet` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -744,7 +796,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_dynamic_get` ( `add_php_before_getitems` TINYINT(1) NOT NULL DEFAULT 0, `add_php_getlistquery` TINYINT(1) NOT NULL DEFAULT 0, `add_php_router_parse` TINYINT(1) NOT NULL DEFAULT 0, - `addcalculation` CHAR NOT NULL DEFAULT '', + `addcalculation` TINYINT(1) NOT NULL DEFAULT 0, `db_selection` TEXT NOT NULL, `db_table_main` VARCHAR(255) NOT NULL DEFAULT '', `filter` TEXT NOT NULL, @@ -772,7 +824,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_dynamic_get` ( `view_selection` TEXT NOT NULL, `view_table_main` INT(11) NOT NULL DEFAULT 0, `where` TEXT NOT NULL, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -788,15 +840,15 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_dynamic_get` ( KEY `idx_name` (`name`), KEY `idx_main_source` (`main_source`), KEY `idx_gettype` (`gettype`), - KEY `idx_select_all` (`select_all`), + KEY `idx_add_php_after_getitems` (`add_php_after_getitems`), + KEY `idx_add_php_router_parse` (`add_php_router_parse`), + KEY `idx_add_php_before_getitems` (`add_php_before_getitems`), KEY `idx_add_php_before_getitem` (`add_php_before_getitem`), - KEY `idx_getcustom` (`getcustom`), KEY `idx_add_php_after_getitem` (`add_php_after_getitem`), - KEY `idx_pagination` (`pagination`), KEY `idx_add_php_getlistquery` (`add_php_getlistquery`), - KEY `idx_add_php_before_getitems` (`add_php_before_getitems`), - KEY `idx_add_php_after_getitems` (`add_php_after_getitems`), - KEY `idx_add_php_router_parse` (`add_php_router_parse`), + KEY `idx_select_all` (`select_all`), + KEY `idx_getcustom` (`getcustom`), + KEY `idx_pagination` (`pagination`), KEY `idx_guid` (`guid`), KEY `idx_access` (`access`), KEY `idx_checkout` (`checked_out`), @@ -815,12 +867,13 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_custom_code` ( `function_name` VARCHAR(255) NOT NULL DEFAULT '', `hashendtarget` VARCHAR(64) NOT NULL DEFAULT '', `hashtarget` VARCHAR(64) NOT NULL DEFAULT '', + `joomla_version` INT(11) NOT NULL DEFAULT 3, `path` TEXT NOT NULL, `system_name` VARCHAR(255) NOT NULL DEFAULT '', `target` TINYINT(1) NOT NULL DEFAULT 0, `to_line` VARCHAR(100) NOT NULL DEFAULT '', `type` TINYINT(1) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -856,7 +909,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_class_property` ( `joomla_plugin_group` INT(11) NOT NULL DEFAULT 0, `name` VARCHAR(255) NOT NULL DEFAULT '', `visibility` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -891,7 +944,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_class_method` ( `joomla_plugin_group` INT(11) NOT NULL DEFAULT 0, `name` VARCHAR(255) NOT NULL DEFAULT '', `visibility` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -920,7 +973,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_placeholder` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `target` VARCHAR(255) NOT NULL DEFAULT '', `value` TEXT NOT NULL, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -953,7 +1006,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_library` ( `php_setdocument` MEDIUMTEXT NOT NULL, `target` TINYINT(1) NOT NULL DEFAULT 1, `type` TINYINT(1) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -983,7 +1036,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_snippet` ( `contributor_email` VARCHAR(255) NOT NULL DEFAULT '', `contributor_name` VARCHAR(255) NOT NULL DEFAULT '', `contributor_website` VARCHAR(255) NOT NULL DEFAULT '', - `description` TEXT NOT NULL, + `description` TEXT NULL, `guid` VARCHAR(36) NOT NULL DEFAULT '', `heading` VARCHAR(255) NOT NULL DEFAULT '', `library` INT(11) NOT NULL DEFAULT 0, @@ -992,7 +1045,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_snippet` ( `type` INT(11) NOT NULL DEFAULT 0, `url` VARCHAR(255) NOT NULL DEFAULT '', `usage` TEXT NOT NULL, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1019,11 +1072,11 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_snippet` ( CREATE TABLE IF NOT EXISTS `#__componentbuilder_validation_rule` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', - `inherit` CHAR NOT NULL DEFAULT '', + `inherit` CHAR(64) NOT NULL DEFAULT '', `name` VARCHAR(255) NOT NULL DEFAULT '', `php` MEDIUMTEXT NOT NULL, `short_description` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1072,7 +1125,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_field` ( `on_save_model_field` TEXT NOT NULL, `store` INT(11) NOT NULL DEFAULT 0, `xml` TEXT NOT NULL, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1116,7 +1169,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_fieldtype` ( `datalenght` CHAR(64) NOT NULL DEFAULT '', `datalenght_other` CHAR(64) NOT NULL DEFAULT '', `datatype` CHAR(64) NOT NULL DEFAULT '', - `description` TEXT NOT NULL, + `description` TEXT NULL, `guid` VARCHAR(36) NOT NULL DEFAULT '', `has_defaults` TINYINT(1) NOT NULL DEFAULT 0, `indexes` CHAR(64) NOT NULL DEFAULT '', @@ -1125,7 +1178,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_fieldtype` ( `properties` TEXT NOT NULL, `short_description` VARCHAR(255) NOT NULL DEFAULT '', `store` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1143,10 +1196,10 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_fieldtype` ( KEY `idx_indexes` (`indexes`), KEY `idx_datadefault_other` (`datadefault_other`), KEY `idx_datadefault` (`datadefault`), - KEY `idx_datalenght_other` (`datalenght_other`), KEY `idx_datatype` (`datatype`), KEY `idx_has_defaults` (`has_defaults`), KEY `idx_datalenght` (`datalenght`), + KEY `idx_datalenght_other` (`datalenght_other`), KEY `idx_guid` (`guid`), KEY `idx_catid` (`catid`), KEY `idx_access` (`access`), @@ -1159,12 +1212,12 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_fieldtype` ( CREATE TABLE IF NOT EXISTS `#__componentbuilder_language_translation` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', - `components` TEXT NOT NULL, - `modules` TEXT NOT NULL, - `plugins` TEXT NOT NULL, + `components` TEXT NULL, + `modules` TEXT NULL, + `plugins` TEXT NULL, `source` MEDIUMTEXT NOT NULL, - `translation` TEXT NOT NULL, - `params` text NULL, + `translation` TEXT NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1189,7 +1242,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_language` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `langtag` VARCHAR(64) NOT NULL DEFAULT '', `name` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1225,7 +1278,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_server` ( `secret` TEXT NOT NULL, `signature` TEXT NOT NULL, `username` TEXT NOT NULL, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1262,7 +1315,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_help_document` ( `title` CHAR(64) NOT NULL DEFAULT '', `type` TINYINT(1) NOT NULL DEFAULT 0, `url` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1291,7 +1344,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_admin_fields` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `addfields` MEDIUMTEXT NOT NULL, `admin_view` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1317,7 +1370,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_admin_fields_conditions` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `addconditions` MEDIUMTEXT NOT NULL, `admin_view` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1343,7 +1396,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_admin_fields_relations` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `addrelations` MEDIUMTEXT NOT NULL, `admin_view` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1369,7 +1422,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_admin_custom_tabs` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `admin_view` INT(11) NOT NULL DEFAULT 0, `tabs` TEXT NOT NULL, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1395,7 +1448,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_admin_views` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `addadmin_views` TEXT NOT NULL, `joomla_component` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1421,7 +1474,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_site_views` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `addsite_views` TEXT NOT NULL, `joomla_component` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1447,7 +1500,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_custom_admin_views` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `addcustom_admin_views` TEXT NOT NULL, `joomla_component` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1472,8 +1525,8 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_updates` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `joomla_component` INT(11) NOT NULL DEFAULT 0, - `version_update` TEXT NOT NULL, - `params` text NULL, + `version_update` MEDIUMTEXT NOT NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1499,7 +1552,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_mysql_tweaks` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `joomla_component` INT(11) NOT NULL DEFAULT 0, `sql_tweak` TEXT NOT NULL, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1525,7 +1578,39 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_custom_admin_menus` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `addcustommenus` TEXT NOT NULL, `joomla_component` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_joomla_component` (`joomla_component`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_router` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `constructor_after_parent_code` MEDIUMTEXT NOT NULL, + `constructor_before_parent_code` MEDIUMTEXT NOT NULL, + `constructor_before_parent_manual` TEXT NOT NULL, + `joomla_component` INT(11) NOT NULL DEFAULT 0, + `methods_code` MEDIUMTEXT NOT NULL, + `mode_constructor_after_parent` TINYINT(1) NOT NULL DEFAULT 0, + `mode_constructor_before_parent` TINYINT(1) NOT NULL DEFAULT 0, + `mode_methods` TINYINT(1) NOT NULL DEFAULT 0, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1551,7 +1636,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_config` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `addconfig` TEXT NOT NULL, `joomla_component` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1578,7 +1663,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_dashboard` ( `dashboard_tab` TEXT NOT NULL, `joomla_component` INT(11) NOT NULL DEFAULT 0, `php_dashboard_methods` MEDIUMTEXT NOT NULL, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1607,7 +1692,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_files_folders` ( `addfolders` TEXT NOT NULL, `addfoldersfullpath` TEXT NOT NULL, `joomla_component` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1633,7 +1718,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_placeholders` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `addplaceholders` TEXT NOT NULL, `joomla_component` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1659,7 +1744,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_plugins` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `addjoomla_plugins` TEXT NOT NULL, `joomla_component` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1685,7 +1770,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_modules` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `addjoomla_modules` TEXT NOT NULL, `joomla_component` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1711,7 +1796,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_snippet_type` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `description` VARCHAR(255) NOT NULL DEFAULT '', `name` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1737,7 +1822,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_library_config` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `addconfig` TEXT NOT NULL, `library` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1767,7 +1852,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_library_files_folders_urls` ( `addfoldersfullpath` TEXT NOT NULL, `addurls` TEXT NOT NULL, `library` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1793,9 +1878,9 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_class_extends` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `comment` TEXT NOT NULL, `extension_type` VARCHAR(64) NOT NULL DEFAULT '', - `head` TEXT NOT NULL, + `head` TEXT NULL, `name` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1820,8 +1905,8 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_module_updates` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `joomla_module` INT(11) NOT NULL DEFAULT 0, - `version_update` TEXT NOT NULL, - `params` text NULL, + `version_update` MEDIUMTEXT NOT NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1851,7 +1936,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_module_files_folders_urls `addfoldersfullpath` TEXT NOT NULL, `addurls` TEXT NOT NULL, `joomla_module` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1877,7 +1962,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin_group` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `class_extends` INT(11) NOT NULL DEFAULT 0, `name` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1903,8 +1988,8 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin_updates` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `joomla_plugin` INT(11) NOT NULL DEFAULT 0, - `version_update` TEXT NOT NULL, - `params` text NULL, + `version_update` MEDIUMTEXT NOT NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1934,7 +2019,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin_files_folders_urls `addfoldersfullpath` TEXT NOT NULL, `addurls` TEXT NOT NULL, `joomla_plugin` INT(11) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -1959,83 +2044,53 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin_files_folders_urls -- Dumping data for table `#__componentbuilder_joomla_component` -- -INSERT INTO `#__componentbuilder_joomla_component` (`id`, `add_license`, `license_type`, `mvc_versiondate`, `add_css_admin`, `add_css_site`, `add_email_helper`, `add_javascript`, `add_php_helper_admin`, `add_php_helper_both`, `add_php_helper_site`, `add_php_postflight_install`, `add_php_method_uninstall`, `add_php_postflight_update`, `add_php_preflight_install`, `add_php_preflight_update`, `add_placeholders`, `add_sql`, `add_sql_uninstall`, `addfootable`, `adduikit`, `add_admin_event`, `add_site_event`, `add_update_server`, `add_sales_server`, `sales_server`, `update_server`, `update_server_target`, `update_server_url`, `php_admin_event`, `php_site_event`, `addreadme`, `readme`, `author`, `bom`, `buildcomp`, `buildcompsql`, `companyname`, `component_version`, `copyright`, `creatuserhelper`, `css_admin`, `css_site`, `dashboard`, `dashboard_type`, `debug_linenr`, `description`, `email`, `emptycontributors`, `export_buy_link`, `joomla_source_link`, `export_key`, `image`, `javascript`, `license`, `name`, `system_name`, `toignore`, `name_code`, `number`, `php_helper_admin`, `php_helper_both`, `php_helper_site`, `php_postflight_install`, `php_method_uninstall`, `php_postflight_update`, `php_preflight_install`, `php_preflight_update`, `short_description`, `sql`, `sql_uninstall`, `website`, `published`, `created`, `modified`, `hits`, `ordering`, `whmcs_key`, `whmcs_url`, `guid`) VALUES -(25, '', 1, '', '', '', '', '', '', '', 1, 1, '', '', '', '', '', '', '', '', 1, '', '', 1, '', '', '', 2, 'https://raw.githubusercontent.com/namibia/demo-joomla-3-component/master/demo_updateserver.xml', '', '', 1, 'IyAjIyNDb21wb25lbnRfbmFtZSMjIyAoIyMjVkVSU0lPTiMjIykNCg0KIVsjIyNDb21wb25lbnRfbmFtZSMjIyBpbWFnZV0oaHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL25hbWliaWEvZGVtby1qb29tbGEtMy1jb21wb25lbnQvbWFzdGVyL2FkbWluL2Fzc2V0cy9pbWFnZXMvdmRtLWNvbXBvbmVudC5qcGcgIlRoZSAjIyNDb21wb25lbnRfbmFtZSMjIyIpDQoNCiMjI0RFU0NSSVBUSU9OIyMjDQoNCiMgQnVpbGQgRGV0YWlscw0KDQorICpDb21wYW55KjogWyMjI0NPTVBBTllOQU1FIyMjXSgjIyNBVVRIT1JXRUJTSVRFIyMjKQ0KKyAqQXV0aG9yKjogWyMjI0FVVEhPUiMjI10obWFpbHRvOiMjI0FVVEhPUkVNQUlMIyMjKQ0KKyAqTmFtZSo6IFsjIyNDb21wb25lbnRfbmFtZSMjI10oIyMjQVVUSE9SV0VCU0lURSMjIykNCisgKkZpcnN0IEJ1aWxkKjogIyMjQ1JFQVRJT05EQVRFIyMjDQorICpMYXN0IEJ1aWxkKjogIyMjQlVJTEREQVRFIyMjDQorICpWZXJzaW9uKjogIyMjVkVSU0lPTiMjIw0KKyAqQ29weXJpZ2h0KjogIyMjQ09QWVJJR0hUIyMjDQorICpMaWNlbnNlKjogIyMjTElDRU5TRSMjIw0KDQojIyBCdWlsZCBUaW1lDQoNCioqIyMjdG90YWxIb3VycyMjIyBIb3VycyoqIG9yICoqIyMjdG90YWxEYXlzIyMjIEVpZ2h0IEhvdXIgRGF5cyoqIChhY3R1YWwgdGltZSB0aGUgYXV0aG9yIHNhdmVkIC0NCmR1ZSB0byBbQXV0b21hdGVkIENvbXBvbmVudCBCdWlsZGVyXShodHRwczovL3d3dy52ZG0uaW8vam9vbWxhLWNvbXBvbmVudC1idWlsZGVyKSkNCg0KPiAoaWYgY3JlYXRpbmcgYSBmb2xkZXIgYW5kIGZpbGUgdG9vayAqKjUgc2Vjb25kcyoqIGFuZCB3cml0aW5nIG9uZSBsaW5lIG9mIGNvZGUgdG9vayAqKjEwIHNlY29uZHMqKiwNCj4gbmV2ZXIgbWFraW5nIG9uZSBtaXN0YWtlIG9yIHRha2luZyBhbnkgY29mZmVlIGJyZWFrLikNCg0KKyAqTGluZSBjb3VudCo6ICoqIyMjTElORV9DT1VOVCMjIyoqDQorICpGaWxlIGNvdW50KjogKiojIyNGSUxFX0NPVU5UIyMjKioNCisgKkZvbGRlciBjb3VudCo6ICoqIyMjRk9MREVSX0NPVU5UIyMjKioNCg0KKiojIyNhY3R1YWxIb3Vyc1NwZW50IyMjIEhvdXJzKiogb3IgKiojIyNhY3R1YWxEYXlzU3BlbnQjIyMgRWlnaHQgSG91ciBEYXlzKiogKHRoZSBhY3R1YWwgdGltZSB0aGUgYXV0aG9yIHNwZW50KQ0KDQo+ICh3aXRoIHRoZSBmb2xsb3dpbmcgYnJlYWsgZG93bjoNCj4gKipkZWJ1Z2dpbmcgQCMjI2RlYnVnZ2luZ0hvdXJzIyMjaG91cnMqKiA9IGNvZGluZ3RpbWUgLyA0Ow0KPiAqKnBsYW5uaW5nIEAjIyNwbGFubmluZ0hvdXJzIyMjaG91cnMqKiA9IGNvZGluZ3RpbWUgLyA3Ow0KPiAqKm1hcHBpbmcgQCMjI21hcHBpbmdIb3VycyMjI2hvdXJzKiogPSBjb2Rpbmd0aW1lIC8gMTA7DQo+ICoqb2ZmaWNlIEAjIyNvZmZpY2VIb3VycyMjI2hvdXJzKiogPSBjb2Rpbmd0aW1lIC8gNjspDQoNCioqIyMjYWN0dWFsVG90YWxIb3VycyMjIyBIb3VycyoqIG9yICoqIyMjYWN0dWFsVG90YWxEYXlzIyMjIEVpZ2h0IEhvdXIgRGF5cyoqDQooYSB0b3RhbCBvZiB0aGUgcmVhbGlzdGljIHRpbWUgZnJhbWUgZm9yIHRoaXMgcHJvamVjdCkNCg0KPiAoaWYgY3JlYXRpbmcgYSBmb2xkZXIgYW5kIGZpbGUgdG9vayAqKjUgc2Vjb25kcyoqIGFuZCB3cml0aW5nIG9uZSBsaW5lIG9mIGNvZGUgdG9vayAqKjEwIHNlY29uZHMqKiwNCj4gd2l0aCB0aGUgbm9ybWFsIGV2ZXJ5ZGF5IHJlYWxpdGllcyBhdCB0aGUgb2ZmaWNlLCB0aGF0IGluY2x1ZGVzIHRoZSBjb21wb25lbnQgcGxhbm5pbmcsIG1hcHBpbmcgJiBkZWJ1Z2dpbmcuKQ0KDQpQcm9qZWN0IGR1cmF0aW9uOiAqKiMjI3Byb2plY3RXZWVrVGltZSMjIyB3ZWVrcyoqIG9yICoqIyMjcHJvamVjdE1vbnRoVGltZSMjIyBtb250aHMqKg0KDQo+IFRoaXMgKipjb21wb25lbnQqKiB3YXMgYnVpbGQgd2l0aCBhIEpvb21sYSBbQXV0b21hdGVkIENvbXBvbmVudCBCdWlsZGVyXShodHRwczovL3d3dy52ZG0uaW8vam9vbWxhLWNvbXBvbmVudC1idWlsZGVyKS4NCj4gRGV2ZWxvcGVkIGJ5IFtMbGV3ZWxseW4gdmFuIGRlciBNZXJ3ZV0obWFpbHRvOmpvb21sYUB2ZG0uaW8pDQoNCltDVVNUT01DT0RFPXJlYWRNRWNvbnRyaWJ1dG9yc10=', 'Llewellyn van der Merwe', 'default.txt', '', '', 'Vast Development Method', '2.1.0', 'Copyright (C) 2015. All Rights Reserved', '', '', '', '', 1, '', 'Just a basic demo of the most basic implementations of the [Joomla](http://www.joomla.org) Component Builder\'s ability.', 'joomla@vdm.io', '', '', 'https://github.com/Llewellynvdm/Joomla-Demo-Component', 'hcYWdyvSGveEnSAqqDG8ybLDgwZ50qMcicGZ3GYQkHc=', 'images/vdm/demo500.jpg', '', 'GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html', 'Demo', 'Demo (public)', '.git', 'demo', 4, '', '', 'CS8qKg0KCSAqCUNoYW5nZSB0byBuaWNlIGZhbmN5IGRhdGUNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGZhbmN5RGF0ZSgkZGF0ZSkNCgl7DQoJCWlmICghc2VsZjo6aXNWYWxpZFRpbWVTdGFtcCgkZGF0ZSkpDQoJCXsNCgkJCSRkYXRlID0gc3RydG90aW1lKCRkYXRlKTsNCgkJfQ0KCQlyZXR1cm4gZGF0ZSgnalMgXG9cZiBGIFknLCRkYXRlKTsNCgl9DQoNCgkvKioNCgkgKglDaGFuZ2UgdG8gbmljZSBmYW5jeSB0aW1lIGFuZCBkYXRlDQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBmYW5jeURhdGVUaW1lKCR0aW1lKQ0KCXsNCgkJaWYgKCFzZWxmOjppc1ZhbGlkVGltZVN0YW1wKCR0aW1lKSkNCgkJew0KCQkJJHRpbWUgPSBzdHJ0b3RpbWUoJHRpbWUpOw0KCQl9DQoJCXJldHVybiBkYXRlKCcoRzppKSBqUyBcb1xmIEYgWScsJHRpbWUpOw0KCX0NCg0KCS8qKg0KCSAqCUNoYW5nZSB0byBuaWNlIGhvdXI6bWludXRlcyB0aW1lDQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBmYW5jeVRpbWUoJHRpbWUpDQoJew0KCQlpZiAoIXNlbGY6OmlzVmFsaWRUaW1lU3RhbXAoJHRpbWUpKQ0KCQl7DQoJCQkkdGltZSA9IHN0cnRvdGltZSgkdGltZSk7DQoJCX0NCgkJcmV0dXJuIGRhdGUoJ0c6aScsJHRpbWUpOw0KCX0NCg0KCS8qKg0KCSAqCUNoZWNrIGlmIHN0cmluZyBpcyBhIHZhbGlkIHRpbWUgc3RhbXANCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGlzVmFsaWRUaW1lU3RhbXAoJHRpbWVzdGFtcCkNCgl7DQoJCXJldHVybiAoKGludCkgJHRpbWVzdGFtcCA9PT0gJHRpbWVzdGFtcCkNCgkJJiYgKCR0aW1lc3RhbXAgPD0gUEhQX0lOVF9NQVgpDQoJCSYmICgkdGltZXN0YW1wID49IH5QSFBfSU5UX01BWCk7DQoJfQ0K', 'CQkvLyBHZXQgQXBwbGljYXRpb24gb2JqZWN0DQoJCSRhcHAgPSBKRmFjdG9yeTo6Z2V0QXBwbGljYXRpb24oKTsNCgkJJGFwcC0+ZW5xdWV1ZU1lc3NhZ2UoJ1RoaXMgaXMgYSBkZW1vIGNvbXBvbmVudCBkZXZlbG9wZWQgaW4gPGEgaHJlZj0iaHR0cDovL3ZkbS5iei9jb21wb25lbnQtYnVpbGRlciIgdGFnZXQ9Il9iYWxuayIgdGl0bGU9Ikpvb21sYSBDb21wb25lbnQgQnVpbGRlciI+SkNCPC9hPiEgWW91IGNhbiBidWlsZCBtb3JlIGNvbXBvbmVudHMgbGlrZSB0aGlzIHdpdGggSkNCLCBjaGVja291dCBvdXIgcGFnZSBvbiA8YSBocmVmPSJodHRwczovL2dpdGh1Yi5jb20vdmRtLWlvL0pvb21sYS1Db21wb25lbnQtQnVpbGRlciIgdGFnZXQ9Il9iYWxuayIgdGl0bGU9Ikpvb21sYSBDb21wb25lbnQgQnVpbGRlciI+Z2l0aHViPC9hPiBmb3IgbW9yZSBpbmZvLiBUaGUgZnV0dXJlIG9mIDxhIGhyZWY9Imh0dHA6Ly92ZG0uYnovY29tcG9uZW50LWJ1aWxkZXIiIHRhZ2V0PSJfYmFsbmsiIHRpdGxlPSJKb29tbGEgQ29tcG9uZW50IEJ1aWxkZXIiPkpvb21sYSBDb21wb25lbnQgRGV2ZWxvcG1lbnQ8L2E+IGlzIEhlcmUhJywgJ0luZm8nKTs=', '', '', '', '', 'Demo Component', '', '', 'https://www.vdm.io/', 1, '2016-10-18 11:44:09', '2020-11-17 17:19:57', '', 10, 'G2Rww7JuEI+de+Bm1ljKg72Hgt3MUfutTh1P15UayKU=', '', 'efde995e-60aa-4b39-b644-44349dfb660d'); +INSERT INTO `#__componentbuilder_joomla_component` (`id`, `add_admin_event`, `add_backup_folder_path`, `add_css_admin`, `add_css_site`, `add_email_helper`, `add_git_folder_path`, `add_javascript`, `add_license`, `add_menu_prefix`, `add_namespace_prefix`, `add_php_helper_admin`, `add_php_helper_both`, `add_php_helper_site`, `add_php_method_uninstall`, `add_php_postflight_install`, `add_php_postflight_update`, `add_php_preflight_install`, `add_php_preflight_update`, `add_placeholders`, `add_powers`, `add_sales_server`, `add_site_event`, `add_sql`, `add_sql_uninstall`, `add_update_server`, `addcontributors`, `addfootable`, `addreadme`, `adduikit`, `assets_table_fix`, `author`, `backup_folder_path`, `bom`, `buildcomp`, `buildcompsql`, `companyname`, `component_version`, `copyright`, `created`, `creatuserhelper`, `crowdin_account_api_key`, `crowdin_project_api_key`, `crowdin_project_identifier`, `crowdin_username`, `css_admin`, `css_site`, `dashboard`, `dashboard_type`, `debug_linenr`, `description`, `email`, `emptycontributors`, `export_buy_link`, `export_key`, `git_folder_path`, `guid`, `image`, `javascript`, `joomla_source_link`, `license`, `license_type`, `menu_prefix`, `modified`, `mvc_versiondate`, `name`, `name_code`, `namespace_prefix`, `number`, `php_admin_event`, `php_helper_admin`, `php_helper_both`, `php_helper_site`, `php_method_uninstall`, `php_postflight_install`, `php_postflight_update`, `php_preflight_install`, `php_preflight_update`, `php_site_event`, `readme`, `remove_line_breaks`, `sales_server`, `short_description`, `sql`, `sql_uninstall`, `system_name`, `toignore`, `translation_tool`, `update_server`, `update_server_target`, `update_server_url`, `website`, `whmcs_buy_link`, `whmcs_key`, `whmcs_url`, `params`, `published`, `version`, `hits`, `access`, `ordering`) VALUES +(25, '', '', '', '', '', '', '', '', 1, '', '', '', 1, '', 1, '', '', '', '', 1, '', '', '', '', 1, '{}', '', 1, 1, 3, 'Llewellyn van der Merwe', '', 'default.txt', '', '', 'Vast Development Method', '2.1.0', 'Copyright (C) 2015. All Rights Reserved', '2016-10-18 11:44:09', '', 'mvVkzmHCEIoBhzD3gR3uTzXRGwNVNRWw8Hr1vrXxb+I=', 'BbloLSYT6Yup6v3I/YNmrdOwzjbI4BGfDvJSB82N9DU=', '', 'VtSt2RMz+AHCrwc7jk1G70t83ZwZsNp2upqfzMyaVHE=', '', '', '', 1, '', 'Just a basic demo of the most basic implementations of the [Joomla](http://www.joomla.org) Component Builder\'s ability.', 'joomla@vdm.io', '', '', 'nZDegSPK87rXA4KMC6P8I6zEldjVIJpPYGRPZlKBI+U=', '', 'efde995e-60aa-4b39-b644-44349dfb660d', 'images/vdm/demo500.jpg', '', 'https://github.com/Llewellynvdm/Joomla-Demo-Component', 'GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html', 1, '»', '2024-01-19 11:57:08', '', 'Demo', 'demo', 'JCB', 4, '', '', '', 'CS8qKg0KCSAqCUNoYW5nZSB0byBuaWNlIGZhbmN5IGRhdGUNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGZhbmN5RGF0ZSgkZGF0ZSkNCgl7DQoJCWlmICghc2VsZjo6aXNWYWxpZFRpbWVTdGFtcCgkZGF0ZSkpDQoJCXsNCgkJCSRkYXRlID0gc3RydG90aW1lKCRkYXRlKTsNCgkJfQ0KCQlyZXR1cm4gZGF0ZSgnalMgXG9cZiBGIFknLCRkYXRlKTsNCgl9DQoNCgkvKioNCgkgKglDaGFuZ2UgdG8gbmljZSBmYW5jeSB0aW1lIGFuZCBkYXRlDQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBmYW5jeURhdGVUaW1lKCR0aW1lKQ0KCXsNCgkJaWYgKCFzZWxmOjppc1ZhbGlkVGltZVN0YW1wKCR0aW1lKSkNCgkJew0KCQkJJHRpbWUgPSBzdHJ0b3RpbWUoJHRpbWUpOw0KCQl9DQoJCXJldHVybiBkYXRlKCcoRzppKSBqUyBcb1xmIEYgWScsJHRpbWUpOw0KCX0NCg0KCS8qKg0KCSAqCUNoYW5nZSB0byBuaWNlIGhvdXI6bWludXRlcyB0aW1lDQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBmYW5jeVRpbWUoJHRpbWUpDQoJew0KCQlpZiAoIXNlbGY6OmlzVmFsaWRUaW1lU3RhbXAoJHRpbWUpKQ0KCQl7DQoJCQkkdGltZSA9IHN0cnRvdGltZSgkdGltZSk7DQoJCX0NCgkJcmV0dXJuIGRhdGUoJ0c6aScsJHRpbWUpOw0KCX0NCg0KCS8qKg0KCSAqCUNoZWNrIGlmIHN0cmluZyBpcyBhIHZhbGlkIHRpbWUgc3RhbXANCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGlzVmFsaWRUaW1lU3RhbXAoJHRpbWVzdGFtcCkNCgl7DQoJCXJldHVybiAoKGludCkgJHRpbWVzdGFtcCA9PT0gJHRpbWVzdGFtcCkNCgkJJiYgKCR0aW1lc3RhbXAgPD0gUEhQX0lOVF9NQVgpDQoJCSYmICgkdGltZXN0YW1wID49IH5QSFBfSU5UX01BWCk7DQoJfQ0K', '', 'CQkvLyBHZXQgQXBwbGljYXRpb24gb2JqZWN0DQoJCSRhcHAgPSBGYWN0b3J5OjpnZXRBcHBsaWNhdGlvbigpOw0KCQkkYXBwLT5lbnF1ZXVlTWVzc2FnZSgnVGhpcyBpcyBhIGRlbW8gY29tcG9uZW50IGRldmVsb3BlZCBpbiA8YSBocmVmPSJodHRwOi8vdmRtLmJ6L2NvbXBvbmVudC1idWlsZGVyIiB0YWdldD0iX2JhbG5rIiB0aXRsZT0iSm9vbWxhIENvbXBvbmVudCBCdWlsZGVyIj5KQ0I8L2E+ISBZb3UgY2FuIGJ1aWxkIG1vcmUgY29tcG9uZW50cyBsaWtlIHRoaXMgd2l0aCBKQ0IsIGNoZWNrb3V0IG91ciBwYWdlIG9uIDxhIGhyZWY9Imh0dHBzOi8vZ2l0aHViLmNvbS92ZG0taW8vSm9vbWxhLUNvbXBvbmVudC1CdWlsZGVyIiB0YWdldD0iX2JhbG5rIiB0aXRsZT0iSm9vbWxhIENvbXBvbmVudCBCdWlsZGVyIj5naXRodWI8L2E+IGZvciBtb3JlIGluZm8uIFRoZSBmdXR1cmUgb2YgPGEgaHJlZj0iaHR0cDovL3ZkbS5iei9jb21wb25lbnQtYnVpbGRlciIgdGFnZXQ9Il9iYWxuayIgdGl0bGU9Ikpvb21sYSBDb21wb25lbnQgQnVpbGRlciI+Sm9vbWxhIENvbXBvbmVudCBEZXZlbG9wbWVudDwvYT4gaXMgSGVyZSEnLCAnSW5mbycpOw==', '', '', '', '', 'IyAjIyNDb21wb25lbnRfbmFtZSMjIyAoIyMjVkVSU0lPTiMjIykNCg0KIVsjIyNDb21wb25lbnRfbmFtZSMjIyBpbWFnZV0oaHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL25hbWliaWEvZGVtby1qb29tbGEtMy1jb21wb25lbnQvbWFzdGVyL2FkbWluL2Fzc2V0cy9pbWFnZXMvdmRtLWNvbXBvbmVudC5qcGcgIlRoZSAjIyNDb21wb25lbnRfbmFtZSMjIyIpDQoNCiMjI0RFU0NSSVBUSU9OIyMjDQoNCiMgQnVpbGQgRGV0YWlscw0KDQorICpDb21wYW55KjogWyMjI0NPTVBBTllOQU1FIyMjXSgjIyNBVVRIT1JXRUJTSVRFIyMjKQ0KKyAqQXV0aG9yKjogWyMjI0FVVEhPUiMjI10obWFpbHRvOiMjI0FVVEhPUkVNQUlMIyMjKQ0KKyAqTmFtZSo6IFsjIyNDb21wb25lbnRfbmFtZSMjI10oIyMjQVVUSE9SV0VCU0lURSMjIykNCisgKkZpcnN0IEJ1aWxkKjogIyMjQ1JFQVRJT05EQVRFIyMjDQorICpMYXN0IEJ1aWxkKjogIyMjQlVJTEREQVRFIyMjDQorICpWZXJzaW9uKjogIyMjVkVSU0lPTiMjIw0KKyAqQ29weXJpZ2h0KjogIyMjQ09QWVJJR0hUIyMjDQorICpMaWNlbnNlKjogIyMjTElDRU5TRSMjIw0KDQojIyBCdWlsZCBUaW1lDQoNCioqIyMjdG90YWxIb3VycyMjIyBIb3VycyoqIG9yICoqIyMjdG90YWxEYXlzIyMjIEVpZ2h0IEhvdXIgRGF5cyoqIChhY3R1YWwgdGltZSB0aGUgYXV0aG9yIHNhdmVkIC0NCmR1ZSB0byBbQXV0b21hdGVkIENvbXBvbmVudCBCdWlsZGVyXShodHRwczovL3d3dy52ZG0uaW8vam9vbWxhLWNvbXBvbmVudC1idWlsZGVyKSkNCg0KPiAoaWYgY3JlYXRpbmcgYSBmb2xkZXIgYW5kIGZpbGUgdG9vayAqKjUgc2Vjb25kcyoqIGFuZCB3cml0aW5nIG9uZSBsaW5lIG9mIGNvZGUgdG9vayAqKjEwIHNlY29uZHMqKiwNCj4gbmV2ZXIgbWFraW5nIG9uZSBtaXN0YWtlIG9yIHRha2luZyBhbnkgY29mZmVlIGJyZWFrLikNCg0KKyAqTGluZSBjb3VudCo6ICoqIyMjTElORV9DT1VOVCMjIyoqDQorICpGaWxlIGNvdW50KjogKiojIyNGSUxFX0NPVU5UIyMjKioNCisgKkZvbGRlciBjb3VudCo6ICoqIyMjRk9MREVSX0NPVU5UIyMjKioNCg0KKiojIyNhY3R1YWxIb3Vyc1NwZW50IyMjIEhvdXJzKiogb3IgKiojIyNhY3R1YWxEYXlzU3BlbnQjIyMgRWlnaHQgSG91ciBEYXlzKiogKHRoZSBhY3R1YWwgdGltZSB0aGUgYXV0aG9yIHNwZW50KQ0KDQo+ICh3aXRoIHRoZSBmb2xsb3dpbmcgYnJlYWsgZG93bjoNCj4gKipkZWJ1Z2dpbmcgQCMjI2RlYnVnZ2luZ0hvdXJzIyMjaG91cnMqKiA9IGNvZGluZ3RpbWUgLyA0Ow0KPiAqKnBsYW5uaW5nIEAjIyNwbGFubmluZ0hvdXJzIyMjaG91cnMqKiA9IGNvZGluZ3RpbWUgLyA3Ow0KPiAqKm1hcHBpbmcgQCMjI21hcHBpbmdIb3VycyMjI2hvdXJzKiogPSBjb2Rpbmd0aW1lIC8gMTA7DQo+ICoqb2ZmaWNlIEAjIyNvZmZpY2VIb3VycyMjI2hvdXJzKiogPSBjb2Rpbmd0aW1lIC8gNjspDQoNCioqIyMjYWN0dWFsVG90YWxIb3VycyMjIyBIb3VycyoqIG9yICoqIyMjYWN0dWFsVG90YWxEYXlzIyMjIEVpZ2h0IEhvdXIgRGF5cyoqDQooYSB0b3RhbCBvZiB0aGUgcmVhbGlzdGljIHRpbWUgZnJhbWUgZm9yIHRoaXMgcHJvamVjdCkNCg0KPiAoaWYgY3JlYXRpbmcgYSBmb2xkZXIgYW5kIGZpbGUgdG9vayAqKjUgc2Vjb25kcyoqIGFuZCB3cml0aW5nIG9uZSBsaW5lIG9mIGNvZGUgdG9vayAqKjEwIHNlY29uZHMqKiwNCj4gd2l0aCB0aGUgbm9ybWFsIGV2ZXJ5ZGF5IHJlYWxpdGllcyBhdCB0aGUgb2ZmaWNlLCB0aGF0IGluY2x1ZGVzIHRoZSBjb21wb25lbnQgcGxhbm5pbmcsIG1hcHBpbmcgJiBkZWJ1Z2dpbmcuKQ0KDQpQcm9qZWN0IGR1cmF0aW9uOiAqKiMjI3Byb2plY3RXZWVrVGltZSMjIyB3ZWVrcyoqIG9yICoqIyMjcHJvamVjdE1vbnRoVGltZSMjIyBtb250aHMqKg0KDQo+IFRoaXMgKipjb21wb25lbnQqKiB3YXMgYnVpbGQgd2l0aCBhIEpvb21sYSBbQXV0b21hdGVkIENvbXBvbmVudCBCdWlsZGVyXShodHRwczovL3d3dy52ZG0uaW8vam9vbWxhLWNvbXBvbmVudC1idWlsZGVyKS4NCj4gRGV2ZWxvcGVkIGJ5IFtMbGV3ZWxseW4gdmFuIGRlciBNZXJ3ZV0obWFpbHRvOmpvb21sYUB2ZG0uaW8pDQoNCltDVVNUT01DT0RFPXJlYWRNRWNvbnRyaWJ1dG9yc10=', '', '', 'Demo Component', '', '', 'Demo (public)', '.git', '', '', 2, 'https://raw.githubusercontent.com/namibia/demo-joomla-3-component/master/demo_updateserver.xml', 'https://www.vdm.io/', '', '6GeGhXcYZEQosGCi0ZXeuAj3oXBwARl7OnRm9h3rxPQ=', '', '{\"language_options\":{\"activate\":\"0\",\"use_percentagelanguageadd\":\"1\",\"percentagelanguageadd\":\"50\"},\"joomla_component_headers\":{\"add_admin_component\":\"0\",\"admin_component\":\"\",\"power_admin_component\":[],\"add_site_component\":\"0\",\"site_component\":\"\",\"power_site_component\":[],\"add_admin_helper\":\"0\",\"admin_helper\":\"\",\"power_admin_helper\":[],\"add_site_helper\":\"0\",\"site_helper\":\"\",\"power_site_helper\":[]}}', 1, 54, '', 1, 10); -- --- Dumping data for table `#__componentbuilder_power` +-- Dumping data for table `#__componentbuilder_joomla_plugin` -- -INSERT INTO `#__componentbuilder_power` (`id`, `add_head`, `description`, `extends`, `extends_custom`, `guid`, `head`, `implements`, `implements_custom`, `load_selection`, `main_class_code`, `method_selection`, `name`, `namespace`, `power_version`, `property_selection`, `system_name`, `type`, `use_selection`, `params`, `published`, `created`, `modified`, `version`, `ordering`) VALUES -(1, '', 'Basic shared utilities, a legacy implementation\r\n\r\n@since 3.0.9', '', '', '79d765b3-7319-4988-9730-446c7f347020', '', '', '', '{\"load_selection1\":{\"load\":\"d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac\"},\"load_selection2\":{\"load\":\"1d929017-a5de-4e0f-9b5a-838934857e26\"}}', 'CS8qKg0KCSAqIFRoZSBNYWluIEFjdGl2ZSBMYW5ndWFnZQ0KCSAqIA0KCSAqIEB2YXIgICAgICBzdHJpbmcNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHVibGljIHN0YXRpYyAkbGFuZ1RhZzsNCg0KCS8qKg0KCSAqIENoZWNrIGlmIGhhdmUgYSBzdHJpbmcgd2l0aCBhIGxlbmd0aA0KCSAqDQoJICogQGlucHV0ICAgIHN0cmluZyAgJHN0cmluZyBUaGUgc3RyaW5nIHRvIGNoZWNrDQoJICoNCgkgKiBAcmV0dXJucyBib29sIHRydWUgb24gc3VjY2Vzcw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKg0KCSAqIEBkZXByZWNhdGVkICA0LjAgLSBVc2UgU3RyaW5nSGVscGVyOjpjaGVjaygkc3RyaW5nKTsNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGNoZWNrU3RyaW5nKCRzdHJpbmcpOiBib29sDQoJew0KCQlyZXR1cm4gU3RyaW5nSGVscGVyOjpjaGVjaygkc3RyaW5nKTsNCgl9DQoNCgkvKioNCgkgKiBTaG9ydGVuIGEgc3RyaW5nDQoJICoNCgkgKiBAaW5wdXQgICAgc3RyaW5nICAkc3RyaW5nIFRoYXQgeW91IHdvdWxkIGxpa2UgdG8gc2hvcnRlbg0KCSAqDQoJICogQHJldHVybnMgc3RyaW5nIG9uIHN1Y2Nlc3MNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICoNCgkgKiBAZGVwcmVjYXRlZCAgNC4wIC0gVXNlIFN0cmluZ0hlbHBlcjo6c2hvcnRlbigkc3RyaW5nLCAkbGVuZ3RoLCAkYWRkVGlwKTsNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIHNob3J0ZW4oJHN0cmluZywgJGxlbmd0aCA9IDQwLCAkYWRkVGlwID0gdHJ1ZSkNCgl7DQoJCXJldHVybiBTdHJpbmdIZWxwZXI6OnNob3J0ZW4oJHN0cmluZywgJGxlbmd0aCwgJGFkZFRpcCk7DQoJfQ0KDQoJLyoqDQoJICogTWFraW5nIHN0cmluZ3Mgc2FmZSAodmFyaW91cyB3YXlzKQ0KCSAqDQoJICogQGlucHV0ICAgIHN0cmluZyAgJHN0cmluZyBUaGF0IHlvdSB3b3VsZCBsaWtlIHRvIG1ha2Ugc2FmZQ0KCSAqDQoJICogQHJldHVybnMgc3RyaW5nIG9uIHN1Y2Nlc3MNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICoNCgkgKiBAZGVwcmVjYXRlZCAgNC4wIC0gVXNlIFN0cmluZ0hlbHBlcjo6c2FmZSgkc3RyaW5nLCAkdHlwZSwgJHNwYWNlciwgJHJlcGxhY2VOdW1iZXJzLCAka2VlcE9ubHlDaGFyYWN0ZXJzKTsNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIHNhZmVTdHJpbmcoJHN0cmluZywgJHR5cGUgPSAnTCcsICRzcGFjZXIgPSAnXycsICRyZXBsYWNlTnVtYmVycyA9IHRydWUsICRrZWVwT25seUNoYXJhY3RlcnMgPSB0cnVlKQ0KCXsNCgkJLy8gc2V0IHRoZSBsb2NhbCBjb21wb25lbnQgb3B0aW9uDQoJCXNlbGY6OnNldENvbXBvbmVudE9wdGlvbigpOw0KDQoJCXJldHVybiBTdHJpbmdIZWxwZXI6OnNhZmUoJHN0cmluZywgJHR5cGUsICRzcGFjZXIsICRyZXBsYWNlTnVtYmVycywgJGtlZXBPbmx5Q2hhcmFjdGVycyk7DQoJfQ0KDQoJLyoqDQoJICogTWFraW5nIGNsYXNzIG9yIGZ1bmN0aW9uIG5hbWUgc2FmZQ0KCSAqDQoJICogQGlucHV0CXN0cmluZyAgICAgICBUaGUgbmFtZSB5b3Ugd291bGQgbGlrZSB0byBtYWtlIHNhZmUNCgkgKg0KCSAqIEByZXR1cm5zIHN0cmluZyBvbiBzdWNjZXNzDQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqDQoJICogQGRlcHJlY2F0ZWQgIDQuMCAtIFVzZSBDbGFzc2Z1bmN0aW9uSGVscGVyOjpzYWZlKCRuYW1lKTsNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIHNhZmVDbGFzc0Z1bmN0aW9uTmFtZSgkbmFtZSkNCgl7DQoJCXJldHVybiBDbGFzc2Z1bmN0aW9uSGVscGVyOjpzYWZlKCRuYW1lKTsNCgl9DQoNCgkvKioNCgkgKiBNYWtpbmcgZmllbGQgbmFtZXMgc2FmZQ0KCSAqDQoJICogQGlucHV0CXN0cmluZyAgICAgICBUaGUgeW91IHdvdWxkIGxpa2UgdG8gbWFrZSBzYWZlDQoJICogQGlucHV0CWJvb2xlYW4gICAgICBUaGUgc3dpdGNoIHRvIHJldHVybiBhbiBBTEwgVVBQRVIgQ0FTRSBzdHJpbmcNCgkgKiBAaW5wdXQJc3RyaW5nICAgICAgIFRoZSBzdHJpbmcgdG8gdXNlIGluIHdoaXRlIHNwYWNlDQoJICoNCgkgKiBAcmV0dXJucyBzdHJpbmcgb24gc3VjY2Vzcw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKg0KCSAqIEBkZXByZWNhdGVkICA0LjAgLSBVc2UgRmllbGRIZWxwZXI6OnNhZmUoJHN0cmluZywgJGFsbGNhcCwgJHNwYWNlcik7DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBzYWZlRmllbGROYW1lKCRzdHJpbmcsICRhbGxjYXAgPSBmYWxzZSwgJHNwYWNlciA9ICdfJykNCgl7DQoJCS8vIHNldCB0aGUgbG9jYWwgY29tcG9uZW50IG9wdGlvbg0KCQlzZWxmOjpzZXRDb21wb25lbnRPcHRpb24oKTsNCg0KCQlyZXR1cm4gRmllbGRIZWxwZXI6OnNhZmUoJHN0cmluZywgJGFsbGNhcCwgJHNwYWNlcik7DQoJfQ0KDQoJLyoqDQoJICogTWFraW5nIGZpZWxkIHR5cGUgbmFtZSBzYWZlDQoJICoNCgkgKiBAaW5wdXQJc3RyaW5nICAgICAgIFRoZSB5b3Ugd291bGQgbGlrZSB0byBtYWtlIHNhZmUNCgkgKg0KCSAqIEByZXR1cm5zIHN0cmluZyBvbiBzdWNjZXNzDQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqDQoJICogQGRlcHJlY2F0ZWQgIDQuMCAtIFVzZSBUeXBlSGVscGVyOjpzYWZlKCRzdHJpbmcpOw0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gc2FmZVR5cGVOYW1lKCRzdHJpbmcpDQoJew0KCQkvLyBzZXQgdGhlIGxvY2FsIGNvbXBvbmVudCBvcHRpb24NCgkJc2VsZjo6c2V0Q29tcG9uZW50T3B0aW9uKCk7DQoNCgkJcmV0dXJuIFR5cGVIZWxwZXI6OnNhZmUoJHN0cmluZyk7DQoJfQ0KDQoJLyoqDQoJICogTWFraW5nIG5hbWVzcGFjZSBzYWZlDQoJICoNCgkgKiBAaW5wdXQJc3RyaW5nICAgICAgIFRoZSB5b3Ugd291bGQgbGlrZSB0byBtYWtlIHNhZmUNCgkgKg0KCSAqIEByZXR1cm5zIHN0cmluZyBvbiBzdWNjZXNzDQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqDQoJICogQGRlcHJlY2F0ZWQgIDQuMCAtIFVzZSBOYW1lc3BhY2VIZWxwZXI6OnNhZmUoJHN0cmluZyk7DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBzYWZlTmFtZXNwYWNlKCRzdHJpbmcpDQoJew0KCQlyZXR1cm4gTmFtZXNwYWNlSGVscGVyOjpzYWZlKCRzdHJpbmcpOw0KCX0NCg0KCS8qKg0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKiANCgkgKiBAZGVwcmVjYXRlZCAgNC4wIC0gVXNlIFN0cmluZ0hlbHBlcjo6dHJhbnNsaXRlcmF0ZSgkc3RyaW5nKTsNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIHRyYW5zbGl0ZXJhdGUoJHN0cmluZykNCgl7DQoJCS8vIHNldCB0aGUgbG9jYWwgY29tcG9uZW50IG9wdGlvbg0KCQlzZWxmOjpzZXRDb21wb25lbnRPcHRpb24oKTsNCg0KCQlyZXR1cm4gU3RyaW5nSGVscGVyOjp0cmFuc2xpdGVyYXRlKCRzdHJpbmcpOw0KCX0NCg0KCS8qKg0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKiANCgkgKiBAZGVwcmVjYXRlZCAgNC4wIC0gVXNlIFN0cmluZ0hlbHBlcjo6aHRtbCgkdmFyLCAkY2hhcnNldCwgJHNob3J0ZW4sICRsZW5ndGgpOw0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gaHRtbEVzY2FwZSgkdmFyLCAkY2hhcnNldCA9ICdVVEYtOCcsICRzaG9ydGVuID0gZmFsc2UsICRsZW5ndGggPSA0MCkNCgl7DQoJCS8vIHNldCB0aGUgbG9jYWwgY29tcG9uZW50IG9wdGlvbg0KCQlzZWxmOjpzZXRDb21wb25lbnRPcHRpb24oKTsNCg0KCQlyZXR1cm4gU3RyaW5nSGVscGVyOjpodG1sKCR2YXIsICRjaGFyc2V0LCAkc2hvcnRlbiwgJGxlbmd0aCk7DQoJfQ0KDQoJLyoqDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqIA0KCSAqIEBkZXByZWNhdGVkICA0LjAgLSBVc2UgU3RyaW5nSGVscGVyOjpudW1iZXJzKCRzdHJpbmcpOw0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gcmVwbGFjZU51bWJlcnMoJHN0cmluZykNCgl7DQoJCXJldHVybiBTdHJpbmdIZWxwZXI6Om51bWJlcnMoJHN0cmluZyk7DQoJfQ0KDQoJLyoqDQoJICogQ29udmVydCBhbiBpbnRlZ2VyIGludG8gYW4gRW5nbGlzaCB3b3JkIHN0cmluZw0KCSAqIFRoYW5rcyB0byBUb20gTmljaG9sc29uIDxodHRwOi8vcGhwLm5ldC9tYW51YWwvZW4vZnVuY3Rpb24uc3RydmFsLnBocCM0MTk4OD4NCgkgKg0KCSAqIEBpbnB1dCAgICBpbnQgJHggYW4gaW50DQoJICoNCgkgKiBAcmV0dXJucyBzdHJpbmcgYSBzdHJpbmcNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICoNCgkgKiBAZGVwcmVjYXRlZCAgNC4wIC0gVXNlIFN0cmluZ0hlbHBlcjo6bnVtYmVyKCR4KTsNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIG51bWJlclRvU3RyaW5nKCR4KQ0KCXsNCgkJcmV0dXJuIFN0cmluZ0hlbHBlcjo6bnVtYmVyKCR4KTsNCgl9DQoNCgkvKioNCgkgKiBSYW5kb20gS2V5DQoJICoNCgkgKiBAaW5wdXQgaW50ICRzaXplIHRoZSBsZW5ndGggb2YgdGhlIHN0cmluZw0KCSAqDQoJICogQHJldHVybnMgc3RyaW5nIGEgc3RyaW5nIG9mIHJhbmRvbSBjaGFyYWN0ZXJzDQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqDQoJICogQGRlcHJlY2F0ZWQgIDQuMCAtIFVzZSBTdHJpbmdIZWxwZXI6OnJhbmRvbSgkc2l6ZSk7DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiByYW5kb21rZXkoJHNpemUpOiBzdHJpbmcNCgl7DQoJCXJldHVybiBTdHJpbmdIZWxwZXI6OnJhbmRvbSgkc2l6ZSk7DQoJfQ0KDQoJLyoqDQoJICogQ2hlY2sgaWYgeW91IGhhdmUgYSBqc29uIHN0cmluZw0KCSAqDQoJICogQGlucHV0ICAgIHN0cmluZyAgJHN0cmluZyAgVGhlIGpzb24gc3RyaW5nIHRvIGNoZWNrDQoJICoNCgkgKiBAcmV0dXJucyBib29sIHRydWUgb24gc3VjY2Vzcw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKg0KCSAqIEBkZXByZWNhdGVkICA0LjAgLSBVc2UgSnNvbkhlbHBlcjo6Y2hlY2soJHN0cmluZyk7DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBjaGVja0pzb24oJHN0cmluZyk6IGJvb2wNCgl7DQoJCXJldHVybiBKc29uSGVscGVyOjpjaGVjaygkc3RyaW5nKTsNCgl9DQoNCgkvKioNCgkgKiBAc2luY2UgIDMuMC45DQoJICogDQoJICogQGRlcHJlY2F0ZWQgIDQuMCAtIFVzZSBKc29uSGVscGVyOjpzdHJpbmcoJHZhbHVlLCAkc3BlcmF0b3IsICR0YWJsZSwgJGlkLCAkbmFtZSk7DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBqc29uVG9TdHJpbmcoJHZhbHVlLCAkc3BlcmF0b3IgPSAiLCAiLCAkdGFibGUgPSBudWxsLCAkaWQgPSAnaWQnLCAkbmFtZSA9ICduYW1lJykNCgl7DQoJCXJldHVybiBKc29uSGVscGVyOjpzdHJpbmcoJHZhbHVlLCAkc3BlcmF0b3IsICR0YWJsZSwgJGlkLCAkbmFtZSk7DQoJfQ0KDQoJLyoqDQoJICogQ2hlY2sgaWYgeW91IGhhdmUgYW4gYXJyYXkgd2l0aCBhIGxlbmd0aA0KCSAqDQoJICogQGlucHV0ICAgIG1peGVkICRhcnJheSAgICAgICAgICAgICAgVGhlIGFycmF5IHRvIGNoZWNrDQoJICogQGlucHV0ICAgIGJvb2wgICRyZW1vdmVFbXB0eVN0cmluZyAgU2hvdWxkIHdlIHJlbW92ZSBlbXB0eSB2YWx1ZXMNCgkgKg0KCSAqIEByZXR1cm5zIGludCAgbnVtYmVyIG9mIGl0ZW1zIGluIGFycmF5IG9uIHN1Y2Nlc3MNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICoNCgkgKiBAZGVwcmVjYXRlZCAgNC4wIC0gVXNlIEFycmF5SGVscGVyOjpjaGVjaygkYXJyYXksICRyZW1vdmVFbXB0eVN0cmluZyk7DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBjaGVja0FycmF5KCRhcnJheSwgJHJlbW92ZUVtcHR5U3RyaW5nID0gZmFsc2UpOiBpbnQNCgl7DQoJCXJldHVybiBBcnJheUhlbHBlcjo6Y2hlY2soJGFycmF5LCAkcmVtb3ZlRW1wdHlTdHJpbmcpOw0KCX0NCg0KCS8qKg0KCSAqIE1lcmdlIGFuIGFycmF5IG9mIGFycmF5J3MNCgkgKg0KCSAqIEBpbnB1dCAgICBtaXhlZCAgJGFycmF5cyBUaGUgYXJyYXlzIHlvdSB3b3VsZCBsaWtlIHRvIG1lcmdlDQoJICoNCgkgKiBAcmV0dXJucyBtaXhlZCBhcnJheSBvbiBzdWNjZXNzDQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqDQoJICogQGRlcHJlY2F0ZWQgIDQuMCAtIFVzZSBBcnJheUhlbHBlcjo6bWVyZ2UoJGFycmF5cyk7DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBtZXJnZUFycmF5cygkYXJyYXlzKQ0KCXsNCgkJcmV0dXJuIEFycmF5SGVscGVyOjptZXJnZSgkYXJyYXlzKTsNCgl9DQoNCgkvKioNCgkgKiBDaGVjayBpZiB5b3UgaGF2ZSBhbiBvYmplY3Qgd2l0aCBhIGxlbmd0aA0KCSAqDQoJICogQGlucHV0ICAgIG9iamVjdCAkb2JqZWN0ICBUaGUgb2JqZWN0IHRvIGNoZWNrDQoJICoNCgkgKiBAcmV0dXJucyBib29sIHRydWUgb24gc3VjY2Vzcw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKg0KCSAqIEBkZXByZWNhdGVkICA0LjAgLSBVc2UgT2JqZWN0SGVscGVyOjpjaGVjaygkb2JqZWN0KTsNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGNoZWNrT2JqZWN0KCRvYmplY3QpOiBib29sDQoJew0KCQlyZXR1cm4gT2JqZWN0SGVscGVyOjpjaGVjaygkb2JqZWN0KTsNCgl9DQoNCgkvKioNCgkgKiBHZXQgYSBWYXJpYWJsZSANCgkgKg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgICR0YWJsZSAgICAgICAgVGhlIHRhYmxlIGZyb20gd2hpY2ggdG8gZ2V0IHRoZSB2YXJpYWJsZQ0KCSAqIEBwYXJhbSAgIHN0cmluZyAgICR3aGVyZSAgICAgICAgVGhlIHZhbHVlIHdoZXJlDQoJICogQHBhcmFtICAgc3RyaW5nICAgJHdoZXJlU3RyaW5nICBUaGUgdGFyZ2V0L2ZpZWxkIHN0cmluZyB3aGVyZS9uYW1lDQoJICogQHBhcmFtICAgc3RyaW5nICAgJHdoYXQgICAgICAgICBUaGUgcmV0dXJuIGZpZWxkDQoJICogQHBhcmFtICAgc3RyaW5nICAgJG9wZXJhdG9yICAgICBUaGUgb3BlcmF0b3IgYmV0d2VlbiAkd2hlcmVTdHJpbmcvZmllbGQgYW5kICR3aGVyZS92YWx1ZQ0KCSAqIEBwYXJhbSAgIHN0cmluZyAgICRtYWluICAgICAgICAgVGhlIGNvbXBvbmVudCBpbiB3aGljaCB0aGUgdGFibGUgaXMgZm91bmQNCgkgKg0KCSAqIEByZXR1cm4gIG1peCBzdHJpbmcvaW50L2Zsb2F0DQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqDQoJICogQGRlcHJlY2F0ZWQgIDQuMCAtIFVzZSBHZXRIZWxwZXI6OnZhcigkdGFibGUsICR3aGVyZSwgJHdoZXJlU3RyaW5nLCAkd2hhdCwgJG9wZXJhdG9yLCAkbWFpbik7DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBnZXRWYXIoJHRhYmxlLCAkd2hlcmUgPSBudWxsLCAkd2hlcmVTdHJpbmcgPSAndXNlcicsICR3aGF0ID0gJ2lkJywgJG9wZXJhdG9yID0gJz0nLCAkbWFpbiA9IG51bGwpDQoJew0KCQkvLyBzZXQgdGhlIGxvY2FsIGNvbXBvbmVudCBvcHRpb24NCgkJc2VsZjo6c2V0Q29tcG9uZW50T3B0aW9uKCk7DQoNCgkJcmV0dXJuIEdldEhlbHBlcjo6dmFyKCR0YWJsZSwgJHdoZXJlLCAkd2hlcmVTdHJpbmcsICR3aGF0LCAkb3BlcmF0b3IsICRtYWluKTsNCgl9DQoNCgkvKioNCgkgKiBHZXQgYXJyYXkgb2YgdmFyaWFibGVzDQoJICoNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkdGFibGUgICAgICAgIFRoZSB0YWJsZSBmcm9tIHdoaWNoIHRvIGdldCB0aGUgdmFyaWFibGVzDQoJICogQHBhcmFtICAgc3RyaW5nICAgJHdoZXJlICAgICAgICBUaGUgdmFsdWUgd2hlcmUNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkd2hlcmVTdHJpbmcgIFRoZSB0YXJnZXQvZmllbGQgc3RyaW5nIHdoZXJlL25hbWUNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkd2hhdCAgICAgICAgIFRoZSByZXR1cm4gZmllbGQNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkb3BlcmF0b3IgICAgIFRoZSBvcGVyYXRvciBiZXR3ZWVuICR3aGVyZVN0cmluZy9maWVsZCBhbmQgJHdoZXJlL3ZhbHVlDQoJICogQHBhcmFtICAgc3RyaW5nICAgJG1haW4gICAgICAgICBUaGUgY29tcG9uZW50IGluIHdoaWNoIHRoZSB0YWJsZSBpcyBmb3VuZA0KCSAqIEBwYXJhbSAgIGJvb2wgICAgICR1bmlxdWUgICAgICAgVGhlIHN3aXRjaCB0byByZXR1cm4gYSB1bmlxdWUgYXJyYXkNCgkgKg0KCSAqIEByZXR1cm4gIGFycmF5DQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqDQoJICogQGRlcHJlY2F0ZWQgIDQuMCAtIFVzZSBHZXRIZWxwZXI6OnZhcnMoJHRhYmxlLCAkd2hlcmUsICR3aGVyZVN0cmluZywgJHdoYXQsICRvcGVyYXRvciwgJG1haW4sICR1bmlxdWUpOw0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gZ2V0VmFycygkdGFibGUsICR3aGVyZSA9IG51bGwsICR3aGVyZVN0cmluZyA9ICd1c2VyJywgJHdoYXQgPSAnaWQnLCAkb3BlcmF0b3IgPSAnSU4nLCAkbWFpbiA9IG51bGwsICR1bmlxdWUgPSB0cnVlKQ0KCXsNCgkJLy8gc2V0IHRoZSBsb2NhbCBjb21wb25lbnQgb3B0aW9uDQoJCXNlbGY6OnNldENvbXBvbmVudE9wdGlvbigpOw0KDQoJCXJldHVybiBHZXRIZWxwZXI6OnZhcnMoJHRhYmxlLCAkd2hlcmUsICR3aGVyZVN0cmluZywgJHdoYXQsICRvcGVyYXRvciwgJG1haW4sICR1bmlxdWUpOw0KCX0NCg0KCS8qKg0KCSAqIGdldCBhbGwgc3RyaW5ncyBiZXR3ZWVuIHR3byBvdGhlciBzdHJpbmdzDQoJICoNCgkgKiBAcGFyYW0gIHN0cmluZyAgICAgICAgICAkY29udGVudCAgICBUaGUgY29udGVudCB0byBzZWFyY2gNCgkgKiBAcGFyYW0gIHN0cmluZyAgICAgICAgICAkc3RhcnQgICAgICAgIFRoZSBzdGFydGluZyB2YWx1ZQ0KCSAqIEBwYXJhbSAgc3RyaW5nICAgICAgICAgICRlbmQgICAgICAgICBUaGUgZW5kaW5nIHZhbHVlDQoJICoNCgkgKiBAcmV0dXJuICBhcnJheSAgICAgICAgICBPbiBzdWNjZXNzDQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqDQoJICogQGRlcHJlY2F0ZWQgIDQuMCAtIFVzZSBHZXRIZWxwZXI6OmFsbEJldHdlZW4oJGNvbnRlbnQsICRzdGFydCwgJGVuZCk7DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBnZXRBbGxCZXR3ZWVuKCRjb250ZW50LCAkc3RhcnQsICRlbmQpDQoJew0KCQlyZXR1cm4gR2V0SGVscGVyOjphbGxCZXR3ZWVuKCRjb250ZW50LCAkc3RhcnQsICRlbmQpOw0KCX0NCg0KCS8qKg0KCSAqIGdldCBhIHN0cmluZyBiZXR3ZWVuIHR3byBvdGhlciBzdHJpbmdzDQoJICogDQoJICogQHBhcmFtICBzdHJpbmcgICAgICAgICAgJGNvbnRlbnQgICAgVGhlIGNvbnRlbnQgdG8gc2VhcmNoDQoJICogQHBhcmFtICBzdHJpbmcgICAgICAgICAgJHN0YXJ0ICAgICAgICBUaGUgc3RhcnRpbmcgdmFsdWUNCgkgKiBAcGFyYW0gIHN0cmluZyAgICAgICAgICAkZW5kICAgICAgICAgVGhlIGVuZGluZyB2YWx1ZQ0KCSAqIEBwYXJhbSAgc3RyaW5nICAgICAgICAgICRkZWZhdWx0ICAgICBUaGUgZGVmYXVsdCB2YWx1ZSBpZiBub25lIGZvdW5kDQoJICoNCgkgKiBAcmV0dXJuICBzdHJpbmcgICAgICAgICAgT24gc3VjY2VzcyAvIGVtcHR5IHN0cmluZyBvbiBmYWlsdXJlDQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqDQoJICogQGRlcHJlY2F0ZWQgIDQuMCAtIFVzZSBHZXRIZWxwZXI6OmJldHdlZW4oJGNvbnRlbnQsICRzdGFydCwgJGVuZCwgJGRlZmF1bHQpOw0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gZ2V0QmV0d2VlbigkY29udGVudCwgJHN0YXJ0LCAkZW5kLCAkZGVmYXVsdCA9ICcnKQ0KCXsNCgkJcmV0dXJuIEdldEhlbHBlcjo6YmV0d2VlbigkY29udGVudCwgJHN0YXJ0LCAkZW5kLCAkZGVmYXVsdCk7DQoJfQ0KDQoJLyoqDQoJICogYmMgbWF0aCB3cmFwcGVyICh2ZXJ5IGJhc2ljIG5vdCBmb3IgYWNjb3VudGluZykNCgkgKg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgICR0eXBlICAgIFRoZSB0eXBlIGJjIG1hdGgNCgkgKiBAcGFyYW0gICBpbnQgICAgICAkdmFsMSAgICBUaGUgZmlyc3QgdmFsdWUNCgkgKiBAcGFyYW0gICBpbnQgICAgICAkdmFsMiAgICBUaGUgc2Vjb25kIHZhbHVlDQoJICogQHBhcmFtICAgaW50ICAgICAgJHNjYWxlICAgVGhlIHNjYWxlIHZhbHVlDQoJICoNCgkgKiBAcmV0dXJuIGZsb2F0fGludA0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKg0KCSAqIEBkZXByZWNhdGVkICA0LjAgLSBVc2UgTWF0aEhlbHBlcjo6YmMoJHR5cGUsICR2YWwxLCAkdmFsMiwgJHNjYWxlKTsNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGJjbWF0aCgkdHlwZSwgJHZhbDEsICR2YWwyLCAkc2NhbGUgPSAwKQ0KCXsNCgkJcmV0dXJuIE1hdGhIZWxwZXI6OmJjKCR0eXBlLCAkdmFsMSwgJHZhbDIsICRzY2FsZSk7DQoJfQ0KDQoJLyoqDQoJICogQmFzaWMgc3VtIG9mIGFuIGFycmF5IHdpdGggbW9yZSBwcmVjaXNpb24NCgkgKg0KCSAqIEBwYXJhbSAgIGFycmF5ICAgJGFycmF5ICAgIFRoZSB2YWx1ZXMgdG8gc3VtDQoJICogQHBhcmFtICAgaW50ICAgICAgJHNjYWxlICAgVGhlIHNjYWxlIHZhbHVlDQoJICoNCgkgKiBAcmV0dXJuIGZsb2F0fGludA0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKg0KCSAqIEBkZXByZWNhdGVkICA0LjAgLSBVc2UgTWF0aEhlbHBlcjo6c3VtKCRhcnJheSwgJHNjYWxlKTsNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGJjc3VtKCRhcnJheSwgJHNjYWxlID0gNCkNCgl7DQoJCXJldHVybiBNYXRoSGVscGVyOjpzdW0oJGFycmF5LCAkc2NhbGUpOw0KCX0NCg0KICAgICAgICAvKioNCiAgICAgICAgICogY3JlYXRlIHBsdWdpbiBjbGFzcyBuYW1lDQoJICoNCgkgKiBAaW5wdXQJc3RyaW5nICAgICAgIFRoZSBncm91cCBuYW1lDQoJICogQGlucHV0CXN0cmluZyAgICAgICBUaGUgbmFtZQ0KCSAqDQoJICogQHJldHVybiBzdHJpbmcNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICoNCgkgKiBAZGVwcmVjYXRlZCAgNC4wIC0gVXNlIFBsdWdpbkhlbHBlcjo6c2FmZSgkbmFtZSwgJGdyb3VwKTsNCiAgICAgICAgICovDQogICAgICAgIHB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gY3JlYXRlUGx1Z2luQ2xhc3NOYW1lKCRncm91cCwgJG5hbWUpDQoJew0KCQlyZXR1cm4gUGx1Z2luSGVscGVyOjpzYWZlQ2xhc3NOYW1lKCRuYW1lLCAkZ3JvdXApOw0KCX0NCg0KCS8qKg0KCSAqIFJldHVybnMgYSBHVUlEdjQgc3RyaW5nDQoJICogDQoJICogVGhhbmtzIHRvIERhdmUgUGVhcnNvbiAoYW5kIG90aGVyKQ0KCSAqIGh0dHBzOi8vd3d3LnBocC5uZXQvbWFudWFsL2VuL2Z1bmN0aW9uLmNvbS1jcmVhdGUtZ3VpZC5waHAjMTE5MTY4IA0KCSAqDQoJICogVXNlcyB0aGUgYmVzdCBjcnlwdG9ncmFwaGljYWxseSBzZWN1cmUgbWV0aG9kDQoJICogZm9yIGFsbCBzdXBwb3J0ZWQgcGxhdGZvcm1zIHdpdGggZmFsbGJhY2sgdG8gYW4gb2xkZXIsDQoJICogbGVzcyBzZWN1cmUgdmVyc2lvbi4NCgkgKg0KCSAqIEBwYXJhbSBib29sICR0cmltDQoJICoNCgkgKiBAcmV0dXJuIHN0cmluZw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKg0KCSAqIEBkZXByZWNhdGVkICA0LjAgLSBVc2UgR3VpZEhlbHBlcjo6Z2V0KCR0cmltKTsNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIEdVSUQoJHRyaW0gPSB0cnVlKQ0KCXsNCgkJcmV0dXJuIEd1aWRIZWxwZXI6OmdldCgkdHJpbSk7DQoJfQ0KDQoJLyoqDQoJICogVmFsaWRhdGUgdGhlIEdsb2JhbGx5IFVuaXF1ZSBJZGVudGlmaWVyICggYW5kIGNoZWNrIGlmIHRhYmxlIGFscmVhZHkgaGFzIHRoaXMgaWRlbnRpZmllcikNCgkgKg0KCSAqIEBwYXJhbSBzdHJpbmcgICAgICAgJGd1aWQNCgkgKiBAcGFyYW0gc3RyaW5nICAgICAgICR0YWJsZQ0KCSAqIEBwYXJhbSBpbnQgICAgICAgICAgICAkaWQNCgkgKiBAcGFyYW0gc3RyaW5nfG51bGwgJGNvbXBvbmVudA0KCSAqDQoJICogQHJldHVybiBib29sDQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqDQoJICogQGRlcHJlY2F0ZWQgIDQuMCAtIFVzZSBHdWlkSGVscGVyOjp2YWxpZCgkZ3VpZCwgJHRhYmxlLCAkaWQsICRjb21wb25lbnQpOw0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gdmFsaWRHVUlEKCRndWlkLCAkdGFibGUgPSBudWxsLCAkaWQgPSAwLCAkY29tcG9uZW50ID0gbnVsbCkNCgl7DQoJCS8vIHNldCB0aGUgbG9jYWwgY29tcG9uZW50IG9wdGlvbg0KCQlzZWxmOjpzZXRDb21wb25lbnRPcHRpb24oKTsNCg0KCQlyZXR1cm4gR3VpZEhlbHBlcjo6dmFsaWQoJGd1aWQsICR0YWJsZSwgJGlkLCAkY29tcG9uZW50KTsNCgl9DQoNCgkvKioNCgkgKiBnZXQgdGhlIElURU0gb2YgYSBHVUlEIGJ5IHRhYmxlDQoJICoNCgkgKiBAcGFyYW0gc3RyaW5nICAgICAgICAgICAkZ3VpZA0KCSAqIEBwYXJhbSBzdHJpbmcgICAgICAgICAgICR0YWJsZQ0KCSAqIEBwYXJhbSBzdHJpbmcvYXJyYXkgICR3aGF0DQoJICogQHBhcmFtIHN0cmluZ3xudWxsICAgICRjb21wb25lbnQNCgkgKg0KCSAqIEByZXR1cm4gbWl4DQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqDQoJICogQGRlcHJlY2F0ZWQgIDQuMCAtIFVzZSBHdWlkSGVscGVyOjp2YWxpZCgkZ3VpZCwgJHRhYmxlLCAkaWQsICRjb21wb25lbnQpOw0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gZ2V0R1VJRCgkZ3VpZCwgJHRhYmxlLCAkd2hhdCA9ICdhLmlkJywgJGNvbXBvbmVudCA9IG51bGwpDQoJew0KCQkvLyBzZXQgdGhlIGxvY2FsIGNvbXBvbmVudCBvcHRpb24NCgkJc2VsZjo6c2V0Q29tcG9uZW50T3B0aW9uKCk7DQoNCgkJcmV0dXJuIEd1aWRIZWxwZXI6Oml0ZW0oJGd1aWQsICR0YWJsZSwgJHdoYXQsICRjb21wb25lbnQpOw0KCX0NCg0KCS8qKg0KCSAqIFZhbGlkYXRlIHRoZSBHbG9iYWxseSBVbmlxdWUgSWRlbnRpZmllcg0KCSAqDQoJICogVGhhbmtzIHRvIExld2llDQoJICogaHR0cHM6Ly9zdGFja292ZXJmbG93LmNvbS9hLzE1MTU0NTYvMTQyOTY3Nw0KCSAqDQoJICogQHBhcmFtIHN0cmluZyAkZ3VpZA0KCSAqDQoJICogQHJldHVybiBib29sDQoJICoNCgkgKiBAZGVwcmVjYXRlZCAgNC4wIC0gVXNlIEd1aWRIZWxwZXI6OnZhbGlkYXRlKCRndWlkKTsNCgkgKi8NCglwcm90ZWN0ZWQgc3RhdGljIGZ1bmN0aW9uIHZhbGlkYXRlR1VJRCgkZ3VpZCkNCgl7DQoJCXJldHVybiBHdWlkSGVscGVyOjp2YWxpZGF0ZSgkZ3VpZCk7DQoJfQ0KDQoJLyoqDQoJICogVGhlIHppcHBlciBtZXRob2QNCgkgKiANCgkgKiBAcGFyYW0gIHN0cmluZyAgICR3b3JraW5nRElSICAgIFRoZSBkaXJlY3Rvcnkgd2hlcmUgdGhlIGl0ZW1zIG11c3QgYmUgemlwcGVkDQoJICogQHBhcmFtICBzdHJpbmcgICAkZmlsZXBhdGggICAgICAgICAgVGhlIHBhdGggdG8gd2hlcmUgdGhlIHppcCBmaWxlIG11c3QgYmUgcGxhY2VkDQoJICoNCgkgKiBAcmV0dXJuICBib29sIHRydWUgICBPbiBzdWNjZXNzDQoJICoNCgkgKiBAc2luY2UgIDMuMC45DQoJICoNCgkgKiBAZGVwcmVjYXRlZCAgNC4wIC0gVXNlIEZpbGVIZWxwZXI6OnppcCgkd29ya2luZ0RJUiwgJGZpbGVwYXRoKTsNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIHppcCgkd29ya2luZ0RJUiwgJiRmaWxlcGF0aCkNCgl7DQoJCXJldHVybiBGaWxlSGVscGVyOjp6aXAoJHdvcmtpbmdESVIsICRmaWxlcGF0aCk7DQoJfQ0KDQoJLyoqDQoJICogZ2V0IHRoZSBjb250ZW50IG9mIGEgZmlsZQ0KCSAqDQoJICogQHBhcmFtICBzdHJpbmcgICAgICAgICRwYXRoICAgVGhlIHBhdGggdG8gdGhlIGZpbGUNCgkgKiBAcGFyYW0gIHN0cmluZy9ib29sICAgJG5vbmUgICBUaGUgcmV0dXJuIHZhbHVlIGlmIG5vIGNvbnRlbnQgd2FzIGZvdW5kDQoJICoNCgkgKiBAcmV0dXJuICBzdHJpbmcgICBPbiBzdWNjZXNzDQoJICoNCgkgKiBAc2luY2UgIDMuMC45DQoJICoNCgkgKiBAZGVwcmVjYXRlZCAgNC4wIC0gVXNlIEZpbGVIZWxwZXI6OmdldENvbnRlbnQoJHBhdGgsICRub25lKTsNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGdldEZpbGVDb250ZW50cygkcGF0aCwgJG5vbmUgPSAnJykNCgl7DQoJCXJldHVybiBGaWxlSGVscGVyOjpnZXRDb250ZW50KCRwYXRoLCAkbm9uZSk7DQoJfQ0KDQoJLyoqDQoJICogV3JpdGUgYSBmaWxlIHRvIHRoZSBzZXJ2ZXINCgkgKg0KCSAqIEBwYXJhbSAgc3RyaW5nICAgJHBhdGggICAgVGhlIHBhdGggYW5kIGZpbGUgbmFtZSB3aGVyZSB0byBzYWZlIHRoZSBkYXRhDQoJICogQHBhcmFtICBzdHJpbmcgICAkZGF0YSAgICBUaGUgZGF0YSB0byBzYWZlDQoJICoNCgkgKiBAcmV0dXJuICBib29sIHRydWUgICBPbiBzdWNjZXNzDQoJICoNCgkgKiBAc2luY2UgIDMuMC45DQoJICoNCgkgKiBAZGVwcmVjYXRlZCAgNC4wIC0gVXNlIEZpbGVIZWxwZXI6OndyaXRlKCRwYXRoLCAkZGF0YSk7DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiB3cml0ZUZpbGUoJHBhdGgsICRkYXRhKQ0KCXsNCgkJcmV0dXJuIEZpbGVIZWxwZXI6OndyaXRlKCRwYXRoLCAkZGF0YSk7DQoJfQ0KDQoJLyoqDQoJICogZ2V0IGFsbCB0aGUgZmlsZSBwYXRocyBpbiBmb2xkZXIgYW5kIHN1YiBmb2xkZXJzDQoJICogDQoJICogQHBhcmFtICAgc3RyaW5nICAkZm9sZGVyICAgICBUaGUgbG9jYWwgcGF0aCB0byBwYXJzZQ0KCSAqIEBwYXJhbSAgIGFycmF5ICAgJGZpbGVUeXBlcyAgVGhlIHR5cGUgb2YgZmlsZXMgdG8gZ2V0DQoJICoNCgkgKiBAcmV0dXJuICB2b2lkDQoJICoNCgkgKiBAc2luY2UgIDMuMC45DQoJICoNCgkgKiBAZGVwcmVjYXRlZCAgNC4wIC0gVXNlIEZpbGVIZWxwZXI6OmdldFBhdGhzKCRmb2xkZXIsICRmaWxlVHlwZXMgLCAkcmVjdXJzZSwgJGZ1bGwpOw0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gZ2V0QWxsRmlsZVBhdGhzKCRmb2xkZXIsICRmaWxlVHlwZXMgPSBhcnJheSgnXC5waHAnLCAnXC5qcycsICdcLmNzcycsICdcLmxlc3MnKSwgJHJlY3Vyc2UgPSB0cnVlLCAkZnVsbCA9IHRydWUpDQoJew0KCQlyZXR1cm4gRmlsZUhlbHBlcjo6Z2V0UGF0aHMoJGZvbGRlciwgJGZpbGVUeXBlcyAsICRyZWN1cnNlLCAkZnVsbCk7DQoJfQ0KDQoJLyoqDQoJICogR2V0IHRoZSBmaWxlIHBhdGggb3IgdXJsDQoJICoNCgkgKiBAcGFyYW0gIHN0cmluZyAgICR0eXBlICAgICAgICAgICAgICBUaGUgKHVybC9wYXRoKSB0eXBlIHRvIHJldHVybg0KCSAqIEBwYXJhbSAgc3RyaW5nICAgJHRhcmdldCAgICAgICAgICAgIFRoZSBQYXJhbXMgVGFyZ2V0IG5hbWUgKGlmIHNldCkNCgkgKiBAcGFyYW0gIHN0cmluZyAgICRmaWxlVHlwZSAgICAgICAgICBUaGUga2luZCBvZiBmaWxlbmFtZSB0byBnZW5lcmF0ZSAoaWYgbm90IHNldCBubyBmaWxlIG5hbWUgaXMgZ2VuZXJhdGVkKQ0KCSAqIEBwYXJhbSAgc3RyaW5nICAgJGtleSAgICAgICAgICAgICAgIFRoZSBrZXkgdG8gYWRqdXN0IHRoZSBmaWxlbmFtZSAoaWYgbm90IHNldCBpZ25vcmVkKQ0KCSAqIEBwYXJhbSAgc3RyaW5nICAgJGRlZmF1bHQgICAgICAgICAgIFRoZSBkZWZhdWx0IHBhdGggaWYgbm90IHNldCBpbiBQYXJhbXMgKGZhbGxiYWNrIHBhdGgpDQoJICogQHBhcmFtICBib29sICAgICAkY3JlYXRlSWZOb3RTZXQgICAgVGhlIHN3aXRjaCB0byBjcmVhdGUgdGhlIGZvbGRlciBpZiBub3QgZm91bmQNCgkgKg0KCSAqIEByZXR1cm4gIHN0cmluZyAgICBPbiBzdWNjZXNzIHRoZSBwYXRoIG9yIHVybCBpcyByZXR1cm5lZCBiYXNlZCBvbiB0aGUgdHlwZSByZXF1ZXN0ZWQNCgkgKg0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKg0KCSAqIEBkZXByZWNhdGVkICA0LjAgLSBVc2UgRmlsZUhlbHBlcjo6Z2V0UGF0aCgkdHlwZSwgJHRhcmdldCwgJGZpbGVUeXBlLCAka2V5LCAkZGVmYXVsdCwgJGNyZWF0ZUlmTm90U2V0KTsNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGdldEZpbGVQYXRoKCR0eXBlID0gJ3BhdGgnLCAkdGFyZ2V0ID0gJ2ZpbGVwYXRoJywgJGZpbGVUeXBlID0gbnVsbCwgJGtleSA9ICcnLCAkZGVmYXVsdCA9ICcnLCAkY3JlYXRlSWZOb3RTZXQgPSB0cnVlKQ0KCXsNCgkJLy8gc2V0IHRoZSBsb2NhbCBjb21wb25lbnQgb3B0aW9uDQoJCXNlbGY6OnNldENvbXBvbmVudE9wdGlvbigpOw0KDQoJCXJldHVybiBGaWxlSGVscGVyOjpnZXRQYXRoKCR0eXBlLCAkdGFyZ2V0LCAkZmlsZVR5cGUsICRrZXksICRkZWZhdWx0LCAkY3JlYXRlSWZOb3RTZXQpOw0KCX0NCg0KCS8qKg0KCSAqIENoZWNrIGlmIGZpbGUgZXhpc3QNCgkgKg0KCSAqIEBwYXJhbSAgc3RyaW5nICAgJHBhdGggICBUaGUgdXJsL3BhdGggdG8gY2hlY2sNCgkgKg0KCSAqIEByZXR1cm4gIGJvb2wgICAgICBJZiBleGlzdCB0cnVlDQoJICoNCgkgKiBAc2luY2UgIDMuMC45DQoJICoNCgkgKiBAZGVwcmVjYXRlZCAgNC4wIC0gVXNlIEZpbGVIZWxwZXI6OmV4aXN0cygkcGF0aCk7DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiB1cmxFeGlzdHMoJHBhdGgpDQoJew0KCQlyZXR1cm4gRmlsZUhlbHBlcjo6ZXhpc3RzKCRwYXRoKTsNCgl9DQoNCgkvKioNCgkgKiBTZXQgdGhlIGNvbXBvbmVudCBvcHRpb24NCgkgKg0KCSAqIEBwYXJhbSAgIFN0cmluZ3xudWxsICAgICAgICRvcHRpb24gICAgVGhlIG9wdGlvbiBmb3IgdGhlIGNvbXBvbmVudC4NCgkgKg0KCSAqIEBzaW5jZSAgMy4wLjExDQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBzZXRDb21wb25lbnRPcHRpb24oJG9wdGlvbiA9IG51bGwpDQoJew0KCQkvLyBzZXQgdGhlIGxvY2FsIGNvbXBvbmVudCBvcHRpb24NCgkJaWYgKGVtcHR5KCRvcHRpb24pKQ0KCQl7DQoJCQlpZiAoZW1wdHkoSGVscGVyOjokb3B0aW9uKSAmJiBwcm9wZXJ0eV9leGlzdHMoX19DTEFTU19fLCAnQ29tcG9uZW50Q29kZU5hbWUnKSkNCgkJCXsNCgkJCQlIZWxwZXI6OiRvcHRpb24gPSAnY29tXycgLiBzZWxmOjokQ29tcG9uZW50Q29kZU5hbWU7DQoJCQl9DQoJCX0NCgkJZWxzZQ0KCQl7DQoJCQlIZWxwZXI6OiRvcHRpb24gPSAkb3B0aW9uOw0KCQl9DQoJfQ0K', '{}', 'Utilities', 'VDM\\Joomla\\Utilities', '1.0.0', '{}', 'Utilities', 'trait', '{\"use_selection0\":{\"use\":\"1f28cb53-60d9-4db1-b517-3c7dc6b429ef\",\"as\":\"default\"},\"use_selection1\":{\"use\":\"4b225c51-d293-48e4-b3f6-5136cf5c3f18\",\"as\":\"default\"},\"use_selection2\":{\"use\":\"0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a\",\"as\":\"default\"},\"use_selection3\":{\"use\":\"91004529-94a9-4590-b842-e7c6b624ecf5\",\"as\":\"default\"},\"use_selection4\":{\"use\":\"152c8793-8b75-4715-996a-257b9f65451c\",\"as\":\"default\"},\"use_selection5\":{\"use\":\"db87c339-5bb6-4291-a7ef-2c48ea1b06bc\",\"as\":\"default\"},\"use_selection6\":{\"use\":\"9c513baf-b279-43fd-ae29-a585c8cbc4f0\",\"as\":\"default\"},\"use_selection7\":{\"use\":\"a223b31e-ea1d-4cdf-92ae-5f9becffaff0\",\"as\":\"default\"},\"use_selection8\":{\"use\":\"9ef0eb24-aae4-4f5a-99af-d724db44808f\",\"as\":\"default\"},\"use_selection9\":{\"use\":\"a8935cbe-7701-40dc-bfd5-675f2d600954\",\"as\":\"default\"},\"use_selection10\":{\"use\":\"30c5b4c2-f75f-4d15-869a-f8bfedd87358\",\"as\":\"default\"},\"use_selection11\":{\"use\":\"ce8cf834-6bac-44fb-941c-861f7e046cc0\",\"as\":\"default\"},\"use_selection12\":{\"use\":\"3cf76fbf-fd95-4a33-878e-7aff6d36b7f6\",\"as\":\"default\"},\"use_selection13\":{\"use\":\"640b5352-fb09-425f-a26e-cd44eda03f15\",\"as\":\"default\"}}', '', 1, '2021-11-06 13:25:19', '2022-08-20 21:09:53', 71, 1), -(5, 1, '', '', '', 'db4a1e4d-be59-4e87-8b4d-c40512752232', 'dXNlIEpvb21sYVxDTVNcSHR0cFxIdHRwIGFzIEJhc2VIdHRwOw0KdXNlIEpvb21sYVxDTVNcSHR0cFxIdHRwRmFjdG9yeTsNCnVzZSBKb29tbGFcUmVnaXN0cnlcUmVnaXN0cnk7', '', '', '{\"load_selection0\":{\"load\":\"aa253bac-f4b4-41b4-8ace-071a73fc4d96\"},\"load_selection1\":{\"load\":\"c65aaf1f-817c-49a2-8202-282e3904f5b1\"},\"load_selection2\":{\"load\":\"51195163-1e87-4251-b755-a03c376798a6\"},\"load_selection3\":{\"load\":\"ef011ee1-64f0-4048-b013-777473b727dd\"},\"load_selection4\":{\"load\":\"c4a188de-ad78-4a6d-9d5b-01866846d701\"}}', 'CS8qKg0KCSAqIE9wdGlvbnMgZm9yIHRoZSBHaXRlYSBvYmplY3QuDQoJICoNCgkgKiBAdmFyICAgIGFycmF5DQoJICogQHNpbmNlICAxLjANCgkgKi8NCglwcm90ZWN0ZWQgJG9wdGlvbnM7DQoNCgkvKioNCgkgKiBUaGUgSFRUUCBjbGllbnQgb2JqZWN0IHRvIHVzZSBpbiBzZW5kaW5nIEhUVFAgcmVxdWVzdHMuDQoJICoNCgkgKiBAdmFyICAgIEJhc2VIdHRwDQoJICogQHNpbmNlICAxLjANCgkgKi8NCglwcm90ZWN0ZWQgJGNsaWVudDsNCg0KCS8qKg0KCSAqIENvbnN0cnVjdG9yLg0KCSAqDQoJICogQHBhcmFtICAgUmVnaXN0cnkgICRvcHRpb25zICBHaXRlYSBvcHRpb25zIG9iamVjdC4NCgkgKiBAcGFyYW0gICBIdHRwICAgICAgJGNsaWVudCAgIFRoZSBIVFRQIGNsaWVudCBvYmplY3QuDQoJICoNCgkgKiBAc2luY2UgICAxLjANCgkgKi8NCglwdWJsaWMgZnVuY3Rpb24gX19jb25zdHJ1Y3QoUmVnaXN0cnkgJG9wdGlvbnMgPSBudWxsLCBCYXNlSHR0cCAkY2xpZW50ID0gbnVsbCkNCgl7DQoJCSR0aGlzLT5vcHRpb25zID0gJG9wdGlvbnMgPzogbmV3IFJlZ2lzdHJ5Ow0KDQoJCS8vIFNldHVwIHRoZSBkZWZhdWx0IHVzZXIgYWdlbnQgaWYgbm90IGFscmVhZHkgc2V0Lg0KCQlpZiAoISR0aGlzLT5nZXRPcHRpb24oJ3VzZXJBZ2VudCcpKQ0KCQl7DQoJCQkkdGhpcy0+c2V0T3B0aW9uKCd1c2VyQWdlbnQnLCAnSkdpdGVhLzEuMCcpOw0KCQl9DQoNCgkJLy8gU2V0dXAgdGhlIGRlZmF1bHQgQVBJIHVybCBpZiBub3QgYWxyZWFkeSBzZXQuDQoJCWlmICghJHRoaXMtPmdldE9wdGlvbignYXBpLnVybCcpKQ0KCQl7DQoJCQkkdGhpcy0+c2V0T3B0aW9uKCdhcGkudXJsJywgJ1tbW2dpdGVhX2FwaV91cmxdXV0nKTsNCgkJfQ0KDQoJCSR0aGlzLT5jbGllbnQgPSAkY2xpZW50ID86IChuZXcgSHR0cEZhY3RvcnkpLT5nZXRIdHRwKCR0aGlzLT5vcHRpb25zKTsNCgl9DQoNCgkvKioNCgkgKiBNYWdpYyBtZXRob2QgdG8gbGF6aWx5IGNyZWF0ZSBBUEkgb2JqZWN0cw0KCSAqDQoJICogQHBhcmFtICAgc3RyaW5nICAkbmFtZSAgTmFtZSBvZiBwcm9wZXJ0eSB0byByZXRyaWV2ZQ0KCSAqDQoJICogQHJldHVybiAgQWJzdHJhY3RHaXRlYU9iamVjdCAgR2l0ZWEgQVBJIG9iamVjdCAoaXNzdWVzLCBwdWxscywgZXRjKS4NCgkgKg0KCSAqIEBzaW5jZSAgIDEuMA0KCSAqIEB0aHJvd3MgIFxJbnZhbGlkQXJndW1lbnRFeGNlcHRpb24gSWYgJG5hbWUgaXMgbm90IGEgdmFsaWQgc3ViIGNsYXNzLg0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiBfX2dldCgkbmFtZSkNCgl7DQoJCSRjbGFzcyA9ICdcXFZETVxcR2l0ZWFcXFBhY2thZ2VcXCcgLiB1Y2ZpcnN0KCRuYW1lKTsNCg0KCQlpZiAoY2xhc3NfZXhpc3RzKCRjbGFzcykpDQoJCXsNCgkJCWlmIChpc3NldCgkdGhpcy0+JG5hbWUpID09IGZhbHNlKQ0KCQkJew0KCQkJCSR0aGlzLT4kbmFtZSA9IG5ldyAkY2xhc3MoJHRoaXMtPm9wdGlvbnMsICR0aGlzLT5jbGllbnQpOw0KCQkJfQ0KDQoJCQlyZXR1cm4gJHRoaXMtPiRuYW1lOw0KCQl9DQoNCgkJdGhyb3cgbmV3IFxJbnZhbGlkQXJndW1lbnRFeGNlcHRpb24oc3ByaW50ZignQXJndW1lbnQgJXMgcHJvZHVjZWQgYW4gaW52YWxpZCBjbGFzcyBuYW1lOiAlcycsICRuYW1lLCAkY2xhc3MpKTsNCgl9DQoNCgkvKioNCgkgKiBHZXQgYW4gb3B0aW9uIGZyb20gdGhlIEdpdGVhIGluc3RhbmNlLg0KCSAqDQoJICogQHBhcmFtICAgc3RyaW5nICAka2V5ICBUaGUgbmFtZSBvZiB0aGUgb3B0aW9uIHRvIGdldC4NCgkgKg0KCSAqIEByZXR1cm4gIG1peGVkICBUaGUgb3B0aW9uIHZhbHVlLg0KCSAqDQoJICogQHNpbmNlICAgMS4wDQoJICovDQoJcHVibGljIGZ1bmN0aW9uIGdldE9wdGlvbigka2V5KQ0KCXsNCgkJcmV0dXJuIGlzc2V0KCR0aGlzLT5vcHRpb25zWyRrZXldKSA/ICR0aGlzLT5vcHRpb25zWyRrZXldIDogbnVsbDsNCgl9DQoNCgkvKioNCgkgKiBTZXQgYW4gb3B0aW9uIGZvciB0aGUgR2l0ZWEgaW5zdGFuY2UuDQoJICoNCgkgKiBAcGFyYW0gICBzdHJpbmcgICRrZXkgICAgVGhlIG5hbWUgb2YgdGhlIG9wdGlvbiB0byBzZXQuDQoJICogQHBhcmFtICAgbWl4ZWQgICAkdmFsdWUgIFRoZSBvcHRpb24gdmFsdWUgdG8gc2V0Lg0KCSAqDQoJICogQHJldHVybiAgR2l0ZWEgIFRoaXMgb2JqZWN0IGZvciBtZXRob2QgY2hhaW5pbmcuDQoJICoNCgkgKiBAc2luY2UgICAxLjANCgkgKi8NCglwdWJsaWMgZnVuY3Rpb24gc2V0T3B0aW9uKCRrZXksICR2YWx1ZSkNCgl7DQoJCSR0aGlzLT5vcHRpb25zWyRrZXldID0gJHZhbHVlOw0KDQoJCXJldHVybiAkdGhpczsNCgl9DQo=', '{}', 'Gitea', 'VDM\\Gitea\\Gitea', '1.0.0', '{}', 'Gitea', 'class', '{}', '', 1, '2021-12-03 14:18:38', '2022-07-09 13:56:22', 27, 4), -(6, 1, '', '', '', 'aa253bac-f4b4-41b4-8ace-071a73fc4d96', 'dXNlIEpvb21sYVxDTVNcSHR0cFxIdHRwIGFzIEJhc2VIdHRwOw0KdXNlIEpvb21sYVxDTVNcSHR0cFxIdHRwRmFjdG9yeTsNCnVzZSBKb29tbGFcQ01TXEh0dHBcUmVzcG9uc2U7DQp1c2UgSm9vbWxhXFJlZ2lzdHJ5XFJlZ2lzdHJ5Ow0KdXNlIEpvb21sYVxVcmlcVXJpOw==', '', '', '{}', 'CS8qKg0KCSAqIE9wdGlvbnMgZm9yIHRoZSBHaXRlYSBvYmplY3QuDQoJICoNCgkgKiBAdmFyICAgIFJlZ2lzdHJ5DQoJICogQHNpbmNlICAxLjANCgkgKi8NCglwcm90ZWN0ZWQgJG9wdGlvbnM7DQoNCgkvKioNCgkgKiBUaGUgSFRUUCBjbGllbnQgb2JqZWN0IHRvIHVzZSBpbiBzZW5kaW5nIEhUVFAgcmVxdWVzdHMuDQoJICoNCgkgKiBAdmFyICAgIEJhc2VIdHRwDQoJICogQHNpbmNlICAxLjANCgkgKi8NCglwcm90ZWN0ZWQgJGNsaWVudDsNCg0KCS8qKg0KCSAqIFRoZSBwYWNrYWdlIHRoZSBvYmplY3QgcmVzaWRlcyBpbg0KCSAqDQoJICogQHZhciAgICBzdHJpbmcNCgkgKiBAc2luY2UgIDEuMA0KCSAqLw0KCXByb3RlY3RlZCAkcGFja2FnZSA9ICcnOw0KDQoJLyoqDQoJICogQ29uc3RydWN0b3IuDQoJICoNCgkgKiBAcGFyYW0gICBSZWdpc3RyeSAgJG9wdGlvbnMgIEdpdGVhIG9wdGlvbnMgb2JqZWN0Lg0KCSAqIEBwYXJhbSAgIEJhc2VIdHRwICAkY2xpZW50ICAgVGhlIEhUVFAgY2xpZW50IG9iamVjdC4NCgkgKg0KCSAqIEBzaW5jZSAgIDEuMA0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiBfX2NvbnN0cnVjdChSZWdpc3RyeSAkb3B0aW9ucyA9IG51bGwsIEJhc2VIdHRwICRjbGllbnQgPSBudWxsKQ0KCXsNCgkJJHRoaXMtPm9wdGlvbnMgPSAkb3B0aW9ucyA/OiBuZXcgUmVnaXN0cnk7DQoJCSR0aGlzLT5jbGllbnQgID0gJGNsaWVudCA/OiAobmV3IEh0dHBGYWN0b3J5KS0+Z2V0SHR0cCgkdGhpcy0+b3B0aW9ucyk7DQoNCgkJJHRoaXMtPnBhY2thZ2UgPSBcZ2V0X2NsYXNzKCR0aGlzKTsNCgkJJHRoaXMtPnBhY2thZ2UgPSBzdWJzdHIoJHRoaXMtPnBhY2thZ2UsIHN0cnJwb3MoJHRoaXMtPnBhY2thZ2UsICdcXCcpICsgMSk7DQoJfQ0KDQoJLyoqDQoJICogTWV0aG9kIHRvIGJ1aWxkIGFuZCByZXR1cm4gYSBmdWxsIHJlcXVlc3QgVVJMIGZvciB0aGUgcmVxdWVzdC4gIFRoaXMgbWV0aG9kIHdpbGwNCgkgKiBhZGQgYXBwcm9wcmlhdGUgcGFnaW5hdGlvbiBkZXRhaWxzIGlmIG5lY2Vzc2FyeSBhbmQgYWxzbyBwcmVwZW5kIHRoZSBBUEkgdXJsDQoJICogdG8gaGF2ZSBhIGNvbXBsZXRlIFVSTCBmb3IgdGhlIHJlcXVlc3QuDQoJICoNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkcGF0aCAgIFVSTCB0byBpbmZsZWN0DQoJICogQHBhcmFtICAgaW50ZWdlciAgJHBhZ2UgICBQYWdlIHRvIHJlcXVlc3QNCgkgKiBAcGFyYW0gICBpbnRlZ2VyICAkbGltaXQgIE51bWJlciBvZiByZXN1bHRzIHRvIHJldHVybiBwZXIgcGFnZQ0KCSAqDQoJICogQHJldHVybiAgVXJpDQoJICoNCgkgKiBAc2luY2UgICAxLjANCgkgKi8NCglwcm90ZWN0ZWQgZnVuY3Rpb24gZmV0Y2hVcmwoJHBhdGgsICRwYWdlID0gMCwgJGxpbWl0ID0gMCkNCgl7DQoJCS8vIEdldCBhIG5ldyBVcmkgb2JqZWN0IGZvY3VzaW5nIHRoZSBhcGkgdXJsIGFuZCBnaXZlbiBwYXRoLg0KCQkkdXJpID0gbmV3IFVyaSgkdGhpcy0+b3B0aW9ucy0+Z2V0KCdhcGkudXJsJykgLiAkcGF0aCk7DQoNCgkJaWYgKCR0aGlzLT5vcHRpb25zLT5nZXQoJ2FjY2Vzcy50b2tlbicsIGZhbHNlKSkNCgkJew0KCQkJLy8gVXNlIG9BdXRoIGF1dGhlbnRpY2F0aW9uDQoJCQkkaGVhZGVycyA9ICR0aGlzLT5jbGllbnQtPmdldE9wdGlvbignaGVhZGVycycsIGFycmF5KCkpOw0KDQoJCQlpZiAoIWlzc2V0KCRoZWFkZXJzWydBdXRob3JpemF0aW9uJ10pKQ0KCQkJew0KCQkJCSRoZWFkZXJzWydBdXRob3JpemF0aW9uJ10gPSAndG9rZW4gJyAuICR0aGlzLT5vcHRpb25zLT5nZXQoJ2FjY2Vzcy50b2tlbicpOw0KCQkJCSR0aGlzLT5jbGllbnQtPnNldE9wdGlvbignaGVhZGVycycsICRoZWFkZXJzKTsNCgkJCX0NCgkJfQ0KCQllbHNlDQoJCXsNCgkJCS8vIFVzZSBiYXNpYyBhdXRoZW50aWNhdGlvbg0KCQkJaWYgKCR0aGlzLT5vcHRpb25zLT5nZXQoJ2FwaS51c2VybmFtZScsIGZhbHNlKSkNCgkJCXsNCgkJCQkkdXJpLT5zZXRVc2VyKCR0aGlzLT5vcHRpb25zLT5nZXQoJ2FwaS51c2VybmFtZScpKTsNCgkJCX0NCg0KCQkJaWYgKCR0aGlzLT5vcHRpb25zLT5nZXQoJ2FwaS5wYXNzd29yZCcsIGZhbHNlKSkNCgkJCXsNCgkJCQkkdXJpLT5zZXRQYXNzKCR0aGlzLT5vcHRpb25zLT5nZXQoJ2FwaS5wYXNzd29yZCcpKTsNCgkJCX0NCgkJfQ0KDQoJCS8vIElmIHdlIGhhdmUgYSBkZWZpbmVkIHBhZ2UgbnVtYmVyIGFkZCBpdCB0byB0aGUgSlVyaSBvYmplY3QuDQoJCWlmICgkcGFnZSA+IDApDQoJCXsNCgkJCSR1cmktPnNldFZhcigncGFnZScsIChpbnQpICRwYWdlKTsNCgkJfQ0KDQoJCS8vIElmIHdlIGhhdmUgYSBkZWZpbmVkIGl0ZW1zIHBlciBwYWdlIGFkZCBpdCB0byB0aGUgSlVyaSBvYmplY3QuDQoJCWlmICgkbGltaXQgPiAwKQ0KCQl7DQoJCQkkdXJpLT5zZXRWYXIoJ2xpbWl0JywgKGludCkgJGxpbWl0KTsNCgkJfQ0KDQoJCXJldHVybiAkdXJpOw0KCX0NCg0KCS8qKg0KCSAqIFByb2Nlc3MgdGhlIHJlc3BvbnNlIGFuZCBkZWNvZGUgaXQuDQoJICoNCgkgKiBAcGFyYW0gICBSZXNwb25zZSAgJHJlc3BvbnNlICAgICAgVGhlIHJlc3BvbnNlLg0KCSAqIEBwYXJhbSAgIGludGVnZXIgICAkZXhwZWN0ZWRDb2RlICBUaGUgZXhwZWN0ZWQgImdvb2QiIGNvZGUuDQoJICoNCgkgKiBAcmV0dXJuICBtaXhlZA0KCSAqDQoJICogQHNpbmNlICAgMS4wDQoJICogQHRocm93cyAgUnVudGltZUV4Y2VwdGlvbg0KCSAqLw0KCXByb3RlY3RlZCBmdW5jdGlvbiBwcm9jZXNzUmVzcG9uc2UoUmVzcG9uc2UgJHJlc3BvbnNlLCAkZXhwZWN0ZWRDb2RlID0gMjAwKQ0KCXsNCgkJLy8gVmFsaWRhdGUgdGhlIHJlc3BvbnNlIGNvZGUuDQoJCWlmICgkcmVzcG9uc2UtPmNvZGUgIT0gJGV4cGVjdGVkQ29kZSkNCgkJew0KCQkJLy8gRGVjb2RlIHRoZSBlcnJvciByZXNwb25zZSBhbmQgdGhyb3cgYW4gZXhjZXB0aW9uLg0KCQkJJGVycm9yICAgPSBqc29uX2RlY29kZSgkcmVzcG9uc2UtPmJvZHkpOw0KCQkJJG1lc3NhZ2UgPSBpc3NldCgkZXJyb3ItPm1lc3NhZ2UpID8gJGVycm9yLT5tZXNzYWdlIDogJ0ludmFsaWQgcmVzcG9uc2UgcmVjZWl2ZWQgZnJvbSBHaXRlYS4nOw0KDQoJCQl0aHJvdyBuZXcgXERvbWFpbkV4Y2VwdGlvbigkbWVzc2FnZSwgJHJlc3BvbnNlLT5jb2RlKTsNCgkJfQ0KDQoJCWlmIChKc29uSGVscGVyOjpjaGVjaygkcmVzcG9uc2UtPmJvZHkpKQ0KCQl7DQoJCQkkYm9keSA9IGpzb25fZGVjb2RlKCRyZXNwb25zZS0+Ym9keSk7DQoNCgkJCWlmIChpc3NldCgkYm9keS0+Y29udGVudF9iYXNlNjQpKQ0KCQkJew0KCQkJCSRib2R5LT5jb250ZW50ID0gYmFzZTY0X2RlY29kZSgkYm9keS0+Y29udGVudF9iYXNlNjQpOw0KCQkJfQ0KCQl9DQoJCWVsc2UNCgkJew0KCQkJJGJvZHkgPSAkcmVzcG9uc2UtPmJvZHk7DQoJCX0NCg0KCQlyZXR1cm4gJGJvZHk7DQoJfQ0K', '{}', 'AbstractGiteaObject', 'VDM\\Gitea\\AbstractGiteaObject', '1.0.0', '{}', 'Abstract Gitea Object', 'abstract class', '{\"use_selection0\":{\"use\":\"4b225c51-d293-48e4-b3f6-5136cf5c3f18\",\"as\":\"default\"}}', '', 1, '2021-12-03 16:00:26', '2022-07-09 12:15:49', 20, 4), -(7, 1, '', 'aa253bac-f4b4-41b4-8ace-071a73fc4d96', '', 'c65aaf1f-817c-49a2-8202-282e3904f5b1', 'dXNlIEpvb21sYVxDTVNcSHR0cFxIdHRwIGFzIEJhc2VIdHRwOw0KdXNlIEpvb21sYVxSZWdpc3RyeVxSZWdpc3RyeTs=', '', '', '{}', 'CS8qKg0KCSAqIENvbnN0cnVjdG9yLg0KCSAqDQoJICogQHBhcmFtICAgUmVnaXN0cnkgICRvcHRpb25zICBHaXRlYSBvcHRpb25zIG9iamVjdC4NCgkgKiBAcGFyYW0gICBIdHRwICAgICAgJGNsaWVudCAgIFRoZSBIVFRQIGNsaWVudCBvYmplY3QuDQoJICoNCgkgKiBAc2luY2UgICAxLjANCgkgKi8NCglwdWJsaWMgZnVuY3Rpb24gX19jb25zdHJ1Y3QoUmVnaXN0cnkgJG9wdGlvbnMgPSBudWxsLCBCYXNlSHR0cCAkY2xpZW50ID0gbnVsbCkNCgl7DQoJCXBhcmVudDo6X19jb25zdHJ1Y3QoJG9wdGlvbnMsICRjbGllbnQpOw0KDQoJCSR0aGlzLT5wYWNrYWdlID0gXGdldF9jbGFzcygkdGhpcyk7DQoJCSR0aGlzLT5wYWNrYWdlID0gc3Vic3RyKCR0aGlzLT5wYWNrYWdlLCBzdHJycG9zKCR0aGlzLT5wYWNrYWdlLCAnXFwnKSArIDEpOw0KCX0NCg0KCS8qKg0KCSAqIE1hZ2ljIG1ldGhvZCB0byBsYXppbHkgY3JlYXRlIEFQSSBvYmplY3RzDQoJICoNCgkgKiBAcGFyYW0gICBzdHJpbmcgICRuYW1lICBOYW1lIG9mIHByb3BlcnR5IHRvIHJldHJpZXZlDQoJICoNCgkgKiBAc2luY2UgICAxLjANCgkgKiBAdGhyb3dzIFxJbnZhbGlkQXJndW1lbnRFeGNlcHRpb24NCgkgKg0KCSAqIEByZXR1cm4gIEFic3RyYWN0UGFja2FnZSAgR2l0ZWEgQVBJIHBhY2thZ2Ugb2JqZWN0Lg0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiBfX2dldCgkbmFtZSkNCgl7DQoJCSRjbGFzcyA9ICdcXFZETVxcR2l0ZWFcXFBhY2thZ2VcXCcgLiAkdGhpcy0+cGFja2FnZSAuICdcXCcgLiB1Y2ZpcnN0KCRuYW1lKTsNCg0KCQlpZiAoY2xhc3NfZXhpc3RzKCRjbGFzcykgPT0gZmFsc2UpDQoJCXsNCgkJCXRocm93IG5ldyBcSW52YWxpZEFyZ3VtZW50RXhjZXB0aW9uKA0KCQkJCXNwcmludGYoDQoJCQkJCSdBcmd1bWVudCAlMSRzIHByb2R1Y2VkIGFuIGludmFsaWQgY2xhc3MgbmFtZTogJTIkcyBpbiBwYWNrYWdlICUzJHMnLA0KCQkJCQkkbmFtZSwgJGNsYXNzLCAkdGhpcy0+cGFja2FnZQ0KCQkJCSkNCgkJCSk7DQoJCX0NCg0KCQlpZiAoaXNzZXQoJHRoaXMtPiRuYW1lKSA9PSBmYWxzZSkNCgkJew0KCQkJJHRoaXMtPiRuYW1lID0gbmV3ICRjbGFzcygkdGhpcy0+b3B0aW9ucywgJHRoaXMtPmNsaWVudCk7DQoJCX0NCg0KCQlyZXR1cm4gJHRoaXMtPiRuYW1lOw0KCX0NCg==', '{}', 'AbstractPackage', 'VDM\\Gitea\\AbstractPackage', '1.0.0', '{}', 'Abstract Gitea Package', 'abstract class', '{}', '', 1, '2021-12-03 16:03:06', '2022-05-27 08:31:35', 15, 4), -(8, 1, '', 'c65aaf1f-817c-49a2-8202-282e3904f5b1', '', '51195163-1e87-4251-b755-a03c376798a6', 'dXNlIEpvb21sYVxDTVNcSHR0cFxIdHRwOw0KdXNlIEpvb21sYVxSZWdpc3RyeVxSZWdpc3RyeTs=', '', '', '{}', 'CS8qKg0KCSAqIExpc3QgeW91ciByZXBvc2l0b3JpZXMuDQoJICoNCgkgKiBMaXN0IHJlcG9zaXRvcmllcyBmb3IgdGhlIGF1dGhlbnRpY2F0ZWQgdXNlci4NCgkgKg0KCSAqIEByZXR1cm4gIG9iamVjdA0KCSAqDQoJICogQHNpbmNlICAgMS4wDQoJICovDQoJcHVibGljIGZ1bmN0aW9uIGdldExpc3RPd24oKQ0KCXsNCgkJLy8gQnVpbGQgdGhlIHJlcXVlc3QgcGF0aC4NCgkJJHVyaSA9ICR0aGlzLT5mZXRjaFVybCgnL3VzZXIvcmVwb3MnKTsNCg0KCQkvLyBTZW5kIHRoZSByZXF1ZXN0Lg0KCQlyZXR1cm4gJHRoaXMtPnByb2Nlc3NSZXNwb25zZSgkdGhpcy0+Y2xpZW50LT5nZXQoJHVyaSkpOw0KCX0NCg0KCS8qKg0KCSAqIExpc3QgdXNlciByZXBvc2l0b3JpZXMuDQoJICoNCgkgKiBMaXN0IHB1YmxpYyByZXBvc2l0b3JpZXMgZm9yIHRoZSBzcGVjaWZpZWQgdXNlci4NCgkgKg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgJHVzZXIgICAgICAgVGhlIHVzZXIgbmFtZS4NCgkgKg0KCSAqIEByZXR1cm4gIG9iamVjdA0KCSAqDQoJICogQHNpbmNlICAgMS4wDQoJICovDQoJcHVibGljIGZ1bmN0aW9uIGdldExpc3RVc2VyKCR1c2VyKQ0KCXsNCgkJLy8gQnVpbGQgdGhlIHJlcXVlc3QgcGF0aC4NCgkJJHVyaSA9ICR0aGlzLT5mZXRjaFVybCgnL3VzZXJzLycgLiAkdXNlciAuICcvcmVwb3MnKTsNCg0KCQkvLyBTZW5kIHRoZSByZXF1ZXN0Lg0KCQlyZXR1cm4gJHRoaXMtPnByb2Nlc3NSZXNwb25zZSgkdGhpcy0+Y2xpZW50LT5nZXQoJHVyaSkpOw0KCX0NCg0KCS8qKg0KCSAqIExpc3Qgb3JnYW5pemF0aW9uIHJlcG9zaXRvcmllcy4NCgkgKg0KCSAqIExpc3QgcmVwb3NpdG9yaWVzIGZvciB0aGUgc3BlY2lmaWVkIG9yZy4NCgkgKg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgJG9yZyAgIFRoZSBuYW1lIG9mIHRoZSBvcmdhbml6YXRpb24uDQoJICoNCgkgKiBAcmV0dXJuICBvYmplY3QNCgkgKg0KCSAqIEBzaW5jZSAgIDEuMA0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiBnZXRMaXN0T3JnKCRvcmcpDQoJew0KCQkvLyBCdWlsZCB0aGUgcmVxdWVzdCBwYXRoLg0KCQkkdXJpID0gJHRoaXMtPmZldGNoVXJsKCcvb3Jncy8nIC4gJG9yZyAuICcvcmVwb3MnKTsNCg0KCQkvLyBTZW5kIHRoZSByZXF1ZXN0Lg0KCQlyZXR1cm4gJHRoaXMtPnByb2Nlc3NSZXNwb25zZSgkdGhpcy0+Y2xpZW50LT5nZXQoJHVyaSkpOw0KCX0NCg0KCS8qKg0KCSAqIENyZWF0ZS4NCgkgKg0KCSAqIENyZWF0ZSBhIG5ldyByZXBvc2l0b3J5IGZvciB0aGUgYXV0aGVudGljYXRlZCB1c2VyIG9yIGFuIG9yZ2FuaXphdGlvbi4gT0F1dGggdXNlcnMgbXVzdCBzdXBwbHkgcmVwbyBzY29wZS4NCgkgKg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgICRuYW1lICAgICAgICAgICAgICAgVGhlIHJlcG9zaXRvcnkgbmFtZS4NCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkb3JnICAgICAgICAgICAgICAgIFRoZSBvcmdhbml6YXRpb24gbmFtZSAoaWYgbmVlZGVkKS4NCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkZGVzY3JpcHRpb24gICAgICAgIFRoZSByZXBvc2l0b3J5IGRlc2NyaXB0aW9uLg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgICRyZWFkbWUgICAgICAgICAgICAgUmVhZG1lIG9mIHRoZSByZXBvc2l0b3J5IHRvIGNyZWF0ZS4NCgkgKiBAcGFyYW0gICBib29sZWFuICAkcHJpdmF0ZSAgICAgICAgICAgIFNldCB0cnVlIHRvIGNyZWF0ZSBhIHByaXZhdGUgcmVwb3NpdG9yeSwgZmFsc2UgdG8gY3JlYXRlIGEgcHVibGljIG9uZS4NCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkZGVmYXVsdEJyYW5jaCAgICAgIERlZmF1bHRCcmFuY2ggb2YgdGhlIHJlcG9zaXRvcnkgKHVzZWQgd2hlbiBpbml0aWFsaXplcyBhbmQgaW4gdGVtcGxhdGUpLg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgICRsaWNlbnNlICAgICAgICAgICAgTGljZW5zZSB0byB1c2UuDQoJICogQHBhcmFtICAgYm9vbGVhbiAgJGF1dG9Jbml0ICAgICAgICAgICBXaGV0aGVyIHRoZSByZXBvc2l0b3J5IHNob3VsZCBhdXRvIGluaXQuDQoJICogQHBhcmFtICAgYm9vbGVhbiAgJHRlbXBsYXRlICAgICAgICAgICBXaGV0aGVyIHRoZSByZXBvc2l0b3J5IGlzIHRlbXBsYXRlLg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgICRnaXRpZ25vcmVzICAgICAgICAgR2l0aWdub3JlcyB0byB1c2UuDQoJICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IFsgSm9vbWxhLCBKZXRCcmFpbnMgXSBhbmQgbXVjaCBtb3JlLi4uDQoJICogQHBhcmFtICAgc3RyaW5nICAgJGlzc3VlTGFiZWxzICAgICAgICBMYWJlbC1TZXQgdG8gdXNlLg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgICR0cnVzdE1vZGVsICAgICAgICAgVHJ1c3RNb2RlbCBvZiB0aGUgcmVwb3NpdG9yeS4NCgkgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogWyBkZWZhdWx0LCBjb2xsYWJvcmF0b3IsIGNvbW1pdHRlciwgY29sbGFib3JhdG9yY29tbWl0dGVyIF0NCgkgKg0KCSAqIEByZXR1cm4gIG9iamVjdA0KCSAqDQoJICogQHNpbmNlICAgMS4wDQoJICovDQoJcHVibGljIGZ1bmN0aW9uIGNyZWF0ZSgkbmFtZSwgJG9yZyA9ICcnLCAkZGVzY3JpcHRpb24gPSAnJywgJHJlYWRtZSA9ICdEZWZhdWx0JywgJHByaXZhdGUgPSBmYWxzZSwgJGRlZmF1bHRCcmFuY2ggPSAnbWFzdGVyJywNCgkJJGxpY2Vuc2UgPSAnR1BMLTIuMC1vci1sYXRlcicsICRhdXRvSW5pdCA9IHRydWUsICR0ZW1wbGF0ZSA9IGZhbHNlLCAkdHJ1c3RNb2RlbCA9ICdkZWZhdWx0JywgJGdpdGlnbm9yZXMgPSAnJywgJGlzc3VlTGFiZWxzID0gJycNCgkpDQoJew0KCQkkcGF0aCA9ICgkb3JnKQ0KCQkJLy8gQ3JlYXRlIGEgcmVwb3NpdG9yeSBmb3IgYW4gb3JnYW5pemF0aW9uDQoJCQk/ICcvb3Jncy8nIC4gJG9yZyAuICcvcmVwb3MnDQoJCQkvLyBDcmVhdGUgYSByZXBvc2l0b3J5IGZvciBhIHVzZXINCgkJCTogJy91c2VyL3JlcG9zJzsNCg0KCQkkZGF0YSA9IFsNCgkJCSduYW1lJyAgICAgICAgICAgICAgID0+ICRuYW1lLA0KCQkJJ2Rlc2NyaXB0aW9uJyAgICAgICAgPT4gJGRlc2NyaXB0aW9uLA0KCQkJJ3JlYWRtZScgICAgICAgICAgICAgPT4gJHJlYWRtZSwNCgkJCSdwcml2YXRlJyAgICAgICAgICAgID0+ICRwcml2YXRlLA0KCQkJJ2F1dG9faW5pdCcgICAgICAgICAgPT4gJGF1dG9Jbml0LA0KCQkJJ2RlZmF1bHRfYnJhbmNoJyAgICAgPT4gJGRlZmF1bHRCcmFuY2gsDQoJCQknaXNzdWVfbGFiZWxzJyAgICAgICA9PiAkaXNzdWVMYWJlbHMsDQoJCQknbGljZW5zZScgICAgICAgICAgICA9PiAkbGljZW5zZSwNCgkJCSd0ZW1wbGF0ZScgICAgICAgICAgID0+ICR0ZW1wbGF0ZSwNCgkJCSdnaXRpZ25vcmVzJyAgICAgICAgID0+ICRnaXRpZ25vcmVzLA0KCQkJJ3RydXN0X21vZGVsJyAgICAgICAgPT4gJHRydXN0TW9kZWwNCgkJXTsNCg0KCQkvLyBTZW5kIHRoZSByZXF1ZXN0Lg0KCQlyZXR1cm4gJHRoaXMtPnByb2Nlc3NSZXNwb25zZSgNCgkJCSR0aGlzLT5jbGllbnQtPnBvc3QoJHRoaXMtPmZldGNoVXJsKCRwYXRoKSwganNvbl9lbmNvZGUoJGRhdGEpKSwNCgkJCTIwMQ0KCQkpOw0KCX0NCg0KCS8qKg0KCSAqIEdldC4NCgkgKg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgJG93bmVyICBSZXBvc2l0b3J5IG93bmVyLg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgJHJlcG8gICBSZXBvc2l0b3J5IG5hbWUuDQoJICoNCgkgKiBAcmV0dXJuICBvYmplY3QNCgkgKg0KCSAqIEBzaW5jZSAgIDEuMA0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiBnZXQoJG93bmVyLCAkcmVwbykNCgl7DQoJCS8vIEJ1aWxkIHRoZSByZXF1ZXN0IHBhdGguDQoJCSRwYXRoID0gJy9yZXBvcy8nIC4gJG93bmVyIC4gJy8nIC4gJHJlcG87DQoNCgkJLy8gU2VuZCB0aGUgcmVxdWVzdC4NCgkJcmV0dXJuICR0aGlzLT5wcm9jZXNzUmVzcG9uc2UoDQoJCQkkdGhpcy0+Y2xpZW50LT5nZXQoJHRoaXMtPmZldGNoVXJsKCRwYXRoKSkNCgkJKTsNCgl9DQoNCgkvKioNCgkgKiBMaXN0IGNvbnRyaWJ1dG9ycy4NCgkgKg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgICRvd25lciAgUmVwb3NpdG9yeSBvd25lci4NCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkcmVwbyAgIFJlcG9zaXRvcnkgbmFtZS4NCgkgKg0KCSAqIEByZXR1cm4gIG9iamVjdA0KCSAqDQoJICogQHNpbmNlICAgMS4wDQoJICovDQoJcHVibGljIGZ1bmN0aW9uIGdldExpc3RDb250cmlidXRvcnMoJG93bmVyLCAkcmVwbykNCgl7DQoJCS8vIEJ1aWxkIHRoZSByZXF1ZXN0IHBhdGguDQoJCSR1cmkgPSAkdGhpcy0+ZmV0Y2hVcmwoJy9yZXBvcy8nIC4gJG93bmVyIC4gJy8nIC4gJHJlcG8gLiAnL2NvbnRyaWJ1dG9ycycpOw0KDQoJCS8vIFNlbmQgdGhlIHJlcXVlc3QuDQoJCXJldHVybiAkdGhpcy0+cHJvY2Vzc1Jlc3BvbnNlKCR0aGlzLT5jbGllbnQtPmdldCgkdXJpKSk7DQoJfQ0KDQoJLyoqDQoJICogTGlzdCBsYW5ndWFnZXMuDQoJICoNCgkgKiBMaXN0IGxhbmd1YWdlcyBmb3IgdGhlIHNwZWNpZmllZCByZXBvc2l0b3J5LiBUaGUgdmFsdWUgb24gdGhlIHJpZ2h0IG9mIGEgbGFuZ3VhZ2UgaXMgdGhlIG51bWJlciBvZiBieXRlcyBvZiBjb2RlDQoJICogd3JpdHRlbiBpbiB0aGF0IGxhbmd1YWdlLg0KCSAqDQoJICogQHBhcmFtICAgc3RyaW5nICAkb3duZXIgIFJlcG9zaXRvcnkgb3duZXIuDQoJICogQHBhcmFtICAgc3RyaW5nICAkcmVwbyAgIFJlcG9zaXRvcnkgbmFtZS4NCgkgKg0KCSAqIEByZXR1cm4gIG9iamVjdA0KCSAqDQoJICogQHNpbmNlICAgMS4wDQoJICovDQoJcHVibGljIGZ1bmN0aW9uIGdldExpc3RMYW5ndWFnZXMoJG93bmVyLCAkcmVwbykNCgl7DQoJCS8vIEJ1aWxkIHRoZSByZXF1ZXN0IHBhdGguDQoJCSRwYXRoID0gJy9yZXBvcy8nIC4gJG93bmVyIC4gJy8nIC4gJHJlcG8gLiAnL2xhbmd1YWdlcyc7DQoNCgkJLy8gU2VuZCB0aGUgcmVxdWVzdC4NCgkJcmV0dXJuICR0aGlzLT5wcm9jZXNzUmVzcG9uc2UoDQoJCQkkdGhpcy0+Y2xpZW50LT5nZXQoJHRoaXMtPmZldGNoVXJsKCRwYXRoKSkNCgkJKTsNCgl9DQoNCgkvKioNCgkgKiBMaXN0IFRlYW1zDQoJICoNCgkgKiBAcGFyYW0gICBzdHJpbmcgICRvd25lciAgUmVwb3NpdG9yeSBvd25lci4NCgkgKiBAcGFyYW0gICBzdHJpbmcgICRyZXBvICAgUmVwb3NpdG9yeSBuYW1lLg0KCSAqDQoJICogQHJldHVybiAgb2JqZWN0DQoJICoNCgkgKiBAc2luY2UgICAxLjANCgkgKi8NCglwdWJsaWMgZnVuY3Rpb24gZ2V0TGlzdFRlYW1zKCRvd25lciwgJHJlcG8pDQoJew0KCQkvLyBCdWlsZCB0aGUgcmVxdWVzdCBwYXRoLg0KCQkkcGF0aCA9ICcvcmVwb3MvJyAuICRvd25lciAuICcvJyAuICRyZXBvIC4gJy90ZWFtcyc7DQoNCgkJLy8gU2VuZCB0aGUgcmVxdWVzdC4NCgkJcmV0dXJuICR0aGlzLT5wcm9jZXNzUmVzcG9uc2UoDQoJCQkkdGhpcy0+Y2xpZW50LT5nZXQoJHRoaXMtPmZldGNoVXJsKCRwYXRoKSkNCgkJKTsNCgl9DQoNCgkvKioNCgkgKiBMaXN0IFRhZ3MuDQoJICoNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkb3duZXIgIFJlcG9zaXRvcnkgb3duZXIuDQoJICogQHBhcmFtICAgc3RyaW5nICAgJHJlcG8gICBSZXBvc2l0b3J5IG5hbWUuDQoJICogQHBhcmFtICAgaW50ZWdlciAgJHBhZ2UgICBQYWdlIHRvIHJlcXVlc3QNCgkgKiBAcGFyYW0gICBpbnRlZ2VyICAkbGltaXQgIE51bWJlciBvZiByZXN1bHRzIHRvIHJldHVybiBwZXIgcGFnZQ0KCSAqDQoJICogQHJldHVybiAgb2JqZWN0DQoJICoNCgkgKiBAc2luY2UgICAxLjANCgkgKi8NCglwdWJsaWMgZnVuY3Rpb24gZ2V0TGlzdFRhZ3MoJG93bmVyLCAkcmVwbywgJHBhZ2UgPSAwLCAkbGltaXQgPSAwKQ0KCXsNCgkJLy8gQnVpbGQgdGhlIHJlcXVlc3QgcGF0aC4NCgkJJHBhdGggPSAnL3JlcG9zLycgLiAkb3duZXIgLiAnLycgLiAkcmVwbyAuICcvdGFncyc7DQoNCgkJLy8gU2VuZCB0aGUgcmVxdWVzdC4NCgkJcmV0dXJuICR0aGlzLT5wcm9jZXNzUmVzcG9uc2UoDQoJCQkkdGhpcy0+Y2xpZW50LT5nZXQoJHRoaXMtPmZldGNoVXJsKCRwYXRoLCAkcGFnZSwgJGxpbWl0KSkNCgkJKTsNCgl9DQoNCgkvKioNCgkgKiBEZWxldGUgYSBSZXBvc2l0b3J5Lg0KCSAqDQoJICogRGVsZXRpbmcgYSByZXBvc2l0b3J5IHJlcXVpcmVzIGFkbWluIGFjY2Vzcy4gSWYgT0F1dGggaXMgdXNlZCwgdGhlIGRlbGV0ZV9yZXBvIHNjb3BlIGlzIHJlcXVpcmVkLg0KCSAqDQoJICogQHBhcmFtICAgc3RyaW5nICAkb3duZXIgIFJlcG9zaXRvcnkgb3duZXIuDQoJICogQHBhcmFtICAgc3RyaW5nICAkcmVwbyAgIFJlcG9zaXRvcnkgbmFtZS4NCgkgKg0KCSAqIEByZXR1cm4gIG9iamVjdA0KCSAqDQoJICogQHNpbmNlICAgMS4wDQoJICovDQoJcHVibGljIGZ1bmN0aW9uIGRlbGV0ZSgkb3duZXIsICRyZXBvKQ0KCXsNCgkJLy8gQnVpbGQgdGhlIHJlcXVlc3QgcGF0aC4NCgkJJHBhdGggPSAnL3JlcG9zLycgLiAkb3duZXIgLiAnLycgLiAkcmVwbzsNCg0KCQkvLyBTZW5kIHRoZSByZXF1ZXN0Lg0KCQlyZXR1cm4gJHRoaXMtPnByb2Nlc3NSZXNwb25zZSgNCgkJCSR0aGlzLT5jbGllbnQtPmRlbGV0ZSgkdGhpcy0+ZmV0Y2hVcmwoJHBhdGgpKQ0KCQkpOw0KCX0NCg==', '{}', 'Repo', 'VDM\\Gitea\\Package.Repo', '1.0.0', '{}', 'Gitea Repo', 'class', '{}', '', 1, '2021-12-03 16:37:20', '2022-07-09 10:28:45', 13, 4), -(9, 1, '', '', '', '011813ba-8dd2-4beb-98f9-50ab3f3665d1', 'dXNlIEpvb21sYVxDTVNcSHR0cFxIdHRwIGFzIEJhc2VIdHRwOw0KdXNlIEpvb21sYVxDTVNcSHR0cFxIdHRwRmFjdG9yeTsNCnVzZSBKb29tbGFcUmVnaXN0cnlcUmVnaXN0cnk7', '', '', '{\"load_selection0\":{\"load\":\"aa253bac-f4b4-41b4-8ace-071a73fc4d96\"},\"load_selection1\":{\"load\":\"c65aaf1f-817c-49a2-8202-282e3904f5b1\"},\"load_selection2\":{\"load\":\"51195163-1e87-4251-b755-a03c376798a6\"}}', 'CS8qKg0KCSAqIE9wdGlvbnMgZm9yIHRoZSBbW1tBcGldXV0gb2JqZWN0Lg0KCSAqDQoJICogQHZhciAgICBhcnJheQ0KCSAqIEBzaW5jZSAgMS4wDQoJICovDQoJcHJvdGVjdGVkICRvcHRpb25zOw0KDQoJLyoqDQoJICogVGhlIEhUVFAgY2xpZW50IG9iamVjdCB0byB1c2UgaW4gc2VuZGluZyBIVFRQIHJlcXVlc3RzLg0KCSAqDQoJICogQHZhciAgICBCYXNlSHR0cA0KCSAqIEBzaW5jZSAgMS4wDQoJICovDQoJcHJvdGVjdGVkICRjbGllbnQ7DQoNCgkvKioNCgkgKiBDb25zdHJ1Y3Rvci4NCgkgKg0KCSAqIEBwYXJhbSAgIFJlZ2lzdHJ5ICAkb3B0aW9ucyAgW1tbQXBpXV1dIG9wdGlvbnMgb2JqZWN0Lg0KCSAqIEBwYXJhbSAgIEh0dHAgICAgICAkY2xpZW50ICAgVGhlIEhUVFAgY2xpZW50IG9iamVjdC4NCgkgKg0KCSAqIEBzaW5jZSAgIDEuMA0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiBfX2NvbnN0cnVjdChSZWdpc3RyeSAkb3B0aW9ucyA9IG51bGwsIEJhc2VIdHRwICRjbGllbnQgPSBudWxsKQ0KCXsNCgkJJHRoaXMtPm9wdGlvbnMgPSAkb3B0aW9ucyA/OiBuZXcgUmVnaXN0cnk7DQoNCgkJLy8gU2V0dXAgdGhlIGRlZmF1bHQgdXNlciBhZ2VudCBpZiBub3QgYWxyZWFkeSBzZXQuDQoJCWlmICghJHRoaXMtPmdldE9wdGlvbigndXNlckFnZW50JykpDQoJCXsNCgkJCSR0aGlzLT5zZXRPcHRpb24oJ3VzZXJBZ2VudCcsICdKW1tbQXBpXV1dLzEuMCcpOw0KCQl9DQoNCgkJLy8gU2V0dXAgdGhlIGRlZmF1bHQgQVBJIHVybCBpZiBub3QgYWxyZWFkeSBzZXQuDQoJCWlmICghJHRoaXMtPmdldE9wdGlvbignYXBpLnVybCcpKQ0KCQl7DQoJCQkkdGhpcy0+c2V0T3B0aW9uKCdhcGkudXJsJywgJ1tbW3Jvb3RfYXBpX3VybF1dXScpOw0KCQl9DQoNCgkJJHRoaXMtPmNsaWVudCA9ICRjbGllbnQgPzogKG5ldyBIdHRwRmFjdG9yeSktPmdldEh0dHAoJHRoaXMtPm9wdGlvbnMpOw0KCX0NCg0KCS8qKg0KCSAqIE1hZ2ljIG1ldGhvZCB0byBsYXppbHkgY3JlYXRlIEFQSSBvYmplY3RzDQoJICoNCgkgKiBAcGFyYW0gICBzdHJpbmcgICRuYW1lICBOYW1lIG9mIHByb3BlcnR5IHRvIHJldHJpZXZlDQoJICoNCgkgKiBAcmV0dXJuICBBYnN0cmFjdFtbW0FwaV1dXU9iamVjdCAgW1tbQXBpXV1dIEFQSSBvYmplY3QgKGlzc3VlcywgcHVsbHMsIGV0YykuDQoJICoNCgkgKiBAc2luY2UgICAxLjANCgkgKiBAdGhyb3dzICBcSW52YWxpZEFyZ3VtZW50RXhjZXB0aW9uIElmICRuYW1lIGlzIG5vdCBhIHZhbGlkIHN1YiBjbGFzcy4NCgkgKi8NCglwdWJsaWMgZnVuY3Rpb24gX19nZXQoJG5hbWUpDQoJew0KCQkkY2xhc3MgPSAnXFxbW1tDT01QQU5ZXV1dXFxbW1tBcGldXV1cXFBhY2thZ2VcXCcgLiB1Y2ZpcnN0KCRuYW1lKTsNCg0KCQlpZiAoY2xhc3NfZXhpc3RzKCRjbGFzcykpDQoJCXsNCgkJCWlmIChpc3NldCgkdGhpcy0+JG5hbWUpID09IGZhbHNlKQ0KCQkJew0KCQkJCSR0aGlzLT4kbmFtZSA9IG5ldyAkY2xhc3MoJHRoaXMtPm9wdGlvbnMsICR0aGlzLT5jbGllbnQpOw0KCQkJfQ0KDQoJCQlyZXR1cm4gJHRoaXMtPiRuYW1lOw0KCQl9DQoNCgkJdGhyb3cgbmV3IFxJbnZhbGlkQXJndW1lbnRFeGNlcHRpb24oc3ByaW50ZignQXJndW1lbnQgJXMgcHJvZHVjZWQgYW4gaW52YWxpZCBjbGFzcyBuYW1lOiAlcycsICRuYW1lLCAkY2xhc3MpKTsNCgl9DQoNCgkvKioNCgkgKiBHZXQgYW4gb3B0aW9uIGZyb20gdGhlIFtbW0FwaV1dXSBpbnN0YW5jZS4NCgkgKg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgJGtleSAgVGhlIG5hbWUgb2YgdGhlIG9wdGlvbiB0byBnZXQuDQoJICoNCgkgKiBAcmV0dXJuICBtaXhlZCAgVGhlIG9wdGlvbiB2YWx1ZS4NCgkgKg0KCSAqIEBzaW5jZSAgIDEuMA0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiBnZXRPcHRpb24oJGtleSkNCgl7DQoJCXJldHVybiBpc3NldCgkdGhpcy0+b3B0aW9uc1ska2V5XSkgPyAkdGhpcy0+b3B0aW9uc1ska2V5XSA6IG51bGw7DQoJfQ0KDQoJLyoqDQoJICogU2V0IGFuIG9wdGlvbiBmb3IgdGhlIFtbW0FwaV1dXSBpbnN0YW5jZS4NCgkgKg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgJGtleSAgICBUaGUgbmFtZSBvZiB0aGUgb3B0aW9uIHRvIHNldC4NCgkgKiBAcGFyYW0gICBtaXhlZCAgICR2YWx1ZSAgVGhlIG9wdGlvbiB2YWx1ZSB0byBzZXQuDQoJICoNCgkgKiBAcmV0dXJuICBbW1tBcGldXV0gIFRoaXMgb2JqZWN0IGZvciBtZXRob2QgY2hhaW5pbmcuDQoJICoNCgkgKiBAc2luY2UgICAxLjANCgkgKi8NCglwdWJsaWMgZnVuY3Rpb24gc2V0T3B0aW9uKCRrZXksICR2YWx1ZSkNCgl7DQoJCSR0aGlzLT5vcHRpb25zWyRrZXldID0gJHZhbHVlOw0KDQoJCXJldHVybiAkdGhpczsNCgl9DQo=', '{}', '[[[Api]]]', '[[[COMPANY]]]\\[[[Api]]]\\[[[Api]]]', '1.0.0', '{}', 'API', 'class', '{}', '', 1, '2022-01-05 00:44:15', '2022-03-09 01:43:33', 5, 4), -(10, 1, 'Control the naming of a field\r\n\r\n@since 3.0.9', '', '', '9ef0eb24-aae4-4f5a-99af-d724db44808f', 'dXNlIEpvb21sYVxDTVNcQ29tcG9uZW50XENvbXBvbmVudEhlbHBlcjs=', '', '', '{}', 'CS8qKg0KCSAqIFRoZSBmaWVsZCBidWlsZGVyIHN3aXRjaA0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwcm90ZWN0ZWQgc3RhdGljICRidWlsZGVyID0gZmFsc2U7DQoNCgkvKioNCgkgKiBNYWtpbmcgZmllbGQgbmFtZXMgc2FmZQ0KCSAqDQoJICogQGlucHV0CXN0cmluZyAgICAgICBUaGUgc3RyaW5nIHlvdSB3b3VsZCBsaWtlIHRvIG1ha2Ugc2FmZQ0KCSAqIEBpbnB1dAlib29sZWFuICAgICAgVGhlIHN3aXRjaCB0byByZXR1cm4gYW4gQUxMIFVQUEVSIENBU0Ugc3RyaW5nDQoJICogQGlucHV0CXN0cmluZyAgICAgICBUaGUgc3RyaW5nIHRvIHVzZSBpbiB3aGl0ZSBzcGFjZQ0KCSAqDQoJICogQHJldHVybnMgc3RyaW5nIG9uIHN1Y2Nlc3MNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBzYWZlKCRzdHJpbmcsICRhbGxjYXAgPSBmYWxzZSwgJHNwYWNlciA9ICdfJykNCgl7DQoJCS8vIGdldCBnbG9iYWwgdmFsdWUNCgkJaWYgKHNlbGY6OiRidWlsZGVyID09PSBmYWxzZSkNCgkJew0KCQkJc2VsZjo6JGJ1aWxkZXIgPSBIZWxwZXI6OmdldFBhcmFtcygpLT5nZXQoJ2ZpZWxkX25hbWVfYnVpbGRlcicsIDEpOw0KCQl9DQoNCgkJLy8gdXNlIHRoZSBuZXcgY29udmVudGlvbg0KCQlpZiAoMiA9PSBzZWxmOjokYnVpbGRlcikNCgkJew0KCQkJLy8gMG5seSBjb250aW51ZSBpZiB3ZSBoYXZlIGEgc3RyaW5nDQoJCQlpZiAoU3RyaW5nSGVscGVyOjpjaGVjaygkc3RyaW5nKSkNCgkJCXsNCgkJCQkvLyBjaGVjayB0aGF0IHRoZSBmaXJzdCBjaGFyYWN0ZXIgaXMgbm90IGEgbnVtYmVyDQoJCQkJaWYgKGlzX251bWVyaWMoc3Vic3RyKCRzdHJpbmcsIDAsIDEpKSkNCgkJCQl7DQoJCQkJCSRzdHJpbmcgPSBTdHJpbmdIZWxwZXI6Om51bWJlcnMoJHN0cmluZyk7DQoJCQkJfQ0KDQoJCQkJLy8gcmVtb3ZlIGFsbCBvdGhlciBzdHJhbmdlIGNoYXJhY3RlcnMNCgkJCQkkc3RyaW5nID0gdHJpbSgkc3RyaW5nKTsNCgkJCQkkc3RyaW5nID0gcHJlZ19yZXBsYWNlKCcvJy4kc3BhY2VyLicrLycsICcgJywgJHN0cmluZyk7DQoJCQkJJHN0cmluZyA9IHByZWdfcmVwbGFjZSgnL1xzKy8nLCAnICcsICRzdHJpbmcpOw0KDQoJCQkJLy8gVHJhbnNsaXRlcmF0ZSBzdHJpbmcNCgkJCQkkc3RyaW5nID0gU3RyaW5nSGVscGVyOjp0cmFuc2xpdGVyYXRlKCRzdHJpbmcpOw0KDQoJCQkJLy8gcmVtb3ZlIGFsbCBhbmQga2VlcCBvbmx5IGNoYXJhY3RlcnMgYW5kIG51bWJlcnMNCgkJCQkkc3RyaW5nID0gcHJlZ19yZXBsYWNlKCIvW15BLVphLXowLTkgXS8iLCAnJywgJHN0cmluZyk7DQoNCgkJCQkvLyByZXBsYWNlIHdoaXRlIHNwYWNlIHdpdGggdW5kZXJzY29yZSAoU0FGRVNUIE9QVElPTikNCgkJCQkkc3RyaW5nID0gcHJlZ19yZXBsYWNlKCcvXHMrLycsICRzcGFjZXIsICRzdHJpbmcpOw0KDQoJCQkJLy8gcmV0dXJuIGFsbCBjYXBzDQoJCQkJaWYgKCRhbGxjYXApDQoJCQkJew0KCQkJCQlyZXR1cm4gc3RydG91cHBlcigkc3RyaW5nKTsNCgkJCQl9DQoNCgkJCQkvLyBkZWZhdWx0IGlzIHRvIHJldHVybiBsb3dlcg0KCQkJCXJldHVybiBzdHJ0b2xvd2VyKCRzdHJpbmcpOw0KCQkJfQ0KCQkJLy8gbm90IGEgc3RyaW5nDQoJCQlyZXR1cm4gJyc7DQoJCX0NCg0KCQkvLyByZXR1cm4gYWxsIGNhcHMNCgkJaWYgKCRhbGxjYXApDQoJCXsNCgkJCXJldHVybiBTdHJpbmdIZWxwZXI6OnNhZmUoJHN0cmluZywgJ1UnKTsNCgkJfQ0KDQoJCS8vIHVzZSB0aGUgZGVmYXVsdCAob3JpZ2luYWwgYmVoYXZpb3IvY29udmVudGlvbikNCgkJcmV0dXJuIFN0cmluZ0hlbHBlcjo6c2FmZSgkc3RyaW5nKTsNCgl9DQo=', '{}', 'FieldHelper', 'VDM\\Joomla\\Utilities.String.FieldHelper', '1.0.0', '{}', 'String Field Helper', 'abstract class', '{\"use_selection0\":{\"use\":\"1f28cb53-60d9-4db1-b517-3c7dc6b429ef\"},\"use_selection1\":{\"use\":\"640b5352-fb09-425f-a26e-cd44eda03f15\"}}', '', 1, '2022-03-08 20:46:56', '2022-05-21 13:27:39', 20, 5), -(11, '', 'The json checker\r\n\r\n@since 3.0.9', '', '', '4b225c51-d293-48e4-b3f6-5136cf5c3f18', '', '', '', '{\"load_selection0\":{\"load\":\"1f28cb53-60d9-4db1-b517-3c7dc6b429ef\"},\"load_selection1\":{\"load\":\"0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a\"},\"load_selection2\":{\"load\":\"db87c339-5bb6-4291-a7ef-2c48ea1b06bc\"}}', 'CS8qKg0KCSAqIENoZWNrIGlmIHlvdSBoYXZlIGEganNvbiBzdHJpbmcNCgkgKg0KCSAqIEBpbnB1dCAgICBzdHJpbmcgICRzdHJpbmcgIFRoZSBqc29uIHN0cmluZyB0byBjaGVjaw0KCSAqDQoJICogQHJldHVybnMgYm9vbCB0cnVlIG9uIHN1Y2Nlc3MNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBjaGVjaygkc3RyaW5nKTogYm9vbA0KCXsNCgkJaWYgKFN0cmluZ0hlbHBlcjo6Y2hlY2soJHN0cmluZykpDQoJCXsNCgkJCWpzb25fZGVjb2RlKCRzdHJpbmcpOw0KCQkJcmV0dXJuIChqc29uX2xhc3RfZXJyb3IoKSA9PT0gSlNPTl9FUlJPUl9OT05FKTsNCgkJfQ0KDQoJCXJldHVybiBmYWxzZTsNCgl9DQoNCgkvKioNCgkgKiBDb252ZXJ0IGEganNvbiBvYmplY3QgdG8gYSBzdHJpbmcNCgkgKg0KCSAqIEBpbnB1dCAgICBzdHJpbmcgICR2YWx1ZSAgVGhlIGpzb24gc3RyaW5nIHRvIGNvbnZlcnQNCgkgKg0KCSAqIEByZXR1cm5zIGEgc3RyaW5nDQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gc3RyaW5nKCR2YWx1ZSwgJHNlcGFyYXRvciA9ICIsICIsICR0YWJsZSA9IG51bGwsICRpZCA9ICdpZCcsICRuYW1lID0gJ25hbWUnKQ0KCXsNCgkJLy8gZG8gc29tZSB0YWJsZSBmb290IHdvcmsNCgkJJGV4dGVybmFsID0gZmFsc2U7DQoJCWlmIChzdHJwb3MoJHRhYmxlLCAnI19fJykgIT09IGZhbHNlKQ0KCQl7DQoJCQkkZXh0ZXJuYWwgPSB0cnVlOw0KCQkJJHRhYmxlID0gc3RyX3JlcGxhY2UoJyNfXycsICcnLCAkdGFibGUpOw0KCQl9DQoNCgkJLy8gY2hlY2sgaWYgc3RyaW5nIGlzIEpTT04NCgkJJHJlc3VsdCA9IGpzb25fZGVjb2RlKCR2YWx1ZSwgdHJ1ZSk7DQoJCWlmIChqc29uX2xhc3RfZXJyb3IoKSA9PT0gSlNPTl9FUlJPUl9OT05FKQ0KCQl7DQoJCQkvLyBpcyBKU09ODQoJCQlpZiAoQXJyYXlIZWxwZXI6OmNoZWNrKCRyZXN1bHQpKQ0KCQkJew0KCQkJCWlmIChTdHJpbmdIZWxwZXI6OmNoZWNrKCR0YWJsZSkpDQoJCQkJew0KCQkJCQkkbmFtZXMgPSBhcnJheSgpOw0KCQkJCQlmb3JlYWNoICgkcmVzdWx0IGFzICR2YWwpDQoJCQkJCXsNCgkJCQkJCWlmICgkZXh0ZXJuYWwpDQoJCQkJCQl7DQoJCQkJCQkJaWYgKCRfbmFtZSA9IEdldEhlbHBlcjo6dmFyKG51bGwsICR2YWwsICRpZCwgJG5hbWUsICc9JywgJHRhYmxlKSkNCgkJCQkJCQl7DQoJCQkJCQkJCSRuYW1lc1tdID0gJF9uYW1lOw0KCQkJCQkJCX0NCgkJCQkJCX0NCgkJCQkJCWVsc2UNCgkJCQkJCXsNCgkJCQkJCQlpZiAoJF9uYW1lID0gR2V0SGVscGVyOjp2YXIoJHRhYmxlLCAkdmFsLCAkaWQsICRuYW1lKSkNCgkJCQkJCQl7DQoJCQkJCQkJCSRuYW1lc1tdID0gJF9uYW1lOw0KCQkJCQkJCX0NCgkJCQkJCX0NCgkJCQkJfQ0KCQkJCQlpZiAoQXJyYXlIZWxwZXI6OmNoZWNrKCRuYW1lcykpDQoJCQkJCXsNCgkJCQkJCXJldHVybiAoc3RyaW5nKSBpbXBsb2RlKCRzZXBhcmF0b3IsICRuYW1lcyk7DQoJCQkJCX0JDQoJCQkJfQ0KCQkJCXJldHVybiAoc3RyaW5nKSBpbXBsb2RlKCRzZXBhcmF0b3IsICRyZXN1bHQpOw0KCQkJfQ0KCQkJcmV0dXJuIChzdHJpbmcpIGpzb25fZGVjb2RlKCR2YWx1ZSk7DQoJCX0NCgkJcmV0dXJuICR2YWx1ZTsNCgl9DQo=', '{}', 'JsonHelper', 'VDM\\Joomla\\Utilities.JsonHelper', '1.0.0', '{}', 'Utilities Json Helper', 'abstract class', '{}', '', 1, '2022-03-08 21:03:54', '2022-05-21 13:27:39', 18, 6), -(12, 1, 'Some string tricks\r\n\r\n@since 3.0.9', '', '', '1f28cb53-60d9-4db1-b517-3c7dc6b429ef', 'dXNlIEpvb21sYVxDTVNcRmlsdGVyXElucHV0RmlsdGVyOw0KdXNlIEpvb21sYVxDTVNcTGFuZ3VhZ2VcTGFuZ3VhZ2U7', '', '', '{\"load_selection0\":{\"load\":\"0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a\"}}', 'CS8qKg0KCSAqIFRoZSBNYWluIEFjdGl2ZSBMYW5ndWFnZQ0KCSAqIA0KCSAqIEB2YXIgICAgICBzdHJpbmcNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHVibGljIHN0YXRpYyAkbGFuZ1RhZzsNCg0KCS8qKg0KCSAqIENoZWNrIGlmIHdlIGhhdmUgYSBzdHJpbmcgd2l0aCBhIGxlbmd0aA0KCSAqDQoJICogQGlucHV0ICAgIHN0cmluZyAgJHN0cmluZyBUaGUgc3RyaW5nIHRvIGNoZWNrDQoJICoNCgkgKiBAcmV0dXJucyBib29sIHRydWUgb24gc3VjY2Vzcw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGNoZWNrKCRzdHJpbmcpOiBib29sDQoJew0KCQlpZiAoaXNfc3RyaW5nKCRzdHJpbmcpICYmIHN0cmxlbigkc3RyaW5nKSA+IDApDQoJCXsNCgkJCXJldHVybiB0cnVlOw0KCQl9DQoNCgkJcmV0dXJuIGZhbHNlOw0KCX0NCg0KCS8qKg0KCSAqIFNob3J0ZW4gYSBzdHJpbmcNCgkgKg0KCSAqIEBpbnB1dAlzdHJpbmcgICBUaGUgeW91IHdvdWxkIGxpa2UgdG8gc2hvcnRlbg0KCSAqDQoJICogQHJldHVybnMgc3RyaW5nIG9uIHN1Y2Nlc3MNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBzaG9ydGVuKCRzdHJpbmcsICRsZW5ndGggPSA0MCwgJGFkZFRpcCA9IHRydWUpDQoJew0KCQlpZiAoc2VsZjo6Y2hlY2soJHN0cmluZykpDQoJCXsNCgkJCSRpbml0aWFsID0gc3RybGVuKCRzdHJpbmcpOw0KCQkJJHdvcmRzID0gcHJlZ19zcGxpdCgnLyhbXHNcblxyXSspLycsICRzdHJpbmcsIG51bGwsIFBSRUdfU1BMSVRfREVMSU1fQ0FQVFVSRSk7DQoJCQkkd29yZHNfY291bnQgPSBjb3VudCgoYXJyYXkpJHdvcmRzKTsNCg0KCQkJJHdvcmRfbGVuZ3RoID0gMDsNCgkJCSRsYXN0X3dvcmQgPSAwOw0KCQkJZm9yICg7ICRsYXN0X3dvcmQgPCAkd29yZHNfY291bnQ7ICsrJGxhc3Rfd29yZCkNCgkJCXsNCgkJCQkkd29yZF9sZW5ndGggKz0gc3RybGVuKCR3b3Jkc1skbGFzdF93b3JkXSk7DQoJCQkJaWYgKCR3b3JkX2xlbmd0aCA+ICRsZW5ndGgpDQoJCQkJew0KCQkJCQlicmVhazsNCgkJCQl9DQoJCQl9DQoNCgkJCSRuZXdTdHJpbmcJPSBpbXBsb2RlKGFycmF5X3NsaWNlKCR3b3JkcywgMCwgJGxhc3Rfd29yZCkpOw0KCQkJJGZpbmFsCT0gc3RybGVuKCRuZXdTdHJpbmcpOw0KCQkJaWYgKCRpbml0aWFsICE9ICRmaW5hbCAmJiAkYWRkVGlwKQ0KCQkJew0KCQkJCSR0aXRsZSA9IHNlbGY6OnNob3J0ZW4oJHN0cmluZywgNDAwICwgZmFsc2UpOw0KCQkJCXJldHVybiAnPHNwYW4gY2xhc3M9Imhhc1RpcCIgdGl0bGU9IicgLiAkdGl0bGUgLiAnIiBzdHlsZT0iY3Vyc29yOmhlbHAiPicgLiB0cmltKCRuZXdTdHJpbmcpIC4gJy4uLjwvc3Bhbj4nOw0KCQkJfQ0KCQkJZWxzZWlmICgkaW5pdGlhbCAhPSAkZmluYWwgJiYgISRhZGRUaXApDQoJCQl7DQoJCQkJcmV0dXJuIHRyaW0oJG5ld1N0cmluZykgLiAnLi4uJzsNCgkJCX0NCgkJfQ0KCQlyZXR1cm4gJHN0cmluZzsNCgl9DQoNCgkvKioNCgkgKiBNYWtpbmcgc3RyaW5ncyBzYWZlICh2YXJpb3VzIHdheXMpDQoJICoNCgkgKiBAaW5wdXQJc3RyaW5nICAgVGhlIHlvdSB3b3VsZCBsaWtlIHRvIG1ha2Ugc2FmZQ0KCSAqDQoJICogQHJldHVybnMgc3RyaW5nIG9uIHN1Y2Nlc3MNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBzYWZlKCRzdHJpbmcsICR0eXBlID0gJ0wnLCAkc3BhY2VyID0gJ18nLCAkcmVwbGFjZU51bWJlcnMgPSB0cnVlLCAka2VlcE9ubHlDaGFyYWN0ZXJzID0gdHJ1ZSkNCgl7DQoJCWlmICgkcmVwbGFjZU51bWJlcnMgPT09IHRydWUpDQoJCXsNCgkJCS8vIHJlbW92ZSBhbGwgbnVtYmVycyBhbmQgcmVwbGFjZSB3aXRoIEVuZ2xpc2ggdGV4dCB2ZXJzaW9uICh3b3JrcyB3ZWxsIG9ubHkgdXAgdG8gbWlsbGlvbnMpDQoJCQkkc3RyaW5nID0gc2VsZjo6bnVtYmVycygkc3RyaW5nKTsNCgkJfQ0KCQkvLyAwbmx5IGNvbnRpbnVlIGlmIHdlIGhhdmUgYSBzdHJpbmcNCgkJaWYgKHNlbGY6OmNoZWNrKCRzdHJpbmcpKQ0KCQl7DQoJCQkvLyBjcmVhdGUgZmlsZSBuYW1lIHdpdGhvdXQgdGhlIGV4dGVuc2lvbiB0aGF0IGlzIHNhZmUNCgkJCWlmICgkdHlwZSA9PT0gJ2ZpbGVuYW1lJykNCgkJCXsNCgkJCQkvLyBtYWtlIHN1cmUgVkRNIGlzIG5vdCBpbiB0aGUgc3RyaW5nDQoJCQkJJHN0cmluZyA9IHN0cl9yZXBsYWNlKCdWRE0nLCAndkRtJywgJHN0cmluZyk7DQoJCQkJLy8gUmVtb3ZlIGFueXRoaW5nIHdoaWNoIGlzbid0IGEgd29yZCwgd2hpdGVzcGFjZSwgbnVtYmVyDQoJCQkJLy8gb3IgYW55IG9mIHRoZSBmb2xsb3dpbmcgY2FyYWN0ZXJzIC1fKCkNCgkJCQkvLyBJZiB5b3UgZG9uJ3QgbmVlZCB0byBoYW5kbGUgbXVsdGktYnl0ZSBjaGFyYWN0ZXJzDQoJCQkJLy8geW91IGNhbiB1c2UgcHJlZ19yZXBsYWNlIHJhdGhlciB0aGFuIG1iX2VyZWdfcmVwbGFjZQ0KCQkJCS8vIFRoYW5rcyBAxYF1a2FzeiBSeXNpYWshDQoJCQkJLy8gJHN0cmluZyA9IG1iX2VyZWdfcmVwbGFjZSgiKFteXHdcc1xkXC1fXChcKV0pIiwgJycsICRzdHJpbmcpOw0KCQkJCSRzdHJpbmcgPSBwcmVnX3JlcGxhY2UoIihbXlx3XHNcZFwtX1woXCldKSIsICcnLCAkc3RyaW5nKTsNCg0KCQkJCS8vIGh0dHA6Ly9zdGFja292ZXJmbG93LmNvbS9hLzIwMjE3MjkvMTQyOTY3Nw0KCQkJCXJldHVybiBwcmVnX3JlcGxhY2UoJy9ccysvJywgJyAnLCAkc3RyaW5nKTsNCgkJCX0NCgkJCS8vIHJlbW92ZSBhbGwgb3RoZXIgY2hhcmFjdGVycw0KCQkJJHN0cmluZyA9IHRyaW0oJHN0cmluZyk7DQoJCQkkc3RyaW5nID0gcHJlZ19yZXBsYWNlKCcvJy4kc3BhY2VyLicrLycsICcgJywgJHN0cmluZyk7DQoJCQkkc3RyaW5nID0gcHJlZ19yZXBsYWNlKCcvXHMrLycsICcgJywgJHN0cmluZyk7DQoJCQkvLyBUcmFuc2xpdGVyYXRlIHN0cmluZw0KCQkJJHN0cmluZyA9IHNlbGY6OnRyYW5zbGl0ZXJhdGUoJHN0cmluZyk7DQoJCQkvLyByZW1vdmUgYWxsIGFuZCBrZWVwIG9ubHkgY2hhcmFjdGVycw0KCQkJaWYgKCRrZWVwT25seUNoYXJhY3RlcnMpDQoJCQl7DQoJCQkJJHN0cmluZyA9IHByZWdfcmVwbGFjZSgiL1teQS1aYS16IF0vIiwgJycsICRzdHJpbmcpOw0KCQkJfQ0KCQkJLy8ga2VlcCBib3RoIG51bWJlcnMgYW5kIGNoYXJhY3RlcnMNCgkJCWVsc2UNCgkJCXsNCgkJCQkkc3RyaW5nID0gcHJlZ19yZXBsYWNlKCIvW15BLVphLXowLTkgXS8iLCAnJywgJHN0cmluZyk7DQoJCQl9DQoJCQkvLyBzZWxlY3QgZmluYWwgYWRhcHRhdGlvbnMNCgkJCWlmICgkdHlwZSA9PT0gJ0wnIHx8ICR0eXBlID09PSAnc3RydG9sb3dlcicpDQoJCQl7DQoJCQkJLy8gcmVwbGFjZSB3aGl0ZSBzcGFjZSB3aXRoIHVuZGVyc2NvcmUNCgkJCQkkc3RyaW5nID0gcHJlZ19yZXBsYWNlKCcvXHMrLycsICRzcGFjZXIsICRzdHJpbmcpOw0KCQkJCS8vIGRlZmF1bHQgaXMgdG8gcmV0dXJuIGxvd2VyDQoJCQkJcmV0dXJuIHN0cnRvbG93ZXIoJHN0cmluZyk7DQoJCQl9DQoJCQllbHNlaWYgKCR0eXBlID09PSAnVycpDQoJCQl7DQoJCQkJLy8gcmV0dXJuIGEgc3RyaW5nIHdpdGggYWxsIGZpcnN0IGxldHRlciBvZiBlYWNoIHdvcmQgdXBwZXJjYXNlKG5vIHVuZGVyc2NvcmUpDQoJCQkJcmV0dXJuIHVjd29yZHMoc3RydG9sb3dlcigkc3RyaW5nKSk7DQoJCQl9DQoJCQllbHNlaWYgKCR0eXBlID09PSAndycgfHwgJHR5cGUgPT09ICd3b3JkJykNCgkJCXsNCgkJCQkvLyByZXR1cm4gYSBzdHJpbmcgd2l0aCBhbGwgbG93ZXJjYXNlKG5vIHVuZGVyc2NvcmUpDQoJCQkJcmV0dXJuIHN0cnRvbG93ZXIoJHN0cmluZyk7DQoJCQl9DQoJCQllbHNlaWYgKCR0eXBlID09PSAnV3cnIHx8ICR0eXBlID09PSAnV29yZCcpDQoJCQl7DQoJCQkJLy8gcmV0dXJuIGEgc3RyaW5nIHdpdGggZmlyc3QgbGV0dGVyIG9mIHRoZSBmaXJzdCB3b3JkIHVwcGVyY2FzZSBhbmQgYWxsIHRoZSByZXN0IGxvd2VyY2FzZShubyB1bmRlcnNjb3JlKQ0KCQkJCXJldHVybiB1Y2ZpcnN0KHN0cnRvbG93ZXIoJHN0cmluZykpOw0KCQkJfQ0KCQkJZWxzZWlmICgkdHlwZSA9PT0gJ1dXJyB8fCAkdHlwZSA9PT0gJ1dPUkQnKQ0KCQkJew0KCQkJCS8vIHJldHVybiBhIHN0cmluZyB3aXRoIGFsbCB0aGUgdXBwZXJjYXNlKG5vIHVuZGVyc2NvcmUpDQoJCQkJcmV0dXJuIHN0cnRvdXBwZXIoJHN0cmluZyk7DQoJCQl9DQoJCQllbHNlaWYgKCR0eXBlID09PSAnVScgfHwgJHR5cGUgPT09ICdzdHJ0b3VwcGVyJykNCgkJCXsNCgkJCQkJLy8gcmVwbGFjZSB3aGl0ZSBzcGFjZSB3aXRoIHVuZGVyc2NvcmUNCgkJCQkJJHN0cmluZyA9IHByZWdfcmVwbGFjZSgnL1xzKy8nLCAkc3BhY2VyLCAkc3RyaW5nKTsNCgkJCQkJLy8gcmV0dXJuIGFsbCB1cHBlcg0KCQkJCQlyZXR1cm4gc3RydG91cHBlcigkc3RyaW5nKTsNCgkJCX0NCgkJCWVsc2VpZiAoJHR5cGUgPT09ICdGJyB8fCAkdHlwZSA9PT0gJ3VjZmlyc3QnKQ0KCQkJew0KCQkJCQkvLyByZXBsYWNlIHdoaXRlIHNwYWNlIHdpdGggdW5kZXJzY29yZQ0KCQkJCQkkc3RyaW5nID0gcHJlZ19yZXBsYWNlKCcvXHMrLycsICRzcGFjZXIsICRzdHJpbmcpOw0KCQkJCQkvLyByZXR1cm4gd2l0aCBmaXJzdCBjaGFyYWN0ZXIgdG8gdXBwZXINCgkJCQkJcmV0dXJuIHVjZmlyc3Qoc3RydG9sb3dlcigkc3RyaW5nKSk7DQoJCQl9DQoJCQllbHNlaWYgKCR0eXBlID09PSAnY0EnIHx8ICR0eXBlID09PSAnY0FtZWwnIHx8ICR0eXBlID09PSAnY2FtZWxjYXNlJykNCgkJCXsNCgkJCQkvLyBjb252ZXJ0IGFsbCB3b3JkcyB0byBmaXJzdCBsZXR0ZXIgdXBwZXJjYXNlDQoJCQkJJHN0cmluZyA9IHVjd29yZHMoc3RydG9sb3dlcigkc3RyaW5nKSk7DQoJCQkJLy8gcmVtb3ZlIHdoaXRlIHNwYWNlDQoJCQkJJHN0cmluZyA9IHByZWdfcmVwbGFjZSgnL1xzKy8nLCAnJywgJHN0cmluZyk7DQoJCQkJLy8gbm93IHJldHVybiBmaXJzdCBsZXR0ZXIgbG93ZXJjYXNlDQoJCQkJcmV0dXJuIGxjZmlyc3QoJHN0cmluZyk7DQoJCQl9DQoJCQkvLyByZXR1cm4gc3RyaW5nDQoJCQlyZXR1cm4gJHN0cmluZzsNCgkJfQ0KCQkvLyBub3QgYSBzdHJpbmcNCgkJcmV0dXJuICcnOw0KCX0NCg0KCS8qKg0KCSAqIENvbnZlcnQgbm9uZSBFbmdsaXNoIHN0cmluZ3MgdG8gY29kZSB1c2FibGUgc3RyaW5nDQoJICoNCgkgKiBAaW5wdXQJYW4gc3RyaW5nDQoJICoNCgkgKiBAcmV0dXJucyBhIHN0cmluZw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIHRyYW5zbGl0ZXJhdGUoJHN0cmluZykNCgl7DQoJCS8vIHNldCB0YWcgb25seSBvbmNlDQoJCWlmICghc2VsZjo6Y2hlY2soc2VsZjo6JGxhbmdUYWcpKQ0KCQl7DQoJCQkvLyBnZXQgZ2xvYmFsIHZhbHVlDQoJCQlzZWxmOjokbGFuZ1RhZyA9IEhlbHBlcjo6Z2V0UGFyYW1zKCktPmdldCgnbGFuZ3VhZ2UnLCAnZW4tR0InKTsNCgkJfQ0KDQoJCS8vIFRyYW5zbGl0ZXJhdGUgb24gdGhlIGxhbmd1YWdlIHJlcXVlc3RlZA0KCQkkbGFuZyA9IExhbmd1YWdlOjpnZXRJbnN0YW5jZShzZWxmOjokbGFuZ1RhZyk7DQoNCgkJcmV0dXJuICRsYW5nLT50cmFuc2xpdGVyYXRlKCRzdHJpbmcpOw0KCX0NCg0KCS8qKg0KCSAqIG1ha2Ugc3VyZSBhIHN0cmluZyBpcyBIVE1MIHNhdmUNCgkgKg0KCSAqIEBpbnB1dAlhbiBodG1sIHN0cmluZw0KCSAqDQoJICogQHJldHVybnMgYSBzdHJpbmcNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBodG1sKCR2YXIsICRjaGFyc2V0ID0gJ1VURi04JywgJHNob3J0ZW4gPSBmYWxzZSwgJGxlbmd0aCA9IDQwKQ0KCXsNCgkJaWYgKHNlbGY6OmNoZWNrKCR2YXIpKQ0KCQl7DQoJCQkkZmlsdGVyID0gbmV3IElucHV0RmlsdGVyKCk7DQoJCQkkc3RyaW5nID0gJGZpbHRlci0+Y2xlYW4oDQoJCQkJaHRtbF9lbnRpdHlfZGVjb2RlKA0KCQkJCQlodG1sZW50aXRpZXMoDQoJCQkJCQkkdmFyLA0KCQkJCQkJRU5UX0NPTVBBVCwNCgkJCQkJCSRjaGFyc2V0DQoJCQkJCSkNCgkJCQkpLA0KCQkJCSdIVE1MJw0KCQkJKTsNCgkJCWlmICgkc2hvcnRlbikNCgkJCXsNCgkJCQlyZXR1cm4gc2VsZjo6c2hvcnRlbigkc3RyaW5nLCAkbGVuZ3RoKTsNCgkJCX0NCgkJCXJldHVybiAkc3RyaW5nOw0KCQl9DQoJCWVsc2UNCgkJew0KCQkJcmV0dXJuICcnOw0KCQl9DQoJfQ0KDQoJLyoqDQoJICogQ29udmVydCBhbGwgaW50IGluIGEgc3RyaW5nIHRvIGFuIEVuZ2xpc2ggd29yZCBzdHJpbmcNCgkgKg0KCSAqIEBpbnB1dAlhbiBzdHJpbmcgd2l0aCBudW1iZXJzDQoJICoNCgkgKiBAcmV0dXJucyBhIHN0cmluZw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIG51bWJlcnMoJHN0cmluZykNCgl7DQoJCS8vIHNldCBudW1iZXJzIGFycmF5DQoJCSRudW1iZXJzID0gYXJyYXkoKTsNCg0KCQkvLyBmaXJzdCBnZXQgYWxsIG51bWJlcnMNCgkJcHJlZ19tYXRjaF9hbGwoJyFcZCshJywgJHN0cmluZywgJG51bWJlcnMpOw0KDQoJCS8vIGNoZWNrIGlmIHdlIGhhdmUgYW55IG51bWJlcnMNCgkJaWYgKGlzc2V0KCRudW1iZXJzWzBdKSAmJiBBcnJheUhlbHBlcjo6Y2hlY2soJG51bWJlcnNbMF0pKQ0KCQl7DQoJCQlmb3JlYWNoICgkbnVtYmVyc1swXSBhcyAkbnVtYmVyKQ0KCQkJew0KCQkJCSRzZWFyY2hSZXBsYWNlWyRudW1iZXJdID0gc2VsZjo6bnVtYmVyKChpbnQpJG51bWJlcik7DQoJCQl9DQoNCgkJCS8vIG5vdyByZXBsYWNlIG51bWJlcnMgaW4gc3RyaW5nDQoJCQkkc3RyaW5nID0gc3RyX3JlcGxhY2UoYXJyYXlfa2V5cygkc2VhcmNoUmVwbGFjZSksIGFycmF5X3ZhbHVlcygkc2VhcmNoUmVwbGFjZSksICRzdHJpbmcpOw0KDQoJCQkvLyBjaGVjayBpZiB3ZSBtaXNzZWQgYW55LCBzdHJhbmdlIGlmIHdlIGRpZC4NCgkJCXJldHVybiBzZWxmOjpudW1iZXJzKCRzdHJpbmcpOw0KCQl9DQoNCgkJLy8gcmV0dXJuIHRoZSBzdHJpbmcgd2l0aCBubyBudW1iZXJzIHJlbWFpbmluZy4NCgkJcmV0dXJuICRzdHJpbmc7DQoJfQ0KDQoJLyoqDQoJICogQ29udmVydCBhbiBpbnRlZ2VyIGludG8gYW4gRW5nbGlzaCB3b3JkIHN0cmluZw0KCSAqIFRoYW5rcyB0byBUb20gTmljaG9sc29uIDxodHRwOi8vcGhwLm5ldC9tYW51YWwvZW4vZnVuY3Rpb24uc3RydmFsLnBocCM0MTk4OD4NCgkgKg0KCSAqIEBpbnB1dAlhbiBpbnQNCgkgKiBAcmV0dXJucyBhIHN0cmluZw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIG51bWJlcigkeCkNCgl7DQoJCSRud29yZHMgPSBhcnJheSggInplcm8iLCAib25lIiwgInR3byIsICJ0aHJlZSIsICJmb3VyIiwgImZpdmUiLCAic2l4IiwgInNldmVuIiwNCgkJCSJlaWdodCIsICJuaW5lIiwgInRlbiIsICJlbGV2ZW4iLCAidHdlbHZlIiwgInRoaXJ0ZWVuIiwNCgkJCSJmb3VydGVlbiIsICJmaWZ0ZWVuIiwgInNpeHRlZW4iLCAic2V2ZW50ZWVuIiwgImVpZ2h0ZWVuIiwNCgkJCSJuaW5ldGVlbiIsICJ0d2VudHkiLCAzMCA9PiAidGhpcnR5IiwgNDAgPT4gImZvcnR5IiwNCgkJCTUwID0+ICJmaWZ0eSIsIDYwID0+ICJzaXh0eSIsIDcwID0+ICJzZXZlbnR5IiwgODAgPT4gImVpZ2h0eSIsDQoJCQk5MCA9PiAibmluZXR5IiApOw0KDQoJCWlmKCFpc19udW1lcmljKCR4KSkNCgkJew0KCQkJJHcgPSAkeDsNCgkJfQ0KCQllbHNlaWYoZm1vZCgkeCwgMSkgIT0gMCkNCgkJew0KCQkJJHcgPSAkeDsNCgkJfQ0KCQllbHNlDQoJCXsNCgkJCWlmKCR4IDwgMCkNCgkJCXsNCgkJCQkkdyA9ICdtaW51cyAnOw0KCQkJCSR4ID0gLSR4Ow0KCQkJfQ0KCQkJZWxzZQ0KCQkJew0KCQkJCSR3ID0gJyc7DQoJCQkJLy8gLi4uIG5vdyAkeCBpcyBhIG5vbi1uZWdhdGl2ZSBpbnRlZ2VyLg0KCQkJfQ0KDQoJCQlpZigkeCA8IDIxKSAgIC8vIDAgdG8gMjANCgkJCXsNCgkJCQkkdyAuPSAkbndvcmRzWyR4XTsNCgkJCX0NCgkJCWVsc2VpZigkeCA8IDEwMCkgIC8vIDIxIHRvIDk5DQoJCQl7IA0KCQkJCSR3IC49ICRud29yZHNbMTAgKiBmbG9vcigkeC8xMCldOw0KCQkJCSRyID0gZm1vZCgkeCwgMTApOw0KCQkJCWlmKCRyID4gMCkNCgkJCQl7DQoJCQkJCSR3IC49ICcgJyAuICRud29yZHNbJHJdOw0KCQkJCX0NCgkJCX0NCgkJCWVsc2VpZigkeCA8IDEwMDApICAvLyAxMDAgdG8gOTk5DQoJCQl7DQoJCQkJJHcgLj0gJG53b3Jkc1tmbG9vcigkeC8xMDApXSAuJyBodW5kcmVkJzsNCgkJCQkkciA9IGZtb2QoJHgsIDEwMCk7DQoJCQkJaWYoJHIgPiAwKQ0KCQkJCXsNCgkJCQkJJHcgLj0gJyBhbmQgJy4gc2VsZjo6bnVtYmVyKCRyKTsNCgkJCQl9DQoJCQl9DQoJCQllbHNlaWYoJHggPCAxMDAwMDAwKSAgLy8gMTAwMCB0byA5OTk5OTkNCgkJCXsNCgkJCQkkdyAuPSBzZWxmOjpudW1iZXIoZmxvb3IoJHgvMTAwMCkpIC4nIHRob3VzYW5kJzsNCgkJCQkkciA9IGZtb2QoJHgsIDEwMDApOw0KCQkJCWlmKCRyID4gMCkNCgkJCQl7DQoJCQkJCSR3IC49ICcgJzsNCgkJCQkJaWYoJHIgPCAxMDApDQoJCQkJCXsNCgkJCQkJCSR3IC49ICdhbmQgJzsNCgkJCQkJfQ0KCQkJCQkkdyAuPSBzZWxmOjpudW1iZXIoJHIpOw0KCQkJCX0NCgkJCX0gDQoJCQllbHNlIC8vICBtaWxsaW9ucw0KCQkJeyAgICANCgkJCQkkdyAuPSBzZWxmOjpudW1iZXIoZmxvb3IoJHgvMTAwMDAwMCkpIC4nIG1pbGxpb24nOw0KCQkJCSRyID0gZm1vZCgkeCwgMTAwMDAwMCk7DQoJCQkJaWYoJHIgPiAwKQ0KCQkJCXsNCgkJCQkJJHcgLj0gJyAnOw0KCQkJCQlpZigkciA8IDEwMCkNCgkJCQkJew0KCQkJCQkJJHcgLj0gJ2FuZCAnOw0KCQkJCQl9DQoJCQkJCSR3IC49IHNlbGY6Om51bWJlcigkcik7DQoJCQkJfQ0KCQkJfQ0KCQl9DQoJCXJldHVybiAkdzsNCgl9DQoNCgkvKioNCgkgKiBSYW5kb20gS2V5DQoJICoNCgkgKiBAcmV0dXJucyBhIHN0cmluZw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIHJhbmRvbSgkc2l6ZSkNCgl7DQoJCSRiYWcgPSAiYWJjZWZnaGlqa25vcHFyc3R1d3h5ekFCQ0RERUZHSElKS0xMTU1OT1BRUlNUVVZWV1hZWmFiY2RkZWZnaGlqa2xsbW1ub3BxcnN0dXZ2d3h5ekFCQ0VGR0hJSktOT1BRUlNUVVdYWVoiOw0KCQkka2V5ID0gYXJyYXkoKTsNCgkJJGJhZ3NpemUgPSBzdHJsZW4oJGJhZykgLSAxOw0KDQoJCWZvciAoJGkgPSAwOyAkaSA8ICRzaXplOyAkaSsrKQ0KCQl7DQoJCQkkZ2V0ID0gcmFuZCgwLCAkYmFnc2l6ZSk7DQoJCQkka2V5W10gPSAkYmFnWyRnZXRdOw0KCQl9DQoNCgkJcmV0dXJuIGltcGxvZGUoJGtleSk7DQoJfQ0K', '{}', 'StringHelper', 'VDM\\Joomla\\Utilities.StringHelper', '1.0.0', '{}', 'Utilities String Helper', 'abstract class', '{\"use_selection0\":{\"use\":\"640b5352-fb09-425f-a26e-cd44eda03f15\",\"as\":\"default\"}}', '', 1, '2022-03-08 21:35:37', '2022-05-27 08:31:35', 25, 7), -(13, '', 'Some array tricks helper\r\n\r\n@since 3.0.9', '', '', '0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a', '', '', '', '{}', 'CS8qKg0KCSAqIENoZWNrIGlmIGhhdmUgYW4gYXJyYXkgd2l0aCBhIGxlbmd0aA0KCSAqDQoJICogQGlucHV0CWFycmF5ICAgVGhlIGFycmF5IHRvIGNoZWNrDQoJICoNCgkgKiBAcmV0dXJucyBib29sL2ludCAgbnVtYmVyIG9mIGl0ZW1zIGluIGFycmF5IG9uIHN1Y2Nlc3MNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBjaGVjaygkYXJyYXksICRyZW1vdmVFbXB0eVN0cmluZyA9IGZhbHNlKQ0KCXsNCgkJaWYgKGlzX2FycmF5KCRhcnJheSkgJiYgKCRuciA9IGNvdW50KChhcnJheSkkYXJyYXkpKSA+IDApDQoJCXsNCgkJCS8vIGFsc28gbWFrZSBzdXJlIHRoZSBlbXB0eSBzdHJpbmdzIGFyZSByZW1vdmVkDQoJCQlpZiAoJHJlbW92ZUVtcHR5U3RyaW5nKQ0KCQkJew0KCQkJCWZvcmVhY2ggKCRhcnJheSBhcyAka2V5ID0+ICRzdHJpbmcpDQoJCQkJew0KCQkJCQlpZiAoZW1wdHkoJHN0cmluZykpDQoJCQkJCXsNCgkJCQkJCXVuc2V0KCRhcnJheVska2V5XSk7DQoJCQkJCX0NCgkJCQl9DQoJCQkJcmV0dXJuIHNlbGY6OmNoZWNrKCRhcnJheSwgZmFsc2UpOw0KCQkJfQ0KCQkJcmV0dXJuICRucjsNCgkJfQ0KCQlyZXR1cm4gZmFsc2U7DQoJfQ0KDQoJLyoqDQoJICogTWVyZ2UgYW4gYXJyYXkgb2YgYXJyYXkncw0KCSAqDQoJICogQGlucHV0CWFycmF5ICAgVGhlIGFycmF5cyB5b3Ugd291bGQgbGlrZSB0byBtZXJnZQ0KCSAqDQoJICogQHJldHVybnMgYXJyYXkgb24gc3VjY2Vzcw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIG1lcmdlKCRhcnJheXMpDQoJew0KCQlpZihzZWxmOjpjaGVjaygkYXJyYXlzKSkNCgkJew0KCQkJJGFycmF5QnVrZXQgPSBhcnJheSgpOw0KCQkJZm9yZWFjaCAoJGFycmF5cyBhcyAkYXJyYXkpDQoJCQl7DQoJCQkJaWYgKHNlbGY6OmNoZWNrKCRhcnJheSkpDQoJCQkJew0KCQkJCQkkYXJyYXlCdWtldCA9IGFycmF5X21lcmdlKCRhcnJheUJ1a2V0LCAkYXJyYXkpOw0KCQkJCX0NCgkJCX0NCgkJCXJldHVybiAkYXJyYXlCdWtldDsNCgkJfQ0KCQlyZXR1cm4gZmFsc2U7DQoJfQ0KDQoJLyoqDQoJICogQ2hlY2sgaWYgYXJyYXlzIGludGVyc2VjdA0KCSAqDQoJICogQGlucHV0CWFycmF5ICAgVGhlIGZpcnN0IGFycmF5DQoJICogQGlucHV0CWFycmF5ICAgVGhlIHNlY29uZCBhcnJheQ0KCSAqDQoJICogQHJldHVybnMgYm9vbCAgdHJ1ZSBpZiBpbnRlcnNlY3QgZWxzZSBmYWxzZQ0KCSAqIA0KCSAqIEBzaW5jZSAgMy4xLjENCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGludGVyc2VjdCgkYV9hcnJheSwgJGJfYXJyYXkpDQoJew0KCQkvLyBmbGlwIHRoZSBzZWNvbmQgYXJyYXkNCgkJJGJfYXJyYXkgPSBhcnJheV9mbGlwKCRiX2FycmF5KTsNCg0KCQkvLyBsb29wIHRoZSBmaXJzdCBhcnJheQ0KCQlmb3JlYWNoICgkYV9hcnJheSBhcyAkdikNCgkJew0KCQkJaWYgKGlzc2V0KCRiX2FycmF5WyR2XSkpDQoJCQl7DQoJCQkJcmV0dXJuIHRydWU7DQoJCQl9DQoJCX0NCgkJcmV0dXJuIGZhbHNlOw0KCX0NCg==', '{}', 'ArrayHelper', 'VDM\\Joomla\\Utilities.ArrayHelper', '1.0.0', '{}', 'Utilities Array Helper', 'abstract class', '{}', '', 1, '2022-03-08 22:53:52', '2022-06-13 10:25:15', 14, 8), -(14, '', 'Control the naming of a namespace helper\r\n\r\n@since 3.0.9', '', '', 'ce8cf834-6bac-44fb-941c-861f7e046cc0', '', '', '', '{}', 'CS8qKg0KCSAqIE1ha2luZyBuYW1lc3BhY2Ugc2FmZQ0KCSAqDQoJICogQGlucHV0CXN0cmluZyAgICAgICBUaGUgeW91IHdvdWxkIGxpa2UgdG8gbWFrZSBzYWZlDQoJICoNCgkgKiBAcmV0dXJucyBzdHJpbmcgb24gc3VjY2Vzcw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIHNhZmUoJHN0cmluZykNCgl7DQoJCS8vIDBubHkgY29udGludWUgaWYgd2UgaGF2ZSBhIHN0cmluZw0KCQlpZiAoU3RyaW5nSGVscGVyOjpjaGVjaygkc3RyaW5nKSkNCgkJew0KCQkJLy8gbWFrZSBzdXJlIGl0IGhhcyBub3QgbnVtYmVycw0KCQkJJHN0cmluZyA9IFN0cmluZ0hlbHBlcjo6bnVtYmVycygkc3RyaW5nKTsNCg0KCQkJLy8gVHJhbnNsaXRlcmF0ZSBzdHJpbmcgVE9ETzogbG9vayBhZ2FpbiBhcyB0aGlzIG1ha2UgaXQgbG93ZXJjYXNlDQoJCQkvLyAkc3RyaW5nID0gU3RyaW5nSGVscGVyOjp0cmFuc2xpdGVyYXRlKCRzdHJpbmcpOw0KDQoJCQkvLyBmaXJzdCByZW1vdmUgYWxsIFtcXSBiYWNrc2xhc2hlcw0KCQkJJHN0cmluZyA9IHN0cl9yZXBsYWNlKCdcXCcsICcxJywgJHN0cmluZyk7DQoNCgkJCS8vIHJlbW92ZSBhbGwgYW5kIGtlZXAgb25seSBjaGFyYWN0ZXJzIGFuZCBbXF0gYmFja3NsYXNoZXMgaW5zaWRlIG9mIHRoZSBzdHJpbmcNCgkJCSRzdHJpbmcgPSB0cmltKCBwcmVnX3JlcGxhY2UoIi9bXkEtWmEtejFdLyIsICcnLCAkc3RyaW5nKSwgJzEnKTsNCg0KCQkJLy8gcGxhY2UgdGhlIFtcXSBiYWNrc2xhc2hlcyBiYWNrDQoJCQlyZXR1cm4gdHJpbSggcHJlZ19yZXBsYWNlKCIvMSsvIiwgJ1xcJywgJHN0cmluZykpOw0KCQl9DQoJCS8vIG5vdCBhIHN0cmluZw0KCQlyZXR1cm4gJyc7DQoJfQ0K', '{}', 'NamespaceHelper', 'VDM\\Joomla\\Utilities.String.NamespaceHelper', '1.0.0', '{}', 'String Namespace Helper', 'abstract class', '{\"use_selection0\":{\"use\":\"1f28cb53-60d9-4db1-b517-3c7dc6b429ef\"}}', '', 1, '2022-03-08 23:27:57', '2022-05-21 13:27:39', 15, 5), -(15, 1, 'Control the naming of a field type\r\n\r\n@since 3.0.9', '', '', 'a8935cbe-7701-40dc-bfd5-675f2d600954', 'dXNlIEpvb21sYVxDTVNcQ29tcG9uZW50XENvbXBvbmVudEhlbHBlcjs=', '', '', '{}', 'CS8qKg0KCSAqIFRoZSBmaWVsZCBidWlsZGVyIHN3aXRjaA0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwcm90ZWN0ZWQgc3RhdGljICRidWlsZGVyID0gZmFsc2U7DQoNCgkvKioNCgkgKiBNYWtpbmcgZmllbGQgdHlwZSBuYW1lIHNhZmUNCgkgKg0KCSAqIEBwYXJhbSAgIFN0cmluZyAgICAgICRzdHJpbmcgICAgIFRoZSB5b3Ugd291bGQgbGlrZSB0byBtYWtlIHNhZmUNCgkgKiBAcGFyYW0gICBTdHJpbmcgICAgICAkb3B0aW9uICAgIFRoZSBvcHRpb24gZm9yIHRoZSBjb21wb25lbnQuDQoJICoNCgkgKiBAcmV0dXJucyBzdHJpbmcgb24gc3VjY2Vzcw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIHNhZmUoJHN0cmluZywgJG9wdGlvbiA9IG51bGwpDQoJew0KCQkvLyBnZXQgZ2xvYmFsIHZhbHVlDQoJCWlmIChzZWxmOjokYnVpbGRlciA9PT0gZmFsc2UpDQoJCXsNCgkJCXNlbGY6OiRidWlsZGVyID0gSGVscGVyOjpnZXRQYXJhbXMoJG9wdGlvbiktPmdldCgndHlwZV9uYW1lX2J1aWxkZXInLCAxKTsNCgkJfQ0KDQoJCS8vIHVzZSB0aGUgbmV3IGNvbnZlbnRpb24NCgkJaWYgKDIgPT0gc2VsZjo6JGJ1aWxkZXIpDQoJCXsNCgkJCS8vIDBubHkgY29udGludWUgaWYgd2UgaGF2ZSBhIHN0cmluZw0KCQkJaWYgKFN0cmluZ0hlbHBlcjo6Y2hlY2soJHN0cmluZykpDQoJCQl7DQoJCQkJLy8gY2hlY2sgdGhhdCB0aGUgZmlyc3QgY2hhcmFjdGVyIGlzIG5vdCBhIG51bWJlcg0KCQkJCWlmIChpc19udW1lcmljKHN1YnN0cigkc3RyaW5nLCAwLCAxKSkpDQoJCQkJew0KCQkJCQkkc3RyaW5nID0gU3RyaW5nSGVscGVyOjpudW1iZXJzKCRzdHJpbmcpOw0KCQkJCX0NCg0KCQkJCS8vIFRyYW5zbGl0ZXJhdGUgc3RyaW5nDQoJCQkJJHN0cmluZyA9IFN0cmluZ0hlbHBlcjo6dHJhbnNsaXRlcmF0ZSgkc3RyaW5nKTsNCg0KCQkJCS8vIHJlbW92ZSBhbGwgYW5kIGtlZXAgb25seSBjaGFyYWN0ZXJzIGFuZCBudW1iZXJzIGFuZCBwb2ludCAoVE9ETyBqdXN0IG9uZSBwb2ludCkNCgkJCQkkc3RyaW5nID0gdHJpbShwcmVnX3JlcGxhY2UoIi9bXkEtWmEtejAtOVwuXS8iLCAnJywgJHN0cmluZykpOw0KDQoJCQkJLy8gYmVzdCBpcyB0byByZXR1cm4gbG93ZXIgKGZvciBhbGwgc3RyaW5nIGVxdWFsaXR5IGluIGNvbXBpbGVyKQ0KCQkJCXJldHVybiBzdHJ0b2xvd2VyKCRzdHJpbmcpOw0KCQkJfQ0KCQkJLy8gbm90IGEgc3RyaW5nDQoJCQlyZXR1cm4gJyc7DQoJCX0NCg0KCQkvLyB1c2UgdGhlIGRlZmF1bHQgKG9yaWdpbmFsIGJlaGF2aW91ci9jb252ZW50aW9uKQ0KCQlyZXR1cm4gU3RyaW5nSGVscGVyOjpzYWZlKCRzdHJpbmcpOw0KCX0NCg==', '{}', 'TypeHelper', 'VDM\\Joomla\\Utilities.String.TypeHelper', '1.0.0', '{}', 'String Type Helper', 'abstract class', '{\"use_selection0\":{\"use\":\"1f28cb53-60d9-4db1-b517-3c7dc6b429ef\"},\"use_selection1\":{\"use\":\"640b5352-fb09-425f-a26e-cd44eda03f15\"}}', '', 1, '2022-03-08 23:33:09', '2022-05-21 13:27:39', 14, 5), -(16, '', 'Control the naming of a class and function\r\n\r\n@since 3.0.9', '', '', '30c5b4c2-f75f-4d15-869a-f8bfedd87358', '', '', '', '{}', 'CS8qKg0KCSAqIE1ha2luZyBjbGFzcyBvciBmdW5jdGlvbiBuYW1lIHNhZmUNCgkgKg0KCSAqIEBpbnB1dAlzdHJpbmcgICAgICAgVGhlIG5hbWUgeW91IHdvdWxkIGxpa2UgdG8gbWFrZSBzYWZlDQoJICoNCgkgKiBAcmV0dXJucyBzdHJpbmcgb24gc3VjY2Vzcw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIHNhZmUoJG5hbWUpDQoJew0KCQkvLyByZW1vdmUgbnVtYmVycyBpZiB0aGUgZmlyc3QgY2hhcmFjdGVyIGlzIGEgbnVtYmVyDQoJCWlmIChpc19udW1lcmljKHN1YnN0cigkbmFtZSwgMCwgMSkpKQ0KCQl7DQoJCQkkbmFtZSA9IFN0cmluZ0hlbHBlcjo6bnVtYmVycygkbmFtZSk7DQoJCX0NCg0KCQkvLyByZW1vdmUgYWxsIHNwYWNlcyBhbmQgc3RyYW5nZSBjaGFyYWN0ZXJzDQoJCXJldHVybiB0cmltKHByZWdfcmVwbGFjZSgiL1teQS1aYS16MC05Xy1dLyIsICcnLCAkbmFtZSkpOw0KCX0NCg==', '{}', 'ClassfunctionHelper', 'VDM\\Joomla\\Utilities.String.ClassfunctionHelper', '1.0.0', '{}', 'String Classfunction Helper', 'abstract class', '{\"use_selection0\":{\"use\":\"1f28cb53-60d9-4db1-b517-3c7dc6b429ef\"}}', '', 1, '2022-03-08 23:43:10', '2022-05-21 13:27:39', 14, 5), -(17, 1, 'Some easy get...\r\n\r\n@since 3.0.9', '', '', 'db87c339-5bb6-4291-a7ef-2c48ea1b06bc', 'dXNlIEpvb21sYVxDTVNcRmFjdG9yeTs=', '', '', '{\"load_selection0\":{\"load\":\"0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a\"},\"load_selection1\":{\"load\":\"1f28cb53-60d9-4db1-b517-3c7dc6b429ef\"}}', 'CS8qKg0KCSAqIEdldCBhIFZhcmlhYmxlIA0KCSAqDQoJICogQHBhcmFtICAgc3RyaW5nICAgJHRhYmxlICAgICAgICBUaGUgdGFibGUgZnJvbSB3aGljaCB0byBnZXQgdGhlIHZhcmlhYmxlDQoJICogQHBhcmFtICAgc3RyaW5nICAgJHdoZXJlICAgICAgICBUaGUgdmFsdWUgd2hlcmUNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkd2hlcmVTdHJpbmcgIFRoZSB0YXJnZXQvZmllbGQgc3RyaW5nIHdoZXJlL25hbWUNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkd2hhdCAgICAgICAgIFRoZSByZXR1cm4gZmllbGQNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkb3BlcmF0b3IgICAgIFRoZSBvcGVyYXRvciBiZXR3ZWVuICR3aGVyZVN0cmluZy9maWVsZCBhbmQgJHdoZXJlL3ZhbHVlDQoJICogQHBhcmFtICAgc3RyaW5nICAgJG1haW4gICAgICAgICBUaGUgY29tcG9uZW50IGluIHdoaWNoIHRoZSB0YWJsZSBpcyBmb3VuZA0KCSAqDQoJICogQHJldHVybiAgbWl4IHN0cmluZy9pbnQvZmxvYXQNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiB2YXIoJHRhYmxlLCAkd2hlcmUgPSBudWxsLCAkd2hlcmVTdHJpbmcgPSAndXNlcicsICR3aGF0ID0gJ2lkJywgJG9wZXJhdG9yID0gJz0nLCAkbWFpbiA9IG51bGwpDQoJew0KCQlpZihlbXB0eSgkd2hlcmUpKQ0KCQl7DQoJCQkkd2hlcmUgPSBGYWN0b3J5OjpnZXRVc2VyKCktPmlkOw0KCQl9DQoNCgkJaWYoZW1wdHkoJG1haW4pKQ0KCQl7DQoJCQkkbWFpbiA9IEhlbHBlcjo6Z2V0Q29kZSgpOw0KCQl9DQoNCgkJLy8gR2V0IGEgZGIgY29ubmVjdGlvbi4NCgkJJGRiID0gRmFjdG9yeTo6Z2V0RGJvKCk7DQoNCgkJLy8gQ3JlYXRlIGEgbmV3IHF1ZXJ5IG9iamVjdC4NCgkJJHF1ZXJ5ID0gJGRiLT5nZXRRdWVyeSh0cnVlKTsNCgkJJHF1ZXJ5LT5zZWxlY3QoJGRiLT5xdW90ZU5hbWUoYXJyYXkoJHdoYXQpKSk7DQoNCgkJaWYgKGVtcHR5KCR0YWJsZSkpDQoJCXsNCgkJCSRxdWVyeS0+ZnJvbSgkZGItPnF1b3RlTmFtZSgnI19fJyAuICRtYWluKSk7DQoJCX0NCgkJZWxzZQ0KCQl7DQoJCQkkcXVlcnktPmZyb20oJGRiLT5xdW90ZU5hbWUoJyNfXycgLiAkbWFpbiAuICdfJyAuICR0YWJsZSkpOw0KCQl9DQoNCgkJaWYgKGlzX251bWVyaWMoJHdoZXJlKSkNCgkJew0KCQkJJHF1ZXJ5LT53aGVyZSgkZGItPnF1b3RlTmFtZSgkd2hlcmVTdHJpbmcpIC4gJyAnIC4gJG9wZXJhdG9yIC4gJyAnIC4gKGludCkgJHdoZXJlKTsNCgkJfQ0KCQllbHNlaWYgKGlzX3N0cmluZygkd2hlcmUpKQ0KCQl7DQoJCQkkcXVlcnktPndoZXJlKCRkYi0+cXVvdGVOYW1lKCR3aGVyZVN0cmluZykgLiAnICcgLiAkb3BlcmF0b3IgLiAnICcgLiAkZGItPnF1b3RlKChzdHJpbmcpJHdoZXJlKSk7DQoJCX0NCgkJZWxzZQ0KCQl7DQoJCQlyZXR1cm4gZmFsc2U7DQoJCX0NCg0KCQkkZGItPnNldFF1ZXJ5KCRxdWVyeSk7DQoJCSRkYi0+ZXhlY3V0ZSgpOw0KDQoJCWlmICgkZGItPmdldE51bVJvd3MoKSkNCgkJew0KCQkJcmV0dXJuICRkYi0+bG9hZFJlc3VsdCgpOw0KCQl9DQoJCXJldHVybiBmYWxzZTsNCgl9DQoNCgkvKioNCgkgKiBHZXQgYXJyYXkgb2YgdmFyaWFibGVzDQoJICoNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkdGFibGUgICAgICAgIFRoZSB0YWJsZSBmcm9tIHdoaWNoIHRvIGdldCB0aGUgdmFyaWFibGVzDQoJICogQHBhcmFtICAgc3RyaW5nICAgJHdoZXJlICAgICAgICBUaGUgdmFsdWUgd2hlcmUNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkd2hlcmVTdHJpbmcgIFRoZSB0YXJnZXQvZmllbGQgc3RyaW5nIHdoZXJlL25hbWUNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkd2hhdCAgICAgICAgIFRoZSByZXR1cm4gZmllbGQNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkb3BlcmF0b3IgICAgIFRoZSBvcGVyYXRvciBiZXR3ZWVuICR3aGVyZVN0cmluZy9maWVsZCBhbmQgJHdoZXJlL3ZhbHVlDQoJICogQHBhcmFtICAgc3RyaW5nICAgJG1haW4gICAgICAgICBUaGUgY29tcG9uZW50IGluIHdoaWNoIHRoZSB0YWJsZSBpcyBmb3VuZA0KCSAqIEBwYXJhbSAgIGJvb2wgICAgICR1bmlxdWUgICAgICAgVGhlIHN3aXRjaCB0byByZXR1cm4gYSB1bmlxdWUgYXJyYXkNCgkgKg0KCSAqIEByZXR1cm4gIGFycmF5DQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gdmFycygkdGFibGUsICR3aGVyZSA9IG51bGwsICR3aGVyZVN0cmluZyA9ICd1c2VyJywgJHdoYXQgPSAnaWQnLCAkb3BlcmF0b3IgPSAnSU4nLCAkbWFpbiA9IG51bGwsICR1bmlxdWUgPSB0cnVlKQ0KCXsNCgkJaWYoZW1wdHkoJHdoZXJlKSkNCgkJew0KCQkJJHdoZXJlID0gRmFjdG9yeTo6Z2V0VXNlcigpLT5pZDsNCgkJfQ0KDQoJCWlmKGlzX251bGwoJG1haW4pKQ0KCQl7DQoJCQkkbWFpbiA9IEhlbHBlcjo6Z2V0Q29kZSgpOw0KCQl9DQoNCgkJaWYgKCFBcnJheUhlbHBlcjo6Y2hlY2soJHdoZXJlKSAmJiAkd2hlcmUgPiAwKQ0KCQl7DQoJCQkkd2hlcmUgPSBhcnJheSgkd2hlcmUpOw0KCQl9DQoNCgkJaWYgKEFycmF5SGVscGVyOjpjaGVjaygkd2hlcmUpKQ0KCQl7DQoJCQkvLyBwcmVwIG1haW4gPC0tIHdoeT8gd2VsbCBpZiAkbWFpbj0nJyBpcyBlbXB0eSB0aGVuICR0YWJsZSBjYW4gYmUgY2F0ZWdvcmllcyBvciB1c2Vycw0KCQkJaWYgKFN0cmluZ0hlbHBlcjo6Y2hlY2soJG1haW4pKQ0KCQkJew0KCQkJCSRtYWluID0gJ18nIC4gbHRyaW0oJG1haW4sICdfJyk7DQoJCQl9DQoNCgkJCS8vIEdldCBhIGRiIGNvbm5lY3Rpb24uDQoJCQkkZGIgPSBGYWN0b3J5OjpnZXREYm8oKTsNCg0KCQkJLy8gQ3JlYXRlIGEgbmV3IHF1ZXJ5IG9iamVjdC4NCgkJCSRxdWVyeSA9ICRkYi0+Z2V0UXVlcnkodHJ1ZSk7DQoJCQkkcXVlcnktPnNlbGVjdCgkZGItPnF1b3RlTmFtZShhcnJheSgkd2hhdCkpKTsNCg0KCQkJaWYgKGVtcHR5KCR0YWJsZSkpDQoJCQl7DQoJCQkJJHF1ZXJ5LT5mcm9tKCRkYi0+cXVvdGVOYW1lKCcjX18nIC4gJG1haW4pKTsNCgkJCX0NCgkJCWVsc2UNCgkJCXsNCgkJCQkkcXVlcnktPmZyb20oJGRiLT5xdW90ZU5hbWUoJyNfJyAuICRtYWluIC4gJ18nIC4gJHRhYmxlKSk7DQoJCQl9DQoNCgkJCS8vIGFkZCBzdHJpbmdzIHRvIGFycmF5IHNlYXJjaA0KCQkJaWYgKCdJTl9TVFJJTkdTJyA9PT0gJG9wZXJhdG9yIHx8ICdOT1QgSU5fU1RSSU5HUycgPT09ICRvcGVyYXRvcikNCgkJCXsNCgkJCQkkcXVlcnktPndoZXJlKCRkYi0+cXVvdGVOYW1lKCR3aGVyZVN0cmluZykgLiAnICcgLiBzdHJfcmVwbGFjZSgnX1NUUklOR1MnLCAnJywgJG9wZXJhdG9yKSAuICcgKCInIC4gaW1wbG9kZSgnIiwiJywkd2hlcmUpIC4gJyIpJyk7DQoJCQl9DQoJCQllbHNlDQoJCQl7DQoJCQkJJHF1ZXJ5LT53aGVyZSgkZGItPnF1b3RlTmFtZSgkd2hlcmVTdHJpbmcpIC4gJyAnIC4gJG9wZXJhdG9yIC4gJyAoJyAuIGltcGxvZGUoJywnLCR3aGVyZSkgLiAnKScpOw0KCQkJfQ0KDQoJCQkkZGItPnNldFF1ZXJ5KCRxdWVyeSk7DQoJCQkkZGItPmV4ZWN1dGUoKTsNCg0KCQkJaWYgKCRkYi0+Z2V0TnVtUm93cygpKQ0KCQkJew0KCQkJCWlmICgkdW5pcXVlKQ0KCQkJCXsNCgkJCQkJcmV0dXJuIGFycmF5X3VuaXF1ZSgkZGItPmxvYWRDb2x1bW4oKSk7DQoJCQkJfQ0KCQkJCXJldHVybiAkZGItPmxvYWRDb2x1bW4oKTsNCgkJCX0NCgkJfQ0KCQlyZXR1cm4gZmFsc2U7DQoJfQ0KDQoJLyoqDQoJICogZ2V0IGFsbCBzdHJpbmdzIGJldHdlZW4gdHdvIG90aGVyIHN0cmluZ3MNCgkgKiANCgkgKiBAcGFyYW0gIHN0cmluZyAgICAgICAgICAkY29udGVudCAgICBUaGUgY29udGVudCB0byBzZWFyY2gNCgkgKiBAcGFyYW0gIHN0cmluZyAgICAgICAgICAkc3RhcnQgICAgICAgIFRoZSBzdGFydGluZyB2YWx1ZQ0KCSAqIEBwYXJhbSAgc3RyaW5nICAgICAgICAgICRlbmQgICAgICAgICBUaGUgZW5kaW5nIHZhbHVlDQoJICoNCgkgKiBAcmV0dXJuICBhcnJheSAgICAgICAgICBPbiBzdWNjZXNzDQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gYWxsQmV0d2VlbigkY29udGVudCwgJHN0YXJ0LCAkZW5kKQ0KCXsNCgkJLy8gcmVzZXQgYnVja2V0DQoJCSRidWNrZXQgPSBhcnJheSgpOw0KCQlmb3IgKCRpID0gMDsgOyAkaSsrKQ0KCQl7DQoJCQkvLyBzZWFyY2ggZm9yIHN0cmluZw0KCQkJJGZvdW5kID0gc2VsZjo6YmV0d2VlbigkY29udGVudCwkc3RhcnQsJGVuZCk7DQoJCQlpZiAoU3RyaW5nSGVscGVyOjpjaGVjaygkZm91bmQpKQ0KCQkJew0KCQkJCS8vIGFkZCB0byBidWNrZXQNCgkJCQkkYnVja2V0W10gPSAkZm91bmQ7DQoJCQkJLy8gYnVpbGQgcmVtb3ZhbCBzdHJpbmcNCgkJCQkkcmVtb3ZlID0gJHN0YXJ0LiRmb3VuZC4kZW5kOw0KCQkJCS8vIHJlbW92ZSBmcm9tIGNvbnRlbnQNCgkJCQkkY29udGVudCA9IHN0cl9yZXBsYWNlKCRyZW1vdmUsJycsJGNvbnRlbnQpOw0KCQkJfQ0KCQkJZWxzZQ0KCQkJew0KCQkJCWJyZWFrOw0KCQkJfQ0KCQkJLy8gc2FmZXR5IGNhdGNoDQoJCQlpZiAoJGkgPT0gNTAwKQ0KCQkJew0KCQkJCWJyZWFrOw0KCQkJfQ0KCQl9DQoJCS8vIG9ubHkgcmV0dXJuIHVuaXF1ZSBhcnJheSBvZiB2YWx1ZXMNCgkJcmV0dXJuICBhcnJheV91bmlxdWUoJGJ1Y2tldCk7DQoJfQ0KDQoJLyoqDQoJICogZ2V0IGEgc3RyaW5nIGJldHdlZW4gdHdvIG90aGVyIHN0cmluZ3MNCgkgKiANCgkgKiBAcGFyYW0gIHN0cmluZyAgICAgICAgICAkY29udGVudCAgICBUaGUgY29udGVudCB0byBzZWFyY2gNCgkgKiBAcGFyYW0gIHN0cmluZyAgICAgICAgICAkc3RhcnQgICAgICAgIFRoZSBzdGFydGluZyB2YWx1ZQ0KCSAqIEBwYXJhbSAgc3RyaW5nICAgICAgICAgICRlbmQgICAgICAgICBUaGUgZW5kaW5nIHZhbHVlDQoJICogQHBhcmFtICBzdHJpbmcgICAgICAgICAgJGRlZmF1bHQgICAgIFRoZSBkZWZhdWx0IHZhbHVlIGlmIG5vbmUgZm91bmQNCgkgKg0KCSAqIEByZXR1cm4gIHN0cmluZyAgICAgICAgICBPbiBzdWNjZXNzIC8gZW1wdHkgc3RyaW5nIG9uIGZhaWx1cmUNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBiZXR3ZWVuKCRjb250ZW50LCAkc3RhcnQsICRlbmQsICRkZWZhdWx0ID0gJycpDQoJew0KCQkkciA9IGV4cGxvZGUoJHN0YXJ0LCAkY29udGVudCk7DQoJCWlmIChpc3NldCgkclsxXSkpDQoJCXsNCgkJCSRyID0gZXhwbG9kZSgkZW5kLCAkclsxXSk7DQoJCQlyZXR1cm4gJHJbMF07DQoJCX0NCgkJcmV0dXJuICRkZWZhdWx0Ow0KCX0NCg==', '{}', 'GetHelper', 'VDM\\Joomla\\Utilities.GetHelper', '1.0.0', '{}', 'Utilities GetHelper', 'abstract class', '{\"use_selection0\":{\"use\":\"640b5352-fb09-425f-a26e-cd44eda03f15\"}}', '', 1, '2022-03-09 00:21:06', '2022-05-21 13:27:39', 20, 9), -(18, '', 'Some object tricks\r\n\r\n@since 3.0.9', '', '', '91004529-94a9-4590-b842-e7c6b624ecf5', '', '', '', '{}', 'CS8qKg0KCSAqIENoZWNrIGlmIGhhdmUgYW4gb2JqZWN0IHdpdGggYSBsZW5ndGgNCgkgKg0KCSAqIEBpbnB1dAlvYmplY3QgICBUaGUgb2JqZWN0IHRvIGNoZWNrDQoJICoNCgkgKiBAcmV0dXJucyBib29sIHRydWUgb24gc3VjY2Vzcw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGNoZWNrKCRvYmplY3QpDQoJew0KCQlpZiAoaXNfb2JqZWN0KCRvYmplY3QpKQ0KCQl7DQoJCQlyZXR1cm4gY291bnQoKGFycmF5KSAkb2JqZWN0KSA+IDA7DQoJCX0NCg0KCQlyZXR1cm4gZmFsc2U7DQoJfQ0K', '{}', 'ObjectHelper', 'VDM\\Joomla\\Utilities.ObjectHelper', '1.0.0', '{}', 'Utilities Object Helper', 'abstract class', '{}', '', 1, '2022-03-09 00:35:23', '2022-05-21 13:27:39', 12, 8), -(19, '', 'Basic Math Helper\r\n\r\n@since 3.0.9', '', '', '152c8793-8b75-4715-996a-257b9f65451c', '', '', '', '{}', 'CS8qKg0KCSAqIGJjIG1hdGggd3JhcHBlciAodmVyeSBiYXNpYyBub3QgZm9yIGFjY291bnRpbmcpDQoJICoNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAkdHlwZSAgICBUaGUgdHlwZSBiYyBtYXRoDQoJICogQHBhcmFtICAgaW50ICAgICAgJHZhbDEgICAgVGhlIGZpcnN0IHZhbHVlDQoJICogQHBhcmFtICAgaW50ICAgICAgJHZhbDIgICAgVGhlIHNlY29uZCB2YWx1ZQ0KCSAqIEBwYXJhbSAgIGludCAgICAgICRzY2FsZSAgIFRoZSBzY2FsZSB2YWx1ZQ0KCSAqDQoJICogQHJldHVybiBpbnQNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBiYygkdHlwZSwgJHZhbDEsICR2YWwyLCAkc2NhbGUgPSAwKQ0KCXsNCgkJLy8gYnVpbGQgZnVuY3Rpb24gbmFtZQ0KCQkkZnVuY3Rpb24gPSAnYmMnIC4gJHR5cGU7DQoJCS8vIHVzZSB0aGUgYmNtYXRoIGZ1bmN0aW9uIGlmIGF2YWlsYWJsZQ0KCQlpZiAoZnVuY3Rpb25fZXhpc3RzKCRmdW5jdGlvbikpDQoJCXsNCgkJCXJldHVybiAkZnVuY3Rpb24oJHZhbDEsICR2YWwyLCAkc2NhbGUpOw0KCQl9DQoJCS8vIGlmIGZ1bmN0aW9uIGRvZXMgbm90IGV4aXN0IHdlIHVzZSArLSovIG9wZXJhdG9ycyAoZmFsbGJhY2sgLSBub3QgaWRlYWwpDQoJCXN3aXRjaCAoJHR5cGUpDQoJCXsNCgkJCS8vIE11bHRpcGx5IHR3byBudW1iZXJzDQoJCQljYXNlICdtdWwnOg0KCQkJCXJldHVybiAoc3RyaW5nKSByb3VuZCgkdmFsMSAqICR2YWwyLCAkc2NhbGUpOw0KCQkJCWJyZWFrOw0KCQkJLy8gRGl2aWRlIG9mIHR3byBudW1iZXJzDQoJCQljYXNlICdkaXYnOg0KCQkJCXJldHVybiAoc3RyaW5nKSByb3VuZCgkdmFsMSAvICR2YWwyLCAkc2NhbGUpOw0KCQkJCWJyZWFrOw0KCQkJLy8gQWRkaW5nIHR3byBudW1iZXJzDQoJCQljYXNlICdhZGQnOg0KCQkJCXJldHVybiAoc3RyaW5nKSByb3VuZCgkdmFsMSArICR2YWwyLCAkc2NhbGUpOw0KCQkJCWJyZWFrOw0KCQkJLy8gU3VidHJhY3Qgb25lIG51bWJlciBmcm9tIHRoZSBvdGhlcg0KCQkJY2FzZSAnc3ViJzoNCgkJCQlyZXR1cm4gKHN0cmluZykgcm91bmQoJHZhbDEgLSAkdmFsMiwgJHNjYWxlKTsNCgkJCQlicmVhazsNCgkJCS8vIFJhaXNlIGFuIGFyYml0cmFyeSBwcmVjaXNpb24gbnVtYmVyIHRvIGFub3RoZXINCgkJCWNhc2UgJ3Bvdyc6DQoJCQkJcmV0dXJuIChzdHJpbmcpIHJvdW5kKHBvdygkdmFsMSwgJHZhbDIpLCAkc2NhbGUpOw0KCQkJCWJyZWFrOw0KCQkJLy8gQ29tcGFyZSB0d28gYXJiaXRyYXJ5IHByZWNpc2lvbiBudW1iZXJzDQoJCQljYXNlICdjb21wJzoNCgkJCQlyZXR1cm4gKHJvdW5kKCR2YWwxLDIpID09IHJvdW5kKCR2YWwyLDIpKTsNCgkJCQlicmVhazsNCgkJfQ0KCQlyZXR1cm4gZmFsc2U7DQoJfQ0KDQoJLyoqDQoJICogQmFzaWMgc3VtIG9mIGFuIGFycmF5IHdpdGggbW9yZSBwcmVjaXNpb24NCgkgKg0KCSAqIEBwYXJhbSAgIGFycmF5ICAgJGFycmF5ICAgIFRoZSB2YWx1ZXMgdG8gc3VtDQoJICogQHBhcmFtICAgaW50ICAgICAgJHNjYWxlICAgVGhlIHNjYWxlIHZhbHVlDQoJICoNCgkgKiBAcmV0dXJuIGZsb2F0DQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gc3VtKCRhcnJheSwgJHNjYWxlID0gNCkNCgl7DQoJCS8vIHVzZSB0aGUgYmNhZGQgZnVuY3Rpb24gaWYgYXZhaWxhYmxlDQoJCWlmIChmdW5jdGlvbl9leGlzdHMoJ2JjYWRkJykpDQoJCXsNCgkJCS8vIHNldCB0aGUgc3RhcnQgdmFsdWUNCgkJCSR2YWx1ZSA9IDAuMDsNCgkJCS8vIGxvb3AgdGhlIHZhbHVlcyBhbmQgcnVuIGJjYWRkDQoJCQlmb3JlYWNoKCRhcnJheSBhcyAkdmFsKQ0KCQkJew0KCQkJCSR2YWx1ZSA9IGJjYWRkKCR2YWx1ZSwgJHZhbCwgJHNjYWxlKTsNCgkJCX0NCgkJCXJldHVybiAkdmFsdWU7DQoJCX0NCgkJLy8gZmFsbCBiYWNrIG9uIGFycmF5IHN1bQ0KCQlyZXR1cm4gYXJyYXlfc3VtKCRhcnJheSk7DQoJfQ0K', '{}', 'MathHelper', 'VDM\\Joomla\\Utilities.MathHelper', '1.0.0', '{}', 'Utilities Math Helper', 'abstract class', '{}', '', 1, '2022-03-09 13:05:39', '2022-05-21 13:27:39', 8, 9), -(20, '', 'Control the naming of a plugin\r\n\r\n@since 3.0.9', '', '', '3cf76fbf-fd95-4a33-878e-7aff6d36b7f6', '', '', '', '{}', 'CS8qKg0KCSAqIE1ha2luZyBwbHVnaW4gZm9sZGVyIG5hbWUgc2FmZQ0KCSAqDQoJICogQGlucHV0CXN0cmluZyAgICAkY29kZU5hbWUgICBUaGUgbmFtZQ0KCSAqIEBpbnB1dAlzdHJpbmcgICAgJGdyb3VwICAgVGhlIGdyb3VwIG5hbWUNCgkgKg0KCSAqIEByZXR1cm5zIHN0cmluZyBvbiBzdWNjZXNzDQoJICogDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gc2FmZUZvbGRlck5hbWUoJGNvZGVOYW1lLCAkZ3JvdXApDQoJew0KCQkvLyBlZGl0b3JzLXh0ZCBncm91cCBwbHVnaW5zIG11c3QgaGF2ZSBhIGNsYXNzIHdpdGggcGxnQnV0dG9uPFBsdWdpbk5hbWU+IHN0cnVjdHVyZQ0KCQlpZiAoJGdyb3VwID09PSAnZWRpdG9ycy14dGQnKQ0KCQl7DQoJCQkkZ3JvdXAgPSAnQnV0dG9uJzsNCgkJfQ0KDQoJCXJldHVybiAncGxnXycgLiBzdHJ0b2xvd2VyKCRncm91cCkgLiAnXycgLiBzdHJ0b2xvd2VyKA0KCQkJJGNvZGVOYW1lDQoJCSk7DQoJfQ0KDQoJLyoqDQoJICogTWFraW5nIHBsdWdpbiBjbGFzcyBuYW1lIHNhZmUNCgkgKg0KCSAqIEBpbnB1dAlzdHJpbmcgICAgJGNvZGVOYW1lICAgVGhlIG5hbWUNCgkgKiBAaW5wdXQJc3RyaW5nICAgICRncm91cCAgIFRoZSBncm91cCBuYW1lDQoJICoNCgkgKiBAcmV0dXJucyBzdHJpbmcgb24gc3VjY2Vzcw0KCSAqIA0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIHNhZmVDbGFzc05hbWUoJGNvZGVOYW1lLCAkZ3JvdXApDQoJew0KCQkvLyBlZGl0b3JzLXh0ZCBncm91cCBwbHVnaW5zIG11c3QgaGF2ZSBhIGNsYXNzIHdpdGggcGxnQnV0dG9uPFBsdWdpbk5hbWU+IHN0cnVjdHVyZQ0KCQlpZiAoJGdyb3VwID09PSAnZWRpdG9ycy14dGQnKQ0KCQl7DQoJCQkkZ3JvdXAgPSAnQnV0dG9uJzsNCgkJfQ0KDQoJCXJldHVybiAnUGxnJyAuIHVjZmlyc3QoJGdyb3VwKSAuIHVjZmlyc3QoDQoJCQkkY29kZU5hbWUNCgkJKTsNCgl9DQoNCgkvKioNCgkgKiBNYWtpbmcgcGx1Z2luIGluc3RhbGwgY2xhc3MgbmFtZSBzYWZlDQoJICoNCgkgKiBAaW5wdXQJc3RyaW5nICAgICRjb2RlTmFtZSAgIFRoZSBuYW1lDQoJICogQGlucHV0CXN0cmluZyAgICAkZ3JvdXAgICBUaGUgZ3JvdXAgbmFtZQ0KCSAqDQoJICogQHJldHVybnMgc3RyaW5nIG9uIHN1Y2Nlc3MNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBzYWZlSW5zdGFsbENsYXNzTmFtZSgkY29kZU5hbWUsICRncm91cCkNCgl7DQoJCS8vIGVkaXRvcnMteHRkIGdyb3VwIHBsdWdpbnMgbXVzdCBoYXZlIGEgY2xhc3Mgd2l0aCBwbGdCdXR0b248UGx1Z2luTmFtZT4gc3RydWN0dXJlDQoJCWlmICgkZ3JvdXAgPT09ICdlZGl0b3JzLXh0ZCcpDQoJCXsNCgkJCSRncm91cCA9ICdCdXR0b24nOw0KCQl9DQoNCgkJcmV0dXJuICdwbGcnIC4gdWNmaXJzdCgkZ3JvdXApIC4gdWNmaXJzdCgNCgkJCSRjb2RlTmFtZQ0KCQkpIC4gJ0luc3RhbGxlclNjcmlwdCc7DQoJfQ0KDQoJLyoqDQoJICogTWFraW5nIGxhbmd1YWdlIHByZWZpeCBzYWZlDQoJICoNCgkgKiBAaW5wdXQJc3RyaW5nICAgICRjb2RlTmFtZSAgIFRoZSBuYW1lDQoJICogQGlucHV0CXN0cmluZyAgICAkZ3JvdXAgICBUaGUgZ3JvdXAgbmFtZQ0KCSAqDQoJICogQHJldHVybnMgc3RyaW5nIG9uIHN1Y2Nlc3MNCgkgKiANCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBzYWZlTGFuZ1ByZWZpeCgkY29kZU5hbWUsICRncm91cCkNCgl7DQoJCS8vIGVkaXRvcnMteHRkIGdyb3VwIHBsdWdpbnMgbXVzdCBoYXZlIGEgY2xhc3Mgd2l0aCBwbGdCdXR0b248UGx1Z2luTmFtZT4gc3RydWN0dXJlDQoJCWlmICgkZ3JvdXAgPT09ICdlZGl0b3JzLXh0ZCcpDQoJCXsNCgkJCSRncm91cCA9ICdCdXR0b24nOw0KCQl9DQoNCgkJcmV0dXJuICdQTEdfJyAuIHN0cnRvdXBwZXIoJGdyb3VwKSAuICdfJyAuIHN0cnRvdXBwZXIoDQoJCQkkY29kZU5hbWUNCgkJKTsNCgl9DQo=', '{}', 'PluginHelper', 'VDM\\Joomla\\Utilities.String.PluginHelper', '1.0.0', '{}', 'String Plugin Helper', 'abstract class', '{}', '', 1, '2022-03-09 14:44:58', '2022-05-21 13:27:39', 13, 5), -(21, 1, 'Global Unique ID Helper\r\n\r\n@since 3.0.9', '', '', '9c513baf-b279-43fd-ae29-a585c8cbc4f0', 'dXNlIEpvb21sYVxDTVNcRmFjdG9yeTs=', '', '', '{\"load_selection0\":{\"load\":\"0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a\"},\"load_selection1\":{\"load\":\"1f28cb53-60d9-4db1-b517-3c7dc6b429ef\"}}', 'CS8qKg0KCSAqIFJldHVybnMgYSBHVUlEdjQgc3RyaW5nDQoJICogDQoJICogVGhhbmtzIHRvIERhdmUgUGVhcnNvbiAoYW5kIG90aGVyKQ0KCSAqIGh0dHBzOi8vd3d3LnBocC5uZXQvbWFudWFsL2VuL2Z1bmN0aW9uLmNvbS1jcmVhdGUtZ3VpZC5waHAjMTE5MTY4IA0KCSAqDQoJICogVXNlcyB0aGUgYmVzdCBjcnlwdG9ncmFwaGljYWxseSBzZWN1cmUgbWV0aG9kDQoJICogZm9yIGFsbCBzdXBwb3J0ZWQgcGxhdGZvcm1zIHdpdGggZmFsbGJhY2sgdG8gYW4gb2xkZXIsDQoJICogbGVzcyBzZWN1cmUgdmVyc2lvbi4NCgkgKg0KCSAqIEBwYXJhbSBib29sICR0cmltDQoJICoNCgkgKiBAcmV0dXJuIHN0cmluZw0KCSAqDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gZ2V0KCR0cmltID0gdHJ1ZSkNCgl7DQoJCS8vIFdpbmRvd3MNCgkJaWYgKGZ1bmN0aW9uX2V4aXN0cygnY29tX2NyZWF0ZV9ndWlkJykgPT09IHRydWUpDQoJCXsNCgkJCWlmICgkdHJpbSA9PT0gdHJ1ZSkNCgkJCXsNCgkJCQlyZXR1cm4gdHJpbShjb21fY3JlYXRlX2d1aWQoKSwgJ3t9Jyk7DQoJCQl9DQoJCQlyZXR1cm4gY29tX2NyZWF0ZV9ndWlkKCk7DQoJCX0NCg0KCQkvLyBzZXQgdGhlIGJyYWNlcyBpZiBuZWVkZWQNCgkJJGxicmFjZSA9ICR0cmltID8gIiIgOiBjaHIoMTIzKTsgICAgLy8gInsiDQoJCSRyYnJhY2UgPSAkdHJpbSA/ICIiIDogY2hyKDEyNSk7ICAgIC8vICJ9Ig0KDQoJCS8vIE9TWC9MaW51eA0KCQlpZiAoZnVuY3Rpb25fZXhpc3RzKCdvcGVuc3NsX3JhbmRvbV9wc2V1ZG9fYnl0ZXMnKSA9PT0gdHJ1ZSkNCgkJew0KCQkJJGRhdGEgPSBvcGVuc3NsX3JhbmRvbV9wc2V1ZG9fYnl0ZXMoMTYpOw0KCQkJJGRhdGFbNl0gPSBjaHIoIG9yZCgkZGF0YVs2XSkgJiAweDBmIHwgMHg0MCk7ICAgIC8vIHNldCB2ZXJzaW9uIHRvIDAxMDANCgkJCSRkYXRhWzhdID0gY2hyKCBvcmQoJGRhdGFbOF0pICYgMHgzZiB8IDB4ODApOyAgICAvLyBzZXQgYml0cyA2LTcgdG8gMTANCgkJCXJldHVybiAkbGJyYWNlIC4gdnNwcmludGYoJyVzJXMtJXMtJXMtJXMtJXMlcyVzJywgc3RyX3NwbGl0KGJpbjJoZXgoJGRhdGEpLCA0KSkgLiAkbGJyYWNlOw0KCQl9DQoNCgkJLy8gRmFsbGJhY2sgKFBIUCA0LjIrKQ0KCQltdF9zcmFuZCgoZG91YmxlKSBtaWNyb3RpbWUoKSAqIDEwMDAwKTsNCgkJJGNoYXJpZCA9IHN0cnRvbG93ZXIoIG1kNSggdW5pcWlkKCByYW5kKCksIHRydWUpKSk7DQoJCSRoeXBoZW4gPSBjaHIoNDUpOyAgICAgICAgICAgICAgICAgIC8vICItIg0KCQkkZ3VpZHY0ID0gJGxicmFjZS4NCgkJCXN1YnN0cigkY2hhcmlkLCAgMCwgIDgpLiAkaHlwaGVuLg0KCQkJc3Vic3RyKCRjaGFyaWQsICA4LCAgNCkuICRoeXBoZW4uDQoJCQlzdWJzdHIoJGNoYXJpZCwgMTIsICA0KS4gJGh5cGhlbi4NCgkJCXN1YnN0cigkY2hhcmlkLCAxNiwgIDQpLiAkaHlwaGVuLg0KCQkJc3Vic3RyKCRjaGFyaWQsIDIwLCAxMikuDQoJCQkkcmJyYWNlOw0KCQlyZXR1cm4gJGd1aWR2NDsNCgl9DQoNCgkvKioNCgkgKiBWYWxpZGF0ZSB0aGUgR2xvYmFsbHkgVW5pcXVlIElkZW50aWZpZXIgKCBhbmQgY2hlY2sgaWYgdGFibGUgYWxyZWFkeSBoYXMgdGhpcyBpZGVudGlmaWVyKQ0KCSAqDQoJICogQHBhcmFtIHN0cmluZyAgICAgICAkZ3VpZA0KCSAqIEBwYXJhbSBzdHJpbmcgICAgICAgJHRhYmxlDQoJICogQHBhcmFtIGludCAgICAgICAgICAgICRpZA0KCSAqIEBwYXJhbSBzdHJpbmd8bnVsbCAkY29tcG9uZW50DQoJICoNCgkgKiBAcmV0dXJuIGJvb2wNCgkgKg0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIHZhbGlkKCRndWlkLCAkdGFibGUgPSBudWxsLCAkaWQgPSAwLCAkY29tcG9uZW50ID0gbnVsbCkNCgl7DQoJCS8vIGNoZWNrIGlmIHdlIGhhdmUgYSBzdHJpbmcNCgkJaWYgKHNlbGY6OnZhbGlkYXRlKCRndWlkKSkNCgkJew0KCQkJLy8gY2hlY2sgaWYgdGFibGUgYWxyZWFkeSBoYXMgdGhpcyBpZGVudGlmaWVyDQoJCQlpZiAoU3RyaW5nSGVscGVyOjpjaGVjaygkdGFibGUpKQ0KCQkJew0KCQkJCS8vIGNoZWNrIHRoYXQgd2UgaGF2ZSB0aGUgY29tcG9uZW50IGNvZGUgbmFtZQ0KCQkJCWlmICghaXNfc3RyaW5nKCRjb21wb25lbnQpKQ0KCQkJCXsNCgkJCQkJJGNvbXBvbmVudCA9IChzdHJpbmcpIEhlbHBlcjo6Z2V0Q29kZSgpOw0KCQkJCX0NCgkJCQkvLyBHZXQgdGhlIGRhdGFiYXNlIG9iamVjdCBhbmQgYSBuZXcgcXVlcnkgb2JqZWN0Lg0KCQkJCSRkYiA9IEZhY3Rvcnk6OmdldERibygpOw0KCQkJCSRxdWVyeSA9ICRkYi0+Z2V0UXVlcnkodHJ1ZSk7DQoJCQkJJHF1ZXJ5LT5zZWxlY3QoJ0NPVU5UKCopJykNCgkJCQkJLT5mcm9tKCcjX18nIC4gKHN0cmluZykgJGNvbXBvbmVudCAuICdfJyAuIChzdHJpbmcpICR0YWJsZSkNCgkJCQkJLT53aGVyZSgkZGItPnF1b3RlTmFtZSgnZ3VpZCcpIC4gJyA9ICcgLiAkZGItPnF1b3RlKCRndWlkKSk7DQoNCgkJCQkvLyByZW1vdmUgdGhpcyBpdGVtIGZyb20gdGhlIGxpc3QNCgkJCQlpZiAoJGlkID4gMCkNCgkJCQl7DQoJCQkJCSRxdWVyeS0+d2hlcmUoJGRiLT5xdW90ZU5hbWUoJ2lkJykgLiAnIDw+ICcgLiAoaW50KSAkaWQpOw0KCQkJCX0NCg0KCQkJCS8vIFNldCBhbmQgcXVlcnkgdGhlIGRhdGFiYXNlLg0KCQkJCSRkYi0+c2V0UXVlcnkoJHF1ZXJ5KTsNCgkJCQkkZHVwbGljYXRlID0gKGJvb2wpICRkYi0+bG9hZFJlc3VsdCgpOw0KDQoJCQkJaWYgKCRkdXBsaWNhdGUpDQoJCQkJew0KCQkJCQlyZXR1cm4gZmFsc2U7DQoJCQkJfQ0KCQkJfQ0KCQkJcmV0dXJuIHRydWU7DQoJCX0NCgkJcmV0dXJuIGZhbHNlOw0KCX0NCg0KCS8qKg0KCSAqIGdldCB0aGUgaXRlbSBieSBndWlkIGluIGEgdGFibGUNCgkgKg0KCSAqIEBwYXJhbSBzdHJpbmcgICAgICAgICAgICRndWlkDQoJICogQHBhcmFtIHN0cmluZyAgICAgICAgICAgJHRhYmxlDQoJICogQHBhcmFtIHN0cmluZy9hcnJheSAgJHdoYXQNCgkgKiBAcGFyYW0gc3RyaW5nfG51bGwgICAgJGNvbXBvbmVudA0KCSAqDQoJICogQHJldHVybiBtaXgNCgkgKg0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGl0ZW0oJGd1aWQsICR0YWJsZSwgJHdoYXQgPSAnYS5pZCcsICRjb21wb25lbnQgPSBudWxsKQ0KCXsNCgkJLy8gY2hlY2sgaWYgd2UgaGF2ZSBhIHN0cmluZw0KCQlpZiAoc2VsZjo6dmFsaWRhdGUoJGd1aWQpKQ0KCQl7DQoJCQkvLyBjaGVjayBpZiB0YWJsZSBhbHJlYWR5IGhhcyB0aGlzIGlkZW50aWZpZXINCgkJCWlmIChTdHJpbmdIZWxwZXI6OmNoZWNrKCR0YWJsZSkpDQoJCQl7DQoJCQkJLy8gY2hlY2sgdGhhdCB3ZSBoYXZlIHRoZSBjb21wb25lbnQgY29kZSBuYW1lDQoJCQkJaWYgKCFpc19zdHJpbmcoJGNvbXBvbmVudCkpDQoJCQkJew0KCQkJCQkkY29tcG9uZW50ID0gKHN0cmluZykgSGVscGVyOjpnZXRDb2RlKCk7DQoJCQkJfQ0KCQkJCS8vIEdldCB0aGUgZGF0YWJhc2Ugb2JqZWN0IGFuZCBhIG5ldyBxdWVyeSBvYmplY3QuDQoJCQkJJGRiID0gRmFjdG9yeTo6Z2V0RGJvKCk7DQoJCQkJJHF1ZXJ5ID0gJGRiLT5nZXRRdWVyeSh0cnVlKTsNCg0KCQkJCWlmIChBcnJheUhlbHBlcjo6Y2hlY2soJHdoYXQpKQ0KCQkJCXsNCgkJCQkJJHF1ZXJ5LT5zZWxlY3QoJGRiLT5xdW90ZU5hbWUoJHdoYXQpKTsNCgkJCQl9DQoJCQkJZWxzZQ0KCQkJCXsNCgkJCQkJJHF1ZXJ5LT5zZWxlY3QoJHdoYXQpOw0KCQkJCX0NCg0KCQkJCSRxdWVyeS0+ZnJvbSgkZGItPnF1b3RlTmFtZSgnI19fJyAuIChzdHJpbmcpICRjb21wb25lbnQgLiAnXycgLiAoc3RyaW5nKSAkdGFibGUsICdhJykpDQoJCQkJCS0+d2hlcmUoJGRiLT5xdW90ZU5hbWUoJ2EuZ3VpZCcpIC4gJyA9ICcgLiAkZGItPnF1b3RlKCRndWlkKSk7DQoNCgkJCQkvLyBTZXQgYW5kIHF1ZXJ5IHRoZSBkYXRhYmFzZS4NCgkJCQkkZGItPnNldFF1ZXJ5KCRxdWVyeSk7DQoJCQkJJGRiLT5leGVjdXRlKCk7DQoNCgkJCQlpZiAoJGRiLT5nZXROdW1Sb3dzKCkpDQoJCQkJew0KCQkJCQlpZiAoQXJyYXlIZWxwZXI6OmNoZWNrKCR3aGF0KSB8fCAkd2hhdCA9PT0gJ2EuKicpDQoJCQkJCXsNCgkJCQkJCXJldHVybiAkZGItPmxvYWRPYmplY3QoKTsNCgkJCQkJfQ0KCQkJCQllbHNlDQoJCQkJCXsNCgkJCQkJCXJldHVybiAkZGItPmxvYWRSZXN1bHQoKTsNCgkJCQkJfQ0KCQkJCX0NCgkJCX0NCgkJfQ0KCQlyZXR1cm4gZmFsc2U7DQoJfQ0KDQoJLyoqDQoJICogVmFsaWRhdGUgdGhlIEdsb2JhbGx5IFVuaXF1ZSBJZGVudGlmaWVyDQoJICoNCgkgKiBUaGFua3MgdG8gTGV3aWUNCgkgKiBodHRwczovL3N0YWNrb3ZlcmZsb3cuY29tL2EvMTUxNTQ1Ni8xNDI5Njc3DQoJICoNCgkgKiBAcGFyYW0gc3RyaW5nICRndWlkDQoJICoNCgkgKiBAcmV0dXJuIGJvb2wNCgkgKg0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwcm90ZWN0ZWQgc3RhdGljIGZ1bmN0aW9uIHZhbGlkYXRlKCRndWlkKQ0KCXsNCgkJLy8gY2hlY2sgaWYgd2UgaGF2ZSBhIHN0cmluZw0KCQlpZiAoU3RyaW5nSGVscGVyOjpjaGVjaygkZ3VpZCkpDQoJCXsNCgkJCXJldHVybiBwcmVnX21hdGNoKCIvXihceyk/W2EtZlxkXXs4fSgtW2EtZlxkXXs0fSl7NH1bYS1mXGRdezh9KD8oMSlcfSkkL2kiLCAkZ3VpZCk7DQoJCX0NCgkJcmV0dXJuIGZhbHNlOw0KCX0NCg==', '{}', 'GuidHelper', 'VDM\\Joomla\\Utilities.GuidHelper', '1.0.0', '{}', 'Utilities GuidHelper', 'abstract class', '{\"use_selection0\":{\"use\":\"640b5352-fb09-425f-a26e-cd44eda03f15\"}}', '', 1, '2022-03-12 01:27:10', '2022-05-21 13:27:39', 12, 9), -(22, 1, 'File helper\r\n\r\n@since 3.0.9', '', '', 'a223b31e-ea1d-4cdf-92ae-5f9becffaff0', 'dXNlIEpvb21sYVxDTVNcVXJpXFVyaTsNCnVzZSBKb29tbGFcQ01TXEZhY3Rvcnk7DQp1c2UgSm9vbWxhXENNU1xMYW5ndWFnZVxUZXh0Ow0KdXNlIEpvb21sYVxDTVNcRmlsZXN5c3RlbVxQYXRoOw0KdXNlIEpvb21sYVxDTVNcRmlsZXN5c3RlbVxGaWxlOw0KdXNlIEpvb21sYVxDTVNcRmlsZXN5c3RlbVxGb2xkZXI7DQp1c2UgSm9vbWxhXEFyY2hpdmVcQXJjaGl2ZTs=', '', '', '{\"load_selection0\":{\"load\":\"0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a\"},\"load_selection1\":{\"load\":\"1f28cb53-60d9-4db1-b517-3c7dc6b429ef\"},\"load_selection2\":{\"load\":\"91004529-94a9-4590-b842-e7c6b624ecf5\"}}', 'CS8qKg0KCSAqIFRyaWdnZXIgZXJyb3Igbm90aWNlIG9ubHkgb25jZQ0KCSAqDQoJICogQHZhciAgICBib29sDQoJICoNCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHJvdGVjdGVkIHN0YXRpYyAkY3VybEVycm9yID0gZmFsc2U7DQoNCgkvKioNCgkgKiBUaGUgemlwcGVyIG1ldGhvZA0KCSAqIA0KCSAqIEBwYXJhbSAgc3RyaW5nICAgJHdvcmtpbmdEaXJlY3RvcnkgICAgVGhlIGRpcmVjdG9yeSB3aGVyZSB0aGUgaXRlbXMgbXVzdCBiZSB6aXBwZWQNCgkgKiBAcGFyYW0gIHN0cmluZyAgICRmaWxlcGF0aCAgICAgICAgICBUaGUgcGF0aCB0byB3aGVyZSB0aGUgemlwIGZpbGUgbXVzdCBiZSBwbGFjZWQNCgkgKg0KCSAqIEByZXR1cm4gIGJvb2wgdHJ1ZSAgIE9uIHN1Y2Nlc3MNCgkgKg0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIHppcCgkd29ya2luZ0RpcmVjdG9yeSwgJiRmaWxlcGF0aCkNCgl7DQoJCS8vIHN0b3JlIHRoZSBjdXJyZW50IGpvb21sYSB3b3JraW5nIGRpcmVjdG9yeQ0KCQkkam9vbWxhID0gZ2V0Y3dkKCk7DQoNCgkJLy8gd2UgYXJlIGNoYW5naW5nIHRoZSB3b3JraW5nIGRpcmVjdG9yeSB0byB0aGUgY29tcG9uZW50IHRlbXAgZm9sZGVyDQoJCWNoZGlyKCR3b3JraW5nRGlyZWN0b3J5KTsNCg0KCQkvLyB0aGUgZnVsbCBmaWxlIHBhdGggb2YgdGhlIHppcCBmaWxlDQoJCSRmaWxlcGF0aCA9IFBhdGg6OmNsZWFuKCRmaWxlcGF0aCk7DQoNCgkJLy8gZGVsZXRlIGFuIGV4aXN0aW5nIHppcCBmaWxlIChvciB1c2UgYW4gZXhjbHVzaW9uIHBhcmFtZXRlciBpbiBGb2xkZXI6OmZpbGVzKCkNCgkJRmlsZTo6ZGVsZXRlKCRmaWxlcGF0aCk7DQoNCgkJLy8gZ2V0IGEgbGlzdCBvZiBmaWxlcyBpbiB0aGUgY3VycmVudCBkaXJlY3RvcnkgdHJlZSAoYWxzbyB0aGUgaGlkZGVuIGZpbGVzKQ0KCQkkZmlsZXMgPSBGb2xkZXI6OmZpbGVzKCcuJywgJycsIHRydWUsIHRydWUsIGFycmF5KCcuc3ZuJywgJ0NWUycsICcuRFNfU3RvcmUnLCAnX19NQUNPU1gnKSwgYXJyYXkoJy4qficpKTsNCg0KCQkkemlwQXJyYXkgPSBhcnJheSgpOw0KCQkvLyBzZXR1cCB0aGUgemlwIGFycmF5DQoJCWZvcmVhY2ggKCRmaWxlcyBhcyAkZmlsZSkNCgkJew0KCQkJJHRtcCA9IGFycmF5KCk7DQoJCQkkdG1wWyduYW1lJ10gPSBzdHJfcmVwbGFjZSgnLi8nLCAnJywgJGZpbGUpOw0KCQkJJHRtcFsnZGF0YSddID0gc2VsZjo6Z2V0Q29udGVudCgkZmlsZSk7DQoJCQkkdG1wWyd0aW1lJ10gPSBmaWxlbXRpbWUoJGZpbGUpOw0KCQkJJHppcEFycmF5W10gPSAkdG1wOw0KCQl9DQoNCgkJLy8gY2hhbmdlIGJhY2sgdG8gam9vbWxhIHdvcmtpbmcgZGlyZWN0b3J5DQoJCWNoZGlyKCRqb29tbGEpOw0KDQoJCS8vIGdldCB0aGUgemlwIGFkYXB0ZXINCgkJJGFkYXB0ZXIgPSBuZXcgQXJjaGl2ZSgpOw0KCQkkemlwID0gJGFkYXB0ZXItPmdldEFkYXB0ZXIoJ3ppcCcpOw0KDQoJCS8vY3JlYXRlIHRoZSB6aXAgZmlsZQ0KCQlpZiAoJHppcC0+Y3JlYXRlKCRmaWxlcGF0aCwgJHppcEFycmF5KSkNCgkJew0KCQkJcmV0dXJuIHRydWU7DQoJCX0NCgkJcmV0dXJuIGZhbHNlOw0KCX0NCg0KCS8qKg0KCSAqIGdldCB0aGUgY29udGVudCBvZiBhIGZpbGUNCgkgKg0KCSAqIEBwYXJhbSAgc3RyaW5nICAgICAgICAkcGF0aCAgIFRoZSBwYXRoIHRvIHRoZSBmaWxlDQoJICogQHBhcmFtICBzdHJpbmcvYm9vbCAgICRub25lICAgVGhlIHJldHVybiB2YWx1ZSBpZiBubyBjb250ZW50IHdhcyBmb3VuZA0KCSAqDQoJICogQHJldHVybiAgc3RyaW5nICAgT24gc3VjY2Vzcw0KCSAqDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gZ2V0Q29udGVudCgkcGF0aCwgJG5vbmUgPSAnJykNCgl7DQoJCWlmIChTdHJpbmdIZWxwZXI6OmNoZWNrKCRwYXRoKSkNCgkJew0KCQkJLy8gdXNlIGJhc2ljIGZpbGUgZ2V0IGNvbnRlbnQgZm9yIG5vdw0KCQkJaWYgKCgkY29udGVudCA9IEBmaWxlX2dldF9jb250ZW50cygkcGF0aCkpICE9PSBGQUxTRSkNCgkJCXsNCgkJCQlyZXR1cm4gJGNvbnRlbnQ7DQoJCQl9DQoJCQkvLyB1c2UgY3VybCBpZiBhdmFpbGFibGUNCgkJCWVsc2VpZiAoZnVuY3Rpb25fZXhpc3RzKCdjdXJsX3ZlcnNpb24nKSkNCgkJCXsNCgkJCQkvLyBzdGFydCBjdXJsDQoJCQkJJGNoID0gY3VybF9pbml0KCk7DQoJCQkJLy8gc2V0IHRoZSBvcHRpb25zDQoJCQkJJG9wdGlvbnMgPSBhcnJheSgpOw0KCQkJCSRvcHRpb25zW0NVUkxPUFRfVVJMXSA9ICRwYXRoOw0KCQkJCSRvcHRpb25zW0NVUkxPUFRfVVNFUkFHRU5UXSA9ICdNb3ppbGxhLzUuMCAoV2luZG93czsgVTsgV2luZG93cyBOVCA2LjE7IGVuLVVTOyBydjoxLjkuMi4xMikgR2Vja28vMjAxMDEwMjYgRmlyZWZveC8zLjYuMTInOw0KCQkJCSRvcHRpb25zW0NVUkxPUFRfUkVUVVJOVFJBTlNGRVJdID0gVFJVRTsNCgkJCQkkb3B0aW9uc1tDVVJMT1BUX1NTTF9WRVJJRllQRUVSXSA9IEZBTFNFOw0KCQkJCS8vIGxvYWQgdGhlIG9wdGlvbnMNCgkJCQljdXJsX3NldG9wdF9hcnJheSgkY2gsICRvcHRpb25zKTsNCgkJCQkvLyBnZXQgdGhlIGNvbnRlbnQNCgkJCQkkY29udGVudCA9IGN1cmxfZXhlYygkY2gpOw0KCQkJCS8vIGNsb3NlIHRoZSBjb25uZWN0aW9uDQoJCQkJY3VybF9jbG9zZSgkY2gpOw0KDQoJCQkJLy8gcmV0dXJuIGlmIGZvdW5kDQoJCQkJaWYgKFN0cmluZ0hlbHBlcjo6Y2hlY2soJGNvbnRlbnQpKQ0KCQkJCXsNCgkJCQkJcmV0dXJuICRjb250ZW50Ow0KCQkJCX0NCgkJCX0NCgkJCWVsc2VpZiAoIXNlbGY6OiRjdXJsRXJyb3IpDQoJCQl7DQoJCQkJLy8gc2V0IHRoZSBub3RpY2UNCgkJCQlGYWN0b3J5OjpnZXRBcHBsaWNhdGlvbigpLT5lbnF1ZXVlTWVzc2FnZShUZXh0OjpfKCc8aDI+Q3VybCBOb3QgRm91bmQhPC9oMj48cD5QbGVhc2Ugc2V0dXAgY3VybCBvbiB5b3VyIHN5c3RlbSwgb3IgPGI+W1tbY29tcG9uZW50XV1dPC9iPiB3aWxsIG5vdCBmdW5jdGlvbiBjb3JyZWN0bHkhPC9wPicpLCAnRXJyb3InKTsNCgkJCQkvLyBsb2FkIHRoaXMgbm90aWNlIG9ubHkgb25jZQ0KCQkJCXNlbGY6OiRjdXJsRXJyb3IgPSB0cnVlOw0KCQkJfQ0KCQl9DQoJCXJldHVybiAkbm9uZTsNCgl9DQoNCgkvKioNCgkgKiBXcml0ZSBhIGZpbGUgdG8gdGhlIHNlcnZlcg0KCSAqDQoJICogQHBhcmFtICBzdHJpbmcgICAkcGF0aCAgICBUaGUgcGF0aCBhbmQgZmlsZSBuYW1lIHdoZXJlIHRvIHNhZmUgdGhlIGRhdGENCgkgKiBAcGFyYW0gIHN0cmluZyAgICRkYXRhICAgIFRoZSBkYXRhIHRvIHNhZmUNCgkgKg0KCSAqIEByZXR1cm4gIGJvb2wgdHJ1ZSAgIE9uIHN1Y2Nlc3MNCgkgKg0KCSAqIEBzaW5jZSAgMy4wLjkNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIHdyaXRlKCRwYXRoLCAkZGF0YSkNCgl7DQoJCSRrbGFhciA9IGZhbHNlOw0KCQlpZiAoU3RyaW5nSGVscGVyOjpjaGVjaygkZGF0YSkpDQoJCXsNCgkJCS8vIG9wZW4gdGhlIGZpbGUNCgkJCSRmaCA9IGZvcGVuKCRwYXRoLCAidyIpOw0KCQkJaWYgKCFpc19yZXNvdXJjZSgkZmgpKQ0KCQkJew0KCQkJCXJldHVybiAka2xhYXI7DQoJCQl9DQoJCQkvLyB3cml0ZSB0byB0aGUgZmlsZQ0KCQkJaWYgKGZ3cml0ZSgkZmgsICRkYXRhKSkNCgkJCXsNCgkJCQkvLyBoYXMgYmVlbiBkb25lDQoJCQkJJGtsYWFyID0gdHJ1ZTsNCgkJCX0NCgkJCS8vIGNsb3NlIGZpbGUuDQoJCQlmY2xvc2UoJGZoKTsNCgkJfQ0KCQlyZXR1cm4gJGtsYWFyOw0KCX0NCg0KCS8qKg0KCSAqIGdldCBhbGwgdGhlIGZpbGUgcGF0aHMgaW4gZm9sZGVyIGFuZCBzdWIgZm9sZGVycw0KCSAqIA0KCSAqIEBwYXJhbSAgIHN0cmluZyAgJGZvbGRlciAgICAgVGhlIGxvY2FsIHBhdGggdG8gcGFyc2UNCgkgKiBAcGFyYW0gICBhcnJheSAgICRmaWxlVHlwZXMgIFRoZSB0eXBlIG9mIGZpbGVzIHRvIGdldA0KCSAqDQoJICogQHJldHVybiAgdm9pZA0KCSAqDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gZ2V0UGF0aHMoJGZvbGRlciwgJGZpbGVUeXBlcyA9IGFycmF5KCdcLnBocCcsICdcLmpzJywgJ1wuY3NzJywgJ1wubGVzcycpLCAkcmVjdXJzZSA9IHRydWUsICRmdWxsID0gdHJ1ZSkNCgl7DQoJCWlmIChGb2xkZXI6OmV4aXN0cygkZm9sZGVyKSkNCgkJew0KCQkJLy8gd2UgbXVzdCBmaXJzdCBzdG9yZSB0aGUgY3VycmVudCB3b2tpbmcgZGlyZWN0b3J5DQoJCQkkam9vbWxhID0gZ2V0Y3dkKCk7DQoJCQkvLyB3ZSBhcmUgY2hhbmdpbmcgdGhlIHdvcmtpbmcgZGlyZWN0b3J5IHRvIHRoZSBjb21wb25lbnQgcGF0aA0KCQkJY2hkaXIoJGZvbGRlcik7DQoNCgkJCS8vIG1ha2Ugc3VyZSB3ZSBoYXZlIGZpbGUgdHlwZSBmaWx0ZXINCgkJCWlmIChBcnJheUhlbHBlcjo6Y2hlY2soJGZpbGVUeXBlcykpDQoJCQl7DQoJCQkJLy8gZ2V0IHRoZSBmaWxlcw0KCQkJCWZvcmVhY2ggKCRmaWxlVHlwZXMgYXMgJHR5cGUpDQoJCQkJew0KCQkJCQkvLyBnZXQgYSBsaXN0IG9mIGZpbGVzIGluIHRoZSBjdXJyZW50IGRpcmVjdG9yeSB0cmVlDQoJCQkJCSRmaWxlc1tdID0gRm9sZGVyOjpmaWxlcygnLicsICR0eXBlLCAkcmVjdXJzZSwgJGZ1bGwpOw0KCQkJCX0NCgkJCX0NCgkJCWVsc2VpZiAoU3RyaW5nSGVscGVyOjpjaGVjaygkZmlsZVR5cGVzKSkNCgkJCXsNCgkJCQkvLyBnZXQgYSBsaXN0IG9mIGZpbGVzIGluIHRoZSBjdXJyZW50IGRpcmVjdG9yeSB0cmVlDQoJCQkJJGZpbGVzW10gPSBGb2xkZXI6OmZpbGVzKCcuJywgJGZpbGVUeXBlcywgJHJlY3Vyc2UsICRmdWxsKTsNCgkJCX0NCgkJCWVsc2UNCgkJCXsNCgkJCQkvLyBnZXQgYSBsaXN0IG9mIGZpbGVzIGluIHRoZSBjdXJyZW50IGRpcmVjdG9yeSB0cmVlDQoJCQkJJGZpbGVzW10gPSBGb2xkZXI6OmZpbGVzKCcuJywgJy4nLCAkcmVjdXJzZSwgJGZ1bGwpOw0KCQkJfQ0KDQoJCQkvLyBjaGFuZ2UgYmFjayB0byBKb29tbGEgd29ya2luZyBkaXJlY3RvcnkNCgkJCWNoZGlyKCRqb29tbGEpOw0KDQoJCQkvLyByZXR1cm4gYXJyYXkgb2YgZmlsZXMNCgkJCXJldHVybiBhcnJheV9tYXAoIGZ1bmN0aW9uKCRmaWxlKSB7IHJldHVybiBzdHJfcmVwbGFjZSgnLi8nLCAnLycsICRmaWxlKTsgfSwgKGFycmF5KSBBcnJheUhlbHBlcjo6bWVyZ2UoJGZpbGVzKSk7DQoJCX0NCgkJcmV0dXJuIGZhbHNlOw0KCX0NCg0KCS8qKg0KCSAqIEdldCB0aGUgZmlsZSBwYXRoIG9yIHVybA0KCSAqDQoJICogQHBhcmFtICBzdHJpbmcgICAkdHlwZSAgICAgICAgICAgICAgVGhlICh1cmwvcGF0aCkgdHlwZSB0byByZXR1cm4NCgkgKiBAcGFyYW0gIHN0cmluZyAgICR0YXJnZXQgICAgICAgICAgICBUaGUgUGFyYW1zIFRhcmdldCBuYW1lIChpZiBzZXQpDQoJICogQHBhcmFtICBzdHJpbmcgICAkZmlsZVR5cGUgICAgICAgICAgVGhlIGtpbmQgb2YgZmlsZW5hbWUgdG8gZ2VuZXJhdGUgKGlmIG5vdCBzZXQgbm8gZmlsZSBuYW1lIGlzIGdlbmVyYXRlZCkNCgkgKiBAcGFyYW0gIHN0cmluZyAgICRrZXkgICAgICAgICAgICAgICBUaGUga2V5IHRvIGFkanVzdCB0aGUgZmlsZW5hbWUgKGlmIG5vdCBzZXQgaWdub3JlZCkNCgkgKiBAcGFyYW0gIHN0cmluZyAgICRkZWZhdWx0ICAgICAgICAgICBUaGUgZGVmYXVsdCBwYXRoIGlmIG5vdCBzZXQgaW4gUGFyYW1zIChmYWxsYmFjayBwYXRoKQ0KCSAqIEBwYXJhbSAgYm9vbCAgICAgJGNyZWF0ZUlmTm90U2V0ICAgIFRoZSBzd2l0Y2ggdG8gY3JlYXRlIHRoZSBmb2xkZXIgaWYgbm90IGZvdW5kDQoJICoNCgkgKiBAcmV0dXJuICBzdHJpbmcgICAgT24gc3VjY2VzcyB0aGUgcGF0aCBvciB1cmwgaXMgcmV0dXJuZWQgYmFzZWQgb24gdGhlIHR5cGUgcmVxdWVzdGVkDQoJICoNCgkgKiBAc2luY2UgIDMuMC45DQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBnZXRQYXRoKCR0eXBlID0gJ3BhdGgnLCAkdGFyZ2V0ID0gJ2ZpbGVwYXRoJywgJGZpbGVUeXBlID0gbnVsbCwgJGtleSA9ICcnLCAkZGVmYXVsdCA9ICcnLCAkY3JlYXRlSWZOb3RTZXQgPSB0cnVlKQ0KCXsNCgkJLy8gbWFrZSBzdXJlIHRvIGFsd2F5cyBoYXZlIGEgc3RyaW5nL3BhdGgNCgkJaWYoIVN0cmluZ0hlbHBlcjo6Y2hlY2soJGRlZmF1bHQpKQ0KCQl7DQoJCQkkZGVmYXVsdCA9IEpQQVRIX1NJVEUgLiAnL2ltYWdlcy8nOw0KCQl9DQoNCgkJLy8gZ2V0IHRoZSBnbG9iYWwgc2V0dGluZ3MNCgkJJGZpbGVQYXRoID0gSGVscGVyOjpnZXRQYXJhbXMoKS0+Z2V0KCR0YXJnZXQsICRkZWZhdWx0KTsNCg0KCQkvLyBjaGVjayB0aGUgZmlsZSBwYXRoIChyZXZlcnQgdG8gZGVmYXVsdCBvbmx5IG9mIG5vdCBhIGhpZGRlbiBmaWxlIHBhdGgpDQoJCWlmICgnaGlkZGVuZmlsZXBhdGgnICE9PSAkdGFyZ2V0ICYmIHN0cnBvcygkZmlsZVBhdGgsIEpQQVRIX1NJVEUpID09PSBmYWxzZSkNCgkJew0KCQkJJGZpbGVQYXRoID0gJGRlZmF1bHQ7DQoJCX0NCg0KCQkvLyBjcmVhdGUgdGhlIGZvbGRlciBpZiBpdCBkb2VzIG5vdCBleGlzdA0KCQlpZiAoJGNyZWF0ZUlmTm90U2V0ICYmICFGb2xkZXI6OmV4aXN0cygkZmlsZVBhdGgpKQ0KCQl7DQoJCQlGb2xkZXI6OmNyZWF0ZSgkZmlsZVBhdGgpOw0KCQl9DQoNCgkJLy8gc2V0dXAgdGhlIGZpbGUgbmFtZQ0KCQkkZmlsZU5hbWUgPSAnJzsNCg0KCQkvLyBHZXQgYmFzaWMga2V5DQoJCSRiYXNpY2tleSA9ICdUaCFzX2lTX24wdF9zQWZlX2J1VF9iM3R0ZXJfdGhlbl9uMHRoaXVnJzsNCgkJLy8gZ2V0IHRoZSBjb21wb25lbnQgaGVscGVyDQoJCSRoZWxwZXIgPSBIZWxwZXI6OmdldCgpOw0KCQkvLyBjaGVjayBpZiBtZXRob2QgZXhpc3QgaW4gaGVscGVyIGNsYXNzDQoJCWlmICgkaGVscGVyICYmIEhlbHBlcjo6bWV0aG9kRXhpc3RzKCdnZXRDcnlwdEtleScpKSANCgkJew0KCQkJJGJhc2lja2V5ID0gJGhlbHBlcjo6Z2V0Q3J5cHRLZXkoJ2Jhc2ljJywgJGJhc2lja2V5KTsNCgkJfQ0KDQoJCS8vIGNoZWNrIHRoZSBrZXkNCgkJaWYgKCFTdHJpbmdIZWxwZXI6OmNoZWNrKCRrZXkpKQ0KCQl7DQoJCQkka2V5ID0gJ3ZEbSc7DQoJCX0NCg0KCQkvLyBzZXQgdGhlIGZpbGUgbmFtZQ0KCQlpZiAoU3RyaW5nSGVscGVyOjpjaGVjaygkZmlsZVR5cGUpKQ0KCQl7DQoJCQkvLyBzZXQgdGhlIG5hbWUNCgkJCSRmaWxlTmFtZSA9IHRyaW0oIG1kNSgkdHlwZSAuICR0YXJnZXQgLiAkYmFzaWNrZXkgLiAka2V5KSAuICcuJyAuIHRyaW0oJGZpbGVUeXBlLCAnLicpKTsNCgkJfQ0KCQllbHNlDQoJCXsNCgkJCSRmaWxlTmFtZSA9IHRyaW0oIG1kNSgkdHlwZSAuICR0YXJnZXQgLiAkYmFzaWNrZXkgLiAka2V5KSkgLiAnLnR4dCc7DQoJCX0NCg0KCQkvLyByZXR1cm4gdGhlIHVybA0KCQlpZiAoJ3VybCcgPT09ICR0eXBlKQ0KCQl7DQoJCQlpZiAoXHN0cnBvcygkZmlsZVBhdGgsIEpQQVRIX1NJVEUpICE9PSBmYWxzZSkNCgkJCXsNCgkJCQkkZmlsZVBhdGggPSB0cmltKCBzdHJfcmVwbGFjZSggSlBBVEhfU0lURSwgJycsICRmaWxlUGF0aCksICcvJyk7DQoNCgkJCQlyZXR1cm4gVXJpOjpyb290KCkgLiAkZmlsZVBhdGggLiAnLycgLiAkZmlsZU5hbWU7DQoJCQl9DQoNCgkJCS8vIHNpbmNlIHRoZSBwYXRoIGlzIGJlaGluZCB0aGUgcm9vdCBmb2xkZXIgb2YgdGhlIHNpdGUsIHJldHVybiBvbmx5IHRoZSByb290IHVybCAobWF5IGJlIHVzZWQgdG8gYnVpbGQgdGhlIGxpbmspDQoJCQlyZXR1cm4gVXJpOjpyb290KCk7DQoJCX0NCg0KCQkvLyBzYW5pdGl6ZSB0aGUgcGF0aA0KCQlyZXR1cm4gJy8nIC4gdHJpbSggJGZpbGVQYXRoLCAnLycgKSAuICcvJyAuICRmaWxlTmFtZTsNCgl9DQoNCgkvKioNCgkgKiBDaGVjayBpZiBmaWxlIGV4aXN0DQoJICoNCgkgKiBAcGFyYW0gIHN0cmluZyAgICRwYXRoICAgVGhlIHVybC9wYXRoIHRvIGNoZWNrDQoJICoNCgkgKiBAcmV0dXJuICBib29sICAgICAgSWYgZXhpc3QgdHJ1ZQ0KCSAqDQoJICogQHNpbmNlICAzLjAuOQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gZXhpc3RzKCRwYXRoKQ0KCXsNCgkJJGV4aXN0cyA9IGZhbHNlOw0KCQkvLyBpZiB0aGlzIGlzIGEgbG9jYWwgcGF0aA0KCQlpZiAoc3RycG9zKCRwYXRoLCAnaHR0cDonKSA9PT0gZmFsc2UgJiYgc3RycG9zKCRwYXRoLCAnaHR0cHM6JykgPT09IGZhbHNlKQ0KCQl7DQoJCQlpZiAoZmlsZV9leGlzdHMoJHBhdGgpKQ0KCQkJew0KCQkJCSRleGlzdHMgPSB0cnVlOw0KCQkJfQ0KCQl9DQoJCS8vIGNoZWNrIGlmIHdlIGNhbiB1c2UgY3VybA0KCQllbHNlaWYgKGZ1bmN0aW9uX2V4aXN0cygnY3VybF92ZXJzaW9uJykpDQoJCXsNCgkJCS8vIGluaXRpYXRlIGN1cmwNCgkJCSRjaCA9IGN1cmxfaW5pdCgkcGF0aCk7DQoJCQkvLyBDVVJMT1BUX05PQk9EWSAoZG8gbm90IHJldHVybiBib2R5KQ0KCQkJY3VybF9zZXRvcHQoJGNoLCBDVVJMT1BUX05PQk9EWSwgdHJ1ZSk7DQoJCQkvLyBtYWtlIGNhbGwNCgkJCSRyZXN1bHQgPSBjdXJsX2V4ZWMoJGNoKTsNCgkJCS8vIGNoZWNrIHJldHVybiB2YWx1ZQ0KCQkJaWYgKCRyZXN1bHQgIT09IGZhbHNlKQ0KCQkJew0KCQkJCS8vIGdldCB0aGUgaHR0cCBDT0RFDQoJCQkJJHN0YXR1c0NvZGUgPSBjdXJsX2dldGluZm8oJGNoLCBDVVJMSU5GT19IVFRQX0NPREUpOw0KCQkJCWlmICgkc3RhdHVzQ29kZSAhPT0gNDA0KQ0KCQkJCXsNCgkJCQkJJGV4aXN0cyA9IHRydWU7DQoJCQkJfQ0KCQkJfQ0KCQkJLy8gY2xvc2UgdGhlIGNvbm5lY3Rpb24NCgkJCWN1cmxfY2xvc2UoJGNoKTsNCgkJfQ0KCQllbHNlaWYgKCRoZWFkZXJzID0gQGdldF9oZWFkZXJzKCRwYXRoKSkNCgkJew0KCQkJaWYoaXNzZXQoJGhlYWRlcnNbMF0pICYmIGlzX3N0cmluZygkaGVhZGVyc1swXSkgJiYgc3RycG9zKCRoZWFkZXJzWzBdLCc0MDQnKSA9PT0gZmFsc2UpDQoJCQl7DQoJCQkJJGV4aXN0cyA9IHRydWU7DQoJCQl9DQoJCX0NCgkJcmV0dXJuICRleGlzdHM7DQoJfQ0K', '{}', 'FileHelper', 'VDM\\Joomla\\Utilities.FileHelper', '1.0.0', '{}', 'Utilities FileHelper', 'abstract class', '{\"use_selection0\":{\"use\":\"640b5352-fb09-425f-a26e-cd44eda03f15\",\"as\":\"default\"}}', '', 1, '2022-03-12 02:09:18', '2022-06-11 16:54:51', 24, 9), -(23, 1, 'Some component helper\r\n\r\n@since 3.0.11', '', '', '640b5352-fb09-425f-a26e-cd44eda03f15', 'dXNlIEpvb21sYVxJbnB1dFxJbnB1dDsNCnVzZSBKb29tbGFcQ01TXENvbXBvbmVudFxDb21wb25lbnRIZWxwZXI7DQp1c2UgSm9vbWxhXFJlZ2lzdHJ5XFJlZ2lzdHJ5Ow==', '', '', '{}', 'CS8qKg0KCSAqIFRoZSBjdXJyZW50IG9wdGlvbg0KCSAqDQoJICogQHZhciAgICBTdHJpbmcNCgkgKiBAc2luY2UgICAzLjAuMTENCgkgKi8NCglwdWJsaWMgc3RhdGljICRvcHRpb247DQoNCgkvKioNCgkgKiBUaGUgY29tcG9uZW50IHBhcmFtcyBsaXN0IGNhY2hlDQoJICoNCgkgKiBAdmFyICAgIFJlZ2lzdHJ5W10NCgkgKiBAc2luY2UgICAzLjAuMTENCgkgKi8NCglwcm90ZWN0ZWQgc3RhdGljICRwYXJhbXMgPSBhcnJheSgpOw0KDQoJLyoqDQoJICogR2V0cyB0aGUgcGFyYW1ldGVyIG9iamVjdCBmb3IgdGhlIGNvbXBvbmVudA0KCSAqDQoJICogQHBhcmFtICAgU3RyaW5nICAgICAgICAgICAgICAgJG9wdGlvbiAgVGhlIG9wdGlvbiBmb3IgdGhlIGNvbXBvbmVudC4NCgkgKg0KCSAqIEByZXR1cm4gIFJlZ2lzdHJ5ICAgICAgICAgICAgQSBSZWdpc3RyeSBvYmplY3QuDQoJICoNCgkgKiBAc2VlICAgICBSZWdpc3RyeQ0KCSAqIEBzaW5jZSAgIDMuMC4xMQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gZ2V0UGFyYW1zKCRvcHRpb24gPSBudWxsKQ0KCXsNCgkJLy8gY2hlY2sgdGhhdCB3ZSBoYXZlIGFuIG9wdGlvbg0KCQlpZiAoZW1wdHkoJG9wdGlvbikpDQoJCXsNCgkJCSRvcHRpb24gPSBzZWxmOjpnZXRPcHRpb24oKTsNCgkJfQ0KDQoJCS8vIGdldCBnbG9iYWwgdmFsdWUNCgkJaWYgKCFpc3NldChzZWxmOjokcGFyYW1zWyRvcHRpb25dKSB8fCAhc2VsZjo6JHBhcmFtc1skb3B0aW9uXSBpbnN0YW5jZW9mIFJlZ2lzdHJ5KQ0KCQl7DQoJCQlzZWxmOjokcGFyYW1zWyRvcHRpb25dID0gQ29tcG9uZW50SGVscGVyOjpnZXRQYXJhbXMoJG9wdGlvbik7DQoJCX0NCg0KCQlyZXR1cm4gc2VsZjo6JHBhcmFtc1skb3B0aW9uXTsNCgl9DQoNCgkvKioNCgkgKiBHZXRzIHRoZSBjb21wb25lbnQgb3B0aW9uDQoJICoNCgkgKiBAcGFyYW0gICBTdHJpbmd8Qm9vbCAgICAgICRkZWZhdWx0ICBUaGUgZGVmYXVsdCByZXR1cm4gdmFsdWUgaWYgbm9uZSBpcyBmb3VuZA0KCSAqDQoJICogQHJldHVybiAgU3RyaW5nfEJvb2wgICAgICBBIGNvbXBvbmVudCBvcHRpb24NCgkgKg0KCSAqIEBzaW5jZSAgIDMuMC4xMQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gZ2V0T3B0aW9uKCRkZWZhdWx0ID0gJ2VtcHR5JykNCgl7DQoJCWlmIChlbXB0eShzZWxmOjokb3B0aW9uKSkNCgkJew0KCQkJLy8gZ2V0IHRoZSBvcHRpb24gZnJvbSB0aGUgdXJsIGlucHV0DQoJCQlzZWxmOjokb3B0aW9uID0gKG5ldyBJbnB1dCktPmdldFN0cmluZygnb3B0aW9uJywgZmFsc2UpOw0KCQl9DQoNCgkJaWYgKHNlbGY6OiRvcHRpb24pDQoJCXsNCgkJCSByZXR1cm4gc2VsZjo6JG9wdGlvbjsNCgkJfQ0KDQoJCXJldHVybiAkZGVmYXVsdDsNCgl9DQoNCgkvKioNCgkgKiBHZXRzIHRoZSBjb21wb25lbnQgY29kZSBuYW1lDQoJICoNCgkgKiBAcGFyYW0gICBTdHJpbmcgICAgICAgICAgICAgICRvcHRpb24gIFRoZSBvcHRpb24gZm9yIHRoZSBjb21wb25lbnQuDQoJICogQHBhcmFtICAgU3RyaW5nfEJvb2wgICAgICAkZGVmYXVsdCAgVGhlIGRlZmF1bHQgcmV0dXJuIHZhbHVlIGlmIG5vbmUgaXMgZm91bmQNCgkgKg0KCSAqIEByZXR1cm4gIFN0cmluZ3xNaXhlZCAgICAgIEEgY29tcG9uZW50IGNvZGUgbmFtZQ0KCSAqDQoJICogQHNpbmNlICAgMy4wLjExDQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBnZXRDb2RlKCRvcHRpb24gPSBudWxsLCAkZGVmYXVsdCA9IG51bGwpDQoJew0KCQkvLyBjaGVjayB0aGF0IHdlIGhhdmUgYW4gb3B0aW9uDQoJCWlmIChlbXB0eSgkb3B0aW9uKSkNCgkJew0KCQkJJG9wdGlvbiA9IHNlbGY6OmdldE9wdGlvbigpOw0KCQl9DQoJCS8vIG9wdGlvbiB3aXRoIGNvbV8NCgkJaWYgKGlzX3N0cmluZygkb3B0aW9uKSAmJiBzdHJwb3MoJG9wdGlvbiwgJ2NvbV8nKSA9PT0gMCkNCgkJew0KCQkJcmV0dXJuIHN0cnRvbG93ZXIodHJpbShzdWJzdHIoJG9wdGlvbiwgNCkpKTsNCgkJfQ0KDQoJCXJldHVybiAkZGVmYXVsdDsNCgl9DQoNCgkvKioNCgkgKiBHZXRzIHRoZSBjb21wb25lbnQgYWJzdHJhY3QgaGVscGVyIGNsYXNzDQoJICoNCgkgKiBAcGFyYW0gICBTdHJpbmcgICAgICAgICAgICAgICRvcHRpb24gIFRoZSBvcHRpb24gZm9yIHRoZSBjb21wb25lbnQuDQoJICogQHBhcmFtICAgU3RyaW5nfEJvb2wgICAgICAkZGVmYXVsdCAgVGhlIGRlZmF1bHQgcmV0dXJuIHZhbHVlIGlmIG5vbmUgaXMgZm91bmQNCgkgKg0KCSAqIEByZXR1cm4gIFN0cmluZ3xNaXhlZCAgICAgIEEgY29tcG9uZW50IGhlbHBlciBuYW1lDQoJICoNCgkgKiBAc2luY2UgICAzLjAuMTENCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGdldCgkb3B0aW9uID0gbnVsbCwgJGRlZmF1bHQgPSBudWxsKQ0KCXsNCgkJLy8gY2hlY2sgdGhhdCB3ZSBoYXZlIGFuIG9wdGlvbg0KCQkvLyBhbmQgZ2V0IHRoZSBjb2RlIG5hbWUgZnJvbSBpdA0KCQlpZiAoKCRjb2RlX25hbWUgPSBzZWxmOjpnZXRDb2RlKCRvcHRpb24sIGZhbHNlKSkgIT09IGZhbHNlKQ0KCQl7DQoJCQkvLyB3ZSBidWlsZCB0aGUgaGVscGVyIGNsYXNzIG5hbWUNCgkJCSRoZWxwZXJfbmFtZSA9ICdcXCcgLiBcdWNmaXJzdCgkY29kZV9uYW1lKSAuICdIZWxwZXInOw0KCQkJLy8gY2hlY2sgaWYgY2xhc3MgZXhpc3QNCgkJCWlmIChjbGFzc19leGlzdHMoJGhlbHBlcl9uYW1lKSkNCgkJCXsNCgkJCQlyZXR1cm4gJGhlbHBlcl9uYW1lOw0KCQkJfQ0KCQl9DQoNCgkJcmV0dXJuICRkZWZhdWx0Ow0KCX0NCg0KCS8qKg0KCSAqIENoZWNrIGlmIHRoZSBoZWxwZXIgY2xhc3Mgb2YgdGhpcyBjb21wb25lbnQgaGFzIGEgbWV0aG9kDQoJICoNCgkgKiBAcGFyYW0gICBTdHJpbmcgICAgICAgJG1ldGhvZCAgVGhlIG1ldGhvZCBuYW1lIHRvIHNlYXJjaCBmb3INCgkgKiBAcGFyYW0gICBTdHJpbmcgICAgICAgJG9wdGlvbiAgICBUaGUgb3B0aW9uIGZvciB0aGUgY29tcG9uZW50Lg0KCSAqDQoJICogQHJldHVybiAgYm9vbCAgICAgICAgICB0cnVlIGlmIG1ldGhvZCBleGlzdA0KCSAqDQoJICogQHNpbmNlICAgMy4wLjExDQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBtZXRob2RFeGlzdHMoJG1ldGhvZCwgJG9wdGlvbiA9IG51bGwpDQoJew0KCQkvLyBnZXQgdGhlIGhlbHBlciBjbGFzcw0KCQlpZiAoKCRoZWxwZXIgPSBzZWxmOjpnZXQoJG9wdGlvbiwgZmFsc2UpKSAhPT0gZmFsc2UpDQoJCXsNCgkJCWlmIChtZXRob2RfZXhpc3RzKCRoZWxwZXIsICRtZXRob2QpKQ0KCQkJew0KCQkJCXJldHVybiB0cnVlOw0KCQkJfQ0KCQl9DQoNCgkJcmV0dXJuIGZhbHNlOw0KCX0NCg==', '{}', 'Helper', 'VDM\\Joomla\\Utilities.Component.Helper', '1.0.0', '{}', 'Utilities Component Helper', 'abstract class', '{}', '', 1, '2022-05-13 05:36:32', '2022-05-21 13:27:39', 17, 7), -(24, 1, 'Image helper\r\n\r\n@since 3.0.11', '', '', '962b15d8-915f-4cd7-aea6-7cf82afdc20b', 'dXNlIEpvb21sYVxDTVNcRmlsZXN5c3RlbVxGaWxlOw0KdXNlIEpvb21sYVxDTVNcRmlsZXN5c3RlbVxGb2xkZXI7DQp1c2UgSm9vbWxhXENNU1xVcmlcVXJpOw0KdXNlIEpvb21sYVxDTVNcSW1hZ2VcSW1hZ2U7', '', '', '{\"load_selection0\":{\"load\":\"91004529-94a9-4590-b842-e7c6b624ecf5\"},\"load_selection1\":{\"load\":\"f11dc790-713e-4706-9a85-a318ed3ad56e\"}}', 'CS8qKg0KCSAqIFJlc2l6ZSBhbiBpbWFnZQ0KCSAqDQoJICogQHBhcmFtICAgc3RyaW5nICAgICRmdWxsUGF0aCAgIFRoZSBmdWxsIHBhdGggdG8gdGhlIGltYWdlDQoJICogQHBhcmFtICAgc3RyaW5nICAgICR0eXBlICAgICAgICBUaGUgdHlwZSBvZiBpbWFnZQ0KCSAqDQoJICogQHJldHVybiBib29sDQoJICogQHNpbmNlIDMuMC4xMQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gcmVzaXplKHN0cmluZyAkZnVsbFBhdGgsIHN0cmluZyAkdHlwZSkNCgl7DQoJCS8vIGZpcnN0IGNoZWNrIGlmIHdlIHNob3VsZCByZXNpemUgdGhpcyB0YXJnZXQNCgkJaWYgKDEgPT0gSGVscGVyOjpnZXRQYXJhbXMoKS0+Z2V0KCR0eXBlIC4gJ19yZXNpemUnLCAwKSkNCgkJew0KCQkJLy8gbG9hZCB0aGUgc2l6ZSB0byBiZSBzZXQNCgkJCSRoZWlnaHQgPSBIZWxwZXI6OmdldFBhcmFtcygpLT5nZXQoJHR5cGUgLiAnX2hlaWdodCcsICdub3Rfc2V0Jyk7DQoJCQkkd2lkdGggPSBIZWxwZXI6OmdldFBhcmFtcygpLT5nZXQoJHR5cGUgLiAnX3dpZHRoJywgJ25vdF9zZXQnKTsNCg0KCQkJLy8gR2V0IGZpbGUgZXh0ZW5zaW9uL2Zvcm1hdA0KCQkJJGZpbGVfZm9ybWF0ID0gTWltZUhlbHBlcjo6ZXh0ZW5zaW9uKCRmdWxsUGF0aCk7DQoNCgkJCS8vIGdldCBpbWFnZSBwcm9wZXJ0aWVzDQoJCQkkaW1hZ2UgPSBzZWxmOjpnZXRQcm9wZXJ0aWVzKCRmdWxsUGF0aCk7DQoNCgkJCS8vIG1ha2Ugc3VyZSB3ZSBoYXZlIGFuIG9iamVjdA0KCQkJaWYgKE9iamVjdEhlbHBlcjo6Y2hlY2soJGltYWdlKSAmJiBpc19zdHJpbmcoJGZpbGVfZm9ybWF0KSkNCgkJCXsNCgkJCQlpZiAoJHdpZHRoICE9PSAnbm90X3NldCcgJiYgJGhlaWdodCAhPT0gJ25vdF9zZXQnICYmICgkaW1hZ2UtPndpZHRoICE9ICR3aWR0aCB8fCAkaW1hZ2UtPmhlaWdodCAhPSAkaGVpZ2h0KSkNCgkJCQl7DQoJCQkJCS8vIGlmIGltYWdlIGlzIGh1Z2UgYW5kIHNob3VsZCBvbmx5IGJlIHNjYWxlZCwgcmVzaXplIGl0IG9uIHRoZSBmbHkNCgkJCQkJaWYoKCRpbWFnZS0+d2lkdGggPiA5MDAgfHwgJGltYWdlLT5oZWlnaHQgPiA3MDApICYmICgkaGVpZ2h0ID09IDAgfHwgJHdpZHRoID09IDApKQ0KCQkJCQl7DQoJCQkJCQkvLyBzZWxlY3QgdGhlIGltYWdlICJnZXR0ZXIiIGJhc2VkIG9uIGZvcm1hdA0KCQkJCQkJaWYoJGZpbGVfZm9ybWF0ID09ICJqcGciIHx8ICRmaWxlX2Zvcm1hdCA9PSAianBlZyIgKQ0KCQkJCQkJew0KCQkJCQkJCSRzcmMgPSBpbWFnZWNyZWF0ZWZyb21qcGVnKCRmdWxsUGF0aCk7DQoJCQkJCQl9DQoJCQkJCQllbHNlaWYoJGZpbGVfZm9ybWF0ID09ICJwbmciKQ0KCQkJCQkJew0KCQkJCQkJCSRzcmMgPSBpbWFnZWNyZWF0ZWZyb21wbmcoJGZ1bGxQYXRoKTsNCgkJCQkJCX0NCgkJCQkJCWVsc2VpZigkZmlsZV9mb3JtYXQgPT0gImdpZiIpDQoJCQkJCQl7DQoJCQkJCQkJJHNyYyA9IGltYWdlY3JlYXRlZnJvbWdpZigkZnVsbFBhdGgpOw0KCQkJCQkJfQ0KCQkJCQkJLy8gd2Ugb25seSBzdXBwb3J0IHRoZSBhYm92ZSB0aHJlZSBmb3JtYXRzIGZvciBub3cNCgkJCQkJCWVsc2UNCgkJCQkJCXsNCgkJCQkJCQlyZXR1cm4gZmFsc2U7DQoJCQkJCQl9DQoNCgkJCQkJCS8vIHdvcmtvdXQgdGhlIHJhdGlvIGlmIHdlIGhhdmUgaGVpZ2h0DQoJCQkJCQlpZiAoJGhlaWdodCAhPSAwKQ0KCQkJCQkJew0KCQkJCQkJCSRoZWlnaHRfcmF0aW8gPSAkaW1hZ2UtPmhlaWdodCAvICRoZWlnaHQ7DQoJCQkJCQl9DQoNCgkJCQkJCS8vIHdvcmtvdXQgdGhlIHJhdGlvIGlmIHdlIGhhdmUgd2lkdGgNCgkJCQkJCWlmICgkd2lkdGggIT0gMCkNCgkJCQkJCXsNCgkJCQkJCQkkd2lkdGhfcmF0aW8gPSAkaW1hZ2UtPndpZHRoIC8gJHdpZHRoOw0KCQkJCQkJfQ0KDQoJCQkJCQkvLyBzZXQgbWF4IHJhdGlvIGJhc2VkIG9uIGJvdGgNCgkJCQkJCWlmIChpc3NldCgkaGVpZ2h0X3JhdGlvKSAmJiBpc3NldCgkd2lkdGhfcmF0aW8pKQ0KCQkJCQkJew0KCQkJCQkJCSRtYXhfcmF0aW8JPSBtYXgoJHdpZHRoX3JhdGlvLCAkaGVpZ2h0X3JhdGlvKTsNCgkJCQkJCX0NCgkJCQkJCS8vIHNldCBtYXggcmF0aW8gYmFzZWQgb24gd2lkdGgNCgkJCQkJCWVsc2VpZiAoaXNzZXQoJHdpZHRoX3JhdGlvKSkNCgkJCQkJCXsNCgkJCQkJCQkkbWF4X3JhdGlvCT0gJHdpZHRoX3JhdGlvOw0KCQkJCQkJfQ0KCQkJCQkJLy8gc2V0IG1heCByYXRpbyBiYXNlZCBvbiBoZWlnaHQNCgkJCQkJCWVsc2VpZiAoaXNzZXQoJGhlaWdodF9yYXRpbykpDQoJCQkJCQl7DQoJCQkJCQkJJG1heF9yYXRpbwk9ICRoZWlnaHRfcmF0aW87DQoJCQkJCQl9DQoNCgkJCQkJCS8vIGlmIHdlIGhhdmUgcmF0aW8gZG8gdGhlIGNvbnZlcnNpb24NCgkJCQkJCWlmICgkbWF4X3JhdGlvID4gMSkNCgkJCQkJCXsNCgkJCQkJCQkkbmV3X3dpZHRoCT0gJGltYWdlLT53aWR0aCAvICRtYXhfcmF0aW87DQoJCQkJCQkJJG5ld19oZWlnaHQJPSAkaW1hZ2UtPmhlaWdodCAvICRtYXhfcmF0aW87DQoJCQkJCQl9DQoJCQkJCQllbHNlDQoJCQkJCQl7DQoJCQkJCQkJJG5ld193aWR0aAk9ICRpbWFnZS0+d2lkdGg7DQoJCQkJCQkJJG5ld19oZWlnaHQJPSAkaW1hZ2UtPmhlaWdodDsNCgkJCQkJCX0NCg0KCQkJCQkJJHRtcAkJCT0gaW1hZ2VjcmVhdGV0cnVlY29sb3IoJG5ld193aWR0aCwgJG5ld19oZWlnaHQpOw0KCQkJCQkJJGJhY2tncm91bmRfY29sb3IJPSBpbWFnZWNvbG9yYWxsb2NhdGUoJHRtcCwgMjU1LCAyNTUsIDI1NSk7DQoNCgkJCQkJCWltYWdlZmlsbCgkdG1wLCAwLCAwLCAkYmFja2dyb3VuZF9jb2xvcik7DQoJCQkJCQlpbWFnZWNvcHlyZXNhbXBsZWQoJHRtcCwgJHNyYywgMCwgMCwgMCwgMCwkbmV3X3dpZHRoLCAkbmV3X2hlaWdodCwgJGltYWdlLT53aWR0aCwgJGltYWdlLT5oZWlnaHQpOw0KCQkJCQkJaW1hZ2VqcGVnKCR0bXAsICRmdWxsUGF0aCwgMTAwKTsNCgkJCQkJCWltYWdlZGVzdHJveSgkc3JjKTsNCgkJCQkJCWltYWdlZGVzdHJveSgkdG1wKTsNCgkJCQkJfQ0KCQkJCQkvLyB3ZSBvbmx5IGNyb3AgaWYgYm90aCBoZWlnaHQgYW5kIHdpZHRoIGlzIHNldCB0byBjcm9wDQoJCQkJCWlmICgkaGVpZ2h0ICE9IDAgJiYgJHdpZHRoICE9IDApDQoJCQkJCXsNCgkJCQkJCS8vIGdldCB0aGUgY3VycmVudCBjb21wb25lbnQgY29kZSBuYW1lDQoJCQkJCQlpZiAoKCRjb21wb25lbnRfY29kZV9uYW1lID0gSGVscGVyOjpnZXRDb2RlKG51bGwsIGZhbHNlKSkgPT09IGZhbHNlKQ0KCQkJCQkJew0KCQkJCQkJCS8vIGlmIHdlIGNhbid0IGdldCB0aGUgY29tcG9uZW50IGNvZGUgbmFtZSB3ZSBzaG91bGQgYnJlYWsgcHV0IG5vdw0KCQkJCQkJCXJldHVybiBmYWxzZTsNCgkJCQkJCX0NCgkJCQkJCS8vIEluY2x1ZGUgd2lkZWltYWdlIC0gaHR0cDovL3dpZGVpbWFnZS5zb3VyY2Vmb3JnZS5uZXQgVE9ETzogaHR0cHM6Ly9naXRodWIuY29tL3Ntb3R0dC9XaWRlSW1hZ2UNCgkJCQkJCXJlcXVpcmVfb25jZShKUEFUSF9BRE1JTklTVFJBVE9SIC4gJy9jb21wb25lbnRzL2NvbV8nIC4gJGNvbXBvbmVudF9jb2RlX25hbWUgLiAnL2hlbHBlcnMvd2lkZWltYWdlL1dpZGVJbWFnZS5waHAnKTsNCgkJCQkJCS8vIGxvYWQgdGhlIGltYWdlIGludG8gdGhlIGJ1aWxkZXINCgkJCQkJCSRidWlsZGVyID0gXFdpZGVJbWFnZTo6bG9hZCgkZnVsbFBhdGgpOw0KCQkJCQkJLy8gcmVzaXplIHRoZSBpbWFnZQ0KCQkJCQkJJHJlc2l6ZWQgPSAkYnVpbGRlci0+cmVzaXplKCR3aWR0aCwgJGhlaWdodCwgJ291dHNpZGUnKS0+Y3JvcCgnY2VudGVyJywgJ21pZGRsZScsICR3aWR0aCwgJGhlaWdodCk7DQoJCQkJCQkvLyBzYXZlIHRoZSBuZXcgaW1hZ2UgdG8gZnVsbCBmaWxlIHBhdGgNCgkJCQkJCSRyZXNpemVkLT5zYXZlVG9GaWxlKCRmdWxsUGF0aCk7DQoJCQkJCX0NCgkJCQl9DQoJCQkJcmV0dXJuIHRydWU7DQoJCQl9DQoJCX0NCgkJcmV0dXJuIGZhbHNlOw0KCX0NCg0KCS8qKg0KCSAqIEdldCBJbWFnZSBQcm9wZXJ0aWVzDQoJICoNCgkgKiBAcGFyYW0gICBzdHJpbmcgICAgJGZ1bGxQYXRoICAgVGhlIGZ1bGwgcGF0aCB0byB0aGUgaW1hZ2UNCgkgKg0KCSAqIEByZXR1cm4gYm9vbHxzdGRDbGFzcw0KCSAqIEBzaW5jZSAzLjAuMTENCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGdldFByb3BlcnRpZXMoJGZ1bGxQYXRoKQ0KCXsNCgkJLy8gY2hlY2sgdGhhdCB0aGUgZmlsZSBleGlzdA0KCQlpZiAoRmlsZTo6ZXhpc3RzKCRmdWxsUGF0aCkpDQoJCXsNCgkJCSRwcm9wZXJ0aWVzID0gSW1hZ2U6OmdldEltYWdlRmlsZVByb3BlcnRpZXMoJGZ1bGxQYXRoKTsNCgkJCS8vIGNoZWNrIGlmIHdlIGhhdmUgcHJvcGVydGllcw0KCQkJaWYgKE9iamVjdEhlbHBlcjo6Y2hlY2soJHByb3BlcnRpZXMpKQ0KCQkJew0KCQkJCS8vIGdldCBpbWFnZSBmaWxlIG5hbWUNCgkJCQkkbmFtZSA9IGJhc2VuYW1lKCRmdWxsUGF0aCk7DQoJCQkJLy8gcmVtb3ZlIGZpbGUgbmFtZSBmcm9tIHBhdGgNCgkJCQkkZGlyX25hbWUgPSBwYXRoaW5mbygkZnVsbFBhdGgsIFBBVEhJTkZPX0RJUk5BTUUpOw0KCQkJCS8vIHJlbW92ZSB0aGUgc2VydmVyIHBhdGgNCgkJCQkkaW1hZ2VfcHVibGljX3BhdGggPSB0cmltKHN0cl9yZXBsYWNlKEpQQVRIX1NJVEUsICcnLCAkZGlyX25hbWUpLCAnLycpIC4gJy8nIC4gJG5hbWU7DQoJCQkJLy8gbm93IGFkZCB0aGUgc3JjIHBhdGggdG8gc2hvdyB0aGUgaW1hZ2UNCgkJCQkkcHJvcGVydGllcy0+c3JjID0gVXJpOjpyb290KCkgLiAkaW1hZ2VfcHVibGljX3BhdGg7DQoJCQkJLy8gcmV0dXJuIHRoZSBpbWFnZSBwcm9wZXJ0aWVzDQoJCQkJcmV0dXJuICRwcm9wZXJ0aWVzOw0KCQkJfQ0KCQl9DQoJCXJldHVybiBmYWxzZTsNCgl9DQo=', '{}', 'ImageHelper', 'VDM\\Joomla\\Utilities.ImageHelper', '1.0.0', '{}', 'Utilities ImageHelper', 'abstract class', '{\"use_selection0\":{\"use\":\"640b5352-fb09-425f-a26e-cd44eda03f15\",\"as\":\"default\"}}', '', 1, '2022-05-16 10:59:17', '2022-05-21 13:27:39', 17, 9), -(25, 1, 'Upload Helper\r\n\r\n@since 3.0.11', '', '', 'd7600b43-771a-4747-9f5d-952765721799', 'dXNlIEpvb21sYVxDTVNcRmFjdG9yeTsNCnVzZSBKb29tbGFcQ01TXExhbmd1YWdlXFRleHQ7DQp1c2UgSm9vbWxhXENNU1xGaWxlc3lzdGVtXEZpbGU7DQp1c2UgSm9vbWxhXENNU1xGaWxlc3lzdGVtXEZvbGRlcjsNCnVzZSBKb29tbGFcQ01TXEZpbGVzeXN0ZW1cUGF0aDs=', '', '', '{\"load_selection0\":{\"load\":\"f11dc790-713e-4706-9a85-a318ed3ad56e\"},\"load_selection1\":{\"load\":\"1f28cb53-60d9-4db1-b517-3c7dc6b429ef\"}}', 'CS8qKg0KCSAqIFRydWUgdG8gdXNlIHN0cmVhbXMNCgkgKg0KCSAqIEB2YXIgICAgYm9vbA0KCSAqDQoJICogQHNpbmNlICAzLjAuMTENCgkgKi8NCglwdWJsaWMgc3RhdGljICR1c2VTdHJlYW1zID0gZmFsc2U7DQoNCgkvKioNCgkgKiBBbGxvdyB0aGUgdXBsb2FkIG9mIHVuc2FmZSBmaWxlcw0KCSAqDQoJICogQHZhciAgICBib29sDQoJICoNCgkgKiBAc2luY2UgIDMuMC4xMQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgJGFsbG93VW5zYWZlID0gZmFsc2U7DQoNCgkvKioNCgkgKiBPcHRpb25zIHRvIElucHV0RmlsdGVyOjppc1NhZmVGaWxlDQoJICoNCgkgKiBAdmFyICAgIGFycmF5DQoJICoNCgkgKiBAc2luY2UgIDMuMC4xMQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgJHNhZmVGaWxlT3B0aW9ucyA9IGFycmF5KCk7DQoNCgkvKioNCgkgKiBTZXQgdGhlIGVycm9yIGJlaGF2aW9yDQoJICoNCgkgKiBAdmFyICAgIGJvb2wNCgkgKg0KCSAqIEBzaW5jZSAgMy4wLjExDQoJICovDQoJcHVibGljIHN0YXRpYyAkZW5xdWV1ZUVycm9yID0gdHJ1ZTsNCg0KCS8qKg0KCSAqIEVycm9ycw0KCSAqDQoJICogQHZhciAgICBhcnJheQ0KCSAqDQoJICogQHNpbmNlICAzLjAuMTENCgkgKi8NCglwcm90ZWN0ZWQgc3RhdGljICRlcnJvcnMgPSBhcnJheSgpOw0KDQoJLyoqDQoJICogR2V0IGZpbGUvZmlsZXMgZnJvbSBhIEhUVFAgdXBsb2FkLg0KCSAqDQoJICogQHBhcmFtICBzdHJpbmcgICAgICAgICAgJGZpZWxkICAgICAgICBUaGUgaW5wdXQgZmllbGQgbmFtZQ0KCSAqIEBwYXJhbSAgc3RyaW5nICAgICAgICAgICR0eXBlICAgICAgICBUaGUgZmlsZSB0eXBlDQoJICogQHBhcmFtICBzdHJpbmd8bnVsbCAgICRmaWx0ZXIgICAgICAgIFRoZSBmaWx0ZXIgdG8gdXNlIHdoZW4gdXBsb2FkaW5nIHRoZSBmaWxlDQoJICogQHBhcmFtICBzdHJpbmd8bnVsbCAgICRwYXRoICAgICAgICBUaGUgcGF0aCB0byB0aGUgZGlyZWN0b3J5IHdoZXJlIHRoZSBpbWFnZSBtdXN0IGJlIHBsYWNlZA0KCSAqDQoJICogQHJldHVybiAgbWl4ZWQgICBGaWxlIGRldGFpbHMgb3IgZmFsc2Ugb24gZmFpbHVyZS4NCgkgKiBAc2luY2UgIDMuMC4xMQ0KCSAqLw0KCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gZ2V0KHN0cmluZyAkZmllbGQsIHN0cmluZyAkdHlwZSwgc3RyaW5nICRmaWx0ZXIgPSBudWxsLCBzdHJpbmcgJHBhdGggPSBudWxsKQ0KCXsNCgkJLy8gR2V0IHRoZSB1cGxvYWRlZCBmaWxlIGluZm9ybWF0aW9uLg0KCQkkaW5wdXQgICAgPSBGYWN0b3J5OjpnZXRBcHBsaWNhdGlvbigpLT5pbnB1dDsNCg0KCQkvLyBzZXQgdGhlIGRlZmF1bHQgZmlsdGVyDQoJCWlmIChlbXB0eSgkZmlsdGVyKSkNCgkJew0KCQkJJGZpbHRlciA9ICdhcnJheSc7DQoJCX0NCgkJLy8gaWYgcmF3IHRoZW4gYWxzbyB1bnNhZmUNCgkJLy8gc2VlOiBodHRwczovL2dpdGh1Yi5jb20vam9vbWxhL2pvb21sYS1jbXMvYmxvYi80LjEtZGV2L2FkbWluaXN0cmF0b3IvY29tcG9uZW50cy9jb21faW5zdGFsbGVyL3NyYy9Nb2RlbC9JbnN0YWxsTW9kZWwucGhwI0wyNTkNCgkJZWxzZWlmICgkZmlsdGVyID09PSAncmF3JykNCgkJew0KCQkJc2VsZjo6JGFsbG93VW5zYWZlID0gdHJ1ZTsNCgkJfQ0KDQoJCS8vIGNoZWNrIGlmIHdlIGhhdmUgYSBmaWxlIGRlc3RpbmF0aW9uIG5hbWUgaW4gdGhlIGZpZWxkIG5hbWUNCgkJJG5hbWUgPSBudWxsOw0KCQlpZiAoc3RycG9zKCRmaWVsZCwgJzonKSAhPT0gZmFsc2UpDQoJCXsNCgkJCWxpc3QoJGZpZWxkLCAkbmFtZSkgPSBleHBsb2RlKCc6JywgJGZpZWxkKTsNCgkJfQ0KDQoJCS8vIFNlZSBKSW5wdXRGaWxlczo6Z2V0Lg0KCQkkdXNlcmZpbGUgPSAkaW5wdXQtPmZpbGVzLT5nZXQoJGZpZWxkLCBudWxsLCAkZmlsdGVyKTsNCg0KCQkvLyBNYWtlIHN1cmUgdGhhdCBmaWxlIHVwbG9hZHMgYXJlIGVuYWJsZWQgaW4gcGhwLg0KCQlpZiAoIShib29sKSBpbmlfZ2V0KCdmaWxlX3VwbG9hZHMnKSkNCgkJew0KCQkJc2VsZjo6c2V0RXJyb3IoVGV4dDo6XygnV2FybmluZywgdXBsb2FkIGVycm9yLicpKTsNCg0KCQkJcmV0dXJuIGZhbHNlOw0KCQl9DQoNCgkJLy8gSWYgdGhlcmUgaXMgbm8gdXBsb2FkZWQgZmlsZSwgd2UgaGF2ZSBhIHByb2JsZW0uLi4NCgkJaWYgKCFpc19hcnJheSgkdXNlcmZpbGUpKQ0KCQl7DQoJCQlzZWxmOjpzZXRFcnJvcihUZXh0OjpfKCdObyB1cGxvYWQgc2VsZWN0ZWQnKSk7DQoNCgkJCXJldHVybiBmYWxzZTsNCgkJfQ0KDQoJCS8vIElzIHRoZSBQSFAgdG1wIGRpcmVjdG9yeSBtaXNzaW5nPw0KCQlpZiAoJHVzZXJmaWxlWydlcnJvciddICYmICgkdXNlcmZpbGVbJ2Vycm9yJ10gPT0gVVBMT0FEX0VSUl9OT19UTVBfRElSKSkNCgkJew0KCQkJc2VsZjo6c2V0RXJyb3IoVGV4dDo6XygnVGhlcmUgd2FzIGFuIGVycm9yIHVwbG9hZGluZyB0byB0aGUgc2VydmVyLicpIC4gJzxicj4nIC4gVGV4dDo6XygnVGhlIFBIUCB0ZW1wb3JhcnkgZm9sZGVyIGlzIG5vdCBzZXQuJykpOw0KDQoJCQlyZXR1cm4gZmFsc2U7DQoJCX0NCg0KCQkvLyBJcyB0aGUgbWF4IHVwbG9hZCBzaXplIHRvbyBzbWFsbCBpbiBwaHAuaW5pPw0KCQlpZiAoJHVzZXJmaWxlWydlcnJvciddICYmICgkdXNlcmZpbGVbJ2Vycm9yJ10gPT0gVVBMT0FEX0VSUl9JTklfU0laRSkpDQoJCXsNCgkJCXNlbGY6OnNldEVycm9yKFRleHQ6Ol8oJ1RoZXJlIHdhcyBhbiBlcnJvciB1cGxvYWRpbmcgdG8gdGhlIHNlcnZlci4nKSAuICc8YnI+JyAuIFRleHQ6Ol8oJ1lvdXIgZmlsZSB3YXMgaXMgbGFyZ2VyIHRoYW4gdGhlIGFsbG93ZWQgc2l6ZS4nKSk7DQoNCgkJCXJldHVybiBmYWxzZTsNCgkJfQ0KDQoJCS8vIENoZWNrIGlmIHRoZXJlIHdhcyBhIGRpZmZlcmVudCBwcm9ibGVtIHVwbG9hZGluZyB0aGUgZmlsZS4NCgkJaWYgKCR1c2VyZmlsZVsnZXJyb3InXSB8fCAkdXNlcmZpbGVbJ3NpemUnXSA8IDEpDQoJCXsNCgkJCXNlbGY6OnNldEVycm9yKFRleHQ6Ol8oJ1RoZXJlIHdhcyBhbiBlcnJvciB1cGxvYWRpbmcgdG8gdGhlIHNlcnZlci4nKSk7DQoNCgkJCXJldHVybiBmYWxzZTsNCgkJfQ0KDQoJCS8vIGNoZWNrIGlmIGEgcGF0aCB3YXMgcGFzc2VkIGFuZCBleGlzdA0KCQlpZiAoaXNfc3RyaW5nKCRwYXRoKSAmJiBGb2xkZXI6OmNyZWF0ZSgkcGF0aCkpDQoJCXsNCgkJCS8vIHNldCB0aGUgcGF0aA0KCQkJJHVzZXJmaWxlWydwYXRoJ10gPSAkcGF0aDsNCgkJfQ0KCQllbHNlDQoJCXsNCgkJCS8vIGdldCB0aGUgSm9vbWxhIGNvbmZpZyBjbGFzcw0KCQkJJGNvbmZpZyA9IEZhY3Rvcnk6OmdldENvbmZpZygpOw0KCQkJLy8gc2V0IHRoZSBwYXRoDQoJCQkkdXNlcmZpbGVbJ3BhdGgnXSA9ICRjb25maWctPmdldCgndG1wX3BhdGgnKTsNCgkJfQ0KDQoJCS8vIHNldCB0aGUgcmFuZG9tIHBhcnQgb2YgdGhlIG5hbWUNCgkJJHVzZXJmaWxlWydyYW5kb20nXSA9IFN0cmluZ0hlbHBlcjo6cmFuZG9tKDEyKTsNCg0KCQkvLyBzZXQgdGhlIGZpbGUgbmFtZQ0KCQlpZiAoZW1wdHkoJG5hbWUpKQ0KCQl7DQoJCQkvLyBzZXQgdGhlIGZpbGUgbmFtZQ0KCQkJJHVzZXJmaWxlWydmaWxlX25hbWUnXSA9ICR1c2VyZmlsZVsncmFuZG9tJ10gLiAkdXNlcmZpbGVbJ25hbWUnXTsNCgkJfQ0KCQllbHNlDQoJCXsNCgkJCS8vIGNoZWNrIHRoYXQgaGlzIG5hbWUgaGFzIGZpbGUgZm9ybWF0DQoJCQlpZiAoaXNfc3RyaW5nKCRuYW1lKSAmJiBzdHJwb3MoJG5hbWUsICcuJykgPT09IGZhbHNlKQ0KCQkJew0KCQkJCSRuYW1lID0gJG5hbWUgLiAnLicgLiBNaW1lSGVscGVyOjpleHRlbnNpb24obnVsbCwgJHVzZXJmaWxlWyd0eXBlJ10pOw0KCQkJfQ0KCQkJJHVzZXJmaWxlWydmaWxlX25hbWUnXSA9ICRuYW1lOw0KCQl9DQoNCgkJLy8gc2V0IGZ1bGwgcGF0aA0KCQkkdXNlcmZpbGVbJ2Z1bGxfcGF0aCddID0gJHVzZXJmaWxlWydwYXRoJ10gLiAnLycgLiAkdXNlcmZpbGVbJ2ZpbGVfbmFtZSddOw0KDQoJCS8vIFVwbG9hZCB0aGUgZmlsZS4NCgkJaWYgKEZpbGU6OnVwbG9hZCgkdXNlcmZpbGVbJ3RtcF9uYW1lJ10sICR1c2VyZmlsZVsnZnVsbF9wYXRoJ10sIHNlbGY6OiR1c2VTdHJlYW1zLCBzZWxmOjokYWxsb3dVbnNhZmUpKQ0KCQl7DQoJCQkvLyBDaGVjayB0aGF0IHRoaXMgaXMgYSB2YWxpZCBmaWxlDQoJCQlyZXR1cm4gc2VsZjo6Y2hlY2soJHVzZXJmaWxlLCAkdHlwZSk7DQoJCX0NCgkJcmV0dXJuIGZhbHNlOw0KCX0NCg0KCS8qKg0KCSAqIEdldCB0aGUgZXJyb3JzDQoJICoNCgkgKiBAcGFyYW0gIGJvb2wgICAgICAgICAkdG9TdHJpbmcgICAgICBUaGUgb3B0aW9uIHRvIHJldHVybiBlcnJvcnMgYXMgYSBzdHJpbmcNCgkgKg0KCSAqIEByZXR1cm4gIGFycmF5DQoJICogQHNpbmNlICAzLjAuMTENCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGdldEVycm9yKCR0b1N0cmluZyA9IGZhbHNlKQ0KCXsNCgkJaWYgKCR0b1N0cmluZykNCgkJew0KCQkJcmV0dXJuIGltcGxvZGUoJyAnIC4gUEhQX0VPTCwgc2VsZjo6JGVycm9ycyk7DQoJCX0NCgkJcmV0dXJuIHNlbGY6OiRlcnJvcnM7DQoJfQ0KDQoJLyoqDQoJICogQ2hlY2sgYSBmaWxlIGFuZCB2ZXJpZmllcyBpdCBhcyBhIGFsbG93ZWQgZmlsZSBmb3JtYXQgZmlsZQ0KCSAqDQoJICogQHBhcmFtICBhcnJheSAgICAgICAgICR1cGxvYWQgICAgICBUaGUgdXBsb2FkZWQgZGV0YWlscyBhcnJheQ0KCSAqIEBwYXJhbSAgc3RyaW5nICAgICAgICAkdHlwZSAgICAgICAgICBUaGUgZmlsZSB0eXBlDQoJICoNCgkgKiBAcmV0dXJuICBhcnJheSAgb2YgZWxlbWVudHMNCgkgKg0KCSAqLw0KCXByb3RlY3RlZCBzdGF0aWMgZnVuY3Rpb24gY2hlY2soYXJyYXkgJHVwbG9hZCwgc3RyaW5nICR0eXBlKQ0KCXsNCgkJLy8gRGVmYXVsdCBmb3JtYXRzDQoJCSRmb3JtYXRzID0gTWltZUhlbHBlcjo6ZXh0ZW5zaW9ucygkdHlwZSk7DQoNCgkJLy8gQ2xlYW4gdGhlIHBhdGgNCgkJJHVwbG9hZF9wYXRoID0gUGF0aDo6Y2xlYW4oJHVwbG9hZFsnZnVsbF9wYXRoJ10pOw0KDQoJCS8vIEdldCBmaWxlIGV4dGVuc2lvbi9mb3JtYXQNCgkJJGZvcm1hdCA9IE1pbWVIZWxwZXI6OmV4dGVuc2lvbigkdXBsb2FkX3BhdGgpOw0KDQoJCS8vIExlZ2FsIGZpbGUgZm9ybWF0cw0KCQkkbGVnYWwgPSBhcnJheSgpOw0KDQoJCS8vIGNoZWNrIGlmIHRoZSBmaWxlIGZvcm1hdCBpcyBldmVuIGluIHRoZSBsaXN0DQoJCWlmIChpbl9hcnJheSgkZm9ybWF0LCAkZm9ybWF0cykpDQoJCXsNCgkJCS8vIGdldCBhbGxvd2VkIGZvcm1hdHMNCgkJCSRsZWdhbCA9IChhcnJheSkgSGVscGVyOjpnZXRQYXJhbXMoKS0+Z2V0KCR0eXBlIC4gJ19mb3JtYXRzJywgYXJyYXkoKSk7DQoJCX0NCg0KCQkvLyBjaGVjayB0aGUgZXh0ZW5zaW9uDQoJCWlmICghaW5fYXJyYXkoJGZvcm1hdCwgJGxlZ2FsKSkNCgkJew0KCQkJLy8gQ2xlYW51cCB0aGUgaW1wb3J0IGZpbGUNCgkJCXNlbGY6OnJlbW92ZSgkdXBsb2FkWydmdWxsX3BhdGgnXSk7DQoNCgkJCXNlbGY6OnNldEVycm9yKFRleHQ6Ol8oJ1VwbG9hZCBpcyBub3QgYSB2YWxpZCB0eXBlLicpKTsNCg0KCQkJcmV0dXJuIGZhbHNlOw0KCQl9DQoNCgkJcmV0dXJuICR1cGxvYWQ7DQoJfQ0KDQoJLyoqDQoJICogQ2xlYW4gdXAgdGVtcG9yYXJ5IHVwbG9hZGVkIGZpbGUNCgkgKg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgJGZ1bGxQYXRoICAgIFRoZSBmdWxsIHBhdGggb2YgdGhlIHVwbG9hZGVkIGZpbGUNCgkgKg0KCSAqIEByZXR1cm4gIGJvb2xlYW4gIFRydWUgb24gc3VjY2Vzcw0KCSAqDQoJICovDQoJcHJvdGVjdGVkIHN0YXRpYyBmdW5jdGlvbiByZW1vdmUoJGZ1bGxQYXRoKQ0KCXsNCgkJLy8gSXMgdGhlIHBhY2thZ2UgZmlsZSBhIHZhbGlkIGZpbGU/DQoJCWlmIChpc19maWxlKCRmdWxsUGF0aCkpDQoJCXsNCgkJCUZpbGU6OmRlbGV0ZSgkZnVsbFBhdGgpOw0KCQl9DQoJCWVsc2VpZiAoaXNfZmlsZShQYXRoOjpjbGVhbigkZnVsbFBhdGgpKSkNCgkJew0KCQkJLy8gSXQgbWlnaHQgYWxzbyBiZSBqdXN0IGEgYmFzZSBmaWxlbmFtZQ0KCQkJRmlsZTo6ZGVsZXRlKFBhdGg6OmNsZWFuKCRmdWxsUGF0aCkpOw0KCQl9DQoJfQ0KDQoJLyoqDQoJICogU2V0IHRoZSBlcnJvcnMNCgkgKg0KCSAqIEBwYXJhbSAgc3RyaW5nICAgICAgICAkbWVzc2FnZSAgIFRoZSBlcnJvciBtZXNzYWdlDQoJICoNCgkgKiBAcmV0dXJuICB2b2lkDQoJICogQHNpbmNlICAzLjAuMTENCgkgKi8NCglwcm90ZWN0ZWQgc3RhdGljIGZ1bmN0aW9uIHNldEVycm9yKCRtZXNzYWdlKQ0KCXsNCgkJaWYgKHNlbGY6OiRlbnF1ZXVlRXJyb3IpDQoJCXsNCgkJCUZhY3Rvcnk6OmdldEFwcGxpY2F0aW9uKCktPmVucXVldWVNZXNzYWdlKCRtZXNzYWdlLCAnZXJyb3InKTsNCgkJfQ0KCQllbHNlDQoJCXsNCgkJCXNlbGY6OiRlcnJvcnNbXSA9ICRtZXNzYWdlOw0KCQl9DQoJfQ==', '{}', 'UploadHelper', 'VDM\\Joomla\\Utilities.UploadHelper', '1.0.0', '{}', 'Utilities UploadHelper', 'abstract class', '{\"use_selection0\":{\"use\":\"640b5352-fb09-425f-a26e-cd44eda03f15\",\"as\":\"default\"}}', '', 1, '2022-05-16 13:20:50', '2022-05-21 13:27:39', 31, 9), -(26, '', 'Mime Helper\r\n\r\n@since 3.0.11', '', '', 'f11dc790-713e-4706-9a85-a318ed3ad56e', '', '', '', '{}', 'W0VYVEVSTkFMQ09ERT1odHRwczovL2dpc3QuZ2l0aHVidXNlcmNvbnRlbnQuY29tL0xsZXdlbGx5bnZkbS83NGJlMzczMzU3ZTEzMWI4Nzc1YTc1ODJjM2RlNTA4Yi9yYXcvbWltZV90eXBlcy5waHBdDQoNCltFWFRFUk5BTENPREU9aHR0cHM6Ly9naXN0LmdpdGh1YnVzZXJjb250ZW50LmNvbS9MbGV3ZWxseW52ZG0vNzRiZTM3MzM1N2UxMzFiODc3NWE3NTgyYzNkZTUwOGIvcmF3L2dldC5waHBdDQoNCltFWFRFUk5BTENPREU9aHR0cHM6Ly9naXN0LmdpdGh1YnVzZXJjb250ZW50LmNvbS9MbGV3ZWxseW52ZG0vNzRiZTM3MzM1N2UxMzFiODc3NWE3NTgyYzNkZTUwOGIvcmF3L2V4dGVuc2lvbnMucGhwXQ==', '{}', 'MimeHelper', 'VDM\\Joomla\\Utilities.MimeHelper', '1.0.0', '{}', 'Utilities MimeHelper', 'abstract class', '{}', '', 1, '2022-05-16 14:27:38', '2022-05-21 13:27:39', 3, 9), -(27, '', 'Just to link powers to the power updater component', '', '', '8025e71c-8e21-44cb-b23e-dce2fb5a1ab5', '', '', '', '{\"load_selection0\":{\"load\":\"db4a1e4d-be59-4e87-8b4d-c40512752232\"},\"load_selection1\":{\"load\":\"79d765b3-7319-4988-9730-446c7f347020\"},\"load_selection2\":{\"load\":\"d7600b43-771a-4747-9f5d-952765721799\"},\"load_selection3\":{\"load\":\"962b15d8-915f-4cd7-aea6-7cf82afdc20b\"},\"load_selection4\":{\"load\":\"f11dc790-713e-4706-9a85-a318ed3ad56e\"}}', '', '{}', 'Updater', 'VDM\\Powe\\Updater', '1.0.0', '{}', 'Power Updater', 'class', '{}', '', 1, '2022-05-21 13:15:55', '2022-06-11 16:54:51', 3, 13), -(28, 1, 'Start looking here:\r\nhttps://git.vdm.dev/api/swagger#/repository/repoGetContents', 'c65aaf1f-817c-49a2-8202-282e3904f5b1', '', 'ef011ee1-64f0-4048-b013-777473b727dd', 'dXNlIEpvb21sYVxDTVNcSHR0cFxIdHRwOw0KdXNlIEpvb21sYVxSZWdpc3RyeVxSZWdpc3RyeTs=', '', '', '{}', 'CS8qKg0KCSAqIEdldHMgdGhlIG1ldGFkYXRhIGFuZCBjb250ZW50cyAoaWYgYSBmaWxlKSBvZiBhbiBlbnRyeSBpbiBhIHJlcG9zaXRvcnksIG9yIGEgbGlzdCBvZiBlbnRyaWVzIGlmIGEgZGlyDQoJICoNCgkgKiBAcGFyYW0gICBzdHJpbmcgICRvd25lciAgICAgICBSZXBvc2l0b3J5IG93bmVyLg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgJHJlcG8gICAgICAgICBSZXBvc2l0b3J5IG5hbWUuDQoJICogQHBhcmFtICAgc3RyaW5nICAkZmlsZXBhdGggICAgUmVwb3NpdG9yeSBmaWxlIHBhdGguDQoJICoNCgkgKiBAcmV0dXJuICBvYmplY3QNCgkgKg0KCSAqIEBzaW5jZSAgIDEuMA0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiBnZXQoJG93bmVyLCAkcmVwbywgJGZpbGVwYXRoKQ0KCXsNCgkJLy8gQnVpbGQgdGhlIHJlcXVlc3QgcGF0aC4NCgkJJHBhdGggPSAnL3JlcG9zLycgLiAkb3duZXIgLiAnLycgLiAkcmVwbyAuICcvY29udGVudHMvJyAuICRmaWxlcGF0aDsNCg0KCQkvLyBTZW5kIHRoZSByZXF1ZXN0Lg0KCQlyZXR1cm4gJHRoaXMtPnByb2Nlc3NSZXNwb25zZSgNCgkJCSR0aGlzLT5jbGllbnQtPmdldCgkdGhpcy0+ZmV0Y2hVcmwoJHBhdGgpKQ0KCQkpOw0KCX0NCg==', '{}', 'File', 'VDM\\Gitea\\Package.Repo.File', '1.0.0', '{}', 'Gitea Repo File', 'class', '{}', '', 1, '2022-05-21 13:40:09', '2022-07-09 10:28:20', 10, 4), -(29, 1, 'Start looking here:\r\nhttps://git.vdm.dev/api/swagger#/repository/repoCreateWikiPage', 'c65aaf1f-817c-49a2-8202-282e3904f5b1', '', 'c4a188de-ad78-4a6d-9d5b-01866846d701', 'dXNlIEpvb21sYVxDTVNcSHR0cFxIdHRwOw0KdXNlIEpvb21sYVxSZWdpc3RyeVxSZWdpc3RyeTs=', '', '', '{}', 'CS8qKg0KCSAqIEdldCBhIHJlcG9zaXRvcnkgd2lraSBwYWdlDQoJICoNCgkgKiBAcGFyYW0gICBzdHJpbmcgICRvd25lciAgICAgICAgICAgICAgIFRoZSByZXBvc2l0b3J5IG93bmVyDQoJICogQHBhcmFtICAgc3RyaW5nICAkcmVwbyAgICAgICAgICAgICAgICAgVGhlIHJlcG9zaXRvcnkgbmFtZQ0KCSAqIEBwYXJhbSAgIHN0cmluZyAgJHBhZ2VOYW1lICAgICAgIFRoZSBwYWdlIG5hbWUNCgkgKg0KCSAqIEByZXR1cm4gIG9iamVjdA0KCSAqDQoJICogQHNpbmNlICAgMS4wDQoJICovDQoJcHVibGljIGZ1bmN0aW9uIGdldChzdHJpbmcgJG93bmVyLCBzdHJpbmcgJHJlcG8sIHN0cmluZyAkcGFnZU5hbWUpDQoJew0KCQkvLyBCdWlsZCB0aGUgcmVxdWVzdCBwYXRoLg0KCQkkcGF0aCA9ICcvcmVwb3MvJyAuICRvd25lciAuICcvJyAuICRyZXBvIC4gJy93aWtpL3BhZ2UvJyAuICRwYWdlTmFtZTsNCg0KCQkvLyBTZW5kIHRoZSByZXF1ZXN0Lg0KCQlyZXR1cm4gJHRoaXMtPnByb2Nlc3NSZXNwb25zZSgNCgkJCSR0aGlzLT5jbGllbnQtPmdldCgkdGhpcy0+ZmV0Y2hVcmwoJHBhdGgpKQ0KCQkpOw0KCX0NCg0KCS8qKg0KCSAqIEdldCBhIHJlcG9zaXRvcnkgd2lraSBodG1sIHBhZ2UNCgkgKg0KCSAqIEBwYXJhbSAgIHN0cmluZyAgJG93bmVyICAgICAgICAgICAgICAgVGhlIHJlcG9zaXRvcnkgb3duZXINCgkgKiBAcGFyYW0gICBzdHJpbmcgICRyZXBvICAgICAgICAgICAgICAgICBUaGUgcmVwb3NpdG9yeSBuYW1lDQoJICogQHBhcmFtICAgc3RyaW5nICAkcGFnZU5hbWUgICAgICAgVGhlIHBhZ2UgbmFtZQ0KCSAqDQoJICogQHJldHVybiAgb2JqZWN0DQoJICoNCgkgKiBAc2luY2UgICAxLjANCgkgKi8NCglwdWJsaWMgZnVuY3Rpb24gZ2V0SHRtbChzdHJpbmcgJG93bmVyLCBzdHJpbmcgJHJlcG8sIHN0cmluZyAkcGFnZU5hbWUpDQoJew0KCQkvLyBnZXQgdGhlIGdpdGVhIHdpa2kgcGFnZQ0KCQkkcGFnZSA9ICR0aGlzLT5nZXQoJG93bmVyLCAkcmVwbywgJHBhZ2VOYW1lKTsNCg0KCQlpZiAoZW1wdHkoJHBhZ2UtPmNvbnRlbnQpKQ0KCQl7DQoJCQl0aHJvdyBuZXcgXEV4Y2VwdGlvbignV2lraSBwYWdlIGNvdWxkIG5vdCBiZSBmb3VuZC4nKTsNCgkJfQ0KDQoJCS8vIEJ1aWxkIHRoZSByZXF1ZXN0IHBhdGguDQoJCSRwYXRoID0gJy9tYXJrZG93bic7DQoNCgkJLy8gR2V0IGhlYWRlcnMNCgkJJGhlYWRlcnMgPSAkdGhpcy0+Y2xpZW50LT5nZXRPcHRpb24oJ2hlYWRlcnMnLCBhcnJheSgpKTsNCg0KCQkkaGVhZGVyc1snYWNjZXB0J10gPSAndGV4dC9odG1sJzsNCgkJJGhlYWRlcnNbJ0NvbnRlbnQtVHlwZSddID0gJ2FwcGxpY2F0aW9uL2pzb24nOw0KDQoJCS8vIGJ1aWxkIHRoZSBwb3N0IGJvZHkNCgkJJGRhdGEgPSBbDQoJCQknQ29udGV4dCcgPT4gJ3N0cmluZycsDQoJCQknTW9kZScgPT4gJ3N0cmluZycsDQoJCQknVGV4dCcgPT4gJHBhZ2UtPmNvbnRlbnQsDQoJCQknV2lraScgPT4gdHJ1ZQ0KCQldOw0KDQoJCS8vIFBvc3QgdGhlIHJlcXVlc3QuDQoJCXJldHVybiAkdGhpcy0+cHJvY2Vzc1Jlc3BvbnNlKA0KCQkJJHRoaXMtPmNsaWVudC0+cG9zdCgkdGhpcy0+ZmV0Y2hVcmwoJHBhdGgpLCBqc29uX2VuY29kZSgkZGF0YSksICRoZWFkZXJzKQ0KCQkpOw0KCX0NCg==', '{}', 'Wiki', 'VDM\\Gitea\\Package.Repo.Wiki', '1.0.0', '{}', 'Gitea Repo Wiki', 'class', '{}', '', 1, '2022-07-09 10:21:53', '2022-07-09 12:18:07', 9, 4); +INSERT INTO `#__componentbuilder_joomla_plugin` (`id`, `add_head`, `add_php_method_uninstall`, `add_php_postflight_install`, `add_php_postflight_update`, `add_php_preflight_install`, `add_php_preflight_uninstall`, `add_php_preflight_update`, `add_php_script_construct`, `add_sales_server`, `add_sql`, `add_sql_uninstall`, `add_update_server`, `addreadme`, `class_extends`, `description`, `fields`, `guid`, `head`, `joomla_plugin_group`, `method_selection`, `main_class_code`, `name`, `php_method_uninstall`, `php_postflight_install`, `php_postflight_update`, `php_preflight_install`, `php_preflight_uninstall`, `php_preflight_update`, `php_script_construct`, `plugin_version`, `property_selection`, `readme`, `sales_server`, `sql`, `sql_uninstall`, `system_name`, `update_server`, `update_server_target`, `update_server_url`, `params`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES +(1, 1, '', '', '', 1, '', '', '', '', '', '', '', 1, 4, 'The plugin to fully integrate componentbuilder with the privacy suite of Joomla.', '{}', '518f7be7-140c-47d3-9fb2-b6717230e0fc', 'dXNlIEpvb21sYVxVdGlsaXRpZXNcQXJyYXlIZWxwZXI7DQoNCkpMb2FkZXI6OnJlZ2lzdGVyKCdQcml2YWN5UGx1Z2luJywgSlBBVEhfQURNSU5JU1RSQVRPUiAuICcvY29tcG9uZW50cy9jb21fcHJpdmFjeS9oZWxwZXJzL3BsdWdpbi5waHAnKTsNCkpMb2FkZXI6OnJlZ2lzdGVyKCdQcml2YWN5UmVtb3ZhbFN0YXR1cycsIEpQQVRIX0FETUlOSVNUUkFUT1IgLiAnL2NvbXBvbmVudHMvY29tX3ByaXZhY3kvaGVscGVycy9yZW1vdmFsL3N0YXR1cy5waHAnKTsNCkpMb2FkZXI6OnJlZ2lzdGVyKCdbW1tDb21wb25lbnRdXV1IZWxwZXInLCBKUEFUSF9BRE1JTklTVFJBVE9SIC4gJy9jb21wb25lbnRzL2NvbV9bW1tjb21wb25lbnRdXV0vaGVscGVycy9bW1tjb21wb25lbnRdXV0ucGhwJyk7IA==', 10, '{\"method_selection0\":{\"method\":\"51\"},\"method_selection1\":{\"method\":\"52\"},\"method_selection2\":{\"method\":\"53\"}}', 'CS8qKg0KCSAqIEFwcGxpY2F0aW9uIG9iamVjdA0KCSAqDQoJICogQHZhciAgICBDTVNBcHBsaWNhdGlvbg0KCSAqIEBzaW5jZSAgMS4wDQoJICovDQoJcHJvdGVjdGVkICAkYXBwOw0KDQoJLyoqDQoJICogRGF0YWJhc2Ugb2JqZWN0DQoJICoNCgkgKiBAdmFyICAgIERhdGFiYXNlRHJpdmVyDQoJICogQHNpbmNlICAxLjANCgkgKi8NCglwcm90ZWN0ZWQgICRkYjsNCg0KCS8qKg0KCSAqIEFmZmVjdHMgY29uc3RydWN0b3IgYmVoYXZpb3IuIElmIHRydWUsIGxhbmd1YWdlIGZpbGVzIHdpbGwgYmUgbG9hZGVkIGF1dG9tYXRpY2FsbHkuDQoJICoNCgkgKiBAdmFyICAgIGJvb2xlYW4NCgkgKiBAc2luY2UgIDEuMA0KCSAqLw0KCXByb3RlY3RlZCAgJGF1dG9sb2FkTGFuZ3VhZ2UgPSB0cnVlOw0KDQoJLyoqDQoJICogUGVyZm9ybXMgdmFsaWRhdGlvbiB0byBkZXRlcm1pbmUgaWYgdGhlIGRhdGEgYXNzb2NpYXRlZCB3aXRoIGEgcmVtb3ZlIGluZm9ybWF0aW9uIHJlcXVlc3QgY2FuIGJlIHByb2Nlc3NlZA0KCSAqDQoJICogQHBhcmFtICAgUHJpdmFjeVRhYmxlUmVxdWVzdCAgJHJlcXVlc3QgIFRoZSByZXF1ZXN0IHJlY29yZCBiZWluZyBwcm9jZXNzZWQNCgkgKiBAcGFyYW0gICBKVXNlciAgICAgICAgICAgICAgICAkdXNlciAgICAgVGhlIHVzZXIgYWNjb3VudCBhc3NvY2lhdGVkIHdpdGggdGhpcyByZXF1ZXN0IGlmIGF2YWlsYWJsZQ0KCSAqDQoJICogQHJldHVybiAgUHJpdmFjeVJlbW92YWxTdGF0dXMNCgkgKg0KCSAqIEBzaW5jZSAgIDEuMA0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiBvblByaXZhY3lDYW5SZW1vdmVEYXRhKFByaXZhY3lUYWJsZVJlcXVlc3QgJHJlcXVlc3QsIEpVc2VyICR1c2VyID0gbnVsbCkNCgl7DQoJCSRzdGF0dXMgPSBuZXcgUHJpdmFjeVJlbW92YWxTdGF0dXM7DQoNCgkJLy8gVGhpcyBwbHVnaW4gb25seSBwcm9jZXNzZXMgZGF0YSBmb3IgcmVnaXN0ZXJlZCB1c2VyIGFjY291bnRzDQoJCWlmICghJHVzZXIpDQoJCXsNCgkJCXJldHVybiAkc3RhdHVzOw0KCQl9DQoNCgkJLy8gY2hlY2sgaWYgdGhlIGhlbHBlciBtZXRob2QgaXMgc2V0IGluIHRoZSBjb21wb25lbnQNCgkJaWYgKG1ldGhvZF9leGlzdHMoJ1tbW0NvbXBvbmVudF1dXUhlbHBlcicsICdvblByaXZhY3lDYW5SZW1vdmVEYXRhJykpDQoJCXsNCgkJCVtbW0NvbXBvbmVudF1dXUhlbHBlcjo6b25Qcml2YWN5Q2FuUmVtb3ZlRGF0YSgkdGhpcywgJHN0YXR1cywgJHJlcXVlc3QsICR1c2VyKTsNCgkJfQ0KDQoJCXJldHVybiAkc3RhdHVzOw0KCX0NCg0KCS8qKg0KCSAqIFByb2Nlc3NlcyBhbiBleHBvcnQgcmVxdWVzdCBmb3IgSm9vbWxhIGNvcmUgdXNlciBkYXRhDQoJICoNCgkgKiBAcGFyYW0gICBQcml2YWN5VGFibGVSZXF1ZXN0ICAkcmVxdWVzdCAgVGhlIHJlcXVlc3QgcmVjb3JkIGJlaW5nIHByb2Nlc3NlZA0KCSAqIEBwYXJhbSAgIEpVc2VyICAgICAgICAgICAgICAgICR1c2VyICAgICBUaGUgdXNlciBhY2NvdW50IGFzc29jaWF0ZWQgd2l0aCB0aGlzIHJlcXVlc3QgaWYgYXZhaWxhYmxlDQoJICoNCgkgKiBAcmV0dXJuICBQcml2YWN5RXhwb3J0RG9tYWluW10NCgkgKg0KCSAqIEBzaW5jZSAgIDEuMA0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiBvblByaXZhY3lFeHBvcnRSZXF1ZXN0KFByaXZhY3lUYWJsZVJlcXVlc3QgJHJlcXVlc3QsIEpVc2VyICR1c2VyID0gbnVsbCkNCgl7DQoJCSRkb21haW5zID0gYXJyYXkoKTsNCg0KCQkvLyBUaGlzIHBsdWdpbiBvbmx5IHByb2Nlc3NlcyBkYXRhIGZvciByZWdpc3RlcmVkIHVzZXIgYWNjb3VudHMNCgkJaWYgKCEkdXNlcikNCgkJew0KCQkJcmV0dXJuICRkb21haW5zOw0KCQl9DQoNCgkJLy8gY2hlY2sgaWYgdGhlIGhlbHBlciBtZXRob2QgaXMgc2V0IGluIHRoZSBjb21wb25lbnQNCgkJaWYgKG1ldGhvZF9leGlzdHMoJ1tbW0NvbXBvbmVudF1dXUhlbHBlcicsICdvblByaXZhY3lFeHBvcnRSZXF1ZXN0JykpDQoJCXsNCgkJCVtbW0NvbXBvbmVudF1dXUhlbHBlcjo6b25Qcml2YWN5RXhwb3J0UmVxdWVzdCgkdGhpcywgJGRvbWFpbnMsICRyZXF1ZXN0LCAkdXNlcik7DQoJCX0NCg0KCQlyZXR1cm4gJGRvbWFpbnM7DQoJfQ0KDQoJLyoqDQoJICogUmVtb3ZlcyB0aGUgZGF0YSBhc3NvY2lhdGVkIHdpdGggYSByZW1vdmUgaW5mb3JtYXRpb24gcmVxdWVzdA0KCSAqDQoJICogQHBhcmFtICAgUHJpdmFjeVRhYmxlUmVxdWVzdCAgJHJlcXVlc3QgIFRoZSByZXF1ZXN0IHJlY29yZCBiZWluZyBwcm9jZXNzZWQNCgkgKiBAcGFyYW0gICBKVXNlciAgICAgICAgICAgICAgICAkdXNlciAgICAgVGhlIHVzZXIgYWNjb3VudCBhc3NvY2lhdGVkIHdpdGggdGhpcyByZXF1ZXN0IGlmIGF2YWlsYWJsZQ0KCSAqDQoJICogQHJldHVybiAgdm9pZA0KCSAqDQoJICogQHNpbmNlICAgMS4wDQoJICovDQoJcHVibGljIGZ1bmN0aW9uIG9uUHJpdmFjeVJlbW92ZURhdGEoUHJpdmFjeVRhYmxlUmVxdWVzdCAkcmVxdWVzdCwgSlVzZXIgJHVzZXIgPSBudWxsKQ0KCXsNCgkJLy8gVGhpcyBwbHVnaW4gb25seSBwcm9jZXNzZXMgZGF0YSBmb3IgcmVnaXN0ZXJlZCB1c2VyIGFjY291bnRzDQoJCWlmICghJHVzZXIpDQoJCXsNCgkJCXJldHVybjsNCgkJfQ0KDQoJCS8vIGNoZWNrIGlmIHRoZSBoZWxwZXIgbWV0aG9kIGlzIHNldCBpbiB0aGUgY29tcG9uZW50DQoJCWlmIChtZXRob2RfZXhpc3RzKCdbW1tDb21wb25lbnRdXV1IZWxwZXInLCAnb25Qcml2YWN5UmVtb3ZlRGF0YScpKQ0KCQl7DQoJCQlbW1tDb21wb25lbnRdXV1IZWxwZXI6Om9uUHJpdmFjeVJlbW92ZURhdGEoJHRoaXMsICRyZXF1ZXN0LCAkdXNlcik7DQoJCX0NCgl9', '[[[Component]]]', 'Ly8gUEhQIE1ldGhvZCAodW5pbnN0YWxsKQ==', 'Ly8gUEhQIFBvc3RmbGlnaHQgKGluc3RhbGwp', 'Ly8gUEhQIFBvc3RmbGlnaHQgKHVwZGF0ZSk=', 'CQkJLy8gY2hlY2sgdGhhdCBbW1tjb21wb25lbnRdXV0gaXMgaW5zdGFsbGVkDQoJCQkkcGF0aFRvQ29yZSA9IEpQQVRIX0FETUlOSVNUUkFUT1IgLiAnL2NvbXBvbmVudHMvY29tX1tbW2NvbXBvbmVudF1dXS9oZWxwZXJzL1tbW2NvbXBvbmVudF1dXS5waHAnOw0KCQkJaWYgKCFKRmlsZTo6ZXhpc3RzKCRwYXRoVG9Db3JlKSkNCgkJCXsNCgkJCQkkYXBwLT5lbnF1ZXVlTWVzc2FnZSgnW1tbY29tcG9uZW50X2Fjcm9ueW1dXV0gbXVzdCBmaXJzdCBiZSBpbnN0YWxsZWQgZnJvbSA8YSBocmVmPSJbW1tnZXRfY29tcG9uZW50X2xpbmtdXV0iIHRhcmdldD0iX2JsYW5rIj5bW1tjb21wb25lbnRfbGlua19uYW1lXV1dPC9hPi4nLCAnZXJyb3InKTsNCgkJCQlyZXR1cm4gZmFsc2U7DQoJCQl9', 'Ly8gUEhQIFByZWZsaWdodCAodW5pbnN0YWxsKQ==', 'Ly8gUEhQIFByZWZsaWdodCAodXBkYXRlKQ==', '', '1.0.0', '{\"property_selection0\":{\"property\":\"31\"},\"property_selection1\":{\"property\":\"32\"},\"property_selection2\":{\"property\":\"33\"}}', 'IyAjIyNQTFVHSU5fTkFNRSMjIyAoIyMjVkVSU0lPTiMjIykNCg0KIyMjREVTQ1JJUFRJT04jIyMNCg0KIyBCdWlsZCBEZXRhaWxzDQoNCisgKkNvbXBhbnkqOiBbIyMjQ09NUEFOWU5BTUUjIyNdKCMjI0FVVEhPUldFQlNJVEUjIyMpDQorICpBdXRob3IqOiBbIyMjQVVUSE9SIyMjXShtYWlsdG86IyMjQVVUSE9SRU1BSUwjIyMpDQorICpWZXJzaW9uKjogIyMjVkVSU0lPTiMjIw0KKyAqQ29weXJpZ2h0KjogIyMjQ09QWVJJR0hUIyMjDQorICpMaWNlbnNlKjogIyMjTElDRU5TRSMjIw==', '', '', '', 'Global Privacy', '', 1, 'https://www.vdm.io/updates/componentbuilder_global_privacy.xml', '', 1, '2019-07-16 00:49:50', '2020-05-24 22:49:38', 29, '', 1), +(21, '', '', '', '', 1, '', '', '', '', '', '', '', '', 1, 'Plugin to autoload the powers of componentbuilder', '{}', '86dd28b5-18d4-437e-8a53-7eaf23478fc8', '', 8, '{}', 'CS8qKg0KCSAqIEFwcGxpY2F0aW9uIG9iamVjdA0KCSAqDQoJICogQHZhciAgICBDTVNBcHBsaWNhdGlvbg0KCSAqIEBzaW5jZSAgMS4wLjANCgkgKi8NCglwcm90ZWN0ZWQgICRhcHA7DQoNCgkvKioNCgkgKiBBZmZlY3RzIGNvbnN0cnVjdG9yIGJlaGF2aW9yLiBJZiB0cnVlLCBsYW5ndWFnZSBmaWxlcyB3aWxsIGJlIGxvYWRlZCBhdXRvbWF0aWNhbGx5Lg0KCSAqDQoJICogQHZhciAgICBib29sZWFuDQoJICogQHNpbmNlICAxLjAuMA0KCSAqLw0KCXByb3RlY3RlZCAgJGF1dG9sb2FkTGFuZ3VhZ2UgPSBmYWxzZTsNCg0KCS8qKg0KCSAqIENvbnN0cnVjdG9yLg0KCSAqDQoJICogQHBhcmFtICAgb2JqZWN0ICAmJHN1YmplY3QgIFRoZSBvYmplY3QgdG8gb2JzZXJ2ZSAtLSBldmVudCBkaXNwYXRjaGVyLg0KCSAqIEBwYXJhbSAgIG9iamVjdCAgJGNvbmZpZyAgICBBbiBvcHRpb25hbCBhc3NvY2lhdGl2ZSBhcnJheSBvZiBjb25maWd1cmF0aW9uIHNldHRpbmdzLg0KCSAqDQoJICogQHNpbmNlICAgMS42DQoJICovDQoJcHVibGljIGZ1bmN0aW9uIF9fY29uc3RydWN0KCRzdWJqZWN0LCAkY29uZmlnKQ0KCXsNCgkJcGFyZW50OjpfX2NvbnN0cnVjdCgkc3ViamVjdCwgJGNvbmZpZyk7IyMjUExVR0lOX1BPV0VSX0FVVE9MT0FERVIjIyMNCgl9', '[[[Component]]] Powers Autoloader', '', '', '', 'Ly8gV0hBVD8=', '', '', '', '1.0.1', '{\"property_selection0\":{\"property\":\"25\"},\"property_selection1\":{\"property\":\"27\"}}', 'WW91IGNhbiB1c2UgYWxsIHRoZSBub3JtYWwgbWFya2Rvd24sIGluY2x1ZGluZyB0aGUgcGxhY2UtaG9sZGVycy4=', '', '', '', 'Powers Autoloader', '', 1, '', '', 1, '2021-11-11 02:22:02', '2024-03-01 21:18:38', 16, '', 8), +(24, '', '', '', '', 1, '', '', '', '', '', '', '', '', 1, 'Add Access Token to easy update [[[Component]]]', '{}', '29ac30d2-1c1a-4b9e-9cfa-c5fcb08caa01', 'dXNlIEpvb21sYVxDTVNcQXBwbGljYXRpb25cQ01TQXBwbGljYXRpb247DQp1c2UgSm9vbWxhXENNU1xQbHVnaW5cQ01TUGx1Z2luOw==', 12, '{\"method_selection0\":{\"method\":\"103\"}}', 'CS8qKg0KCSAqIEFwcGxpY2F0aW9uIG9iamVjdA0KCSAqDQoJICogQHZhciAgICBDTVNBcHBsaWNhdGlvbg0KCSAqIEBzaW5jZSAgMS4wLjANCgkgKi8NCglwcm90ZWN0ZWQgICRhcHA7DQoNCgkvKioNCgkgKiBBZmZlY3RzIGNvbnN0cnVjdG9yIGJlaGF2aW9yLiBJZiB0cnVlLCBsYW5ndWFnZSBmaWxlcyB3aWxsIGJlIGxvYWRlZCBhdXRvbWF0aWNhbGx5Lg0KCSAqDQoJICogQHZhciAgICBib29sZWFuDQoJICogQHNpbmNlICAxLjAuMA0KCSAqLw0KCXByb3RlY3RlZCAgJGF1dG9sb2FkTGFuZ3VhZ2UgPSB0cnVlOw0KDQoJLyoqDQoJICogb25JbnN0YWxsZXJCZWZvcmVQYWNrYWdlRG93bmxvYWQuDQoJICoNCgkgKiBGb3IgbW9kaWZpY2F0aW9uIG9mIFVSTCBhbmQgaGVhZGVycyBiZWZvcmUgcGFja2FnZSBkb3dubG9hZA0KCSAqDQoJICogQHJldHVybiAgdm9pZA0KCSAqDQoJICogQHNpbmNlICAgMS4wDQoJICovDQoJcHVibGljIGZ1bmN0aW9uIG9uSW5zdGFsbGVyQmVmb3JlUGFja2FnZURvd25sb2FkKCYkdXJsLCAmJGhlYWRlcnMpDQoJew0KCQkvLyBzZXQgdGhlIFVSSSBvYmplY3QNCgkJJHVyaSA9IFxKVXJpOjpnZXRJbnN0YW5jZSgkdXJsKTsNCgkJJHBhcnRzID0gZXhwbG9kZSgnLycsICR1cmktPmdldFBhdGgoKSk7DQoNCgkJLy8gY2hlY2sgdGhhdCB0aGlzIGlzIG91ciBBUEkNCgkJaWYgKCR1cmktPmdldEhvc3QoKSA9PSAnW1tbZ2l0ZWFfdXJsXV1dJyAmJiBpbl9hcnJheSgnW1tbZ2l0ZWFfcGFja2FnZV9uYW1lXV1dJywgJHBhcnRzKSkNCgkJew0KCQkJLy8gZ2V0IHRoZSB0b2tlbiBpZiBzZXQNCgkJCSR0b2tlbiA9IFxKQ29tcG9uZW50SGVscGVyOjpnZXRQYXJhbXMoJ2NvbV9bW1tjb21wb25lbnRdXV0nKS0+Z2V0KCdnaXRlYV90b2tlbicsIGZhbHNlKTsNCgkJCS8vIG9ubHkgYWRkIGlmIHRva2VuIGlzIHNldA0KCQkJaWYgKCR0b2tlbikNCgkJCXsNCgkJCQkvLyBhZGQgdGhlIHRva2VuDQoJCQkJJHVyaS0+c2V0VmFyKCdhY2Nlc3NfdG9rZW4nLCAkdG9rZW4pOw0KCQkJCS8vIHVwZGF0ZSB0aGUgVVJMDQoJCQkJJHVybCA9ICR1cmktPnRvU3RyaW5nKCk7DQoJCQl9DQoJCQllbHNlDQoJCQl7DQoJCQkJLy8gc2V0IHRoZSByZXR1cm4gVVJMDQoJCQkJJHJldHVybiA9IHVybGVuY29kZShiYXNlNjRfZW5jb2RlKChzdHJpbmcpIFxKVXJpOjpnZXRJbnN0YW5jZSgpKSk7DQoJCQkJLy8gc2V0IHRoZSB1cmxzDQoJCQkJJGdldF9hY2Nlc3NfdG9rZW5fdXJsID0gJyJodHRwczovL1tbW2dpdGVhX3VybF1dXS91c2VyL3NldHRpbmdzL2FwcGxpY2F0aW9ucyIgdGFyZ2V0PSJfYmxhbmsiIHRpdGxlPSInIC4gVGV4dDo6XygnR2V0IEFjY2VzcyBUb2tlbicpIC4gJyInOw0KCQkJCSRzZXRfYWNjZXNzX3Rva2VuX3VybCA9ICciJyAuIFxKVXJpOjpyb290KCkgLiAnYWRtaW5pc3RyYXRvci9pbmRleC5waHA/b3B0aW9uPWNvbV9jb25maWcmdmlldz1jb21wb25lbnQmY29tcG9uZW50PWNvbV9bW1tjb21wb25lbnRdXV0mcGF0aD0mcmV0dXJuPScgLiAkcmV0dXJuIC4gJyIgdGl0bGU9IicgLiBUZXh0OjpfKCdTZXQgQWNjZXNzIFRva2VuJykgLiAnIic7DQoJCQkJLy8gbG9hZCB0aGUgbWVzc2FnZQ0KCQkJCSR0aGlzLT5hcHAtPmVucXVldWVNZXNzYWdlKA0KCQkJCQlUZXh0OjpzcHJpbnRmKCJJZiB0aGVyZSB3YXMgYSBkb3dubG9hZC91cGRhdGUgZXJyb3IsIGl0J3MgcHJvYmFibHkgYmVjYXVzZSB0aGUgPGEgaHJlZj0lcyA+QVBJIEFjY2VzcyBUb2tlbjwvYT4gZm9yIHVwZGF0ZXMgb2YgW1tbY29tcG9uZW50XV1dIGhhcyBub3QgYmVlbiBzZXQsIHlvdSBjYW4gc2V0IHRoaXMgYWNjZXNzIHRva2VuIGluIHRoZSA8YSBocmVmPSVzID5nbG9iYWwgb3B0aW9ucyB0YWI8L2E+LiIsDQoJCQkJCQkkZ2V0X2FjY2Vzc190b2tlbl91cmwsDQoJCQkJCQkkc2V0X2FjY2Vzc190b2tlbl91cmwNCgkJCQkJKSwgJ25vdGljZScpOw0KCQkJfQ0KCQl9DQoJfQ0K', 'componentbuilder', '', '', '', 'Ly8gbmVlZHMgZml4', '', '', '', '1.0.2', '{\"property_selection0\":{\"property\":\"39\"},\"property_selection1\":{\"property\":\"37\"}}', 'WW91IGNhbiB1c2UgYWxsIHRoZSBub3JtYWwgbWFya2Rvd24sIGluY2x1ZGluZyB0aGUgcGxhY2UtaG9sZGVycy4=', '', '', '', 'Update (git.vdm.dev)', '', 1, '', '', 1, '2021-12-08 07:42:39', '2024-03-01 21:17:50', 17, '', 9), +(28, 1, '', '', '', 1, '', '', '', '', '', '', '', 1, 1, 'This plugin is used to load PreUpVer on your website. So it adds https://cdn.jsdelivr.net/gh/Llewellynvdm/PreUpVer@1.0.0/dist/js/preupver.min.js to the header of your website. See: https://git.vdm.dev/Llewellyn/PreUpVer for more details.', '{}', 'dd6580c4-6bbb-4d13-a868-0b38fbb6a66e', 'dXNlIEpvb21sYVxDTVNcUGx1Z2luXENNU1BsdWdpbjsNCnVzZSBKb29tbGFcQ01TXEh0bWxcSFRNTEhlbHBlcjsNCg==', 8, '{\"method_selection0\":{\"method\":\"122\"}}', 'CS8qKg0KCSAqIEFwcGxpY2F0aW9uIG9iamVjdA0KCSAqDQoJICogQHZhciAgICBDTVNBcHBsaWNhdGlvbg0KCSAqIEBzaW5jZSAgMS4wLjANCgkgKi8NCglwcm90ZWN0ZWQgICRhcHA7DQoNCgkvKioNCgkgKiBUaGlzIG1ldGhvZCBpcyBjYWxsZWQgYmVmb3JlIHRoZSBoZWFkIGlzIGNvbXBpbGVkIGFuZCBhbGxvd3MgbWFuaXB1bGF0aW9uIG9mIHRoZSBoZWFkIGRhdGEuDQoJICogSW4gdGhpcyBjYXNlLCBpdCdzIHVzZWQgdG8gYWRkIGEgSmF2YVNjcmlwdCBmaWxlIHRvIHRoZSBmcm9udCBlbmQgb2YgdGhlIEpvb21sYSBzaXRlLg0KCSAqDQoJICogQHJldHVybiAgdm9pZA0KCSAqDQoJICogQHNpbmNlICAgMy4wLjANCgkgKiBAdGhyb3dzICBFeGNlcHRpb24gb24gZXJyb3IuDQoJICovDQoJcHVibGljIGZ1bmN0aW9uIG9uQmVmb3JlQ29tcGlsZUhlYWQoKQ0KCXsNCgkJLy8gQ2hlY2sgaWYgd2UgYXJlIGluIHRoZSBzaXRlIGFwcGxpY2F0aW9uDQoJCWlmICgkdGhpcy0+YXBwLT5pc0NsaWVudCgnc2l0ZScpKSB7DQoJCQlIVE1MSGVscGVyOjpfKCdzY3JpcHQnLCAnaHR0cHM6Ly9jZG4uanNkZWxpdnIubmV0L2doL0xsZXdlbGx5bnZkbS9QcmVVcFZlckAxLjAuMC9kaXN0L2pzL3ByZXVwdmVyLm1pbi5qcycsIFsndmVyc2lvbicgPT4gJ2F1dG8nXSk7DQoJCX0NCgl9', 'PreUpVerLoader', '', '', '', 'CQkJJGp2ZXJzaW9uID0gbmV3IEpWZXJzaW9uKCk7DQoJCQlpZiAoISRqdmVyc2lvbi0+aXNDb21wYXRpYmxlKCczLjEwLjAnKSkgew0KCQkJCSRhcHAtPmVucXVldWVNZXNzYWdlKCdQbGVhc2UgdXBncmFkZSB0byBhdCBsZWFzdCBKb29tbGEhIDMuMTAgYmVmb3JlIGNvbnRpbnVpbmchJywgJ2Vycm9yJyk7DQoJCQkJcmV0dXJuIGZhbHNlOw0KCQkJfQ0K', '', '', '', '1.0.0', '{\"property_selection0\":{\"property\":\"25\"}}', 'IyBQcmVVcFZlciBMb2FkZXIgKFtbW3BsdWdpbi52ZXJzaW9uXV1dKQ0KDQojIyBJbnRyb2R1Y3Rpb24NCg0KUHJlVXBWZXIgaXMgYSB2ZXJzYXRpbGUgSmF2YVNjcmlwdCBsaWJyYXJ5IGRlc2lnbmVkIHRvIGF1dG9tYXRpY2FsbHkgdXBkYXRlIHRoZSB2ZXJzaW9uIG51bWJlcnMgb2YgbGlicmFyeSBzY3JpcHRzIGluIHlvdXIgZG9jdW1lbnRhdGlvbi4gSXQgaWRlbnRpZmllcyBzcGVjaWZpYyBgPHByZT5gIHRhZ3Mgb24geW91ciB3ZWJwYWdlIGFuZCB1cGRhdGVzIHRoZW0gd2l0aCB0aGUgbGF0ZXN0IHZlcnNpb24gdGFnIGZldGNoZWQgZnJvbSBhIHNwZWNpZmllZCByZXBvc2l0b3J5LCBlbnN1cmluZyB5b3VyIGRvY3VtZW50YXRpb24gYWx3YXlzIGRpc3BsYXlzIHVwLXRvLWRhdGUgaW5mb3JtYXRpb24uDQoNCiMjIEhvdyBJdCBXb3Jrcw0KDQpQcmVVcFZlciBvcGVyYXRlcyBieSBzZWFyY2hpbmcgZm9yIGA8cHJlPmAgdGFncyB3aXRoIGEgZGVzaWduYXRlZCBjbGFzcyAoYHByZXVwdmVyYCkgYW5kIHVzaW5nIHRoZWlyIGRhdGEgYXR0cmlidXRlcyB0byBwZXJmb3JtIHZlcnNpb24gdXBkYXRlcy4gSXQgc2ltcGxpZmllcyB0aGUgcHJvY2VzcyBvZiBrZWVwaW5nIHlvdXIgbGlicmFyeSByZWZlcmVuY2VzIHVwLXRvLWRhdGUgaW4gZG9jdW1lbnRhdGlvbi4NCg0KIyMjIEF1dG9tYXRpYyBEZXRlY3Rpb24gYW5kIFVwZGF0aW5nDQoNCldoZW4gdGhlIHdlYnBhZ2UgbG9hZHMsIFByZVVwVmVyIGZpbmRzIGFsbCBgPHByZT5gIHRhZ3MgbWFya2VkIHdpdGggdGhlIGBwcmV1cHZlcmAgY2xhc3MuIEl0IHRoZW4gZXh0cmFjdHMgbmVjZXNzYXJ5IGRldGFpbHMgZnJvbSB0aGVpciBkYXRhIGF0dHJpYnV0ZXMgYW5kIHVwZGF0ZXMgZWFjaCB0YWcgd2l0aCB0aGUgbGF0ZXN0IGxpYnJhcnkgdmVyc2lvbi4NCg0KIyMjIFVzYWdlDQoNCjEuICoqTWFya2luZyBgPHByZT5gIFRhZ3M6KioNCg0KICAgQWRkIHRoZSBgY2xhc3M9InByZXVwdmVyImAgdG8gYDxwcmU+YCB0YWdzIGluIHlvdXIgSFRNTCBhbmQgZGVmaW5lIHRoZSByZXF1aXJlZCBkYXRhIGF0dHJpYnV0ZXMgZm9yIGF1dG9tYXRpYyB1cGRhdGluZzoNCg0KICAgYGBgaHRtbA0KICAgPHByZSBpZD0idW5pcXVlLWlkIiBjbGFzcz0icHJldXB2ZXIiDQogICAgICAgIGRhdGEtYXBpLXVybD0iaHR0cHM6Ly9hcGkuZ2l0aHViLmNvbS9yZXBvcy91c2VybmFtZS9saWJyYXJ5L3RhZ3MiDQogICAgICAgIGRhdGEtZGVzY3JpcHRpb249IkRlc2NyaXB0aW9uIG9mIHRoZSBsaWJyYXJ5IHNjcmlwdCINCiAgICAgICAgZGF0YS11cmw9Imh0dHBzOi8vY2RuLmpzZGVsaXZyLm5ldC9naC91c2VybmFtZS9saWJyYXJ5QCR7dmVyc2lvbn0vZGlzdC9saWJyYXJ5Lm1pbi5qcyI+DQogICA8L3ByZT4NCiAgIGBgYA0KDQogICBSZXBsYWNlIGB1bmlxdWUtaWRgLCBgdXNlcm5hbWVgLCBgbGlicmFyeWAsIGFuZCBvdGhlciBwbGFjZWhvbGRlcnMgd2l0aCB5b3VyIHNwZWNpZmljIGRldGFpbHMuDQoNCjIuICoqQXR0cmlidXRlcyBFeHBsYWluZWQ6KioNCg0KICAgLSBgaWRgOiBBIHVuaXF1ZSBpZGVudGlmaWVyIGZvciB0aGUgYDxwcmU+YCB0YWcuDQogICAtIGBkYXRhLWFwaS11cmxgOiBUaGUgQVBJIFVSTCB0byBmZXRjaCB0aGUgbGF0ZXN0IGxpYnJhcnkgdmVyc2lvbi4NCiAgIC0gYGRhdGEtZGVzY3JpcHRpb25gOiBBIGJyaWVmIGRlc2NyaXB0aW9uIG9mIHRoZSBsaWJyYXJ5IHNjcmlwdC4NCiAgIC0gYGRhdGEtdXJsYDogVGhlIFVSTCBvZiB0aGUgc2NyaXB0LCB3aGVyZSBgJHt2ZXJzaW9ufWAgd2lsbCBiZSByZXBsYWNlZCB3aXRoIHRoZSBsYXRlc3QgdmVyc2lvbiBudW1iZXIuDQoNCiMjIyBFeGFtcGxlDQoNCkNoZWNrIG91dCB0aGUgW3Rlc3RzXShodHRwczovL2dpdC52ZG0uZGV2L0xsZXdlbGx5bi9QcmVVcFZlci9zcmMvYnJhbmNoL21hc3Rlci90ZXN0cy8pIGZvbGRlciBmb3IgdGhlIGV4YW1wbGVzIHdlIHVzZSB0byB0ZXN0IGlmIHRoaXMgbGlicmFyeSB3b3JrcyBhcyBleHBlY3RlZC4NCg0KIyBCdWlsZCBEZXRhaWxzDQoNCisgKkF1dGhvcio6IFtMbGV3ZWxseW4gdmFuIGRlciBNZXJ3ZV0obWFpbHRvOmpvb21sYUB2ZG0uaW8pDQorICpOYW1lKjogW1ByZVVwVmVyIExvYWRlcl0oaHR0cHM6Ly9naXQudmRtLmRldi9MbGV3ZWxseW4vUHJlVXBWZXIpDQorICpGaXJzdCBCdWlsZCo6ICMjI0NSRUFUSU9OREFURSMjIw0KKyAqTGFzdCBCdWlsZCo6ICMjI0JVSUxEREFURSMjIw0KKyAqVmVyc2lvbio6IFtbW3BsdWdpbi52ZXJzaW9uXV1dDQorICpDb3B5cmlnaHQqOiAjIyNDT1BZUklHSFQjIyMNCisgKkxpY2Vuc2UqOiAjIyNMSUNFTlNFIyMjDQoNCj4gVGhpcyAqKnBsdWdpbioqIHdhcyBidWlsZCB3aXRoIGEgSm9vbWxhIFtBdXRvbWF0ZWQgQ29tcG9uZW50IEJ1aWxkZXJdKGh0dHBzOi8vd3d3Lmpvb21sYWNvbXBvbmVudGJ1aWxkZXIuY29tKS4NCj4gRGV2ZWxvcGVkIGJ5IFtMbGV3ZWxseW4gdmFuIGRlciBNZXJ3ZV0obWFpbHRvOmpvb21sYUB2ZG0uaW8p', '', '', '', 'PreUpVer Loader', '', 1, '', '', 1, '2023-11-28 09:01:02', '2023-11-28 11:27:32', 5, '', 2); -- -- Dumping data for table `#__componentbuilder_admin_view` -- -INSERT INTO `#__componentbuilder_admin_view` (`id`, `add_css_view`, `add_css_views`, `add_custom_button`, `add_custom_import`, `add_fadein`, `add_javascript_view_file`, `add_javascript_view_footer`, `add_javascript_views_file`, `add_javascript_views_footer`, `add_php_ajax`, `add_php_allowedit`, `add_php_batchcopy`, `add_php_batchmove`, `add_php_getitem`, `add_php_getitems`, `add_php_getitems_after_all`, `add_php_getlistquery`, `add_php_postsavehook`, `add_php_save`, `add_sql`, `addlinked_views`, `addpermissions`, `addtables`, `addtabs`, `add_php_before_delete`, `add_php_before_publish`, `add_php_document`, `add_php_after_delete`, `add_php_after_publish`, `php_before_delete`, `php_before_publish`, `php_controller`, `php_document`, `php_after_delete`, `php_after_publish`, `ajax_input`, `css_view`, `css_views`, `custom_button`, `description`, `html_import_view`, `icon`, `icon_add`, `icon_category`, `javascript_view_file`, `javascript_view_footer`, `javascript_views_file`, `javascript_views_footer`, `name_list`, `system_name`, `name_single`, `php_ajaxmethod`, `php_allowedit`, `php_batchcopy`, `php_batchmove`, `php_getitem`, `php_getitems`, `php_getitems_after_all`, `php_getlistquery`, `php_import`, `php_import_display`, `php_import_save`, `php_import_setdata`, `php_model`, `php_postsavehook`, `php_save`, `short_description`, `source`, `sql`, `type`, `params`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `guid`) VALUES -(109, '', '', '', '', 1, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '{}', '{\"addpermissions0\":{\"action\":\"view.edit\",\"implementation\":3},\"addpermissions1\":{\"action\":\"view.edit.own\",\"implementation\":3},\"addpermissions2\":{\"action\":\"view.edit.state\",\"implementation\":3},\"addpermissions3\":{\"action\":\"view.edit.created_by\",\"implementation\":3},\"addpermissions4\":{\"action\":\"view.edit.created\",\"implementation\":3},\"addpermissions5\":{\"action\":\"view.create\",\"implementation\":3},\"addpermissions6\":{\"action\":\"view.delete\",\"implementation\":3},\"addpermissions7\":{\"action\":\"view.access\",\"implementation\":3}}', '{}', '{\"addtabs0\":{\"name\":\"Details\"},\"addtabs1\":{\"name\":\"More\"}}', '', '', '', '', '', '', '', '', '', '', '', '{}', '', '', '{}', '', '', 'images/WoodMannequin-icon.png', 'images/WoodMannequin-icon-plus.png', '', '', '', '', '', 'Looks', 'Look', 'Look', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'The demo view', '', '', 1, '{\"fieldordering\":{\"add_admin_ordering\":\"0\",\"admin_ordering_fields\":{\"admin_ordering_fields0\":{\"field\":\"\",\"direction\":\"ASC\"}},\"add_linked_ordering\":\"0\",\"linked_ordering_fields\":{\"linked_ordering_fields0\":{\"field\":\"\",\"direction\":\"ASC\"}}},\"privacy\":{\"activate\":\"1\",\"permissions\":\"1\",\"anonymize\":\"0\",\"anonymize_fields\":[],\"user_link\":\"1\",\"custom_link\":\"$query->where($db->quoteName(\'created_by\') . \' = \' . $db->quote($user->id));\",\"other_user_field\":\"682\"}}', 1, '2016-10-18 11:44:46', '2020-05-21 14:39:27', 18, '', 110, 'c1053952-8a84-4398-aef1-41726f7c0043'); - - +INSERT INTO `#__componentbuilder_admin_view` (`id`, `add_css_view`, `add_css_views`, `add_custom_button`, `add_custom_import`, `add_fadein`, `add_javascript_view_file`, `add_javascript_view_footer`, `add_javascript_views_file`, `add_javascript_views_footer`, `add_php_ajax`, `add_php_allowedit`, `add_php_batchcopy`, `add_php_batchmove`, `add_php_getitem`, `add_php_getitems`, `add_php_getitems_after_all`, `add_php_getlistquery`, `add_php_postsavehook`, `add_php_save`, `add_sql`, `addlinked_views`, `addpermissions`, `addtables`, `addtabs`, `add_php_before_delete`, `add_php_before_publish`, `add_php_document`, `add_php_after_delete`, `add_php_after_publish`, `php_before_delete`, `php_before_publish`, `php_controller`, `php_document`, `php_after_delete`, `php_after_publish`, `ajax_input`, `css_view`, `css_views`, `custom_button`, `description`, `html_import_view`, `icon`, `icon_add`, `icon_category`, `javascript_view_file`, `javascript_view_footer`, `javascript_views_file`, `javascript_views_footer`, `name_list`, `system_name`, `name_single`, `php_ajaxmethod`, `php_allowedit`, `php_batchcopy`, `php_batchmove`, `php_getitem`, `php_getitems`, `php_getitems_after_all`, `php_getlistquery`, `php_import`, `php_import_display`, `php_import_save`, `php_import_setdata`, `php_model`, `php_postsavehook`, `php_save`, `short_description`, `source`, `sql`, `type`, `php_before_save`, `php_controller_list`, `php_getform`, `php_after_cancel`, `php_allowadd`, `php_before_cancel`, `php_import_ext`, `php_import_headers`, `php_model_list`, `params`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `guid`) VALUES +(109, '', '', '', '', 1, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '{}', '{\"addpermissions0\":{\"action\":\"view.edit\",\"implementation\":3},\"addpermissions1\":{\"action\":\"view.edit.own\",\"implementation\":3},\"addpermissions2\":{\"action\":\"view.edit.state\",\"implementation\":3},\"addpermissions3\":{\"action\":\"view.edit.created_by\",\"implementation\":3},\"addpermissions4\":{\"action\":\"view.edit.created\",\"implementation\":3},\"addpermissions5\":{\"action\":\"view.create\",\"implementation\":3},\"addpermissions6\":{\"action\":\"view.delete\",\"implementation\":3},\"addpermissions7\":{\"action\":\"view.access\",\"implementation\":3}}', '{}', '{\"addtabs0\":{\"name\":\"Details\"},\"addtabs1\":{\"name\":\"More\"}}', '', '', '', '', '', '', '', '', '', '', '', '{}', '', '', '{}', '', '', 'images/WoodMannequin-icon.png', 'images/WoodMannequin-icon-plus.png', '', '', '', '', '', 'Looks', 'Look', 'Look', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'The demo view', '', '', 1, '', '', '', '', '', '', '', '', '', '{\"fieldordering\":{\"add_admin_ordering\":\"0\",\"admin_ordering_fields\":{\"admin_ordering_fields0\":{\"field\":\"\",\"direction\":\"ASC\"}},\"add_linked_ordering\":\"0\",\"linked_ordering_fields\":{\"linked_ordering_fields0\":{\"field\":\"\",\"direction\":\"ASC\"}}},\"privacy\":{\"activate\":\"1\",\"permissions\":\"1\",\"anonymize\":\"0\",\"anonymize_fields\":[],\"user_link\":\"1\",\"custom_link\":\"$query->where($db->quoteName(\'created_by\') . \' = \' . $db->quote($user->id));\",\"other_user_field\":\"682\"}}', 1, '2016-10-18 11:44:46', '2020-05-21 14:39:27', 18, '', 110, 'c1053952-8a84-4398-aef1-41726f7c0043'); -- -- Dumping data for table `#__componentbuilder_site_view` -- -INSERT INTO `#__componentbuilder_site_view` (`id`, `add_css_document`, `add_css`, `add_js_document`, `add_php_document`, `add_php_jview`, `add_php_jview_display`, `add_php_view`, `add_php_ajax`, `add_custom_button`, `custom_button`, `button_position`, `php_controller`, `php_model`, `ajax_input`, `php_ajaxmethod`, `codename`, `css_document`, `css`, `custom_get`, `default`, `description`, `dynamic_get`, `js_document`, `main_get`, `name`, `system_name`, `php_document`, `php_jview`, `php_jview_display`, `php_view`, `snippet`, `params`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `guid`) VALUES -(23, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'looks', '', '', '', 'PHRhYmxlIGNsYXNzPSJ1ay10YWJsZSB1ay10YWJsZS1ob3ZlciI+DQogICAgPGNhcHRpb24+PD9waHAgZWNobyBKVGV4dDo6XygnTGlzdCBvZiBhbGwgbG9va3MnKTsgPz48L2NhcHRpb24+DQogICAgPHRoZWFkPg0KICAgICAgICA8dHI+DQogICAgICAgICAgICA8dGg+PD9waHAgZWNobyBKVGV4dDo6XygnTmFtZScpOyA/PjwvdGg+DQogICAgICAgICAgICA8dGg+PD9waHAgZWNobyBKVGV4dDo6XygnRGVzY3JpcHRpb24nKTsgPz48L3RoPg0KICAgICAgICA8L3RyPg0KICAgIDwvdGhlYWQ+DQogICAgPHRib2R5Pg0KICAgICAgICA8P3BocCBmb3JlYWNoICgkdGhpcy0+aXRlbXMgYXMgJGl0ZW0pOiA/Pg0KICAgICAgICA8dHI+DQogICAgICAgICAgICA8dGQ+PGEgaHJlZj0iPD9waHAgZWNobyAgW1tbQ29tcG9uZW50XV1dSGVscGVyUm91dGU6OmdldExvb2tpbmdSb3V0ZSgkaXRlbS0+c2x1Zyk7ID8+IiA+PD9waHAgZWNobyAkaXRlbS0+bmFtZTsgPz48L2E+PC90ZD4NCiAgICAgICAgICAgIDx0ZD48P3BocCBlY2hvICR0aGlzLT5lc2NhcGUoJGl0ZW0tPmRlc2NyaXB0aW9uLCB0cnVlLCAxMjApOyA/Pjw/cGhwIGVjaG8gJGl0ZW0tPmVkaXRMaW5rOyA/PjwvdGQ+DQogICAgICAgIDwvdHI+DQogICAgICAgIDw/cGhwIGVuZGZvcmVhY2g7ID8+DQogICAgPC90Ym9keT4NCjwvdGFibGU+', 'The List of all published looks', 36, '', 36, 'Looks', 'Looks', '', '', '', '', '', '', 1, '2016-04-05 14:31:59', '2016-10-20 15:57:24', 9, '', 14, 'b2dce59e-e3b8-4467-bcb5-8f2df4bdfeb7'), -(25, '', '', '', '', 1, 1, '', '', '', '', 1, '', '', '', '', 'looking', '', '', '', 'PGFydGljbGUgY2xhc3M9InVrLWNvbW1lbnQiPg0KICAgIDxoZWFkZXIgY2xhc3M9InVrLWNvbW1lbnQtaGVhZGVyIj4NCiAgICAgICAgPGltZyBjbGFzcz0idWstY29tbWVudC1hdmF0YXIiIHNyYz0ie2ltYWdldXJsfSIgYWx0PSIiPg0KICAgICAgICA8aDQgY2xhc3M9InVrLWNvbW1lbnQtdGl0bGUiPjw/cGhwIGVjaG8gJHRoaXMtPmVzY2FwZSgkdGhpcy0+aXRlbS0+bmFtZSk7ID8+PC9oND4NCiAgICAgICAgPGRpdiBjbGFzcz0idWstY29tbWVudC1tZXRhIj48P3BocCBlY2hvIEpUZXh0OjpfKCdIaXRzJyk7ID8+OiA8P3BocCBlY2hvICR0aGlzLT5pdGVtLT5oaXRzOyA/PjwvZGl2Pg0KICAgIDwvaGVhZGVyPg0KICAgIDxkaXYgY2xhc3M9InVrLWNvbW1lbnQtYm9keSI+DQogICAgICAgIDw/cGhwIGVjaG8gJHRoaXMtPml0ZW0tPmRlc2NyaXB0aW9uOyA/Pg0KICAgICAgICA8P3BocCBpZiAoJHRoaXMtPml0ZW0tPmFkZCk6ID8+DQogICAgICAgICAgICA8YnIgLz4NCiAgICAgICAgICAgIDwhLS0gVGhpcyBpcyBhIGJ1dHRvbiB0b2dnbGluZyB0aGUgbW9kYWwgLS0+DQogICAgICAgICAgICA8YnV0dG9uIGNsYXNzPSJ1ay1idXR0b24iIGRhdGEtdWstbW9kYWw9Int0YXJnZXQ6JyNtb3JlLWRldGFpbHMtMDkwJ30iPjw/cGhwIGVjaG8gSlRleHQ6Ol8oJ01vcmUgRGV0YWlscycpOyA/PjwvYnV0dG9uPg0KICAgICAgICA8P3BocCBlbmRpZjsgPz4NCiAgICA8L2Rpdj4NCjwvYXJ0aWNsZT4NCjw/cGhwIGlmICgkdGhpcy0+aXRlbS0+YWRkKTogPz4NCjwhLS0gVGhpcyBpcyB0aGUgbW9kYWwgLS0+DQo8ZGl2IGlkPSJtb3JlLWRldGFpbHMtMDkwIiBjbGFzcz0idWstbW9kYWwiPg0KICAgIDxkaXYgY2xhc3M9InVrLW1vZGFsLWRpYWxvZyI+DQogICAgICAgIDxhIGNsYXNzPSJ1ay1tb2RhbC1jbG9zZSB1ay1jbG9zZSI+PC9hPg0KICAgICAgICA8ZGwgY2xhc3M9InVrLWRlc2NyaXB0aW9uLWxpc3QtaG9yaXpvbnRhbCI+DQogICAgICAgIDw/cGhwIGlmIChbW1tDb21wb25lbnRdXV1IZWxwZXI6OmNoZWNrU3RyaW5nKCR0aGlzLT5pdGVtLT5kYXRlb2ZiaXJ0aCkpOiA/Pg0KICAgICAgICAgICAgPGR0Pjw/cGhwIGVjaG8gSlRleHQ6Ol8oJ0JpcnRoIGRheScpOyA/PjwvZHQ+PGRkPjw/cGhwIGVjaG8gW1tbQ29tcG9uZW50XV1dSGVscGVyOjpmYW5jeURhdGUoJHRoaXMtPmVzY2FwZSgkdGhpcy0+aXRlbS0+ZGF0ZW9mYmlydGgpKTsgPz48L2RkPg0KICAgICAgICA8P3BocCBlbmRpZjsgPz4NCiAgICAgICAgPD9waHAgaWYgKFtbW0NvbXBvbmVudF1dXUhlbHBlcjo6Y2hlY2tTdHJpbmcoJHRoaXMtPml0ZW0tPmVtYWlsKSk6ID8+DQogICAgICAgICAgICA8ZHQ+PD9waHAgZWNobyBKVGV4dDo6XygnRW1haWwnKTsgPz48L2R0PjxkZD48P3BocCBlY2hvICR0aGlzLT5lc2NhcGUoJHRoaXMtPml0ZW0tPmVtYWlsKTsgPz48L2RkPg0KICAgICAgICA8P3BocCBlbmRpZjsgPz4NCiAgICAgICAgPD9waHAgaWYgKFtbW0NvbXBvbmVudF1dXUhlbHBlcjo6Y2hlY2tTdHJpbmcoJHRoaXMtPml0ZW0tPm1vYmlsZV9waG9uZSkpOiA/Pg0KICAgICAgICAgICAgPGR0Pjw/cGhwIGVjaG8gSlRleHQ6Ol8oJ01vYmlsZScpOyA/PjwvZHQ+PGRkPjw/cGhwIGVjaG8gJHRoaXMtPmVzY2FwZSgkdGhpcy0+aXRlbS0+bW9iaWxlX3Bob25lKTsgPz48L2RkPg0KICAgICAgICA8P3BocCBlbmRpZjsgPz4NCiAgICAgICAgPD9waHAgaWYgKFtbW0NvbXBvbmVudF1dXUhlbHBlcjo6Y2hlY2tTdHJpbmcoJHRoaXMtPml0ZW0tPndlYnNpdGUpKTogPz4NCiAgICAgICAgICAgIDxkdD48P3BocCBlY2hvIEpUZXh0OjpfKCdXZWJzaXRlJyk7ID8+PC9kdD48ZGQ+PD9waHAgZWNobyAkdGhpcy0+ZXNjYXBlKCR0aGlzLT5pdGVtLT53ZWJzaXRlKTsgPz48L2RkPg0KICAgICAgICA8P3BocCBlbmRpZjsgPz4NCiAgICAgICAgPC9kbD4NCiAgICA8L2Rpdj4NCjwvZGl2Pg0KPD9waHAgZW5kaWY7ID8+', 'Looking at a look', 39, '', 39, 'Looking', 'Looking', '', 'CSAvKioNCgkgKiBJbmNyZW1lbnQgdGhlIGhpdCBjb3VudGVyIGZvciB0aGUgcHJlYWNoZXIuDQoJICoNCgkgKiBAcGFyYW0gICBpbnRlZ2VyICAkcGsgIFByaW1hcnkga2V5IG9mIHRoZSBwcmVhY2hlciB0byBpbmNyZW1lbnQuDQoJICoNCgkgKiBAcmV0dXJuICBib29sZWFuICBUcnVlIGlmIHN1Y2Nlc3NmdWw7DQoJICovDQoJcHVibGljIGZ1bmN0aW9uIGhpdCgkcGsgPSAwKQ0KCXsNCgkJaWYgKCRwaykNCgkJew0KCQkJJGRiID0gSkZhY3Rvcnk6OmdldERibygpOw0KCQkJJHF1ZXJ5ID0gJGRiLT5nZXRRdWVyeSh0cnVlKTsNCg0KCQkJLy8gRmllbGRzIHRvIHVwZGF0ZS4NCgkJCSRmaWVsZHMgPSBhcnJheSgNCgkJCSAgICAkZGItPnF1b3RlTmFtZSgnaGl0cycpIC4gJyA9ICcuJGRiLT5xdW90ZU5hbWUoJ2hpdHMnKS4nICsgMScNCgkJCSk7DQoNCgkJCS8vIENvbmRpdGlvbnMgZm9yIHdoaWNoIHJlY29yZHMgc2hvdWxkIGJlIHVwZGF0ZWQuDQoJCQkkY29uZGl0aW9ucyA9IGFycmF5KA0KCQkJICAgICRkYi0+cXVvdGVOYW1lKCdpZCcpIC4gJyA9ICcgLiAkcGsNCgkJCSk7DQoNCgkJCSRxdWVyeS0+dXBkYXRlKCRkYi0+cXVvdGVOYW1lKCcjX19bW1tjb21wb25lbnRdXV1fbG9vaycpKS0+c2V0KCRmaWVsZHMpLT53aGVyZSgkY29uZGl0aW9ucyk7DQoNCgkJCSRkYi0+c2V0UXVlcnkoJHF1ZXJ5KTsNCgkJCXJldHVybiAkZGItPmV4ZWN1dGUoKTsNCgkJfQ0KCQlyZXR1cm4gZmFsc2U7DQoJfQ==', 'Ly8gYWRkIGEgaGl0IHRvIHRoZSBsb29rDQppZiAoJHRoaXMtPmhpdCgkdGhpcy0+aXRlbS0+aWQpKQ0Kew0KCSR0aGlzLT5pdGVtLT5oaXRzKys7DQp9', '', '', '', 1, '2016-10-20 15:11:29', '2016-10-20 17:10:58', 16, '', 14, '851ed44e-5431-4951-876f-4b62a4c56ad2'); - - - - +INSERT INTO `#__componentbuilder_site_view` (`id`, `add_css_document`, `add_css`, `add_js_document`, `add_php_document`, `add_php_jview`, `add_php_jview_display`, `add_php_view`, `add_php_ajax`, `add_custom_button`, `custom_button`, `button_position`, `php_controller`, `php_model`, `ajax_input`, `php_ajaxmethod`, `codename`, `css_document`, `css`, `custom_get`, `default`, `description`, `dynamic_get`, `js_document`, `main_get`, `name`, `system_name`, `php_document`, `php_jview`, `php_jview_display`, `php_view`, `snippet`, `params`, `javascript_file`, `libraries`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `guid`) VALUES +(23, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'looks', '', '', '', 'PHRhYmxlIGNsYXNzPSJ1ay10YWJsZSB1ay10YWJsZS1ob3ZlciI+DQogICAgPGNhcHRpb24+PD9waHAgZWNobyBUZXh0OjpfKCdMaXN0IG9mIGFsbCBsb29rcycpOyA/PjwvY2FwdGlvbj4NCiAgICA8dGhlYWQ+DQogICAgICAgIDx0cj4NCiAgICAgICAgICAgIDx0aD48P3BocCBlY2hvIFRleHQ6Ol8oJ05hbWUnKTsgPz48L3RoPg0KICAgICAgICAgICAgPHRoPjw/cGhwIGVjaG8gVGV4dDo6XygnRGVzY3JpcHRpb24nKTsgPz48L3RoPg0KICAgICAgICA8L3RyPg0KICAgIDwvdGhlYWQ+DQogICAgPHRib2R5Pg0KICAgICAgICA8P3BocCBmb3JlYWNoICgkdGhpcy0+aXRlbXMgYXMgJGl0ZW0pOiA/Pg0KICAgICAgICA8dHI+DQogICAgICAgICAgICA8dGQ+PGEgaHJlZj0iPD9waHAgZWNobyAgW1tbQ29tcG9uZW50XV1dSGVscGVyUm91dGU6OmdldExvb2tpbmdSb3V0ZSgkaXRlbS0+c2x1Zyk7ID8+IiA+PD9waHAgZWNobyAkaXRlbS0+bmFtZTsgPz48L2E+PC90ZD4NCiAgICAgICAgICAgIDx0ZD48P3BocCBlY2hvICR0aGlzLT5lc2NhcGUoJGl0ZW0tPmRlc2NyaXB0aW9uLCB0cnVlLCAxMjApOyA/Pjw/cGhwIGVjaG8gJGl0ZW0tPmVkaXRMaW5rOyA/PjwvdGQ+DQogICAgICAgIDwvdHI+DQogICAgICAgIDw/cGhwIGVuZGZvcmVhY2g7ID8+DQogICAgPC90Ym9keT4NCjwvdGFibGU+', 'The List of all published looks', 36, '', 36, 'Looks', 'Looks', '', '', '', '', '', '', '', '', 1, '2016-04-05 14:31:59', '2016-10-20 15:57:24', 9, '', 14, 'b2dce59e-e3b8-4467-bcb5-8f2df4bdfeb7'), +(25, '', '', '', '', 1, 1, '', '', '', '', 1, '', '', '', '', 'looking', '', '', '', 'PGFydGljbGUgY2xhc3M9InVrLWNvbW1lbnQiPg0KICAgIDxoZWFkZXIgY2xhc3M9InVrLWNvbW1lbnQtaGVhZGVyIj4NCiAgICAgICAgPGltZyBjbGFzcz0idWstY29tbWVudC1hdmF0YXIiIHNyYz0ie2ltYWdldXJsfSIgYWx0PSIiPg0KICAgICAgICA8aDQgY2xhc3M9InVrLWNvbW1lbnQtdGl0bGUiPjw/cGhwIGVjaG8gJHRoaXMtPmVzY2FwZSgkdGhpcy0+aXRlbS0+bmFtZSk7ID8+PC9oND4NCiAgICAgICAgPGRpdiBjbGFzcz0idWstY29tbWVudC1tZXRhIj48P3BocCBlY2hvIFRleHQ6Ol8oJ0hpdHMnKTsgPz46IDw/cGhwIGVjaG8gJHRoaXMtPml0ZW0tPmhpdHM7ID8+PC9kaXY+DQogICAgPC9oZWFkZXI+DQogICAgPGRpdiBjbGFzcz0idWstY29tbWVudC1ib2R5Ij4NCiAgICAgICAgPD9waHAgZWNobyAkdGhpcy0+aXRlbS0+ZGVzY3JpcHRpb247ID8+DQogICAgICAgIDw/cGhwIGlmICgkdGhpcy0+aXRlbS0+YWRkKTogPz4NCiAgICAgICAgICAgIDxiciAvPg0KICAgICAgICAgICAgPCEtLSBUaGlzIGlzIGEgYnV0dG9uIHRvZ2dsaW5nIHRoZSBtb2RhbCAtLT4NCiAgICAgICAgICAgIDxidXR0b24gY2xhc3M9InVrLWJ1dHRvbiIgZGF0YS11ay1tb2RhbD0ie3RhcmdldDonI21vcmUtZGV0YWlscy0wOTAnfSI+PD9waHAgZWNobyBUZXh0OjpfKCdNb3JlIERldGFpbHMnKTsgPz48L2J1dHRvbj4NCiAgICAgICAgPD9waHAgZW5kaWY7ID8+DQogICAgPC9kaXY+DQo8L2FydGljbGU+DQo8P3BocCBpZiAoJHRoaXMtPml0ZW0tPmFkZCk6ID8+DQo8IS0tIFRoaXMgaXMgdGhlIG1vZGFsIC0tPg0KPGRpdiBpZD0ibW9yZS1kZXRhaWxzLTA5MCIgY2xhc3M9InVrLW1vZGFsIj4NCiAgICA8ZGl2IGNsYXNzPSJ1ay1tb2RhbC1kaWFsb2ciPg0KICAgICAgICA8YSBjbGFzcz0idWstbW9kYWwtY2xvc2UgdWstY2xvc2UiPjwvYT4NCiAgICAgICAgPGRsIGNsYXNzPSJ1ay1kZXNjcmlwdGlvbi1saXN0LWhvcml6b250YWwiPg0KICAgICAgICA8P3BocCBpZiAoU3VwZXJfX18xZjI4Y2I1M182MGQ5XzRkYjFfYjUxN18zYzdkYzZiNDI5ZWZfX19Qb3dlcjo6Y2hlY2soJHRoaXMtPml0ZW0tPmRhdGVvZmJpcnRoKSk6ID8+DQogICAgICAgICAgICA8ZHQ+PD9waHAgZWNobyBUZXh0OjpfKCdCaXJ0aCBkYXknKTsgPz48L2R0PjxkZD48P3BocCBlY2hvIFtbW0NvbXBvbmVudF1dXUhlbHBlcjo6ZmFuY3lEYXRlKCR0aGlzLT5lc2NhcGUoJHRoaXMtPml0ZW0tPmRhdGVvZmJpcnRoKSk7ID8+PC9kZD4NCiAgICAgICAgPD9waHAgZW5kaWY7ID8+DQogICAgICAgIDw/cGhwIGlmIChTdXBlcl9fXzFmMjhjYjUzXzYwZDlfNGRiMV9iNTE3XzNjN2RjNmI0MjllZl9fX1Bvd2VyOjpjaGVjaygkdGhpcy0+aXRlbS0+ZW1haWwpKTogPz4NCiAgICAgICAgICAgIDxkdD48P3BocCBlY2hvIFRleHQ6Ol8oJ0VtYWlsJyk7ID8+PC9kdD48ZGQ+PD9waHAgZWNobyAkdGhpcy0+ZXNjYXBlKCR0aGlzLT5pdGVtLT5lbWFpbCk7ID8+PC9kZD4NCiAgICAgICAgPD9waHAgZW5kaWY7ID8+DQogICAgICAgIDw/cGhwIGlmIChTdXBlcl9fXzFmMjhjYjUzXzYwZDlfNGRiMV9iNTE3XzNjN2RjNmI0MjllZl9fX1Bvd2VyOjpjaGVjaygkdGhpcy0+aXRlbS0+bW9iaWxlX3Bob25lKSk6ID8+DQogICAgICAgICAgICA8ZHQ+PD9waHAgZWNobyBUZXh0OjpfKCdNb2JpbGUnKTsgPz48L2R0PjxkZD48P3BocCBlY2hvICR0aGlzLT5lc2NhcGUoJHRoaXMtPml0ZW0tPm1vYmlsZV9waG9uZSk7ID8+PC9kZD4NCiAgICAgICAgPD9waHAgZW5kaWY7ID8+DQogICAgICAgIDw/cGhwIGlmIChTdXBlcl9fXzFmMjhjYjUzXzYwZDlfNGRiMV9iNTE3XzNjN2RjNmI0MjllZl9fX1Bvd2VyOjpjaGVjaygkdGhpcy0+aXRlbS0+d2Vic2l0ZSkpOiA/Pg0KICAgICAgICAgICAgPGR0Pjw/cGhwIGVjaG8gVGV4dDo6XygnV2Vic2l0ZScpOyA/PjwvZHQ+PGRkPjw/cGhwIGVjaG8gJHRoaXMtPmVzY2FwZSgkdGhpcy0+aXRlbS0+d2Vic2l0ZSk7ID8+PC9kZD4NCiAgICAgICAgPD9waHAgZW5kaWY7ID8+DQogICAgICAgIDwvZGw+DQogICAgPC9kaXY+DQo8L2Rpdj4NCjw/cGhwIGVuZGlmOyA/Pg==', 'Looking at a look', 39, '', 39, 'Looking', 'Looking', '', 'CSAvKioNCgkgKiBJbmNyZW1lbnQgdGhlIGhpdCBjb3VudGVyIGZvciB0aGUgcHJlYWNoZXIuDQoJICoNCgkgKiBAcGFyYW0gICBpbnRlZ2VyICAkcGsgIFByaW1hcnkga2V5IG9mIHRoZSBwcmVhY2hlciB0byBpbmNyZW1lbnQuDQoJICoNCgkgKiBAcmV0dXJuICBib29sZWFuICBUcnVlIGlmIHN1Y2Nlc3NmdWw7DQoJICovDQoJcHVibGljIGZ1bmN0aW9uIGhpdCgkcGsgPSAwKQ0KCXsNCgkJaWYgKCRwaykNCgkJew0KCQkJJGRiID0gRmFjdG9yeTo6Z2V0RGJvKCk7DQoJCQkkcXVlcnkgPSAkZGItPmdldFF1ZXJ5KHRydWUpOw0KDQoJCQkvLyBGaWVsZHMgdG8gdXBkYXRlLg0KCQkJJGZpZWxkcyA9IGFycmF5KA0KCQkJICAgICRkYi0+cXVvdGVOYW1lKCdoaXRzJykgLiAnID0gJy4kZGItPnF1b3RlTmFtZSgnaGl0cycpLicgKyAxJw0KCQkJKTsNCg0KCQkJLy8gQ29uZGl0aW9ucyBmb3Igd2hpY2ggcmVjb3JkcyBzaG91bGQgYmUgdXBkYXRlZC4NCgkJCSRjb25kaXRpb25zID0gYXJyYXkoDQoJCQkgICAgJGRiLT5xdW90ZU5hbWUoJ2lkJykgLiAnID0gJyAuICRwaw0KCQkJKTsNCg0KCQkJJHF1ZXJ5LT51cGRhdGUoJGRiLT5xdW90ZU5hbWUoJyNfX1tbW2NvbXBvbmVudF1dXV9sb29rJykpLT5zZXQoJGZpZWxkcyktPndoZXJlKCRjb25kaXRpb25zKTsNCg0KCQkJJGRiLT5zZXRRdWVyeSgkcXVlcnkpOw0KCQkJcmV0dXJuICRkYi0+ZXhlY3V0ZSgpOw0KCQl9DQoJCXJldHVybiBmYWxzZTsNCgl9', 'Ly8gYWRkIGEgaGl0IHRvIHRoZSBsb29rDQppZiAoJHRoaXMtPmhpdCgkdGhpcy0+aXRlbS0+aWQpKQ0Kew0KCSR0aGlzLT5pdGVtLT5oaXRzKys7DQp9', '', '', '', '', '', 1, '2016-10-20 15:11:29', '2016-10-20 17:10:58', 16, '', 14, '851ed44e-5431-4951-876f-4b62a4c56ad2'); -- -- Dumping data for table `#__componentbuilder_dynamic_get` -- -INSERT INTO `#__componentbuilder_dynamic_get` (`id`, `add_php_after_getitem`, `add_php_before_getitem`, `add_php_after_getitems`, `add_php_before_getitems`, `add_php_getlistquery`, `php_after_getitem`, `php_before_getitem`, `php_before_getitems`, `php_getlistquery`, `php_after_getitems`, `pagination`, `addcalculation`, `db_selection`, `db_table_main`, `filter`, `getcustom`, `gettype`, `global`, `join_db_table`, `join_view_table`, `main_source`, `name`, `order`, `php_calculation`, `php_custom_get`, `view_selection`, `view_table_main`, `where`, `params`, `published`, `version`, `hits`, `ordering`, `guid`) VALUES -(36, '', '', 1, '', '', '', '', '', '', 'CQkvLyBkbyBhIHF1aWNrIGJ1aWxkIG9mIGFsbCBlZGl0IGxpbmtzIGxpbmtzDQoJCWlmIChpc3NldCgkaXRlbXMpICYmICRpdGVtcykNCgkJew0KCQkJZm9yZWFjaCAoJGl0ZW1zIGFzICRuciA9PiAmJGl0ZW0pDQoJCQl7DQoJCQkJJGNhbkRvID0gW1tbQ29tcG9uZW50XV1dSGVscGVyOjpnZXRBY3Rpb25zKCdsb29rJywkaXRlbSwnbG9va3MnKTsNCgkJCQlpZiAoJGNhbkRvLT5nZXQoJ2xvb2suZWRpdCcpKQ0KCQkJCXsNCgkJCQkJJGl0ZW0tPmVkaXRMaW5rID0gJzxiciAvPjxiciAvPjxhIGNsYXNzPSJ1ay1idXR0b24gdWstYnV0dG9uLXByaW1hcnkgdWstd2lkdGgtMS0xIiBocmVmPSInOw0KCQkJCQkkaXRlbS0+ZWRpdExpbmsgLj0gSlJvdXRlOjpfKCdpbmRleC5waHA/b3B0aW9uPWNvbV9bW1tjb21wb25lbnRdXV0mdmlldz1sb29rJnRhc2s9bG9vay5lZGl0JmlkPScgLiAkaXRlbS0+aWQpOw0KCQkJCQkkaXRlbS0+ZWRpdExpbmsgLj0gJyI+PGkgY2xhc3M9InVrLWljb24tcGVuY2lsIj48L2k+PHNwYW4gY2xhc3M9InVrLWhpZGRlbi1zbWFsbCI+JzsNCgkJCQkJJGl0ZW0tPmVkaXRMaW5rIC49IEpUZXh0OjpfKCdFZGl0IExvb2snKTsNCgkJCQkJJGl0ZW0tPmVkaXRMaW5rIC49ICc8L3NwYW4+PC9hPic7DQoJCQkJfQ0KCQkJCWVsc2UNCgkJCQl7DQoJCQkJCSRpdGVtLT5lZGl0TGluayA9ICcnOw0KCQkJCX0NCgkJCX0NCgkJfQ==', 1, '', '', '', '', '', 2, '', '', '', 1, 'Looks', '{\"order0\":{\"table_key\":\"a.name\",\"direction\":\"ASC\"}}', '', '', 'a.*', 109, '{\"where0\":{\"table_key\":\"a.published\",\"operator\":\"1\",\"value_key\":\"1\"}}', '', 1, 12, '', 13, '32b3ae7d-8aa8-47f1-ab2e-30076ddaa029'), -(39, '', '', '', '', '', '', '', '', '', '', 1, '', '', '', '{\"filter0\":{\"filter_type\":\"1\",\"state_key\":\"id\",\"operator\":\"1\",\"table_key\":\"a.id\"}}', '', 1, '', '', '', 1, 'Looking', '', '', '', 'a.id AS id\r\na.name AS name\r\na.alias AS alias\r\na.description AS description\r\na.add AS add\r\na.email AS email\r\na.mobile_phone AS mobile_phone\r\na.dateofbirth AS dateofbirth\r\na.image AS image\r\na.website AS website\r\na.published AS published\r\na.hits AS hits\r\na.created_by AS created_by', 109, '', '', 1, 8, '', '', '98e6ea56-0911-4d89-b1f4-8f0bb1e4aa5a'); - - +INSERT INTO `#__componentbuilder_dynamic_get` (`id`, `add_php_after_getitem`, `add_php_before_getitem`, `add_php_after_getitems`, `add_php_before_getitems`, `add_php_getlistquery`, `php_after_getitem`, `php_before_getitem`, `php_before_getitems`, `php_getlistquery`, `php_after_getitems`, `pagination`, `addcalculation`, `db_selection`, `db_table_main`, `filter`, `getcustom`, `gettype`, `global`, `join_db_table`, `join_view_table`, `main_source`, `name`, `order`, `php_calculation`, `php_custom_get`, `view_selection`, `view_table_main`, `where`, `php_router_parse`, `group`, `params`, `published`, `version`, `hits`, `ordering`, `guid`) VALUES +(36, '', '', 1, '', '', '', '', '', '', 'CQkvLyBkbyBhIHF1aWNrIGJ1aWxkIG9mIGFsbCBlZGl0IGxpbmtzIGxpbmtzDQoJCWlmIChpc3NldCgkaXRlbXMpICYmICRpdGVtcykNCgkJew0KCQkJZm9yZWFjaCAoJGl0ZW1zIGFzICRuciA9PiAmJGl0ZW0pDQoJCQl7DQoJCQkJJGNhbkRvID0gW1tbQ29tcG9uZW50XV1dSGVscGVyOjpnZXRBY3Rpb25zKCdsb29rJywkaXRlbSwnbG9va3MnKTsNCgkJCQlpZiAoJGNhbkRvLT5nZXQoJ2xvb2suZWRpdCcpKQ0KCQkJCXsNCgkJCQkJJGl0ZW0tPmVkaXRMaW5rID0gJzxiciAvPjxiciAvPjxhIGNsYXNzPSJ1ay1idXR0b24gdWstYnV0dG9uLXByaW1hcnkgdWstd2lkdGgtMS0xIiBocmVmPSInOw0KCQkJCQkkaXRlbS0+ZWRpdExpbmsgLj0gXEpSb3V0ZTo6XygnaW5kZXgucGhwP29wdGlvbj1jb21fW1tbY29tcG9uZW50XV1dJnZpZXc9bG9vayZ0YXNrPWxvb2suZWRpdCZpZD0nIC4gJGl0ZW0tPmlkKTsNCgkJCQkJJGl0ZW0tPmVkaXRMaW5rIC49ICciPjxpIGNsYXNzPSJ1ay1pY29uLXBlbmNpbCI+PC9pPjxzcGFuIGNsYXNzPSJ1ay1oaWRkZW4tc21hbGwiPic7DQoJCQkJCSRpdGVtLT5lZGl0TGluayAuPSBUZXh0OjpfKCdFZGl0IExvb2snKTsNCgkJCQkJJGl0ZW0tPmVkaXRMaW5rIC49ICc8L3NwYW4+PC9hPic7DQoJCQkJfQ0KCQkJCWVsc2UNCgkJCQl7DQoJCQkJCSRpdGVtLT5lZGl0TGluayA9ICcnOw0KCQkJCX0NCgkJCX0NCgkJfQ==', 1, '', '', '', '', '', 2, '', '', '', 1, 'Looks', '{\"order0\":{\"table_key\":\"a.name\",\"direction\":\"ASC\"}}', '', '', 'a.*', 109, '{\"where0\":{\"table_key\":\"a.published\",\"operator\":\"1\",\"value_key\":\"1\"}}', '', '', '', 1, 12, '', 13, '32b3ae7d-8aa8-47f1-ab2e-30076ddaa029'), +(39, '', '', '', '', '', '', '', '', '', '', 1, '', '', '', '{\"filter0\":{\"filter_type\":\"1\",\"state_key\":\"id\",\"operator\":\"1\",\"table_key\":\"a.id\"}}', '', 1, '', '', '', 1, 'Looking', '', '', '', 'a.id AS id\r\na.name AS name\r\na.alias AS alias\r\na.description AS description\r\na.add AS add\r\na.email AS email\r\na.mobile_phone AS mobile_phone\r\na.dateofbirth AS dateofbirth\r\na.image AS image\r\na.website AS website\r\na.published AS published\r\na.hits AS hits\r\na.created_by AS created_by', 109, '', '', '', '', 1, 8, '', '', '98e6ea56-0911-4d89-b1f4-8f0bb1e4aa5a'); -- -- Dumping data for table `#__componentbuilder_library` -- -INSERT INTO `#__componentbuilder_library` (`id`, `addconditions`, `description`, `type`, `how`, `name`, `php_setdocument`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `guid`) VALUES -(1, '', '', 1, '', 'No Library', '', 1, '2017-11-11 22:08:33', '2017-12-08 15:51:34', 4, '', 1, 'bc8e675d-7536-4a68-b186-fb4b988fa3e2'), -(2, '', '', 1, 1, 'Bootstrap v4', '', 1, '2017-11-12 02:08:39', '2017-12-17 09:04:10', 18, '', 2, '6f6650a5-ebff-4783-8508-f0285c0e98a6'), -(3, '{}', '', 1, 1, 'Uikit v3', '', 1, '2017-11-11 22:08:45', '2021-05-27 00:18:36', 20, '', 3, '5eeee148-cebd-4a92-bc0e-56efea3cffdc'), -(4, '', '', 1, 4, 'Uikit v2', '', 1, '2017-11-11 22:08:51', '2018-06-29 02:36:17', 6, '', 4, '367fbf66-890e-42a7-a82d-f780d2f86786'), -(5, '', '', 1, 4, 'FooTable v2', '', 1, '2017-11-11 22:08:57', '2017-12-11 20:07:32', 9, '', 5, 'a90edd5a-8521-4fb1-b6b3-9a21e9f56642'), -(6, '', '', 1, 4, 'FooTable v3', '', 1, '2017-11-25 22:11:03', '2017-12-10 15:54:45', 12, '', 6, '86829029-dc8a-424e-b046-b189a92565d9'); +INSERT INTO `#__componentbuilder_library` (`id`, `addconditions`, `description`, `type`, `how`, `name`, `php_setdocument`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `libraries`, `params`, `guid`) VALUES +(1, '', '', 1, '', 'No Library', '', 1, '2017-11-11 22:08:33', '2017-12-08 15:51:34', 4, '', 1, '', '', 'bc8e675d-7536-4a68-b186-fb4b988fa3e2'), +(2, '', '', 1, 1, 'Bootstrap v4', '', 1, '2017-11-12 02:08:39', '2017-12-17 09:04:10', 18, '', 2, '', '', '6f6650a5-ebff-4783-8508-f0285c0e98a6'), +(3, '{}', '', 1, 1, 'Uikit v3', '', 1, '2017-11-11 22:08:45', '2021-05-27 00:18:36', 20, '', 3, '', '', '5eeee148-cebd-4a92-bc0e-56efea3cffdc'), +(4, '', '', 1, 4, 'Uikit v2', '', 1, '2017-11-11 22:08:51', '2018-06-29 02:36:17', 6, '', 4, '', '', '367fbf66-890e-42a7-a82d-f780d2f86786'), +(5, '', '', 1, 4, 'FooTable v2', '', 1, '2017-11-11 22:08:57', '2017-12-11 20:07:32', 9, '', 5, '', '', 'a90edd5a-8521-4fb1-b6b3-9a21e9f56642'), +(6, '', '', 1, 4, 'FooTable v3', '', 1, '2017-11-25 22:11:03', '2017-12-10 15:54:45', 12, '', 6, '', '', '86829029-dc8a-424e-b046-b189a92565d9'); -- -- Dumping data for table `#__componentbuilder_snippet` @@ -2130,9 +2185,9 @@ INSERT INTO `#__componentbuilder_snippet` (`id`, `contributor_company`, `contrib (86, 'Vast Development Method', 'Joomla@vdm.io', 'Llewellyn van der Merwe', 'https://www.vdm.io/', 'You can link multiple images to the same lightbox and switch between them from within the lightbox, thus creating a gallery. Just add the {group:\'my-group\'} option to the data attribute of each item using the same name on all items that you want to group. Make sure to include the CSS from the Slidenav component, so you can navigate between the items.', 'Create a fancy lightbox for images and videos utilizing the Modal component.', 4, 'Lightbox groups-image', 'PGRpdiBkYXRhLXVrLWdyaWQtbWFyZ2luPSIiIGNsYXNzPSJ1ay1ncmlkIHVrLWdyaWQtd2lkdGgtbWVkaXVtLTEtNCI+DQogICAgPGRpdj4NCiAgICAgICAgPGEgdGl0bGU9IlRpdGxlIiBkYXRhLXVrLWxpZ2h0Ym94PSJ7Z3JvdXA6J2dyb3VwMSd9IiBocmVmPSJpbWFnZXMvcGxhY2Vob2xkZXJfODAweDYwMF8xLmpwZyI+DQogICAgICAgICAgICA8aW1nIHdpZHRoPSI4MDAiIGhlaWdodD0iNjAwIiBhbHQ9IiIgc3JjPSJpbWFnZXMvcGxhY2Vob2xkZXJfODAweDYwMF8xLmpwZyI+DQogICAgICAgIDwvYT4NCiAgICA8L2Rpdj4NCiAgICA8ZGl2Pg0KICAgICAgICA8YSB0aXRsZT0iVGl0bGUiIGRhdGEtdWstbGlnaHRib3g9Intncm91cDonZ3JvdXAxJ30iIGRhdGEtbGlnaHRib3gtdHlwZT0iaW1hZ2UiIGhyZWY9ImltYWdlcy9wbGFjZWhvbGRlcl84MDB4NjAwXzIuanBnIj4NCiAgICAgICAgICAgIDxpbWcgd2lkdGg9IjgwMCIgaGVpZ2h0PSI2MDAiIGFsdD0iIiBzcmM9ImltYWdlcy9wbGFjZWhvbGRlcl84MDB4NjAwXzIuanBnIj4NCiAgICAgICAgPC9hPg0KICAgIDwvZGl2Pg0KICAgIDxkaXY+DQogICAgICAgIDxhIHRpdGxlPSJUaXRsZSIgZGF0YS11ay1saWdodGJveD0ie2dyb3VwOidncm91cDEnfSIgZGF0YS1saWdodGJveC10eXBlPSJpbWFnZSIgaHJlZj0iaW1hZ2VzL3BsYWNlaG9sZGVyXzgwMHg2MDBfMy5qcGciPg0KICAgICAgICAgICAgPGltZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjYwMCIgYWx0PSIiIHNyYz0iaW1hZ2VzL3BsYWNlaG9sZGVyXzgwMHg2MDBfMy5qcGciPg0KICAgICAgICA8L2E+DQogICAgPC9kaXY+DQogICAgPGRpdj4NCiAgICAgICAgPGEgdGl0bGU9IlRpdGxlIiBkYXRhLXVrLWxpZ2h0Ym94PSJ7Z3JvdXA6J2dyb3VwMSd9IiBkYXRhLWxpZ2h0Ym94LXR5cGU9ImltYWdlIiBocmVmPSJpbWFnZXMvcGxhY2Vob2xkZXJfODAweDYwMF80LmpwZyI+DQogICAgICAgICAgICA8aW1nIHdpZHRoPSI4MDAiIGhlaWdodD0iNjAwIiBhbHQ9IiIgc3JjPSJpbWFnZXMvcGxhY2Vob2xkZXJfODAweDYwMF80LmpwZyI+DQogICAgICAgIDwvYT4NCiAgICA8L2Rpdj4NCjwvZGl2Pg==', 5, 'http://getuikit.com/docs/lightbox.html', 'To apply this component, add the data-uk-lightbox attribute to an anchor linking to the image you wish to display. If a title attribute exists it will be displayed as a caption for the lightbox.', '', 1, '2015-06-01 20:21:01', '2017-11-11 22:09:27', 20, '', 9, '9fb9dbd8-23b1-4a85-a144-c4ad95f105d1'), (87, 'Vast Development Method', 'Joomla@vdm.io', 'Llewellyn van der Merwe', 'https://www.vdm.io/', 'A lightbox is not restricted to images. Other media, like videos, can be displayed inside a lightbox and it will automatically generate the correct output by evaluating your path.', 'Create a fancy lightbox for images and videos utilizing the Modal component.', 4, 'Lightbox content-sources', 'PHA+DQogICAgPGEgdGl0bGU9IlRpdGxlIiBkYXRhLXVrLWxpZ2h0Ym94PSJ7Z3JvdXA6J2dyb3VwMid9IiBocmVmPSJpbWFnZXMvcGxhY2Vob2xkZXJfODAweDYwMF8xLmpwZyIgY2xhc3M9InVrLWJ1dHRvbiI+SW1hZ2U8L2E+DQogICAgPGEgZGF0YS11ay1saWdodGJveD0ie2dyb3VwOidncm91cDInfSIgaHJlZj0iaHR0cDovL3d3dy5xdWlya3Ntb2RlLm9yZy9odG1sNS92aWRlb3MvYmlnX2J1Y2tfYnVubnkubXA0IiBjbGFzcz0idWstYnV0dG9uIj5NUDQ8L2E+DQogICAgPGEgZGF0YS11ay1saWdodGJveD0ie2dyb3VwOidncm91cDInfSIgaHJlZj0iaHR0cDovL3ZpbWVvLmNvbS8xMDg0NTM3IiBjbGFzcz0idWstYnV0dG9uIj5WaW1lbzwvYT4NCiAgICA8YSBkYXRhLXVrLWxpZ2h0Ym94PSJ7Z3JvdXA6J2dyb3VwMid9IiBocmVmPSJodHRwczovL3d3dy55b3V0dWJlLmNvbS93YXRjaD92PVlFN1Z6bEx0cC00IiBjbGFzcz0idWstYnV0dG9uIj5Zb3VUdWJlPC9hPg0KPC9wPg==', 5, 'http://getuikit.com/docs/lightbox.html', 'To apply this component, add the data-uk-lightbox attribute to an anchor linking to the image you wish to display. If a title attribute exists it will be displayed as a caption for the lightbox.', '', 1, '2015-06-01 20:22:21', '2017-11-11 22:09:27', 19, '', 9, '4e0dcf96-2140-49e9-bbed-8f84b36f4f3c'), (88, 'Vast Development Method', 'Joomla@vdm.io', 'Llewellyn van der Merwe', 'https://www.vdm.io/', 'To display multiple content sections at the same time without one collapsing when the other one is opened, add the {collapse: false} option to the date attribute.', 'Create a list of items, allowing each item\'s content to be expanded and collapsed by clicking its header.', 4, 'Accordion', 'PGRpdiBjbGFzcz0idWstYWNjb3JkaW9uIiBkYXRhLXVrLWFjY29yZGlvbj4NCg0KICAgIDxoMyBjbGFzcz0idWstYWNjb3JkaW9uLXRpdGxlIj4uLi48L2gzPg0KICAgIDxkaXYgY2xhc3M9InVrLWFjY29yZGlvbi1jb250ZW50Ij4uLi48L2Rpdj4NCg0KICAgIDxoMyBjbGFzcz0idWstYWNjb3JkaW9uLXRpdGxlIj4uLi48L2gzPg0KICAgIDxkaXYgY2xhc3M9InVrLWFjY29yZGlvbi1jb250ZW50Ij4uLi48L2Rpdj4NCg0KICAgIDxoMyBjbGFzcz0idWstYWNjb3JkaW9uLXRpdGxlIj4uLi48L2gzPg0KICAgIDxkaXYgY2xhc3M9InVrLWFjY29yZGlvbi1jb250ZW50Ij4uLi48L2Rpdj4NCg0KPC9kaXY+', 5, 'http://getuikit.com/docs/accordion.html', 'To apply the Accordion component, add the uk-accordion class and the data-uk-accordion attribute to a container element. Add the uk-accordion-content class to each of the content sections within the container. Finally, add the uk-accordion-title class to any element, like a heading, above the content section to create a toggle.', '', 1, '2015-06-01 20:24:59', '2017-11-11 22:09:27', 20, '', 10, 'f5bd905c-8d79-4eb6-bb61-e139af27f573'), -(90, 'Vast Development Method', 'Joomla@vdm.io', 'Llewellyn van der Merwe', 'https://www.vdm.io/', 'This is a input field for uikit form', 'Add Input field - row', 4, 'Input field', 'ICAgICAgICA8ZGl2IGNsYXNzPSJ1ay1mb3JtLXJvdyI+DQoJCTxsYWJlbCBjbGFzcz0idWstZm9ybS1sYWJlbCIgPg0KCQkJPD9waHAgZWNobyBKVGV4dDo6XygnTGFiZWwnKTsgPz4NCgkJPC9sYWJlbD4NCgkJPGlucHV0IHR5cGU9InRleHQiIG5hbWU9ImtleSIgcGxhY2Vob2xkZXI9Ijw/cGhwIGVjaG8gSlRleHQ6Ol8oJ2FkZCBzb21lIHRleHQgaGVyZSEnKTsgPz4iPiA8c3BhbiBjbGFzcz0idWstZm9ybS1oZWxwLWlubGluZSI+PD9waHAgZWNobyBKVGV4dDo6XygnaGVscCBuZWVkZWQnKTsgPz48L3NwYW4+DQoJPC9kaXY+', 3, 'http://getuikit.com/docs/form.html', '', '', 1, '2015-11-29 03:54:40', '2017-11-11 22:09:27', 20, '', 12, 'f1319e45-395a-492e-a899-f2fec00de5ec'), +(90, 'Vast Development Method', 'Joomla@vdm.io', 'Llewellyn van der Merwe', 'https://www.vdm.io/', 'This is a input field for uikit form', 'Add Input field - row', 4, 'Input field', 'ICAgICAgICA8ZGl2IGNsYXNzPSJ1ay1mb3JtLXJvdyI+DQoJCTxsYWJlbCBjbGFzcz0idWstZm9ybS1sYWJlbCIgPg0KCQkJPD9waHAgZWNobyBUZXh0OjpfKCdMYWJlbCcpOyA/Pg0KCQk8L2xhYmVsPg0KCQk8aW5wdXQgdHlwZT0idGV4dCIgbmFtZT0ia2V5IiBwbGFjZWhvbGRlcj0iPD9waHAgZWNobyBUZXh0OjpfKCdhZGQgc29tZSB0ZXh0IGhlcmUhJyk7ID8+Ij4gPHNwYW4gY2xhc3M9InVrLWZvcm0taGVscC1pbmxpbmUiPjw/cGhwIGVjaG8gVGV4dDo6XygnaGVscCBuZWVkZWQnKTsgPz48L3NwYW4+DQoJPC9kaXY+', 3, 'http://getuikit.com/docs/form.html', '', '', 1, '2015-11-29 03:54:40', '2017-11-11 22:09:27', 20, '', 12, 'f1319e45-395a-492e-a899-f2fec00de5ec'), (91, 'Vast Development Method', 'Joomla@vdm.io', 'Llewellyn van der Merwe', 'https://www.vdm.io/', 'This is a textarea field for uikit form', 'Add textarea - row', 4, 'Textarea', 'CTxkaXYgY2xhc3M9InVrLWZvcm0tcm93Ij4NCgkJPGxhYmVsIGNsYXNzPSJ1ay1mb3JtLWxhYmVsIiA+DQoJCQk8P3BocCBlY2hvIEpUZXh0OjpfKCdMYWJlbCcpOyA/Pg0KCQk8L2xhYmVsPg0KCQk8dGV4dGFyZWEgY29scz0iIiByb3dzPSIiICBzdHlsZT0id2lkdGg6IDEwMCU7IGhlaWdodDogMjE2cHg7IiBwbGFjZWhvbGRlcj0iPD9waHAgZWNobyBKVGV4dDo6XygnYWRkIHNvbWUgdGV4dCBoZXJlIScpOyA/PiI+PHx8fHxGSVh8fHx8fHx0ZXh0YXJlYT4NCgkJPHAgY2xhc3M9InVrLWZvcm0taGVscC1ibG9jayI+PD9waHAgZWNobyBKVGV4dDo6XygnaGVscCBuZWVkZWQnKTsgPz48L3A+DQoJPC9kaXY+', 3, 'http://getuikit.com/docs/form.html', '', '', 1, '2015-11-29 03:55:57', '2017-11-11 22:09:27', 22, '', 12, '22207e7c-6096-4b6e-8e03-0616745c8447'), -(92, 'Vast Development Method', 'Joomla@vdm.io', 'Llewellyn van der Merwe', 'https://www.vdm.io/', 'This is a uikit form', 'Add Form', 4, 'Form', 'PGZvcm0gY2xhc3M9InVrLWZvcm0iPg0KICAgIDxmaWVsZHNldD4NCiAgICAgICAgPGxlZ2VuZD48P3BocCBlY2hvIEpUZXh0OjpfKCdMZWdlbmQnKTsgPz48L2xlZ2VuZD4NCiAgICAgICAgPGRpdiBjbGFzcz0idWstZm9ybS1yb3ciPg0KCQk8bGFiZWwgY2xhc3M9InVrLWZvcm0tbGFiZWwiID4NCgkJCTw/cGhwIGVjaG8gSlRleHQ6Ol8oJ0xhYmVsJyk7ID8+DQoJCTwvbGFiZWw+DQoJCTxpbnB1dCB0eXBlPSJ0ZXh0IiBuYW1lPSJrZXkiIHBsYWNlaG9sZGVyPSI8P3BocCBlY2hvIEpUZXh0OjpfKCdhZGQgc29tZSB0ZXh0IGhlcmUhJyk7ID8+Ij4gPHNwYW4gY2xhc3M9InVrLWZvcm0taGVscC1pbmxpbmUiPjw/cGhwIGVjaG8gSlRleHQ6Ol8oJ2hlbHAgbmVlZGVkJyk7ID8+PC9zcGFuPg0KCTwvZGl2Pg0KICAgICAgICA8ZGl2IGNsYXNzPSJ1ay1mb3JtLXJvdyI+DQoJCTxsYWJlbCBjbGFzcz0idWstZm9ybS1sYWJlbCIgPg0KCQkJPD9waHAgZWNobyBKVGV4dDo6XygnTGFiZWwnKTsgPz4NCgkJPC9sYWJlbD4NCgkJPHRleHRhcmVhIGNvbHM9IiIgcm93cz0iIiAgc3R5bGU9IndpZHRoOiAxMDAlOyBoZWlnaHQ6IDIxNnB4OyIgcGxhY2Vob2xkZXI9Ijw/cGhwIGVjaG8gSlRleHQ6Ol8oJ2FkZCBzb21lIHRleHQgaGVyZSEnKTsgPz4iPjx8fHx8fEZJWHx8fHx8dGV4dGFyZWE+DQoJCTxwIGNsYXNzPSJ1ay1mb3JtLWhlbHAtYmxvY2siPjw/cGhwIGVjaG8gSlRleHQ6Ol8oJ2hlbHAgbmVlZGVkJyk7ID8+PC9wPg0KCTwvZGl2Pg0KICAgIDwvZmllbGRzZXQ+DQo8L2Zvcm0+', 1, 'http://getuikit.com/docs/form.html', 'To apply this component, add the .uk-form class to a form element. All form control elements are placed side by side within the next row.', '', 1, '2015-11-29 03:57:03', '2017-11-20 23:42:28', 21, '', 12, '6d6bebcf-e291-4344-a39e-f072fa22bf71'), +(92, 'Vast Development Method', 'Joomla@vdm.io', 'Llewellyn van der Merwe', 'https://www.vdm.io/', 'This is a uikit form', 'Add Form', 4, 'Form', 'PGZvcm0gY2xhc3M9InVrLWZvcm0iPg0KICAgIDxmaWVsZHNldD4NCiAgICAgICAgPGxlZ2VuZD48P3BocCBlY2hvIFRleHQ6Ol8oJ0xlZ2VuZCcpOyA/PjwvbGVnZW5kPg0KICAgICAgICA8ZGl2IGNsYXNzPSJ1ay1mb3JtLXJvdyI+DQoJCTxsYWJlbCBjbGFzcz0idWstZm9ybS1sYWJlbCIgPg0KCQkJPD9waHAgZWNobyBUZXh0OjpfKCdMYWJlbCcpOyA/Pg0KCQk8L2xhYmVsPg0KCQk8aW5wdXQgdHlwZT0idGV4dCIgbmFtZT0ia2V5IiBwbGFjZWhvbGRlcj0iPD9waHAgZWNobyBUZXh0OjpfKCdhZGQgc29tZSB0ZXh0IGhlcmUhJyk7ID8+Ij4gPHNwYW4gY2xhc3M9InVrLWZvcm0taGVscC1pbmxpbmUiPjw/cGhwIGVjaG8gVGV4dDo6XygnaGVscCBuZWVkZWQnKTsgPz48L3NwYW4+DQoJPC9kaXY+DQogICAgICAgIDxkaXYgY2xhc3M9InVrLWZvcm0tcm93Ij4NCgkJPGxhYmVsIGNsYXNzPSJ1ay1mb3JtLWxhYmVsIiA+DQoJCQk8P3BocCBlY2hvIFRleHQ6Ol8oJ0xhYmVsJyk7ID8+DQoJCTwvbGFiZWw+DQoJCTx0ZXh0YXJlYSBjb2xzPSIiIHJvd3M9IiIgIHN0eWxlPSJ3aWR0aDogMTAwJTsgaGVpZ2h0OiAyMTZweDsiIHBsYWNlaG9sZGVyPSI8P3BocCBlY2hvIFRleHQ6Ol8oJ2FkZCBzb21lIHRleHQgaGVyZSEnKTsgPz4iPjx8fHx8fEZJWHx8fHx8dGV4dGFyZWE+DQoJCTxwIGNsYXNzPSJ1ay1mb3JtLWhlbHAtYmxvY2siPjw/cGhwIGVjaG8gVGV4dDo6XygnaGVscCBuZWVkZWQnKTsgPz48L3A+DQoJPC9kaXY+DQogICAgPC9maWVsZHNldD4NCjwvZm9ybT4=', 1, 'http://getuikit.com/docs/form.html', 'To apply this component, add the .uk-form class to a form element. All form control elements are placed side by side within the next row.', '', 1, '2015-11-29 03:57:03', '2017-11-20 23:42:28', 21, '', 12, '6d6bebcf-e291-4344-a39e-f072fa22bf71'), (95, 'Vast Development Method', 'joomla@vdm.io', 'Llewellyn van der Merwe', 'https://www.vdm.io/', '', 'Create a list of items that can be shown individually by clicking an item\'s header.', 3, 'Accordion', 'PHVsIHVrLWFjY29yZGlvbj4NCiAgICA8bGkgY2xhc3M9InVrLW9wZW4iPg0KICAgICAgICA8aDMgY2xhc3M9InVrLWFjY29yZGlvbi10aXRsZSI+SXRlbSAxPC9oMz4NCiAgICAgICAgPGRpdiBjbGFzcz0idWstYWNjb3JkaW9uLWNvbnRlbnQiPg0KICAgICAgICAgICAgPHA+TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdCwgc2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2lkaWR1bnQgdXQgbGFib3JlIGV0IGRvbG9yZSBtYWduYSBhbGlxdWEuPC9wPg0KICAgICAgICA8L2Rpdj4NCiAgICA8L2xpPg0KICAgIDxsaT4NCiAgICAgICAgPGgzIGNsYXNzPSJ1ay1hY2NvcmRpb24tdGl0bGUiPkl0ZW0gMjwvaDM+DQogICAgICAgIDxkaXYgY2xhc3M9InVrLWFjY29yZGlvbi1jb250ZW50Ij4NCiAgICAgICAgICAgIDxwPlV0IGVuaW0gYWQgbWluaW0gdmVuaWFtLCBxdWlzIG5vc3RydWQgZXhlcmNpdGF0aW9uIHVsbGFtY28gbGFib3JpcyBuaXNpIHV0IGFsaXF1aXAgZXggZWEgY29tbW9kbyBjb25zZXF1YXQuIER1aXMgYXV0ZSBpcnVyZSBkb2xvciByZXByZWhlbmRlcml0LjwvcD4NCiAgICAgICAgPC9kaXY+DQogICAgPC9saT4NCiAgICA8bGk+DQogICAgICAgIDxoMyBjbGFzcz0idWstYWNjb3JkaW9uLXRpdGxlIj5JdGVtIDM8L2gzPg0KICAgICAgICA8ZGl2IGNsYXNzPSJ1ay1hY2NvcmRpb24tY29udGVudCI+DQogICAgICAgICAgICA8cD5EdWlzIGF1dGUgaXJ1cmUgZG9sb3IgaW4gcmVwcmVoZW5kZXJpdCBpbiB2b2x1cHRhdGUgdmVsaXQgZXNzZSBjaWxsdW0gZG9sb3JlIGV1IGZ1Z2lhdCBudWxsYSBwYXJpYXR1ci4gRXhjZXB0ZXVyIHNpbnQgb2NjYWVjYXQgY3VwaWRhdGF0IHByb2lkZW50LjwvcD4NCiAgICAgICAgPC9kaXY+DQogICAgPC9saT4NCjwvdWw+', 15, 'https://getuikit.com/docs/accordion', 'The Accordion component consists of a parent container with the uk-accordion attribute, and a title and content part for each accordion item.\r\n\r\n.uk-accordion-title - Defines and styles the toggle for each accordion item. Typically used on a heading.\r\n\r\n.uk-accordion-content - Defines the content part for each accordion item.\r\n\r\n', '', 1, '2017-11-20 17:21:09', '2017-11-20 23:41:14', 1, '', 14, 'c76d547f-8bcd-48e6-ba64-4ae971404a1b'), (96, 'Vast Development Method', 'Joomla@vdm.io', 'Llewellyn van der Merwe', 'https://www.vdm.io/', 'FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome – No matter how many columns of data you may have in them.\r\n\r\nHave you ever wanted to show a lot of data in a table, but hate how badly it scales on smaller mobile devices? The FooTable jQuery plugin solves this problem by allowing you to hide certain columns on smaller devices, but still allowing the user to expand each row to see the columns that were hidden.', 'metro-blue', 5, 'FooTable', 'PHRhYmxlIGNsYXNzPSJmb290YWJsZSBtZXRyby1ibHVlIiBkYXRhLWZpbHRlcj0iI2ZpbHRlciIgZGF0YS1wYWdlLXNpemU9IjUiPg0KICA8dGhlYWQ+DQogICAgPHRyPg0KICAgICAgPHRoIGRhdGEtdG9nZ2xlPSJ0cnVlIj5OYW1lPC90aD4NCiAgICAgIDx0aCBkYXRhLWhpZGU9InBob25lLHRhYmxldCI+UGhvbmU8L3RoPg0KICAgICAgPHRoIGRhdGEtaGlkZT0icGhvbmUsdGFibGV0Ij5FbWFpbDwvdGg+DQogICAgPC90cj4NCiAgPC90aGVhZD4NCiAgPHRib2R5Pg0KICAgIDx0cj4NCiAgICAgIDx0ZD5Cb2IgTWFuPC90ZD4NCiAgICAgIDx0ZD41NTUtMTIzNDU8L3RkPg0KICAgICAgPHRkPmJvYkBob21lLmNvbTwvdGQ+DQogICAgPC90cj4NCiAgICA8dHI+DQogICAgICA8dGQ+QnJpZGdldCBKb25lczwvdGQ+DQogICAgICA8dGQ+NTQ0LTc3NjY1NTwvdGQ+DQogICAgICA8dGQ+YmpvbmVzQG15c2l0ZS5jb208L3RkPg0KICAgIDwvdHI+DQogICAgPHRyPg0KICAgICAgPHRkPlRvbSBKb25lczwvdGQ+DQogICAgICA8dGQ+NTU1LTk5OTExPC90ZD4NCiAgICAgIDx0ZD5jcnVpc2UxQGNyYXp5LmNvbTwvdGQ+DQogICAgPC90cj4NCiAgPC90Ym9keT4NCjwvdGFibGU+', 32, 'https://github.com/fooplugins/FooTable/tree/V2', '', '', 1, '2015-09-26 14:07:03', '2017-11-25 22:24:55', 3, '', 15, '57eace63-c278-4685-8bb7-a40bfdee704e'), (97, 'Most Wanted Web Services, Inc.', 'sales@mwweb.host', 'Steve Voorhees', 'https://mostwantedwebhosting.com', 'Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages.', 'alert-success', 2, 'Alerts - Success', 'PGRpdiBjbGFzcz0iYWxlcnQgYWxlcnQtc3VjY2VzcyIgcm9sZT0iYWxlcnQiPg0KICAgIDxzdHJvbmc+V2VsbCBkb25lITwvc3Ryb25nPiBZb3Ugc3VjY2Vzc2Z1bGx5IHJlYWQgdGhpcw0KICAgIGltcG9ydGFudCBhbGVydCBtZXNzYWdlLg0KPC9kaXY+', 7, 'https://getbootstrap.com/docs/4.0/components/alerts/', 'Alerts are available for any length of text, as well as an optional dismiss button. For proper styling, use one of the eight required contextual classes (e.g., .alert-success).', '', 1, '2017-11-01 00:00:00', '2017-11-13 10:12:34', 1, '', 16, 'eac77139-a69b-4eef-9276-254194d2bed5'), @@ -2188,29 +2243,29 @@ INSERT INTO `#__componentbuilder_snippet` (`id`, `contributor_company`, `contrib -- Dumping data for table `#__componentbuilder_validation_rule` -- -INSERT INTO `#__componentbuilder_validation_rule` (`id`, `name`, `php`, `short_description`, `published`, `created`) VALUES -(1, 'inspect', 'CS8qKg0KCSAqIE1ldGhvZCB0byB0ZXN0IHRoZSB2YWx1ZS4NCgkgKg0KCSAqIEBwYXJhbSAgIFxTaW1wbGVYTUxFbGVtZW50ICAkZWxlbWVudCAgVGhlIFNpbXBsZVhNTEVsZW1lbnQgb2JqZWN0IHJlcHJlc2VudGluZyB0aGUgYDxmaWVsZD5gIHRhZyBmb3IgdGhlIGZvcm0gZmllbGQgb2JqZWN0Lg0KCSAqIEBwYXJhbSAgIG1peGVkICAgICAgICAgICAgICAkdmFsdWUgICAgVGhlIGZvcm0gZmllbGQgdmFsdWUgdG8gdmFsaWRhdGUuDQoJICogQHBhcmFtICAgc3RyaW5nICAgICAgICAgICAgICRncm91cCAgICBUaGUgZmllbGQgbmFtZSBncm91cCBjb250cm9sIHZhbHVlLiBUaGlzIGFjdHMgYXMgYW4gYXJyYXkgY29udGFpbmVyIGZvciB0aGUgZmllbGQuDQoJICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGb3IgZXhhbXBsZSBpZiB0aGUgZmllbGQgaGFzIG5hbWU9ImZvbyIgYW5kIHRoZSBncm91cCB2YWx1ZSBpcyBzZXQgdG8gImJhciIgdGhlbiB0aGUNCgkgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGwgZmllbGQgbmFtZSB3b3VsZCBlbmQgdXAgYmVpbmcgImJhcltmb29dIi4NCgkgKiBAcGFyYW0gICBSZWdpc3RyeSAgICAgICAgICAgJGlucHV0ICAgIEFuIG9wdGlvbmFsIFJlZ2lzdHJ5IG9iamVjdCB3aXRoIHRoZSBlbnRpcmUgZGF0YSBzZXQgdG8gdmFsaWRhdGUgYWdhaW5zdCB0aGUgZW50aXJlIGZvcm0uDQoJICogQHBhcmFtICAgRm9ybSAgICAgICAgICAgICAgICRmb3JtICAgICBUaGUgZm9ybSBvYmplY3QgZm9yIHdoaWNoIHRoZSBmaWVsZCBpcyBiZWluZyB0ZXN0ZWQuDQoJICoNCgkgKiBAcmV0dXJuICBib29sZWFuICBUcnVlIGlmIHRoZSB2YWx1ZSBpcyB2YWxpZCwgZmFsc2Ugb3RoZXJ3aXNlLg0KCSAqDQoJICogQHNpbmNlICAgMTEuMQ0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiB0ZXN0KFxTaW1wbGVYTUxFbGVtZW50ICRlbGVtZW50LCAkdmFsdWUsICRncm91cCA9IG51bGwsIFJlZ2lzdHJ5ICRpbnB1dCA9IG51bGwsIEZvcm0gJGZvcm0gPSBudWxsKQ0KCXsNCgkJLy8gbG9vayBpbnRvIHRoZXNlIHZhbHVlcyBvbmUgYXQgYSB0aW1lDQoJCWVjaG8gJ2VsZW1lbnQ8YnIgLz4nOw0KCQl2YXJfZHVtcCgkZWxlbWVudCk7DQoJCWVjaG8gJ3ZhbHVlPGJyIC8+JzsNCgkJdmFyX2R1bXAoJHZhbHVlKTsNCgkJZWNobyAnZ3JvdXA8YnIgLz4nOw0KCQl2YXJfZHVtcCgkZ3JvdXApOw0KCQllY2hvICdpbnB1dDxiciAvPic7DQoJCXZhcl9kdW1wKCRpbnB1dCk7DQoJCWVjaG8gJ2Zvcm08YnIgLz4nOw0KCQl2YXJfZHVtcCgkZm9ybSk7DQoJCWpleGl0KCk7DQoJfQ==', 'simple function to inspect the test values', 1, '2018-03-30 09:22:15'), -(2, 'code', 'CS8qKg0KCSAqIE1ldGhvZCB0byB0ZXN0IHRoZSB2YWx1ZS4NCgkgKg0KCSAqIEBwYXJhbSAgIFxTaW1wbGVYTUxFbGVtZW50ICAkZWxlbWVudCAgVGhlIFNpbXBsZVhNTEVsZW1lbnQgb2JqZWN0IHJlcHJlc2VudGluZyB0aGUgYDxmaWVsZD5gIHRhZyBmb3IgdGhlIGZvcm0gZmllbGQgb2JqZWN0Lg0KCSAqIEBwYXJhbSAgIG1peGVkICAgICAgICAgICAgICAkdmFsdWUgICAgVGhlIGZvcm0gZmllbGQgdmFsdWUgdG8gdmFsaWRhdGUuDQoJICogQHBhcmFtICAgc3RyaW5nICAgICAgICAgICAgICRncm91cCAgICBUaGUgZmllbGQgbmFtZSBncm91cCBjb250cm9sIHZhbHVlLiBUaGlzIGFjdHMgYXMgYW4gYXJyYXkgY29udGFpbmVyIGZvciB0aGUgZmllbGQuDQoJICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGb3IgZXhhbXBsZSBpZiB0aGUgZmllbGQgaGFzIG5hbWU9ImZvbyIgYW5kIHRoZSBncm91cCB2YWx1ZSBpcyBzZXQgdG8gImJhciIgdGhlbiB0aGUNCgkgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGwgZmllbGQgbmFtZSB3b3VsZCBlbmQgdXAgYmVpbmcgImJhcltmb29dIi4NCgkgKiBAcGFyYW0gICBSZWdpc3RyeSAgICAgICAgICAgJGlucHV0ICAgIEFuIG9wdGlvbmFsIFJlZ2lzdHJ5IG9iamVjdCB3aXRoIHRoZSBlbnRpcmUgZGF0YSBzZXQgdG8gdmFsaWRhdGUgYWdhaW5zdCB0aGUgZW50aXJlIGZvcm0uDQoJICogQHBhcmFtICAgRm9ybSAgICAgICAgICAgICAgICRmb3JtICAgICBUaGUgZm9ybSBvYmplY3QgZm9yIHdoaWNoIHRoZSBmaWVsZCBpcyBiZWluZyB0ZXN0ZWQuDQoJICoNCgkgKiBAcmV0dXJuICBib29sZWFuICBUcnVlIGlmIHRoZSB2YWx1ZSBpcyB2YWxpZCwgZmFsc2Ugb3RoZXJ3aXNlLg0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiB0ZXN0KFxTaW1wbGVYTUxFbGVtZW50ICRlbGVtZW50LCAkdmFsdWUsICRncm91cCA9IG51bGwsIFJlZ2lzdHJ5ICRpbnB1dCA9IG51bGwsIEZvcm0gJGZvcm0gPSBudWxsKQ0KCXsNCgkJLy8gVGhpcyByZW1vdmVzIGFsbCB2YWxpZGF0aW9uIChpcyBkYW5nZXJvdXMpIGJ1dCBuZWVkZWQgdG8gc3VibWl0IGNvZGUgdmlhIEpDQg0KCQlyZXR1cm4gdHJ1ZTsNCg0KCQkvKioNCgkJICogTXkgaWRlYSBpcyB0byBhZGQgc29tZSBraW5kIG9mIHZhbGlkYXRpb24gdG8gaW1wcm92ZSBKQ0IgY29kZSAocGVyL2xhbmd1YWdlKQ0KCQkgKg0KCQkgKiBTbyBhdCB0aGlzIHRpbWUgdGhpcyBjb2RlIHZhbGlkYXRpb24gaXMgdXNlZCBmb3IgSmF2YVNjcmlwdCxDU1MsSFRNTCBhbmQgUEhQLg0KCQkgKiBXZSBjYW4gc2VlIHdoYXQgbGFuZ3VhZ2UgaXMgYmVpbmcgd29ya2VkIG9uIHdpdGggdGhlIHN5bnRheCBwcm9wZXJ0eSBpbiB0aGUgJGVsZW1lbnQuIChpbiBKQ0IpDQoJCSAqIFdoYXQgY29tcGxpY2F0ZXMgdGhpbmdzIGlzIHRoZSBwbGFjZWhvbGRlcnMsIG9mIGJvdGggY3VzdG9tIGNvZGUsIGNvbXBvbmVudCwgYW5kIHZpZXcgbmFtZXMuDQoJCSAqIElkZWFsbHkgd2UgY291bGQgc3RyaXAgdGhlbSBhbmQgdGhlbiB2YWxpZGF0ZSB0aGUgY29kZSB0byBiZWluZyBzeW50YWN0aWNhbGx5IGNvcnJlY3QuDQoJCSAqIEJ1dCBzaW5jZSBzb21lIG9mIHRoZSBwbGFjZWhvbGRlcnMgZm9ybSBwYXJ0IG9mIHRoZSBjbGFzcy9mdW5jdGlvbiBuYW1lcyBhbmQgdGhlIG1vcmUsIGl0IHNlZW1zIGxpa2Ugd2UgYXJlIHByZXNzZWQgZm9yIGEgbXVjaCBtb3JlIGFkdmFuY2Ugc29sdXRpb24uDQoJCSAqIElmIHlvdSBoYXZlIGFueSBpZGVhcyB0byBob3cgd2UgY2FuIGdvIGFib3V0IHRvIGRvIHRoaXMsIHRoZW4gcGxlYXNlIG9wZW4gYW4gaXNzdWUgb24gZ2l0aHViIGFuZCBsZXRzIGJlZ2luLiAodGhpcyBpcyBhIG5pY2UgdG8gaGF2ZSwgc28gZG9uJ3QgYnJlYWsgYSBsZWcuLi4pDQoJCSAqLw0KCX0=', 'To validate code', 1, '2018-06-24 19:11:45'), -(3, 'uniquefield', 'CS8qKg0KCSAqIE1ldGhvZCB0byB0ZXN0IHRoZSBmaWVsZCB2YWx1ZSBmb3IgdW5pcXVlbmVzcy4NCgkgKg0KCSAqIEBwYXJhbSAgIFxTaW1wbGVYTUxFbGVtZW50ICAkZWxlbWVudCAgVGhlIFNpbXBsZVhNTEVsZW1lbnQgb2JqZWN0IHJlcHJlc2VudGluZyB0aGUgYDxmaWVsZD5gIHRhZyBmb3IgdGhlIGZvcm0gZmllbGQgb2JqZWN0Lg0KCSAqIEBwYXJhbSAgIG1peGVkICAgICAgICAgICAgICAkdmFsdWUgICAgVGhlIGZvcm0gZmllbGQgdmFsdWUgdG8gdmFsaWRhdGUuDQoJICogQHBhcmFtICAgc3RyaW5nICAgICAgICAgICAgICRncm91cCAgICBUaGUgZmllbGQgbmFtZSBncm91cCBjb250cm9sIHZhbHVlLiBUaGlzIGFjdHMgYXMgYW4gYXJyYXkgY29udGFpbmVyIGZvciB0aGUgZmllbGQuDQoJICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGb3IgZXhhbXBsZSBpZiB0aGUgZmllbGQgaGFzIG5hbWU9ImZvbyIgYW5kIHRoZSBncm91cCB2YWx1ZSBpcyBzZXQgdG8gImJhciIgdGhlbiB0aGUNCgkgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGwgZmllbGQgbmFtZSB3b3VsZCBlbmQgdXAgYmVpbmcgImJhcltmb29dIi4NCgkgKiBAcGFyYW0gICBSZWdpc3RyeSAgICAgICAgICAgJGlucHV0ICAgIEFuIG9wdGlvbmFsIFJlZ2lzdHJ5IG9iamVjdCB3aXRoIHRoZSBlbnRpcmUgZGF0YSBzZXQgdG8gdmFsaWRhdGUgYWdhaW5zdCB0aGUgZW50aXJlIGZvcm0uDQoJICogQHBhcmFtICAgRm9ybSAgICAgICAgICAgICAgICRmb3JtICAgICBUaGUgZm9ybSBvYmplY3QgZm9yIHdoaWNoIHRoZSBmaWVsZCBpcyBiZWluZyB0ZXN0ZWQuDQoJICoNCgkgKiBAcmV0dXJuICBib29sZWFuICBUcnVlIGlmIHRoZSB2YWx1ZSBpcyB2YWxpZCwgZmFsc2Ugb3RoZXJ3aXNlLg0KCSAqDQoJICogQHNpbmNlICAgMTEuMQ0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiB0ZXN0KFxTaW1wbGVYTUxFbGVtZW50ICRlbGVtZW50LCAkdmFsdWUsICRncm91cCA9IG51bGwsIFJlZ2lzdHJ5ICRpbnB1dCA9IG51bGwsIEZvcm0gJGZvcm0gPSBudWxsKQ0KCXsNCgkJLy8gR2V0IHRoZSBkYXRhYmFzZSBvYmplY3QgYW5kIGEgbmV3IHF1ZXJ5IG9iamVjdC4NCgkJJGRiID0gXEpGYWN0b3J5OjpnZXREYm8oKTsNCgkJJHF1ZXJ5ID0gJGRiLT5nZXRRdWVyeSh0cnVlKTsNCg0KCQkvLyBHZXQgdGhlIGV4dHJhIGZpZWxkIGNoZWNrIGF0dHJpYnV0ZS4NCgkJJGlkID0gKCRpbnB1dCBpbnN0YW5jZW9mIFJlZ2lzdHJ5KSA/ICRpbnB1dC0+Z2V0KCdpZCcsIG51bGwpIDogbnVsbDsNCg0KCQkvLyBnZXQgdGhlIGNvbXBvbmVudCAmIHRhYmxlIG5hbWUNCgkJJHRhYmxlID0gKCRmb3JtIGluc3RhbmNlb2YgRm9ybSkgPyAkZm9ybS0+Z2V0TmFtZSgpIDogJyc7DQoNCgkJLy8gZ2V0IHRoZSBjb2x1bW4gbmFtZQ0KCQkkbmFtZSA9IChhcnJheSkgJGVsZW1lbnQtPmF0dHJpYnV0ZXMoKS0+eyduYW1lJ307DQoJCSRjb2x1bW4gPSAoc3RyaW5nKSB0cmltKCRuYW1lWzBdKTsNCgkJDQoJCS8vIGNoZWNrIHRoYXQgd2UgaGF2ZSBhIHZhbHVlDQoJCWlmIChzdHJsZW4oJHZhbHVlKSAmJiBzdHJsZW4oJHRhYmxlKSA+IDMgJiYgc3RycG9zKCR0YWJsZSwgJ1tbW2NvbXBvbmVudF1dXS4nKSAhPT0gZmFsc2UpDQoJCXsNCgkJCS8vIG5vdyBnZXQgdGhlIHRhYmxlIG5hbWUNCgkJCSR0YWJsZUFycmF5ID0gZXhwbG9kZSgnLicsICR0YWJsZSk7DQoJCQkvLyBkbyB3ZSBoYXZlIHR3byB2YWx1ZXMNCgkJCWlmIChjb3VudCggKGFycmF5KSAkdGFibGVBcnJheSkgPT0gMikNCgkJCXsNCgkJCQkvLyBCdWlsZCB0aGUgcXVlcnkuDQoJCQkJJHF1ZXJ5LT5zZWxlY3QoJ0NPVU5UKCopJykNCgkJCQkJLT5mcm9tKCcjX19bW1tjb21wb25lbnRdXV1fJyAuIChzdHJpbmcpICR0YWJsZUFycmF5WzFdKQ0KCQkJCQktPndoZXJlKCRkYi0+cXVvdGVOYW1lKCRjb2x1bW4pIC4gJyA9ICcgLiAkZGItPnF1b3RlKCR2YWx1ZSkpOw0KDQoJCQkJLy8gcmVtb3ZlIHRoaXMgaXRlbSBmcm9tIHRoZSBsaXN0DQoJCQkJaWYgKCRpZCA+IDApDQoJCQkJew0KCQkJCQkkcXVlcnktPndoZXJlKCRkYi0+cXVvdGVOYW1lKCdpZCcpIC4gJyA8PiAnIC4gKGludCkgJGlkKTsNCgkJCQl9DQoNCgkJCQkvLyBTZXQgYW5kIHF1ZXJ5IHRoZSBkYXRhYmFzZS4NCgkJCQkkZGItPnNldFF1ZXJ5KCRxdWVyeSk7DQoJCQkJJGR1cGxpY2F0ZSA9IChib29sKSAkZGItPmxvYWRSZXN1bHQoKTsNCg0KCQkJCWlmICgkZHVwbGljYXRlKQ0KCQkJCXsNCgkJCQkJcmV0dXJuIGZhbHNlOw0KCQkJCX0NCgkJCX0NCgkJfQ0KDQoJCXJldHVybiB0cnVlOw0KCX0=', 'unique field value', 1, '2018-07-21 06:06:42'), -(4, 'memberloginname', 'CS8qKg0KCSAqIE1ldGhvZCB0byB0ZXN0IHRoZSB1c2VybmFtZSBmb3IgdW5pcXVlbmVzcy4NCgkgKg0KCSAqIEBwYXJhbSAgIFxTaW1wbGVYTUxFbGVtZW50ICAkZWxlbWVudCAgVGhlIFNpbXBsZVhNTEVsZW1lbnQgb2JqZWN0IHJlcHJlc2VudGluZyB0aGUgYDxmaWVsZD5gIHRhZyBmb3IgdGhlIGZvcm0gZmllbGQgb2JqZWN0Lg0KCSAqIEBwYXJhbSAgIG1peGVkICAgICAgICAgICAgICAkdmFsdWUgICAgVGhlIGZvcm0gZmllbGQgdmFsdWUgdG8gdmFsaWRhdGUuDQoJICogQHBhcmFtICAgc3RyaW5nICAgICAgICAgICAgICRncm91cCAgICBUaGUgZmllbGQgbmFtZSBncm91cCBjb250cm9sIHZhbHVlLiBUaGlzIGFjdHMgYXMgYW4gYXJyYXkgY29udGFpbmVyIGZvciB0aGUgZmllbGQuDQoJICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGb3IgZXhhbXBsZSBpZiB0aGUgZmllbGQgaGFzIG5hbWU9ImZvbyIgYW5kIHRoZSBncm91cCB2YWx1ZSBpcyBzZXQgdG8gImJhciIgdGhlbiB0aGUNCgkgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGwgZmllbGQgbmFtZSB3b3VsZCBlbmQgdXAgYmVpbmcgImJhcltmb29dIi4NCgkgKiBAcGFyYW0gICBSZWdpc3RyeSAgICAgICAgICAgJGlucHV0ICAgIEFuIG9wdGlvbmFsIFJlZ2lzdHJ5IG9iamVjdCB3aXRoIHRoZSBlbnRpcmUgZGF0YSBzZXQgdG8gdmFsaWRhdGUgYWdhaW5zdCB0aGUgZW50aXJlIGZvcm0uDQoJICogQHBhcmFtICAgRm9ybSAgICAgICAgICAgICAgICRmb3JtICAgICBUaGUgZm9ybSBvYmplY3QgZm9yIHdoaWNoIHRoZSBmaWVsZCBpcyBiZWluZyB0ZXN0ZWQuDQoJICoNCgkgKiBAcmV0dXJuICBib29sZWFuICBUcnVlIGlmIHRoZSB2YWx1ZSBpcyB2YWxpZCwgZmFsc2Ugb3RoZXJ3aXNlLg0KCSAqDQoJICogQHNpbmNlICAgMTEuMQ0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiB0ZXN0KFxTaW1wbGVYTUxFbGVtZW50ICRlbGVtZW50LCAkdmFsdWUsICRncm91cCA9IG51bGwsIFJlZ2lzdHJ5ICRpbnB1dCA9IG51bGwsIEZvcm0gJGZvcm0gPSBudWxsKQ0KCXsNCgkJLy8gR2V0IHRoZSBkYXRhYmFzZSBvYmplY3QgYW5kIGEgbmV3IHF1ZXJ5IG9iamVjdC4NCgkJJGRiID0gXEpGYWN0b3J5OjpnZXREYm8oKTsNCgkJJHF1ZXJ5ID0gJGRiLT5nZXRRdWVyeSh0cnVlKTsNCg0KCQkvLyBCdWlsZCB0aGUgcXVlcnkuDQoJCSRxdWVyeS0+c2VsZWN0KCdDT1VOVCgqKScpDQoJCQktPmZyb20oJyNfX3VzZXJzJykNCgkJCS0+d2hlcmUoJ3VzZXJuYW1lID0gJyAuICRkYi0+cXVvdGUoJHZhbHVlKSk7DQoNCgkJLy8gR2V0IHRoZSB1c2VyIElEIGlmIHNldC4NCgkJJHVzZXJJZCA9ICgkZm9ybSBpbnN0YW5jZW9mIEZvcm0gJiYgKCR1c2VySWQgPSAkZm9ybS0+Z2V0VmFsdWUoJ3VzZXInKSkpID8gJHVzZXJJZCA6ICgoJGlucHV0IGluc3RhbmNlb2YgUmVnaXN0cnkgJiYgKCR1c2VySWQgPSAkaW5wdXQtPmdldCgndXNlcicpKSkgPyAkdXNlcklkIDogMCk7DQoJCS8vIGlmIHN0aWxsIG5vdCB1c2VyIGlzIGZvdW5kIGdldCBtZW1iZXIgaWQNCgkJaWYgKCR1c2VySWQgPT0gMCkNCgkJew0KCQkJJG1lbWJlcklkID0gKCRmb3JtIGluc3RhbmNlb2YgRm9ybSAmJiAoJG1lbWJlcklkID0gJGZvcm0tPmdldFZhbHVlKCdpZCcpKSkgPyAkbWVtYmVySWQgOiAoKCRpbnB1dCBpbnN0YW5jZW9mIFJlZ2lzdHJ5ICYmICgkbWVtYmVySWQgPSAkaW5wdXQtPmdldCgnaWQnKSkpID8gJG1lbWJlcklkIDogMCk7DQoJCX0NCgkJLy8gZ2V0IGFjY291bnQgdHlwZSBpZiBuZWVkZWQNCgkJaWYgKCR1c2VySWQgPT0gMCAmJiAkbWVtYmVySWQgPiAwKQ0KCQl7DQoJCQkkYWNjb3VudElkID0gKCRmb3JtIGluc3RhbmNlb2YgRm9ybSAmJiAoJGFjY291bnRJZCA9ICRmb3JtLT5nZXRWYWx1ZSgnYWNjb3VudCcpKSkgPyAkYWNjb3VudElkIDogKCgkaW5wdXQgaW5zdGFuY2VvZiBSZWdpc3RyeSAmJiAoJGFjY291bnRJZCA9ICRpbnB1dC0+Z2V0KCdhY2NvdW50JykpKSA/ICRhY2NvdW50SWQgOiAwKTsNCgkJCS8vIG1ha2Ugc3VyZSB0aGVzZSBhY2NvdW50IGlzIHNldA0KCQkJaWYgKCRhY2NvdW50SWQgPT0gMCkNCgkJCXsNCgkJCQkkYWNjb3VudElkID0gW1tbQ29tcG9uZW50XV1dSGVscGVyOjpnZXRWYXIoJ21lbWJlcicsICRtZW1iZXJJZCwgJ2lkJywgJ2FjY291bnQnKTsNCgkJCX0NCgkJfQ0KCQkvLyBnZXQgdXNlciB2YWx1ZSBpZiBub3Qgc2V0IChkdWUgdG8gcGVybWlzc2lvbnMpDQoJCWlmICgkdXNlcklkID09IDAgJiYgJG1lbWJlcklkID4gMCAmJiAkYWNjb3VudElkID4gMCAmJiAoMSA9PSAkYWNjb3VudElkIHx8IDQgPT0gJGFjY291bnRJZCkpDQoJCXsNCgkJCSR1c2VySWQgPSBbW1tDb21wb25lbnRdXV1IZWxwZXI6OmdldFZhcignbWVtYmVyJywgJG1lbWJlcklkLCAnaWQnLCAndXNlcicpOw0KCQl9DQoJCSRxdWVyeS0+d2hlcmUoJGRiLT5xdW90ZU5hbWUoJ2lkJykgLiAnIDw+ICcgLiAoaW50KSAkdXNlcklkKTsNCg0KCQkvLyBTZXQgYW5kIHF1ZXJ5IHRoZSBkYXRhYmFzZS4NCgkJJGRiLT5zZXRRdWVyeSgkcXVlcnkpOw0KCQkkZHVwbGljYXRlID0gKGJvb2wpICRkYi0+bG9hZFJlc3VsdCgpOw0KDQoJCWlmICgkZHVwbGljYXRlKQ0KCQl7DQoJCQlyZXR1cm4gZmFsc2U7DQoJCX0NCg0KCQlyZXR1cm4gdHJ1ZTsNCgl9', 'Validate the member username', 1, '2018-09-16 00:42:59'), -(5, 'memberuseremail', 'CS8qKg0KCSAqIFRoZSByZWd1bGFyIGV4cHJlc3Npb24gdG8gdXNlIGluIHRlc3RpbmcgYSBmb3JtIGZpZWxkIHZhbHVlLg0KCSAqDQoJICogQHZhciAgICBzdHJpbmcNCgkgKiBAc2luY2UgIDExLjENCgkgKiBAbGluayAgIGh0dHA6Ly93d3cudzMub3JnL1RSL2h0bWwtbWFya3VwL2lucHV0LmVtYWlsLmh0bWwNCgkgKi8NCglwcm90ZWN0ZWQgJHJlZ2V4ID0gIl5bYS16QS1aMC05LiEjJCUmJyorLz0/Xl9ge3x9fi1dK0BbYS16QS1aMC05LV0rKD86XC5bYS16QS1aMC05LV0rKSokIjsNCg0KCS8qKg0KCSAqIE1ldGhvZCB0byB0ZXN0IHRoZSBlbWFpbCBhZGRyZXNzIGFuZCBvcHRpb25hbGx5IGNoZWNrIGZvciB1bmlxdWVuZXNzLg0KCSAqDQoJICogQHBhcmFtICAgXFNpbXBsZVhNTEVsZW1lbnQgICRlbGVtZW50ICBUaGUgU2ltcGxlWE1MRWxlbWVudCBvYmplY3QgcmVwcmVzZW50aW5nIHRoZSBgPGZpZWxkPmAgdGFnIGZvciB0aGUgZm9ybSBmaWVsZCBvYmplY3QuDQoJICogQHBhcmFtICAgbWl4ZWQgICAgICAgICAgICAgICR2YWx1ZSAgICBUaGUgZm9ybSBmaWVsZCB2YWx1ZSB0byB2YWxpZGF0ZS4NCgkgKiBAcGFyYW0gICBzdHJpbmcgICAgICAgICAgICAgJGdyb3VwICAgIFRoZSBmaWVsZCBuYW1lIGdyb3VwIGNvbnRyb2wgdmFsdWUuIFRoaXMgYWN0cyBhcyBhbiBhcnJheSBjb250YWluZXIgZm9yIHRoZSBmaWVsZC4NCgkgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZvciBleGFtcGxlIGlmIHRoZSBmaWVsZCBoYXMgbmFtZT0iZm9vIiBhbmQgdGhlIGdyb3VwIHZhbHVlIGlzIHNldCB0byAiYmFyIiB0aGVuIHRoZQ0KCSAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVsbCBmaWVsZCBuYW1lIHdvdWxkIGVuZCB1cCBiZWluZyAiYmFyW2Zvb10iLg0KCSAqIEBwYXJhbSAgIFJlZ2lzdHJ5ICAgICAgICAgICAkaW5wdXQgICAgQW4gb3B0aW9uYWwgUmVnaXN0cnkgb2JqZWN0IHdpdGggdGhlIGVudGlyZSBkYXRhIHNldCB0byB2YWxpZGF0ZSBhZ2FpbnN0IHRoZSBlbnRpcmUgZm9ybS4NCgkgKiBAcGFyYW0gICBGb3JtICAgICAgICAgICAgICAgJGZvcm0gICAgIFRoZSBmb3JtIG9iamVjdCBmb3Igd2hpY2ggdGhlIGZpZWxkIGlzIGJlaW5nIHRlc3RlZC4NCgkgKg0KCSAqIEByZXR1cm4gIGJvb2xlYW4gIFRydWUgaWYgdGhlIHZhbHVlIGlzIHZhbGlkLCBmYWxzZSBvdGhlcndpc2UuDQoJICoNCgkgKiBAc2luY2UgICAxMS4xDQoJICovDQoJcHVibGljIGZ1bmN0aW9uIHRlc3QoXFNpbXBsZVhNTEVsZW1lbnQgJGVsZW1lbnQsICR2YWx1ZSwgJGdyb3VwID0gbnVsbCwgUmVnaXN0cnkgJGlucHV0ID0gbnVsbCwgRm9ybSAkZm9ybSA9IG51bGwpDQoJew0KCQkvLyBJZiB0aGUgZmllbGQgaXMgZW1wdHkgYW5kIG5vdCByZXF1aXJlZCwgdGhlIGZpZWxkIGlzIHZhbGlkLg0KCQkkcmVxdWlyZWQgPSAoKHN0cmluZykgJGVsZW1lbnRbJ3JlcXVpcmVkJ10gPT0gJ3RydWUnIHx8IChzdHJpbmcpICRlbGVtZW50WydyZXF1aXJlZCddID09ICdyZXF1aXJlZCcpOw0KDQoJCWlmICghJHJlcXVpcmVkICYmIGVtcHR5KCR2YWx1ZSkpDQoJCXsNCgkJCXJldHVybiB0cnVlOw0KCQl9DQoNCgkJLy8gSWYgdGhlIHRsZCBhdHRyaWJ1dGUgaXMgcHJlc2VudCwgY2hhbmdlIHRoZSByZWd1bGFyIGV4cHJlc3Npb24gdG8gcmVxdWlyZSBhdCBsZWFzdCAyIGNoYXJhY3RlcnMgZm9yIGl0Lg0KCQkkdGxkID0gKChzdHJpbmcpICRlbGVtZW50Wyd0bGQnXSA9PSAndGxkJyB8fCAoc3RyaW5nKSAkZWxlbWVudFsndGxkJ10gPT0gJ3JlcXVpcmVkJyk7DQoNCgkJaWYgKCR0bGQpDQoJCXsNCgkJCSR0aGlzLT5yZWdleCA9ICJeW2EtekEtWjAtOS4hIyQlJicqKy89P15fYHt8fX4tXStAW2EtekEtWjAtOV0oPzpbYS16QS1aMC05LV17MCw2MX1bYS16QS1aMC05XSkiDQoJCQkJLiAnPyg/OlwuW2EtekEtWjAtOV0oPzpbYS16QS1aMC05LV17MCw2MX1bYS16QS1aMC05XSk/KSskJzsNCgkJfQ0KDQoJCS8vIERldGVybWluZSBpZiB0aGUgbXVsdGlwbGUgYXR0cmlidXRlIGlzIHByZXNlbnQNCgkJJG11bHRpcGxlID0gKChzdHJpbmcpICRlbGVtZW50WydtdWx0aXBsZSddID09ICd0cnVlJyB8fCAoc3RyaW5nKSAkZWxlbWVudFsnbXVsdGlwbGUnXSA9PSAnbXVsdGlwbGUnKTsNCg0KCQlpZiAoISRtdWx0aXBsZSkNCgkJew0KCQkJLy8gSGFuZGxlIGlkbiBlbWFpbCBhZGRyZXNzZXMgYnkgY29udmVydGluZyB0byBwdW55Y29kZS4NCgkJCSR2YWx1ZSA9IFxKU3RyaW5nUHVueWNvZGU6OmVtYWlsVG9QdW55Y29kZSgkdmFsdWUpOw0KDQoJCQkvLyBUZXN0IHRoZSB2YWx1ZSBhZ2FpbnN0IHRoZSByZWd1bGFyIGV4cHJlc3Npb24uDQoJCQlpZiAoIXBhcmVudDo6dGVzdCgkZWxlbWVudCwgJHZhbHVlLCAkZ3JvdXAsICRpbnB1dCwgJGZvcm0pKQ0KCQkJew0KCQkJCXJldHVybiBmYWxzZTsNCgkJCX0NCgkJfQ0KCQllbHNlDQoJCXsNCgkJCSR2YWx1ZXMgPSBleHBsb2RlKCcsJywgJHZhbHVlKTsNCg0KCQkJZm9yZWFjaCAoJHZhbHVlcyBhcyAkdmFsdWUpDQoJCQl7DQoJCQkJLy8gSGFuZGxlIGlkbiBlbWFpbCBhZGRyZXNzZXMgYnkgY29udmVydGluZyB0byBwdW55Y29kZS4NCgkJCQkkdmFsdWUgPSBcSlN0cmluZ1B1bnljb2RlOjplbWFpbFRvUHVueWNvZGUoJHZhbHVlKTsNCg0KCQkJCS8vIFRlc3QgdGhlIHZhbHVlIGFnYWluc3QgdGhlIHJlZ3VsYXIgZXhwcmVzc2lvbi4NCgkJCQlpZiAoIXBhcmVudDo6dGVzdCgkZWxlbWVudCwgJHZhbHVlLCAkZ3JvdXAsICRpbnB1dCwgJGZvcm0pKQ0KCQkJCXsNCgkJCQkJcmV0dXJuIGZhbHNlOw0KCQkJCX0NCgkJCX0NCgkJfQ0KDQoJCS8vIENoZWNrIGlmIHdlIHNob3VsZCB0ZXN0IGZvciB1bmlxdWVuZXNzLiBUaGlzIG9ubHkgY2FuIGJlIHVzZWQgaWYgbXVsdGlwbGUgaXMgbm90IHRydWUNCgkJJHVuaXF1ZSA9ICgoc3RyaW5nKSAkZWxlbWVudFsndW5pcXVlJ10gPT0gJ3RydWUnIHx8IChzdHJpbmcpICRlbGVtZW50Wyd1bmlxdWUnXSA9PSAndW5pcXVlJyk7DQoNCgkJaWYgKCR1bmlxdWUgJiYgISRtdWx0aXBsZSkNCgkJew0KCQkJLy8gR2V0IHRoZSBkYXRhYmFzZSBvYmplY3QgYW5kIGEgbmV3IHF1ZXJ5IG9iamVjdC4NCgkJCSRkYiA9IFxKRmFjdG9yeTo6Z2V0RGJvKCk7DQoJCQkkcXVlcnkgPSAkZGItPmdldFF1ZXJ5KHRydWUpOw0KDQoJCQkvLyBCdWlsZCB0aGUgcXVlcnkuDQoJCQkkcXVlcnktPnNlbGVjdCgnQ09VTlQoKiknKQ0KCQkJCS0+ZnJvbSgnI19fdXNlcnMnKQ0KCQkJCS0+d2hlcmUoJ2VtYWlsID0gJyAuICRkYi0+cXVvdGUoJHZhbHVlKSk7DQoNCgkJCS8vIEdldCB0aGUgdXNlciBJRCBpZiBzZXQuDQoJCQkkdXNlcklkID0gKCRmb3JtIGluc3RhbmNlb2YgRm9ybSAmJiAoJHVzZXJJZCA9ICRmb3JtLT5nZXRWYWx1ZSgndXNlcicpKSkgPyAkdXNlcklkIDogKCgkaW5wdXQgaW5zdGFuY2VvZiBSZWdpc3RyeSAmJiAoJHVzZXJJZCA9ICRpbnB1dC0+Z2V0KCd1c2VyJykpKSA/ICR1c2VySWQgOiAwKTsNCgkJCS8vIGlmIHN0aWxsIG5vdCB1c2VyIGlzIGZvdW5kIGdldCBtZW1iZXIgaWQNCgkJCWlmICgkdXNlcklkID09IDApDQoJCQl7DQoJCQkJJG1lbWJlcklkID0gKCRmb3JtIGluc3RhbmNlb2YgRm9ybSAmJiAoJG1lbWJlcklkID0gJGZvcm0tPmdldFZhbHVlKCdpZCcpKSkgPyAkbWVtYmVySWQgOiAoKCRpbnB1dCBpbnN0YW5jZW9mIFJlZ2lzdHJ5ICYmICgkbWVtYmVySWQgPSAkaW5wdXQtPmdldCgnaWQnKSkpID8gJG1lbWJlcklkIDogMCk7DQoJCQl9DQoJCQkvLyBnZXQgYWNjb3VudCB0eXBlIGlmIG5lZWRlZA0KCQkJaWYgKCR1c2VySWQgPT0gMCAmJiAkbWVtYmVySWQgPiAwKQ0KCQkJew0KCQkJCSRhY2NvdW50SWQgPSAoJGZvcm0gaW5zdGFuY2VvZiBGb3JtICYmICgkYWNjb3VudElkID0gJGZvcm0tPmdldFZhbHVlKCdhY2NvdW50JykpKSA/ICRhY2NvdW50SWQgOiAoKCRpbnB1dCBpbnN0YW5jZW9mIFJlZ2lzdHJ5ICYmICgkYWNjb3VudElkID0gJGlucHV0LT5nZXQoJ2FjY291bnQnKSkpID8gJGFjY291bnRJZCA6IDApOw0KCQkJCS8vIG1ha2Ugc3VyZSB0aGVzZSBhY2NvdW50IGlzIHNldA0KCQkJCWlmICgkYWNjb3VudElkID09IDApDQoJCQkJew0KCQkJCQkkYWNjb3VudElkID0gW1tbQ29tcG9uZW50XV1dSGVscGVyOjpnZXRWYXIoJ21lbWJlcicsICRtZW1iZXJJZCwgJ2lkJywgJ2FjY291bnQnKTsNCgkJCQl9DQoJCQl9DQoJCQkvLyBnZXQgdXNlciB2YWx1ZSBpZiBub3Qgc2V0IChkdWUgdG8gcGVybWlzc2lvbnMpDQoJCQlpZiAoJHVzZXJJZCA9PSAwICYmICRtZW1iZXJJZCA+IDAgJiYgJGFjY291bnRJZCA+IDAgJiYgKDEgPT0gJGFjY291bnRJZCB8fCA0ID09ICRhY2NvdW50SWQpKQ0KCQkJew0KCQkJCSR1c2VySWQgPSBbW1tDb21wb25lbnRdXV1IZWxwZXI6OmdldFZhcignbWVtYmVyJywgJG1lbWJlcklkLCAnaWQnLCAndXNlcicpOw0KCQkJfQ0KCQkJJHF1ZXJ5LT53aGVyZSgkZGItPnF1b3RlTmFtZSgnaWQnKSAuICcgPD4gJyAuIChpbnQpICR1c2VySWQpOw0KDQoJCQkvLyBTZXQgYW5kIHF1ZXJ5IHRoZSBkYXRhYmFzZS4NCgkJCSRkYi0+c2V0UXVlcnkoJHF1ZXJ5KTsNCgkJCSRkdXBsaWNhdGUgPSAoYm9vbCkgJGRiLT5sb2FkUmVzdWx0KCk7DQoNCgkJCWlmICgkZHVwbGljYXRlKQ0KCQkJew0KCQkJCXJldHVybiBmYWxzZTsNCgkJCX0NCgkJfQ0KDQoJCXJldHVybiB0cnVlOw0KCX0=', 'Validate the member useremail', 1, '2018-09-16 00:43:44'), -(6, 'iban', 'CS8qKg0KCSogTWV0aG9kIHRvIGNoZWNrIGlmIElCQU4gaXMgdmFsaWQuDQoJKg0KCSogQHBhcmFtICAgXFNpbXBsZVhNTEVsZW1lbnQgICRlbGVtZW50ICBUaGUgU2ltcGxlWE1MRWxlbWVudCBvYmplY3QgcmVwcmVzZW50aW5nIHRoZSBgPGZpZWxkPmAgdGFnIGZvciB0aGUgZm9ybSBmaWVsZCBvYmplY3QuDQoJKiBAcGFyYW0gICBtaXhlZCAgICAgICAgICAgICAgJHZhbHVlICAgIFRoZSBmb3JtIGZpZWxkIHZhbHVlIHRvIHZhbGlkYXRlLg0KCSogQHBhcmFtICAgc3RyaW5nICAgICAgICAgICAgICRncm91cCAgICBUaGUgZmllbGQgbmFtZSBncm91cCBjb250cm9sIHZhbHVlLiBUaGlzIGFjdHMgYXMgYW4gYXJyYXkgY29udGFpbmVyIGZvciB0aGUgZmllbGQuDQoJKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZvciBleGFtcGxlIGlmIHRoZSBmaWVsZCBoYXMgbmFtZT0iZm9vIiBhbmQgdGhlIGdyb3VwIHZhbHVlIGlzIHNldCB0byAiYmFyIiB0aGVuIHRoZQ0KCSogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdWxsIGZpZWxkIG5hbWUgd291bGQgZW5kIHVwIGJlaW5nICJiYXJbZm9vXSIuDQoJKiBAcGFyYW0gICBSZWdpc3RyeSAgICAgICAgICAgJGlucHV0ICAgIEFuIG9wdGlvbmFsIFJlZ2lzdHJ5IG9iamVjdCB3aXRoIHRoZSBlbnRpcmUgZGF0YSBzZXQgdG8gdmFsaWRhdGUgYWdhaW5zdCB0aGUgZW50aXJlIGZvcm0uDQoJKiBAcGFyYW0gICBGb3JtICAgICAgICAgICAgICAgJGZvcm0gICAgIFRoZSBmb3JtIG9iamVjdCBmb3Igd2hpY2ggdGhlIGZpZWxkIGlzIGJlaW5nIHRlc3RlZC4NCgkqDQoJKiBAcmV0dXJuICBib29sZWFuICBUcnVlIGlmIHRoZSB2YWx1ZSBpcyB2YWxpZCwgZmFsc2Ugb3RoZXJ3aXNlLg0KCSoNCgkqIEBzaW5jZSAgIDMuOS4wDQoJKi8NCglwdWJsaWMgZnVuY3Rpb24gdGVzdChcU2ltcGxlWE1MRWxlbWVudCAkZWxlbWVudCwgJHZhbHVlLCAkZ3JvdXAgPSBudWxsLCBSZWdpc3RyeSAkaW5wdXQgPSBudWxsLCBGb3JtICRmb3JtID0gbnVsbCkNCgl7DQoJCSRjb3VudHJ5Q29kZU9mZnNldCA9IDA7IC8vIENPVU5UUllfQ09ERV9PRkZTRVQNCgkJJGNvdW50cnlDb2RlTGVuZ3RoID0gMjsgLy9DT1VOVFJZX0NPREVfTEVOR1RIDQoJCSRjaGVja3N1bU9mZnNldCA9IDI7IC8vQ0hFQ0tTVU1fT0ZGU0VUDQoJCSRjaGVja3N1bUxlbmd0aCA9IDI7IC8vQ0hFQ0tTVU1fTEVOR1RIDQoJCSRpbnN0aXR1dGVJZGVudGlmaWNhdGlvbk9mZnNldCA9IDQ7IC8vSU5TVElUVVRFX0lERU5USUZJQ0FUSU9OX09GRlNFVA0KDQoJCS8qKg0KCQkqIEB2YXIgYXJyYXkgQ291bnRyeSBjb2RlIHRvIHNpemUsIHJlZ2V4IGZvcm1hdCBmb3IgZWFjaCBjb3VudHJ5IHRoYXQgc3VwcG9ydHMgSUJBTg0KCQkqLw0KCQkkaWJhbkZvcm1hdE1hcCA9IGFycmF5KA0KCQkJJ0FBJyA9PiBhcnJheSgxMiwgJ15bQS1aMC05XXsxMn0kJyksDQoJCQknQUQnID0+IGFycmF5KDIwLCAnXlswLTldezR9WzAtOV17NH1bQS1aMC05XXsxMn0kJyksDQoJCQknQUUnID0+IGFycmF5KDE5LCAnXlswLTldezN9WzAtOV17MTZ9JCcpLA0KCQkJJ0FMJyA9PiBhcnJheSgyNCwgJ15bMC05XXs4fVtBLVowLTldezE2fSQnKSwNCgkJCSdBTycgPT4gYXJyYXkoMjEsICdeWzAtOV17MjF9JCcpLA0KCQkJJ0FUJyA9PiBhcnJheSgxNiwgJ15bMC05XXs1fVswLTldezExfSQnKSwNCgkJCSdBWCcgPT4gYXJyYXkoMTQsICdeWzAtOV17Nn1bMC05XXs3fVswLTldezF9JCcpLA0KCQkJJ0FaJyA9PiBhcnJheSgyNCwgJ15bQS1aXXs0fVtBLVowLTldezIwfSQnKSwNCgkJCSdCQScgPT4gYXJyYXkoMTYsICdeWzAtOV17M31bMC05XXszfVswLTldezh9WzAtOV17Mn0kJyksDQoJCQknQkUnID0+IGFycmF5KDEyLCAnXlswLTldezN9WzAtOV17N31bMC05XXsyfSQnKSwNCgkJCSdCRicgPT4gYXJyYXkoMjMsICdeWzAtOV17MjN9JCcpLA0KCQkJJ0JHJyA9PiBhcnJheSgxOCwgJ15bQS1aXXs0fVswLTldezR9WzAtOV17Mn1bQS1aMC05XXs4fSQnKSwNCgkJCSdCSCcgPT4gYXJyYXkoMTgsICdeW0EtWl17NH1bQS1aMC05XXsxNH0kJyksDQoJCQknQkknID0+IGFycmF5KDEyLCAnXlswLTldezEyfSQnKSwNCgkJCSdCSicgPT4gYXJyYXkoMjQsICdeW0EtWl17MX1bMC05XXsyM30kJyksDQoJCQknQkwnID0+IGFycmF5KDIzLCAnXlswLTldezV9WzAtOV17NX1bQS1aMC05XXsxMX1bMC05XXsyfSQnKSwNCgkJCSdCUicgPT4gYXJyYXkoMjUsICdeWzAtOV17OH1bMC05XXs1fVswLTldezEwfVtBLVpdezF9W0EtWjAtOV17MX0kJyksDQoJCQknQ0gnID0+IGFycmF5KDE3LCAnXlswLTldezV9W0EtWjAtOV17MTJ9JCcpLA0KCQkJJ0NJJyA9PiBhcnJheSgyNCwgJ15bQS1aXXsxfVswLTldezIzfSQnKSwNCgkJCSdDTScgPT4gYXJyYXkoMjMsICdeWzAtOV17MjN9JCcpLA0KCQkJJ0NSJyA9PiBhcnJheSgxNywgJ15bMC05XXs0fVswLTldezEzfSQnKSwNCgkJCSdDVicgPT4gYXJyYXkoMjEsICdeWzAtOV17MjF9JCcpLA0KCQkJJ0NZJyA9PiBhcnJheSgyNCwgJ15bMC05XXszfVswLTldezV9W0EtWjAtOV17MTZ9JCcpLA0KCQkJJ0NaJyA9PiBhcnJheSgyMCwgJ15bMC05XXs0fVswLTldezZ9WzAtOV17MTB9JCcpLA0KCQkJJ0RFJyA9PiBhcnJheSgxOCwgJ15bMC05XXs4fVswLTldezEwfSQnKSwNCgkJCSdESycgPT4gYXJyYXkoMTQsICdeWzAtOV17NH1bMC05XXs5fVswLTldezF9JCcpLA0KCQkJJ0RPJyA9PiBhcnJheSgyNCwgJ15bQS1aMC05XXs0fVswLTldezIwfSQnKSwNCgkJCSdEWicgPT4gYXJyYXkoMjAsICdeWzAtOV17MjB9JCcpLA0KCQkJJ0VFJyA9PiBhcnJheSgxNiwgJ15bMC05XXsyfVswLTldezJ9WzAtOV17MTF9WzAtOV17MX0kJyksDQoJCQknRVMnID0+IGFycmF5KDIwLCAnXlswLTldezR9WzAtOV17NH1bMC05XXsxfVswLTldezF9WzAtOV17MTB9JCcpLA0KCQkJJ0ZJJyA9PiBhcnJheSgxNCwgJ15bMC05XXs2fVswLTldezd9WzAtOV17MX0kJyksDQoJCQknRk8nID0+IGFycmF5KDE0LCAnXlswLTldezR9WzAtOV17OX1bMC05XXsxfSQnKSwNCgkJCSdGUicgPT4gYXJyYXkoMjMsICdeWzAtOV17NX1bMC05XXs1fVtBLVowLTldezExfVswLTldezJ9JCcpLA0KCQkJJ0dCJyA9PiBhcnJheSgxOCwgJ15bQS1aXXs0fVswLTldezZ9WzAtOV17OH0kJyksDQoJCQknR0UnID0+IGFycmF5KDE4LCAnXltBLVpdezJ9WzAtOV17MTZ9JCcpLA0KCQkJJ0dGJyA9PiBhcnJheSgyMywgJ15bMC05XXs1fVswLTldezV9W0EtWjAtOV17MTF9WzAtOV17Mn0kJyksDQoJCQknR0knID0+IGFycmF5KDE5LCAnXltBLVpdezR9W0EtWjAtOV17MTV9JCcpLA0KCQkJJ0dMJyA9PiBhcnJheSgxNCwgJ15bMC05XXs0fVswLTldezl9WzAtOV17MX0kJyksDQoJCQknR1AnID0+IGFycmF5KDIzLCAnXlswLTldezV9WzAtOV17NX1bQS1aMC05XXsxMX1bMC05XXsyfSQnKSwNCgkJCSdHUicgPT4gYXJyYXkoMjMsICdeWzAtOV17M31bMC05XXs0fVtBLVowLTldezE2fSQnKSwNCgkJCSdHVCcgPT4gYXJyYXkoMjQsICdeW0EtWjAtOV17NH1bQS1aMC05XXsyMH0kJyksDQoJCQknSFInID0+IGFycmF5KDE3LCAnXlswLTldezd9WzAtOV17MTB9JCcpLA0KCQkJJ0hVJyA9PiBhcnJheSgyNCwgJ15bMC05XXszfVswLTldezR9WzAtOV17MX1bMC05XXsxNX1bMC05XXsxfSQnKSwNCgkJCSdJRScgPT4gYXJyYXkoMTgsICdeW0EtWl17NH1bMC05XXs2fVswLTldezh9JCcpLA0KCQkJJ0lMJyA9PiBhcnJheSgxOSwgJ15bMC05XXszfVswLTldezN9WzAtOV17MTN9JCcpLA0KCQkJJ0lSJyA9PiBhcnJheSgyMiwgJ15bMC05XXsyMn0kJyksDQoJCQknSVMnID0+IGFycmF5KDIyLCAnXlswLTldezR9WzAtOV17Mn1bMC05XXs2fVswLTldezEwfSQnKSwNCgkJCSdJVCcgPT4gYXJyYXkoMjMsICdeW0EtWl17MX1bMC05XXs1fVswLTldezV9W0EtWjAtOV17MTJ9JCcpLA0KCQkJJ0pPJyA9PiBhcnJheSgyNiwgJ15bQS1aXXs0fVswLTldezR9W0EtWjAtOV17MTh9JCcpLA0KCQkJJ0tXJyA9PiBhcnJheSgyNiwgJ15bQS1aXXs0fVtBLVowLTldezIyfSQnKSwNCgkJCSdLWicgPT4gYXJyYXkoMTYsICdeWzAtOV17M31bQS1aMC05XXsxM30kJyksDQoJCQknTEInID0+IGFycmF5KDI0LCAnXlswLTldezR9W0EtWjAtOV17MjB9JCcpLA0KCQkJJ0xDJyA9PiBhcnJheSgyOCwgJ15bQS1aXXs0fVtBLVowLTldezI0fSQnKSwNCgkJCSdMSScgPT4gYXJyYXkoMTcsICdeWzAtOV17NX1bQS1aMC05XXsxMn0kJyksDQoJCQknTFQnID0+IGFycmF5KDE2LCAnXlswLTldezV9WzAtOV17MTF9JCcpLA0KCQkJJ0xVJyA9PiBhcnJheSgxNiwgJ15bMC05XXszfVtBLVowLTldezEzfSQnKSwNCgkJCSdMVicgPT4gYXJyYXkoMTcsICdeW0EtWl17NH1bQS1aMC05XXsxM30kJyksDQoJCQknTUMnID0+IGFycmF5KDIzLCAnXlswLTldezV9WzAtOV17NX1bQS1aMC05XXsxMX1bMC05XXsyfSQnKSwNCgkJCSdNRCcgPT4gYXJyYXkoMjAsICdeW0EtWjAtOV17Mn1bQS1aMC05XXsxOH0kJyksDQoJCQknTUUnID0+IGFycmF5KDE4LCAnXlswLTldezN9WzAtOV17MTN9WzAtOV17Mn0kJyksDQoJCQknTUYnID0+IGFycmF5KDIzLCAnXlswLTldezV9WzAtOV17NX1bQS1aMC05XXsxMX1bMC05XXsyfSQnKSwNCgkJCSdNRycgPT4gYXJyYXkoMjMsICdeWzAtOV17MjN9JCcpLA0KCQkJJ01LJyA9PiBhcnJheSgxNSwgJ15bMC05XXszfVtBLVowLTldezEwfVswLTldezJ9JCcpLA0KCQkJJ01MJyA9PiBhcnJheSgyNCwgJ15bQS1aXXsxfVswLTldezIzfSQnKSwNCgkJCSdNUScgPT4gYXJyYXkoMjMsICdeWzAtOV17NX1bMC05XXs1fVtBLVowLTldezExfVswLTldezJ9JCcpLA0KCQkJJ01SJyA9PiBhcnJheSgyMywgJ15bMC05XXs1fVswLTldezV9WzAtOV17MTF9WzAtOV17Mn0kJyksDQoJCQknTVQnID0+IGFycmF5KDI3LCAnXltBLVpdezR9WzAtOV17NX1bQS1aMC05XXsxOH0kJyksDQoJCQknTVUnID0+IGFycmF5KDI2LCAnXltBLVpdezR9WzAtOV17Mn1bMC05XXsyfVswLTldezEyfVswLTldezN9W0EtWl17M30kJyksDQoJCQknTVonID0+IGFycmF5KDIxLCAnXlswLTldezIxfSQnKSwNCgkJCSdOQycgPT4gYXJyYXkoMjMsICdeWzAtOV17NX1bMC05XXs1fVtBLVowLTldezExfVswLTldezJ9JCcpLA0KCQkJJ05MJyA9PiBhcnJheSgxNCwgJ15bQS1aXXs0fVswLTldezEwfSQnKSwNCgkJCSdOTycgPT4gYXJyYXkoMTEsICdeWzAtOV17NH1bMC05XXs2fVswLTldezF9JCcpLA0KCQkJJ1BGJyA9PiBhcnJheSgyMywgJ15bMC05XXs1fVswLTldezV9W0EtWjAtOV17MTF9WzAtOV17Mn0kJyksDQoJCQknUEsnID0+IGFycmF5KDIwLCAnXltBLVpdezR9W0EtWjAtOV17MTZ9JCcpLA0KCQkJJ1BMJyA9PiBhcnJheSgyNCwgJ15bMC05XXs4fVswLTldezE2fSQnKSwNCgkJCSdQTScgPT4gYXJyYXkoMjMsICdeWzAtOV17NX1bMC05XXs1fVtBLVowLTldezExfVswLTldezJ9JCcpLA0KCQkJJ1BTJyA9PiBhcnJheSgyNSwgJ15bQS1aXXs0fVtBLVowLTldezIxfSQnKSwNCgkJCSdQVCcgPT4gYXJyYXkoMjEsICdeWzAtOV17NH1bMC05XXs0fVswLTldezExfVswLTldezJ9JCcpLA0KCQkJJ1FBJyA9PiBhcnJheSgyNSwgJ15bQS1aXXs0fVswLTldezR9W0EtWjAtOV17MTd9JCcpLA0KCQkJJ1JFJyA9PiBhcnJheSgyMywgJ15bMC05XXs1fVswLTldezV9W0EtWjAtOV17MTF9WzAtOV17Mn0kJyksDQoJCQknUk8nID0+IGFycmF5KDIwLCAnXltBLVpdezR9W0EtWjAtOV17MTZ9JCcpLA0KCQkJJ1JTJyA9PiBhcnJheSgxOCwgJ15bMC05XXszfVswLTldezEzfVswLTldezJ9JCcpLA0KCQkJJ1NBJyA9PiBhcnJheSgyMCwgJ15bMC05XXsyfVtBLVowLTldezE4fSQnKSwNCgkJCSdTQycgPT4gYXJyYXkoMjcsICdeW0EtWl17NH1bMC05XXs0fVswLTldezE2fVtBLVpdezN9JCcpLA0KCQkJJ1NFJyA9PiBhcnJheSgyMCwgJ15bMC05XXszfVswLTldezE2fVswLTldezF9JCcpLA0KCQkJJ1NJJyA9PiBhcnJheSgxNSwgJ15bMC05XXs1fVswLTldezh9WzAtOV17Mn0kJyksDQoJCQknU0snID0+IGFycmF5KDIwLCAnXlswLTldezR9WzAtOV17Nn1bMC05XXsxMH0kJyksDQoJCQknU00nID0+IGFycmF5KDIzLCAnXltBLVpdezF9WzAtOV17NX1bMC05XXs1fVtBLVowLTldezEyfSQnKSwNCgkJCSdTTicgPT4gYXJyYXkoMjQsICdeW0EtWl17MX1bMC05XXsyM30kJyksDQoJCQknU1QnID0+IGFycmF5KDIxLCAnXlswLTldezh9WzAtOV17MTF9WzAtOV17Mn0kJyksDQoJCQknVEYnID0+IGFycmF5KDIzLCAnXlswLTldezV9WzAtOV17NX1bQS1aMC05XXsxMX1bMC05XXsyfSQnKSwNCgkJCSdUTCcgPT4gYXJyYXkoMTksICdeWzAtOV17M31bMC05XXsxNH1bMC05XXsyfSQnKSwNCgkJCSdUTicgPT4gYXJyYXkoMjAsICdeWzAtOV17Mn1bMC05XXszfVswLTldezEzfVswLTldezJ9JCcpLA0KCQkJJ1RSJyA9PiBhcnJheSgyMiwgJ15bMC05XXs1fVswLTldezF9W0EtWjAtOV17MTZ9JCcpLA0KCQkJJ1VBJyA9PiBhcnJheSgyNSwgJ15bMC05XXs2fVtBLVowLTldezE5fSQnKSwNCgkJCSdWRycgPT4gYXJyYXkoMjAsICdeW0EtWl17NH1bMC05XXsxNn0kJyksDQoJCQknV0YnID0+IGFycmF5KDIzLCAnXlswLTldezV9WzAtOV17NX1bQS1aMC05XXsxMX1bMC05XXsyfSQnKSwNCgkJCSdYSycgPT4gYXJyYXkoMTYsICdeWzAtOV17NH1bMC05XXsxMH1bMC05XXsyfSQnKSwNCgkJCSdZVCcgPT4gYXJyYXkoMjMsICdeWzAtOV17NX1bMC05XXs1fVtBLVowLTldezExfVswLTldezJ9JCcpDQoJCSk7DQoNCgkJLy8gQ0xFQU4gVVAgSUJBTg0KCQkkaWJhbiA9IHByZWdfcmVwbGFjZSgnL1teYS16MC05XSsvaScsICcnLCB0cmltKHN0cnRvdXBwZXIoJHZhbHVlKSkpOw0KDQoJCS8vIENIRUNLIENvdW50cnkgQ29kZQ0KCQkkY291bnRyeUNvZGUgPSBzdWJzdHIoJGliYW4sICRjb3VudHJ5Q29kZU9mZnNldCwgJGNvdW50cnlDb2RlTGVuZ3RoKTsNCgkJJGlzQ291bnRyeUNvZGVWYWxpZCA9ICEoaXNzZXQoJGliYW5Gb3JtYXRNYXBbJGNvdW50cnlDb2RlXSkgPT09IGZhbHNlKTsNCg0KCQkkdmFsaWRMZW5ndGggPSAkY291bnRyeUNvZGVMZW5ndGggKyAkY2hlY2tzdW1MZW5ndGggKyAkaWJhbkZvcm1hdE1hcFskY291bnRyeUNvZGVdWzBdOw0KCQkkaXNMZW5ndGhWYWxpZCA9IHN0cmxlbigkaWJhbikgPT09ICR2YWxpZExlbmd0aDsNCg0KCQkkYWNjb3VudElkZW50aWZpY2F0aW9uID0gc3Vic3RyKCRpYmFuLCAkaW5zdGl0dXRlSWRlbnRpZmljYXRpb25PZmZzZXQpOw0KCQkkaXNGb3JtYXRWYWxpZCA9ICEocHJlZ19tYXRjaCgnLycgLiAkaWJhbkZvcm1hdE1hcFskY291bnRyeUNvZGVdWzFdIC4gJy8nLCAkYWNjb3VudElkZW50aWZpY2F0aW9uKSAhPT0gMSk7DQoNCgkJJGNoZWNrc3VtID0gc3Vic3RyKCRpYmFuLCAkY2hlY2tzdW1PZmZzZXQsICRjaGVja3N1bUxlbmd0aCk7DQoJCSRhY2NvdW50SWRlbnRpZmljYXRpb24gPSBzdWJzdHIoJGliYW4sICRpbnN0aXR1dGVJZGVudGlmaWNhdGlvbk9mZnNldCk7DQoNCgkJLy8gR0VUIE5VTUVSSUMgQ09VTlRSWSBDT0RFDQoJCSRudW1lcmljUmVwcmVzZW50YXRpb24gPSAnJzsNCgkJJGxldHRlclJlcHJlc2VudGF0aW9uID0gJGNvdW50cnlDb2RlOw0KCQlmb3JlYWNoIChzdHJfc3BsaXQoJGxldHRlclJlcHJlc2VudGF0aW9uKSBhcyAkY2hhcikNCgkJew0KCQkJJG9yZCA9IG9yZCgkY2hhcik7DQoJCQlpZiAoJG9yZCA+PSA2NSAmJiAkb3JkIDw9IDkwKQ0KCQkJew0KCQkJCSRudW1lcmljUmVwcmVzZW50YXRpb24gLj0gKHN0cmluZykgKCRvcmQgLSA1NSk7DQoJCQl9DQoJCQllbHNlaWYgKCRvcmQgPj0gNDggJiYgJG9yZCA8PSA1NykNCgkJCXsNCgkJCQkkbnVtZXJpY1JlcHJlc2VudGF0aW9uIC49IChzdHJpbmcpICgkb3JkIC0gNDgpOw0KCQkJfQ0KCQl9DQoJCSRudW1lcmljQ291bnRyeUNvZGUgPSAkbnVtZXJpY1JlcHJlc2VudGF0aW9uOw0KDQoJCSRudW1lcmljUmVwcmVzZW50YXRpb24gPSAnJzsNCgkJJGxldHRlclJlcHJlc2VudGF0aW9uID0gJGFjY291bnRJZGVudGlmaWNhdGlvbjsNCgkJZm9yZWFjaCAoc3RyX3NwbGl0KCRsZXR0ZXJSZXByZXNlbnRhdGlvbikgYXMgJGNoYXIpDQoJCXsNCgkJCSRvcmQgPSBvcmQoJGNoYXIpOw0KCQkJaWYgKCRvcmQgPj0gNjUgJiYgJG9yZCA8PSA5MCkNCgkJCXsNCgkJCQkkbnVtZXJpY1JlcHJlc2VudGF0aW9uIC49IChzdHJpbmcpICgkb3JkIC0gNTUpOw0KCQkJfQ0KCQkJZWxzZWlmICgkb3JkID49IDQ4ICYmICRvcmQgPD0gNTcpDQoJCQl7DQoJCQkJJG51bWVyaWNSZXByZXNlbnRhdGlvbiAuPSAoc3RyaW5nKSAoJG9yZCAtIDQ4KTsNCgkJCX0NCgkJfQ0KCQkkbnVtZXJpY0FjY291bnRJZGVudGlmaWNhdGlvbiA9ICRudW1lcmljUmVwcmVzZW50YXRpb247DQoJCSRpbnZlcnRlZEliYW4gPSAkbnVtZXJpY0FjY291bnRJZGVudGlmaWNhdGlvbiAuICRudW1lcmljQ291bnRyeUNvZGUgLiAkY2hlY2tzdW07DQoNCgkJLy8gQ0hFQ0tTVU0gQkNNT0QNCgkJJHggPSAkaW52ZXJ0ZWRJYmFuOw0KCQkkeSA9IDk3Ow0KCQlpZiAoIWZ1bmN0aW9uX2V4aXN0cygnYmNtb2QnKSkNCgkJew0KCQkJJHRha2UgPSA1Ow0KCQkJJG1vZCA9ICcnOw0KCQkJZG8gew0KCQkJCSRhID0gKGludCkkbW9kIC4gc3Vic3RyKCR4LCAwLCAkdGFrZSk7DQoJCQkJJHggPSBzdWJzdHIoJHgsICR0YWtlKTsNCgkJCQkkbW9kID0gJGEgJSAkeTsNCgkJCX0gd2hpbGUgKHN0cmxlbigkeCkpOw0KCQkJJGJjbW9kID0gKHN0cmluZykkbW9kOw0KCQl9DQoJCWVsc2UNCgkJew0KCQkJJGJjbW9kID0gYmNtb2QoJHgsICR5KTsNCgkJfQ0KDQoJCSRpc0NoZWNrc3VtVmFsaWQgPSAkYmNtb2QgPT09ICcxJzsNCg0KCQlpZiAoISRpc0NvdW50cnlDb2RlVmFsaWQgfHwgISRpc0xlbmd0aFZhbGlkIHx8ICEkaXNGb3JtYXRWYWxpZCB8fCAhJGlzQ2hlY2tzdW1WYWxpZCkNCgkJew0KCQkJcmV0dXJuIGZhbHNlOw0KCQl9DQoJCWVsc2UNCgkJew0KCQkgICAgcmV0dXJuIHRydWU7DQoJCX0NCgl9', 'IBAN validation', 1, '2019-02-12 23:14:43'); +INSERT INTO `#__componentbuilder_validation_rule` (`id`, `name`, `php`, `short_description`, `published`, `created`, `params`) VALUES +(1, 'inspect', 'CS8qKg0KCSAqIE1ldGhvZCB0byB0ZXN0IHRoZSB2YWx1ZS4NCgkgKg0KCSAqIEBwYXJhbSAgIFxTaW1wbGVYTUxFbGVtZW50ICAkZWxlbWVudCAgVGhlIFNpbXBsZVhNTEVsZW1lbnQgb2JqZWN0IHJlcHJlc2VudGluZyB0aGUgYDxmaWVsZD5gIHRhZyBmb3IgdGhlIGZvcm0gZmllbGQgb2JqZWN0Lg0KCSAqIEBwYXJhbSAgIG1peGVkICAgICAgICAgICAgICAkdmFsdWUgICAgVGhlIGZvcm0gZmllbGQgdmFsdWUgdG8gdmFsaWRhdGUuDQoJICogQHBhcmFtICAgc3RyaW5nICAgICAgICAgICAgICRncm91cCAgICBUaGUgZmllbGQgbmFtZSBncm91cCBjb250cm9sIHZhbHVlLiBUaGlzIGFjdHMgYXMgYW4gYXJyYXkgY29udGFpbmVyIGZvciB0aGUgZmllbGQuDQoJICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGb3IgZXhhbXBsZSBpZiB0aGUgZmllbGQgaGFzIG5hbWU9ImZvbyIgYW5kIHRoZSBncm91cCB2YWx1ZSBpcyBzZXQgdG8gImJhciIgdGhlbiB0aGUNCgkgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGwgZmllbGQgbmFtZSB3b3VsZCBlbmQgdXAgYmVpbmcgImJhcltmb29dIi4NCgkgKiBAcGFyYW0gICBSZWdpc3RyeSAgICAgICAgICAgJGlucHV0ICAgIEFuIG9wdGlvbmFsIFJlZ2lzdHJ5IG9iamVjdCB3aXRoIHRoZSBlbnRpcmUgZGF0YSBzZXQgdG8gdmFsaWRhdGUgYWdhaW5zdCB0aGUgZW50aXJlIGZvcm0uDQoJICogQHBhcmFtICAgRm9ybSAgICAgICAgICAgICAgICRmb3JtICAgICBUaGUgZm9ybSBvYmplY3QgZm9yIHdoaWNoIHRoZSBmaWVsZCBpcyBiZWluZyB0ZXN0ZWQuDQoJICoNCgkgKiBAcmV0dXJuICBib29sZWFuICBUcnVlIGlmIHRoZSB2YWx1ZSBpcyB2YWxpZCwgZmFsc2Ugb3RoZXJ3aXNlLg0KCSAqDQoJICogQHNpbmNlICAgMTEuMQ0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiB0ZXN0KFxTaW1wbGVYTUxFbGVtZW50ICRlbGVtZW50LCAkdmFsdWUsICRncm91cCA9IG51bGwsIFJlZ2lzdHJ5ICRpbnB1dCA9IG51bGwsIEZvcm0gJGZvcm0gPSBudWxsKQ0KCXsNCgkJLy8gbG9vayBpbnRvIHRoZXNlIHZhbHVlcyBvbmUgYXQgYSB0aW1lDQoJCWVjaG8gJzxwcmU+ZWxlbWVudDxiciAvPic7DQoJCXZhcl9kdW1wKCRlbGVtZW50KTsNCgkJZWNobyAndmFsdWU8YnIgLz4nOw0KCQl2YXJfZHVtcCgkdmFsdWUpOw0KCQllY2hvICdncm91cDxiciAvPic7DQoJCXZhcl9kdW1wKCRncm91cCk7DQoJCWVjaG8gJ2lucHV0PGJyIC8+JzsNCgkJdmFyX2R1bXAoJGlucHV0KTsNCgkJZWNobyAnZm9ybTxiciAvPic7DQoJCXZhcl9kdW1wKCRmb3JtKTsNCgkJamV4aXQoKTsNCgl9', 'simple function to inspect the test values', 1, '2018-03-30 09:22:15', ''), +(2, 'code', 'CS8qKg0KCSAqIE1ldGhvZCB0byB0ZXN0IHRoZSB2YWx1ZS4NCgkgKg0KCSAqIEBwYXJhbSAgIFxTaW1wbGVYTUxFbGVtZW50ICAkZWxlbWVudCAgVGhlIFNpbXBsZVhNTEVsZW1lbnQgb2JqZWN0IHJlcHJlc2VudGluZyB0aGUgYDxmaWVsZD5gIHRhZyBmb3IgdGhlIGZvcm0gZmllbGQgb2JqZWN0Lg0KCSAqIEBwYXJhbSAgIG1peGVkICAgICAgICAgICAgICAkdmFsdWUgICAgVGhlIGZvcm0gZmllbGQgdmFsdWUgdG8gdmFsaWRhdGUuDQoJICogQHBhcmFtICAgc3RyaW5nICAgICAgICAgICAgICRncm91cCAgICBUaGUgZmllbGQgbmFtZSBncm91cCBjb250cm9sIHZhbHVlLiBUaGlzIGFjdHMgYXMgYW4gYXJyYXkgY29udGFpbmVyIGZvciB0aGUgZmllbGQuDQoJICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGb3IgZXhhbXBsZSBpZiB0aGUgZmllbGQgaGFzIG5hbWU9ImZvbyIgYW5kIHRoZSBncm91cCB2YWx1ZSBpcyBzZXQgdG8gImJhciIgdGhlbiB0aGUNCgkgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGwgZmllbGQgbmFtZSB3b3VsZCBlbmQgdXAgYmVpbmcgImJhcltmb29dIi4NCgkgKiBAcGFyYW0gICBSZWdpc3RyeSAgICAgICAgICAgJGlucHV0ICAgIEFuIG9wdGlvbmFsIFJlZ2lzdHJ5IG9iamVjdCB3aXRoIHRoZSBlbnRpcmUgZGF0YSBzZXQgdG8gdmFsaWRhdGUgYWdhaW5zdCB0aGUgZW50aXJlIGZvcm0uDQoJICogQHBhcmFtICAgRm9ybSAgICAgICAgICAgICAgICRmb3JtICAgICBUaGUgZm9ybSBvYmplY3QgZm9yIHdoaWNoIHRoZSBmaWVsZCBpcyBiZWluZyB0ZXN0ZWQuDQoJICoNCgkgKiBAcmV0dXJuICBib29sZWFuICBUcnVlIGlmIHRoZSB2YWx1ZSBpcyB2YWxpZCwgZmFsc2Ugb3RoZXJ3aXNlLg0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiB0ZXN0KFxTaW1wbGVYTUxFbGVtZW50ICRlbGVtZW50LCAkdmFsdWUsICRncm91cCA9IG51bGwsIFJlZ2lzdHJ5ICRpbnB1dCA9IG51bGwsIEZvcm0gJGZvcm0gPSBudWxsKQ0KCXsNCgkJLy8gVGhpcyByZW1vdmVzIGFsbCB2YWxpZGF0aW9uIChpcyBkYW5nZXJvdXMpIGJ1dCBuZWVkZWQgdG8gc3VibWl0IGNvZGUgdmlhIEpDQg0KCQlyZXR1cm4gdHJ1ZTsNCg0KCQkvKioNCgkJICogTXkgaWRlYSBpcyB0byBhZGQgc29tZSBraW5kIG9mIHZhbGlkYXRpb24gdG8gaW1wcm92ZSBKQ0IgY29kZSAocGVyL2xhbmd1YWdlKQ0KCQkgKg0KCQkgKiBTbyBhdCB0aGlzIHRpbWUgdGhpcyBjb2RlIHZhbGlkYXRpb24gaXMgdXNlZCBmb3IgSmF2YVNjcmlwdCxDU1MsSFRNTCBhbmQgUEhQLg0KCQkgKiBXZSBjYW4gc2VlIHdoYXQgbGFuZ3VhZ2UgaXMgYmVpbmcgd29ya2VkIG9uIHdpdGggdGhlIHN5bnRheCBwcm9wZXJ0eSBpbiB0aGUgJGVsZW1lbnQuIChpbiBKQ0IpDQoJCSAqIFdoYXQgY29tcGxpY2F0ZXMgdGhpbmdzIGlzIHRoZSBwbGFjZWhvbGRlcnMsIG9mIGJvdGggY3VzdG9tIGNvZGUsIGNvbXBvbmVudCwgYW5kIHZpZXcgbmFtZXMuDQoJCSAqIElkZWFsbHkgd2UgY291bGQgc3RyaXAgdGhlbSBhbmQgdGhlbiB2YWxpZGF0ZSB0aGUgY29kZSB0byBiZWluZyBzeW50YWN0aWNhbGx5IGNvcnJlY3QuDQoJCSAqIEJ1dCBzaW5jZSBzb21lIG9mIHRoZSBwbGFjZWhvbGRlcnMgZm9ybSBwYXJ0IG9mIHRoZSBjbGFzcy9mdW5jdGlvbiBuYW1lcyBhbmQgdGhlIG1vcmUsIGl0IHNlZW1zIGxpa2Ugd2UgYXJlIHByZXNzZWQgZm9yIGEgbXVjaCBtb3JlIGFkdmFuY2Ugc29sdXRpb24uDQoJCSAqIElmIHlvdSBoYXZlIGFueSBpZGVhcyB0byBob3cgd2UgY2FuIGdvIGFib3V0IHRvIGRvIHRoaXMsIHRoZW4gcGxlYXNlIG9wZW4gYW4gaXNzdWUgb24gZ2l0aHViIGFuZCBsZXRzIGJlZ2luLiAodGhpcyBpcyBhIG5pY2UgdG8gaGF2ZSwgc28gZG9uJ3QgYnJlYWsgYSBsZWcuLi4pDQoJCSAqLw0KCX0=', 'To validate code', 1, '2018-06-24 19:11:45', ''), +(3, 'uniquefield', 'CS8qKg0KCSAqIE1ldGhvZCB0byB0ZXN0IHRoZSBmaWVsZCB2YWx1ZSBmb3IgdW5pcXVlbmVzcy4NCgkgKg0KCSAqIEBwYXJhbSAgIFxTaW1wbGVYTUxFbGVtZW50ICAkZWxlbWVudCAgVGhlIFNpbXBsZVhNTEVsZW1lbnQgb2JqZWN0IHJlcHJlc2VudGluZyB0aGUgYDxmaWVsZD5gIHRhZyBmb3IgdGhlIGZvcm0gZmllbGQgb2JqZWN0Lg0KCSAqIEBwYXJhbSAgIG1peGVkICAgICAgICAgICAgICAkdmFsdWUgICAgVGhlIGZvcm0gZmllbGQgdmFsdWUgdG8gdmFsaWRhdGUuDQoJICogQHBhcmFtICAgc3RyaW5nICAgICAgICAgICAgICRncm91cCAgICBUaGUgZmllbGQgbmFtZSBncm91cCBjb250cm9sIHZhbHVlLiBUaGlzIGFjdHMgYXMgYW4gYXJyYXkgY29udGFpbmVyIGZvciB0aGUgZmllbGQuDQoJICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGb3IgZXhhbXBsZSBpZiB0aGUgZmllbGQgaGFzIG5hbWU9ImZvbyIgYW5kIHRoZSBncm91cCB2YWx1ZSBpcyBzZXQgdG8gImJhciIgdGhlbiB0aGUNCgkgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGwgZmllbGQgbmFtZSB3b3VsZCBlbmQgdXAgYmVpbmcgImJhcltmb29dIi4NCgkgKiBAcGFyYW0gICBSZWdpc3RyeSAgICAgICAgICAgJGlucHV0ICAgIEFuIG9wdGlvbmFsIFJlZ2lzdHJ5IG9iamVjdCB3aXRoIHRoZSBlbnRpcmUgZGF0YSBzZXQgdG8gdmFsaWRhdGUgYWdhaW5zdCB0aGUgZW50aXJlIGZvcm0uDQoJICogQHBhcmFtICAgRm9ybSAgICAgICAgICAgICAgICRmb3JtICAgICBUaGUgZm9ybSBvYmplY3QgZm9yIHdoaWNoIHRoZSBmaWVsZCBpcyBiZWluZyB0ZXN0ZWQuDQoJICoNCgkgKiBAcmV0dXJuICBib29sZWFuICBUcnVlIGlmIHRoZSB2YWx1ZSBpcyB2YWxpZCwgZmFsc2Ugb3RoZXJ3aXNlLg0KCSAqDQoJICogQHNpbmNlICAgMTEuMQ0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiB0ZXN0KFxTaW1wbGVYTUxFbGVtZW50ICRlbGVtZW50LCAkdmFsdWUsICRncm91cCA9IG51bGwsIFJlZ2lzdHJ5ICRpbnB1dCA9IG51bGwsIEZvcm0gJGZvcm0gPSBudWxsKQ0KCXsNCgkJLy8gR2V0IHRoZSBkYXRhYmFzZSBvYmplY3QgYW5kIGEgbmV3IHF1ZXJ5IG9iamVjdC4NCgkJJGRiID0gRmFjdG9yeTo6Z2V0RGJvKCk7DQoJCSRxdWVyeSA9ICRkYi0+Z2V0UXVlcnkodHJ1ZSk7DQoNCgkJLy8gR2V0IHRoZSBleHRyYSBmaWVsZCBjaGVjayBhdHRyaWJ1dGUuDQoJCSRpZCA9ICgkaW5wdXQgaW5zdGFuY2VvZiBSZWdpc3RyeSkgPyAkaW5wdXQtPmdldCgnaWQnLCBudWxsKSA6IG51bGw7DQoNCgkJLy8gZ2V0IHRoZSBjb21wb25lbnQgJiB0YWJsZSBuYW1lDQoJCSR0YWJsZSA9ICgkZm9ybSBpbnN0YW5jZW9mIEZvcm0pID8gJGZvcm0tPmdldE5hbWUoKSA6ICcnOw0KDQoJCS8vIGdldCB0aGUgY29sdW1uIG5hbWUNCgkJJG5hbWUgPSAoYXJyYXkpICRlbGVtZW50LT5hdHRyaWJ1dGVzKCktPnsnbmFtZSd9Ow0KCQkkY29sdW1uID0gKHN0cmluZykgdHJpbSgkbmFtZVswXSk7DQoJCQ0KCQkvLyBjaGVjayB0aGF0IHdlIGhhdmUgYSB2YWx1ZQ0KCQlpZiAoc3RybGVuKCR2YWx1ZSkgJiYgc3RybGVuKCR0YWJsZSkgPiAzICYmIHN0cnBvcygkdGFibGUsICdbW1tjb21wb25lbnRdXV0uJykgIT09IGZhbHNlKQ0KCQl7DQoJCQkvLyBub3cgZ2V0IHRoZSB0YWJsZSBuYW1lDQoJCQkkdGFibGVBcnJheSA9IGV4cGxvZGUoJy4nLCAkdGFibGUpOw0KCQkJLy8gZG8gd2UgaGF2ZSB0d28gdmFsdWVzDQoJCQlpZiAoY291bnQoIChhcnJheSkgJHRhYmxlQXJyYXkpID09IDIpDQoJCQl7DQoJCQkJLy8gQnVpbGQgdGhlIHF1ZXJ5Lg0KCQkJCSRxdWVyeS0+c2VsZWN0KCdDT1VOVCgqKScpDQoJCQkJCS0+ZnJvbSgnI19fW1tbY29tcG9uZW50XV1dXycgLiAoc3RyaW5nKSAkdGFibGVBcnJheVsxXSkNCgkJCQkJLT53aGVyZSgkZGItPnF1b3RlTmFtZSgkY29sdW1uKSAuICcgPSAnIC4gJGRiLT5xdW90ZSgkdmFsdWUpKTsNCg0KCQkJCS8vIHJlbW92ZSB0aGlzIGl0ZW0gZnJvbSB0aGUgbGlzdA0KCQkJCWlmICgkaWQgPiAwKQ0KCQkJCXsNCgkJCQkJJHF1ZXJ5LT53aGVyZSgkZGItPnF1b3RlTmFtZSgnaWQnKSAuICcgPD4gJyAuIChpbnQpICRpZCk7DQoJCQkJfQ0KDQoJCQkJLy8gU2V0IGFuZCBxdWVyeSB0aGUgZGF0YWJhc2UuDQoJCQkJJGRiLT5zZXRRdWVyeSgkcXVlcnkpOw0KCQkJCSRkdXBsaWNhdGUgPSAoYm9vbCkgJGRiLT5sb2FkUmVzdWx0KCk7DQoNCgkJCQlpZiAoJGR1cGxpY2F0ZSkNCgkJCQl7DQoJCQkJCXJldHVybiBmYWxzZTsNCgkJCQl9DQoJCQl9DQoJCX0NCg0KCQlyZXR1cm4gdHJ1ZTsNCgl9', 'unique field value', 1, '2018-07-21 06:06:42', ''), +(4, 'memberloginname', 'CS8qKg0KCSAqIE1ldGhvZCB0byB0ZXN0IHRoZSB1c2VybmFtZSBmb3IgdW5pcXVlbmVzcy4NCgkgKg0KCSAqIEBwYXJhbSAgIFxTaW1wbGVYTUxFbGVtZW50ICAkZWxlbWVudCAgVGhlIFNpbXBsZVhNTEVsZW1lbnQgb2JqZWN0IHJlcHJlc2VudGluZyB0aGUgYDxmaWVsZD5gIHRhZyBmb3IgdGhlIGZvcm0gZmllbGQgb2JqZWN0Lg0KCSAqIEBwYXJhbSAgIG1peGVkICAgICAgICAgICAgICAkdmFsdWUgICAgVGhlIGZvcm0gZmllbGQgdmFsdWUgdG8gdmFsaWRhdGUuDQoJICogQHBhcmFtICAgc3RyaW5nICAgICAgICAgICAgICRncm91cCAgICBUaGUgZmllbGQgbmFtZSBncm91cCBjb250cm9sIHZhbHVlLiBUaGlzIGFjdHMgYXMgYW4gYXJyYXkgY29udGFpbmVyIGZvciB0aGUgZmllbGQuDQoJICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGb3IgZXhhbXBsZSBpZiB0aGUgZmllbGQgaGFzIG5hbWU9ImZvbyIgYW5kIHRoZSBncm91cCB2YWx1ZSBpcyBzZXQgdG8gImJhciIgdGhlbiB0aGUNCgkgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGwgZmllbGQgbmFtZSB3b3VsZCBlbmQgdXAgYmVpbmcgImJhcltmb29dIi4NCgkgKiBAcGFyYW0gICBSZWdpc3RyeSAgICAgICAgICAgJGlucHV0ICAgIEFuIG9wdGlvbmFsIFJlZ2lzdHJ5IG9iamVjdCB3aXRoIHRoZSBlbnRpcmUgZGF0YSBzZXQgdG8gdmFsaWRhdGUgYWdhaW5zdCB0aGUgZW50aXJlIGZvcm0uDQoJICogQHBhcmFtICAgRm9ybSAgICAgICAgICAgICAgICRmb3JtICAgICBUaGUgZm9ybSBvYmplY3QgZm9yIHdoaWNoIHRoZSBmaWVsZCBpcyBiZWluZyB0ZXN0ZWQuDQoJICoNCgkgKiBAcmV0dXJuICBib29sZWFuICBUcnVlIGlmIHRoZSB2YWx1ZSBpcyB2YWxpZCwgZmFsc2Ugb3RoZXJ3aXNlLg0KCSAqDQoJICogQHNpbmNlICAgMTEuMQ0KCSAqLw0KCXB1YmxpYyBmdW5jdGlvbiB0ZXN0KFxTaW1wbGVYTUxFbGVtZW50ICRlbGVtZW50LCAkdmFsdWUsICRncm91cCA9IG51bGwsIFJlZ2lzdHJ5ICRpbnB1dCA9IG51bGwsIEZvcm0gJGZvcm0gPSBudWxsKQ0KCXsNCgkJLy8gR2V0IHRoZSBkYXRhYmFzZSBvYmplY3QgYW5kIGEgbmV3IHF1ZXJ5IG9iamVjdC4NCgkJJGRiID0gRmFjdG9yeTo6Z2V0RGJvKCk7DQoJCSRxdWVyeSA9ICRkYi0+Z2V0UXVlcnkodHJ1ZSk7DQoNCgkJLy8gQnVpbGQgdGhlIHF1ZXJ5Lg0KCQkkcXVlcnktPnNlbGVjdCgnQ09VTlQoKiknKQ0KCQkJLT5mcm9tKCcjX191c2VycycpDQoJCQktPndoZXJlKCd1c2VybmFtZSA9ICcgLiAkZGItPnF1b3RlKCR2YWx1ZSkpOw0KDQoJCS8vIEdldCB0aGUgdXNlciBJRCBpZiBzZXQuDQoJCSR1c2VySWQgPSAoJGZvcm0gaW5zdGFuY2VvZiBGb3JtICYmICgkdXNlcklkID0gJGZvcm0tPmdldFZhbHVlKCd1c2VyJykpKSA/ICR1c2VySWQgOiAoKCRpbnB1dCBpbnN0YW5jZW9mIFJlZ2lzdHJ5ICYmICgkdXNlcklkID0gJGlucHV0LT5nZXQoJ3VzZXInKSkpID8gJHVzZXJJZCA6IDApOw0KCQkvLyBpZiBzdGlsbCBub3QgdXNlciBpcyBmb3VuZCBnZXQgbWVtYmVyIGlkDQoJCWlmICgkdXNlcklkID09IDApDQoJCXsNCgkJCSRtZW1iZXJJZCA9ICgkZm9ybSBpbnN0YW5jZW9mIEZvcm0gJiYgKCRtZW1iZXJJZCA9ICRmb3JtLT5nZXRWYWx1ZSgnaWQnKSkpID8gJG1lbWJlcklkIDogKCgkaW5wdXQgaW5zdGFuY2VvZiBSZWdpc3RyeSAmJiAoJG1lbWJlcklkID0gJGlucHV0LT5nZXQoJ2lkJykpKSA/ICRtZW1iZXJJZCA6IDApOw0KCQl9DQoJCS8vIGdldCBhY2NvdW50IHR5cGUgaWYgbmVlZGVkDQoJCWlmICgkdXNlcklkID09IDAgJiYgJG1lbWJlcklkID4gMCkNCgkJew0KCQkJJGFjY291bnRJZCA9ICgkZm9ybSBpbnN0YW5jZW9mIEZvcm0gJiYgKCRhY2NvdW50SWQgPSAkZm9ybS0+Z2V0VmFsdWUoJ2FjY291bnQnKSkpID8gJGFjY291bnRJZCA6ICgoJGlucHV0IGluc3RhbmNlb2YgUmVnaXN0cnkgJiYgKCRhY2NvdW50SWQgPSAkaW5wdXQtPmdldCgnYWNjb3VudCcpKSkgPyAkYWNjb3VudElkIDogMCk7DQoJCQkvLyBtYWtlIHN1cmUgdGhlc2UgYWNjb3VudCBpcyBzZXQNCgkJCWlmICgkYWNjb3VudElkID09IDApDQoJCQl7DQoJCQkJJGFjY291bnRJZCA9IFN1cGVyX19fZGI4N2MzMzlfNWJiNl80MjkxX2E3ZWZfMmM0OGVhMWIwNmJjX19fUG93ZXI6OnZhcignbWVtYmVyJywgJG1lbWJlcklkLCAnaWQnLCAnYWNjb3VudCcpOw0KCQkJfQ0KCQl9DQoJCS8vIGdldCB1c2VyIHZhbHVlIGlmIG5vdCBzZXQgKGR1ZSB0byBwZXJtaXNzaW9ucykNCgkJaWYgKCR1c2VySWQgPT0gMCAmJiAkbWVtYmVySWQgPiAwICYmICRhY2NvdW50SWQgPiAwICYmICgxID09ICRhY2NvdW50SWQgfHwgNCA9PSAkYWNjb3VudElkKSkNCgkJew0KCQkJJHVzZXJJZCA9IFN1cGVyX19fZGI4N2MzMzlfNWJiNl80MjkxX2E3ZWZfMmM0OGVhMWIwNmJjX19fUG93ZXI6OnZhcignbWVtYmVyJywgJG1lbWJlcklkLCAnaWQnLCAndXNlcicpOw0KCQl9DQoJCSRxdWVyeS0+d2hlcmUoJGRiLT5xdW90ZU5hbWUoJ2lkJykgLiAnIDw+ICcgLiAoaW50KSAkdXNlcklkKTsNCg0KCQkvLyBTZXQgYW5kIHF1ZXJ5IHRoZSBkYXRhYmFzZS4NCgkJJGRiLT5zZXRRdWVyeSgkcXVlcnkpOw0KCQkkZHVwbGljYXRlID0gKGJvb2wpICRkYi0+bG9hZFJlc3VsdCgpOw0KDQoJCWlmICgkZHVwbGljYXRlKQ0KCQl7DQoJCQlyZXR1cm4gZmFsc2U7DQoJCX0NCg0KCQlyZXR1cm4gdHJ1ZTsNCgl9', 'Validate the member username', 1, '2018-09-16 00:42:59', ''), +(5, 'memberuseremail', 'CS8qKg0KCSAqIFRoZSByZWd1bGFyIGV4cHJlc3Npb24gdG8gdXNlIGluIHRlc3RpbmcgYSBmb3JtIGZpZWxkIHZhbHVlLg0KCSAqDQoJICogQHZhciAgICBzdHJpbmcNCgkgKiBAc2luY2UgIDExLjENCgkgKiBAbGluayAgIGh0dHA6Ly93d3cudzMub3JnL1RSL2h0bWwtbWFya3VwL2lucHV0LmVtYWlsLmh0bWwNCgkgKi8NCglwcm90ZWN0ZWQgJHJlZ2V4ID0gIl5bYS16QS1aMC05LiEjJCUmJyorLz0/Xl9ge3x9fi1dK0BbYS16QS1aMC05LV0rKD86XC5bYS16QS1aMC05LV0rKSokIjsNCg0KCS8qKg0KCSAqIE1ldGhvZCB0byB0ZXN0IHRoZSBlbWFpbCBhZGRyZXNzIGFuZCBvcHRpb25hbGx5IGNoZWNrIGZvciB1bmlxdWVuZXNzLg0KCSAqDQoJICogQHBhcmFtICAgXFNpbXBsZVhNTEVsZW1lbnQgICRlbGVtZW50ICBUaGUgU2ltcGxlWE1MRWxlbWVudCBvYmplY3QgcmVwcmVzZW50aW5nIHRoZSBgPGZpZWxkPmAgdGFnIGZvciB0aGUgZm9ybSBmaWVsZCBvYmplY3QuDQoJICogQHBhcmFtICAgbWl4ZWQgICAgICAgICAgICAgICR2YWx1ZSAgICBUaGUgZm9ybSBmaWVsZCB2YWx1ZSB0byB2YWxpZGF0ZS4NCgkgKiBAcGFyYW0gICBzdHJpbmcgICAgICAgICAgICAgJGdyb3VwICAgIFRoZSBmaWVsZCBuYW1lIGdyb3VwIGNvbnRyb2wgdmFsdWUuIFRoaXMgYWN0cyBhcyBhbiBhcnJheSBjb250YWluZXIgZm9yIHRoZSBmaWVsZC4NCgkgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZvciBleGFtcGxlIGlmIHRoZSBmaWVsZCBoYXMgbmFtZT0iZm9vIiBhbmQgdGhlIGdyb3VwIHZhbHVlIGlzIHNldCB0byAiYmFyIiB0aGVuIHRoZQ0KCSAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVsbCBmaWVsZCBuYW1lIHdvdWxkIGVuZCB1cCBiZWluZyAiYmFyW2Zvb10iLg0KCSAqIEBwYXJhbSAgIFJlZ2lzdHJ5ICAgICAgICAgICAkaW5wdXQgICAgQW4gb3B0aW9uYWwgUmVnaXN0cnkgb2JqZWN0IHdpdGggdGhlIGVudGlyZSBkYXRhIHNldCB0byB2YWxpZGF0ZSBhZ2FpbnN0IHRoZSBlbnRpcmUgZm9ybS4NCgkgKiBAcGFyYW0gICBGb3JtICAgICAgICAgICAgICAgJGZvcm0gICAgIFRoZSBmb3JtIG9iamVjdCBmb3Igd2hpY2ggdGhlIGZpZWxkIGlzIGJlaW5nIHRlc3RlZC4NCgkgKg0KCSAqIEByZXR1cm4gIGJvb2xlYW4gIFRydWUgaWYgdGhlIHZhbHVlIGlzIHZhbGlkLCBmYWxzZSBvdGhlcndpc2UuDQoJICoNCgkgKiBAc2luY2UgICAxMS4xDQoJICovDQoJcHVibGljIGZ1bmN0aW9uIHRlc3QoXFNpbXBsZVhNTEVsZW1lbnQgJGVsZW1lbnQsICR2YWx1ZSwgJGdyb3VwID0gbnVsbCwgUmVnaXN0cnkgJGlucHV0ID0gbnVsbCwgRm9ybSAkZm9ybSA9IG51bGwpDQoJew0KCQkvLyBJZiB0aGUgZmllbGQgaXMgZW1wdHkgYW5kIG5vdCByZXF1aXJlZCwgdGhlIGZpZWxkIGlzIHZhbGlkLg0KCQkkcmVxdWlyZWQgPSAoKHN0cmluZykgJGVsZW1lbnRbJ3JlcXVpcmVkJ10gPT0gJ3RydWUnIHx8IChzdHJpbmcpICRlbGVtZW50WydyZXF1aXJlZCddID09ICdyZXF1aXJlZCcpOw0KDQoJCWlmICghJHJlcXVpcmVkICYmIGVtcHR5KCR2YWx1ZSkpDQoJCXsNCgkJCXJldHVybiB0cnVlOw0KCQl9DQoNCgkJLy8gSWYgdGhlIHRsZCBhdHRyaWJ1dGUgaXMgcHJlc2VudCwgY2hhbmdlIHRoZSByZWd1bGFyIGV4cHJlc3Npb24gdG8gcmVxdWlyZSBhdCBsZWFzdCAyIGNoYXJhY3RlcnMgZm9yIGl0Lg0KCQkkdGxkID0gKChzdHJpbmcpICRlbGVtZW50Wyd0bGQnXSA9PSAndGxkJyB8fCAoc3RyaW5nKSAkZWxlbWVudFsndGxkJ10gPT0gJ3JlcXVpcmVkJyk7DQoNCgkJaWYgKCR0bGQpDQoJCXsNCgkJCSR0aGlzLT5yZWdleCA9ICJeW2EtekEtWjAtOS4hIyQlJicqKy89P15fYHt8fX4tXStAW2EtekEtWjAtOV0oPzpbYS16QS1aMC05LV17MCw2MX1bYS16QS1aMC05XSkiDQoJCQkJLiAnPyg/OlwuW2EtekEtWjAtOV0oPzpbYS16QS1aMC05LV17MCw2MX1bYS16QS1aMC05XSk/KSskJzsNCgkJfQ0KDQoJCS8vIERldGVybWluZSBpZiB0aGUgbXVsdGlwbGUgYXR0cmlidXRlIGlzIHByZXNlbnQNCgkJJG11bHRpcGxlID0gKChzdHJpbmcpICRlbGVtZW50WydtdWx0aXBsZSddID09ICd0cnVlJyB8fCAoc3RyaW5nKSAkZWxlbWVudFsnbXVsdGlwbGUnXSA9PSAnbXVsdGlwbGUnKTsNCg0KCQlpZiAoISRtdWx0aXBsZSkNCgkJew0KCQkJLy8gSGFuZGxlIGlkbiBlbWFpbCBhZGRyZXNzZXMgYnkgY29udmVydGluZyB0byBwdW55Y29kZS4NCgkJCSR2YWx1ZSA9IFxKU3RyaW5nUHVueWNvZGU6OmVtYWlsVG9QdW55Y29kZSgkdmFsdWUpOw0KDQoJCQkvLyBUZXN0IHRoZSB2YWx1ZSBhZ2FpbnN0IHRoZSByZWd1bGFyIGV4cHJlc3Npb24uDQoJCQlpZiAoIXBhcmVudDo6dGVzdCgkZWxlbWVudCwgJHZhbHVlLCAkZ3JvdXAsICRpbnB1dCwgJGZvcm0pKQ0KCQkJew0KCQkJCXJldHVybiBmYWxzZTsNCgkJCX0NCgkJfQ0KCQllbHNlDQoJCXsNCgkJCSR2YWx1ZXMgPSBleHBsb2RlKCcsJywgJHZhbHVlKTsNCg0KCQkJZm9yZWFjaCAoJHZhbHVlcyBhcyAkdmFsdWUpDQoJCQl7DQoJCQkJLy8gSGFuZGxlIGlkbiBlbWFpbCBhZGRyZXNzZXMgYnkgY29udmVydGluZyB0byBwdW55Y29kZS4NCgkJCQkkdmFsdWUgPSBcSlN0cmluZ1B1bnljb2RlOjplbWFpbFRvUHVueWNvZGUoJHZhbHVlKTsNCg0KCQkJCS8vIFRlc3QgdGhlIHZhbHVlIGFnYWluc3QgdGhlIHJlZ3VsYXIgZXhwcmVzc2lvbi4NCgkJCQlpZiAoIXBhcmVudDo6dGVzdCgkZWxlbWVudCwgJHZhbHVlLCAkZ3JvdXAsICRpbnB1dCwgJGZvcm0pKQ0KCQkJCXsNCgkJCQkJcmV0dXJuIGZhbHNlOw0KCQkJCX0NCgkJCX0NCgkJfQ0KDQoJCS8vIENoZWNrIGlmIHdlIHNob3VsZCB0ZXN0IGZvciB1bmlxdWVuZXNzLiBUaGlzIG9ubHkgY2FuIGJlIHVzZWQgaWYgbXVsdGlwbGUgaXMgbm90IHRydWUNCgkJJHVuaXF1ZSA9ICgoc3RyaW5nKSAkZWxlbWVudFsndW5pcXVlJ10gPT0gJ3RydWUnIHx8IChzdHJpbmcpICRlbGVtZW50Wyd1bmlxdWUnXSA9PSAndW5pcXVlJyk7DQoNCgkJaWYgKCR1bmlxdWUgJiYgISRtdWx0aXBsZSkNCgkJew0KCQkJLy8gR2V0IHRoZSBkYXRhYmFzZSBvYmplY3QgYW5kIGEgbmV3IHF1ZXJ5IG9iamVjdC4NCgkJCSRkYiA9IEZhY3Rvcnk6OmdldERibygpOw0KCQkJJHF1ZXJ5ID0gJGRiLT5nZXRRdWVyeSh0cnVlKTsNCg0KCQkJLy8gQnVpbGQgdGhlIHF1ZXJ5Lg0KCQkJJHF1ZXJ5LT5zZWxlY3QoJ0NPVU5UKCopJykNCgkJCQktPmZyb20oJyNfX3VzZXJzJykNCgkJCQktPndoZXJlKCdlbWFpbCA9ICcgLiAkZGItPnF1b3RlKCR2YWx1ZSkpOw0KDQoJCQkvLyBHZXQgdGhlIHVzZXIgSUQgaWYgc2V0Lg0KCQkJJHVzZXJJZCA9ICgkZm9ybSBpbnN0YW5jZW9mIEZvcm0gJiYgKCR1c2VySWQgPSAkZm9ybS0+Z2V0VmFsdWUoJ3VzZXInKSkpID8gJHVzZXJJZCA6ICgoJGlucHV0IGluc3RhbmNlb2YgUmVnaXN0cnkgJiYgKCR1c2VySWQgPSAkaW5wdXQtPmdldCgndXNlcicpKSkgPyAkdXNlcklkIDogMCk7DQoJCQkvLyBpZiBzdGlsbCBub3QgdXNlciBpcyBmb3VuZCBnZXQgbWVtYmVyIGlkDQoJCQlpZiAoJHVzZXJJZCA9PSAwKQ0KCQkJew0KCQkJCSRtZW1iZXJJZCA9ICgkZm9ybSBpbnN0YW5jZW9mIEZvcm0gJiYgKCRtZW1iZXJJZCA9ICRmb3JtLT5nZXRWYWx1ZSgnaWQnKSkpID8gJG1lbWJlcklkIDogKCgkaW5wdXQgaW5zdGFuY2VvZiBSZWdpc3RyeSAmJiAoJG1lbWJlcklkID0gJGlucHV0LT5nZXQoJ2lkJykpKSA/ICRtZW1iZXJJZCA6IDApOw0KCQkJfQ0KCQkJLy8gZ2V0IGFjY291bnQgdHlwZSBpZiBuZWVkZWQNCgkJCWlmICgkdXNlcklkID09IDAgJiYgJG1lbWJlcklkID4gMCkNCgkJCXsNCgkJCQkkYWNjb3VudElkID0gKCRmb3JtIGluc3RhbmNlb2YgRm9ybSAmJiAoJGFjY291bnRJZCA9ICRmb3JtLT5nZXRWYWx1ZSgnYWNjb3VudCcpKSkgPyAkYWNjb3VudElkIDogKCgkaW5wdXQgaW5zdGFuY2VvZiBSZWdpc3RyeSAmJiAoJGFjY291bnRJZCA9ICRpbnB1dC0+Z2V0KCdhY2NvdW50JykpKSA/ICRhY2NvdW50SWQgOiAwKTsNCgkJCQkvLyBtYWtlIHN1cmUgdGhlc2UgYWNjb3VudCBpcyBzZXQNCgkJCQlpZiAoJGFjY291bnRJZCA9PSAwKQ0KCQkJCXsNCgkJCQkJJGFjY291bnRJZCA9IFN1cGVyX19fZGI4N2MzMzlfNWJiNl80MjkxX2E3ZWZfMmM0OGVhMWIwNmJjX19fUG93ZXI6OnZhcignbWVtYmVyJywgJG1lbWJlcklkLCAnaWQnLCAnYWNjb3VudCcpOw0KCQkJCX0NCgkJCX0NCgkJCS8vIGdldCB1c2VyIHZhbHVlIGlmIG5vdCBzZXQgKGR1ZSB0byBwZXJtaXNzaW9ucykNCgkJCWlmICgkdXNlcklkID09IDAgJiYgJG1lbWJlcklkID4gMCAmJiAkYWNjb3VudElkID4gMCAmJiAoMSA9PSAkYWNjb3VudElkIHx8IDQgPT0gJGFjY291bnRJZCkpDQoJCQl7DQoJCQkJJHVzZXJJZCA9IFN1cGVyX19fZGI4N2MzMzlfNWJiNl80MjkxX2E3ZWZfMmM0OGVhMWIwNmJjX19fUG93ZXI6OnZhcignbWVtYmVyJywgJG1lbWJlcklkLCAnaWQnLCAndXNlcicpOw0KCQkJfQ0KCQkJJHF1ZXJ5LT53aGVyZSgkZGItPnF1b3RlTmFtZSgnaWQnKSAuICcgPD4gJyAuIChpbnQpICR1c2VySWQpOw0KDQoJCQkvLyBTZXQgYW5kIHF1ZXJ5IHRoZSBkYXRhYmFzZS4NCgkJCSRkYi0+c2V0UXVlcnkoJHF1ZXJ5KTsNCgkJCSRkdXBsaWNhdGUgPSAoYm9vbCkgJGRiLT5sb2FkUmVzdWx0KCk7DQoNCgkJCWlmICgkZHVwbGljYXRlKQ0KCQkJew0KCQkJCXJldHVybiBmYWxzZTsNCgkJCX0NCgkJfQ0KDQoJCXJldHVybiB0cnVlOw0KCX0=', 'Validate the member useremail', 1, '2018-09-16 00:43:44', ''), +(6, 'iban', 'CS8qKg0KCSogTWV0aG9kIHRvIGNoZWNrIGlmIElCQU4gaXMgdmFsaWQuDQoJKg0KCSogQHBhcmFtICAgXFNpbXBsZVhNTEVsZW1lbnQgICRlbGVtZW50ICBUaGUgU2ltcGxlWE1MRWxlbWVudCBvYmplY3QgcmVwcmVzZW50aW5nIHRoZSBgPGZpZWxkPmAgdGFnIGZvciB0aGUgZm9ybSBmaWVsZCBvYmplY3QuDQoJKiBAcGFyYW0gICBtaXhlZCAgICAgICAgICAgICAgJHZhbHVlICAgIFRoZSBmb3JtIGZpZWxkIHZhbHVlIHRvIHZhbGlkYXRlLg0KCSogQHBhcmFtICAgc3RyaW5nICAgICAgICAgICAgICRncm91cCAgICBUaGUgZmllbGQgbmFtZSBncm91cCBjb250cm9sIHZhbHVlLiBUaGlzIGFjdHMgYXMgYW4gYXJyYXkgY29udGFpbmVyIGZvciB0aGUgZmllbGQuDQoJKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZvciBleGFtcGxlIGlmIHRoZSBmaWVsZCBoYXMgbmFtZT0iZm9vIiBhbmQgdGhlIGdyb3VwIHZhbHVlIGlzIHNldCB0byAiYmFyIiB0aGVuIHRoZQ0KCSogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdWxsIGZpZWxkIG5hbWUgd291bGQgZW5kIHVwIGJlaW5nICJiYXJbZm9vXSIuDQoJKiBAcGFyYW0gICBSZWdpc3RyeSAgICAgICAgICAgJGlucHV0ICAgIEFuIG9wdGlvbmFsIFJlZ2lzdHJ5IG9iamVjdCB3aXRoIHRoZSBlbnRpcmUgZGF0YSBzZXQgdG8gdmFsaWRhdGUgYWdhaW5zdCB0aGUgZW50aXJlIGZvcm0uDQoJKiBAcGFyYW0gICBGb3JtICAgICAgICAgICAgICAgJGZvcm0gICAgIFRoZSBmb3JtIG9iamVjdCBmb3Igd2hpY2ggdGhlIGZpZWxkIGlzIGJlaW5nIHRlc3RlZC4NCgkqDQoJKiBAcmV0dXJuICBib29sZWFuICBUcnVlIGlmIHRoZSB2YWx1ZSBpcyB2YWxpZCwgZmFsc2Ugb3RoZXJ3aXNlLg0KCSoNCgkqIEBzaW5jZSAgIDMuOS4wDQoJKi8NCglwdWJsaWMgZnVuY3Rpb24gdGVzdChcU2ltcGxlWE1MRWxlbWVudCAkZWxlbWVudCwgJHZhbHVlLCAkZ3JvdXAgPSBudWxsLCBSZWdpc3RyeSAkaW5wdXQgPSBudWxsLCBGb3JtICRmb3JtID0gbnVsbCkNCgl7DQoJCSRjb3VudHJ5Q29kZU9mZnNldCA9IDA7IC8vIENPVU5UUllfQ09ERV9PRkZTRVQNCgkJJGNvdW50cnlDb2RlTGVuZ3RoID0gMjsgLy9DT1VOVFJZX0NPREVfTEVOR1RIDQoJCSRjaGVja3N1bU9mZnNldCA9IDI7IC8vQ0hFQ0tTVU1fT0ZGU0VUDQoJCSRjaGVja3N1bUxlbmd0aCA9IDI7IC8vQ0hFQ0tTVU1fTEVOR1RIDQoJCSRpbnN0aXR1dGVJZGVudGlmaWNhdGlvbk9mZnNldCA9IDQ7IC8vSU5TVElUVVRFX0lERU5USUZJQ0FUSU9OX09GRlNFVA0KDQoJCS8qKg0KCQkqIEB2YXIgYXJyYXkgQ291bnRyeSBjb2RlIHRvIHNpemUsIHJlZ2V4IGZvcm1hdCBmb3IgZWFjaCBjb3VudHJ5IHRoYXQgc3VwcG9ydHMgSUJBTg0KCQkqLw0KCQkkaWJhbkZvcm1hdE1hcCA9IGFycmF5KA0KCQkJJ0FBJyA9PiBhcnJheSgxMiwgJ15bQS1aMC05XXsxMn0kJyksDQoJCQknQUQnID0+IGFycmF5KDIwLCAnXlswLTldezR9WzAtOV17NH1bQS1aMC05XXsxMn0kJyksDQoJCQknQUUnID0+IGFycmF5KDE5LCAnXlswLTldezN9WzAtOV17MTZ9JCcpLA0KCQkJJ0FMJyA9PiBhcnJheSgyNCwgJ15bMC05XXs4fVtBLVowLTldezE2fSQnKSwNCgkJCSdBTycgPT4gYXJyYXkoMjEsICdeWzAtOV17MjF9JCcpLA0KCQkJJ0FUJyA9PiBhcnJheSgxNiwgJ15bMC05XXs1fVswLTldezExfSQnKSwNCgkJCSdBWCcgPT4gYXJyYXkoMTQsICdeWzAtOV17Nn1bMC05XXs3fVswLTldezF9JCcpLA0KCQkJJ0FaJyA9PiBhcnJheSgyNCwgJ15bQS1aXXs0fVtBLVowLTldezIwfSQnKSwNCgkJCSdCQScgPT4gYXJyYXkoMTYsICdeWzAtOV17M31bMC05XXszfVswLTldezh9WzAtOV17Mn0kJyksDQoJCQknQkUnID0+IGFycmF5KDEyLCAnXlswLTldezN9WzAtOV17N31bMC05XXsyfSQnKSwNCgkJCSdCRicgPT4gYXJyYXkoMjMsICdeWzAtOV17MjN9JCcpLA0KCQkJJ0JHJyA9PiBhcnJheSgxOCwgJ15bQS1aXXs0fVswLTldezR9WzAtOV17Mn1bQS1aMC05XXs4fSQnKSwNCgkJCSdCSCcgPT4gYXJyYXkoMTgsICdeW0EtWl17NH1bQS1aMC05XXsxNH0kJyksDQoJCQknQkknID0+IGFycmF5KDEyLCAnXlswLTldezEyfSQnKSwNCgkJCSdCSicgPT4gYXJyYXkoMjQsICdeW0EtWl17MX1bMC05XXsyM30kJyksDQoJCQknQkwnID0+IGFycmF5KDIzLCAnXlswLTldezV9WzAtOV17NX1bQS1aMC05XXsxMX1bMC05XXsyfSQnKSwNCgkJCSdCUicgPT4gYXJyYXkoMjUsICdeWzAtOV17OH1bMC05XXs1fVswLTldezEwfVtBLVpdezF9W0EtWjAtOV17MX0kJyksDQoJCQknQ0gnID0+IGFycmF5KDE3LCAnXlswLTldezV9W0EtWjAtOV17MTJ9JCcpLA0KCQkJJ0NJJyA9PiBhcnJheSgyNCwgJ15bQS1aXXsxfVswLTldezIzfSQnKSwNCgkJCSdDTScgPT4gYXJyYXkoMjMsICdeWzAtOV17MjN9JCcpLA0KCQkJJ0NSJyA9PiBhcnJheSgxNywgJ15bMC05XXs0fVswLTldezEzfSQnKSwNCgkJCSdDVicgPT4gYXJyYXkoMjEsICdeWzAtOV17MjF9JCcpLA0KCQkJJ0NZJyA9PiBhcnJheSgyNCwgJ15bMC05XXszfVswLTldezV9W0EtWjAtOV17MTZ9JCcpLA0KCQkJJ0NaJyA9PiBhcnJheSgyMCwgJ15bMC05XXs0fVswLTldezZ9WzAtOV17MTB9JCcpLA0KCQkJJ0RFJyA9PiBhcnJheSgxOCwgJ15bMC05XXs4fVswLTldezEwfSQnKSwNCgkJCSdESycgPT4gYXJyYXkoMTQsICdeWzAtOV17NH1bMC05XXs5fVswLTldezF9JCcpLA0KCQkJJ0RPJyA9PiBhcnJheSgyNCwgJ15bQS1aMC05XXs0fVswLTldezIwfSQnKSwNCgkJCSdEWicgPT4gYXJyYXkoMjAsICdeWzAtOV17MjB9JCcpLA0KCQkJJ0VFJyA9PiBhcnJheSgxNiwgJ15bMC05XXsyfVswLTldezJ9WzAtOV17MTF9WzAtOV17MX0kJyksDQoJCQknRVMnID0+IGFycmF5KDIwLCAnXlswLTldezR9WzAtOV17NH1bMC05XXsxfVswLTldezF9WzAtOV17MTB9JCcpLA0KCQkJJ0ZJJyA9PiBhcnJheSgxNCwgJ15bMC05XXs2fVswLTldezd9WzAtOV17MX0kJyksDQoJCQknRk8nID0+IGFycmF5KDE0LCAnXlswLTldezR9WzAtOV17OX1bMC05XXsxfSQnKSwNCgkJCSdGUicgPT4gYXJyYXkoMjMsICdeWzAtOV17NX1bMC05XXs1fVtBLVowLTldezExfVswLTldezJ9JCcpLA0KCQkJJ0dCJyA9PiBhcnJheSgxOCwgJ15bQS1aXXs0fVswLTldezZ9WzAtOV17OH0kJyksDQoJCQknR0UnID0+IGFycmF5KDE4LCAnXltBLVpdezJ9WzAtOV17MTZ9JCcpLA0KCQkJJ0dGJyA9PiBhcnJheSgyMywgJ15bMC05XXs1fVswLTldezV9W0EtWjAtOV17MTF9WzAtOV17Mn0kJyksDQoJCQknR0knID0+IGFycmF5KDE5LCAnXltBLVpdezR9W0EtWjAtOV17MTV9JCcpLA0KCQkJJ0dMJyA9PiBhcnJheSgxNCwgJ15bMC05XXs0fVswLTldezl9WzAtOV17MX0kJyksDQoJCQknR1AnID0+IGFycmF5KDIzLCAnXlswLTldezV9WzAtOV17NX1bQS1aMC05XXsxMX1bMC05XXsyfSQnKSwNCgkJCSdHUicgPT4gYXJyYXkoMjMsICdeWzAtOV17M31bMC05XXs0fVtBLVowLTldezE2fSQnKSwNCgkJCSdHVCcgPT4gYXJyYXkoMjQsICdeW0EtWjAtOV17NH1bQS1aMC05XXsyMH0kJyksDQoJCQknSFInID0+IGFycmF5KDE3LCAnXlswLTldezd9WzAtOV17MTB9JCcpLA0KCQkJJ0hVJyA9PiBhcnJheSgyNCwgJ15bMC05XXszfVswLTldezR9WzAtOV17MX1bMC05XXsxNX1bMC05XXsxfSQnKSwNCgkJCSdJRScgPT4gYXJyYXkoMTgsICdeW0EtWl17NH1bMC05XXs2fVswLTldezh9JCcpLA0KCQkJJ0lMJyA9PiBhcnJheSgxOSwgJ15bMC05XXszfVswLTldezN9WzAtOV17MTN9JCcpLA0KCQkJJ0lSJyA9PiBhcnJheSgyMiwgJ15bMC05XXsyMn0kJyksDQoJCQknSVMnID0+IGFycmF5KDIyLCAnXlswLTldezR9WzAtOV17Mn1bMC05XXs2fVswLTldezEwfSQnKSwNCgkJCSdJVCcgPT4gYXJyYXkoMjMsICdeW0EtWl17MX1bMC05XXs1fVswLTldezV9W0EtWjAtOV17MTJ9JCcpLA0KCQkJJ0pPJyA9PiBhcnJheSgyNiwgJ15bQS1aXXs0fVswLTldezR9W0EtWjAtOV17MTh9JCcpLA0KCQkJJ0tXJyA9PiBhcnJheSgyNiwgJ15bQS1aXXs0fVtBLVowLTldezIyfSQnKSwNCgkJCSdLWicgPT4gYXJyYXkoMTYsICdeWzAtOV17M31bQS1aMC05XXsxM30kJyksDQoJCQknTEInID0+IGFycmF5KDI0LCAnXlswLTldezR9W0EtWjAtOV17MjB9JCcpLA0KCQkJJ0xDJyA9PiBhcnJheSgyOCwgJ15bQS1aXXs0fVtBLVowLTldezI0fSQnKSwNCgkJCSdMSScgPT4gYXJyYXkoMTcsICdeWzAtOV17NX1bQS1aMC05XXsxMn0kJyksDQoJCQknTFQnID0+IGFycmF5KDE2LCAnXlswLTldezV9WzAtOV17MTF9JCcpLA0KCQkJJ0xVJyA9PiBhcnJheSgxNiwgJ15bMC05XXszfVtBLVowLTldezEzfSQnKSwNCgkJCSdMVicgPT4gYXJyYXkoMTcsICdeW0EtWl17NH1bQS1aMC05XXsxM30kJyksDQoJCQknTUMnID0+IGFycmF5KDIzLCAnXlswLTldezV9WzAtOV17NX1bQS1aMC05XXsxMX1bMC05XXsyfSQnKSwNCgkJCSdNRCcgPT4gYXJyYXkoMjAsICdeW0EtWjAtOV17Mn1bQS1aMC05XXsxOH0kJyksDQoJCQknTUUnID0+IGFycmF5KDE4LCAnXlswLTldezN9WzAtOV17MTN9WzAtOV17Mn0kJyksDQoJCQknTUYnID0+IGFycmF5KDIzLCAnXlswLTldezV9WzAtOV17NX1bQS1aMC05XXsxMX1bMC05XXsyfSQnKSwNCgkJCSdNRycgPT4gYXJyYXkoMjMsICdeWzAtOV17MjN9JCcpLA0KCQkJJ01LJyA9PiBhcnJheSgxNSwgJ15bMC05XXszfVtBLVowLTldezEwfVswLTldezJ9JCcpLA0KCQkJJ01MJyA9PiBhcnJheSgyNCwgJ15bQS1aXXsxfVswLTldezIzfSQnKSwNCgkJCSdNUScgPT4gYXJyYXkoMjMsICdeWzAtOV17NX1bMC05XXs1fVtBLVowLTldezExfVswLTldezJ9JCcpLA0KCQkJJ01SJyA9PiBhcnJheSgyMywgJ15bMC05XXs1fVswLTldezV9WzAtOV17MTF9WzAtOV17Mn0kJyksDQoJCQknTVQnID0+IGFycmF5KDI3LCAnXltBLVpdezR9WzAtOV17NX1bQS1aMC05XXsxOH0kJyksDQoJCQknTVUnID0+IGFycmF5KDI2LCAnXltBLVpdezR9WzAtOV17Mn1bMC05XXsyfVswLTldezEyfVswLTldezN9W0EtWl17M30kJyksDQoJCQknTVonID0+IGFycmF5KDIxLCAnXlswLTldezIxfSQnKSwNCgkJCSdOQycgPT4gYXJyYXkoMjMsICdeWzAtOV17NX1bMC05XXs1fVtBLVowLTldezExfVswLTldezJ9JCcpLA0KCQkJJ05MJyA9PiBhcnJheSgxNCwgJ15bQS1aXXs0fVswLTldezEwfSQnKSwNCgkJCSdOTycgPT4gYXJyYXkoMTEsICdeWzAtOV17NH1bMC05XXs2fVswLTldezF9JCcpLA0KCQkJJ1BGJyA9PiBhcnJheSgyMywgJ15bMC05XXs1fVswLTldezV9W0EtWjAtOV17MTF9WzAtOV17Mn0kJyksDQoJCQknUEsnID0+IGFycmF5KDIwLCAnXltBLVpdezR9W0EtWjAtOV17MTZ9JCcpLA0KCQkJJ1BMJyA9PiBhcnJheSgyNCwgJ15bMC05XXs4fVswLTldezE2fSQnKSwNCgkJCSdQTScgPT4gYXJyYXkoMjMsICdeWzAtOV17NX1bMC05XXs1fVtBLVowLTldezExfVswLTldezJ9JCcpLA0KCQkJJ1BTJyA9PiBhcnJheSgyNSwgJ15bQS1aXXs0fVtBLVowLTldezIxfSQnKSwNCgkJCSdQVCcgPT4gYXJyYXkoMjEsICdeWzAtOV17NH1bMC05XXs0fVswLTldezExfVswLTldezJ9JCcpLA0KCQkJJ1FBJyA9PiBhcnJheSgyNSwgJ15bQS1aXXs0fVswLTldezR9W0EtWjAtOV17MTd9JCcpLA0KCQkJJ1JFJyA9PiBhcnJheSgyMywgJ15bMC05XXs1fVswLTldezV9W0EtWjAtOV17MTF9WzAtOV17Mn0kJyksDQoJCQknUk8nID0+IGFycmF5KDIwLCAnXltBLVpdezR9W0EtWjAtOV17MTZ9JCcpLA0KCQkJJ1JTJyA9PiBhcnJheSgxOCwgJ15bMC05XXszfVswLTldezEzfVswLTldezJ9JCcpLA0KCQkJJ1NBJyA9PiBhcnJheSgyMCwgJ15bMC05XXsyfVtBLVowLTldezE4fSQnKSwNCgkJCSdTQycgPT4gYXJyYXkoMjcsICdeW0EtWl17NH1bMC05XXs0fVswLTldezE2fVtBLVpdezN9JCcpLA0KCQkJJ1NFJyA9PiBhcnJheSgyMCwgJ15bMC05XXszfVswLTldezE2fVswLTldezF9JCcpLA0KCQkJJ1NJJyA9PiBhcnJheSgxNSwgJ15bMC05XXs1fVswLTldezh9WzAtOV17Mn0kJyksDQoJCQknU0snID0+IGFycmF5KDIwLCAnXlswLTldezR9WzAtOV17Nn1bMC05XXsxMH0kJyksDQoJCQknU00nID0+IGFycmF5KDIzLCAnXltBLVpdezF9WzAtOV17NX1bMC05XXs1fVtBLVowLTldezEyfSQnKSwNCgkJCSdTTicgPT4gYXJyYXkoMjQsICdeW0EtWl17MX1bMC05XXsyM30kJyksDQoJCQknU1QnID0+IGFycmF5KDIxLCAnXlswLTldezh9WzAtOV17MTF9WzAtOV17Mn0kJyksDQoJCQknVEYnID0+IGFycmF5KDIzLCAnXlswLTldezV9WzAtOV17NX1bQS1aMC05XXsxMX1bMC05XXsyfSQnKSwNCgkJCSdUTCcgPT4gYXJyYXkoMTksICdeWzAtOV17M31bMC05XXsxNH1bMC05XXsyfSQnKSwNCgkJCSdUTicgPT4gYXJyYXkoMjAsICdeWzAtOV17Mn1bMC05XXszfVswLTldezEzfVswLTldezJ9JCcpLA0KCQkJJ1RSJyA9PiBhcnJheSgyMiwgJ15bMC05XXs1fVswLTldezF9W0EtWjAtOV17MTZ9JCcpLA0KCQkJJ1VBJyA9PiBhcnJheSgyNSwgJ15bMC05XXs2fVtBLVowLTldezE5fSQnKSwNCgkJCSdWRycgPT4gYXJyYXkoMjAsICdeW0EtWl17NH1bMC05XXsxNn0kJyksDQoJCQknV0YnID0+IGFycmF5KDIzLCAnXlswLTldezV9WzAtOV17NX1bQS1aMC05XXsxMX1bMC05XXsyfSQnKSwNCgkJCSdYSycgPT4gYXJyYXkoMTYsICdeWzAtOV17NH1bMC05XXsxMH1bMC05XXsyfSQnKSwNCgkJCSdZVCcgPT4gYXJyYXkoMjMsICdeWzAtOV17NX1bMC05XXs1fVtBLVowLTldezExfVswLTldezJ9JCcpDQoJCSk7DQoNCgkJLy8gQ0xFQU4gVVAgSUJBTg0KCQkkaWJhbiA9IHByZWdfcmVwbGFjZSgnL1teYS16MC05XSsvaScsICcnLCB0cmltKHN0cnRvdXBwZXIoJHZhbHVlKSkpOw0KDQoJCS8vIENIRUNLIENvdW50cnkgQ29kZQ0KCQkkY291bnRyeUNvZGUgPSBzdWJzdHIoJGliYW4sICRjb3VudHJ5Q29kZU9mZnNldCwgJGNvdW50cnlDb2RlTGVuZ3RoKTsNCgkJJGlzQ291bnRyeUNvZGVWYWxpZCA9ICEoaXNzZXQoJGliYW5Gb3JtYXRNYXBbJGNvdW50cnlDb2RlXSkgPT09IGZhbHNlKTsNCg0KCQkkdmFsaWRMZW5ndGggPSAkY291bnRyeUNvZGVMZW5ndGggKyAkY2hlY2tzdW1MZW5ndGggKyAkaWJhbkZvcm1hdE1hcFskY291bnRyeUNvZGVdWzBdOw0KCQkkaXNMZW5ndGhWYWxpZCA9IHN0cmxlbigkaWJhbikgPT09ICR2YWxpZExlbmd0aDsNCg0KCQkkYWNjb3VudElkZW50aWZpY2F0aW9uID0gc3Vic3RyKCRpYmFuLCAkaW5zdGl0dXRlSWRlbnRpZmljYXRpb25PZmZzZXQpOw0KCQkkaXNGb3JtYXRWYWxpZCA9ICEocHJlZ19tYXRjaCgnLycgLiAkaWJhbkZvcm1hdE1hcFskY291bnRyeUNvZGVdWzFdIC4gJy8nLCAkYWNjb3VudElkZW50aWZpY2F0aW9uKSAhPT0gMSk7DQoNCgkJJGNoZWNrc3VtID0gc3Vic3RyKCRpYmFuLCAkY2hlY2tzdW1PZmZzZXQsICRjaGVja3N1bUxlbmd0aCk7DQoJCSRhY2NvdW50SWRlbnRpZmljYXRpb24gPSBzdWJzdHIoJGliYW4sICRpbnN0aXR1dGVJZGVudGlmaWNhdGlvbk9mZnNldCk7DQoNCgkJLy8gR0VUIE5VTUVSSUMgQ09VTlRSWSBDT0RFDQoJCSRudW1lcmljUmVwcmVzZW50YXRpb24gPSAnJzsNCgkJJGxldHRlclJlcHJlc2VudGF0aW9uID0gJGNvdW50cnlDb2RlOw0KCQlmb3JlYWNoIChzdHJfc3BsaXQoJGxldHRlclJlcHJlc2VudGF0aW9uKSBhcyAkY2hhcikNCgkJew0KCQkJJG9yZCA9IG9yZCgkY2hhcik7DQoJCQlpZiAoJG9yZCA+PSA2NSAmJiAkb3JkIDw9IDkwKQ0KCQkJew0KCQkJCSRudW1lcmljUmVwcmVzZW50YXRpb24gLj0gKHN0cmluZykgKCRvcmQgLSA1NSk7DQoJCQl9DQoJCQllbHNlaWYgKCRvcmQgPj0gNDggJiYgJG9yZCA8PSA1NykNCgkJCXsNCgkJCQkkbnVtZXJpY1JlcHJlc2VudGF0aW9uIC49IChzdHJpbmcpICgkb3JkIC0gNDgpOw0KCQkJfQ0KCQl9DQoJCSRudW1lcmljQ291bnRyeUNvZGUgPSAkbnVtZXJpY1JlcHJlc2VudGF0aW9uOw0KDQoJCSRudW1lcmljUmVwcmVzZW50YXRpb24gPSAnJzsNCgkJJGxldHRlclJlcHJlc2VudGF0aW9uID0gJGFjY291bnRJZGVudGlmaWNhdGlvbjsNCgkJZm9yZWFjaCAoc3RyX3NwbGl0KCRsZXR0ZXJSZXByZXNlbnRhdGlvbikgYXMgJGNoYXIpDQoJCXsNCgkJCSRvcmQgPSBvcmQoJGNoYXIpOw0KCQkJaWYgKCRvcmQgPj0gNjUgJiYgJG9yZCA8PSA5MCkNCgkJCXsNCgkJCQkkbnVtZXJpY1JlcHJlc2VudGF0aW9uIC49IChzdHJpbmcpICgkb3JkIC0gNTUpOw0KCQkJfQ0KCQkJZWxzZWlmICgkb3JkID49IDQ4ICYmICRvcmQgPD0gNTcpDQoJCQl7DQoJCQkJJG51bWVyaWNSZXByZXNlbnRhdGlvbiAuPSAoc3RyaW5nKSAoJG9yZCAtIDQ4KTsNCgkJCX0NCgkJfQ0KCQkkbnVtZXJpY0FjY291bnRJZGVudGlmaWNhdGlvbiA9ICRudW1lcmljUmVwcmVzZW50YXRpb247DQoJCSRpbnZlcnRlZEliYW4gPSAkbnVtZXJpY0FjY291bnRJZGVudGlmaWNhdGlvbiAuICRudW1lcmljQ291bnRyeUNvZGUgLiAkY2hlY2tzdW07DQoNCgkJLy8gQ0hFQ0tTVU0gQkNNT0QNCgkJJHggPSAkaW52ZXJ0ZWRJYmFuOw0KCQkkeSA9IDk3Ow0KCQlpZiAoIWZ1bmN0aW9uX2V4aXN0cygnYmNtb2QnKSkNCgkJew0KCQkJJHRha2UgPSA1Ow0KCQkJJG1vZCA9ICcnOw0KCQkJZG8gew0KCQkJCSRhID0gKGludCkkbW9kIC4gc3Vic3RyKCR4LCAwLCAkdGFrZSk7DQoJCQkJJHggPSBzdWJzdHIoJHgsICR0YWtlKTsNCgkJCQkkbW9kID0gJGEgJSAkeTsNCgkJCX0gd2hpbGUgKHN0cmxlbigkeCkpOw0KCQkJJGJjbW9kID0gKHN0cmluZykkbW9kOw0KCQl9DQoJCWVsc2UNCgkJew0KCQkJJGJjbW9kID0gYmNtb2QoJHgsICR5KTsNCgkJfQ0KDQoJCSRpc0NoZWNrc3VtVmFsaWQgPSAkYmNtb2QgPT09ICcxJzsNCg0KCQlpZiAoISRpc0NvdW50cnlDb2RlVmFsaWQgfHwgISRpc0xlbmd0aFZhbGlkIHx8ICEkaXNGb3JtYXRWYWxpZCB8fCAhJGlzQ2hlY2tzdW1WYWxpZCkNCgkJew0KCQkJcmV0dXJuIGZhbHNlOw0KCQl9DQoJCWVsc2UNCgkJew0KCQkgICAgcmV0dXJuIHRydWU7DQoJCX0NCgl9', 'IBAN validation', 1, '2019-02-12 23:14:43', ''); -- -- Dumping data for table `#__componentbuilder_field` -- -INSERT INTO `#__componentbuilder_field` (`id`, `add_css_view`, `add_css_views`, `add_javascript_view_footer`, `add_javascript_views_footer`, `css_view`, `css_views`, `datadefault`, `datadefault_other`, `datalenght`, `datalenght_other`, `datatype`, `indexes`, `javascript_view_footer`, `javascript_views_footer`, `name`, `null_switch`, `store`, `fieldtype`, `xml`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `guid`) VALUES -(23, '', '', '', '', '', '', '', '', 64, '', 'CHAR', '', '', '', 'Alias', 'NOT NULL', '', 24, '\"\"', 1, '2015-04-09 13:46:04', '2016-05-05 22:30:18', 2, '', 216, '335866ce-b81b-4329-901d-c20254135c9c'), -(84, '', '', '', '', '', '', '', '', '', '', 'TEXT', '', '', '', 'Description (full width)', 'NOT NULL', '', 25, '\"\"', 1, '2015-03-19 18:20:49', '2016-10-20 17:01:21', 4, '', 265, '749a9917-90c3-49c4-9e72-aa33b0683a87'), -(100, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Email (required)', 'NOT NULL', '', 24, '\"\"', 1, '2015-05-05 23:44:32', '2016-02-07 22:43:18', 4, '', 285, '10c1eccb-b3c3-4325-a056-45a72d116fd8'), -(158, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Image', 'NOT NULL', '', 12, '\"\"', 1, '2015-04-29 14:00:56', '2020-06-07 02:17:46', 2, '', 45, '0d6970af-b361-4f65-84f6-0eb0c5f09bad'), -(196, '', '', '', '', '', '', '', '', 64, '', 'VARCHAR', '', '', '', 'Mobile Phone', 'NOT NULL', '', 23, '\"\"', 1, '2015-04-07 22:12:58', '2016-03-28 14:00:02', 2, '', 7, '65933a19-243a-48b2-aae9-34e2da710051'), -(199, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', 2, '', '', 'Name (required)', 'NOT NULL', '', 24, '\"\"', 1, '2015-03-19 17:30:59', '2021-08-05 08:42:17', 10, '', 4, '5d3d34dd-4876-4c6a-86ab-b4e162f22c08'), -(203, '', '', '', '', '', '', '', '', 1, '', 'INT', '', '', '', 'Not Required', 'NOT NULL', '', 9, '\"\"', 1, '2015-05-08 16:19:16', '2020-02-27 20:17:33', 13, '', 19, 'da5e6901-6958-40e5-a4f5-6822d6fe57ac'), -(280, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Website', 'NOT NULL', '', 27, '\"\"', 1, '2015-04-08 00:36:16', '2018-07-08 00:11:05', 2, '', 105, '6c3a6983-d1bf-4e5e-9e99-deea00b0cefd'), -(682, '', '', '', '', '', '', '', '', 1, '', 'TINYINT', 2, '', '', 'Add More', 'NOT NULL', '', 17, '\"\"', 1, '2015-08-05 01:18:20', '2018-03-30 09:30:45', 4, '', 196, 'a66389aa-2323-4f44-8c23-ff44969639be'), -(1011, '', '', '', '', '', '', 'Other', '0000-00-00', '', '', 'DATE', '', '', '', 'Date of Birth', 'NOT NULL', '', 1, '\"\"', 1, '2015-12-07 01:47:32', '2018-08-03 09:56:07', 4, '', 649, 'cb2bdf20-8800-407b-a4f6-250152a0bdfb'); +INSERT INTO `#__componentbuilder_field` (`id`, `add_css_view`, `add_css_views`, `add_javascript_view_footer`, `add_javascript_views_footer`, `css_view`, `css_views`, `datadefault`, `datadefault_other`, `datalenght`, `datalenght_other`, `datatype`, `indexes`, `javascript_view_footer`, `javascript_views_footer`, `name`, `null_switch`, `store`, `fieldtype`, `xml`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `guid`, `on_get_model_field`, `on_save_model_field`, `initiator_on_get_model`, `initiator_on_save_model`, `params`) VALUES +(23, '', '', '', '', '', '', '', '', 64, '', 'CHAR', 2, '', '', 'Alias', 'NOT NULL', '', 24, '\"\"', 1, '2015-04-09 13:46:04', '2023-06-27 23:46:54', 3, '', 216, '335866ce-b81b-4329-901d-c20254135c9c', '', '', '', '', ''), +(84, '', '', '', '', '', '', '', '', '', '', 'TEXT', '', '', '', 'Description (full width)', 'NULL', '', 25, '\"\"', 1, '2015-03-19 18:20:49', '2024-03-06 15:53:48', 5, '', 265, '749a9917-90c3-49c4-9e72-aa33b0683a87', '', '', '', '', ''), +(100, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Email (required)', 'NOT NULL', '', 24, '\"\"', 1, '2015-05-05 23:44:32', '2016-02-07 22:43:18', 4, '', 285, '10c1eccb-b3c3-4325-a056-45a72d116fd8', '', '', '', '', ''), +(158, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Image', 'NOT NULL', '', 12, '\"\"', 1, '2015-04-29 14:00:56', '2020-06-07 02:17:46', 2, '', 45, '0d6970af-b361-4f65-84f6-0eb0c5f09bad', '', '', '', '', ''), +(196, '', '', '', '', '', '', '', '', 64, '', 'VARCHAR', '', '', '', 'Mobile Phone', 'NOT NULL', '', 23, '\"\"', 1, '2015-04-07 22:12:58', '2016-03-28 14:00:02', 2, '', 7, '65933a19-243a-48b2-aae9-34e2da710051', '', '', '', '', ''), +(199, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', 2, '', '', 'Name (Key - Required)', 'NOT NULL', '', 24, '\"\"', 1, '2015-03-19 17:30:59', '2023-06-19 22:38:40', 10, '', 4, '5d3d34dd-4876-4c6a-86ab-b4e162f22c08', '', '', '', '', ''), +(203, '', '', '', '', '', '', '', '', 1, '', 'INT', '', '', '', 'Not Required', 'NOT NULL', '', 9, '\"\"', 1, '2015-05-08 16:19:16', '2023-09-27 07:57:19', 16, '', 19, 'da5e6901-6958-40e5-a4f5-6822d6fe57ac', '', '', '', '', ''), +(280, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Website', 'NOT NULL', '', 27, '\"\"', 1, '2015-04-08 00:36:16', '2018-07-08 00:11:05', 2, '', 105, '6c3a6983-d1bf-4e5e-9e99-deea00b0cefd', '', '', '', '', ''), +(682, '', '', '', '', '', '', '', '', 1, '', 'TINYINT', 2, '', '', 'Add More', 'NOT NULL', '', 17, '\"\"', 1, '2015-08-05 01:18:20', '2023-01-20 11:15:45', 7, '', 196, 'a66389aa-2323-4f44-8c23-ff44969639be', '', '', '', '', ''), +(1011, '', '', '', '', '', '', 'Other', '0000-00-00', '', '', 'DATE', '', '', '', 'Date of Birth', 'NOT NULL', '', 1, '\"\"', 1, '2015-12-07 01:47:32', '2018-08-03 09:56:07', 4, '', 649, 'cb2bdf20-8800-407b-a4f6-250152a0bdfb', '', '', '', '', ''); -- -- Dumping data for table `#__componentbuilder_fieldtype` @@ -2222,13 +2277,13 @@ INSERT INTO `#__componentbuilder_fieldtype` (`id`, `description`, `name`, `prope (3, 'The checkbox form field type provides a single checkbox. If the parameter has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.', 'Checkbox', '{\"properties0\":{\"name\":\"type\",\"example\":\"checkbox\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be checkbox\"},\"properties1\":{\"name\":\"name\",\"example\":\"show_title\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the parameter.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Show title\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"value\",\"example\":\"1\",\"adjustable\":\"1\",\"description\":\"(optional) is the value of the parameter if this checkbox is set (usually 1).\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the default value (usually 0 or 1).\"},\"properties5\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties6\":{\"name\":\"description\",\"example\":\"Show the title of the item\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the label.\"},\"properties7\":{\"name\":\"class\",\"example\":\"inputbox\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties8\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties9\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (JavaScript use)\"}}', 'provides a single checkbox to be checked or unchecked', '', 1, 7, '', '', '10066262-b6e3-4f82-941e-cbe4f61ddd6c'), (4, 'The checkboxes form field type provides a set of checkboxes. Note: unlike most standard form field types, such as textfield or checkbox, this field is not an \"out of the box\" solution. It will create checkboxes for you, and submit their values in form of ', 'Checkboxes', '{\"properties0\":{\"name\":\"type\",\"example\":\"checkboxes\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be checkboxs\"},\"properties1\":{\"name\":\"name\",\"example\":\"toppings\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the parameter.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select Toppings\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"option\",\"example\":\"anch|Anchovies,chor|Chorizo,on|Onions,mush|Mushrooms\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) set the options of this radio. Separate options with commas and use the pipe symbol to separate value from text.\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the default value.\"},\"properties5\":{\"name\":\"description\",\"example\":\"Select the topping of your choice\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the label.\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties7\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties8\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides unlimited checkboxes that can be used for multi-select.', '', 1, 4, '', '', 'ac10859b-58da-4584-9682-36a6c2c8d04d'), (5, 'Provides a color picker. Enter the color as #ff00ff or pick it from the palet.', 'Color', '{\"properties0\":{\"name\":\"type\",\"example\":\"color\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be color.\"},\"properties1\":{\"name\":\"name\",\"example\":\"backgroundcolor\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the parameter.\"},\"properties2\":{\"name\":\"default\",\"example\":\"#FFFFFF\",\"adjustable\":\"1\",\"description\":\"(optional) provides a color when not set.\"},\"properties3\":{\"name\":\"label\",\"example\":\"Background\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties4\":{\"name\":\"description\",\"example\":\"Select the background color here.\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) tooltip for the form field.\"},\"properties5\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties6\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides a color picker when clicking the input box.', '', 1, 5, '', '', '7f60f198-53e7-4fe9-813f-d1b6c553680e'), -(6, 'The list form field type provides a drop down list or a list box of other current component table entries. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.', 'Custom', '{\"properties0\":{\"name\":\"type\",\"example\":\"subjects\",\"mandatory\":\"1\",\"description\":\"(mandatory) can be anything, just not the same as any other default Joomla field type. You can also not use the \\\"_\\\" (underscore) or \\\"-\\\" (hyphen) in the type name, and no spaces.\"},\"properties1\":{\"name\":\"name\",\"example\":\"subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a Subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"message\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties5\":{\"name\":\"class\",\"example\":\"list_class\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties6\":{\"name\":\"multiple\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether multiple items can be selected at the same time (true or false).\"},\"properties7\":{\"name\":\"default\",\"example\":\"0\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties8\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties9\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties10\":{\"name\":\"readonly\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties11\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties12\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties13\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"},\"properties14\":{\"name\":\"extends\",\"example\":\"list\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"The JFormField sub class that should be extended. The options are (\'list\',\'radio\',\'checkboxes\')\"},\"properties15\":{\"name\":\"button\",\"example\":\"true\",\"adjustable\":\"1\",\"description\":\"(optional) to add new button next to field in edit view\"},\"properties16\":{\"name\":\"table\",\"example\":\"#__###component###_subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The table being linked to. The ###TABLE### placeholder holds the table in the php.\"},\"properties17\":{\"name\":\"component\",\"example\":\"com_###component###\",\"mandatory\":\"1\",\"description\":\"(mandatory) The name of the component where this table is found. Must be com_users\"},\"properties18\":{\"name\":\"view\",\"example\":\"subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The single view name if the place this field is added.\"},\"properties19\":{\"name\":\"views\",\"example\":\"subjects\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The list view name if the place this field is added.\"},\"properties20\":{\"name\":\"value_field\",\"example\":\"name\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The name of the text field in table linked to. The ###TEXT### placeholder holds the value_field in the php.\"},\"properties21\":{\"name\":\"key_field\",\"example\":\"id\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The field from the linked table to save in this table as the unique key. The ###ID### placeholder holds the key_field in the php.\"},\"properties22\":{\"name\":\"prime_php\",\"example\":\"1\",\"adjustable\":\"1\",\"description\":\"This field makes sure that the PHP used here is used to build the field type, and other are custom fields with the same field type are ignored. So to avoid that they over write the PHP added here. You should only have one prime per\\/type. To disable remove the field or set to 0\"},\"properties23\":{\"name\":\"type_php_1\",\"example\":\"\\/\\/ Get the user object.\\r\\n\\t\\t$user = JFactory::getUser();\\r\\n\\t\\t\\/\\/ Get the databse object.\\r\\n\\t\\t$db = JFactory::getDBO();\\r\\n\\t\\t$query = $db->getQuery(true);\\r\\n\\t\\t$query->select($db->quoteName(array(\'a.###ID###\',\'a.###TEXT###\'),array(\'###ID###\',\'###CODE_TEXT###\')));\\r\\n\\t\\t$query->from($db->quoteName(\'###TABLE###\', \'a\'));\\r\\n\\t\\t$query->where($db->quoteName(\'a.published\') . \' = 1\');\\r\\n\\t\\t$query->order(\'a.###TEXT### ASC\');\\r\\n\\t\\t\\/\\/ Implement View Level Access (if set in table)\\r\\n\\t\\tif (!$user->authorise(\'core.options\', \'[[[com_component]]]\'))\\r\\n\\t\\t{\\r\\n\\t\\t\\t$columns = $db->getTableColumns(\'###TABLE###\');\\r\\n\\t\\t\\tif(isset($columns[\'access\']))\\r\\n\\t\\t\\t{\\r\\n\\t\\t\\t\\t$groups = implode(\',\', $user->getAuthorisedViewLevels());\\r\\n\\t\\t\\t\\t$query->where(\'a.access IN (\' . $groups . \')\');\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t\\t$db->setQuery((string)$query);\\r\\n\\t\\t$items = $db->loadObjectList();\\r\\n\\t\\t$options = array();\\r\\n\\t\\tif ($items)\\r\\n\\t\\t{\\r\\n\\t\\t\\tif ($this->multiple === false)\\r\\n\\t\\t\\t{\\r\\n\\t\\t\\t\\t$options[] = JHtml::_(\'select.option\', \'\', JText::_(\'Select an option\'));\\r\\n\\t\\t\\t}\\r\\n\\t\\t\\tforeach($items as $item)\\r\\n\\t\\t\\t{\\r\\n\\t\\t\\t\\t$options[] = JHtml::_(\'select.option\', $item->###ID###, $item->###CODE_TEXT###);\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t\\treturn $options;\",\"adjustable\":\"1\",\"description\":\"The php for the getOptions method.\"}}', 'provides a drop down list of items entries.', '', 1, 28, '', '', 'dd2e1f4b-f5db-45e8-85fa-efd27bae7b6a'), -(7, 'The a list of users that can be targeting one or more groups and excluded users that already belongs to an item in a view.', 'CustomUser', '{\"properties0\":{\"name\":\"type\",\"example\":\"staffusers\",\"mandatory\":\"1\",\"description\":\"(mandatory) can be anything, just not the same as any other default Joomla field type.\"},\"properties1\":{\"name\":\"name\",\"example\":\"staff\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Staff\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties5\":{\"name\":\"multiple\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether multiple items can be selected at the same time (true or false).\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties7\":{\"name\":\"readonly\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties8\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties9\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"\"},\"properties10\":{\"name\":\"hint\",\"example\":\"select a user\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"\"},\"properties11\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties12\":{\"name\":\"extends\",\"example\":\"user\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"The JFormField sub class that should be extended. The options are (\'list\',\'radio\',\'checkboxes\')\"},\"properties13\":{\"name\":\"table\",\"example\":\"#__users\",\"mandatory\":\"1\",\"description\":\"(mandatory) The table being linked to. Must be #__users\"},\"properties14\":{\"name\":\"component\",\"example\":\"com_users\",\"mandatory\":\"1\",\"description\":\"(mandatory) The name of the component where this table is found. Must be com_users\"},\"properties15\":{\"name\":\"view\",\"example\":\"###view###\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The single view name if the place this field is added.\"},\"properties16\":{\"name\":\"views\",\"example\":\"###views###\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The list view name if the place this field is added.\"},\"properties17\":{\"name\":\"value_field\",\"example\":\"name\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The name of the text field in table linked to.\"},\"properties18\":{\"name\":\"key_field\",\"example\":\"id\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The field from the linked table to save in this table as the unique key.\"},\"properties19\":{\"name\":\"type_php_1\",\"example\":\"\\t\\t\\/\\/ set the groups array\\r\\n\\t\\treturn JComponentHelper::getParams(\'com_###component###\')->get(\'###type###\');\",\"adjustable\":\"1\",\"description\":\"The php for the getGroups method.\"},\"properties22\":{\"name\":\"type_phpx_1\",\"example\":\"\\t\\t\\/\\/ To ensure that there is only one record per user\\r\\n\\t\\t\\/\\/ Get a db connection.\\r\\n\\t\\t$db = JFactory::getDbo();\\r\\n\\t\\t\\/\\/ Create a new query object.\\r\\n\\t\\t$query = $db->getQuery(true);\\r\\n\\t\\t\\/\\/ Select all records from the #__###component###_###view### table from ###CODE### column\\\".\\r\\n\\t\\t$query->select($db->quoteName(\'###CODE###\'));\\r\\n\\t\\t$query->from($db->quoteName(\'#__###component###_###view###\'));\\r\\n\\t\\t$db->setQuery($query);\\r\\n\\t\\t$db->execute();\\r\\n\\t\\t$found = $db->getNumRows();\\r\\n\\t\\tif ($found)\\r\\n\\t\\t{\\r\\n\\t\\t\\t\\/\\/ return all users already used\\r\\n\\t\\t\\treturn array_unique($db->loadColumn());\\r\\n\\t\\t}\\r\\n\\t\\treturn null;\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"}}', 'Provides list of users.', '', 1, 6, '', '', 'a4a39f70-070f-459c-be4b-0ac103a29b9a'), +(6, 'The list form field type provides a drop down list or a list box of other current component table entries. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.', 'Custom', '{\"properties0\":{\"name\":\"type\",\"example\":\"subjects\",\"mandatory\":\"1\",\"description\":\"(mandatory) can be anything, just not the same as any other default Joomla field type. You can also not use the \\\"_\\\" (underscore) or \\\"-\\\" (hyphen) in the type name, and no spaces.\"},\"properties1\":{\"name\":\"name\",\"example\":\"subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a Subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"message\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties5\":{\"name\":\"class\",\"example\":\"list_class\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties24\":{\"name\":\"layout\",\"example\":\"joomla.form.field.list-fancy-select\",\"adjustable\":\"1\",\"description\":\"(optional) New layout field added in Joomla 4\"},\"properties6\":{\"name\":\"multiple\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether multiple items can be selected at the same time (true or false).\"},\"properties7\":{\"name\":\"default\",\"example\":\"0\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties8\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties9\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties10\":{\"name\":\"readonly\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties11\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties12\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties13\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"},\"properties14\":{\"name\":\"extends\",\"example\":\"list\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"The JFormField sub class that should be extended. The options are (\'list\',\'radio\',\'checkboxes\')\"},\"properties15\":{\"name\":\"button\",\"example\":\"true\",\"adjustable\":\"1\",\"description\":\"(optional) to add new button next to field in edit view\"},\"properties16\":{\"name\":\"table\",\"example\":\"#__###component###_subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The table being linked to. The ###TABLE### placeholder holds the table in the php.\"},\"properties17\":{\"name\":\"component\",\"example\":\"com_###component###\",\"mandatory\":\"1\",\"description\":\"(mandatory) The name of the component where this table is found. Must be com_users\"},\"properties18\":{\"name\":\"view\",\"example\":\"subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The single view name if the place this field is added.\"},\"properties19\":{\"name\":\"views\",\"example\":\"subjects\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The list view name if the place this field is added.\"},\"properties20\":{\"name\":\"value_field\",\"example\":\"name\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The name of the text field in table linked to. The ###TEXT### placeholder holds the value_field in the php.\"},\"properties21\":{\"name\":\"key_field\",\"example\":\"id\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The field from the linked table to save in this table as the unique key. The ###ID### placeholder holds the key_field in the php.\"},\"properties22\":{\"name\":\"prime_php\",\"example\":\"1\",\"adjustable\":\"1\",\"description\":\"This field makes sure that the PHP used here is used to build the field type, and other are custom fields with the same field type are ignored. So to avoid that they over write the PHP added here. You should only have one prime per\\/type. To disable remove the field or set to 0\"},\"properties23\":{\"name\":\"type_php_1\",\"example\":\"\\/\\/ Get the user object.\\r\\n\\t\\t$user = Factory::getUser();\\r\\n\\t\\t\\/\\/ Get the databse object.\\r\\n\\t\\t$db = Factory::getDBO();\\r\\n\\t\\t$query = $db->getQuery(true);\\r\\n\\t\\t$query->select($db->quoteName(array(\'a.###ID###\',\'a.###TEXT###\'),array(\'###ID###\',\'###CODE_TEXT###\')));\\r\\n\\t\\t$query->from($db->quoteName(\'###TABLE###\', \'a\'));\\r\\n\\t\\t$query->where($db->quoteName(\'a.published\') . \' = 1\');\\r\\n\\t\\t$query->order(\'a.###TEXT### ASC\');\\r\\n\\t\\t\\/\\/ Implement View Level Access (if set in table)\\r\\n\\t\\tif (!$user->authorise(\'core.options\', \'[[[com_component]]]\'))\\r\\n\\t\\t{\\r\\n\\t\\t\\t$columns = $db->getTableColumns(\'###TABLE###\');\\r\\n\\t\\t\\tif(isset($columns[\'access\']))\\r\\n\\t\\t\\t{\\r\\n\\t\\t\\t\\t$groups = implode(\',\', $user->getAuthorisedViewLevels());\\r\\n\\t\\t\\t\\t$query->where(\'a.access IN (\' . $groups . \')\');\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t\\t$db->setQuery((string)$query);\\r\\n\\t\\t$items = $db->loadObjectList();\\r\\n\\t\\t$options = [];\\r\\n\\t\\tif ($items)\\r\\n\\t\\t{\\r\\n\\t\\t\\tif ($this->multiple === false)\\r\\n\\t\\t\\t{\\r\\n\\t\\t\\t\\t$options[] = Html::_(\'select.option\', \'\', Text::_(\'Select an option\'));\\r\\n\\t\\t\\t}\\r\\n\\t\\t\\tforeach($items as $item)\\r\\n\\t\\t\\t{\\r\\n\\t\\t\\t\\t$options[] = Html::_(\'select.option\', $item->###ID###, $item->###CODE_TEXT###);\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t\\treturn $options;\",\"adjustable\":\"1\",\"description\":\"The php for the getOptions method.\"}}', 'provides a drop down list of items entries.', '', 1, 30, '', '', 'dd2e1f4b-f5db-45e8-85fa-efd27bae7b6a'), +(7, 'The a list of users that can be targeting one or more groups and excluded users that already belongs to an item in a view.', 'CustomUser', '{\"properties0\":{\"name\":\"type\",\"example\":\"staffusers\",\"mandatory\":\"1\",\"description\":\"(mandatory) can be anything, just not the same as any other default Joomla field type.\"},\"properties1\":{\"name\":\"name\",\"example\":\"staff\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Staff\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties5\":{\"name\":\"multiple\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether multiple items can be selected at the same time (true or false).\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties7\":{\"name\":\"readonly\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties8\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties9\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"\"},\"properties10\":{\"name\":\"hint\",\"example\":\"select a user\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"\"},\"properties11\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties12\":{\"name\":\"extends\",\"example\":\"user\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"The JFormField sub class that should be extended. The options are (\'list\',\'radio\',\'checkboxes\')\"},\"properties13\":{\"name\":\"table\",\"example\":\"#__users\",\"mandatory\":\"1\",\"description\":\"(mandatory) The table being linked to. Must be #__users\"},\"properties14\":{\"name\":\"component\",\"example\":\"com_users\",\"mandatory\":\"1\",\"description\":\"(mandatory) The name of the component where this table is found. Must be com_users\"},\"properties15\":{\"name\":\"view\",\"example\":\"###view###\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The single view name if the place this field is added.\"},\"properties16\":{\"name\":\"views\",\"example\":\"###views###\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The list view name if the place this field is added.\"},\"properties17\":{\"name\":\"value_field\",\"example\":\"name\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The name of the text field in table linked to.\"},\"properties18\":{\"name\":\"key_field\",\"example\":\"id\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The field from the linked table to save in this table as the unique key.\"},\"properties19\":{\"name\":\"type_php_1\",\"example\":\"\\t\\t\\/\\/ set the groups array\\r\\n\\t\\treturn \\\\JComponentHelper::getParams(\'com_###component###\')->get(\'###type###\');\",\"adjustable\":\"1\",\"description\":\"The php for the getGroups method.\"},\"properties22\":{\"name\":\"type_phpx_1\",\"example\":\"\\t\\t\\/\\/ To ensure that there is only one record per user\\r\\n\\t\\t\\/\\/ Get a db connection.\\r\\n\\t\\t$db = Factory::getDbo();\\r\\n\\t\\t\\/\\/ Create a new query object.\\r\\n\\t\\t$query = $db->getQuery(true);\\r\\n\\t\\t\\/\\/ Select all records from the #__###component###_###view### table from ###CODE### column\\\".\\r\\n\\t\\t$query->select($db->quoteName(\'###CODE###\'));\\r\\n\\t\\t$query->from($db->quoteName(\'#__###component###_###view###\'));\\r\\n\\t\\t$db->setQuery($query);\\r\\n\\t\\t$db->execute();\\r\\n\\t\\t$found = $db->getNumRows();\\r\\n\\t\\tif ($found)\\r\\n\\t\\t{\\r\\n\\t\\t\\t\\/\\/ return all users already used\\r\\n\\t\\t\\treturn array_unique($db->loadColumn());\\r\\n\\t\\t}\\r\\n\\t\\treturn null;\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"}}', 'Provides list of users.', '', 1, 6, '', '', 'a4a39f70-070f-459c-be4b-0ac103a29b9a'), (8, 'The Editor field type provides a WYSIWYG editor.', 'Editor', '{\"properties0\":{\"name\":\"type\",\"example\":\"editor\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be editor.\"},\"properties1\":{\"name\":\"name\",\"example\":\"mytextblock\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the parameter.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Test Field\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"default\",\"example\":\"Some text\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties4\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the label.\"},\"properties5\":{\"name\":\"message\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties6\":{\"name\":\"width\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) defines the width (in pixels) of the wysiwyg editor and defaults to 100%.\"},\"properties7\":{\"name\":\"height\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) defines the height (in pixels) of the wysiwyg editor and defaults to 250px.\"},\"properties8\":{\"name\":\"cols\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) defines the width of the editor (in columns).\"},\"properties9\":{\"name\":\"rows\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) defines the height of the editor (in rows).\"},\"properties10\":{\"name\":\"buttons\",\"example\":\"no\",\"adjustable\":\"1\",\"description\":\"(optional) can be an array of plugin buttons to be excluded or set to false. The default editors-xtd are: article, image, pagebreak and readmore.\"},\"properties11\":{\"name\":\"syntax\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) can be used to set the code syntax matching for this field.\"},\"properties12\":{\"name\":\"hide\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) array of plugin buttons to be hidden. eg... set buttons=\\\"true\\\" hide=\\\"readmore,pagebreak\\\"\"},\"properties13\":{\"name\":\"editor\",\"example\":\"codemirror|none\",\"adjustable\":\"1\",\"description\":\"specifies the editor to be used and can include two options (editor=\\\"desired|alternative\\\")\"},\"properties14\":{\"name\":\"filter\",\"example\":\"safehtml\",\"adjustable\":\"1\",\"description\":\"(optional) allow the system to save certain html tags or raw data.\"},\"properties15\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties16\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties17\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides an editor area field.', '', 1, 11, '', '', '51f288d2-6eaa-42bc-a182-a6f69b3032b8'), (9, 'The hidden form field type provides a hidden field for saving a field whose value cannot be altered directly by a user in the Administrator (it can be altered in code or by editing the params.ini file). If the parameter has a saved value this is entered i', 'Hidden', '{\"properties0\":{\"name\":\"type\",\"example\":\"hidden\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be hidden.\"},\"properties1\":{\"name\":\"name\",\"example\":\"mysecretvariable\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"default\",\"example\":\"1\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the data which needs to be collected.\"},\"properties5\":{\"name\":\"filter\",\"example\":\"STRING\",\"adjustable\":\"1\",\"description\":\"(optional) allow the system to save certain html tags or raw data.\"},\"properties4\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"}}', 'provides a hidden field for saving a form field whose value cannot be altered directly by a user.', '', 1, 2, '', '', '82f1b5ca-bb9b-44d7-9a7a-9a03fb2a31dd'), (10, 'The integer form field type provides a select box with a range of integer values. If the field has a value saved, this value is displayed when the page is first loaded. If not, the default value (if any) is selected.', 'Integer', '{\"properties0\":{\"name\":\"type\",\"example\":\"integer\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be integer.\"},\"properties1\":{\"name\":\"name\",\"example\":\"size\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Size\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the default value.\"},\"properties4\":{\"name\":\"message\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties5\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties6\":{\"name\":\"class\",\"example\":\"text_area\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'text_area\'.\"},\"properties7\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties8\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties9\":{\"name\":\"first\",\"example\":\"1\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) this value is the lowest on the list.\"},\"properties10\":{\"name\":\"last\",\"example\":\"20\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) this value is the highest on the list.\"},\"properties11\":{\"name\":\"step\",\"example\":\"5\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) each option will be the previous option incremented by this integer, starting with the first value until the last value is reached.\"},\"properties12\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties13\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'provides a drop down list of integers between a minimum and maximum.', '', 1, 6, '', '', 'fdbb50ea-35d2-45b2-a0bc-076fdf1544b8'), -(11, 'The list form field type provides a drop down list or a list box of custom-defined entries. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.', 'List', '{\"properties0\":{\"name\":\"type\",\"example\":\"list\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be list.\"},\"properties1\":{\"name\":\"name\",\"example\":\"mylist\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select an option\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"message\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties5\":{\"name\":\"class\",\"example\":\"list_class\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties6\":{\"name\":\"multiple\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether multiple items can be selected at the same time (true or false).\"},\"properties7\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) filter options\"},\"properties8\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties9\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties10\":{\"name\":\"option\",\"example\":\"0|Option 1,1|Option 2,2|Option 1\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) set the options of this radio. Separate options with commas and use the pipe symbol to separate value from text.\"},\"properties11\":{\"name\":\"useglobal\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) if set to true, it will show the value that is set in the global configuration if found in the database.\"},\"properties12\":{\"name\":\"default\",\"example\":\"0\",\"adjustable\":\"1\",\"description\":\"(optional) is the default list item value.\"},\"properties13\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+ https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties14\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'provides a drop down list of custom-defined entries.', '', 1, 10, '', '', 'a51dfc06-1b9b-4d0a-86ba-f705bcd40d4d'), -(12, 'The media form field type provides modal access to the media manager for the choice of an image. Users with appropriate permissions will be able to upload files.', 'Media', '{\"properties0\":{\"name\":\"type\",\"example\":\"media\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be media.\"},\"properties1\":{\"name\":\"name\",\"example\":\"media\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Media\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"directory\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the directory from which the user will be able to choose a file. This attribute should be relative to the top level \\/images\\/ folder.\"},\"properties5\":{\"name\":\"preview\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) shows or hides the preview of the currently chosen image. (\\\"true\\\": Show always, \\\"tooltip\\\": Show as tooltip, \\\"false\\\": Show never) (since Joomla! 2.5.5)\"},\"properties6\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides modal access to the media manager for insertion of images with upload for users with appropriate permissions.', '', 1, 4, '', '', '69957007-e3d4-4976-a32b-611d02dbad71'), +(11, 'The list form field type provides a drop down list or a list box of custom-defined entries. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.', 'List', '{\"properties0\":{\"name\":\"type\",\"example\":\"list\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be list.\"},\"properties1\":{\"name\":\"name\",\"example\":\"mylist\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select an option\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"message\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties5\":{\"name\":\"class\",\"example\":\"list_class\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties6\":{\"name\":\"layout\",\"example\":\"joomla.form.field.list-fancy-select\",\"adjustable\":\"1\",\"description\":\"(optional) New layout field added in Joomla 4\"},\"properties7\":{\"name\":\"multiple\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether multiple items can be selected at the same time (true or false).\"},\"properties8\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) filter options\"},\"properties9\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties10\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties11\":{\"name\":\"option\",\"example\":\"0|Option 1,1|Option 2,2|Option 1\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) set the options of this radio. Separate options with commas and use the pipe symbol to separate value from text.\"},\"properties12\":{\"name\":\"useglobal\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) if set to true, it will show the value that is set in the global configuration if found in the database.\"},\"properties13\":{\"name\":\"default\",\"example\":\"0\",\"adjustable\":\"1\",\"description\":\"(optional) is the default list item value.\"},\"properties14\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+ https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties15\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'provides a drop down list of custom-defined entries.', '', 1, 12, '', '', 'a51dfc06-1b9b-4d0a-86ba-f705bcd40d4d'), +(12, 'The media form field type provides modal access to the media manager for the choice of an image. Users with appropriate permissions will be able to upload files.', 'Media', '{\"properties0\":{\"name\":\"type\",\"example\":\"media\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be media.\"},\"properties1\":{\"name\":\"name\",\"example\":\"media\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Media\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"directory\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the directory from which the user will be able to choose a file. This attribute should be relative to the top level \\/images\\/ folder.\"},\"properties5\":{\"name\":\"preview\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) shows or hides the preview of the currently chosen image. (\\\"true\\\": Show always, \\\"tooltip\\\": Show as tooltip, \\\"false\\\": Show never) (since Joomla! 2.5.5)\"},\"properties6\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties7\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'provides modal access to the media manager for insertion of images with upload for users with appropriate permissions.', '', 1, 5, '', '', '69957007-e3d4-4976-a32b-611d02dbad71'), (13, 'Provides a meter to show value in a range, updated with jQuery if needed or simply a fixed value.', 'Meter', '{\"properties0\":{\"name\":\"type\",\"example\":\"meter\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be meter.\"},\"properties1\":{\"name\":\"name\",\"example\":\"meter\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Meter\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"width\",\"example\":\"330px\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of meter box\"},\"properties4\":{\"name\":\"color\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The background color\"},\"properties5\":{\"name\":\"default\",\"example\":\"9\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties6\":{\"name\":\"animated\",\"example\":\"1\",\"adjustable\":\"1\",\"description\":\"(optional) lets the bar have strips\"},\"properties7\":{\"name\":\"active\",\"example\":\"1\",\"adjustable\":\"1\",\"description\":\"(optional) lets the strips on the bar move\"},\"properties8\":{\"name\":\"description\",\"example\":\"Enter some description\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties9\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'text_area\'.\"},\"properties10\":{\"name\":\"min\",\"example\":\"1\",\"adjustable\":\"1\",\"description\":\"(mandatory) this value is the min on the meter.\"},\"properties11\":{\"name\":\"max\",\"example\":\"20\",\"adjustable\":\"1\",\"description\":\"(mandatory) this value is the max on meter.\"},\"properties12\":{\"name\":\"step\",\"example\":\"1\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) each option will be the previous option incremented by this integer, starting with the first value until the last value is reached.\"},\"properties13\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'Provides a meter to show value in a range.', '', 1, 3, '', '', '81668284-e572-4e17-927b-ba697fc64bd0'), (14, 'This form field makes it possible to create titles, texts, descriptions and even alert boxes. It also allows you to bring order in the settings for extensions, by separating them with useful titles. Or adding descriptions for certain settings (without having to rely on the tooltips). Or adding any other text you want.', 'Note', '{\"properties0\":{\"name\":\"type\",\"example\":\"note\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be note\"},\"properties1\":{\"name\":\"name\",\"example\":\"note_one\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"The notice\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory or optional if using description) (translatable) is the descriptive title of the note \"},\"properties3\":{\"name\":\"description\",\"example\":\"The notice description\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional if using label)(translatable) the description\\/text of the note \"},\"properties4\":{\"name\":\"heading\",\"example\":\"h4\",\"adjustable\":\"1\",\"description\":\"(optional) the type of heading element to use for the label (default: h4)\"},\"properties5\":{\"name\":\"class\",\"example\":\"alert\",\"adjustable\":\"1\",\"description\":\"(optional) a class name (or class names), like these examples ( alert, alert alert-info, alert alert-success, alert alert-error )\"},\"properties6\":{\"name\":\"close\",\"example\":\"true\",\"adjustable\":\"1\",\"description\":\"(optional) a value of \'true\' (for alerts) or the value for the data-dismiss of the bootstrap close icon\"},\"properties7\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+ https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'supports a one line text field.', '', 1, 5, '', '', 'f9ecacd0-8481-4157-8c71-d7aaefc2b7c3'), (15, 'Provides a one line text box with up-down handles to set a number in the field.', 'Number', '{\"properties0\":{\"name\":\"type\",\"example\":\"number\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be number.\"},\"properties1\":{\"name\":\"name\",\"example\":\"number\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Number\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the default value.\"},\"properties4\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties5\":{\"name\":\"class\",\"example\":\"text_area\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'text_area\'.\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties7\":{\"name\":\"min\",\"example\":\"1\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) this value is the lowest on the list.\"},\"properties8\":{\"name\":\"max\",\"example\":\"40\",\"mandatory\":\"1\",\"description\":\"(mandatory) this value is the highest on the list.\"},\"properties9\":{\"name\":\"step\",\"example\":\"5\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) each option will be the previous option incremented by this integer, starting with the first value until the last value is reached.\"},\"properties10\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Javascript that should run on changing of the value.\"},\"properties11\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'Provides a one line text box with up-down handles to set a number in the field.', '', 1, 4, '', '', '5abd2b73-643b-4273-841a-787991aad968'), @@ -2245,7 +2300,7 @@ INSERT INTO `#__componentbuilder_fieldtype` (`id`, `description`, `name`, `prope (26, 'The timezones form field type provides a drop down list of time zones. If the field has a value saved, this value is displayed when the page is first loaded. If not, the default value (if any) is selected.', 'Timezone', '{\"properties0\":{\"name\":\"type\",\"example\":\"timezone\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be timezone.\"},\"properties1\":{\"name\":\"name\",\"example\":\"timezone\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Timezone\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the default time zone. For example, use \'-10\' for \'(UTC -10:00) Hawaii\'.\"},\"properties4\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties5\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides a drop down list of time zones.', '', 1, 3, '', '', 'ed8d8cf4-cb05-49cc-95ef-4ef275f539f9'), (27, 'This field essentially is a text field with the type of url. If a fully qualified url (that is one with a scheme and domain such as http://example.com) is entered and it uses idn (that is uses characters that are non ascii such as ê or Ψ) it will translat', 'URL', '{\"properties0\":{\"name\":\"type\",\"example\":\"url\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be url.\"},\"properties1\":{\"name\":\"name\",\"example\":\"website\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Website\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"size\",\"example\":\"10\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties4\":{\"name\":\"maxlength\",\"example\":\"50\",\"adjustable\":\"1\",\"description\":\"(optional) limits the number of characters that may be entered.\"},\"properties5\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties6\":{\"name\":\"description\",\"example\":\"Enter website address\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties7\":{\"name\":\"class\",\"example\":\"text_area\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'text_area\'.\"},\"properties8\":{\"name\":\"readonly\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties9\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties10\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties11\":{\"name\":\"relative\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) set to true for relative URLs\"},\"properties12\":{\"name\":\"filter\",\"example\":\"url\",\"adjustable\":\"1\",\"description\":\"(optional) allow the system to save certain html tags or raw data.\"},\"properties13\":{\"name\":\"validated\",\"example\":\"url\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties14\":{\"name\":\"scheme\",\"example\":\"http,https,mailto\",\"adjustable\":\"1\",\"description\":\"(optional) Validates that the value is a URL with a valid scheme (which can be restricted by the optional comma-separated field \'scheme\'), and passes a basic syntax check.\"},\"properties15\":{\"name\":\"message\",\"example\":\"Error! Please add website here.\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties16\":{\"name\":\"hint\",\"example\":\"Your Website Here\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) The placeholder to display inside the text box.\"},\"properties19\":{\"name\":\"autocomplete\",\"example\":\"on\",\"adjustable\":\"1\",\"description\":\"(optional) The autocomplete state for the form field. If \'off\' element will not be automatically completed by browser.\"},\"properties17\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+ https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties18\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'provides a URL text input field.', '', 1, 10, '', '', '8df6e07e-2b16-43ed-a18d-2059fa44cdf1'), (28, 'The user form field type provides a modal select box of users.', 'User', '{\"properties0\":{\"name\":\"type\",\"example\":\"user\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be user.\"},\"properties1\":{\"name\":\"name\",\"example\":\"user\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field. This must match the name of the query results column that contains the values that will be shown to the user in the drop-down list, unless a different name is specified in the value_field attribute.\"},\"properties2\":{\"name\":\"label\",\"example\":\"User\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties5\":{\"name\":\"size\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties7\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides a modal list of users.', '', 1, 4, '', '', 'b0641980-5e78-42f6-972f-86aa607db23e'), -(29, 'The usergroup form field type provides a modal select box of user groups.', 'Usergroup', '{\"properties0\":{\"name\":\"type\",\"example\":\"usergroup\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be usergroup.\"},\"properties1\":{\"name\":\"name\",\"example\":\"usergroup\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field. This must match the name of the query results column that contains the values that will be shown to the user in the drop-down list, unless a different name is specified in the value_field attribute.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Group\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"Select a group\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties5\":{\"name\":\"size\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the field required true if yes.\"},\"properties7\":{\"name\":\"multiple\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) If set to multiple then allows more than one usergroup to be selected.\"},\"properties8\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides a drop down list of user groups.', '', 1, 3, '', '', 'e2f31181-fbb3-4c3a-859d-72b6b0cff308'), +(29, 'The usergroup form field type provides a modal select box of user groups.', 'Usergrouplist', '{\"properties0\":{\"name\":\"type\",\"example\":\"usergrouplist\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be usergroup.\"},\"properties1\":{\"name\":\"name\",\"example\":\"usergroup\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field. This must match the name of the query results column that contains the values that will be shown to the user in the drop-down list, unless a different name is specified in the value_field attribute.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Group\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"Select a group\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties9\":{\"name\":\"layout\",\"example\":\"joomla.form.field.list-fancy-select\",\"adjustable\":\"1\",\"description\":\"(optional) (translatable) is the layout, for example joomla.form.field.list-fancy-select.\"},\"properties5\":{\"name\":\"size\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the field required true if yes.\"},\"properties10\":{\"name\":\"checksuperusergroup\",\"example\":\"1\",\"adjustable\":\"1\",\"description\":\"(optional) is boolean to omit Super User groups. Values 1 or 0.\"},\"properties7\":{\"name\":\"multiple\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) If set to multiple then allows more than one usergroup to be selected.\"},\"properties8\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides a drop down list of user groups.', '', 1, 5, '', '', 'e2f31181-fbb3-4c3a-859d-72b6b0cff308'), (30, 'The filelist form field type provides a drop down list of files from a specified directory. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.\r\n\r\nBy default, the first item on the', 'Filelist', '{\"properties0\":{\"name\":\"type\",\"example\":\"filelist\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be filelist.\"},\"properties1\":{\"name\":\"name\",\"example\":\"myfile\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a file\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"directory\",\"example\":\"images\\/stories\",\"adjustable\":\"1\",\"description\":\"(optional) is the filesystem path to the directory containing the files to be listed. If omitted the directory given by JPATH_ROOT is assumed.\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the default file name.\"},\"properties5\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties6\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a regular expression string which is used to filter the list of files selected for inclusion in the drop-down list. If omitted, all files in the directory are included. The filter argument expression is applied before the exclude argument expression. For information on constructing regular expressions see Regular expressions in parameter arguments.\"},\"properties7\":{\"name\":\"exclude\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a regular expression string which is used to exclude files from the list. The exclude argument expression is applied after the filter argument expression. For information on constructing regular expressions see Regular expressions in parameter arguments.\"},\"properties8\":{\"name\":\"stripext\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a Boolean argument. If true then file name extensions will be stripped from the file names listed. Also note that the file name will be saved without the extension too.\"},\"properties9\":{\"name\":\"hide_none\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a Boolean argument. If true, the \'- Do not use -\' item is omitted from the drop-down list.\"},\"properties10\":{\"name\":\"hide_default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a Boolean argument. If true, the \'- Use default -\' item is omitted from the drop-down list.\"},\"properties11\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'Provides a drop down list of files from a specified directory.', '', 1, 4, '', 1, '0c80df15-52c6-4647-983b-4bb4888a2edf'), (31, 'The folderlist form field type provides a drop down list of folders from a specfied directory. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.\r\n\r\nBy default, the first item on ', 'Folderlist', '{\"properties0\":{\"name\":\"type\",\"example\":\"folderlist\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be folderlist.\"},\"properties1\":{\"name\":\"name\",\"example\":\"myfolder\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a folder\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"directory\",\"example\":\"images\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the filesystem path to the directory containing the folders to be listed.\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the default folder name.\"},\"properties5\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties6\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a regular expression string which is used to filter the list of folders selected for inclusion in the drop-down list. If omitted, all folders in the directory are included. The filter argument expression is applied before the exclude argument expression. For information on constructing regular expressions see Regular expressions in parameter arguments.\"},\"properties7\":{\"name\":\"exclude\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a regular expression string which is used to exclude folders from the list. The exclude argument expression is applied after the filter argument expression. For information on constructing regular expressions see Regular expressions in parameter arguments.\"},\"properties8\":{\"name\":\"hide_none\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a Boolean argument. If true, the \'- Do not use -\' item is omitted from the drop-down list.\"},\"properties9\":{\"name\":\"hide_default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a Boolean argument. If true, the \'- Use default -\' item is omitted from the drop-down list.\"},\"properties10\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'Provides a drop down list of folders from a specified directory.', '', 1, 4, '', 2, 'd3ab2ae4-9370-4497-ae6d-dee2e0b74b7a'), (32, 'Note: When using the file input type you should always add the attribute enctype=\"multipart/form-data\" to your form tag. Otherwise, the uploaded files will not be attached correctly.\r\n\r\nNote 2: You can put a soft limit file size by adding a hidden field with name=\"MAX_FILE_SIZE\" and value the maximum allowed bytes which is handled by php, but you must also handle it in your code with or without it.', 'File', '{\"properties0\":{\"name\":\"type\",\"example\":\"file\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be file.\"},\"properties1\":{\"name\":\"name\",\"example\":\"myfilevalue\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Enter some text\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"Choose an image from your computer with maximum 100KB\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value, but doesn\'t mean much for a file.\"},\"properties5\":{\"name\":\"size\",\"example\":\"10\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the file box in characters.\"},\"properties6\":{\"name\":\"accept\",\"example\":\"image\\/*\",\"adjustable\":\"1\",\"description\":\"(optional) Tells the browser what MIME types your form will allow to be uploaded.\"},\"properties7\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties8\":{\"name\":\"labelclass\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) adds a CSS class for form field\'s label; for Joomla 2.5.4+\"},\"properties9\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute\"},\"properties10\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"},\"properties11\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) For Joomla form validating it to be filled in\"},\"properties12\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Whether to Joomla validate the field according to rules\"},\"properties13\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+ https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'Provides an input field for files', '', 1, 9, '', 3, '6da71c1e-119c-4e0d-a309-f3e52ecfa1d1'), @@ -2265,84 +2320,84 @@ INSERT INTO `#__componentbuilder_fieldtype` (`id`, `description`, `name`, `prope -- INSERT INTO `#__componentbuilder_language` (`id`, `langtag`, `name`, `params`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES -(1, 'af-ZA', 'Afrikaans', '', 1, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(2, 'sq-AL', 'Albanian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(3, 'ar-AA', 'Arabic Unitag', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(4, 'hy-AM', 'Armenian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(5, 'id-ID', 'Bahasa Indonesia', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(6, 'eu-ES', 'Basque', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(7, 'be-BY', 'Belarusian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(8, 'bn-BD', 'Bengali', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(9, 'bs-BA', 'Bosnian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(10, 'bg-BG', 'Bulgarian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(11, 'ca-ES', 'Catalan', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(12, 'zh-CN', 'Chinese Simplified', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(13, 'zh-TW', 'Chinese Traditional', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(14, 'hr-HR', 'Croatian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(15, 'cs-CZ', 'Czech', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(16, 'da-DK', 'Danish', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(17, 'prs-AF', 'Dari Persian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(18, 'nl-NL', 'Dutch', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(19, 'dz-BT', 'Dzongkha', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(20, 'en-AU', 'English AU', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(21, 'en-CA', 'English CA', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(22, 'en-GB', 'English GB', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(23, 'en-NZ', 'English NZ', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(24, 'en-US', 'English US', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(25, 'eo-XX', 'Esperanto', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(26, 'et-EE', 'Estonian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(27, 'fi-FI', 'Finnish', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(28, 'nl-BE', 'Flemish', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(29, 'fr-FR', 'French', '', 1, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(30, 'fr-CA', 'French CA', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(31, 'gl-ES', 'Galician', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(32, 'ka-GE', 'Georgian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(33, 'de-AT', 'German AT', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(34, 'de-CH', 'German CH', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(35, 'de-DE', 'German DE', '', 1, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(36, 'de-LI', 'German LI', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(37, 'de-LU', 'German LU', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(38, 'el-GR', 'Greek', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(39, 'he-IL', 'Hebrew', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(40, 'hi-IN', 'Hindi', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(41, 'hu-HU', 'Hungarian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(42, 'ga-IE', 'Irish', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(43, 'it-IT', 'Italian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(44, 'ja-JP', 'Japanese', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(45, 'km-KH', 'Khmer', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(46, 'ko-KR', 'Korean', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(47, 'lv-LV', 'Latvian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(48, 'mk-MK', 'Macedonian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(49, 'ms-MY', 'Malay', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(50, 'srp-ME', 'Montenegrin', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(51, 'nb-NO', 'Norwegian Bokmal', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(52, 'nn-NO', 'Norwegian Nynorsk', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(53, 'fa-IR', 'Persian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(54, 'pl-PL', 'Polish', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(55, 'pt-PT', 'Portuguese', '', 1, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(56, 'pt-BR', 'Portuguese Brazil', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(57, 'ro-RO', 'Romanian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(58, 'ru-RU', 'Russian', '', 1, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 4, '', 1), -(59, 'sr-RS', 'Serbian Cyrillic', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(60, 'sr-YU', 'Serbian Latin', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(61, 'si-LK', 'Sinhala', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(62, 'sk-SK', 'Slovak', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(63, 'sl-SI', 'Slovenian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(64, 'es-ES', 'Spanish', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(65, 'es-CO', 'Spanish CO', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(66, 'sw-KE', 'Swahili', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(67, 'sv-SE', 'Swedish', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(68, 'sy-IQ', 'Syriac', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(69, 'ta-IN', 'Tamil', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(70, 'th-TH', 'Thai', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(71, 'tr-TR', 'Turkish', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(72, 'tk-TM', 'Turkmen', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(73, 'uk-UA', 'Ukrainian', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(74, 'ug-CN', 'Uyghur', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(75, 'vi-VN', 'Vietnamese', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(76, 'cy-GB', 'Welsh', '', 2, '2018-04-19 13:43:44', '2020-03-19 13:41:00', 3, '', 1), -(77, 'lt-LT', 'Lithuanian', '', 2, '2018-09-14 10:39:11', '2020-03-19 13:41:00', 2, '', 2), -(78, 'kk-KZ', 'Kazakh', '', 2, '2020-03-19 13:41:00', '0000-00-00 00:00:00', 1, '', 3); +(1, 'af-ZA', 'Afrikaans', '', 1, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(2, 'sq-AL', 'Albanian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(3, 'ar-AA', 'Arabic Unitag', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(4, 'hy-AM', 'Armenian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(5, 'id-ID', 'Indonesian, Bahasa Indonesia', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(6, 'eu-ES', 'Basque', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(7, 'be-BY', 'Belarusian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(8, 'bn-BD', 'Bengali, Bangladesh', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(9, 'bs-BA', 'Bosnian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(10, 'bg-BG', 'Bulgarian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(11, 'ca-ES', 'Catalan', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(12, 'zh-CN', 'Chinese, Simplified', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(13, 'zh-TW', 'Chinese, Traditional', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(14, 'hr-HR', 'Croatian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(15, 'cs-CZ', 'Czech', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(16, 'da-DK', 'Danish', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(17, 'prs-AF', 'Dari Persian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(18, 'nl-NL', 'Dutch', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(19, 'dz-BT', 'Dzongkha', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(20, 'en-AU', 'English, Australia', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(21, 'en-CA', 'English, Canada', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(22, 'en-GB', 'English GB', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(23, 'en-NZ', 'English, New Zealand', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(24, 'en-US', 'English, USA', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(25, 'eo-XX', 'Esperanto', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(26, 'et-EE', 'Estonian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(27, 'fi-FI', 'Finnish', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(28, 'nl-BE', 'Flemish', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(29, 'fr-FR', 'French', '', 1, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(30, 'fr-CA', 'French, Canada', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(31, 'gl-ES', 'Galician', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(32, 'ka-GE', 'Georgian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(33, 'de-AT', 'German, Austria', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(34, 'de-CH', 'German, Switzerland', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(35, 'de-DE', 'German', '', 1, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(36, 'de-LI', 'German, Liechtenstein', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(37, 'de-LU', 'German, Luxembourg', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(38, 'el-GR', 'Greek', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(39, 'he-IL', 'Hebrew', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(40, 'hi-IN', 'Hindi, India', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(41, 'hu-HU', 'Hungarian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(42, 'ga-IE', 'Irish', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(43, 'it-IT', 'Italian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(44, 'ja-JP', 'Japanese', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(45, 'km-KH', 'Khmer', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(46, 'ko-KR', 'Korean', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(47, 'lv-LV', 'Latvian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(48, 'mk-MK', 'Macedonian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(49, 'ms-MY', 'Malay', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(50, 'srp-ME', 'Montenegrin', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(51, 'nb-NO', 'Norwegian Bokmål', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(52, 'nn-NO', 'Norwegian Nynorsk', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(53, 'fa-IR', 'Persian Farsi', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(54, 'pl-PL', 'Polish', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(55, 'pt-PT', 'Portuguese, Portugal', '', 1, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(56, 'pt-BR', 'Portuguese, Brazil', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(57, 'ro-RO', 'Romanian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(58, 'ru-RU', 'Russian', '', 1, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 6, '', 1), +(59, 'sr-RS', 'Serbian, Cyrillic', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(60, 'sr-YU', 'Serbian, Latin', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(61, 'si-LK', 'Sinhala', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(62, 'sk-SK', 'Slovak', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(63, 'sl-SI', 'Slovenian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(64, 'es-ES', 'Spanish', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(65, 'es-CO', 'Spanish, Colombia', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(66, 'sw-KE', 'Swahili', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(67, 'sv-SE', 'Swedish', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(68, 'sy-IQ', 'Syriac, East', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(69, 'ta-IN', 'Tamil, India', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(70, 'th-TH', 'Thai', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(71, 'tr-TR', 'Turkish', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(72, 'tk-TM', 'Turkmen', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(73, 'uk-UA', 'Ukrainian', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(74, 'ug-CN', 'Uyghur', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(75, 'vi-VN', 'Vietnamese', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(76, 'cy-GB', 'Welsh', '', 2, '2018-04-19 13:43:44', '2023-12-26 07:40:20', 5, '', 1), +(77, 'lt-LT', 'Lithuanian', '', 2, '2018-09-14 10:39:11', '2023-12-26 07:40:20', 4, '', 2), +(78, 'kk-KZ', 'Kazakh', '', 2, '2020-03-19 13:41:00', '2023-12-26 07:40:20', 3, '', 3); -- -- Dumping data for table `#__componentbuilder_help_document` @@ -2365,80 +2420,78 @@ INSERT INTO `#__componentbuilder_help_document` (`id`, `admin_view`, `alias`, `a -- Dumping data for table `#__componentbuilder_admin_fields` -- -INSERT INTO `#__componentbuilder_admin_fields` (`id`, `addfields`, `admin_view`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES -(111, '{\"0\":{\"field\":\"84\",\"list\":\"1\",\"order_list\":\"2\",\"sort\":\"1\",\"search\":\"1\",\"tab\":\"1\",\"alignment\":\"3\",\"order_edit\":\"1\"},\"1\":{\"field\":\"199\",\"list\":\"1\",\"order_list\":\"1\",\"title\":\"1\",\"sort\":\"1\",\"search\":\"1\",\"link\":\"1\",\"tab\":\"1\",\"alignment\":\"4\",\"order_edit\":\"1\"},\"2\":{\"field\":\"23\",\"list\":\"\",\"order_list\":\"0\",\"alias\":\"1\",\"search\":\"1\",\"tab\":\"1\",\"alignment\":\"4\",\"order_edit\":\"2\"},\"3\":{\"field\":\"203\",\"list\":\"2\",\"order_list\":\"0\",\"tab\":\"1\",\"alignment\":\"5\",\"order_edit\":\"1\"},\"4\":{\"field\":\"682\",\"list\":\"\",\"order_list\":\"0\",\"sort\":\"1\",\"search\":\"1\",\"filter\":\"1\",\"tab\":\"2\",\"alignment\":\"1\",\"order_edit\":\"1\"},\"5\":{\"field\":\"100\",\"list\":\"\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"1\"},\"6\":{\"field\":\"196\",\"list\":\"\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"2\"},\"7\":{\"field\":\"1011\",\"list\":\"\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"3\"},\"8\":{\"field\":\"158\",\"list\":\"\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"4\"},\"9\":{\"field\":\"280\",\"list\":\"\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"5\"}}', 109, 1, '2017-10-12 19:52:03', '2019-01-28 16:27:19', 7, '', ''); +INSERT INTO `#__componentbuilder_admin_fields` (`id`, `addfields`, `admin_view`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `params`) VALUES +(111, '{\"0\":{\"field\":\"84\",\"list\":\"1\",\"order_list\":\"2\",\"sort\":\"1\",\"search\":\"1\",\"tab\":\"1\",\"alignment\":\"3\",\"order_edit\":\"1\"},\"1\":{\"field\":\"199\",\"list\":\"1\",\"order_list\":\"1\",\"title\":\"1\",\"sort\":\"1\",\"search\":\"1\",\"link\":\"1\",\"tab\":\"1\",\"alignment\":\"4\",\"order_edit\":\"1\"},\"2\":{\"field\":\"23\",\"list\":\"\",\"order_list\":\"0\",\"alias\":\"1\",\"search\":\"1\",\"tab\":\"1\",\"alignment\":\"4\",\"order_edit\":\"2\"},\"3\":{\"field\":\"203\",\"list\":\"2\",\"order_list\":\"0\",\"tab\":\"1\",\"alignment\":\"5\",\"order_edit\":\"1\"},\"4\":{\"field\":\"682\",\"list\":\"\",\"order_list\":\"0\",\"sort\":\"1\",\"search\":\"1\",\"filter\":\"1\",\"tab\":\"2\",\"alignment\":\"1\",\"order_edit\":\"1\"},\"5\":{\"field\":\"100\",\"list\":\"\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"1\"},\"6\":{\"field\":\"196\",\"list\":\"\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"2\"},\"7\":{\"field\":\"1011\",\"list\":\"\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"3\"},\"8\":{\"field\":\"158\",\"list\":\"\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"4\"},\"9\":{\"field\":\"280\",\"list\":\"\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"5\"}}', 109, 1, '2017-10-12 19:52:03', '2019-01-28 16:27:19', 7, '', '', ''); -- -- Dumping data for table `#__componentbuilder_admin_fields_conditions` -- -INSERT INTO `#__componentbuilder_admin_fields_conditions` (`id`, `addconditions`, `admin_view`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES -(111, '{\"addconditions0\":{\"target_field\":[\"1011\",\"100\",\"158\",\"196\",\"280\"],\"target_behavior\":\"1\",\"target_relation\":\"0\",\"match_field\":\"682\",\"match_behavior\":\"1\",\"match_options\":\"1|Yes\"}}', 109, 1, '2017-10-12 21:36:00', '0000-00-00 00:00:00', 2, '', ''); - - +INSERT INTO `#__componentbuilder_admin_fields_conditions` (`id`, `addconditions`, `admin_view`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `params`) VALUES +(111, '{\"addconditions0\":{\"target_field\":[\"1011\",\"100\",\"158\",\"196\",\"280\"],\"target_behavior\":\"1\",\"target_relation\":\"0\",\"match_field\":\"682\",\"match_behavior\":\"1\",\"match_options\":\"1|Yes\"}}', 109, 1, '2017-10-12 21:36:00', '0000-00-00 00:00:00', 2, '', '', ''); -- -- Dumping data for table `#__componentbuilder_component_admin_views` -- -INSERT INTO `#__componentbuilder_component_admin_views` (`id`, `addadmin_views`, `joomla_component`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES -(27, '{\"addadmin_views0\":{\"adminview\":\"109\",\"icomoon\":\"eye-open\",\"mainmenu\":\"1\",\"dashboard_add\":\"1\",\"dashboard_list\":\"1\",\"submenu\":\"1\",\"checkin\":\"1\",\"history\":\"1\",\"joomla_fields\":\"1\",\"metadata\":\"1\",\"access\":\"1\",\"port\":\"1\",\"filter\":\"2\",\"edit_create_site_view\":\"1\",\"order\":\"1\"}}', 25, 1, '2017-10-28 03:56:26', '2021-02-08 10:32:04', 7, '', ''); +INSERT INTO `#__componentbuilder_component_admin_views` (`id`, `addadmin_views`, `joomla_component`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `params`) VALUES +(27, '{\"addadmin_views0\":{\"adminview\":\"109\",\"icomoon\":\"eye-open\",\"mainmenu\":\"1\",\"dashboard_add\":\"1\",\"dashboard_list\":\"1\",\"submenu\":\"1\",\"checkin\":\"1\",\"history\":\"1\",\"joomla_fields\":\"1\",\"metadata\":\"1\",\"access\":\"1\",\"port\":\"1\",\"filter\":\"2\",\"edit_create_site_view\":\"1\",\"order\":\"1\"}}', 25, 1, '2017-10-28 03:56:26', '2021-02-08 10:32:04', 7, '', '', ''); -- -- Dumping data for table `#__componentbuilder_component_site_views` -- -INSERT INTO `#__componentbuilder_component_site_views` (`id`, `addsite_views`, `joomla_component`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES -(27, '{\"addsite_views0\":{\"siteview\":\"23\",\"menu\":\"1\",\"metadata\":\"1\",\"default_view\":\"1\",\"access\":\"1\",\"public_access\":\"1\"},\"addsite_views1\":{\"siteview\":\"25\",\"metadata\":\"1\",\"access\":\"1\"}}', 25, 1, '2017-10-28 03:56:26', '2020-02-27 21:32:04', 4, '', ''); +INSERT INTO `#__componentbuilder_component_site_views` (`id`, `addsite_views`, `joomla_component`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `params`) VALUES +(27, '{\"addsite_views0\":{\"siteview\":\"23\",\"menu\":\"1\",\"metadata\":\"1\",\"default_view\":\"1\",\"access\":\"1\",\"public_access\":\"1\"},\"addsite_views1\":{\"siteview\":\"25\",\"metadata\":\"1\",\"access\":\"1\"}}', 25, 1, '2017-10-28 03:56:26', '2020-02-27 21:32:04', 4, '', '', ''); -- -- Dumping data for table `#__componentbuilder_component_custom_admin_views` -- -INSERT INTO `#__componentbuilder_component_custom_admin_views` (`id`, `addcustom_admin_views`, `joomla_component`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES -(27, '', 25, 1, '2017-10-28 03:56:26', '0000-00-00 00:00:00', 2, '', ''); +INSERT INTO `#__componentbuilder_component_custom_admin_views` (`id`, `addcustom_admin_views`, `joomla_component`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `params`) VALUES +(27, '', 25, 1, '2017-10-28 03:56:26', '0000-00-00 00:00:00', 2, '', '', ''); -- -- Dumping data for table `#__componentbuilder_component_updates` -- -INSERT INTO `#__componentbuilder_component_updates` (`id`, `joomla_component`, `version_update`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES -(27, 25, '{\"version_update0\":{\"version\":\"2.0.0\",\"mysql\":\"ALTER TABLE `#__demo_look` ENGINE = InnoDB;\\r\\n\\r\\nALTER TABLE `#__demo_look` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\",\"url\":\"https:\\/\\/git.vdm.dev\\/joomla\\/Demo-Component\\/archive\\/v2.0.0.zip\",\"update_server_adv\":\"0\",\"update_server_type\":\"component\",\"update_element\":\"\",\"update_state\":\"stable\",\"update_target_version\":\"3.*\",\"change_log\":\"\",\"update_client\":\"site\"},\"version_update1\":{\"version\":\"2.0.2\",\"mysql\":\"ALTER TABLE `#__demo_look` CHANGE `image` `image` VARCHAR(255) NOT NULL DEFAULT \'\';\",\"url\":\"https:\\/\\/git.vdm.dev\\/joomla\\/Demo-Component\\/archive\\/v2.0.2.zip\",\"update_server_adv\":\"0\",\"update_server_type\":\"component\",\"update_element\":\"\",\"update_state\":\"stable\",\"update_target_version\":\"3.*\",\"change_log\":\"\",\"update_client\":\"site\"},\"version_update2\":{\"version\":\"2.0.3\",\"mysql\":\"\",\"url\":\"https:\\/\\/git.vdm.dev\\/joomla\\/Demo-Component\\/archive\\/v2.0.3.zip\",\"update_server_adv\":\"0\",\"update_server_type\":\"component\",\"update_element\":\"\",\"update_state\":\"stable\",\"update_target_version\":\"3.*\",\"change_log\":\"\",\"update_client\":\"site\"},\"version_update3\":{\"version\":\"2.1.0\",\"mysql\":\"\",\"url\":\"https:\\/\\/git.vdm.dev\\/joomla\\/Demo-Component\\/archive\\/v2.1.0.zip\",\"update_server_adv\":\"0\",\"update_server_type\":\"component\",\"update_element\":\"\",\"update_state\":\"stable\",\"update_target_version\":\"3.*\",\"change_log\":\"\",\"update_client\":\"site\"}}', 1, '2017-10-28 03:56:26', '2022-05-27 05:23:46', 9, '', ''); +INSERT INTO `#__componentbuilder_component_updates` (`id`, `joomla_component`, `version_update`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `params`) VALUES +(27, 25, '{\"version_update0\":{\"version\":\"2.0.0\",\"mysql\":\"ALTER TABLE `#__demo_look` ENGINE = InnoDB;\\r\\n\\r\\nALTER TABLE `#__demo_look` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\",\"url\":\"https:\\/\\/git.vdm.dev\\/joomla\\/Demo-Component\\/archive\\/v2.0.0.zip\",\"update_server_adv\":\"0\",\"update_server_type\":\"component\",\"update_element\":\"\",\"update_state\":\"stable\",\"update_target_version\":\"3.*\",\"change_log\":\"\",\"update_client\":\"site\"},\"version_update1\":{\"version\":\"2.0.2\",\"mysql\":\"ALTER TABLE `#__demo_look` CHANGE `image` `image` VARCHAR(255) NOT NULL DEFAULT \'\';\",\"url\":\"https:\\/\\/git.vdm.dev\\/joomla\\/Demo-Component\\/archive\\/v2.0.2.zip\",\"update_server_adv\":\"0\",\"update_server_type\":\"component\",\"update_element\":\"\",\"update_state\":\"stable\",\"update_target_version\":\"3.*\",\"change_log\":\"\",\"update_client\":\"site\"},\"version_update2\":{\"version\":\"2.0.3\",\"mysql\":\"\",\"url\":\"https:\\/\\/git.vdm.dev\\/joomla\\/Demo-Component\\/archive\\/v2.0.3.zip\",\"update_server_adv\":\"0\",\"update_server_type\":\"component\",\"update_element\":\"\",\"update_state\":\"stable\",\"update_target_version\":\"3.*\",\"change_log\":\"\",\"update_client\":\"site\"},\"version_update3\":{\"version\":\"2.1.0\",\"mysql\":\"\",\"url\":\"https:\\/\\/git.vdm.dev\\/joomla\\/Demo-Component\\/archive\\/v2.1.0.zip\",\"update_server_adv\":\"0\",\"update_server_type\":\"component\",\"update_element\":\"\",\"update_state\":\"stable\",\"update_target_version\":\"3.*\",\"change_log\":\"\",\"update_client\":\"site\"}}', 1, '2017-10-28 03:56:26', '2022-05-27 05:23:46', 9, '', '', ''); -- -- Dumping data for table `#__componentbuilder_component_mysql_tweaks` -- -INSERT INTO `#__componentbuilder_component_mysql_tweaks` (`id`, `joomla_component`, `sql_tweak`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES -(27, 25, '', 1, '2017-10-28 03:56:26', '0000-00-00 00:00:00', 2, '', ''); +INSERT INTO `#__componentbuilder_component_mysql_tweaks` (`id`, `joomla_component`, `sql_tweak`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `params`) VALUES +(27, 25, '', 1, '2017-10-28 03:56:26', '0000-00-00 00:00:00', 2, '', '', ''); -- -- Dumping data for table `#__componentbuilder_component_custom_admin_menus` -- -INSERT INTO `#__componentbuilder_component_custom_admin_menus` (`id`, `addcustommenus`, `joomla_component`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES -(27, '', 25, 1, '2017-10-28 03:56:26', '0000-00-00 00:00:00', 2, '', ''); +INSERT INTO `#__componentbuilder_component_custom_admin_menus` (`id`, `addcustommenus`, `joomla_component`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `params`) VALUES +(27, '', 25, 1, '2017-10-28 03:56:26', '0000-00-00 00:00:00', 2, '', '', ''); -- -- Dumping data for table `#__componentbuilder_component_config` -- -INSERT INTO `#__componentbuilder_component_config` (`id`, `addconfig`, `joomla_component`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES -(27, '', 25, 1, '2017-10-28 03:56:26', '0000-00-00 00:00:00', 2, '', ''); +INSERT INTO `#__componentbuilder_component_config` (`id`, `addconfig`, `joomla_component`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `params`) VALUES +(27, '', 25, 1, '2017-10-28 03:56:26', '0000-00-00 00:00:00', 2, '', '', ''); -- -- Dumping data for table `#__componentbuilder_component_dashboard` -- -INSERT INTO `#__componentbuilder_component_dashboard` (`id`, `dashboard_tab`, `joomla_component`, `php_dashboard_methods`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES -(27, '', 25, '', 1, '2017-10-28 03:56:26', '0000-00-00 00:00:00', 2, '', ''); +INSERT INTO `#__componentbuilder_component_dashboard` (`id`, `dashboard_tab`, `joomla_component`, `php_dashboard_methods`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `params`) VALUES +(27, '', 25, '', 1, '2017-10-28 03:56:26', '0000-00-00 00:00:00', 2, '', '', ''); -- -- Dumping data for table `#__componentbuilder_component_files_folders` -- -INSERT INTO `#__componentbuilder_component_files_folders` (`id`, `addfiles`, `addfolders`, `joomla_component`, `params`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES -(27, '', '', 25, '', 1, '2017-10-28 03:56:26', '0000-00-00 00:00:00', 2, '', ''); +INSERT INTO `#__componentbuilder_component_files_folders` (`id`, `addfiles`, `addfolders`, `joomla_component`, `params`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `addfilesfullpath`, `addfoldersfullpath`) VALUES +(27, '', '', 25, '', 1, '2017-10-28 03:56:26', '0000-00-00 00:00:00', 2, '', '', '', ''); -- -- Dumping data for table `#__componentbuilder_snippet_type` @@ -2508,14 +2561,17 @@ INSERT INTO `#__componentbuilder_library_files_folders_urls` (`id`, `addfiles`, (6, '{}', '{}', '{\"addurls0\":{\"url\":\"https:\\/\\/raw.githubusercontent.com\\/artf\\/grapesjs-preset-webpage\\/master\\/dist\\/grapesjs-preset-webpage.min.css\",\"type\":2},\"addurls1\":{\"url\":\"https:\\/\\/raw.githubusercontent.com\\/artf\\/grapesjs-preset-webpage\\/master\\/dist\\/grapesjs-preset-webpage.min.js\",\"type\":2},\"addurls2\":{\"url\":\"https:\\/\\/static.filestackapi.com\\/v3\\/filestack-0.1.10.js\",\"type\":2}}', 9, '', 1, '2020-02-18 21:13:16', '2020-02-18 21:14:11', 2, '', 5), (7, '{}', '{}', '{\"addurls0\":{\"url\":\"https:\\/\\/cdn.jsdelivr.net\\/npm\\/vue\",\"type\":3}}', 10, '', 1, '2020-06-05 13:11:54', '0000-00-00 00:00:00', 1, '', 6), (8, '{}', '{}', '{\"addurls2\":{\"url\":\"https:\\/\\/cdn.datatables.net\\/1.10.21\\/js\\/jquery.dataTables.min.js\",\"type\":2},\"addurls1\":{\"url\":\"https:\\/\\/cdn.datatables.net\\/1.10.21\\/css\\/dataTables.uikit.min.css\",\"type\":2}}', 11, '', 1, '2020-06-27 21:34:44', '0000-00-00 00:00:00', 1, '', 7), -(9, '{}', '{}', '{\"addurls3\":{\"url\":\"http:\\/\\/code.jquery.com\\/ui\\/1.11.1\\/themes\\/smoothness\\/jquery-ui.css\",\"type\":2},\"addurls0\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/jquery-ui-timepicker-addon\\/1.6.3\\/jquery-ui-timepicker-addon.min.css\",\"type\":2},\"addurls1\":{\"url\":\"http:\\/\\/code.jquery.com\\/ui\\/1.11.1\\/jquery-ui.min.js\",\"type\":2},\"addurls2\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/jquery-ui-timepicker-addon\\/1.6.3\\/jquery-ui-timepicker-addon.min.js\",\"type\":2}}', 12, '', 1, '2020-06-29 00:00:44', '2020-06-29 04:32:57', 4, '', 8); +(9, '{}', '{}', '{\"addurls3\":{\"url\":\"http:\\/\\/code.jquery.com\\/ui\\/1.11.1\\/themes\\/smoothness\\/jquery-ui.css\",\"type\":2},\"addurls0\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/jquery-ui-timepicker-addon\\/1.6.3\\/jquery-ui-timepicker-addon.min.css\",\"type\":2},\"addurls1\":{\"url\":\"http:\\/\\/code.jquery.com\\/ui\\/1.11.1\\/jquery-ui.min.js\",\"type\":2},\"addurls2\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/jquery-ui-timepicker-addon\\/1.6.3\\/jquery-ui-timepicker-addon.min.js\",\"type\":2}}', 12, '', 1, '2020-06-29 00:00:44', '2020-06-29 04:32:57', 4, '', 8), +(10, '{}', '{}', '{\"addurls0\":{\"url\":\"https:\\/\\/cdn.datatables.net\\/v\\/dt\\/jszip-2.5.0\\/dt-1.11.5\\/b-2.2.2\\/b-colvis-2.2.2\\/b-html5-2.2.2\\/b-print-2.2.2\\/cr-1.5.5\\/date-1.1.2\\/fc-4.0.2\\/fh-3.2.2\\/kt-2.6.4\\/r-2.2.9\\/rg-1.1.4\\/rr-1.2.8\\/sc-2.0.5\\/sb-1.3.2\\/sp-2.0.0\\/sl-1.3.4\\/sr-1.1.0\\/datatables.min.css\",\"type\":3},\"addurls1\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/pdfmake\\/0.1.36\\/pdfmake.min.js\",\"type\":3},\"addurls2\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/pdfmake\\/0.1.36\\/vfs_fonts.js\",\"type\":3},\"addurls3\":{\"url\":\"https:\\/\\/cdn.datatables.net\\/v\\/dt\\/jszip-2.5.0\\/dt-1.11.5\\/b-2.2.2\\/b-colvis-2.2.2\\/b-html5-2.2.2\\/b-print-2.2.2\\/cr-1.5.5\\/date-1.1.2\\/fc-4.0.2\\/fh-3.2.2\\/kt-2.6.4\\/r-2.2.9\\/rg-1.1.4\\/rr-1.2.8\\/sc-2.0.5\\/sb-1.3.2\\/sp-2.0.0\\/sl-1.3.4\\/sr-1.1.0\\/datatables.min.js\",\"type\":3}}', 13, '', 1, '2022-10-17 20:56:24', '0000-00-00 00:00:00', 1, '', 9), +(11, '{}', '{}', '{\"addurls0\":{\"url\":\"https:\\/\\/cdn.jsdelivr.net\\/npm\\/nouislider\\/dist\\/nouislider.min.css\",\"type\":2},\"addurls1\":{\"url\":\"https:\\/\\/cdn.jsdelivr.net\\/npm\\/nouislider\\/dist\\/nouislider.min.js\",\"type\":2}}', 14, '', 1, '2023-06-26 15:02:42', '2023-07-24 18:11:41', 3, '', 10), +(12, '{}', '{}', '{\"addurls4\":{\"url\":\"https:\\/\\/cdn.datatables.net\\/v\\/bs5\\/jszip-3.10.1\\/dt-2.0.2\\/b-3.0.1\\/b-colvis-3.0.1\\/b-html5-3.0.1\\/b-print-3.0.1\\/cr-2.0.0\\/date-1.5.2\\/fc-5.0.0\\/fh-4.0.1\\/kt-2.12.0\\/r-3.0.0\\/rg-1.5.0\\/rr-1.5.0\\/sc-2.4.1\\/sb-1.7.0\\/sp-2.3.0\\/sl-2.0.0\\/sr-1.4.0\\/datatables.min.css\",\"type\":3},\"addurls1\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/pdfmake\\/0.2.7\\/pdfmake.min.js\",\"type\":3},\"addurls2\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/pdfmake\\/0.2.7\\/vfs_fonts.js\",\"type\":3},\"addurls3\":{\"url\":\"https:\\/\\/cdn.datatables.net\\/v\\/bs5\\/jszip-3.10.1\\/dt-2.0.2\\/b-3.0.1\\/b-colvis-3.0.1\\/b-html5-3.0.1\\/b-print-3.0.1\\/cr-2.0.0\\/date-1.5.2\\/fc-5.0.0\\/fh-4.0.1\\/kt-2.12.0\\/r-3.0.0\\/rg-1.5.0\\/rr-1.5.0\\/sc-2.4.1\\/sb-1.7.0\\/sp-2.3.0\\/sl-2.0.0\\/sr-1.4.0\\/datatables.min.js\",\"type\":3}}', 15, '', 1, '2024-03-09 16:27:28', '2024-03-09 16:29:30', 2, '', 9); CREATE TABLE IF NOT EXISTS `#__componentbuilder_external_code` ( `target` VARCHAR(255) NOT NULL DEFAULT '', `hash` VARCHAR(64) NOT NULL DEFAULT '', PRIMARY KEY (`target`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql index 606f7c32d..df379941b 100644 --- a/admin/sql/uninstall.mysql.utf8.sql +++ b/admin/sql/uninstall.mysql.utf8.sql @@ -1,6 +1,7 @@ DROP TABLE IF EXISTS `#__componentbuilder_joomla_component`; DROP TABLE IF EXISTS `#__componentbuilder_joomla_module`; DROP TABLE IF EXISTS `#__componentbuilder_joomla_plugin`; +DROP TABLE IF EXISTS `#__componentbuilder_joomla_power`; DROP TABLE IF EXISTS `#__componentbuilder_power`; DROP TABLE IF EXISTS `#__componentbuilder_admin_view`; DROP TABLE IF EXISTS `#__componentbuilder_custom_admin_view`; @@ -31,6 +32,7 @@ DROP TABLE IF EXISTS `#__componentbuilder_component_custom_admin_views`; DROP TABLE IF EXISTS `#__componentbuilder_component_updates`; DROP TABLE IF EXISTS `#__componentbuilder_component_mysql_tweaks`; DROP TABLE IF EXISTS `#__componentbuilder_component_custom_admin_menus`; +DROP TABLE IF EXISTS `#__componentbuilder_component_router`; DROP TABLE IF EXISTS `#__componentbuilder_component_config`; DROP TABLE IF EXISTS `#__componentbuilder_component_dashboard`; DROP TABLE IF EXISTS `#__componentbuilder_component_files_folders`; diff --git a/admin/sql/updates/mysql/3.0.0.sql b/admin/sql/updates/mysql/3.0.0.sql new file mode 100644 index 000000000..98ab2ab5a --- /dev/null +++ b/admin/sql/updates/mysql/3.0.0.sql @@ -0,0 +1 @@ +ALTER TABLE `#__componentbuilder_power` ADD `load_selection` TEXT NOT NULL AFTER `implements_custom`; diff --git a/admin/sql/updates/mysql/3.0.10.sql b/admin/sql/updates/mysql/3.0.10.sql new file mode 100644 index 000000000..6e6988aa1 --- /dev/null +++ b/admin/sql/updates/mysql/3.0.10.sql @@ -0,0 +1,2 @@ +ALTER TABLE `#__componentbuilder_power` CHANGE `extends` `extends` VARCHAR(36) NOT NULL DEFAULT ''; +ALTER TABLE `#__componentbuilder_power` CHANGE `implements` `implements` TEXT NULL; diff --git a/admin/sql/updates/mysql/3.0.9.sql b/admin/sql/updates/mysql/3.0.9.sql new file mode 100644 index 000000000..d8c537d5c --- /dev/null +++ b/admin/sql/updates/mysql/3.0.9.sql @@ -0,0 +1 @@ +ALTER TABLE `#__componentbuilder_joomla_component` ADD `add_powers` TINYINT(1) NOT NULL DEFAULT 1 AFTER `add_placeholders`; diff --git a/admin/sql/updates/mysql/3.1.12.sql b/admin/sql/updates/mysql/3.1.12.sql new file mode 100644 index 000000000..c8e27449a --- /dev/null +++ b/admin/sql/updates/mysql/3.1.12.sql @@ -0,0 +1 @@ +ALTER TABLE `#__componentbuilder_power` ADD `composer` TEXT NOT NULL AFTER `add_licensing_template`; diff --git a/admin/sql/updates/mysql/3.1.19.sql b/admin/sql/updates/mysql/3.1.19.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.19.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.21.sql b/admin/sql/updates/mysql/3.1.21.sql new file mode 100644 index 000000000..c7d0397e8 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.21.sql @@ -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`; diff --git a/admin/sql/updates/mysql/3.1.24.sql b/admin/sql/updates/mysql/3.1.24.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.24.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.25.sql b/admin/sql/updates/mysql/3.1.25.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.25.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.26.sql b/admin/sql/updates/mysql/3.1.26.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.26.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.27.sql b/admin/sql/updates/mysql/3.1.27.sql new file mode 100644 index 000000000..3edcba651 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.27.sql @@ -0,0 +1,7 @@ +ALTER TABLE `#__componentbuilder_joomla_component` ADD `add_backup_folder_path` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_admin_event`; + +ALTER TABLE `#__componentbuilder_joomla_component` ADD `add_git_folder_path` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_email_helper`; + +ALTER TABLE `#__componentbuilder_joomla_component` ADD `backup_folder_path` VARCHAR(255) NOT NULL DEFAULT '' AFTER `author`; + +ALTER TABLE `#__componentbuilder_joomla_component` ADD `git_folder_path` VARCHAR(255) NOT NULL DEFAULT '' AFTER `export_key`; diff --git a/admin/sql/updates/mysql/3.1.28.sql b/admin/sql/updates/mysql/3.1.28.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.28.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.29.sql b/admin/sql/updates/mysql/3.1.29.sql new file mode 100644 index 000000000..11f0419aa --- /dev/null +++ b/admin/sql/updates/mysql/3.1.29.sql @@ -0,0 +1,3 @@ +ALTER TABLE `#__componentbuilder_joomla_component` ADD `add_namespace_prefix` CHAR(1) NOT NULL DEFAULT '' AFTER `add_menu_prefix`; + +ALTER TABLE `#__componentbuilder_joomla_component` ADD `namespace_prefix` VARCHAR(255) NOT NULL DEFAULT '' AFTER `name_code`; diff --git a/admin/sql/updates/mysql/3.1.30.sql b/admin/sql/updates/mysql/3.1.30.sql new file mode 100644 index 000000000..834be685a --- /dev/null +++ b/admin/sql/updates/mysql/3.1.30.sql @@ -0,0 +1 @@ +ALTER TABLE `#__componentbuilder_custom_code` ADD `joomla_version` INT(11) NOT NULL DEFAULT 3 AFTER `hashtarget`; diff --git a/admin/sql/updates/mysql/3.1.31.sql b/admin/sql/updates/mysql/3.1.31.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.31.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.32.sql b/admin/sql/updates/mysql/3.1.32.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.32.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.33.sql b/admin/sql/updates/mysql/3.1.33.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.33.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.34.sql b/admin/sql/updates/mysql/3.1.34.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.34.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.35.sql b/admin/sql/updates/mysql/3.1.35.sql new file mode 100644 index 000000000..798a7f4b9 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.35.sql @@ -0,0 +1,31 @@ +CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_router` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `constructor_after_parent_code` MEDIUMTEXT NOT NULL, + `constructor_before_parent_code` MEDIUMTEXT NOT NULL, + `constructor_before_parent_manual` TEXT NOT NULL, + `joomla_component` INT(11) NOT NULL DEFAULT 0, + `methods_code` MEDIUMTEXT NOT NULL, + `mode_constructor_after_parent` TINYINT(1) NOT NULL DEFAULT 0, + `mode_constructor_before_parent` TINYINT(1) NOT NULL DEFAULT 0, + `mode_methods` TINYINT(1) NOT NULL DEFAULT 0, + `params` text NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_joomla_component` (`joomla_component`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; diff --git a/admin/sql/updates/mysql/3.1.36.sql b/admin/sql/updates/mysql/3.1.36.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.36.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.37.sql b/admin/sql/updates/mysql/3.1.37.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.37.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.38.sql b/admin/sql/updates/mysql/3.1.38.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.38.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.39.sql b/admin/sql/updates/mysql/3.1.39.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.39.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.40.sql b/admin/sql/updates/mysql/3.1.40.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.40.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.42.sql b/admin/sql/updates/mysql/3.1.42.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.42.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.1.5.sql b/admin/sql/updates/mysql/3.1.5.sql new file mode 100644 index 000000000..951fcc604 --- /dev/null +++ b/admin/sql/updates/mysql/3.1.5.sql @@ -0,0 +1,2 @@ +ALTER TABLE `#__componentbuilder_power` ADD `add_licensing_template` TINYINT(1) NOT NULL DEFAULT 1 AFTER `add_head`; +ALTER TABLE `#__componentbuilder_power` ADD `licensing_template` TEXT NOT NULL AFTER `implements_custom`; diff --git a/admin/sql/updates/mysql/3.2.0-beta.sql b/admin/sql/updates/mysql/3.2.0-beta.sql new file mode 100644 index 000000000..376a853c3 --- /dev/null +++ b/admin/sql/updates/mysql/3.2.0-beta.sql @@ -0,0 +1 @@ +ALTER TABLE `#__componentbuilder_joomla_component` ADD `preferred_joomla_version` INT(11) NOT NULL DEFAULT 3 AFTER `php_site_event`; diff --git a/admin/sql/updates/mysql/3.2.0.sql b/admin/sql/updates/mysql/3.2.0.sql new file mode 100644 index 000000000..f98f6aec0 --- /dev/null +++ b/admin/sql/updates/mysql/3.2.0.sql @@ -0,0 +1,3 @@ +ALTER TABLE `#__componentbuilder_joomla_component` ADD `add_jcb_powers_path` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_javascript`; + +ALTER TABLE `#__componentbuilder_joomla_component` ADD `jcb_powers_path` VARCHAR(255) NOT NULL DEFAULT '' AFTER `javascript`; diff --git a/admin/sql/updates/mysql/3.2.1-alpha1.sql b/admin/sql/updates/mysql/3.2.1-alpha1.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.2.1-alpha1.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.2.1-alpha2.sql b/admin/sql/updates/mysql/3.2.1-alpha2.sql new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/admin/sql/updates/mysql/3.2.1-alpha2.sql @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/3.2.1-alpha3.sql b/admin/sql/updates/mysql/3.2.1-alpha3.sql new file mode 100644 index 000000000..d525a44ab --- /dev/null +++ b/admin/sql/updates/mysql/3.2.1-alpha3.sql @@ -0,0 +1,28 @@ +CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_power` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `description` TEXT NULL, + `guid` VARCHAR(36) NOT NULL DEFAULT '', + `settings` TEXT NOT NULL, + `system_name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME DEFAULT CURRENT_TIMESTAMP, + `modified` DATETIME DEFAULT NULL, + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME DEFAULT NULL, + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_system_name` (`system_name`), + KEY `idx_guid` (`guid`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; diff --git a/admin/sql/updates/mysql/3.2.1-alpha4.sql b/admin/sql/updates/mysql/3.2.1-alpha4.sql new file mode 100644 index 000000000..902532589 --- /dev/null +++ b/admin/sql/updates/mysql/3.2.1-alpha4.sql @@ -0,0 +1,2 @@ +ALTER TABLE `#__componentbuilder_joomla_component` ADD `add_php_method_install` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_php_helper_site`; +ALTER TABLE `#__componentbuilder_joomla_component` ADD `php_method_install` MEDIUMTEXT NOT NULL AFTER `php_helper_site`; diff --git a/admin/sql/updates/mysql/3.2.1-beta1.sql b/admin/sql/updates/mysql/3.2.1-beta1.sql new file mode 100644 index 000000000..5bcf8654f --- /dev/null +++ b/admin/sql/updates/mysql/3.2.1-beta1.sql @@ -0,0 +1,15 @@ +UPDATE `#__componentbuilder_admin_view` +SET `alias_builder_type` = 0 +WHERE `alias_builder_type` = ''; + +UPDATE `#__componentbuilder_dynamic_get` +SET `addcalculation` = 0 +WHERE `addcalculation` = ''; + +ALTER TABLE `#__componentbuilder_joomla_component` CHANGE `image` `image` VARCHAR(255) NOT NULL DEFAULT ''; +ALTER TABLE `#__componentbuilder_admin_view` CHANGE `alias_builder_type` `alias_builder_type` TINYINT(1) NOT NULL DEFAULT 0; +ALTER TABLE `#__componentbuilder_admin_view` CHANGE `icon` `icon` VARCHAR(255) NOT NULL DEFAULT ''; +ALTER TABLE `#__componentbuilder_admin_view` CHANGE `icon_add` `icon_add` VARCHAR(255) NOT NULL DEFAULT ''; +ALTER TABLE `#__componentbuilder_admin_view` CHANGE `icon_category` `icon_category` VARCHAR(255) NOT NULL DEFAULT ''; +ALTER TABLE `#__componentbuilder_custom_admin_view` CHANGE `icon` `icon` VARCHAR(255) NOT NULL DEFAULT ''; +ALTER TABLE `#__componentbuilder_dynamic_get` CHANGE `addcalculation` `addcalculation` TINYINT(1) NOT NULL DEFAULT 0; diff --git a/admin/sql/updates/mysql/3.2.1-beta2.sql b/admin/sql/updates/mysql/3.2.1-beta2.sql new file mode 100644 index 000000000..9c9830468 --- /dev/null +++ b/admin/sql/updates/mysql/3.2.1-beta2.sql @@ -0,0 +1,3 @@ +ALTER TABLE `#__componentbuilder_component_updates` CHANGE `version_update` `version_update` MEDIUMTEXT NOT NULL; +ALTER TABLE `#__componentbuilder_joomla_module_updates` CHANGE `version_update` `version_update` MEDIUMTEXT NOT NULL; +ALTER TABLE `#__componentbuilder_joomla_plugin_updates` CHANGE `version_update` `version_update` MEDIUMTEXT NOT NULL; diff --git a/admin/tables/admin_custom_tabs.php b/admin/tables/admin_custom_tabs.php index ecfc44dfa..816432f82 100644 --- a/admin/tables/admin_custom_tabs.php +++ b/admin/tables/admin_custom_tabs.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Admins_custom_tabs Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableAdmin_custom_tabs extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_admin_custom_tabs', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.admin_custom_tabs')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.admin_custom_tabs')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Admin_custom_tabs table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('admin_custom_tabs', 'ComponentbuilderTable'); + $table = Table::getInstance('admin_custom_tabs', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('admin_custom_tabs', 'componentbuilderTable'); + + $table = Table::getInstance('admin_custom_tabs', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.admin_custom_tabs.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/admin_fields.php b/admin/tables/admin_fields.php index ab1f66067..a184e17cd 100644 --- a/admin/tables/admin_fields.php +++ b/admin/tables/admin_fields.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Admins_fields Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableAdmin_fields extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_admin_fields', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.admin_fields')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.admin_fields')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Admin_fields table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('admin_fields', 'ComponentbuilderTable'); + $table = Table::getInstance('admin_fields', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_ADMIN_FIELDS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_ADMIN_FIELDS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_ADMIN_FIELDS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('admin_fields', 'componentbuilderTable'); + + $table = Table::getInstance('admin_fields', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.admin_fields.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/admin_fields_conditions.php b/admin/tables/admin_fields_conditions.php index 01806f6be..b01cc984d 100644 --- a/admin/tables/admin_fields_conditions.php +++ b/admin/tables/admin_fields_conditions.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Admins_fields_conditions Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableAdmin_fields_conditions extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_admin_fields_conditions', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.admin_fields_conditions')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.admin_fields_conditions')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Admin_fields_conditions table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('admin_fields_conditions', 'ComponentbuilderTable'); + $table = Table::getInstance('admin_fields_conditions', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('admin_fields_conditions', 'componentbuilderTable'); + + $table = Table::getInstance('admin_fields_conditions', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.admin_fields_conditions.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/admin_fields_relations.php b/admin/tables/admin_fields_relations.php index 5d9dc7a3d..f3e4b75b2 100644 --- a/admin/tables/admin_fields_relations.php +++ b/admin/tables/admin_fields_relations.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Admins_fields_relations Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableAdmin_fields_relations extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_admin_fields_relations', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.admin_fields_relations')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.admin_fields_relations')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Admin_fields_relations table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('admin_fields_relations', 'ComponentbuilderTable'); + $table = Table::getInstance('admin_fields_relations', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('admin_fields_relations', 'componentbuilderTable'); + + $table = Table::getInstance('admin_fields_relations', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.admin_fields_relations.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/admin_view.php b/admin/tables/admin_view.php index da8f8463b..c71fd1ffe 100644 --- a/admin/tables/admin_view.php +++ b/admin/tables/admin_view.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Admin_views Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableAdmin_view extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_admin_view', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.admin_view')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.admin_view')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Admin_view table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('admin_view', 'ComponentbuilderTable'); + $table = Table::getInstance('admin_view', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('admin_view', 'componentbuilderTable'); + + $table = Table::getInstance('admin_view', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.admin_view.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/class_extends.php b/admin/tables/class_extends.php index cb6f084fd..81e90c249 100644 --- a/admin/tables/class_extends.php +++ b/admin/tables/class_extends.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Class_extendings Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableClass_extends extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_class_extends', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.class_extends')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.class_extends')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Class_extends table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('class_extends', 'ComponentbuilderTable'); + $table = Table::getInstance('class_extends', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('class_extends', 'componentbuilderTable'); + + $table = Table::getInstance('class_extends', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.class_extends.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/class_method.php b/admin/tables/class_method.php index 01e179ca2..5baf8f877 100644 --- a/admin/tables/class_method.php +++ b/admin/tables/class_method.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Class_methods Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableClass_method extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_class_method', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.class_method')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.class_method')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Class_method table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('class_method', 'ComponentbuilderTable'); + $table = Table::getInstance('class_method', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_CLASS_METHOD_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_CLASS_METHOD_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('class_method', 'componentbuilderTable'); + + $table = Table::getInstance('class_method', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.class_method.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/class_property.php b/admin/tables/class_property.php index 632e06b83..35996b370 100644 --- a/admin/tables/class_property.php +++ b/admin/tables/class_property.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Class_properties Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableClass_property extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_class_property', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.class_property')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.class_property')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Class_property table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('class_property', 'ComponentbuilderTable'); + $table = Table::getInstance('class_property', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('class_property', 'componentbuilderTable'); + + $table = Table::getInstance('class_property', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.class_property.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/component_admin_views.php b/admin/tables/component_admin_views.php index 9a655fa0b..498bef130 100644 --- a/admin/tables/component_admin_views.php +++ b/admin/tables/component_admin_views.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Components_admin_views Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableComponent_admin_views extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_component_admin_views', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_admin_views')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_admin_views')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Component_admin_views table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('component_admin_views', 'ComponentbuilderTable'); + $table = Table::getInstance('component_admin_views', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('component_admin_views', 'componentbuilderTable'); + + $table = Table::getInstance('component_admin_views', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.component_admin_views.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/component_config.php b/admin/tables/component_config.php index 7893f4009..215b97117 100644 --- a/admin/tables/component_config.php +++ b/admin/tables/component_config.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Components_config Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableComponent_config extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_component_config', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_config')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_config')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Component_config table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('component_config', 'ComponentbuilderTable'); + $table = Table::getInstance('component_config', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_COMPONENT_CONFIG_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_CONFIG_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_CONFIG_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('component_config', 'componentbuilderTable'); + + $table = Table::getInstance('component_config', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.component_config.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/component_custom_admin_menus.php b/admin/tables/component_custom_admin_menus.php index 839a6647f..d3a6c8f8a 100644 --- a/admin/tables/component_custom_admin_menus.php +++ b/admin/tables/component_custom_admin_menus.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Components_custom_admin_menus Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableComponent_custom_admin_menus extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_component_custom_admin_menus', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_custom_admin_menus')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_custom_admin_menus')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Component_custom_admin_menus table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('component_custom_admin_menus', 'ComponentbuilderTable'); + $table = Table::getInstance('component_custom_admin_menus', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('component_custom_admin_menus', 'componentbuilderTable'); + + $table = Table::getInstance('component_custom_admin_menus', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.component_custom_admin_menus.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/component_custom_admin_views.php b/admin/tables/component_custom_admin_views.php index fada7ce5b..0c958ce84 100644 --- a/admin/tables/component_custom_admin_views.php +++ b/admin/tables/component_custom_admin_views.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Components_custom_admin_views Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableComponent_custom_admin_views extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_component_custom_admin_views', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_custom_admin_views')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_custom_admin_views')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Component_custom_admin_views table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('component_custom_admin_views', 'ComponentbuilderTable'); + $table = Table::getInstance('component_custom_admin_views', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('component_custom_admin_views', 'componentbuilderTable'); + + $table = Table::getInstance('component_custom_admin_views', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.component_custom_admin_views.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/component_dashboard.php b/admin/tables/component_dashboard.php index ccf0800c1..58c0d05b8 100644 --- a/admin/tables/component_dashboard.php +++ b/admin/tables/component_dashboard.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Components_dashboard Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableComponent_dashboard extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_component_dashboard', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_dashboard')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_dashboard')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Component_dashboard table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('component_dashboard', 'ComponentbuilderTable'); + $table = Table::getInstance('component_dashboard', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('component_dashboard', 'componentbuilderTable'); + + $table = Table::getInstance('component_dashboard', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.component_dashboard.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/component_files_folders.php b/admin/tables/component_files_folders.php index c71309592..eb14b3872 100644 --- a/admin/tables/component_files_folders.php +++ b/admin/tables/component_files_folders.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Components_files_folders Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableComponent_files_folders extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_component_files_folders', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_files_folders')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_files_folders')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Component_files_folders table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('component_files_folders', 'ComponentbuilderTable'); + $table = Table::getInstance('component_files_folders', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('component_files_folders', 'componentbuilderTable'); + + $table = Table::getInstance('component_files_folders', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.component_files_folders.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/component_modules.php b/admin/tables/component_modules.php index 86a664472..08dfb67d6 100644 --- a/admin/tables/component_modules.php +++ b/admin/tables/component_modules.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Components_modules Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableComponent_modules extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_component_modules', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_modules')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_modules')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Component_modules table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('component_modules', 'ComponentbuilderTable'); + $table = Table::getInstance('component_modules', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_COMPONENT_MODULES_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_MODULES_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_MODULES_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('component_modules', 'componentbuilderTable'); + + $table = Table::getInstance('component_modules', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.component_modules.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/component_mysql_tweaks.php b/admin/tables/component_mysql_tweaks.php index b68f15a17..2ca8c72b6 100644 --- a/admin/tables/component_mysql_tweaks.php +++ b/admin/tables/component_mysql_tweaks.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Components_mysql_tweaks Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableComponent_mysql_tweaks extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_component_mysql_tweaks', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_mysql_tweaks')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_mysql_tweaks')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Component_mysql_tweaks table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('component_mysql_tweaks', 'ComponentbuilderTable'); + $table = Table::getInstance('component_mysql_tweaks', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('component_mysql_tweaks', 'componentbuilderTable'); + + $table = Table::getInstance('component_mysql_tweaks', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.component_mysql_tweaks.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/component_placeholders.php b/admin/tables/component_placeholders.php index b83af5f40..902f38f85 100644 --- a/admin/tables/component_placeholders.php +++ b/admin/tables/component_placeholders.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Components_placeholders Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableComponent_placeholders extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_component_placeholders', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_placeholders')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_placeholders')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Component_placeholders table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('component_placeholders', 'ComponentbuilderTable'); + $table = Table::getInstance('component_placeholders', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('component_placeholders', 'componentbuilderTable'); + + $table = Table::getInstance('component_placeholders', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.component_placeholders.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/component_plugins.php b/admin/tables/component_plugins.php index d861dd74d..d786f6c51 100644 --- a/admin/tables/component_plugins.php +++ b/admin/tables/component_plugins.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Components_plugins Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableComponent_plugins extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_component_plugins', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_plugins')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_plugins')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Component_plugins table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('component_plugins', 'ComponentbuilderTable'); + $table = Table::getInstance('component_plugins', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('component_plugins', 'componentbuilderTable'); + + $table = Table::getInstance('component_plugins', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.component_plugins.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/component_router.php b/admin/tables/component_router.php new file mode 100644 index 000000000..71eb251a7 --- /dev/null +++ b/admin/tables/component_router.php @@ -0,0 +1,336 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; + +/** + * Components_routers Table class + */ +class ComponentbuilderTableComponent_router extends Table +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__componentbuilder_component_router', 'id', $db); + + // Adding History Options + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_router')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new Registry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new Registry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Component_router table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = Factory::getDate(); + $user = Factory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New component_router. A component_router created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = Table::getInstance('component_router', 'ComponentbuilderTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_ROUTER_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_ROUTER_ERROR_UNIQUE_ALIAS_TRASHED')); + } + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = PunycodeHelper::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = PunycodeHelper::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = Table::getInstance('component_router', 'componentbuilderTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = []; + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty AccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_componentbuilder.component_router.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return AccessRules The AccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = Factory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof AccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = []; + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return AccessRules::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_componentbuilder.component_router.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(?Table $table = null, $id = null) + { + $asset = Table::getInstance('Asset'); + $asset->loadByName('com_componentbuilder'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/component_site_views.php b/admin/tables/component_site_views.php index b833b7196..2e3a18989 100644 --- a/admin/tables/component_site_views.php +++ b/admin/tables/component_site_views.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Components_site_views Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableComponent_site_views extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_component_site_views', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_site_views')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_site_views')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Component_site_views table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('component_site_views', 'ComponentbuilderTable'); + $table = Table::getInstance('component_site_views', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('component_site_views', 'componentbuilderTable'); + + $table = Table::getInstance('component_site_views', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.component_site_views.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/component_updates.php b/admin/tables/component_updates.php index 01c57ed10..69be7db73 100644 --- a/admin/tables/component_updates.php +++ b/admin/tables/component_updates.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Components_updates Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableComponent_updates extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_component_updates', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_updates')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.component_updates')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Component_updates table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('component_updates', 'ComponentbuilderTable'); + $table = Table::getInstance('component_updates', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_COMPONENT_UPDATES_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_UPDATES_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_COMPONENT_UPDATES_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('component_updates', 'componentbuilderTable'); + + $table = Table::getInstance('component_updates', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.component_updates.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/custom_admin_view.php b/admin/tables/custom_admin_view.php index 28a76d3ff..d6c0c2a9f 100644 --- a/admin/tables/custom_admin_view.php +++ b/admin/tables/custom_admin_view.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Custom_admin_views Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableCustom_admin_view extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_custom_admin_view', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.custom_admin_view')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.custom_admin_view')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Custom_admin_view table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('custom_admin_view', 'ComponentbuilderTable'); + $table = Table::getInstance('custom_admin_view', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('custom_admin_view', 'componentbuilderTable'); + + $table = Table::getInstance('custom_admin_view', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.custom_admin_view.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/custom_code.php b/admin/tables/custom_code.php index a93c6f998..e115cfa4f 100644 --- a/admin/tables/custom_code.php +++ b/admin/tables/custom_code.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Custom_codes Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableCustom_code extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_custom_code', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.custom_code')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.custom_code')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Custom_code table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('custom_code', 'ComponentbuilderTable'); + $table = Table::getInstance('custom_code', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_CUSTOM_CODE_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_CUSTOM_CODE_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('custom_code', 'componentbuilderTable'); + + $table = Table::getInstance('custom_code', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.custom_code.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/dynamic_get.php b/admin/tables/dynamic_get.php index b25e61c35..cbde68bc6 100644 --- a/admin/tables/dynamic_get.php +++ b/admin/tables/dynamic_get.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Dynamic_gets Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableDynamic_get extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_dynamic_get', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.dynamic_get')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.dynamic_get')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Dynamic_get table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('dynamic_get', 'ComponentbuilderTable'); + $table = Table::getInstance('dynamic_get', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_DYNAMIC_GET_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_DYNAMIC_GET_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_DYNAMIC_GET_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('dynamic_get', 'componentbuilderTable'); + + $table = Table::getInstance('dynamic_get', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.dynamic_get.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/field.php b/admin/tables/field.php index 4161923ce..cc354a566 100644 --- a/admin/tables/field.php +++ b/admin/tables/field.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Fields Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableField extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_field', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.field')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.field')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Field table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('field', 'ComponentbuilderTable'); + $table = Table::getInstance('field', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_FIELD_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_FIELD_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_FIELD_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('field', 'componentbuilderTable'); + + $table = Table::getInstance('field', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.field.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/fieldtype.php b/admin/tables/fieldtype.php index 2fbd152c2..ec599d6e5 100644 --- a/admin/tables/fieldtype.php +++ b/admin/tables/fieldtype.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Fieldtypes Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableFieldtype extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_fieldtype', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.fieldtype')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.fieldtype')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Fieldtype table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('fieldtype', 'ComponentbuilderTable'); + $table = Table::getInstance('fieldtype', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_FIELDTYPE_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_FIELDTYPE_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_FIELDTYPE_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('fieldtype', 'componentbuilderTable'); + + $table = Table::getInstance('fieldtype', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.fieldtype.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/help_document.php b/admin/tables/help_document.php index deb548887..65fb51f9c 100644 --- a/admin/tables/help_document.php +++ b/admin/tables/help_document.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Help_documents Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableHelp_document extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_help_document', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.help_document')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.help_document')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Help_document table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('help_document', 'ComponentbuilderTable'); + $table = Table::getInstance('help_document', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('help_document', 'componentbuilderTable'); + + $table = Table::getInstance('help_document', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.help_document.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; @@ -324,11 +336,11 @@ public function generateAlias() $this->alias = $this->title; } - $this->alias = JApplicationHelper::stringURLSafe($this->alias); + $this->alias = ApplicationHelper::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { - $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + $this->alias = Factory::getDate()->format('Y-m-d-H-i-s'); } return $this->alias; diff --git a/admin/tables/joomla_component.php b/admin/tables/joomla_component.php index 19c081019..b78fc9a62 100644 --- a/admin/tables/joomla_component.php +++ b/admin/tables/joomla_component.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Joomla_components Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableJoomla_component extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_joomla_component', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_component')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_component')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Joomla_component table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('joomla_component', 'ComponentbuilderTable'); + $table = Table::getInstance('joomla_component', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('joomla_component', 'componentbuilderTable'); + + $table = Table::getInstance('joomla_component', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.joomla_component.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/joomla_module.php b/admin/tables/joomla_module.php index 36d3e8b44..380977ec1 100644 --- a/admin/tables/joomla_module.php +++ b/admin/tables/joomla_module.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Joomla_modules Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableJoomla_module extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_joomla_module', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_module')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_module')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Joomla_module table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('joomla_module', 'ComponentbuilderTable'); + $table = Table::getInstance('joomla_module', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('joomla_module', 'componentbuilderTable'); + + $table = Table::getInstance('joomla_module', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.joomla_module.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/joomla_module_files_folders_urls.php b/admin/tables/joomla_module_files_folders_urls.php index decc60e82..6e6ce921b 100644 --- a/admin/tables/joomla_module_files_folders_urls.php +++ b/admin/tables/joomla_module_files_folders_urls.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Joomla_modules_files_folders_urls Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableJoomla_module_files_folders_urls extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_joomla_module_files_folders_urls', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_module_files_folders_urls')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_module_files_folders_urls')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Joomla_module_files_folders_urls table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('joomla_module_files_folders_urls', 'ComponentbuilderTable'); + $table = Table::getInstance('joomla_module_files_folders_urls', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('joomla_module_files_folders_urls', 'componentbuilderTable'); + + $table = Table::getInstance('joomla_module_files_folders_urls', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.joomla_module_files_folders_urls.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/joomla_module_updates.php b/admin/tables/joomla_module_updates.php index a266666ef..823bcdcd6 100644 --- a/admin/tables/joomla_module_updates.php +++ b/admin/tables/joomla_module_updates.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Joomla_modules_updates Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableJoomla_module_updates extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_joomla_module_updates', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_module_updates')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_module_updates')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Joomla_module_updates table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('joomla_module_updates', 'ComponentbuilderTable'); + $table = Table::getInstance('joomla_module_updates', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('joomla_module_updates', 'componentbuilderTable'); + + $table = Table::getInstance('joomla_module_updates', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.joomla_module_updates.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/joomla_plugin.php b/admin/tables/joomla_plugin.php index 14d118601..3985509be 100644 --- a/admin/tables/joomla_plugin.php +++ b/admin/tables/joomla_plugin.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Joomla_plugins Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableJoomla_plugin extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_joomla_plugin', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_plugin')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_plugin')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Joomla_plugin table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('joomla_plugin', 'ComponentbuilderTable'); + $table = Table::getInstance('joomla_plugin', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('joomla_plugin', 'componentbuilderTable'); + + $table = Table::getInstance('joomla_plugin', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.joomla_plugin.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/joomla_plugin_files_folders_urls.php b/admin/tables/joomla_plugin_files_folders_urls.php index 50210cde2..76701a782 100644 --- a/admin/tables/joomla_plugin_files_folders_urls.php +++ b/admin/tables/joomla_plugin_files_folders_urls.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Joomla_plugins_files_folders_urls Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableJoomla_plugin_files_folders_urls extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_joomla_plugin_files_folders_urls', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_plugin_files_folders_urls')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_plugin_files_folders_urls')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Joomla_plugin_files_folders_urls table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('joomla_plugin_files_folders_urls', 'ComponentbuilderTable'); + $table = Table::getInstance('joomla_plugin_files_folders_urls', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('joomla_plugin_files_folders_urls', 'componentbuilderTable'); + + $table = Table::getInstance('joomla_plugin_files_folders_urls', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.joomla_plugin_files_folders_urls.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/joomla_plugin_group.php b/admin/tables/joomla_plugin_group.php index 0bfe96a3c..6c2fcb111 100644 --- a/admin/tables/joomla_plugin_group.php +++ b/admin/tables/joomla_plugin_group.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Joomla_plugin_groups Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableJoomla_plugin_group extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_joomla_plugin_group', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_plugin_group')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_plugin_group')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Joomla_plugin_group table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('joomla_plugin_group', 'ComponentbuilderTable'); + $table = Table::getInstance('joomla_plugin_group', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('joomla_plugin_group', 'componentbuilderTable'); + + $table = Table::getInstance('joomla_plugin_group', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.joomla_plugin_group.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/joomla_plugin_updates.php b/admin/tables/joomla_plugin_updates.php index 770333de4..2e6ff0fe9 100644 --- a/admin/tables/joomla_plugin_updates.php +++ b/admin/tables/joomla_plugin_updates.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Joomla_plugins_updates Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableJoomla_plugin_updates extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_joomla_plugin_updates', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_plugin_updates')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_plugin_updates')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Joomla_plugin_updates table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('joomla_plugin_updates', 'ComponentbuilderTable'); + $table = Table::getInstance('joomla_plugin_updates', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('joomla_plugin_updates', 'componentbuilderTable'); + + $table = Table::getInstance('joomla_plugin_updates', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.joomla_plugin_updates.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/joomla_power.php b/admin/tables/joomla_power.php new file mode 100644 index 000000000..dc038e1ad --- /dev/null +++ b/admin/tables/joomla_power.php @@ -0,0 +1,336 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Factory; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; + +/** + * Joomla_powers Table class + */ +class ComponentbuilderTableJoomla_power extends Table +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__componentbuilder_joomla_power', 'id', $db); + + // Adding History Options + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.joomla_power')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new Registry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new Registry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Joomla_power table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = Factory::getDate(); + $user = Factory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New joomla_power. A joomla_power created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = Table::getInstance('joomla_power', 'ComponentbuilderTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_POWER_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_POWER_ERROR_UNIQUE_ALIAS_TRASHED')); + } + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = PunycodeHelper::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = PunycodeHelper::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = Table::getInstance('joomla_power', 'componentbuilderTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = []; + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty AccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_componentbuilder.joomla_power.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return AccessRules The AccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = Factory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof AccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = []; + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return AccessRules::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_componentbuilder.joomla_power.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(?Table $table = null, $id = null) + { + $asset = Table::getInstance('Asset'); + $asset->loadByName('com_componentbuilder'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/language.php b/admin/tables/language.php index 1b81f6007..6272253db 100644 --- a/admin/tables/language.php +++ b/admin/tables/language.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Languages Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableLanguage extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_language', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.language')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.language')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Language table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('language', 'ComponentbuilderTable'); + $table = Table::getInstance('language', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_LANGUAGE_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_LANGUAGE_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_LANGUAGE_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('language', 'componentbuilderTable'); + + $table = Table::getInstance('language', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.language.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/language_translation.php b/admin/tables/language_translation.php index c8bd8a6bd..969a9fe86 100644 --- a/admin/tables/language_translation.php +++ b/admin/tables/language_translation.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Language_translations Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableLanguage_translation extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_language_translation', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.language_translation')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.language_translation')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Language_translation table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('language_translation', 'ComponentbuilderTable'); + $table = Table::getInstance('language_translation', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('language_translation', 'componentbuilderTable'); + + $table = Table::getInstance('language_translation', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.language_translation.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/layout.php b/admin/tables/layout.php index 1ec121893..a6323e84d 100644 --- a/admin/tables/layout.php +++ b/admin/tables/layout.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Layouts Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableLayout extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_layout', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.layout')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.layout')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Layout table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('layout', 'ComponentbuilderTable'); + $table = Table::getInstance('layout', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_LAYOUT_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_LAYOUT_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_LAYOUT_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('layout', 'componentbuilderTable'); + + $table = Table::getInstance('layout', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.layout.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; @@ -324,11 +336,11 @@ public function generateAlias() $this->alias = $this->name; } - $this->alias = JApplicationHelper::stringURLSafe($this->alias); + $this->alias = ApplicationHelper::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { - $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + $this->alias = Factory::getDate()->format('Y-m-d-H-i-s'); } return $this->alias; diff --git a/admin/tables/library.php b/admin/tables/library.php index b476df994..517bd0e65 100644 --- a/admin/tables/library.php +++ b/admin/tables/library.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Libraries Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableLibrary extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_library', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.library')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.library')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Library table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('library', 'ComponentbuilderTable'); + $table = Table::getInstance('library', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_LIBRARY_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_LIBRARY_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_LIBRARY_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('library', 'componentbuilderTable'); + + $table = Table::getInstance('library', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.library.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/library_config.php b/admin/tables/library_config.php index e1260aa42..712724d2f 100644 --- a/admin/tables/library_config.php +++ b/admin/tables/library_config.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Libraries_config Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableLibrary_config extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_library_config', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.library_config')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.library_config')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Library_config table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('library_config', 'ComponentbuilderTable'); + $table = Table::getInstance('library_config', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_LIBRARY_CONFIG_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_LIBRARY_CONFIG_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_LIBRARY_CONFIG_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('library_config', 'componentbuilderTable'); + + $table = Table::getInstance('library_config', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.library_config.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/library_files_folders_urls.php b/admin/tables/library_files_folders_urls.php index 4c8aeaf2a..c4356eccd 100644 --- a/admin/tables/library_files_folders_urls.php +++ b/admin/tables/library_files_folders_urls.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Libraries_files_folders_urls Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableLibrary_files_folders_urls extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_library_files_folders_urls', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.library_files_folders_urls')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.library_files_folders_urls')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Library_files_folders_urls table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('library_files_folders_urls', 'ComponentbuilderTable'); + $table = Table::getInstance('library_files_folders_urls', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('library_files_folders_urls', 'componentbuilderTable'); + + $table = Table::getInstance('library_files_folders_urls', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.library_files_folders_urls.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/placeholder.php b/admin/tables/placeholder.php index d5c519b34..e79aed533 100644 --- a/admin/tables/placeholder.php +++ b/admin/tables/placeholder.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Placeholders Table class @@ -29,63 +36,63 @@ class ComponentbuilderTablePlaceholder extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_placeholder', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.placeholder')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.placeholder')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Placeholder table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('placeholder', 'ComponentbuilderTable'); + $table = Table::getInstance('placeholder', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_PLACEHOLDER_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_PLACEHOLDER_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_PLACEHOLDER_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('placeholder', 'componentbuilderTable'); + + $table = Table::getInstance('placeholder', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.placeholder.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/power.php b/admin/tables/power.php index 870895317..83cbade24 100644 --- a/admin/tables/power.php +++ b/admin/tables/power.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Powers Table class @@ -29,63 +36,63 @@ class ComponentbuilderTablePower extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_power', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.power')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.power')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Power table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('power', 'ComponentbuilderTable'); + $table = Table::getInstance('power', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_POWER_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_POWER_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_POWER_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('power', 'componentbuilderTable'); + + $table = Table::getInstance('power', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.power.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/server.php b/admin/tables/server.php index bc2628a01..e3527241e 100644 --- a/admin/tables/server.php +++ b/admin/tables/server.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Servers Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableServer extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_server', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.server')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.server')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Server table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('server', 'ComponentbuilderTable'); + $table = Table::getInstance('server', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_SERVER_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_SERVER_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_SERVER_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('server', 'componentbuilderTable'); + + $table = Table::getInstance('server', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.server.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/site_view.php b/admin/tables/site_view.php index f7cb9e369..186afe443 100644 --- a/admin/tables/site_view.php +++ b/admin/tables/site_view.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Site_views Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableSite_view extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_site_view', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.site_view')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.site_view')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Site_view table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('site_view', 'ComponentbuilderTable'); + $table = Table::getInstance('site_view', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_SITE_VIEW_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_SITE_VIEW_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_SITE_VIEW_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('site_view', 'componentbuilderTable'); + + $table = Table::getInstance('site_view', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.site_view.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/snippet.php b/admin/tables/snippet.php index 65afde210..e7160a7ab 100644 --- a/admin/tables/snippet.php +++ b/admin/tables/snippet.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Snippets Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableSnippet extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_snippet', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.snippet')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.snippet')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Snippet table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('snippet', 'ComponentbuilderTable'); + $table = Table::getInstance('snippet', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_SNIPPET_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_SNIPPET_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_SNIPPET_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('snippet', 'componentbuilderTable'); + + $table = Table::getInstance('snippet', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.snippet.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/snippet_type.php b/admin/tables/snippet_type.php index c2d5759d6..9b5defcdd 100644 --- a/admin/tables/snippet_type.php +++ b/admin/tables/snippet_type.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Snippet_types Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableSnippet_type extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_snippet_type', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.snippet_type')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.snippet_type')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Snippet_type table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('snippet_type', 'ComponentbuilderTable'); + $table = Table::getInstance('snippet_type', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_SNIPPET_TYPE_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_SNIPPET_TYPE_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_SNIPPET_TYPE_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('snippet_type', 'componentbuilderTable'); + + $table = Table::getInstance('snippet_type', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.snippet_type.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/tables/template.php b/admin/tables/template.php index 19870e7e4..79e532744 100644 --- a/admin/tables/template.php +++ b/admin/tables/template.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Templates Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableTemplate extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_template', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.template')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.template')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Template table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('template', 'ComponentbuilderTable'); + $table = Table::getInstance('template', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_TEMPLATE_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_TEMPLATE_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_TEMPLATE_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('template', 'componentbuilderTable'); + + $table = Table::getInstance('template', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.template.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; @@ -324,11 +336,11 @@ public function generateAlias() $this->alias = $this->name; } - $this->alias = JApplicationHelper::stringURLSafe($this->alias); + $this->alias = ApplicationHelper::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { - $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + $this->alias = Factory::getDate()->format('Y-m-d-H-i-s'); } return $this->alias; diff --git a/admin/tables/validation_rule.php b/admin/tables/validation_rule.php index 8e785d58d..28cd6573f 100644 --- a/admin/tables/validation_rule.php +++ b/admin/tables/validation_rule.php @@ -12,10 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Validation_rules Table class @@ -29,63 +36,63 @@ class ComponentbuilderTableValidation_rule extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__componentbuilder_validation_rule', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.validation_rule')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_componentbuilder.validation_rule')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Validation_rule table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -100,33 +107,38 @@ public function store($updateNulls = false) $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('validation_rule', 'ComponentbuilderTable'); + $table = Table::getInstance('validation_rule', 'ComponentbuilderTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_COMPONENTBUILDER_VALIDATION_RULE_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_COMPONENTBUILDER_VALIDATION_RULE_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_COMPONENTBUILDER_VALIDATION_RULE_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -138,20 +150,20 @@ public function check() { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('validation_rule', 'componentbuilderTable'); + + $table = Table::getInstance('validation_rule', 'componentbuilderTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -162,7 +174,7 @@ public function check() // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -185,13 +197,13 @@ public function check() $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_componentbuilder.validation_rule.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -207,12 +219,12 @@ public function check() * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -223,14 +235,14 @@ protected function getDefaultAssetValues($component, $try = true) { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -247,7 +259,7 @@ protected function getDefaultAssetValues($component, $try = true) else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -255,8 +267,8 @@ protected function getDefaultAssetValues($component, $try = true) { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -265,7 +277,7 @@ protected function getDefaultAssetValues($component, $try = true) return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -273,8 +285,8 @@ protected function getDefaultAssetValues($component, $try = true) * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -285,8 +297,8 @@ protected function _getAssetName() /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -300,12 +312,12 @@ protected function _getAssetTitle() /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_componentbuilder'); return $asset->id; diff --git a/admin/views/admin_custom_tabs/submitbutton.js b/admin/views/admin_custom_tabs/submitbutton.js index 3136b79f5..b07838aad 100644 --- a/admin/views/admin_custom_tabs/submitbutton.js +++ b/admin/views/admin_custom_tabs/submitbutton.js @@ -12,7 +12,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/admin_custom_tabs/tmpl/edit.php b/admin/views/admin_custom_tabs/tmpl/edit.php index fa875b421..339e7cf29 100644 --- a/admin/views/admin_custom_tabs/tmpl/edit.php +++ b/admin/views/admin_custom_tabs/tmpl/edit.php @@ -12,71 +12,70 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?>
    \ No newline at end of file diff --git a/admin/views/admins_fields_conditions/view.html.php b/admin/views/admins_fields_conditions/view.html.php index 4253ed693..04b666912 100644 --- a/admin/views/admins_fields_conditions/view.html.php +++ b/admin/views/admins_fields_conditions/view.html.php @@ -12,7 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Componentbuilder Html View class for the Admins_fields_conditions @@ -35,7 +48,7 @@ function display($tpl = null) $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -45,14 +58,14 @@ function display($tpl = null) $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = ComponentbuilderHelper::getActions('admin_fields_conditions'); $this->canEdit = $this->canDo->get('admin_fields_conditions.edit'); $this->canState = $this->canDo->get('admin_fields_conditions.edit.state'); $this->canCreate = $this->canDo->get('admin_fields_conditions.create'); $this->canDelete = $this->canDo->get('admin_fields_conditions.delete'); - $this->canBatch = $this->canDo->get('core.batch'); + $this->canBatch = ($this->canDo->get('admin_fields_conditions.batch') && $this->canDo->get('core.batch')); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') @@ -65,7 +78,7 @@ function display($tpl = null) $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -84,32 +97,32 @@ function display($tpl = null) */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS'), 'joomla'); JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=admins_fields_conditions'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS'), 'joomla'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('admin_fields_conditions.add'); + ToolbarHelper::addNew('admin_fields_conditions.add'); } // Only load if there are items - if (ComponentbuilderHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('admin_fields_conditions.edit'); + ToolbarHelper::editList('admin_fields_conditions.edit'); } if ($this->canState) { - JToolBarHelper::publishList('admins_fields_conditions.publish'); - JToolBarHelper::unpublishList('admins_fields_conditions.unpublish'); - JToolBarHelper::archiveList('admins_fields_conditions.archive'); + ToolbarHelper::publishList('admins_fields_conditions.publish'); + ToolbarHelper::unpublishList('admins_fields_conditions.unpublish'); + ToolbarHelper::archiveList('admins_fields_conditions.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('admins_fields_conditions.checkin'); + ToolbarHelper::checkin('admins_fields_conditions.checkin'); } } @@ -117,11 +130,11 @@ protected function addToolBar() if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -129,34 +142,34 @@ protected function addToolBar() if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'admins_fields_conditions.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'admins_fields_conditions.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('admins_fields_conditions.trash'); + ToolbarHelper::trash('admins_fields_conditions.trash'); } } // set help url for this view if found $this->help_url = ComponentbuilderHelper::getHelpUrl('admins_fields_conditions'); - if (ComponentbuilderHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_componentbuilder'); + ToolbarHelper::preferences('com_componentbuilder'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + Text::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -164,9 +177,9 @@ protected function addToolBar() if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } } @@ -180,10 +193,10 @@ protected function setDocument() { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/admins_fields_conditions.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS')); + Html::_('stylesheet', "administrator/components/com_componentbuilder/assets/css/admins_fields_conditions.css", ['version' => 'auto']); } /** @@ -198,23 +211,33 @@ public function escape($var) if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; + } } diff --git a/admin/views/admins_fields_relations/tmpl/default.php b/admin/views/admins_fields_relations/tmpl/default.php index e515b42ea..09e52d271 100644 --- a/admin/views/admins_fields_relations/tmpl/default.php +++ b/admin/views/admins_fields_relations/tmpl/default.php @@ -12,17 +12,24 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); -JHtml::_('formbehavior.chosen', 'select'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::_('behavior.multiselect'); +Html::_('dropdown.init'); +Html::_('formbehavior.chosen', 'select'); +Html::_('formbehavior.chosen', '.multipleAccessLevels', null, ['placeholder_text_multiple' => '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -']); + if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=admins_fields_relations.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'admin_fields_relationsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); + Html::_('sortablelist.sortable', 'admin_fields_relationsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } ?> -
    + sidebar)): ?>
    sidebar; ?> @@ -33,13 +40,13 @@ $this)); + echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?> items)): ?>
    - +
    @@ -49,11 +56,11 @@
    canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_BATCH_OPTIONS'), + 'title' => Text::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer') ), $this->loadTemplate('batch_body') @@ -63,5 +70,5 @@
    - +
    diff --git a/admin/views/admins_fields_relations/tmpl/default_batch_body.php b/admin/views/admins_fields_relations/tmpl/default_batch_body.php index f45996a1e..e12368766 100644 --- a/admin/views/admins_fields_relations/tmpl/default_batch_body.php +++ b/admin/views/admins_fields_relations/tmpl/default_batch_body.php @@ -12,7 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> -

    +

    batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/admins_fields_relations/tmpl/default_batch_footer.php b/admin/views/admins_fields_relations/tmpl/default_batch_footer.php index adc091fbb..6715bf9e5 100644 --- a/admin/views/admins_fields_relations/tmpl/default_batch_footer.php +++ b/admin/views/admins_fields_relations/tmpl/default_batch_footer.php @@ -12,12 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + ?> \ No newline at end of file diff --git a/admin/views/admins_fields_relations/tmpl/default_body.php b/admin/views/admins_fields_relations/tmpl/default_body.php index 7c5fb6506..de037435f 100644 --- a/admin/views/admins_fields_relations/tmpl/default_body.php +++ b/admin/views/admins_fields_relations/tmpl/default_body.php @@ -12,13 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + $edit = "index.php?option=com_componentbuilder&view=admins_fields_relations&task=admin_fields_relations.edit"; ?> items as $i => $item): ?> user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); + $userChkOut = Factory::getUser($item->checked_out); $canDo = ComponentbuilderHelper::getActions('admin_fields_relations',$item,'admins_fields_relations'); ?> @@ -28,7 +32,7 @@ $iconClass = ''; if (!$this->saveOrder) { - $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + $iconClass = ' inactive tip-top" hasTooltip" title="' . Html::tooltipText('JORDERINGDISABLED'); } ?> @@ -46,12 +50,12 @@ get('admin_fields_relations.edit')): ?> checked_out) : ?> - id); ?> + id); ?> - id); ?> + id); ?> □ @@ -62,7 +66,7 @@ get('admin_fields_relations.edit')): ?> escape($item->admin_view_system_name); ?> checked_out): ?> - name, $item->checked_out_time, 'admins_fields_relations.', $canCheckin); ?> + name, $item->checked_out_time, 'admins_fields_relations.', $canCheckin); ?> escape($item->admin_view_system_name); ?> @@ -73,15 +77,15 @@ get('admin_fields_relations.edit.state')) : ?> checked_out) : ?> - published, $i, 'admins_fields_relations.', true, 'cb'); ?> + published, $i, 'admins_fields_relations.', true, 'cb'); ?> - published, $i, 'admins_fields_relations.', false, 'cb'); ?> + published, $i, 'admins_fields_relations.', false, 'cb'); ?> - published, $i, 'admins_fields_relations.', true, 'cb'); ?> + published, $i, 'admins_fields_relations.', true, 'cb'); ?> - published, $i, 'admins_fields_relations.', false, 'cb'); ?> + published, $i, 'admins_fields_relations.', false, 'cb'); ?> diff --git a/admin/views/admins_fields_relations/tmpl/default_head.php b/admin/views/admins_fields_relations/tmpl/default_head.php index 2557d2a11..28d218805 100644 --- a/admin/views/admins_fields_relations/tmpl/default_head.php +++ b/admin/views/admins_fields_relations/tmpl/default_head.php @@ -12,14 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> canEdit&& $this->canState): ?> - listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> - + @@ -30,18 +33,18 @@ - + canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - + - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/admins_fields_relations/tmpl/default_toolbar.php b/admin/views/admins_fields_relations/tmpl/default_toolbar.php index 236c32115..cce52d798 100644 --- a/admin/views/admins_fields_relations/tmpl/default_toolbar.php +++ b/admin/views/admins_fields_relations/tmpl/default_toolbar.php @@ -12,34 +12,37 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?>
    - -
    - - -
    -
    - - pagination->getLimitBox(); ?> -
    -
    - - -
    -
    - - -
    -
    + +
    + + +
    +
    + + pagination->getLimitBox(); ?> +
    +
    + + +
    +
    + + +
    +
    \ No newline at end of file diff --git a/admin/views/admins_fields_relations/view.html.php b/admin/views/admins_fields_relations/view.html.php index d6382395b..06cc45a12 100644 --- a/admin/views/admins_fields_relations/view.html.php +++ b/admin/views/admins_fields_relations/view.html.php @@ -12,7 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Componentbuilder Html View class for the Admins_fields_relations @@ -35,7 +48,7 @@ function display($tpl = null) $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -45,14 +58,14 @@ function display($tpl = null) $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = ComponentbuilderHelper::getActions('admin_fields_relations'); $this->canEdit = $this->canDo->get('admin_fields_relations.edit'); $this->canState = $this->canDo->get('admin_fields_relations.edit.state'); $this->canCreate = $this->canDo->get('admin_fields_relations.create'); $this->canDelete = $this->canDo->get('admin_fields_relations.delete'); - $this->canBatch = $this->canDo->get('core.batch'); + $this->canBatch = ($this->canDo->get('admin_fields_relations.batch') && $this->canDo->get('core.batch')); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') @@ -65,7 +78,7 @@ function display($tpl = null) $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -84,32 +97,32 @@ function display($tpl = null) */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS'), 'joomla'); JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=admins_fields_relations'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS'), 'joomla'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('admin_fields_relations.add'); + ToolbarHelper::addNew('admin_fields_relations.add'); } // Only load if there are items - if (ComponentbuilderHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('admin_fields_relations.edit'); + ToolbarHelper::editList('admin_fields_relations.edit'); } if ($this->canState) { - JToolBarHelper::publishList('admins_fields_relations.publish'); - JToolBarHelper::unpublishList('admins_fields_relations.unpublish'); - JToolBarHelper::archiveList('admins_fields_relations.archive'); + ToolbarHelper::publishList('admins_fields_relations.publish'); + ToolbarHelper::unpublishList('admins_fields_relations.unpublish'); + ToolbarHelper::archiveList('admins_fields_relations.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('admins_fields_relations.checkin'); + ToolbarHelper::checkin('admins_fields_relations.checkin'); } } @@ -117,11 +130,11 @@ protected function addToolBar() if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -129,34 +142,34 @@ protected function addToolBar() if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'admins_fields_relations.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'admins_fields_relations.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('admins_fields_relations.trash'); + ToolbarHelper::trash('admins_fields_relations.trash'); } } // set help url for this view if found $this->help_url = ComponentbuilderHelper::getHelpUrl('admins_fields_relations'); - if (ComponentbuilderHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_componentbuilder'); + ToolbarHelper::preferences('com_componentbuilder'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + Text::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -164,9 +177,9 @@ protected function addToolBar() if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } } @@ -180,10 +193,10 @@ protected function setDocument() { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/admins_fields_relations.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS')); + Html::_('stylesheet', "administrator/components/com_componentbuilder/assets/css/admins_fields_relations.css", ['version' => 'auto']); } /** @@ -198,23 +211,33 @@ public function escape($var) if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; + } } diff --git a/admin/views/class_extendings/tmpl/default.php b/admin/views/class_extendings/tmpl/default.php index 053a616f2..6505c0c6c 100644 --- a/admin/views/class_extendings/tmpl/default.php +++ b/admin/views/class_extendings/tmpl/default.php @@ -12,17 +12,24 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); -JHtml::_('formbehavior.chosen', 'select'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::_('behavior.multiselect'); +Html::_('dropdown.init'); +Html::_('formbehavior.chosen', 'select'); +Html::_('formbehavior.chosen', '.multipleAccessLevels', null, ['placeholder_text_multiple' => '- ' . Text::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -']); + if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=class_extendings.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'class_extendsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); + Html::_('sortablelist.sortable', 'class_extendsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } ?> -
    + sidebar)): ?>
    sidebar; ?> @@ -33,13 +40,13 @@ $this)); + echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?> items)): ?>
    - +
    @@ -49,11 +56,11 @@
    canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_OPTIONS'), + 'title' => Text::_('COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer') ), $this->loadTemplate('batch_body') @@ -63,5 +70,5 @@
    - +
    diff --git a/admin/views/class_extendings/tmpl/default_batch_body.php b/admin/views/class_extendings/tmpl/default_batch_body.php index ed473bd78..58f6322da 100644 --- a/admin/views/class_extendings/tmpl/default_batch_body.php +++ b/admin/views/class_extendings/tmpl/default_batch_body.php @@ -12,7 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> -

    +

    batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/class_extendings/tmpl/default_batch_footer.php b/admin/views/class_extendings/tmpl/default_batch_footer.php index abd385711..d99efe2f7 100644 --- a/admin/views/class_extendings/tmpl/default_batch_footer.php +++ b/admin/views/class_extendings/tmpl/default_batch_footer.php @@ -12,12 +12,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + ?> \ No newline at end of file diff --git a/admin/views/class_extendings/tmpl/default_body.php b/admin/views/class_extendings/tmpl/default_body.php index b0c9ea780..aa3f3f15c 100644 --- a/admin/views/class_extendings/tmpl/default_body.php +++ b/admin/views/class_extendings/tmpl/default_body.php @@ -12,13 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + $edit = "index.php?option=com_componentbuilder&view=class_extendings&task=class_extends.edit"; ?> items as $i => $item): ?> user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); + $userChkOut = Factory::getUser($item->checked_out); $canDo = ComponentbuilderHelper::getActions('class_extends',$item,'class_extendings'); ?> @@ -28,7 +32,7 @@ $iconClass = ''; if (!$this->saveOrder) { - $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + $iconClass = ' inactive tip-top" hasTooltip" title="' . Html::tooltipText('JORDERINGDISABLED'); } ?> @@ -46,12 +50,12 @@ get('class_extends.edit')): ?> checked_out) : ?> - id); ?> + id); ?> - id); ?> + id); ?> □ @@ -62,7 +66,7 @@ get('class_extends.edit')): ?> escape($item->name); ?> checked_out): ?> - name, $item->checked_out_time, 'class_extendings.', $canCheckin); ?> + name, $item->checked_out_time, 'class_extendings.', $canCheckin); ?> escape($item->name); ?> @@ -70,21 +74,21 @@
    - extension_type); ?> + extension_type); ?> get('class_extends.edit.state')) : ?> checked_out) : ?> - published, $i, 'class_extendings.', true, 'cb'); ?> + published, $i, 'class_extendings.', true, 'cb'); ?> - published, $i, 'class_extendings.', false, 'cb'); ?> + published, $i, 'class_extendings.', false, 'cb'); ?> - published, $i, 'class_extendings.', true, 'cb'); ?> + published, $i, 'class_extendings.', true, 'cb'); ?> - published, $i, 'class_extendings.', false, 'cb'); ?> + published, $i, 'class_extendings.', false, 'cb'); ?> diff --git a/admin/views/class_extendings/tmpl/default_head.php b/admin/views/class_extendings/tmpl/default_head.php index 40bee431c..338c01d3f 100644 --- a/admin/views/class_extendings/tmpl/default_head.php +++ b/admin/views/class_extendings/tmpl/default_head.php @@ -12,14 +12,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> canEdit&& $this->canState): ?> - listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> - + @@ -30,21 +33,21 @@ - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - + - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/class_extendings/tmpl/default_toolbar.php b/admin/views/class_extendings/tmpl/default_toolbar.php index 18c6a9ac6..c572fc964 100644 --- a/admin/views/class_extendings/tmpl/default_toolbar.php +++ b/admin/views/class_extendings/tmpl/default_toolbar.php @@ -12,34 +12,37 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?>
    - -
    - - -
    -
    - - pagination->getLimitBox(); ?> -
    -
    - - -
    -
    - - -
    -
    + +
    + + +
    +
    + + pagination->getLimitBox(); ?> +
    +
    + + +
    +
    + + +
    +
    \ No newline at end of file diff --git a/admin/views/class_extendings/view.html.php b/admin/views/class_extendings/view.html.php index 459e76827..302f48e63 100644 --- a/admin/views/class_extendings/view.html.php +++ b/admin/views/class_extendings/view.html.php @@ -12,7 +12,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Componentbuilder Html View class for the Class_extendings @@ -35,7 +48,7 @@ function display($tpl = null) $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -45,14 +58,14 @@ function display($tpl = null) $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = ComponentbuilderHelper::getActions('class_extends'); $this->canEdit = $this->canDo->get('class_extends.edit'); $this->canState = $this->canDo->get('class_extends.edit.state'); $this->canCreate = $this->canDo->get('class_extends.create'); $this->canDelete = $this->canDo->get('class_extends.delete'); - $this->canBatch = $this->canDo->get('core.batch'); + $this->canBatch = ($this->canDo->get('class_extends.batch') && $this->canDo->get('core.batch')); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') @@ -65,7 +78,7 @@ function display($tpl = null) $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -84,32 +97,32 @@ function display($tpl = null) */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDINGS'), 'joomla'); JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=class_extendings'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_CLASS_EXTENDINGS'), 'joomla'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('class_extends.add'); + ToolbarHelper::addNew('class_extends.add'); } // Only load if there are items - if (ComponentbuilderHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('class_extends.edit'); + ToolbarHelper::editList('class_extends.edit'); } if ($this->canState) { - JToolBarHelper::publishList('class_extendings.publish'); - JToolBarHelper::unpublishList('class_extendings.unpublish'); - JToolBarHelper::archiveList('class_extendings.archive'); + ToolbarHelper::publishList('class_extendings.publish'); + ToolbarHelper::unpublishList('class_extendings.unpublish'); + ToolbarHelper::archiveList('class_extendings.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('class_extendings.checkin'); + ToolbarHelper::checkin('class_extendings.checkin'); } } @@ -117,11 +130,11 @@ protected function addToolBar() if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -129,34 +142,34 @@ protected function addToolBar() if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'class_extendings.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'class_extendings.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('class_extendings.trash'); + ToolbarHelper::trash('class_extendings.trash'); } } // set help url for this view if found $this->help_url = ComponentbuilderHelper::getHelpUrl('class_extendings'); - if (ComponentbuilderHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_componentbuilder'); + ToolbarHelper::preferences('com_componentbuilder'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + Text::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -164,9 +177,9 @@ protected function addToolBar() if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } @@ -174,19 +187,19 @@ protected function addToolBar() if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Extension Type Selection - $this->extension_typeOptions = JFormHelper::loadFieldType('classextendingsfilterextensiontype')->options; + $this->extension_typeOptions = FormHelper::loadFieldType('classextendingsfilterextensiontype')->options; // We do some sanitation for Extension Type filter - if (ComponentbuilderHelper::checkArray($this->extension_typeOptions) && + if (ArrayHelper::check($this->extension_typeOptions) && isset($this->extension_typeOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->extension_typeOptions[0]->value)) + !StringHelper::check($this->extension_typeOptions[0]->value)) { unset($this->extension_typeOptions[0]); } // Extension Type Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL').' -', + '- Keep Original '.Text::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL').' -', 'batch[extension_type]', - JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text') + Html::_('select.options', $this->extension_typeOptions, 'value', 'text') ); } } @@ -200,10 +213,10 @@ protected function setDocument() { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDINGS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/class_extendings.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_COMPONENTBUILDER_CLASS_EXTENDINGS')); + Html::_('stylesheet', "administrator/components/com_componentbuilder/assets/css/class_extendings.css", ['version' => 'auto']); } /** @@ -218,25 +231,35 @@ public function escape($var) if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_LABEL'), - 'a.extension_type' => JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.name' => Text::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_LABEL'), + 'a.extension_type' => Text::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; + } } diff --git a/admin/views/class_extends/submitbutton.js b/admin/views/class_extends/submitbutton.js index ca3c27842..926f8a99e 100644 --- a/admin/views/class_extends/submitbutton.js +++ b/admin/views/class_extends/submitbutton.js @@ -12,7 +12,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/class_extends/tmpl/edit.php b/admin/views/class_extends/tmpl/edit.php index dde23d141..d0e41072d 100644 --- a/admin/views/class_extends/tmpl/edit.php +++ b/admin/views/class_extends/tmpl/edit.php @@ -12,76 +12,75 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?>