Compare commits

...

26 Commits

Author SHA1 Message Date
9f30f30b9e Release search stable BETA. 2022-11-04 22:18:05 +02:00
f1cb398f7a Adds beta search engine to JCB. 2022-11-02 21:48:20 +02:00
f2ea22d0ad Continued development on the search feature 2022-10-31 00:34:54 +02:00
869a1879cb Moved some class around for better structure in the jcb_powers of JCB. Fixed small issue with JCB package export. 2022-10-23 23:18:02 +02:00
d4843d6696 Improved the compiler power building class. Add the search form and the needed ajax functions. 2022-10-20 16:40:18 +02:00
9db33ad449 Fixed issue #957 to load classes namespace. Refactored search classes. Improved the Power compiler class. 2022-10-06 19:34:44 +02:00
dcb4f86ee2 Fixed power include issue in plugin. 2022-09-20 15:09:12 +02:00
e6c8805143 Fixed power include issue. 2022-09-20 13:34:20 +02:00
5537a868e3 Adds licensing template option to the powers area. 2022-09-20 13:06:03 +02:00
f4fccfe761 Adds the update option for sub-form array values 2022-09-19 10:05:41 +02:00
fca5bd5f42 Adds basic and regex search and replace types. 2022-09-17 23:59:31 +02:00
c53ece2a2d Adds more classes, and refactoring to the search feature. Adds test search to search page. #952 2022-09-16 23:49:53 +02:00
d757e14fac Adds the initial classes needed for the new search feature. Adds the empty view for the search feature. #952 2022-09-14 17:40:02 +02:00
1dddba0fc8 Moved some arrays to the Registry, and marked and updated deprecated class methods and values in the compiler. 2022-09-10 10:16:44 +02:00
c5a85f167e Moved many field related get methods to its own classes 2022-09-10 10:12:13 +02:00
4a32d3d50e Adds interfaces to many classes. 2022-09-03 12:48:53 +02:00
0512af0f33 Adds the customcode extractor class 2022-09-02 12:24:00 +02:00
abe9b5d227 Adds the customcode dispencer class 2022-09-01 12:24:55 +02:00
4928a8baaf Moves multiple class methods to their own power classes. Moves many compiler config values to its own config class. Updated the Expantion method to use the new config class. 2022-08-30 17:28:41 +02:00
f8ac247377 Initial move of configuration to its own class and factory. #951 2022-08-21 19:21:03 +02:00
e7500b76eb Add tmp debugging. 2022-08-20 18:33:09 +02:00
a0fda76abd Adds getExtensionInstallClass and setInstallMethodScript to its own class. #950 2022-08-20 18:02:48 +02:00
154cd5ae1e Remove specific type for adapter parameter from all installer methods 2022-08-19 20:00:52 +03:00
d4ffc3addc Fixed the dashboard to allow offline work 2022-07-09 22:37:56 +02:00
f81f05936a Fixed a few links inside JCB 2022-07-09 18:27:30 +02:00
f50690819f Fixed octojpack update server link 2022-07-09 18:07:02 +02:00
218 changed files with 32483 additions and 15469 deletions

6
.github/SUPPORT.md vendored
View File

@ -17,11 +17,11 @@ We have started a [**JCB forum**][forum] where you can post questions, about how
[Tutorials]: https://www.youtube.com/playlist?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE
[HelloWorld]: https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45
[Wiki]: https://github.com/vdm-io/Joomla-Component-Builder/wiki
[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://github.com/vdm-io/Joomla-Component-Builder/issues
[Issue]: https://git.vdm.dev/joomla/Component-Builder/issues
[VDM]: https://www.vdm.io/joomla-component-builder
[guidelines]: https://github.com/vdm-io/Joomla-Component-Builder/blob/master/.github/CONTRIBUTING.md
[guidelines]: https://git.vdm.dev/joomla/Component-Builder/src/branch/master/.github/CONTRIBUTING.md

View File

@ -20,7 +20,7 @@
"author_url": "https://io.vdm.dev/",
"description": "The Joomla Component Builder Package that bundles JCB Component and all the plugins and features available into one package for easy install and update of your JCB system.",
"version_id": "com_componentbuilder",
"update_servers": "https://git.vdm.dev/joomla/Component-Builder/raw/branch/staging/componentbuilder_update_server.xml"
"update_servers": "https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/componentbuilder_update_server.xml"
},
"repository": {
"owner": "joomla",

View File

@ -3,13 +3,13 @@
This is a [Joomla 3.x](https://extensions.joomla.org/extension/component-builder/) component. [__See In Action__](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/staging/admin/assets/images/vdm-component.jpg "The Component Builder")
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/admin/assets/images/jcb-banner.jpg "The Component Builder")
The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.2) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.11) 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)
@ -108,11 +108,11 @@ Where can you get support and help?
+ [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/staging/.github/SUPPORT.md) project [VDM.io](https://www.vdm.io/) is **no longer solely responsible** for support.
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.
^^ Then if you run into any issues, related to the [JCB](http://joomlacomponentbuilder.com) code, like bugs, **start by searching** the (*open & closed*) issues over on Gitea, 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/staging/.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).
WHY GIVE IT AWAY LIKE THIS?
====================
@ -140,14 +140,14 @@ 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*: 9th July, 2022
+ *Version*: 3.1.2
+ *Last Build*: 4th November, 2022
+ *Version*: 3.1.11
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **311259**
+ *Field count*: **2002**
+ *File count*: **2049**
+ *Folder count*: **349**
+ *Line count*: **334175**
+ *Field count*: **2004**
+ *File count*: **2183**
+ *Folder count*: **381**
> 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)

View File

@ -3,13 +3,13 @@
This is a [Joomla 3.x](https://extensions.joomla.org/extension/component-builder/) component. [__See In Action__](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/staging/admin/assets/images/vdm-component.jpg "The Component Builder")
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/admin/assets/images/jcb-banner.jpg "The Component Builder")
The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.2) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.11) 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)
@ -108,11 +108,11 @@ Where can you get support and help?
+ [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/staging/.github/SUPPORT.md) project [VDM.io](https://www.vdm.io/) is **no longer solely responsible** for support.
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.
^^ Then if you run into any issues, related to the [JCB](http://joomlacomponentbuilder.com) code, like bugs, **start by searching** the (*open & closed*) issues over on Gitea, 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/staging/.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).
WHY GIVE IT AWAY LIKE THIS?
====================
@ -140,14 +140,14 @@ 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*: 9th July, 2022
+ *Version*: 3.1.2
+ *Last Build*: 4th November, 2022
+ *Version*: 3.1.11
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **311259**
+ *Field count*: **2002**
+ *File count*: **2049**
+ *Folder count*: **349**
+ *Line count*: **334175**
+ *Field count*: **2004**
+ *File count*: **2183**
+ *Folder count*: **381**
> 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)

View File

@ -498,6 +498,9 @@
<action name="power.edit.state" title="COM_COMPONENTBUILDER_POWERS_EDIT_STATE" description="COM_COMPONENTBUILDER_POWERS_EDIT_STATE_DESC" />
<action name="power.version" title="COM_COMPONENTBUILDER_POWERS_EDIT_VERSION" description="COM_COMPONENTBUILDER_POWERS_EDIT_VERSION_DESC" />
<action name="power.submenu" title="COM_COMPONENTBUILDER_POWERS_SUBMENU" description="COM_COMPONENTBUILDER_POWERS_SUBMENU_DESC" />
<action name="search.access" title="COM_COMPONENTBUILDER_SEARCH_ACCESS" description="COM_COMPONENTBUILDER_SEARCH_ACCESS_DESC" />
<action name="search.compiler" title="COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS_DESC" />
<action name="search.submenu" title="COM_COMPONENTBUILDER_SEARCH_SUBMENU" description="COM_COMPONENTBUILDER_SEARCH_SUBMENU_DESC" />
<action name="server.access" title="COM_COMPONENTBUILDER_SERVERS_ACCESS" description="COM_COMPONENTBUILDER_SERVERS_ACCESS_DESC" />
<action name="server.batch" title="COM_COMPONENTBUILDER_SERVERS_BATCH_USE" description="COM_COMPONENTBUILDER_SERVERS_BATCH_USE_DESC" />
<action name="server.create" title="COM_COMPONENTBUILDER_SERVERS_CREATE" description="COM_COMPONENTBUILDER_SERVERS_CREATE_DESC" />

View File

@ -0,0 +1,37 @@
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/* CSS Document */
.selected {
background-color:#d7d8db !important
}
tr.selected td {
background-color:#d7d8db !important
}
tr {
cursor:pointer
}
.found_code {
color: #46a546;
font-weight: bolder;
}
.search_details_title {
font-size: large;
font-weight: bolder;
}
.small_column {
padding: 2px;
text-align: center;
}
th.small_column {
padding: 2px !important;
text-align: center !important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

833
admin/assets/js/search.js Normal file
View File

@ -0,0 +1,833 @@
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/* JS Document */
/**
* JS Function to execute the search
*/
const doSearch = async (signal, tables) => {
try {
// build form
const formData = new FormData();
// load the result table
const resultsTable = new DataTable('#search_results_table');
// get the search mode
let typeSearch = modeObject.querySelector('input[type=\'radio\']:checked').value;
// set some search values
let searchValue = searchObject.value;
let replaceValue = replaceObject.value;
// 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', matchObject.checked ? 1 : 0);
formData.append('whole_word', wholeObject.checked ? 1 : 0);
formData.append('regex_search', regexObject.checked ? 1 : 0);
let abort_this_search_values = false;
// reset the progress bar
searchProgressBarObject.style.width = '0%';
searchProgressBarObject.innerHTML = '0%';
// show the progress bar
searchProgressObject.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
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');
}
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 == 1) {
// calling URL
postURL = UrlAjax + 'getSearchValue';
} else {
// add the line value
formData.append('line_nr', line);
// calling URL
postURL = UrlAjax + 'getReplaceValue';
}
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 = () => {
// load question
let question = Joomla.JText._('COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_REPLACE_BALLB_SEARCH_RESULTS') + '<br />' +
Joomla.JText._('COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_BYOU_HAVE_BEEN_WARNEDB') + '<br /><br />' +
Joomla.JText._('COM_COMPONENTBUILDER_ARE_YOU_THEREFORE_ABSOLUTELY_SURE_YOU_WANT_TO_CONTINUE');
// do check
UIkit.modal.confirm(question, function () {
// show the search settings again
showSearch();
// Create new controller and issue new request
controller_replace = new AbortController();
// check if any specific table was set
let tables = [];
let table = tableObject.value;
if (table != -1) {
tables.push(table);
replaceAll(controller_replace.signal, tables);
} else {
replaceAll(controller_replace.signal, searchTables);
}
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES_UPDATE_ALL'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
};
/**
* JS Function to execute the search
*/
const replaceAll = async (signal, tables) => {
try {
// build form
const formData = new FormData();
// get the search mode
let typeSearch = modeObject.querySelector('input[type=\'radio\']:checked').value;
// set some search values
let searchValue = searchObject.value;
let replaceValue = replaceObject.value;
let matchValue = matchObject.checked ? 1 : 0;
let wholeValue = wholeObject.checked ? 1 : 0;
let regexValue = regexObject.checked ? 1 : 0;
// add the form data
formData.append('table_name', '');
formData.append('type_search', typeSearch);
formData.append('search_value', searchValue);
formData.append('replace_value', replaceValue);
formData.append('match_case', matchValue);
formData.append('whole_word', wholeValue);
formData.append('regex_search', regexValue);
// reset the progress bar
replaceProgressBarObject.style.width = '0%';
// show the progress bar
replaceProgressObject.style.display = '';
let abort_this_replace_values = false;
let total = 0;
let progress = tables.length;
let index;
for (index = 0; index < progress; index++) {
let tableName = tables[index];
// add the table name
formData.set('table_name', tableName);
let options = {
signal: signal,
method: 'POST', // *GET, POST, PUT, DELETE, etc.
body: formData
}
if (abort_this_replace_values) {
break;
}
const response = await fetch(UrlAjax + 'replaceAll', options).then(response => {
total++;
if (response.ok) {
return response.json();
} else {
UIkit.notify(Joomla.JText._('COM_COMPONENTBUILDER_THE_REPLACE_PROCESS_HAD_AN_ERROR_WITH_TABLE') + ' ' + tableName, {pos:'top-right', status:'danger'});
}
}).then((data) => {
if (typeof data.success !== 'undefined') {
UIkit.notify(data.success, {pos:'top-right', timeout : 200, status:'success'});
} else if (typeof data.error !== 'undefined') {
UIkit.notify(data.error, {pos:'bottom-right', timeout : 200});
}
// calculate the percent
let percent = 100.0 * (total / progress);
// update the progress bar
replaceProgressBarObject.style.width = percent.toFixed(2) + '%';
// when complete hide the progress bar
if (progress == total) {
setTimeout(function () {
// hide the progress bar again
replaceProgressObject.style.display = 'none';
// we clear the table again
clearAll();
// if not reqex we reverse the search for you so you can see the update was a success
if (regexValue == 0) {
// set the replace value as the search value
UIkit.modal.confirm(Joomla.JText._('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_DO_A_REVERSE_SEARCH'), function(){
setSearch(replaceValue, searchValue, matchValue, wholeValue, regexValue, 2);
}, function () {
UIkit.modal.confirm(Joomla.JText._('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_REPEAT_THE_SAME_SEARCH'), function(){
onChange();
}, 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(){
onChange();
}, function () {
clearSearch();
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
}
}, 3000);
}
}).catch(error => {
console.log(error);
if (error.name === "AbortError") {
abort_this_replace_values = true;
}
});
}
} catch (error) {
console.log(error);
} finally {
// Executed regardless if we caught the error
}
};
/**
* JS Function to check if we should save/update the current selected item
*/
const setValueCheck = (row, field, table) => {
// load question
let question = Joomla.JText._('COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_UPDATE_ROW') + ' (' + row + ') -> (' + field + ') ' +
Joomla.JText._('COM_COMPONENTBUILDER_FIELD_IN_THE') + ' (' + table + ') ' + Joomla.JText._('COM_COMPONENTBUILDER_TABLE') + '.<br /><br />' +
Joomla.JText._('COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE');
// do check
UIkit.modal.confirm(question, function () {
setValue(row, field, table);
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
};
/**
* JS Function to set the current selected item
*/
const setValue = async (row, field, table) => {
try {
// get the value from the editor
let value = editorObject.getValue();
// build form
const formData = new FormData();
formData.append('value', value);
formData.append('row_id', row);
formData.append('field_name', field);
formData.append('table_name', table);
let options = {
method: 'POST', // *GET, POST, PUT, DELETE, etc.
body: formData
}
const response = await fetch(UrlAjax + 'setValue', options).then(response => {
if (response.ok) {
return response.json();
}
}).then((data) => {
if (typeof data.success !== 'undefined') {
UIkit.notify(data.success, {pos:'top-right', status:'success'});
clearSelectedItem();
tableActiveObject.remove().draw();
}
}).catch(error => {
console.log(error);
});
} catch (error) {
console.log(error);
} finally {
// Executed regardless if we caught the error
}
};
/**
* JS Function to add item to the editor
*/
const addSelectedItem = async (value, table, row, field, line) => {
// display area
if (value.length > 1)
{
// add value to editor
editorObject.setValue(value);
// set item details notice area
itemNoticeObject.style.display = '';
itemEditButtonObject.innerHTML = editButtonSelected;
itemTableNameObject.innerHTML = table;
itemRowIdObject.innerHTML = row;
itemFieldNameObject.innerHTML = field;
itemLineNumberObject.innerHTML = line;
// set button and editor line if we have a line number
if (typeof line == 'number') {
// show and set the save button
buttonUpdateItemObject.style.display = '';
buttonUpdateItemObject.setAttribute('onclick',"setValueCheck(" + row + ", '" + field + "', '" + table + "');");
// get top of the code line
let top = editorObject.charCoords({line: line, ch: 0}, "local").top;
// scroll to the line
editorObject.scrollTo(null, top - 12);
// select the line
editorObject.setCursor(line - 1);
} else {
// no line so no data we can't save this data
buttonUpdateItemObject.setAttribute('onclick', "");
buttonUpdateItemObject.style.display = 'none';
}
}
};
/**
* JS Function to clear item from the editor and hide it
*/
const clearSelectedItem = async () => {
// display area
editorObject.setValue('');
// clear notice area
itemNoticeObject.style.display = 'none';
itemEditButtonObject.innerHTML = '...';
itemTableNameObject.innerHTML = '...';
itemRowIdObject.innerHTML = '...';
itemFieldNameObject.innerHTML = '...';
itemLineNumberObject.innerHTML = '...';
// clear update button
buttonUpdateItemObject.setAttribute('onclick', '');
};
/**
* JS Function to clear table items
*/
const clearTableItems = async () => {
let table = new DataTable('#search_results_table');
table.clear().draw( true );
// hide the update all items
buttonUpdateAllObject.style.display = '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 setSearch = async (search, replace = '', match = 0, whole = 0, regex = 0, mode = 1) => {
// update the type of search
if (mode == 1) {
window.location.href = UrlSearch +
'&search_value=' + search +
'&type_search=1&match_case=' + match +
'&whole_word=' + whole +
'&regex_search=' + regex;
} else if (mode == 2) {
window.location.href = UrlSearch +
'&search_value=' + search +
'&replace_value=' + replace +
'&type_search=2&match_case=' + match +
'&whole_word=' + whole +
'&regex_search=' + regex;
}
};
/**
* 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) {
buttonUpdateAllObject.style.display = ''; // TODO should only show once all items are loaded
} else {
buttonUpdateAllObject.style.display = 'none'; // TODO should only show once all items are loaded
}
};
/**
* JS Function to execute (A) on search/replace text change , (B) on search options changes
*/
const onChange = () => {
// 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) {
// 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 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 &amp; van Zonneveld'
// example 2: htmlentities("foo'bar","ENT_QUOTES")
// returns 2: 'foo&#039;bar'
const hashMap = getHtmlTranslationTable('HTML_ENTITIES', quoteStyle)
string = string === null ? '' : string + ''
if (!hashMap) {
return false
}
if (quoteStyle && quoteStyle === 'ENT_QUOTES') {
hashMap["'"] = '&#039;'
}
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: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
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'] = '&amp;'
if (useTable === 'HTML_ENTITIES') {
entities['160'] = '&nbsp;'
entities['161'] = '&iexcl;'
entities['162'] = '&cent;'
entities['163'] = '&pound;'
entities['164'] = '&curren;'
entities['165'] = '&yen;'
entities['166'] = '&brvbar;'
entities['167'] = '&sect;'
entities['168'] = '&uml;'
entities['169'] = '&copy;'
entities['170'] = '&ordf;'
entities['171'] = '&laquo;'
entities['172'] = '&not;'
entities['173'] = '&shy;'
entities['174'] = '&reg;'
entities['175'] = '&macr;'
entities['176'] = '&deg;'
entities['177'] = '&plusmn;'
entities['178'] = '&sup2;'
entities['179'] = '&sup3;'
entities['180'] = '&acute;'
entities['181'] = '&micro;'
entities['182'] = '&para;'
entities['183'] = '&middot;'
entities['184'] = '&cedil;'
entities['185'] = '&sup1;'
entities['186'] = '&ordm;'
entities['187'] = '&raquo;'
entities['188'] = '&frac14;'
entities['189'] = '&frac12;'
entities['190'] = '&frac34;'
entities['191'] = '&iquest;'
entities['192'] = '&Agrave;'
entities['193'] = '&Aacute;'
entities['194'] = '&Acirc;'
entities['195'] = '&Atilde;'
entities['196'] = '&Auml;'
entities['197'] = '&Aring;'
entities['198'] = '&AElig;'
entities['199'] = '&Ccedil;'
entities['200'] = '&Egrave;'
entities['201'] = '&Eacute;'
entities['202'] = '&Ecirc;'
entities['203'] = '&Euml;'
entities['204'] = '&Igrave;'
entities['205'] = '&Iacute;'
entities['206'] = '&Icirc;'
entities['207'] = '&Iuml;'
entities['208'] = '&ETH;'
entities['209'] = '&Ntilde;'
entities['210'] = '&Ograve;'
entities['211'] = '&Oacute;'
entities['212'] = '&Ocirc;'
entities['213'] = '&Otilde;'
entities['214'] = '&Ouml;'
entities['215'] = '&times;'
entities['216'] = '&Oslash;'
entities['217'] = '&Ugrave;'
entities['218'] = '&Uacute;'
entities['219'] = '&Ucirc;'
entities['220'] = '&Uuml;'
entities['221'] = '&Yacute;'
entities['222'] = '&THORN;'
entities['223'] = '&szlig;'
entities['224'] = '&agrave;'
entities['225'] = '&aacute;'
entities['226'] = '&acirc;'
entities['227'] = '&atilde;'
entities['228'] = '&auml;'
entities['229'] = '&aring;'
entities['230'] = '&aelig;'
entities['231'] = '&ccedil;'
entities['232'] = '&egrave;'
entities['233'] = '&eacute;'
entities['234'] = '&ecirc;'
entities['235'] = '&euml;'
entities['236'] = '&igrave;'
entities['237'] = '&iacute;'
entities['238'] = '&icirc;'
entities['239'] = '&iuml;'
entities['240'] = '&eth;'
entities['241'] = '&ntilde;'
entities['242'] = '&ograve;'
entities['243'] = '&oacute;'
entities['244'] = '&ocirc;'
entities['245'] = '&otilde;'
entities['246'] = '&ouml;'
entities['247'] = '&divide;'
entities['248'] = '&oslash;'
entities['249'] = '&ugrave;'
entities['250'] = '&uacute;'
entities['251'] = '&ucirc;'
entities['252'] = '&uuml;'
entities['253'] = '&yacute;'
entities['254'] = '&thorn;'
entities['255'] = '&yuml;'
}
if (useQuoteStyle !== 'ENT_NOQUOTES') {
entities['34'] = '&quot;'
}
if (useQuoteStyle === 'ENT_QUOTES') {
entities['39'] = '&#39;'
}
entities['60'] = '&lt;'
entities['62'] = '&gt;'
// ascii decimals to real symbols
for (decimal in entities) {
if (entities.hasOwnProperty(decimal)) {
hashMap[String.fromCharCode(decimal)] = entities[decimal]
}
}
return hashMap
}

View File

@ -20,7 +20,7 @@ defined('_JEXEC') or die('Restricted access');
?>
<img alt="<?php echo JText::_('COM_###COMPONENT###'); ?>" src="components/com_###component###/assets/images/vdm-component.###COMP_IMAGE_TYPE###">
<ul class="list-striped">
<li><b><?php echo JText::_('COM_###COMPONENT###_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?>&nbsp;&nbsp;<span class="update-notice"></span></li>
<li><b><?php echo JText::_('COM_###COMPONENT###_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?>&nbsp;&nbsp;<span class="update-notice" id="component-update-notice"></span></li>
<li><b><?php echo JText::_('COM_###COMPONENT###_DATE'); ?>:</b> <?php echo $this->manifest->creationDate; ?></li>
<li><b><?php echo JText::_('COM_###COMPONENT###_AUTHOR'); ?>:</b> <a href="mailto:<?php echo $this->manifest->authorEmail; ?>"><?php echo $this->manifest->author; ?></a></li>
<li><b><?php echo JText::_('COM_###COMPONENT###_WEBSITE'); ?>:</b> <a href="<?php echo $this->manifest->authorUrl; ?>" target="_blank"><?php echo $this->manifest->authorUrl; ?></a></li>

View File

@ -678,16 +678,6 @@
size="60"
default=""
/>
<field type="note" name="medium_key_note" class="alert alert-info" label="COM_COMPONENTBUILDER_CONFIG_MEDIUM_KEY_NOTE_LABEL" description="COM_COMPONENTBUILDER_CONFIG_MEDIUM_KEY_NOTE_DESC" />
<field name="medium_key_path"
type="text"
label="COM_COMPONENTBUILDER_CONFIG_MEDIUM_KEY_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_MEDIUM_KEY_DESC"
size="160"
filter="PATH"
hint="/home/user/hiddenfolder123/"
default=""
/>
</fieldset>
<fieldset
name="compiler_custom_config"
@ -930,11 +920,11 @@
min="1"
showon="development_method:2">
<form hidden="true" name="list_expansion_modal" repeat="true">
<!-- Component Field. Type: Joomlacomponent. (custom) -->
<!-- Component_id Field. Type: Joomlacomponent. (custom) -->
<field
type="joomlacomponent"
name="component"
label="COM_COMPONENTBUILDER_CONFIG_COMPONENT_LABEL"
name="component_id"
label="COM_COMPONENTBUILDER_CONFIG_COMPONENT_ID_LABEL"
class="list_class"
multiple="false"
default="0"
@ -973,14 +963,14 @@
description="COM_COMPONENTBUILDER_CONFIG_REPOSITORY_DESCRIPTION"
class="inputbox"
/>
<!-- Placeholders Field. Type: Checkbox. (joomla) -->
<!-- Add_placeholders Field. Type: Checkbox. (joomla) -->
<field
type="checkbox"
name="placeholders"
label="COM_COMPONENTBUILDER_CONFIG_PLACEHOLDERS_LABEL"
name="add_placeholders"
label="COM_COMPONENTBUILDER_CONFIG_ADD_PLACEHOLDERS_LABEL"
value="1"
default=""
description="COM_COMPONENTBUILDER_CONFIG_PLACEHOLDERS_DESCRIPTION"
description="COM_COMPONENTBUILDER_CONFIG_ADD_PLACEHOLDERS_DESCRIPTION"
class="inputbox"
/>
</form>

View File

@ -35,6 +35,7 @@ class ComponentbuilderControllerAjax extends BaseController
$this->registerTask('getComponentDetails', 'ajax');
$this->registerTask('getCronPath', 'ajax');
$this->registerTask('getWiki', 'ajax');
$this->registerTask('getVersion', 'ajax');
$this->registerTask('getJCBpackageInfo', 'ajax');
$this->registerTask('getCrowdinDetails', 'ajax');
$this->registerTask('getModuleCode', 'ajax');
@ -66,6 +67,11 @@ class ComponentbuilderControllerAjax extends BaseController
$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');
@ -295,6 +301,47 @@ class ComponentbuilderControllerAjax extends BaseController
}
}
break;
case 'getVersion':
try
{
$versionValue = $jinput->get('version', NULL, 'INT');
if($versionValue && $user->id != 0)
{
$result = $this->getModel('ajax')->getVersion($versionValue);
}
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 'getJCBpackageInfo':
try
{
@ -1589,6 +1636,241 @@ class ComponentbuilderControllerAjax extends BaseController
}
}
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)
{
$result = $this->getModel('ajax')->doSearch($table_nameValue, $type_searchValue, $search_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue);
}
else
{
$result = false;
}
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case '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)
{
$result = $this->getModel('ajax')->replaceAll($table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue);
}
else
{
$result = false;
}
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'getSearchValue':
try
{
$field_nameValue = $jinput->get('field_name', NULL, 'WORD');
$row_idValue = $jinput->get('row_id', NULL, 'INT');
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
$search_valueValue = $jinput->get('search_value', NULL, 'RAW');
$replace_valueValue = $jinput->get('replace_value', NULL, 'RAW');
$match_caseValue = $jinput->get('match_case', 0, 'INT');
$whole_wordValue = $jinput->get('whole_word', 0, 'INT');
$regex_searchValue = $jinput->get('regex_search', 0, 'INT');
if($field_nameValue && $user->id != 0 && $row_idValue && $table_nameValue && $search_valueValue)
{
$result = $this->getModel('ajax')->getSearchValue($field_nameValue, $row_idValue, $table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue);
}
else
{
$result = false;
}
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'getReplaceValue':
try
{
$field_nameValue = $jinput->get('field_name', NULL, 'WORD');
$row_idValue = $jinput->get('row_id', NULL, 'INT');
$line_nrValue = $jinput->get('line_nr', 0, 'STRING');
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
$search_valueValue = $jinput->get('search_value', NULL, 'RAW');
$replace_valueValue = $jinput->get('replace_value', NULL, 'RAW');
$match_caseValue = $jinput->get('match_case', 0, 'INT');
$whole_wordValue = $jinput->get('whole_word', 0, 'INT');
$regex_searchValue = $jinput->get('regex_search', 0, 'INT');
if($field_nameValue && $user->id != 0 && $row_idValue && $table_nameValue && $search_valueValue)
{
$result = $this->getModel('ajax')->getReplaceValue($field_nameValue, $row_idValue, $line_nrValue, $table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue);
}
else
{
$result = false;
}
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'setValue':
try
{
$valueValue = $jinput->get('value', NULL, 'RAW');
$row_idValue = $jinput->get('row_id', NULL, 'INT');
$field_nameValue = $jinput->get('field_name', NULL, 'WORD');
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
if($valueValue && $user->id != 0 && $row_idValue && $field_nameValue && $table_nameValue)
{
$result = $this->getModel('ajax')->setValue($valueValue, $row_idValue, $field_nameValue, $table_nameValue);
}
else
{
$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 'snippetDetails':
try
{

View File

@ -14,6 +14,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
/**
* Compiler Admin Controller
@ -50,7 +51,7 @@ class ComponentbuilderControllerCompiler extends AdminController
*
* @return true on success
*/
public function getCompilerAnimations()
public function getDynamicContent()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
@ -64,7 +65,7 @@ class ComponentbuilderControllerCompiler extends AdminController
{
// get the model
$model = $this->getModel('compiler');
if ($model->getCompilerAnimations($message))
if ($model->getDynamicContent($message))
{
$message = JText::_('COM_COMPONENTBUILDER_BALL_THE_COMPILER_ANIMATIONS_WERE_SUCCESSFULLY_DOWNLOADED_TO_THIS_JOOMLA_INSTALLB');
$this->setRedirect($redirect_url, $message, 'message');
@ -89,20 +90,10 @@ class ComponentbuilderControllerCompiler extends AdminController
// currently only those with admin access can compile a component
if($user->authorise('core.manage', 'com_componentbuilder'))
{
// get the post values
$jinput = JFactory::getApplication()->input;
$componentId = $jinput->post->get('component', 0, 'INT');
$version = $jinput->post->get('version', 0, 'INT');
$addBackup = $jinput->post->get('backup', 0, 'INT');
$addRepo = $jinput->post->get('repository', 0, 'INT');
$addPlaceholders = $jinput->post->get('placeholders', 2, 'INT');
$addPowers = $jinput->post->get('powers', 2, 'INT');
$debugLinenr = $jinput->post->get('debuglinenr', 2, 'INT');
$minify = $jinput->post->get('minify', 2, 'INT');
// include component compiler
require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/compiler.php';
$model = $this->getModel('compiler');
if ($model->builder($version, $componentId, $addBackup, $addRepo, $addPlaceholders, $addPowers, $debugLinenr, $minify))
if ($model->builder())
{
$cache = JFactory::getCache('mod_menu');
$cache->clean();
@ -123,7 +114,7 @@ class ComponentbuilderControllerCompiler extends AdminController
$redirect_url = $app->getUserState('com_componentbuilder.redirect_url');
// get system messages
$message = $app->getUserState('com_componentbuilder.message');
if (empty($redirect_url) && $componentId > 0)
if (empty($redirect_url) && CFactory::_('Config')->component_id > 0)
{
// start new message
$message = array();

View File

@ -0,0 +1,42 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\Utilities\ArrayHelper;
/**
* Componentbuilder Search Base Controller
*/
class ComponentbuilderControllerSearch extends BaseController
{
public function __construct($config)
{
parent::__construct($config);
}
public function dashboard()
{
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder', false));
return;
}
public function openCompiler()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// redirect to the libraries
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=compiler', false));
return;
}
}

View File

@ -20,6 +20,10 @@ use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\MathHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
// Use the component builder autoloader
ComponentbuilderHelper::autoLoader();
@ -29,6 +33,8 @@ ComponentbuilderHelper::autoLoader();
*/
class Compiler extends Infusion
{
/**
* The Temp path
*
@ -74,13 +80,13 @@ class Compiler extends Infusion
// to check the compiler speed
$this->time_start = microtime(true);
// first we run the perent constructors
if (parent::__construct($config))
if (parent::__construct())
{
// set temp directory
$comConfig = JFactory::getConfig();
$this->tempPath = $comConfig->get('tmp_path');
// set some folder paths in relation to distribution
if ($config['backup'])
if (CFactory::_('Config')->backup)
{
$this->backupPath = $this->params->get(
'backup_folder_path', $this->tempPath
@ -88,7 +94,7 @@ class Compiler extends Infusion
$this->dynamicIntegration = true;
}
// set local repos switch
if ($config['repository'])
if (CFactory::_('Config')->repository)
{
$this->repoPath = $this->params->get('git_folder_path', null);
}
@ -99,8 +105,7 @@ class Compiler extends Infusion
$this->removeFolder($this->componentPath . '/site');
// clear form component xml
$xmlPath = $this->componentPath . '/'
. $this->fileContentStatic[$this->hhh . 'component'
. $this->hhh] . '.xml';
. $this->fileContentStatic[Placefix::_h('component')] . '.xml';
$componentXML = ComponentbuilderHelper::getFileContents(
$xmlPath
);
@ -118,7 +123,7 @@ class Compiler extends Infusion
$this->writeFile($xmlPath, $componentXML);
}
// Trigger Event: jcb_ce_onBeforeUpdateFiles
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeUpdateFiles',
array(&$this->componentContext, &$this)
);
@ -128,15 +133,15 @@ class Compiler extends Infusion
return false;
}
// Trigger Event: jcb_ce_onBeforeGetCustomCode
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeGetCustomCode',
array(&$this->componentContext, &$this)
);
// now insert into the new files
if ($this->getCustomCode())
if (CFactory::_('Customcode')->get())
{
// Trigger Event: jcb_ce_onBeforeAddCustomCode
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeAddCustomCode',
array(&$this->componentContext, &$this)
);
@ -144,7 +149,7 @@ class Compiler extends Infusion
$this->addCustomCode();
}
// Trigger Event: jcb_ce_onBeforeSetLangFileData
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeSetLangFileData',
array(&$this->componentContext, &$this)
);
@ -183,7 +188,7 @@ class Compiler extends Infusion
'because more then %s&#37; of the strings have been translated.',
$this->percentageLanguageAdd
);
if ($this->debugLinenr)
if (CFactory::_('Config')->get('debug_line_nr', false))
{
$whyAddedLang = JText::_(
'because the debugging mode is on. (debug line numbers)'
@ -214,12 +219,12 @@ class Compiler extends Infusion
'The <b>SQL</b> fix updates the #__assets table\'s column size on installation of the component and reverses it back to the Joomla default on uninstall of the component.'
);
// set assets table rules column notice
if ($this->addAssetsTableFix)
if (CFactory::_('Config')->add_assets_table_fix)
{
$this->app->enqueueMessage(
JText::_('<hr /><h3>Assets Table Notice</h3>'), 'Notice'
);
$asset_table_fix_type = ($this->addAssetsTableFix == 2)
$asset_table_fix_type = (CFactory::_('Config')->add_assets_table_fix == 2)
? 'intelligent' : 'sql';
$this->app->enqueueMessage(
JText::sprintf(
@ -244,7 +249,7 @@ class Compiler extends Infusion
);
}
// set assets table name column warning if not set
if (!$this->addAssetsTableFix && $this->addAssetsTableNameFix)
if (!CFactory::_('Config')->add_assets_table_fix && $this->addAssetsTableNameFix)
{
// only add if not already added
if ($this->accessSize < 30)
@ -281,18 +286,18 @@ class Compiler extends Infusion
// if there are plugins zip them
$this->zipPlugins();
// do lang mismatch check
if (ArrayHelper::check($this->langMismatch))
if (ArrayHelper::check(CFactory::_('Language.Extractor')->langMismatch))
{
if (ArrayHelper::check($this->langMatch))
if (ArrayHelper::check(CFactory::_('Language.Extractor')->langMatch))
{
$mismatch = array_diff(
array_unique($this->langMismatch),
array_unique($this->langMatch)
array_unique(CFactory::_('Language.Extractor')->langMismatch),
array_unique(CFactory::_('Language.Extractor')->langMatch)
);
}
else
{
$mismatch = array_unique($this->langMismatch);
$mismatch = array_unique(CFactory::_('Language.Extractor')->langMismatch);
}
// set a notice if we have a mismatch
if (isset($mismatch)
@ -322,7 +327,7 @@ class Compiler extends Infusion
// add the mismatching issues
foreach ($mismatch as $string)
{
$constant = $this->langPrefix . '_'
$constant = CFactory::_('Config')->lang_prefix . '_'
. StringHelper::safe($string, 'U');
$this->app->enqueueMessage(
JText::sprintf(
@ -364,24 +369,6 @@ class Compiler extends Infusion
return false;
}
/**
* Set the line number in comments
*
* @param int $nr The line number
*
* @return void
*
*/
private function setLine($nr)
{
if ($this->debugLinenr)
{
return ' [Compiler ' . $nr . ']';
}
return '';
}
/**
* Set the dynamic data to the created fils
*
@ -597,9 +584,9 @@ class Compiler extends Infusion
}
}
// do powers if found
if (ArrayHelper::check($this->powers))
if (ArrayHelper::check(CFactory::_('Power')->active))
{
foreach ($this->powers as $power)
foreach (CFactory::_('Power')->active as $power)
{
if (ObjectHelper::check($power)
&& isset($this->newFiles[$power->key])
@ -640,12 +627,12 @@ class Compiler extends Infusion
protected function setFileContent(&$name, &$path, &$bom, $view = null)
{
// Trigger Event: jcb_ce_onBeforeSetFileContent
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeSetFileContent',
array(&$this->componentContext, &$name, &$path, &$bom, &$view)
);
// set the file name
$this->fileContentStatic[$this->hhh . 'FILENAME' . $this->hhh] = $name;
$this->fileContentStatic[Placefix::_h('FILENAME')] = $name;
// check if the file should get PHP opening
$php = '';
if (ComponentbuilderHelper::checkFileType($name, 'php'))
@ -655,35 +642,35 @@ class Compiler extends Infusion
// get content of the file
$string = ComponentbuilderHelper::getFileContents($path);
// Trigger Event: jcb_ce_onGetFileContents
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onGetFileContents',
array(&$this->componentContext, &$string, &$name, &$path, &$bom,
&$view)
);
// see if we should add a BOM
if (strpos($string, $this->hhh . 'BOM' . $this->hhh) !== false)
if (strpos($string, Placefix::_h('BOM')) !== false)
{
list($wast, $code) = explode(
$this->hhh . 'BOM' . $this->hhh, $string
Placefix::_h('BOM'), $string
);
$string = $php . $bom . $code;
}
// set the answer
$answer = $this->setPlaceholders($string, $this->fileContentStatic, 3);
$answer = CFactory::_('Placeholder')->update($string, $this->fileContentStatic, 3);
// set the dynamic answer
if ($view)
{
$answer = $this->setPlaceholders(
$answer = CFactory::_('Placeholder')->update(
$answer, $this->fileContentDynamic[$view], 3
);
}
// check if this file needs extra care :)
if (isset($this->updateFileContent[$path]))
{
$answer = $this->setDynamicValues($answer);
$answer = CFactory::_('Customcode')->update($answer);
}
// Trigger Event: jcb_ce_onBeforeSetFileContent
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeWriteFileContent',
array(&$this->componentContext, &$answer, &$name, &$path, &$bom,
&$view)
@ -804,7 +791,7 @@ class Compiler extends Infusion
{
foreach ($data['config'] as $key => $value)
{
if ($this->hhh . 'VERSION' . $this->hhh === $key)
if (Placefix::_h('VERSION') === $key)
{
// hmm we sould in some way make it known that this version number
// is not in relation the the project but to the file only... any ideas?
@ -824,14 +811,14 @@ class Compiler extends Infusion
return true;
}
// else insure to reset to global
$this->fileContentStatic[$this->hhh . 'CREATIONDATE' . $this->hhh]
= $this->fileContentStatic[$this->hhh . 'CREATIONDATE' . $this->hhh
$this->fileContentStatic[Placefix::_h('CREATIONDATE')]
= $this->fileContentStatic[Placefix::_h('CREATIONDATE')
. 'GLOBAL'];
$this->fileContentStatic[$this->hhh . 'BUILDDATE' . $this->hhh]
= $this->fileContentStatic[$this->hhh . 'BUILDDATE' . $this->hhh
$this->fileContentStatic[Placefix::_h('BUILDDATE')]
= $this->fileContentStatic[Placefix::_h('BUILDDATE')
. 'GLOBAL'];
$this->fileContentStatic[$this->hhh . 'VERSION' . $this->hhh]
= $this->fileContentStatic[$this->hhh . 'VERSION' . $this->hhh
$this->fileContentStatic[Placefix::_h('VERSION')]
= $this->fileContentStatic[Placefix::_h('VERSION')
. 'GLOBAL'];
}
@ -897,9 +884,9 @@ class Compiler extends Infusion
{
// set readme data if not set already
if (!isset(
$this->fileContentStatic[$this->hhh . 'LINE_COUNT' . $this->hhh]
$this->fileContentStatic[Placefix::_h('LINE_COUNT')]
)
|| $this->fileContentStatic[$this->hhh . 'LINE_COUNT' . $this->hhh]
|| $this->fileContentStatic[Placefix::_h('LINE_COUNT')]
!= $this->lineCount)
{
$this->buildReadMeData();
@ -907,7 +894,7 @@ class Compiler extends Infusion
// get the file
$string = ComponentbuilderHelper::getFileContents($path);
// update the file
$answer = $this->setPlaceholders($string, $this->fileContentStatic);
$answer = CFactory::_('Placeholder')->update($string, $this->fileContentStatic);
// add to zip array
$this->writeFile($path, $answer);
}
@ -915,71 +902,71 @@ class Compiler extends Infusion
private function buildReadMeData()
{
// set some defaults
$this->fileContentStatic[$this->hhh . 'LINE_COUNT' . $this->hhh]
$this->fileContentStatic[Placefix::_h('LINE_COUNT')]
= $this->lineCount;
$this->fileContentStatic[$this->hhh . 'FIELD_COUNT' . $this->hhh]
$this->fileContentStatic[Placefix::_h('FIELD_COUNT')]
= $this->fieldCount;
$this->fileContentStatic[$this->hhh . 'FILE_COUNT' . $this->hhh]
$this->fileContentStatic[Placefix::_h('FILE_COUNT')]
= $this->fileCount;
$this->fileContentStatic[$this->hhh . 'FOLDER_COUNT' . $this->hhh]
$this->fileContentStatic[Placefix::_h('FOLDER_COUNT')]
= $this->folderCount;
$this->fileContentStatic[$this->hhh . 'PAGE_COUNT' . $this->hhh]
$this->fileContentStatic[Placefix::_h('PAGE_COUNT')]
= $this->pageCount;
$this->fileContentStatic[$this->hhh . 'folders' . $this->hhh]
$this->fileContentStatic[Placefix::_h('folders')]
= $this->folderSeconds;
$this->fileContentStatic[$this->hhh . 'foldersSeconds' . $this->hhh]
$this->fileContentStatic[Placefix::_h('foldersSeconds')]
= $this->folderSeconds;
$this->fileContentStatic[$this->hhh . 'files' . $this->hhh]
$this->fileContentStatic[Placefix::_h('files')]
= $this->fileSeconds;
$this->fileContentStatic[$this->hhh . 'filesSeconds' . $this->hhh]
$this->fileContentStatic[Placefix::_h('filesSeconds')]
= $this->fileSeconds;
$this->fileContentStatic[$this->hhh . 'lines' . $this->hhh]
$this->fileContentStatic[Placefix::_h('lines')]
= $this->lineSeconds;
$this->fileContentStatic[$this->hhh . 'linesSeconds' . $this->hhh]
$this->fileContentStatic[Placefix::_h('linesSeconds')]
= $this->lineSeconds;
$this->fileContentStatic[$this->hhh . 'seconds' . $this->hhh]
$this->fileContentStatic[Placefix::_h('seconds')]
= $this->actualSeconds;
$this->fileContentStatic[$this->hhh . 'actualSeconds' . $this->hhh]
$this->fileContentStatic[Placefix::_h('actualSeconds')]
= $this->actualSeconds;
$this->fileContentStatic[$this->hhh . 'totalHours' . $this->hhh]
$this->fileContentStatic[Placefix::_h('totalHours')]
= $this->totalHours;
$this->fileContentStatic[$this->hhh . 'totalDays' . $this->hhh]
$this->fileContentStatic[Placefix::_h('totalDays')]
= $this->totalDays;
$this->fileContentStatic[$this->hhh . 'debugging' . $this->hhh]
$this->fileContentStatic[Placefix::_h('debugging')]
= $this->secondsDebugging;
$this->fileContentStatic[$this->hhh . 'secondsDebugging' . $this->hhh]
$this->fileContentStatic[Placefix::_h('secondsDebugging')]
= $this->secondsDebugging;
$this->fileContentStatic[$this->hhh . 'planning' . $this->hhh]
$this->fileContentStatic[Placefix::_h('planning')]
= $this->secondsPlanning;
$this->fileContentStatic[$this->hhh . 'secondsPlanning' . $this->hhh]
$this->fileContentStatic[Placefix::_h('secondsPlanning')]
= $this->secondsPlanning;
$this->fileContentStatic[$this->hhh . 'mapping' . $this->hhh]
$this->fileContentStatic[Placefix::_h('mapping')]
= $this->secondsMapping;
$this->fileContentStatic[$this->hhh . 'secondsMapping' . $this->hhh]
$this->fileContentStatic[Placefix::_h('secondsMapping')]
= $this->secondsMapping;
$this->fileContentStatic[$this->hhh . 'office' . $this->hhh]
$this->fileContentStatic[Placefix::_h('office')]
= $this->secondsOffice;
$this->fileContentStatic[$this->hhh . 'secondsOffice' . $this->hhh]
$this->fileContentStatic[Placefix::_h('secondsOffice')]
= $this->secondsOffice;
$this->fileContentStatic[$this->hhh . 'actualTotalHours' . $this->hhh]
$this->fileContentStatic[Placefix::_h('actualTotalHours')]
= $this->actualTotalHours;
$this->fileContentStatic[$this->hhh . 'actualTotalDays' . $this->hhh]
$this->fileContentStatic[Placefix::_h('actualTotalDays')]
= $this->actualTotalDays;
$this->fileContentStatic[$this->hhh . 'debuggingHours' . $this->hhh]
$this->fileContentStatic[Placefix::_h('debuggingHours')]
= $this->debuggingHours;
$this->fileContentStatic[$this->hhh . 'planningHours' . $this->hhh]
$this->fileContentStatic[Placefix::_h('planningHours')]
= $this->planningHours;
$this->fileContentStatic[$this->hhh . 'mappingHours' . $this->hhh]
$this->fileContentStatic[Placefix::_h('mappingHours')]
= $this->mappingHours;
$this->fileContentStatic[$this->hhh . 'officeHours' . $this->hhh]
$this->fileContentStatic[Placefix::_h('officeHours')]
= $this->officeHours;
$this->fileContentStatic[$this->hhh . 'actualHoursSpent' . $this->hhh]
$this->fileContentStatic[Placefix::_h('actualHoursSpent')]
= $this->actualHoursSpent;
$this->fileContentStatic[$this->hhh . 'actualDaysSpent' . $this->hhh]
$this->fileContentStatic[Placefix::_h('actualDaysSpent')]
= $this->actualDaysSpent;
$this->fileContentStatic[$this->hhh . 'projectWeekTime' . $this->hhh]
$this->fileContentStatic[Placefix::_h('projectWeekTime')]
= $this->projectWeekTime;
$this->fileContentStatic[$this->hhh . 'projectMonthTime' . $this->hhh]
$this->fileContentStatic[Placefix::_h('projectMonthTime')]
= $this->projectMonthTime;
}
@ -994,9 +981,9 @@ class Compiler extends Infusion
// set the repo path
$repoFullPath = $this->repoPath . '/com_'
. $this->componentData->sales_name . '__joomla_'
. $this->joomlaVersion;
. CFactory::_('Config')->get('version', 3);
// Trigger Event: jcb_ce_onBeforeUpdateRepo
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeUpdateRepo',
array(&$this->componentContext, &$this->componentPath,
&$repoFullPath, &$this->componentData)
@ -1006,7 +993,7 @@ class Compiler extends Infusion
// set the new data
Folder::copy($this->componentPath, $repoFullPath, '', true);
// Trigger Event: jcb_ce_onAfterUpdateRepo
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onAfterUpdateRepo',
array(&$this->componentContext, &$this->componentPath,
&$repoFullPath, &$this->componentData)
@ -1025,9 +1012,9 @@ class Compiler extends Infusion
// set the repo path
$repoFullPath = $this->repoPath . '/'
. $module->folder_name . '__joomla_'
. $this->joomlaVersion;
. CFactory::_('Config')->get('version', 3);
// Trigger Event: jcb_ce_onBeforeUpdateRepo
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeUpdateRepo',
array(&$module_context, &$module->folder_path,
&$repoFullPath, &$module)
@ -1041,7 +1028,7 @@ class Compiler extends Infusion
$module->folder_path, $repoFullPath, '', true
);
// Trigger Event: jcb_ce_onAfterUpdateRepo
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onAfterUpdateRepo',
array(&$module_context, &$module->folder_path,
&$repoFullPath, &$module)
@ -1062,9 +1049,9 @@ class Compiler extends Infusion
// set the repo path
$repoFullPath = $this->repoPath . '/'
. $plugin->folder_name . '__joomla_'
. $this->joomlaVersion;
. CFactory::_('Config')->get('version', 3);
// Trigger Event: jcb_ce_onBeforeUpdateRepo
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeUpdateRepo',
array(&$plugin_context, &$plugin->folder_path,
&$repoFullPath, &$plugin)
@ -1078,7 +1065,7 @@ class Compiler extends Infusion
$plugin->folder_path, $repoFullPath, '', true
);
// Trigger Event: jcb_ce_onAfterUpdateRepo
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onAfterUpdateRepo',
array(&$plugin_context, &$plugin->folder_path,
&$repoFullPath, &$plugin)
@ -1097,7 +1084,7 @@ class Compiler extends Infusion
$this->filepath['component'] = $this->tempPath . '/'
. $this->filepath['component-folder'] . '.zip';
// Trigger Event: jcb_ce_onBeforeZipComponent
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeZipComponent',
array(&$this->componentContext, &$this->componentPath,
&$this->filepath['component'], &$this->tempPath,
@ -1112,7 +1099,7 @@ class Compiler extends Infusion
if ($this->backupPath && $this->dynamicIntegration)
{
// Trigger Event: jcb_ce_onBeforeBackupZip
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBackupZip', array(&$this->componentContext,
&$this->filepath['component'],
&$this->tempPath,
@ -1134,7 +1121,7 @@ class Compiler extends Infusion
if (isset($this->componentData->sales_server))
{
// Trigger Event: jcb_ce_onBeforeMoveToServer
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeMoveToServer',
array(&$this->componentContext,
&$this->filepath['component'], &$this->tempPath,
@ -1150,7 +1137,7 @@ class Compiler extends Infusion
}
}
// Trigger Event: jcb_ce_onAfterZipComponent
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onAfterZipComponent',
array(&$this->componentContext, &$this->filepath['component'],
&$this->tempPath, &$this->componentFolderName,
@ -1189,7 +1176,7 @@ class Compiler extends Infusion
$this->filepath['modules'][$module->id] = $this->tempPath
. '/' . $module->zip_name . '.zip';
// Trigger Event: jcb_ce_onBeforeZipModule
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeZipModule',
array(&$module_context, &$module->folder_path,
&$this->filepath['modules'][$module->id],
@ -1206,7 +1193,7 @@ class Compiler extends Infusion
{
$__module_context = 'module.' . $module_context;
// Trigger Event: jcb_ce_onBeforeBackupZip
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBackupZip',
array(&$__module_context,
&$this->filepath['modules'][$module->id],
@ -1228,7 +1215,7 @@ class Compiler extends Infusion
if (isset($module->sales_server))
{
// Trigger Event: jcb_ce_onBeforeMoveToServer
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeMoveToServer',
array(&$__module_context,
&$this->filepath['modules'][$module->id],
@ -1245,7 +1232,7 @@ class Compiler extends Infusion
}
}
// Trigger Event: jcb_ce_onAfterZipModule
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onAfterZipModule', array(&$module_context,
&$this->filepath['modules'][$module->id],
&$this->tempPath,
@ -1283,7 +1270,7 @@ class Compiler extends Infusion
$this->filepath['plugins'][$plugin->id] = $this->tempPath
. '/' . $plugin->zip_name . '.zip';
// Trigger Event: jcb_ce_onBeforeZipPlugin
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeZipPlugin',
array(&$plugin_context, &$plugin->folder_path,
&$this->filepath['plugins'][$plugin->id],
@ -1300,7 +1287,7 @@ class Compiler extends Infusion
{
$__plugin_context = 'plugin.' . $plugin_context;
// Trigger Event: jcb_ce_onBeforeBackupZip
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBackupZip',
array(&$__plugin_context,
&$this->filepath['plugins'][$plugin->id],
@ -1322,7 +1309,7 @@ class Compiler extends Infusion
if (isset($plugin->sales_server))
{
// Trigger Event: jcb_ce_onBeforeMoveToServer
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeMoveToServer',
array(&$__plugin_context,
&$this->filepath['plugins'][$plugin->id],
@ -1339,7 +1326,7 @@ class Compiler extends Infusion
}
}
// Trigger Event: jcb_ce_onAfterZipPlugin
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onAfterZipPlugin', array(&$plugin_context,
&$this->filepath['plugins'][$plugin->id],
&$this->tempPath,
@ -1357,9 +1344,9 @@ class Compiler extends Infusion
protected function addCustomCode()
{
// reset all these
$this->clearFromPlaceHolders('view');
$this->clearFromPlaceHolders('arg');
foreach ($this->customCode as $nr => $target)
CFactory::_('Placeholder')->clearType('view');
CFactory::_('Placeholder')->clearType('arg');
foreach (CFactory::_('Customcode')->active as $nr => $target)
{
// reset each time per custom code
$fingerPrint = array();
@ -1470,13 +1457,13 @@ class Compiler extends Infusion
}
if ($found)
{
$placeholder = $this->getPlaceHolder(
$placeholder = CFactory::_('Placeholder')->keys(
(int) $target['comment_type'] . $target['type'],
$target['id']
);
$data = $placeholder['start'] . PHP_EOL
. $this->setPlaceholders(
$target['code'], $this->placeholders
. CFactory::_('Placeholder')->update(
$target['code'], CFactory::_('Placeholder')->active
) . $placeholder['end'] . PHP_EOL;
if ($target['type'] == 2)
{
@ -1565,7 +1552,7 @@ class Compiler extends Infusion
$_commentType . PHP_EOL . $commentType, $code
) . $_commentType . PHP_EOL;
// get place holders
$placeholder = $this->getPlaceHolder(
$placeholder = CFactory::_('Placeholder')->keys(
(int) $target['comment_type'] . $target['type'], $target['id']
);
// build the data

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,10 @@ use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GetHelper;
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;
/**
@ -28,6 +32,7 @@ use VDM\Joomla\Utilities\FileHelper;
class Structure extends Get
{
/**
* The folder counter
*
@ -369,56 +374,50 @@ class Structure extends Get
/**
* Constructor
*/
public function __construct($config = array())
public function __construct()
{
// first we run the perent constructor
if (parent::__construct($config))
if (parent::__construct())
{
// set the standard admin file
$this->stdRootFiles[] = $this->componentData->name_code . '.php';
// set incase no extra admin folder are loaded
$this->fileContentStatic[$this->hhh . 'EXSTRA_ADMIN_FOLDERS'
. $this->hhh]
$this->fileContentStatic[Placefix::_h('EXSTRA_ADMIN_FOLDERS')]
= '';
// set incase no extra site folder are loaded
$this->fileContentStatic[$this->hhh . 'EXSTRA_SITE_FOLDERS'
. $this->hhh]
$this->fileContentStatic[Placefix::_h('EXSTRA_SITE_FOLDERS')]
= '';
// set incase no extra media folder are loaded
$this->fileContentStatic[$this->hhh . 'EXSTRA_MEDIA_FOLDERS'
. $this->hhh]
$this->fileContentStatic[Placefix::_h('EXSTRA_MEDIA_FOLDERS')]
= '';
// set incase no extra admin files are loaded
$this->fileContentStatic[$this->hhh . 'EXSTRA_ADMIN_FILES'
. $this->hhh]
$this->fileContentStatic[Placefix::_h('EXSTRA_ADMIN_FILES')]
= '';
// set incase no extra site files are loaded
$this->fileContentStatic[$this->hhh . 'EXSTRA_SITE_FILES'
. $this->hhh]
$this->fileContentStatic[Placefix::_h('EXSTRA_SITE_FILES')]
= '';
// set incase no extra media files are loaded
$this->fileContentStatic[$this->hhh . 'EXSTRA_MEDIA_FILES'
. $this->hhh]
$this->fileContentStatic[Placefix::_h('EXSTRA_MEDIA_FILES')]
= '';
// run global updater
ComponentbuilderHelper::runGlobalUpdater();
// set the template path
$this->templatePath = $this->compilerPath . '/joomla_'
. $this->joomlaVersions[$this->joomlaVersion]['folder_key'];
$this->templatePath = CFactory::_('Config')->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/joomla_'
. $this->joomlaVersions[CFactory::_('Config')->joomla_version]['folder_key'];
// set some default names
$this->componentSalesName = 'com_'
. $this->componentData->sales_name . '__J'
. $this->joomlaVersion;
. CFactory::_('Config')->joomla_version;
$this->componentBackupName = 'com_'
. $this->componentData->sales_name . '_v' . str_replace(
'.', '_', $this->componentData->component_version
) . '__J' . $this->joomlaVersion;
) . '__J' . CFactory::_('Config')->joomla_version;
$this->componentFolderName = 'com_'
. $this->componentData->name_code . '_v' . str_replace(
'.', '_', $this->componentData->component_version
) . '__J' . $this->joomlaVersion;
) . '__J' . CFactory::_('Config')->joomla_version;
// set component folder path
$this->componentPath = $this->compilerPath . '/'
$this->componentPath = CFactory::_('Config')->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/'
. $this->componentFolderName;
// set the template path for custom
$this->templatePathCustom = $this->params->get(
@ -437,7 +436,7 @@ class Structure extends Get
// set the Joomla Version Data
$this->joomlaVersionData = $this->setJoomlaVersionData();
// Trigger Event: jcb_ce_onAfterSetJoomlaVersionData
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onAfterSetJoomlaVersionData',
array(&$this->componentContext, &$this->joomlaVersionData)
);
@ -465,24 +464,6 @@ class Structure extends Get
return false;
}
/**
* Set the line number in comments
*
* @param int $nr The line number
*
* @return string
*
*/
private function setLine($nr)
{
if ($this->debugLinenr)
{
return ' [Structure ' . $nr . ']';
}
return '';
}
/**
* Build the Powers files, folders
*
@ -491,16 +472,20 @@ class Structure extends Get
*/
private function buildPowers()
{
if (ArrayHelper::check($this->powers))
if (ArrayHelper::check(CFactory::_('Power')->active))
{
// for plugin event TODO change event api signatures
$this->powers = CFactory::_('Power')->active;
// Trigger Event: jcb_ce_onBeforeSetModules
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBuildPowers',
array(&$this->componentContext, &$this->powers)
);
// for plugin event TODO change event api signatures
CFactory::_('Power')->active = $this->powers;
// we track the creation of htaccess files
$htaccess = array();
foreach ($this->powers as $power)
foreach (CFactory::_('Power')->active as $power)
{
if (ObjectHelper::check($power)
&& isset($power->path)
@ -529,11 +514,16 @@ class Structure extends Get
. $power->file_name . '.php',
'name' => $power->file_name . '.php',
'zip' => $power->file_name . '.php');
$bom = '<?php' . PHP_EOL . '// A POWER FILE' .
PHP_EOL . Placefix::_h('BOM') . PHP_EOL;
// add custom override if found
if ($power->add_licensing_template == 2)
{
$bom = '<?php' . PHP_EOL . $power->licensing_template;
}
$this->writeFile(
$fileDetails['path'],
'<?php' . PHP_EOL . '// A POWER FILE' .
PHP_EOL . $this->hhh . 'BOM' . $this->hhh . PHP_EOL .
PHP_EOL . $this->hhh . 'POWERCODE' . $this->hhh
$bom . PHP_EOL . Placefix::_h('POWERCODE')
);
$this->newFiles[$power->key][] = $fileDetails;
// count the file created
@ -605,7 +595,7 @@ class Structure extends Get
if (ArrayHelper::check($this->joomlaModules))
{
// Trigger Event: jcb_ce_onBeforeSetModules
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBuildModules',
array(&$this->componentContext, &$this->joomlaModules)
);
@ -618,7 +608,7 @@ class Structure extends Get
))
{
// module path
$module->folder_path = $this->compilerPath . '/'
$module->folder_path = CFactory::_('Config')->get('compiler_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler') . '/'
. $module->folder_name;
// set the module paths
$this->dynamicPaths[$module->key] = $module->folder_path;
@ -634,11 +624,11 @@ class Structure extends Get
$this->writeFile(
$fileDetails['path'],
'<?php' . PHP_EOL . '// main modfile' .
PHP_EOL . $this->hhh . 'BOM' . $this->hhh . PHP_EOL .
PHP_EOL . Placefix::_h('BOM') . PHP_EOL .
PHP_EOL . '// No direct access to this file' . PHP_EOL .
"defined('_JEXEC') or die('Restricted access');"
. PHP_EOL .
$this->hhh . 'MODCODE' . $this->hhh
Placefix::_h('MODCODE')
);
$this->newFiles[$module->key][] = $fileDetails;
// count the file created
@ -653,7 +643,7 @@ class Structure extends Get
$this->writeFile(
$fileDetails['path'],
'<?php' . PHP_EOL . '// get data file' .
PHP_EOL . $this->hhh . 'BOM' . $this->hhh . PHP_EOL
PHP_EOL . Placefix::_h('BOM') . PHP_EOL
.
PHP_EOL . '// No direct access to this file'
. PHP_EOL .
@ -665,7 +655,7 @@ class Structure extends Get
' */' . PHP_EOL .
"class " . $module->class_data_name
. ' extends \JObject' . PHP_EOL .
"{" . $this->hhh . 'DYNAMICGETS' . $this->hhh . "}"
"{" . Placefix::_h('DYNAMICGETS') . "}"
. PHP_EOL
);
$this->newFiles[$module->key][] = $fileDetails;
@ -682,13 +672,13 @@ class Structure extends Get
$this->writeFile(
$fileDetails['path'],
'<?php' . PHP_EOL . '// helper file' .
PHP_EOL . $this->hhh . 'BOM' . $this->hhh . PHP_EOL
PHP_EOL . Placefix::_h('BOM') . PHP_EOL
.
PHP_EOL . '// No direct access to this file'
. PHP_EOL .
"defined('_JEXEC') or die('Restricted access');"
. PHP_EOL .
$this->hhh . 'HELPERCODE' . $this->hhh
Placefix::_h('HELPERCODE')
);
$this->newFiles[$module->key][] = $fileDetails;
// count the file created
@ -716,11 +706,11 @@ class Structure extends Get
$this->writeFile(
$fileDetails['path'],
'<?php' . PHP_EOL . '// default tmpl' .
PHP_EOL . $this->hhh . 'BOM' . $this->hhh . PHP_EOL .
PHP_EOL . Placefix::_h('BOM') . PHP_EOL .
PHP_EOL . '// No direct access to this file' . PHP_EOL .
"defined('_JEXEC') or die('Restricted access');"
. PHP_EOL .
$this->hhh . 'MODDEFAULT' . $this->hhh
Placefix::_h('MODDEFAULT')
);
$this->newFiles[$module->key][] = $fileDetails;
// count the file created
@ -735,13 +725,13 @@ class Structure extends Get
$this->writeFile(
$fileDetails['path'],
'<?php' . PHP_EOL . '// Script template' .
PHP_EOL . $this->hhh . 'BOM' . $this->hhh . PHP_EOL
PHP_EOL . Placefix::_h('BOM') . PHP_EOL
.
PHP_EOL . '// No direct access to this file'
. PHP_EOL .
"defined('_JEXEC') or die('Restricted access');"
. PHP_EOL .
$this->hhh . 'INSTALLCLASS' . $this->hhh
Placefix::_h('INSTALLCLASS')
);
$this->newFiles[$module->key][] = $fileDetails;
// count the file created
@ -769,7 +759,7 @@ class Structure extends Get
$module->add_scripts_field = false;
$field_script_bucket = array();
// add any css from the fields
if (($css = $this->getCustomScriptBuilder(
if (($css = CFactory::_('Customcode.Dispenser')->get(
'css_view', $module->key
)) !== null
&& StringHelper::check($css))
@ -788,23 +778,23 @@ class Structure extends Get
'zip' => 'mod_admin.css');
$this->writeFile(
$fileDetails['path'],
$this->hhh . 'BOM' . $this->hhh . PHP_EOL
Placefix::_h('BOM') . PHP_EOL
. PHP_EOL . $css
);
$this->newFiles[$module->key][] = $fileDetails;
// count the file created
$this->fileCount++;
// add the field script
$field_script_bucket[] = $this->_t(2) . "//"
. $this->setLine(__LINE__) . " Custom CSS";
$field_script_bucket[] = $this->_t(2)
$field_script_bucket[] = Indent::_(2) . "//"
. Line::_(__Line__, __Class__) . " Custom CSS";
$field_script_bucket[] = Indent::_(2)
. "\$document->addStyleSheet('" . $target_path
. "/modules/" . $module->folder_name
. "/css/mod_admin.css', ['version' => 'auto', 'relative' => true]);";
}
}
// add any JavaScript from the fields
if (($javascript = $this->getCustomScriptBuilder(
if (($javascript = CFactory::_('Customcode.Dispenser')->get(
'view_footer', $module->key
)) !== null
&& StringHelper::check($javascript))
@ -823,16 +813,16 @@ class Structure extends Get
'zip' => 'mod_admin.js');
$this->writeFile(
$fileDetails['path'],
$this->hhh . 'BOM' . $this->hhh . PHP_EOL
Placefix::_h('BOM') . PHP_EOL
. PHP_EOL . $javascript
);
$this->newFiles[$module->key][] = $fileDetails;
// count the file created
$this->fileCount++;
// add the field script
$field_script_bucket[] = $this->_t(2) . "//"
. $this->setLine(__LINE__) . " Custom JS";
$field_script_bucket[] = $this->_t(2)
$field_script_bucket[] = Indent::_(2) . "//"
. Line::_(__Line__, __Class__) . " Custom JS";
$field_script_bucket[] = Indent::_(2)
. "\$document->addScript('" . $target_path
. "/modules/" . $module->folder_name
. "/js/mod_admin.js', ['version' => 'auto', 'relative' => true]);";
@ -889,7 +879,7 @@ class Structure extends Get
. '.xml');
// build basic XML
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<!--' . $this->setLine(__LINE__)
$xml .= PHP_EOL . '<!--' . Line::_(__Line__, __Class__)
. ' default paths of ' . $file
. ' form points to ' . $this->componentCodeName
. ' -->';
@ -918,13 +908,13 @@ class Structure extends Get
if ($add_component_path)
{
$xml .= PHP_EOL . '<form';
$xml .= PHP_EOL . $this->_t(1)
$xml .= PHP_EOL . Indent::_(1)
. 'addrulepath="/administrator/components/com_'
. $this->componentCodeName
. CFactory::_('Config')->component_code_name
. '/models/rules"';
$xml .= PHP_EOL . $this->_t(1)
$xml .= PHP_EOL . Indent::_(1)
. 'addfieldpath="/administrator/components/com_'
. $this->componentCodeName
. CFactory::_('Config')->component_code_name
. '/models/fields"';
$xml .= PHP_EOL . '>';
}
@ -947,7 +937,7 @@ class Structure extends Get
$field_name_inner = $field_names[1];
}
}
$xml .= PHP_EOL . $this->_t(1)
$xml .= PHP_EOL . Indent::_(1)
. '<fields name="' . $field_name_outer
. '">';
foreach ($fieldsets as $fieldset => $field)
@ -1001,30 +991,30 @@ class Structure extends Get
|| isset($module->add_field_path[$file . $field_name . $fieldset]))
{
$xml .= PHP_EOL . $this->_t(1) . '<!--'
. $this->setLine(__LINE__) . ' default paths of '
$xml .= PHP_EOL . Indent::_(1) . '<!--'
. Line::_(__Line__, __Class__) . ' default paths of '
. $fieldset . ' fieldset points to the module -->';
$xml .= PHP_EOL . $this->_t(1) . '<fieldset name="'
$xml .= PHP_EOL . Indent::_(1) . '<fieldset name="'
. $fieldset . '" label="' . $label . '"';
if (isset($module->add_rule_path[$file . $field_name . $fieldset]))
{
$xml .= PHP_EOL . $this->_t(2)
$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 . $this->_t(2)
$xml .= PHP_EOL . Indent::_(2)
. 'addfieldpath="' . $module->add_field_path[$file . $field_name . $fieldset] . '"';
}
$xml .= PHP_EOL . $this->_t(1) . '>';
$xml .= PHP_EOL . Indent::_(1) . '>';
}
else
{
$xml .= PHP_EOL . $this->_t(1) . '<fieldset name="'
$xml .= PHP_EOL . Indent::_(1) . '<fieldset name="'
. $fieldset . '" label="' . $label . '">';
}
// check if we have an inner field set
@ -1032,25 +1022,25 @@ class Structure extends Get
$field_name_inner
))
{
$xml .= PHP_EOL . $this->_t(1)
$xml .= PHP_EOL . Indent::_(1)
. '<fields name="'
. $field_name_inner . '">';
}
// add the placeholder of the fields
$xml .= $this->hhh . 'FIELDSET_' . $file
. $field_name . $fieldset . $this->hhh;
$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 . $this->_t(1)
$xml .= PHP_EOL . Indent::_(1)
. '</fields>';
}
$xml .= PHP_EOL . $this->_t(1)
$xml .= PHP_EOL . Indent::_(1)
. '</fieldset>';
}
$xml .= PHP_EOL . $this->_t(1) . '</fields>';
$xml .= PHP_EOL . Indent::_(1) . '</fields>';
}
$xml .= PHP_EOL . '</form>';
// add xml to file
@ -1095,7 +1085,7 @@ class Structure extends Get
$this->createFolder($module->folder_path . '/language');
// also create the lang tag folder
$this->createFolder(
$module->folder_path . '/language/' . $this->langTag
$module->folder_path . '/language/' . CFactory::_('Config')->get('lang_tag', 'en-GB')
);
// check if this lib has files
if (isset($module->files)
@ -1186,7 +1176,7 @@ class Structure extends Get
if (ArrayHelper::check($this->joomlaPlugins))
{
// Trigger Event: jcb_ce_onBeforeSetPlugins
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBuildPlugins',
array(&$this->componentContext, &$this->joomlaPlugins)
);
@ -1199,7 +1189,7 @@ class Structure extends Get
))
{
// plugin path
$plugin->folder_path = $this->compilerPath . '/'
$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;
@ -1215,11 +1205,11 @@ class Structure extends Get
$this->writeFile(
$fileDetails['path'],
'<?php' . PHP_EOL . '// Plugin main class template' .
PHP_EOL . $this->hhh . 'BOM' . $this->hhh . PHP_EOL .
PHP_EOL . Placefix::_h('BOM') . PHP_EOL .
PHP_EOL . '// No direct access to this file' . PHP_EOL .
"defined('_JEXEC') or die('Restricted access');"
. PHP_EOL .
$this->hhh . 'MAINCLASS' . $this->hhh
Placefix::_h('MAINCLASS')
);
$this->newFiles[$plugin->key][] = $fileDetails;
// count the file created
@ -1246,13 +1236,13 @@ class Structure extends Get
$this->writeFile(
$fileDetails['path'],
'<?php' . PHP_EOL . '// Script template' .
PHP_EOL . $this->hhh . 'BOM' . $this->hhh . PHP_EOL
PHP_EOL . Placefix::_h('BOM') . PHP_EOL
.
PHP_EOL . '// No direct access to this file'
. PHP_EOL .
"defined('_JEXEC') or die('Restricted access');"
. PHP_EOL .
$this->hhh . 'INSTALLCLASS' . $this->hhh
Placefix::_h('INSTALLCLASS')
);
$this->newFiles[$plugin->key][] = $fileDetails;
// count the file created
@ -1298,9 +1288,9 @@ class Structure extends Get
. '.xml');
// biuld basic XML
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<!--' . $this->setLine(__LINE__)
$xml .= PHP_EOL . '<!--' . Line::_(__Line__, __Class__)
. ' default paths of ' . $file
. ' form points to ' . $this->componentCodeName
. ' form points to ' . CFactory::_('Config')->component_code_name
. ' -->';
// search if we must add the component path
$add_component_path = false;
@ -1327,13 +1317,13 @@ class Structure extends Get
if ($add_component_path)
{
$xml .= PHP_EOL . '<form';
$xml .= PHP_EOL . $this->_t(1)
$xml .= PHP_EOL . Indent::_(1)
. 'addrulepath="/administrator/components/com_'
. $this->componentCodeName
. CFactory::_('Config')->component_code_name
. '/models/rules"';
$xml .= PHP_EOL . $this->_t(1)
$xml .= PHP_EOL . Indent::_(1)
. 'addfieldpath="/administrator/components/com_'
. $this->componentCodeName
. CFactory::_('Config')->component_code_name
. '/models/fields"';
$xml .= PHP_EOL . '>';
}
@ -1356,7 +1346,7 @@ class Structure extends Get
$field_name_inner = $field_names[1];
}
}
$xml .= PHP_EOL . $this->_t(1)
$xml .= PHP_EOL . Indent::_(1)
. '<fields name="' . $field_name_outer
. '">';
foreach ($fieldsets as $fieldset => $field)
@ -1392,30 +1382,30 @@ class Structure extends Get
if (isset($plugin->add_rule_path[$file . $field_name . $fieldset])
|| isset($plugin->add_field_path[$file . $field_name . $fieldset]))
{
$xml .= PHP_EOL . $this->_t(1) . '<!--'
. $this->setLine(__LINE__) . ' default paths of '
$xml .= PHP_EOL . Indent::_(1) . '<!--'
. Line::_(__Line__, __Class__) . ' default paths of '
. $fieldset . ' fieldset points to the plugin -->';
$xml .= PHP_EOL . $this->_t(1) . '<fieldset name="'
$xml .= PHP_EOL . Indent::_(1) . '<fieldset name="'
. $fieldset . '" label="' . $label . '"';
if (isset($plugin->add_rule_path[$file . $field_name . $fieldset]))
{
$xml .= PHP_EOL . $this->_t(2)
$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 . $this->_t(2)
$xml .= PHP_EOL . Indent::_(2)
. 'addfieldpath="' . $plugin->add_field_path[$file . $field_name . $fieldset] . '"';
}
$xml .= PHP_EOL . $this->_t(1) . '>';
$xml .= PHP_EOL . Indent::_(1) . '>';
}
else
{
$xml .= PHP_EOL . $this->_t(1) . '<fieldset name="'
$xml .= PHP_EOL . Indent::_(1) . '<fieldset name="'
. $fieldset . '" label="' . $label . '">';
}
// check if we have an inner field set
@ -1423,25 +1413,25 @@ class Structure extends Get
$field_name_inner
))
{
$xml .= PHP_EOL . $this->_t(1)
$xml .= PHP_EOL . Indent::_(1)
. '<fields name="'
. $field_name_inner . '">';
}
// add the placeholder of the fields
$xml .= $this->hhh . 'FIELDSET_' . $file
. $field_name . $fieldset . $this->hhh;
$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 . $this->_t(1)
$xml .= PHP_EOL . Indent::_(1)
. '</fields>';
}
$xml .= PHP_EOL . $this->_t(1)
$xml .= PHP_EOL . Indent::_(1)
. '</fieldset>';
}
$xml .= PHP_EOL . $this->_t(1) . '</fields>';
$xml .= PHP_EOL . Indent::_(1) . '</fields>';
}
$xml .= PHP_EOL . '</form>';
// add xml to file
@ -1486,7 +1476,7 @@ class Structure extends Get
$this->createFolder($plugin->folder_path . '/language');
// also creat the lang tag folder path
$this->createFolder(
$plugin->folder_path . '/language/' . $this->langTag
$plugin->folder_path . '/language/' . CFactory::_('Config')->get('lang_tag', 'en-GB')
);
// check if this lib has files
if (isset($plugin->files)
@ -1602,7 +1592,7 @@ class Structure extends Get
if (ArrayHelper::check($this->libraries))
{
// Trigger Event: jcb_ce_onBeforeSetLibraries
$this->triggerEvent(
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeSetLibraries',
array(&$this->componentContext, &$this->libraries)
);
@ -1711,9 +1701,8 @@ class Structure extends Get
if ($addLocalFolder)
{
// add folder to xml of media folders
$this->fileContentStatic[$this->hhh
. 'EXSTRA_MEDIA_FOLDERS' . $this->hhh]
.= PHP_EOL . $this->_t(2) . "<folder>"
$this->fileContentStatic[Placefix::_h('EXSTRA_MEDIA_FOLDERS')]
.= PHP_EOL . Indent::_(2) . "<folder>"
. $libFolder . "</folder>";
}
}
@ -2071,7 +2060,7 @@ class Structure extends Get
$this->joomlaVersionData->move->static
))
{
$codeName = $this->componentCodeName;
$codeName = CFactory::_('Config')->component_code_name;
// TODO needs more looking at this must be dynamic actually
$this->notNew[] = 'LICENSE.txt';
// do license check
@ -2288,16 +2277,16 @@ class Structure extends Get
if ($add_to_extra)
{
// set the tab
$eTab = $this->_t(2);
$eTab = Indent::_(2);
if ('admin' === $checker[0])
{
$eTab = $this->_t(3);
$eTab = Indent::_(3);
}
// set the xml file
$this->fileContentStatic[$this->hhh . 'EXSTRA_'
$this->fileContentStatic[Placefix::_h('EXSTRA_'
. StringHelper::safe(
$checker[0], 'U'
) . '_' . $eNAME . $this->hhh]
) . '_' . $eNAME)]
.= PHP_EOL . $eTab . "<" . $ename . ">"
. $checker[1] . "</" . $ename . ">";
}
@ -2347,24 +2336,18 @@ class Structure extends Get
{
$target
= array('admin' => $view['settings']->name_list);
$config = array($this->hhh . 'CREATIONDATE'
. $this->hhh => $created,
$this->hhh . 'BUILDDATE'
. $this->hhh => $modified,
$this->hhh . 'VERSION'
. $this->hhh => $view['settings']->version);
$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($this->hhh . 'CREATIONDATE'
. $this->hhh => $created,
$this->hhh . 'BUILDDATE'
. $this->hhh => $modified,
$this->hhh . 'VERSION'
. $this->hhh => $view['settings']->version);
$config = array(Placefix::_h('CREATIONDATE') => $created,
Placefix::_h('BUILDDATE') => $modified,
Placefix::_h('VERSION') => $view['settings']->version);
$this->buildDynamique(
$target, 'single', false, $config
);
@ -2378,12 +2361,9 @@ class Structure extends Get
// setup the front site edit-view files
$target
= array('site' => $view['settings']->name_single);
$config = array($this->hhh . 'CREATIONDATE'
. $this->hhh => $created,
$this->hhh . 'BUILDDATE'
. $this->hhh => $modified,
$this->hhh . 'VERSION'
. $this->hhh => $view['settings']->version);
$config = array(Placefix::_h('CREATIONDATE') => $created,
Placefix::_h('BUILDDATE') => $modified,
Placefix::_h('VERSION') => $view['settings']->version);
$this->buildDynamique($target, 'edit', false, $config);
}
}
@ -2415,24 +2395,18 @@ class Structure extends Get
{
// set list view
$target = array('site' => $view['settings']->code);
$config = array($this->hhh . 'CREATIONDATE'
. $this->hhh => $created,
$this->hhh . 'BUILDDATE'
. $this->hhh => $modified,
$this->hhh . 'VERSION'
. $this->hhh => $view['settings']->version);
$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($this->hhh . 'CREATIONDATE'
. $this->hhh => $created,
$this->hhh . 'BUILDDATE'
. $this->hhh => $modified,
$this->hhh . 'VERSION'
. $this->hhh => $view['settings']->version);
$config = array(Placefix::_h('CREATIONDATE') => $created,
Placefix::_h('BUILDDATE') => $modified,
Placefix::_h('VERSION') => $view['settings']->version);
$this->buildDynamique($target, 'single', false, $config);
}
}
@ -2455,24 +2429,18 @@ class Structure extends Get
{
// set list view$view
$target = array('custom_admin' => $view['settings']->code);
$config = array($this->hhh . 'CREATIONDATE'
. $this->hhh => $created,
$this->hhh . 'BUILDDATE'
. $this->hhh => $modified,
$this->hhh . 'VERSION'
. $this->hhh => $view['settings']->version);
$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($this->hhh . 'CREATIONDATE'
. $this->hhh => $created,
$this->hhh . 'BUILDDATE'
. $this->hhh => $modified,
$this->hhh . 'VERSION'
. $this->hhh => $view['settings']->version);
$config = array(Placefix::_h('CREATIONDATE') => $created,
Placefix::_h('BUILDDATE') => $modified,
Placefix::_h('VERSION') => $view['settings']->version);
$this->buildDynamique($target, 'single', false, $config);
}
}
@ -2532,11 +2500,11 @@ class Structure extends Get
}
}
// check if this has validation that should be moved
if (isset($this->validationLinkedFields[$field['field']]))
if (CFactory::_('Registry')->get('validation.linked.' . $field['field']) !== null)
{
$check = md5(
$path . 'rule'
. $this->validationLinkedFields[$field['field']]
. CFactory::_('Registry')->get('validation.linked.' . $field['field'])
);
// lets check if we already moved this
if (!isset($this->extentionTrackingFilesMoved[$check]))
@ -2544,16 +2512,16 @@ class Structure extends Get
// check files exist
if (File::exists(
$this->componentPath . '/admin/models/rules/'
. $this->validationLinkedFields[$field['field']]
. CFactory::_('Registry')->get('validation.linked.' . $field['field'])
. '.php'
))
{
// copy the custom field
File::copy(
$this->componentPath . '/admin/models/rules/'
. $this->validationLinkedFields[$field['field']]
. CFactory::_('Registry')->get('validation.linked.' . $field['field'])
. '.php', $path . '/rules/'
. $this->validationLinkedFields[$field['field']]
. CFactory::_('Registry')->get('validation.linked.' . $field['field'])
. '.php'
);
}
@ -2592,7 +2560,7 @@ class Structure extends Get
// setup the field
$field = array();
$field['field'] = $id;
$this->setFieldDetails($field);
CFactory::_('Field')->set($field);
// move field and rules if needed
$this->moveFieldsRules($field, $path);
}
@ -2879,7 +2847,7 @@ class Structure extends Get
private function setJoomlaVersionData()
{
// option to load other settings
$custom_settings = $this->templatePath . '/settings_' . $this->componentCodeName . '.json';
$custom_settings = $this->templatePath . '/settings_' . CFactory::_('Config')->component_code_name . '.json';
// set the version data
if (File::exists($custom_settings))
{
@ -3122,8 +3090,8 @@ class Structure extends Get
'//', '/', $custom['file']
);
// update the dynamic component name placholders in file names
$custom['path'] = $this->setPlaceholders(
$custom['path'], $this->placeholders
$custom['path'] = CFactory::_('Placeholder')->update(
$custom['path'], CFactory::_('Placeholder')->active
);
// get the path info
$pathInfo = pathinfo($custom['path']);
@ -3262,10 +3230,10 @@ class Structure extends Get
*/
protected function updateDynamicPath($path)
{
return $this->setPlaceholders(
$this->setPlaceholders(
return CFactory::_('Placeholder')->update(
CFactory::_('Placeholder')->update(
$path, ComponentbuilderHelper::$constantPaths
), $this->placeholders
), CFactory::_('Placeholder')->active
);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -56,6 +56,7 @@ spl_autoload_register(function ($class) {
}
});
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Language\Language;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
@ -63,9 +64,8 @@ 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;
@ -3550,6 +3550,9 @@ abstract class ComponentbuilderHelper
),
'special' => array(
'contentlanguage', 'moduleposition', 'plugin', 'repeatable', 'subform'
),
'search' => array(
'editor', 'email', 'tel', 'text', 'textarea', 'url', 'subform'
)
);
@ -3678,30 +3681,34 @@ abstract class ComponentbuilderHelper
}
/**
* 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;
}
/**
@ -6314,6 +6321,11 @@ abstract class ComponentbuilderHelper
{
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_COMPILER'), 'index.php?option=com_componentbuilder&view=compiler', $submenu === 'compiler');
}
// Access control (search.submenu).
if ($user->authorise('search.submenu', 'com_componentbuilder'))
{
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_SEARCH'), 'index.php?option=com_componentbuilder&view=search', $submenu === 'search');
}
if ($user->authorise('joomla_component.access', 'com_componentbuilder') && $user->authorise('joomla_component.submenu', 'com_componentbuilder'))
{
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_COMPONENTS'), 'index.php?option=com_componentbuilder&view=joomla_components', $submenu === 'joomla_components');

View File

@ -191,7 +191,7 @@ class Builder extends Mapping
*/
protected function setField(&$view, &$field)
{
if ($fieldType = $this->getFieldType($field['fieldType']))
if ($fieldType = CFactory::_('Field.Type.Name')->get($field['fieldType']))
{
// set the field object
$object = new stdClass();

View File

@ -1292,6 +1292,7 @@ COM_COMPONENTBUILDER_AJAX="Ajax"
COM_COMPONENTBUILDER_ALIAS="Alias"
COM_COMPONENTBUILDER_ALIGNMENT="Alignment"
COM_COMPONENTBUILDER_ALL="All"
COM_COMPONENTBUILDER_ALL_FOUND_INSTANCES_IN_S_WHERE_REPLACED="All found instances in %s where replaced"
COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER="All is good, please check again latter."
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.<br />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 know</a>."
@ -1301,6 +1302,7 @@ 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. <small>(Make <b>SURE</b> to move this zipped backup package out of the tmp folder before doing an import)</small><br />If you are importing a package of a 3rd party JCB package developer, <b>make sure it is a reputable JCB package developers!</b> <a %s>Find out why!</a>"
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,6 +1313,7 @@ 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"
@ -1330,6 +1333,7 @@ COM_COMPONENTBUILDER_BASIC_TUTORIAL_ON_GIT_BSB="Basic Tutorial on git: <b>%s</b>
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="<b>Best to not continue!</b><br />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="<b>Best to not continue!</b><br />You can Refresh and try again.<br />But note that this package <b>FAILED</b> checksum validation, this could be a serious security breach! DO NOT CONTINUE!!!"
COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVED_TO_CORRECT_LOCATION="<b>Custom files</b> not moved to correct location!"
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 <b>local snippet</b> (with the same name, library and type) has a <b>older modified date</b> then the community snippet (with the same name, library and type)."
COM_COMPONENTBUILDER_BETA_RELEASE="Beta Release"
@ -1720,6 +1724,7 @@ 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 <br /><small>(disabled... soon!)</small>"
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"
@ -3230,6 +3235,8 @@ COM_COMPONENTBUILDER_CONDITIONS="Conditions"
COM_COMPONENTBUILDER_CONFIG_ACTIVE="Active"
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."
COM_COMPONENTBUILDER_CONFIG_ADD_PLACEHOLDERS_LABEL="Add Custom Code Placeholders"
COM_COMPONENTBUILDER_CONFIG_ADMIN_CUSTOM_TABS_TABS="Admin Custom Tabs (tabs)"
COM_COMPONENTBUILDER_CONFIG_ADMIN_FIELDS_ADDFIELDS="Admin Fields (addfields)"
COM_COMPONENTBUILDER_CONFIG_ADMIN_FIELDS_CONDITIONS_ADDCONDITIONS="Admin Fields Conditions (addconditions)"
@ -3341,12 +3348,12 @@ COM_COMPONENTBUILDER_CONFIG_COMPILER_FOLDER_PATH_LABEL="Compiler Folder Path"
COM_COMPONENTBUILDER_CONFIG_COMPILER_FOLDER_PATH_MESSAGE="Error! Please add some text here."
COM_COMPONENTBUILDER_CONFIG_COMPILER_PLUGIN_DESCRIPTION="Select the plugin you would like to use in JCB's compiler"
COM_COMPONENTBUILDER_CONFIG_COMPILER_PLUGIN_LABEL="Activate Compiler Plugins"
COM_COMPONENTBUILDER_CONFIG_COMPONENT="Component"
COM_COMPONENTBUILDER_CONFIG_COMPONENT_ADMIN_VIEWS_ADDADMIN_VIEWS="Component Admin Views (addadmin_views)"
COM_COMPONENTBUILDER_CONFIG_COMPONENT_CUSTOM_ADMIN_MENUS_ADDCUSTOMMENUS="Component Custom Admin Menus (addcustommenus)"
COM_COMPONENTBUILDER_CONFIG_COMPONENT_CUSTOM_ADMIN_VIEWS_ADDCUSTOM_ADMIN_VIEWS="Component Custom Admin Views (addcustom_admin_views)"
COM_COMPONENTBUILDER_CONFIG_COMPONENT_DASHBOARD_DASHBOARD_TAB="Component Dashboard (dashboard_tab)"
COM_COMPONENTBUILDER_CONFIG_COMPONENT_LABEL="Component"
COM_COMPONENTBUILDER_CONFIG_COMPONENT_ID="Component Id"
COM_COMPONENTBUILDER_CONFIG_COMPONENT_ID_LABEL="Component"
COM_COMPONENTBUILDER_CONFIG_COMPONENT_SITE_VIEWS_ADDSITE_VIEWS="Component Site Views (addsite_views)"
COM_COMPONENTBUILDER_CONFIG_COMPONENT_UPDATES_VERSION_UPDATE="Component Updates (version_update)"
COM_COMPONENTBUILDER_CONFIG_CRONJOB_BACKUP_FOLDER_PATH_DESCRIPTION="Here you can set the path to where all components are backed up to."
@ -3526,11 +3533,6 @@ 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.<br />Never change this key once it is set, or remove the key file! <b>DATA WILL GET CORRUPTED IF YOU DO!</b> 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 <b>secure connection</b> 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="&#187;"
COM_COMPONENTBUILDER_CONFIG_MENU_PREFIX_LABEL="Prefix<br />
@ -3604,8 +3606,6 @@ COM_COMPONENTBUILDER_CONFIG_PACKAGE_NAME_PLAEHOLDERS_LABEL="Package Name Placeho
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_PLACEHOLDERS_DESCRIPTION="Should JCB insert the custom code placeholders? This is only applicable if this component has custom code."
COM_COMPONENTBUILDER_CONFIG_PLACEHOLDERS_LABEL="Add Custom Code Placeholders"
COM_COMPONENTBUILDER_CONFIG_REMOTE_SERVER="Remote Server"
COM_COMPONENTBUILDER_CONFIG_REPEATABLETABLE_JOOMLA="Repeatable-table (joomla)"
COM_COMPONENTBUILDER_CONFIG_REPEATABLE_JOOMLA="Repeatable (Joomla)"
@ -4708,6 +4708,7 @@ 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"
@ -4721,6 +4722,8 @@ COM_COMPONENTBUILDER_EMLICENSEEM_BSB="<em>License:</em> <b>%s</b>"
COM_COMPONENTBUILDER_EMOWNEREM_BSB="<em>Owner:</em> <b>%s</b>"
COM_COMPONENTBUILDER_EMPTY_TRASH="Empty trash"
COM_COMPONENTBUILDER_EMWEBSITEEM_BSB="<em>Website:</em> <b>%s</b>"
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 <b>creation</b> and <b>modified date</b>."
COM_COMPONENTBUILDER_ERROR="Error"
@ -4793,6 +4796,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"
@ -5034,6 +5038,7 @@ $mediumkey = ComponentbuilderHelper::getCryptKey('medium');
$medium = new FOFEncryptAes($mediumkey);"
COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_LABEL="Initiator<br /><small>on save model</small>"
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."
@ -5448,6 +5453,8 @@ COM_COMPONENTBUILDER_FOLDER_BSB_WAS_MOVED_TO_BSB="Folder <b>%s</b> was moved to
COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVED_TO_BSB="Folder <b>%s</b> was not moved to <b>%s</b>"
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 <b>Merge</b> is set to yes above."
COM_COMPONENTBUILDER_FOUND="Found"
COM_COMPONENTBUILDER_FOUND_TEXT="Found Text"
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."
@ -5483,7 +5490,7 @@ COM_COMPONENTBUILDER_GET_SNIPPETS_TEMPLATES_BUTTON_ACCESS_DESC="Allows the users
COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_INSTALL_IT_LOCALLY="Get the snippet from gitHub and install it locally"
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_FOR_UPDATES_AND_ADD_IT_TO_YOUR_GLOBAL_OPTIONS="Get token from VDM for updates, and add it to your global options"
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_GLOBAL="Global"
COM_COMPONENTBUILDER_GLUECODE="Glue/Code"
COM_COMPONENTBUILDER_GREAT_THIS_FUNCTION_NAME_WILL_WORK="Great, this function name will work!"
@ -5491,6 +5498,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"
@ -5591,14 +5599,22 @@ 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_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_HFOUR_CLASSNAVHEADERCOPYRIGHTHFOURPSP="<h4 class="nav-header">Copyright</h4><p>%s</p>"
COM_COMPONENTBUILDER_HFOUR_CLASSNAVHEADERLICENSEHFOURPSP="<h4 class="nav-header">License</h4><p>%s</p>"
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 <a %s >free keys</a> from VDM."
COM_COMPONENTBUILDER_HR_HTHREECUSTOM_CODES_WARNINGHTHREE="<hr /><h3>Custom Codes Warning</h3>"
COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_ERRORHTHREE="<hr /><h3>External Code Error</h3>"
COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_NOTICEHTHREE="<hr /><h3>External Code Notice</h3>"
COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_WARNINGHTHREE="<hr /><h3>External Code Warning</h3>"
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="<h3>Placeholder Removed!</h3><p><b>This</b> custom code can only be used in <b>other</b> custom code, not in it self! Since that will cause a infinite loop in the compiler.</p>"
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="<h3>%s</h3><p>Custom code can only be used in other custom code if set as <b>JCB (manual)</b>, you can not add them to <em>Hash (Automation)</em> code at this point.</p>"
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="<h3>%s namespace error (%s)</h3><p>You must at-least have two sections in your namespace, you just have one (%s). This is an unacceptable action, please see <a href=%s >psr-4</a> for more info.</p><p>This %s was therefore removed, <a href=%s>click here</a> to fix this issue.</p>"
COM_COMPONENTBUILDER_HTHREES_NAMESPACE_ERROR_SHTHREEPYOU_MUST_ATLEAST_HAVE_TWO_SECTIONS_IN_YOUR_NAMESPACE_YOU_JUST_HAVE_ONE_THIS_IS_AN_UNACCEPTABLE_ACTION_PLEASE_SEE_A_HREFS_PSRFOURA_FOR_MORE_INFOPPTHIS_S_WAS_THEREFORE_REMOVED_A_HREFSCLICK_HEREA_TO_FIX_THIS_ISSUEP="<h3>%s namespace error (%s)</h3><p>You must at-least have two sections in your namespace, you just have one. This is an unacceptable action, please see <a href=%s >psr-4</a> for more info.</p><p>This %s was therefore removed, <a href=%s>click here</a> to fix this issue.</p>"
COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP="<h2>Curl Not Found!</h2><p>Please setup curl on your system, or <b>componentbuilder</b> will not function correctly!</p>"
COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BKEY_ERRORB_OR_BROKEN_PACKAGE="<h2>Data is corrupt!</h2>This could be due to <b>key error</b>, or broken package!"
COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BROKEN_PACKAGE="<h2>Data is corrupt!</h2>This could be due to broken package!"
@ -5607,6 +5623,8 @@ COM_COMPONENTBUILDER_HTWOWE_COULD_NOT_OPEN_THE_PACKAGEHTWOTHIS_COULD_BE_DUE_TO_T
COM_COMPONENTBUILDER_IAUTHORI_BSB="<i>Author:</i> <b>%s</b>"
COM_COMPONENTBUILDER_ICOMPANYI_BSB="<i>Company:</i> <b>%s</b>"
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="<i>Email:</i> <b>%s</b>"
COM_COMPONENTBUILDER_IMPORT_BY_GUID_ONLY="Import by GUID only!"
COM_COMPONENTBUILDER_IMPORT_CONTINUE="Continue"
@ -5672,6 +5690,7 @@ 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="<i>Website:</i> <b>%s</b>"
COM_COMPONENTBUILDER_JCB_COMMUNITY="JCB Community"
COM_COMPONENTBUILDER_JCB_COMMUNITY_PACKAGES="JCB Community Packages"
@ -7735,6 +7754,8 @@ 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"
@ -7746,6 +7767,7 @@ COM_COMPONENTBUILDER_LOCAL_GET="Local (get)"
COM_COMPONENTBUILDER_LOCAL_SNIPPET="Local snippet"
COM_COMPONENTBUILDER_MAIN_MENU="Main Menu"
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)"
@ -7753,6 +7775,7 @@ 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"
@ -7787,6 +7810,7 @@ COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_SINCE_INCORRECT_TYPE_REQUESTED="No cr
COM_COMPONENTBUILDER_NO_DESCRIPTION_FOUND="No description found."
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"
@ -7810,7 +7834,7 @@ COM_COMPONENTBUILDER_OPTIONS="Options"
COM_COMPONENTBUILDER_ORDER_BEFORE="Order Before"
COM_COMPONENTBUILDER_ORDER_IN_EDIT="Order in Edit"
COM_COMPONENTBUILDER_ORDER_IN_LIST_VIEWS="Order in list views"
COM_COMPONENTBUILDER_OUT_OF_DATE="Out of Date"
COM_COMPONENTBUILDER_OUT_OF_DATE="Out of date"
COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET="Owner details was set"
COM_COMPONENTBUILDER_OWNER_S="Owner: %s"
COM_COMPONENTBUILDER_PACKAGE="Package"
@ -7995,6 +8019,8 @@ COM_COMPONENTBUILDER_POWERS_SUBMENU_DESC="Allows the users in this group to subm
COM_COMPONENTBUILDER_POWER_ABSTRACT_CLASS="abstract class"
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_AS_LABEL="as"
COM_COMPONENTBUILDER_POWER_CLASS="class"
COM_COMPONENTBUILDER_POWER_CODE="Code"
@ -8025,6 +8051,17 @@ COM_COMPONENTBUILDER_POWER_IMPLEMENTS_CUSTOM_MESSAGE="Error! Please add the cust
COM_COMPONENTBUILDER_POWER_IMPLEMENTS_DESCRIPTION="The interface(s), this class should implement."
COM_COMPONENTBUILDER_POWER_IMPLEMENTS_LABEL="Implements interface(s)"
COM_COMPONENTBUILDER_POWER_INTERFACE="interface"
COM_COMPONENTBUILDER_POWER_LICENSING="Licensing"
COM_COMPONENTBUILDER_POWER_LICENSING_TEMPLATE_HINT="/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/"
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="<p>When you would like to load a power to the project, but you do not want that power to be part of the <b>use namespace declarations</b> in the header of this power.</p>
@ -8080,6 +8117,7 @@ COM_COMPONENTBUILDER_POWER_NOTE_LINKED_TO_NOTICE_DESCRIPTION="<div id='display_l
COM_COMPONENTBUILDER_POWER_NOTE_LINKED_TO_NOTICE_LABEL="Linked To"
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"
@ -8102,26 +8140,34 @@ 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_GLOBAL="Use Global"
COM_COMPONENTBUILDER_POWER_USE_LABEL="use"
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="<p>Power <b>guid:%s</b> not found!</p>"
COM_COMPONENTBUILDER_PROPERTIES="Properties"
COM_COMPONENTBUILDER_PROPERTIESBR_SMALLHERE_YOU_CAN_SET_THE_PROPERTIES_FOR_THIS_FIELDSMALL="Properties<br /><small>Here you can set the properties for this field.</small>"
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_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="<p>%s naming mismatch error (%s)</p><p>The %s name is <b>%s</b> and the ending file name in the namespace is <b>%s</b>. This is bad convention, please see <a href=%s >psr-4</a> for more info.</p><p><a href=%s>Click here</a> to fix this issue.</p>"
COM_COMPONENTBUILDER_PUBLIC_ACCESS="Public Access"
COM_COMPONENTBUILDER_PUBLISHED="Published"
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: <b>%s</b>"
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=&quot;list&quot;: 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."
@ -8130,10 +8176,25 @@ 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<br />You can add a <b>gitHub Access Token</b> 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_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"
@ -8145,8 +8206,10 @@ COM_COMPONENTBUILDER_SELECT_A_SNIPPET="select a snippet"
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"
@ -8287,6 +8350,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."
@ -8952,6 +9016,7 @@ 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"
@ -8966,7 +9031,12 @@ COM_COMPONENTBUILDER_S_BEING_IMPORTED="%s Being Imported"
COM_COMPONENTBUILDER_S_NOT_LINKED="%s Not Linked"
COM_COMPONENTBUILDER_S_PLEASE_WAIT="%s, please wait!"
COM_COMPONENTBUILDER_S_S_NUMBER_BSB_COULD_NOT_BE_DOWNLOADED_SUCCESSFULLY_TO_THIS_JOOMLA_INSTALL="%s (%s) number <b>%s</b> could not be downloaded successfully to this Joomla Install!"
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 <b>EXTERNALCODE</b>, but you do not have permission to allow this change so <b>%s</b> was removed from the compilation. Please contact your system administrator for more info!<br /><small>(admin access required)</small>"
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 <b>NEW EXTERNALCODE</b>, but you do not have permission to allow this new code/string so <b>%s</b> was removed from the compilation. Please contact you system administrator for more info!<br /><small>(admin access required)</small>"
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 <b>%s</b> 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 <b>%s</b> not found in the local database so its values could not be imported. The whole powers feature is only available to <a href=%s>PRO Members</a> at this time."
COM_COMPONENTBUILDER_TARGET_BEHAVIOUR="Target Behaviour"
@ -9093,6 +9163,7 @@ 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, <b>no view or id found in session or view not allowed to access area</b>, 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 <a %s >gitHub</a> and can be imported by simply making a selection and then clicking the <b>[Get Package]</b> button.<br />Some of these packages would require a key, since they are not free."
@ -9109,12 +9180,18 @@ 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 <b>Only in Admin List View</b> 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 <b>Only in Linked List Views</b> 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 <b>phpseclib\NET\SFTP</b> library\class is not available! This library\class should have been added to your <b>libraries/vdm_io/vendor</b> folder. Please contact your system administrator for more info"
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 <b>%s</b> 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 <b>%s</b> file could not be moved to <b>%s</b> path on <b>%s</b> server."
COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER="The <b>%s</b> file could not be moved to <b>%s</b> server."
COM_COMPONENTBUILDER_THE_BSB_IS_NOT_A_VALID_URLPATH="The <b>%s</b> is not a valid url/path!"
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 <b>%s</b> library\class is not available! This library\class should have been added to your <b>libraries/phpseclib/vendor</b> folder. Please contact your system administrator for more info!"
COM_COMPONENTBUILDER_THE_BSB_LIBRARY_CAN_NOT_BE_DELETED_OR_THINGS_WILL_BREAK="The <b>%s</b> library can not be deleted, or things will break."
COM_COMPONENTBUILDER_THE_BSB_RETURNED_AN_INVALID_STRING="The <b>%s</b> returned an invalid string!"
COM_COMPONENTBUILDER_THE_BSHOW_IN_ALL_LIST_VIEWSB_OPTION_WILL_ADD_THIS_FIELD_TO_ALL_LIST_VIEWS_ADMIN_AMP_LINKED="The <b>Show in All List Views</b> option will Add this field to all list views, admin &amp; linked."
COM_COMPONENTBUILDER_THE_BSINGLE_FILTERB_SELECTION_OPTION_ALLOWS_THE_USER_TO_SELECT_JUST_ONE_VALUE_IN_THIS_FILTERFIELD="The <b>single filter</b> selection option allows the user to select just one value in this filter/field."
COM_COMPONENTBUILDER_THE_CHANGES_YOU_MAKE_HERE_CAN_NOT_BE_UNDONE_THEREFORE_YOU_MUST_ALWAYS_USE_THE_UPDATE_AND_REPLACE_FEATURES_WITH_GREAT_CAUTION_SEARCH_FEATURE_IS_IN_BETA_STAGE="The changes you make here can not be undone, therefore you must always use the update and replace features with great caution. Search feature is in BETA stage."
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 <b>%s</b> has been added for the <b>first time</b>. Please <i>investigate</i> to ensure the correct code/string was used! <b>Should you not know about this NEW external code/string being added, then this is a serious danger! and requires immediate attention!</b> Do not ignore this warning as it will only show <b>once</b>."
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 <b>%s</b> has been <b>changed</b> since the last compilation. Please investigate to ensure the changes are safe! <b>Should you not expect this change to the external code/string being added, then this is a serious issue! and requires immediate attention!</b> Do not ignore this warning as it will only show <b>once</b>."
COM_COMPONENTBUILDER_THE_COMPONENT="The Component"
COM_COMPONENTBUILDER_THE_COMPONENT_ADMIN_VIEWS="The component admin views"
COM_COMPONENTBUILDER_THE_COMPONENT_CONFIG="The component config"
@ -9147,7 +9224,9 @@ COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FIELD_COULD_NOT_BE_LOADED_FOR_BSB_SERVER="T
COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FILE_COULD_NOT_BE_LOADEDFOUND_FOR_BSB_SERVER="The private key file could not be loaded/found for <b>%s</b> 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_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 <b>names</b> of either or the <b>snippet, library or snippet types</b> 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 <b>keep to the community naming</b> 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 <b>(ID: %s)</b> 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!"
@ -9158,6 +9237,8 @@ COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_RETURN_ANY_
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_IS_LOADING="The wiki is loading"
COM_COMPONENTBUILDER_THIS_BSB_IS_NOT_LINKED_TO_ANY_OTHER_AREAS_OF_JCB_AT_THIS_TIME="This <b>%s</b> 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, <b>you have been warned</b>!"
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 <b>PASSED</b> the checksum validation!<br /><br /><small>Manually also validate that the correct checksum was used.</small><br />This checksum: <b>%s</b> must be the same as the one found @ <a %s %s</a>"
COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY="This package has no key."
@ -9233,7 +9314,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"
@ -9345,9 +9428,18 @@ 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_FAILED_TO_MOVE_BSB="We failed to move <b>%s</b>!"
COM_COMPONENTBUILDER_WE_FOUND_DYNAMIC_CODE_BALL_IN_ONE_LINEB_AND_IGNORED_IT_PLEASE_REVIEW_S_FOR_MORE_DETAILS="We found dynamic code <b>all in one line</b>, 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 <b>%s</b>!"
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_WOULD_YOU_LIKE_TO_DO_A_REVERSE_SEARCH="Would you like to do a reverse search?"
COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_REPEAT_THE_SAME_SEARCH="Would you like to repeat the same search?"
COM_COMPONENTBUILDER_YES="Yes"
COM_COMPONENTBUILDER_YES_UPDATE_ALL="Yes! Update ALL"
COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_REPLACE_BALLB_SEARCH_RESULTS="Your are about to replace <b>ALL</b> search results."
COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_UPDATE_ROW="Your are about to update row"
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 <a href="http://random-ize.com/how-long-to-hack-pass/" target="_blank" title="How long to hack pass">700 000 000 000 000 000 000 000 000 000 000</a> years to crack theoretically. Unless they have this key above, so do keep it safe."
COM_COMPONENTBUILDER_YOU_ARE_CURRENTLY_VIEWING_THE_TRASHED_ITEMS="You are currently viewing the trashed items."
@ -9379,6 +9471,7 @@ COM_COMPONENTBUILDER_YOU_WILL_NEED_TO_KNOW_HOW_S_WORKS_BASIC_YOU_WILL_ALSO_NEED_
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!"

View File

@ -963,6 +963,7 @@ 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"
@ -1017,6 +1018,12 @@ COM_COMPONENTBUILDER_POWERS_SUBMENU="Powers Submenu"
COM_COMPONENTBUILDER_POWERS_SUBMENU_DESC="Allows the users in this group to submenu of power"
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_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"

View File

@ -29,10 +29,10 @@ $fields = $displayData->get($fields_tab_layout) ?: array(
'name',
'description',
'extends',
'implements_custom',
'implements',
'namespace',
'extends_custom',
'implements',
'implements_custom',
'namespace',
'add_head'
);

View File

@ -0,0 +1,45 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'add_licensing_template',
'licensing_template'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<div class="form-vertical">
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
</div>
<?php endif; ?>

43
admin/layouts/rows.php Normal file
View File

@ -0,0 +1,43 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('JPATH_BASE') or die('Restricted access');
$headers = $displayData['headers'];
$items = $displayData['items'];
?>
<?php if (is_array($items)): ?>
<?php foreach ($items as $row => $values): ?>
<tr>
<?php foreach($values as $value): ?>
<td class=""><?php echo $value; ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
<?php elseif (is_numeric($items) && is_array($headers)): ?>
<?php for( $row = 0; $row < $items; $row++): ?>
<tr class="">
<?php foreach($headers as $header): ?>
<td class="">&nbsp;&nbsp;</td>
<?php endforeach; ?>
</tr>
<?php endfor; ?>
<?php elseif (is_numeric($items) && is_numeric($headers)): ?>
<?php for( $row = 0; $row < $items; $row++): ?>
<tr class="">
<?php for( $column = 0; $column < $headers; $column++): ?>
<td class="">&nbsp;&nbsp;</td>
<?php endfor; ?>
</tr>
<?php endfor; ?>
<?php endif; ?>

72
admin/layouts/table.php Normal file
View File

@ -0,0 +1,72 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('JPATH_BASE') or die('Restricted access');
$table_id = (isset($displayData['id'])) ? $displayData['id'] : ComponentbuilderHelper::randomkey(7);
$name = (isset($displayData['name'])) ? $displayData['name'] : false;
$headers = (isset($displayData['headers'])) ? $displayData['headers'] : [JText::_('COM_COMPONENTBUILDER_NO'), JText::_('COM_COMPONENTBUILDER_HEADERS'), JText::_('COM_COMPONENTBUILDER_FOUND')];
$items = (isset($displayData['items'])) ? $displayData['items'] : 6;
?>
<div class="uk-overflow-auto">
<table id="<?php echo $table_id; ?>" class="uk-table">
<thead>
<?php if (is_array($headers)): ?>
<?php if ($name): ?>
<tr>
<th colspan="<?php echo count($headers); ?>" style="text-align:center"><b><?php echo $name; ?></b></th>
</tr>
<?php endif; ?>
<tr>
<?php foreach($headers as $code_name => $header): ?>
<?php
if (is_numeric($code_name))
{
$code_name = ComponentbuilderHelper::safeString($header);
}
?>
<th data-name="<?php echo $code_name; ?>"><?php echo $header; ?></th>
<?php endforeach; ?>
</tr>
<?php elseif (is_numeric($headers)): ?>
<?php if ($name): ?>
<tr>
<th colspan="<?php echo (int) $headers; ?>" style="text-align:center"><b><?php echo $name; ?></b></th>
</tr>
<?php endif; ?>
<tr style="position: absolute; top: -9999px; left: -9999px;">
<?php for( $row = 0; $row < $headers; $row++): ?>
<th><?php echo ComponentbuilderHelper::safeString($row); ?></th>
<?php endfor; ?>
</tr>
<?php endif; ?>
</thead>
<tbody>
<?php echo JLayoutHelper::render('rows', ['headers' => $headers, 'items' => $items]); ?>
</tbody>
</table>
</div>
<?php
// Initialize the table if [init is not set], or [is true]
// To stop initialization set $displayData['init'] = false;
if (!isset($displayData['init']) || $displayData['init']) :
?>
<script type="text/javascript">
jQuery(document).ready(function() {
var <?php echo $table_id; ?> = jQuery('#<?php echo $table_id; ?>').DataTable({
paging: false,
select: true
});
});
</script>
<?php endif; ?>

View File

@ -16,6 +16,7 @@ use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Utilities\ArrayHelper;
use Joomla\Registry\Registry;
use VDM\Gitea\Gitea;
use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory;
/**
* Componentbuilder Ajax List Model
@ -305,15 +306,15 @@ class ComponentbuilderModelAjax extends ListModel
}
catch (DomainException $e)
{
return $this->getTokenFromVDM($e->getMessage());
return $this->getTokenForWiki($e->getMessage());
}
catch (InvalidArgumentException $e)
{
return $this->getTokenFromVDM($e->getMessage());
return $this->getTokenForWiki($e->getMessage());
}
catch (Exception $e)
{
return $this->getTokenFromVDM($e->getMessage());
return $this->getTokenForWiki($e->getMessage());
}
// get the html
@ -322,10 +323,10 @@ class ComponentbuilderModelAjax extends ListModel
return ['page' => $page];
}
return $this->getTokenFromVDM();
return $this->getTokenForWiki();
}
protected function getTokenFromVDM($message = null)
protected function getTokenForWiki($message = null)
{
if ($message)
{
@ -333,7 +334,94 @@ class ComponentbuilderModelAjax extends ListModel
}
return ['error' => JText::_('COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JCB_SYSTEM_HAS_INTERNET_CONNECTION')];
}
}
public function getVersion($version = null)
{
// get the token if set
$token = JComponentHelper::getParams('com_componentbuilder')->get('gitea_token', false);
// 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');
}
catch (DomainException $e)
{
return $this->getTokenForVersion($e->getMessage());
}
catch (InvalidArgumentException $e)
{
return $this->getTokenForVersion($e->getMessage());
}
catch (Exception $e)
{
return $this->getTokenForVersion($e->getMessage());
}
// do we have tags returned
if (isset($tags[0]) && isset($tags[0]->name))
{
// 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)
{
return ['notice' => '<small><span style="color:green;"><span class="icon-shield"></span>' . JText::_('COM_COMPONENTBUILDER_UP_TO_DATE') . '</span></small>'];
}
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' => '<small><span style="color:#F7B033;"><span class="icon-wrench"></span>' . JText::_('COM_COMPONENTBUILDER_BETA_RELEASE') . '</span></small>'];
}
else
{
// download link of the latest version
$download = "https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/" . $tags[0]->name . ".zip?access_token=" . $token;
return ['notice' => '<small><span style="color:red;"><span class="icon-warning-circle"></span>' . JText::_('COM_COMPONENTBUILDER_OUT_OF_DATE') . '!</span> <a style="color:green;" href="' .
$download . '" title="' . JText::_('COM_COMPONENTBUILDER_YOU_CAN_DIRECTLY_DOWNLOAD_THE_LATEST_UPDATE_OR_USE_THE_JOOMLA_UPDATE_AREA') . '">' . JText::_('COM_COMPONENTBUILDER_DOWNLOAD_UPDATE') . '!</a></small>'];
}
}
}
}
return $this->getTokenForVersion();
}
protected function getTokenForVersion($message = null)
{
// the URL
$url = 'https://git.vdm.dev/user/settings/applications';
// create link
$a = '<small><a style="color:#F7B033;" href="' . $url . '" title="';
$a_ = '">';
$_a = '</a></small>';
if ($message)
{
return ['error' => $a . $message . $a_ . JText::_('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];
}
// Used in joomla_module
public function getModuleCode($data)
@ -3517,6 +3605,226 @@ class ComponentbuilderModelAjax extends ListModel
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' => JText::sprintf('COM_COMPONENTBUILDER_WE_FOUND_SOME_INSTANCES_IN_S', $tableName),
'items' => $items,
'fields_count' => SearchFactory::_('Config')->field_counter,
'line_count' => SearchFactory::_('Config')->line_counter
];
}
return [
'not_found' => JText::sprintf('COM_COMPONENTBUILDER_NO_INSTANCES_WHERE_FOUND_IN_S', $tableName),
'fields_count' => SearchFactory::_('Config')->field_counter,
'line_count' => SearchFactory::_('Config')->line_counter
];
}
catch(Exception $error)
{
return ['error' => $error->getMessage()];
}
}
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
}
/**
* 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' => JText::sprintf('COM_COMPONENTBUILDER_ALL_FOUND_INSTANCES_IN_S_WHERE_REPLACED', $tableName)];
}
return ['not_found' => JText::sprintf('COM_COMPONENTBUILDER_NO_INSTANCES_WHERE_FOUND_IN_S', $tableName)];
}
catch(Exception $error)
{
return ['error' => $error->getMessage()];
}
}
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
}
/**
* Get a selected search value from a given table and row
*
* @param string $fieldName The field key
* @param int $rowId The item ID
* @param string $tableName The table
* @param string $searchValue The value to search for
* @param string|null $replaceValue The value to replace search value
* @param int $matchCase The switch to control match case
* @param int $wholeWord The switch to control whole word
* @param int $regexSearch The switch to control regex search
*
* @return array
* @since 3.2.0
**/
public function getSearchValue(string $fieldName, int $rowId, string $tableName,
string $searchValue, ?string $replaceValue = null, int $matchCase, int $wholeWord, int $regexSearch): array
{
// check if this is a valid table and field
if ($rowId > 0 && SearchFactory::_('Table')->exist($tableName, $fieldName))
{
try
{
// load the configurations
SearchFactory::_('Config')->table_name = $tableName;
SearchFactory::_('Config')->type_search = 1;
SearchFactory::_('Config')->search_value = $searchValue;
SearchFactory::_('Config')->replace_value = $replaceValue;
SearchFactory::_('Config')->match_case = $matchCase;
SearchFactory::_('Config')->whole_word = $wholeWord;
SearchFactory::_('Config')->regex_search = $regexSearch;
if (($value = SearchFactory::_('Agent')->getValue($rowId, $fieldName, 0, $tableName)) !== null)
{
// load the value
return ['value' => $value];
}
}
catch(Exception $error)
{
return ['error' => $error->getMessage()];
}
}
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
}
/**
* Get a replaced search value from a given table and row
*
* @param string $fieldName The field key
* @param int $rowId The item ID
* @param mixed $line The line line
* @param string $tableName The table
* @param string $searchValue The value to search for
* @param string|null $replaceValue The value to replace search value
* @param int $matchCase The switch to control match case
* @param int $wholeWord The switch to control whole word
* @param int $regexSearch The switch to control regex search
*
* @return array
* @since 3.2.0
**/
public function getReplaceValue(string $fieldName, int $rowId, $line, string $tableName,
string $searchValue, ?string $replaceValue = null, int $matchCase, int $wholeWord, int $regexSearch): array
{
// check if this is a valid table and field
if ($rowId > 0 && SearchFactory::_('Table')->exist($tableName, $fieldName))
{
try
{
// load the configurations
SearchFactory::_('Config')->table_name = $tableName;
SearchFactory::_('Config')->type_search = 2;
SearchFactory::_('Config')->search_value = $searchValue;
SearchFactory::_('Config')->replace_value = $replaceValue;
SearchFactory::_('Config')->match_case = $matchCase;
SearchFactory::_('Config')->whole_word = $wholeWord;
SearchFactory::_('Config')->regex_search = $regexSearch;
// load the value
if (($value = SearchFactory::_('Agent')->getValue($rowId, $fieldName, $line, $tableName, true)) !== null)
{
return ['value' => $value];
}
}
catch(Exception $error)
{
return ['error' => $error->getMessage()];
}
}
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
}
/**
* Set selected search value in a given table and row
*
* @param mixed $value The field value
* @param int $rowId The item ID
* @param string $fieldName The field key
* @param string $tableName The table
*
* @return array
* @since 3.2.0
**/
public function setValue($value, int $rowId, string $fieldName, string $tableName): array
{
// check if this is a valid table and field
if ($rowId > 0 && SearchFactory::_('Table')->exist($tableName, $fieldName) &&
SearchFactory::_('Agent')->setValue($value, $rowId, $fieldName, $tableName))
{
return ['success' => JText::sprintf(
'<b>%s</b> (%s:%s) was successfully updated!',
$tableName, $rowId, $fieldName)];
}
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
}
// Used in get_snippets
public function getSnippets($libraries)

View File

@ -139,81 +139,10 @@ class ComponentbuilderModelCompiler extends ListModel
public $compiler;
public function getComponents()
public function builder()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Order it by the ordering field.
$query->select($db->quoteName(array('id', 'system_name'),array('id', 'name')));
$query->from($db->quoteName('#__componentbuilder_joomla_component'));
$query->where($db->quoteName('published') . ' = 1');
$query->order('modified DESC');
$query->order('created DESC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
// return the result
return $db->loadObjectList();
}
public function getCompilerAnimations(&$errorMessage)
{
// convert error message to array
$errorMessage = array();
$searchArray = array(
// add banners (width - height)
'banner' => array(
'728-90',
'160-600'
),
// The build-gif by size (width - height)
'builder-gif' => array(
'480-540'
)
);
// start search, and get
foreach ($searchArray as $type => $sizes)
{
// per size
foreach ($sizes as $size)
{
// get size
if (($set_size = ComponentbuilderHelper::getDynamicContentSize($type, $size)) !== 0)
{
// we loop over all type size artwork
for ($target = 1; $target <= $set_size; $target++)
{
if (!ComponentbuilderHelper::getDynamicContent($type, $size, false, 0, $target))
{
$errorMessage[] = JText::sprintf('COM_COMPONENTBUILDER_S_S_NUMBER_BSB_COULD_NOT_BE_DOWNLOADED_SUCCESSFULLY_TO_THIS_JOOMLA_INSTALL', $type, $size, $target);
}
}
}
}
}
// check if we had any errors
if (ComponentbuilderHelper::checkArray($errorMessage))
{
// flatten the error message array
$errorMessage = implode('<br />', $errorMessage);
return false;
}
return true;
}
public function builder($version, $id, $backup, $repo, $addPlaceholders, $addPowers, $debugLinenr, $minify)
{
$set['version'] = $version;
$set['component'] = $id;
$set['backup'] = $backup;
$set['repository'] = $repo;
$set['placeholders'] = $addPlaceholders;
$set['powers'] = $addPowers;
$set['debuglinenr'] = $debugLinenr;
$set['minify'] = $minify;
// run compiler
$this->compiler = new Compiler($set);
$this->compiler = new Compiler();
if($this->compiler)
{
return true;
@ -367,5 +296,91 @@ class ComponentbuilderModelCompiler extends ListModel
$this->cleanCache('mod_menu', 1);
return $result;
}
}
/**
* Get all components in the system
*
* @return array
* @since 3.2.0
**/
public function getComponents(): array
{
// Get a db connection.
$db = $this->getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select only id and system name
$query->select($db->quoteName(array('id', 'system_name'),array('id', 'name')));
$query->from($db->quoteName('#__componentbuilder_joomla_component'));
// only the active components
$query->where($db->quoteName('published') . ' = 1');
// Order it by the ordering field.
$query->order('modified DESC');
$query->order('created DESC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
// return the result
return $db->loadObjectList();
}
/**
* Get all dynamic content
*
* @return bool
* @since 3.2.0
**/
public function getDynamicContent(&$errorMessage): bool
{
// convert error message to array
$errorMessage = [];
$searchArray = [
// add banners (width - height)
'banner' => [
'728-90',
'160-600'
],
// The build-gif by size (width - height)
'builder-gif' => [
'480-540'
]
];
// start search, and get
foreach ($searchArray as $type => $sizes)
{
// per size
foreach ($sizes as $size)
{
// get size
if (($set_size = ComponentbuilderHelper::getDynamicContentSize($type, $size)) !== 0)
{
// we loop over all type size artwork
for ($target = 1; $target <= $set_size; $target++)
{
if (!ComponentbuilderHelper::getDynamicContent($type, $size, false, 0, $target))
{
$errorMessage[] = JText::sprintf('COM_COMPONENTBUILDER_S_S_NUMBER_BSB_COULD_NOT_BE_DOWNLOADED_SUCCESSFULLY_TO_THIS_JOOMLA_INSTALL', $type, $size, $target);
}
}
}
}
}
// check if we had any errors
if (ComponentbuilderHelper::checkArray($errorMessage))
{
// flatten the error message array
$errorMessage = implode('<br />', $errorMessage);
return false;
}
return true;
}
}

View File

@ -36,6 +36,7 @@ class ComponentbuilderModelComponentbuilder extends ListModel
$viewAccess = array(
'compiler.submenu' => 'compiler.submenu',
'compiler.dashboard_list' => 'compiler.dashboard_list',
'search.submenu' => 'search.submenu',
'get_snippets.submenu' => 'get_snippets.submenu',
'get_snippets.dashboard_list' => 'get_snippets.dashboard_list',
'joomla_component.create' => 'joomla_component.create',
@ -416,90 +417,26 @@ class ComponentbuilderModelComponentbuilder extends ListModel
$call_url = JUri::base() . 'index.php?option=com_componentbuilder&task=ajax.getWiki&format=json&raw=true&' . JSession::getFormToken() . '=1&name=Home';
$document = JFactory::getDocument();
$document->addScriptDeclaration('
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;
} else if (typeof result.error !== "undefined") {
document.getElementById("wiki-md-error").innerHTML = result.error
}
});');
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;
} else if (typeof result.error !== "undefined") {
document.getElementById("wiki-md-error").innerHTML = result.error
}
});
}
setTimeout(getWikiPage, 1000);');
return '<div id="wiki-md"><small>'.JText::_('COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING').'.<span class="loading-dots">.</span></small></div><div id="wiki-md-error" style="color: red"></div>';
}
public function getGitea()
{
// get the document
$document = JFactory::getDocument();
// 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');
}
catch (DomainException $m)
{
$token = false;
}
// get the document to load the scripts
if ($token && isset($tags[0]) && isset($tags[0]->name))
{
// download link of the latest version
$download = "https://git.vdm.dev/api/v1/repos/joomla/Component-Builder/archive/" . $tags[0]->name . ".zip?access_token=" . $token;
// load the JavaScript to the page
$document->addScriptDeclaration('
jQuery(document).ready(function () {
var activeVersion = "' . trim($tags[0]->name, 'vV') . '";
if (activeVersion === manifest.version) {
// local version is in sync with latest release
jQuery(".update-notice").html("<small><span style=\'color:green;\'><span class=\'icon-shield\'></span>' . JText::_('COM_COMPONENTBUILDER_UP_TO_DATE') . '</span></small>");
} else {
// split versions in to array
var activeVersionArray = activeVersion.split(".");
var localVersionArray = manifest.version.split(".");
if ((+localVersionArray[0] > +activeVersionArray[0]) ||
(+localVersionArray[0] == +activeVersionArray[0] && +localVersionArray[1] > +activeVersionArray[1]) ||
(+localVersionArray[0] == +activeVersionArray[0] && +localVersionArray[1] == +activeVersionArray[1] && +localVersionArray[2] > +activeVersionArray[2])) {
// local version head latest release
jQuery(".update-notice").html("<small><span style=\'color:#F7B033;\'><span class=\'icon-wrench\'></span>' . JText::_('COM_COMPONENTBUILDER_BETA_RELEASE') . '</span></small>");
} else {
// local version behind latest release
jQuery(".update-notice").html("<small><span style=\'color:red;\'><span class=\'icon-warning-circle\'></span>' . JText::_('COM_COMPONENTBUILDER_OUT_OF_DATE') . '</span> <a style=\'color:green;\' href=\'' .
$download . '\' title=\'' . JText::_('COM_COMPONENTBUILDER_YOU_CAN_DIRECTLY_DOWNLOAD_THE_LATEST_UPDATE_OR_USE_THE_JOOMLA_UPDATE_AREA') . '\'>' .
JText::_('COM_COMPONENTBUILDER_DOWNLOAD_UPDATE') . '!</a></small>");
}
}
});');
return;
}
}
// the URL
$url = 'https://git.vdm.dev/user/settings/applications';
// give a notice to get the token
$document->addScriptDeclaration(
'jQuery(document).ready(function () {jQuery(".update-notice").html("<small><a style=\'color:#F7B033;\' href=\'' .
$url . '\' title=\'' . JText::_('COM_COMPONENTBUILDER_GET_TOKEN_FROM_VDM_FOR_UPDATES_AND_ADD_IT_TO_YOUR_GLOBAL_OPTIONS') . '\'>' .
JText::_('COM_COMPONENTBUILDER_GET_TOKEN') . '!</a></small>");});'
);
}
public function getNoticeboard()
{
// get the document to load the scripts
@ -590,5 +527,28 @@ jQuery(document).ready( function($) {
});');
return '<div id="readme-md"><small>'.JText::_('COM_COMPONENTBUILDER_THE_README_IS_LOADING').'.<span class="loading-dots">.</span></small></div>';
}
}
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();
$document->addScriptDeclaration('
function getComponentVersionStatus() {
fetch("' . $call_url . '").then((response) => {
if (response.ok) {
return response.json();
}
}).then((result) => {
if (typeof result.notice !== "undefined") {
document.getElementById("component-update-notice").innerHTML = result.notice;
} else if (typeof result.error !== "undefined") {
document.getElementById("component-update-notice").innerHTML = result.error;
}
});
}
setTimeout(getComponentVersionStatus, 800);');
}
}

View File

@ -153,6 +153,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_NAME_MESSAGE"

View File

@ -608,6 +608,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_MESSAGE"
@ -1786,6 +1788,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_CLASS_METHOD_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_CLASS_METHOD_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME_MESSAGE"

View File

@ -137,6 +137,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NAME_MESSAGE"

View File

@ -138,6 +138,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NAME_MESSAGE"

View File

@ -116,6 +116,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_MESSAGE"
@ -1118,6 +1120,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_DYNAMIC_GET_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_DYNAMIC_GET_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_FIELD_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_FIELD_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_FIELDTYPE_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_FIELDTYPE_NAME_MESSAGE"
@ -322,6 +324,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_FIELDTYPE_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_FIELDTYPE_NAME_MESSAGE"

View File

@ -1217,6 +1217,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_MESSAGE"

View File

@ -890,6 +890,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_JOOMLA_MODULE_NAME_MESSAGE"

View File

@ -857,6 +857,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_LANGUAGE_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_LANGUAGE_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_LAYOUT_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_LAYOUT_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_LIBRARY_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_LIBRARY_NAME_MESSAGE"

View File

@ -202,44 +202,6 @@
filter="raw"
validate="code"
/>
<!-- Use_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
name="use_selection"
label="COM_COMPONENTBUILDER_POWER_USE_SELECTION_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_POWER_USE_SELECTION_DESCRIPTION"
icon="list"
max="30"
min="0"
showon="type!:interface">
<form hidden="true" name="list_use_selection_modal" repeat="true">
<!-- Use Field. Type: Namespaces. (custom) -->
<field
type="namespaces"
name="use"
label="COM_COMPONENTBUILDER_POWER_USE_LABEL"
class="list_class span12"
multiple="false"
default="0"
button="false"
/>
<!-- As Field. Type: Text. (joomla) -->
<field
type="text"
name="as"
label="COM_COMPONENTBUILDER_POWER_AS_LABEL"
size="10"
maxlength="50"
default="default"
class="text_area"
filter="STRING"
autocomplete="on"
/>
</form>
</field>
<!-- Description Field. Type: Textarea. (joomla) -->
<field
type="textarea"
@ -252,6 +214,19 @@
filter="HTML"
hint="COM_COMPONENTBUILDER_POWER_DESCRIPTION_HINT"
/>
<!-- Licensing_template Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="licensing_template"
label="COM_COMPONENTBUILDER_POWER_LICENSING_TEMPLATE_LABEL"
rows="10"
cols="10"
class="text_area span12"
filter="RAW"
hint="COM_COMPONENTBUILDER_POWER_LICENSING_TEMPLATE_HINT"
validate="code"
showon="add_licensing_template:2"
/>
<!-- Property_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
@ -297,8 +272,8 @@
type="text"
name="implements_custom"
label="COM_COMPONENTBUILDER_POWER_IMPLEMENTS_CUSTOM_LABEL"
size="10"
maxlength="50"
size="50"
maxlength="150"
description="COM_COMPONENTBUILDER_POWER_IMPLEMENTS_CUSTOM_DESCRIPTION"
class="text_area span12"
filter="STRING"
@ -397,6 +372,59 @@
required="false"
validate="code"
/>
<!-- Add_licensing_template Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_licensing_template"
label="COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_LABEL"
description="COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_POWER_USE_GLOBAL</option>
<option value="2">
COM_COMPONENTBUILDER_POWER_OVERRIDE</option>
</field>
<!-- Use_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
name="use_selection"
label="COM_COMPONENTBUILDER_POWER_USE_SELECTION_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_POWER_USE_SELECTION_DESCRIPTION"
icon="list"
max="30"
min="0"
showon="type!:interface">
<form hidden="true" name="list_use_selection_modal" repeat="true">
<!-- Use Field. Type: Namespaces. (custom) -->
<field
type="namespaces"
name="use"
label="COM_COMPONENTBUILDER_POWER_USE_LABEL"
class="list_class span12"
multiple="false"
default="0"
button="false"
/>
<!-- As Field. Type: Text. (joomla) -->
<field
type="text"
name="as"
label="COM_COMPONENTBUILDER_POWER_AS_LABEL"
size="10"
maxlength="50"
default="default"
class="text_area"
filter="STRING"
autocomplete="on"
/>
</form>
</field>
<!-- Guid Field. Type: Text. (joomla) -->
<field
type="text"
@ -420,6 +448,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_POWER_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_POWER_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_SERVER_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_SERVER_NAME_MESSAGE"

View File

@ -116,6 +116,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_SITE_VIEW_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_SITE_VIEW_NAME_MESSAGE"
@ -1137,6 +1139,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_SITE_VIEW_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_SITE_VIEW_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_SNIPPET_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_SNIPPET_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_SNIPPET_TYPE_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_SNIPPET_TYPE_NAME_MESSAGE"

View File

@ -102,6 +102,8 @@
maxlength="150"
description="COM_COMPONENTBUILDER_TEMPLATE_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_TEMPLATE_NAME_MESSAGE"

View File

@ -693,17 +693,26 @@ class ComponentbuilderModelJoomla_components extends ListModel
{
$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))
{
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 +731,14 @@ class ComponentbuilderModelJoomla_components extends ListModel
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

View File

@ -33,10 +33,10 @@ class ComponentbuilderModelPower extends AdminModel
'name',
'description',
'extends',
'implements_custom',
'implements',
'namespace',
'extends_custom',
'implements',
'implements_custom',
'namespace',
'add_head'
),
'right' => array(
@ -58,6 +58,12 @@ class ComponentbuilderModelPower extends AdminModel
'type',
'power_version'
)
),
'licensing' => array(
'fullwidth' => array(
'add_licensing_template',
'licensing_template'
)
)
);
@ -178,6 +184,12 @@ class ComponentbuilderModelPower extends AdminModel
$item->main_class_code = base64_decode($item->main_class_code);
}
if (!empty($item->licensing_template))
{
// base64 Decode licensing_template.
$item->licensing_template = base64_decode($item->licensing_template);
}
if (!empty($item->head))
{
// base64 Decode head.
@ -192,14 +204,6 @@ class ComponentbuilderModelPower extends AdminModel
$item->load_selection = $load_selection->toArray();
}
if (!empty($item->use_selection))
{
// 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->property_selection))
{
// Convert the property_selection field to an array.
@ -224,6 +228,14 @@ class ComponentbuilderModelPower extends AdminModel
$item->method_selection = $method_selection->toArray();
}
if (!empty($item->use_selection))
{
// 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->id))
{
@ -1038,19 +1050,6 @@ class ComponentbuilderModelPower extends AdminModel
$data['load_selection'] = '';
}
// Set the use_selection items to data.
if (isset($data['use_selection']) && is_array($data['use_selection']))
{
$use_selection = new JRegistry;
$use_selection->loadArray($data['use_selection']);
$data['use_selection'] = (string) $use_selection;
}
elseif (!isset($data['use_selection']))
{
// Set the empty use_selection to data
$data['use_selection'] = '';
}
// Set the property_selection items to data.
if (isset($data['property_selection']) && is_array($data['property_selection']))
{
@ -1090,12 +1089,31 @@ class ComponentbuilderModelPower extends AdminModel
$data['method_selection'] = '';
}
// Set the use_selection items to data.
if (isset($data['use_selection']) && is_array($data['use_selection']))
{
$use_selection = new JRegistry;
$use_selection->loadArray($data['use_selection']);
$data['use_selection'] = (string) $use_selection;
}
elseif (!isset($data['use_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']))
{
$data['main_class_code'] = base64_encode($data['main_class_code']);
}
// 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.
if (isset($data['head']))
{

View File

@ -158,6 +158,8 @@ class ComponentbuilderModelPowers extends ListModel
continue;
}
// remove dots
$item->namespace = str_replace('.','\\', $item->namespace);
}
}
@ -269,7 +271,7 @@ class ComponentbuilderModelPowers extends ListModel
else
{
$search = $db->quote('%' . $db->escape($search) . '%');
$query->where('(a.system_name LIKE '.$search.' OR a.type LIKE '.$search.' OR a.description LIKE '.$search.' OR a.extends_custom LIKE '.$search.' OR a.extends LIKE '.$search.' OR a.name LIKE '.$search.')');
$query->where('(a.system_name LIKE '.$search.' OR a.type LIKE '.$search.' OR a.description LIKE '.$search.' OR a.extends_custom LIKE '.$search.' OR a.extends LIKE '.$search.' OR a.guid LIKE '.$search.' OR a.name LIKE '.$search.')');
}
}

243
admin/models/search.php Normal file
View File

@ -0,0 +1,243 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Model\ItemModel;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory;
/**
* 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 = JFactory::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 = JFactory::getUser();
// check if this user has permission to access item
if (!$this->user->authorise('search.access', 'com_componentbuilder'))
{
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('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 = array();
}
if (!isset($this->_item[$pk]))
{
try
{
// Get a db connection.
$db = JFactory::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 = JFactory::getApplication();
// If no data is found redirect to default page and show warning.
$app->enqueueMessage(JText::_('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::raiseWarning(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 = JFactory::getUser();
$this->userId = $this->user->get('id');
$this->guest = $this->user->get('guest');
$this->groups = $this->user->get('groups');
$this->authorisedGroups = $this->user->getAuthorisedGroups();
$this->levels = $this->user->getAuthorisedViewLevels();
$this->initSet = true;
}
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Get data
$data = [
'type_search' => SearchFactory::_('Config')->get('type_search', 1),
'search_value' => SearchFactory::_('Config')->get('search_value', ''),
'replace_value' => SearchFactory::_('Config')->get('replace_value', ''),
'match_case' => SearchFactory::_('Config')->get('match_case', 0),
'whole_word' => SearchFactory::_('Config')->get('whole_word', 0),
'regex_search' => SearchFactory::_('Config')->get('regex_search', 0)
];
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) && ComponentbuilderHelper::checkArray($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();
}
}

File diff suppressed because one or more lines are too long

View File

@ -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`;

View File

@ -25,7 +25,6 @@ $selectNotice .= '<p>' . JText::_('COM_COMPONENTBUILDER_PLEASE_SELECT_A_COMPONEN
$noticeboardOptions = array('vdm', 'pro');
?>
<?php if ($this->canDo->get('compiler.access')): ?>
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=compiler'); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<script type="text/javascript">
Joomla.submitbutton = function(task, key)
@ -33,9 +32,9 @@ Joomla.submitbutton = function(task, key)
if (task == ''){
return false;
} else {
var component = jQuery('#component').val();
var component = jQuery('#component_id').val();
var isValid = true;
if(component == '' && task == 'compiler.compiler'){
isValid = false;
}
@ -56,7 +55,7 @@ Joomla.submitbutton = function(task, key)
// some ui movements
if (task == 'compiler.compiler'){
// get the component name
let component_name = jQuery("#component option:selected").text();
let component_name = jQuery("#component_id option:selected").text();
// set the component name
jQuery(".component-name").text(component_name);
// wait a little since to much is happening...
@ -127,73 +126,78 @@ jQuery('<div id="compiling"></div>')
<div id="j-main-container">
<?php endif; ?>
<?php if (ComponentbuilderHelper::checkString($this->SuccessMessage)): ?>
<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<?= $this->SuccessMessage; ?>
</div>
<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<?php echo $this->SuccessMessage; ?>
</div>
<?php endif; ?>
<div id="form">
<div class="span4">
<h3><?= JText::_('COM_COMPONENTBUILDER_READY_TO_COMPILE_A_COMPONENT') ?></h3>
<div id="compilerForm">
<div>
<span class="notice" style="display:none; color:red;"><?= JText::_('COM_COMPONENTBUILDER_YOU_MUST_SELECT_A_COMPONENT') ?></span><br />
<?php if ($this->form): ?>
<?php foreach ($this->form as $field): ?>
<div class="control-group">
<div class="control-label"><?= $field->label ?></div>
<div class="controls"><?= $field->input ?></div>
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=compiler'); ?>"
method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<div id="form" >
<div class="span4">
<h3><?php echo JText::_('COM_COMPONENTBUILDER_READY_TO_COMPILE_A_COMPONENT'); ?></h3>
<div id="compilerForm">
<div>
<span class="notice" style="display:none; color:red;"><?php echo JText::_('COM_COMPONENTBUILDER_YOU_MUST_SELECT_A_COMPONENT'); ?></span><br />
<?php if ($this->Form): ?>
<?php foreach ($this->Form as $field): ?>
<div class="control-group">
<div class="control-label"><?php echo $field->label; ?></div>
<div class="controls"><?php echo $field->input; ?></div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
<br />
<div class="clearfix"></div>
<button class="btn btn-small btn-success" onclick="Joomla.submitbutton('compiler.compiler')"><span class="icon-cog icon-white"></span>
<?php echo JText::_('COM_COMPONENTBUILDER_COMPILE_COMPONENT'); ?>
</button>
<input type="hidden" name="install_item_id" value="0">
<input type="hidden" name="version" value="3" />
</div>
<br />
<div class="clearfix"></div>
<button class="btn btn-small btn-success" onclick="Joomla.submitbutton('compiler.compiler')"><span class="icon-cog icon-white"></span>
<?= JText::_('COM_COMPONENTBUILDER_COMPILE_COMPONENT') ?>
</button>
<input type="hidden" name="install_item_id" value="0">
<input type="hidden" name="version" value="3" />
</div>
<div class="span7">
<div id="component-details"><?php echo $selectNotice; ?></div>
<?php echo JLayoutHelper::render('jcbnoticeboardtabs', array('id' => 'noticeboard' , 'active' => $noticeboardOptions[array_rand($noticeboardOptions)])); ?>
</div>
</div>
<div class="span7">
<div id="component-details"><?= $selectNotice ?></div>
<?= JLayoutHelper::render('jcbnoticeboardtabs', array('id' => 'noticeboard' , 'active' => $noticeboardOptions[array_rand($noticeboardOptions)])) ?>
</div>
</div>
<div id="get-compiler-animations" style="display:none;">
<h1><?= JText::_('COM_COMPONENTBUILDER_PLEASE_WAIT') ?></h1>
<h4><?= JText::_('COM_COMPONENTBUILDER_WHILE_WE_DOWNLOAD_ALL_TWENTY_SIX_COMPILER_GIF_ANIMATIONS_RANDOMLY_USED_IN_THE_COMPILER_GUI_DURING_COMPILATION') ?> <span class="loading-dots">.</span></h4>
<div class="clearfix"></div>
</div>
<div id="clear" style="display:none;">
<h1><?= JText::_('COM_COMPONENTBUILDER_PLEASE_WAIT') ?></h1>
<h4><?= JText::_('COM_COMPONENTBUILDER_REMOVING_ALL_ZIP_PACKAGES_FROM_THE_TEMPORARY_FOLDER_OF_THE_JOOMLA_INSTALL') ?> <span class="loading-dots">.</span></h4>
<div class="clearfix"></div>
</div>
<div id="compiler" style="display:none;">
<div id="compiler-spinner" class="span4" style="display:none;">
<h3><?= JText::sprintf('COM_COMPONENTBUILDER_S_PLEASE_WAIT', $this->user->name) ?></h3>
<p style="font-size: smaller;"><?= JText::_('COM_COMPONENTBUILDER_THIS_MAY_TAKE_A_WHILE_DEPENDING_ON_THE_SIZE_OF_YOUR_PROJECT') ?></p>
<p><b><span class="component-name"><?= JText::_('COM_COMPONENTBUILDER_THE_COMPONENT') ?></span></b> <?= JText::_('COM_COMPONENTBUILDER_IS_BEING_COMPILED') ?> <span class="loading-dots">.</span></p>
<div style="text-align: center;"><?= ComponentbuilderHelper::getDynamicContent('builder-gif', $this->builder_gif_size) ?></div>
<div id="get-compiler-animations" style="display:none;">
<h1><?php echo JText::_('COM_COMPONENTBUILDER_PLEASE_WAIT'); ?></h1>
<h4><?php echo JText::_('COM_COMPONENTBUILDER_WHILE_WE_DOWNLOAD_ALL_TWENTY_SIX_COMPILER_GIF_ANIMATIONS_RANDOMLY_USED_IN_THE_COMPILER_GUI_DURING_COMPILATION'); ?> <span class="loading-dots">.</span></h4>
<div class="clearfix"></div>
</div>
<div id="compiler-notice" class="span7" style="display:none;">
<?= JLayoutHelper::render('jcbnoticeboard' . $noticeboardOptions[array_rand($noticeboardOptions)], null) ?>
<div><?= ComponentbuilderHelper::getDynamicContent('banner', '728-90') ?></div>
<div id="clear" style="display:none;">
<h1><?php echo JText::_('COM_COMPONENTBUILDER_PLEASE_WAIT'); ?></h1>
<h4><?php echo JText::_('COM_COMPONENTBUILDER_REMOVING_ALL_ZIP_PACKAGES_FROM_THE_TEMPORARY_FOLDER_OF_THE_JOOMLA_INSTALL'); ?> <span class="loading-dots">.</span></h4>
<div class="clearfix"></div>
</div>
</div>
<div id="compiler" style="display:none;">
<div id="compiler-spinner" class="span4" style="display:none;">
<h3><?php echo JText::sprintf('COM_COMPONENTBUILDER_S_PLEASE_WAIT', $this->user->name); ?></h3>
<p style="font-size: smaller;"><?php echo JText::_('COM_COMPONENTBUILDER_THIS_MAY_TAKE_A_WHILE_DEPENDING_ON_THE_SIZE_OF_YOUR_PROJECT'); ?></p>
<p><b><span class="component-name"><?php echo JText::_('COM_COMPONENTBUILDER_THE_COMPONENT'); ?></span></b> <?php echo JText::_('COM_COMPONENTBUILDER_IS_BEING_COMPILED'); ?> <span class="loading-dots">.</span></p>
<div style="text-align: center;"><?php echo ComponentbuilderHelper::getDynamicContent('builder-gif', $this->builder_gif_size); ?></div>
<div class="clearfix"></div>
</div>
<div id="compiler-notice" class="span7" style="display:none;">
<?php echo JLayoutHelper::render('jcbnoticeboard' . $noticeboardOptions[array_rand($noticeboardOptions)], null); ?>
<div><?php echo ComponentbuilderHelper::getDynamicContent('banner', '728-90'); ?></div>
</div>
</div>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
<script type="text/javascript">
// token
var token = '<?= JSession::getFormToken() ?>';
var all_is_good = '<?= JText::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_THERE_IS_NO_NOTICE_AT_THIS_TIME') ?>';
jQuery('#compilerForm').on('change', '#component',function (e)
var token = '<?php echo JSession::getFormToken(); ?>';
var all_is_good = '<?php echo JText::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_THERE_IS_NO_NOTICE_AT_THIS_TIME'); ?>';
jQuery('#compilerForm').on('change', '#component_id',function (e)
{
var component = jQuery('#component').val();
var component = jQuery('#component_id').val();
if(component == "") {
jQuery('#component-details').html("<?= $selectNotice ?>");
jQuery('#component-details').html("<?php echo $selectNotice; ?>");
jQuery("#noticeboard").show();
jQuery('.notice').show();
} else {
@ -233,9 +237,6 @@ function JRouter(link) {
return url+link;
}
</script>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
<?php else: ?>
<h1><?php echo JText::_('COM_COMPONENTBUILDER_NO_ACCESS_GRANTED'); ?></h1>
<?php endif; ?>

View File

@ -40,11 +40,18 @@ class ComponentbuilderViewCompiler extends HtmlView
JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=compiler');
$this->sidebar = JHtmlSidebar::render();
}
// get the success message if set
$this->SuccessMessage = $this->app->getUserState('com_componentbuilder.success_message', false);
// get active components
$this->Components = $this->get('Components');
$this->form = $this->setForm();
// get the needed form fields
$this->Form = $this->getDynamicForm();
// set the compiler artwork from global settings
$this->builder_gif_size = $this->params->get('builder_gif_size', '480-272');
// only run these checks if he has access
if ($this->canDo->get('compiler.compiler_animations'))
{
@ -96,7 +103,14 @@ class ComponentbuilderViewCompiler extends HtmlView
// JLayoutHelper::render('sectionjcb', [?]); // added to ensure the layout are loaded
// JLayoutHelper::render('repeatablejcb', [?]); // added to ensure the layout are loaded
public function setForm()
/**
* Get the dynamic build form fields needed on the page
*
* @return array|null The array of form fields
*
* @since 3.2.0
*/
public function getDynamicForm(): ?array
{
if(ComponentbuilderHelper::checkArray($this->Components))
{
@ -133,7 +147,7 @@ class ComponentbuilderViewCompiler extends HtmlView
// placeholders attributes
$attributes = array(
'type' => 'radio',
'name' => 'placeholders',
'name' => 'add_placeholders',
'label' => 'COM_COMPONENTBUILDER_ADD_CUSTOM_CODE_PLACEHOLDERS',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_SHOULD_JCB_INSERT_THE_CUSTOM_CODE_PLACEHOLDERS_THIS_IS_ONLY_APPLICABLE_IF_THIS_COMPONENT_HAS_CUSTOM_CODE',
@ -148,7 +162,7 @@ class ComponentbuilderViewCompiler extends HtmlView
// debuglinenr attributes
$attributes = array(
'type' => 'radio',
'name' => 'debuglinenr',
'name' => 'debug_line_nr',
'label' => 'COM_COMPONENTBUILDER_DEBUG_LINE_NUMBERS',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_ADD_CORRESPONDING_LINE_NUMBERS_TO_THE_DYNAMIC_COMMENTS_SO_TO_SEE_WHERE_IN_THE_COMPILER_THE_LINES_OF_CODE_WAS_BUILD_THIS_WILL_HELP_IF_YOU_NEED_TO_GET_MORE_TECHNICAL_WITH_AN_ISSUE_ON_GITHUB_OR_EVEN_FOR_YOUR_OWN_DEBUGGING',
@ -190,7 +204,7 @@ class ComponentbuilderViewCompiler extends HtmlView
// component attributes
$attributes = array(
'type' => 'list',
'name' => 'component',
'name' => 'component_id',
'label' => 'COM_COMPONENTBUILDER_COMPONENTS',
'class' => 'list_class',
'description' => 'COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_TO_COMPILE',
@ -209,8 +223,10 @@ class ComponentbuilderViewCompiler extends HtmlView
// return the form array
return $form;
}
return false;
}
return null;
}
/**
* Prepares the document
@ -396,7 +412,7 @@ class ComponentbuilderViewCompiler extends HtmlView
if ($this->canDo->get('compiler.compiler_animations'))
{
// add Compiler Animations button.
JToolBarHelper::custom('compiler.getCompilerAnimations', 'download custom-button-getcompileranimations', '', 'COM_COMPONENTBUILDER_COMPILER_ANIMATIONS', false);
JToolBarHelper::custom('compiler.getDynamicContent', 'download custom-button-getdynamiccontent', '', 'COM_COMPONENTBUILDER_COMPILER_ANIMATIONS', false);
}
if ($this->canDo->get('compiler.clear_tmp'))
{

View File

@ -38,58 +38,50 @@ defined('_JEXEC') or die('Restricted access');
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'wiki', JText::_('Wiki', true)); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'wiki', JText::_('COM_COMPONENTBUILDER_WIKI', true)); ?>
<div class="row-fluid">
<div class="span12">
<div class="span10">
<?php echo JHtml::_('bootstrap.startAccordion', 'wiki_accordian', array('active' => 'wiki_one')); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'wiki_accordian', 'Tutorials', 'wiki_one'); ?>
<?php echo $this->loadTemplate('wiki_tutorials');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
</div>
<div class="span2">
<?php echo ComponentbuilderHelper::getDynamicContent('banner', '160-600'); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'notice_board', JText::_('Notice Board', true)); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'notice_board', JText::_('COM_COMPONENTBUILDER_NOTICE_BOARD', true)); ?>
<div class="row-fluid">
<div class="span12">
<div class="span10">
<?php echo JHtml::_('bootstrap.startAccordion', 'notice_board_accordian', array('active' => 'notice_board_one')); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'notice_board_accordian', 'Vast Development Method', 'notice_board_one'); ?>
<?php echo $this->loadTemplate('notice_board_vast_development_method');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
</div>
<div class="span2">
<?php echo ComponentbuilderHelper::getDynamicContent('banner', '160-600'); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'readme', JText::_('Readme', true)); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'readme', JText::_('COM_COMPONENTBUILDER_README', true)); ?>
<div class="row-fluid">
<div class="span12">
<div class="span10">
<?php echo JHtml::_('bootstrap.startAccordion', 'readme_accordian', array('active' => 'readme_one')); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'readme_accordian', 'Information', 'readme_one'); ?>
<?php echo $this->loadTemplate('readme_information');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'notice_board', JText::_('COM_COMPONENTBUILDER_NOTICE_BOARD', true)); ?>
<div class="row-fluid">
<div class="span10">
<?php echo JHtml::_('bootstrap.startAccordion', 'notice_board_accordian', array('active' => 'notice_board_one')); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'notice_board_accordian', 'Vast Development Method', 'notice_board_one'); ?>
<?php echo $this->loadTemplate('notice_board_vast_development_method');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.addSlide', 'notice_board_accordian', 'JCB Pro Membership', 'notice_board_two'); ?>
<?php echo $this->loadTemplate('notice_board_jcb_pro_membership');?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
</div>
<div class="span2">
<?php echo ComponentbuilderHelper::getDynamicContent('banner', '160-600'); ?>
</div>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>

View File

@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access');
?>
<img alt="<?php echo JText::_('COM_COMPONENTBUILDER'); ?>" src="components/com_componentbuilder/assets/images/vdm-component.jpg">
<ul class="list-striped">
<li><b><?php echo JText::_('COM_COMPONENTBUILDER_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?>&nbsp;&nbsp;<span class="update-notice"></span></li>
<li><b><?php echo JText::_('COM_COMPONENTBUILDER_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?>&nbsp;&nbsp;<span class="update-notice" id="component-update-notice"></span></li>
<li><b><?php echo JText::_('COM_COMPONENTBUILDER_DATE'); ?>:</b> <?php echo $this->manifest->creationDate; ?></li>
<li><b><?php echo JText::_('COM_COMPONENTBUILDER_AUTHOR'); ?>:</b> <a href="mailto:<?php echo $this->manifest->authorEmail; ?>"><?php echo $this->manifest->author; ?></a></li>
<li><b><?php echo JText::_('COM_COMPONENTBUILDER_WEBSITE'); ?>:</b> <a href="<?php echo $this->manifest->authorUrl; ?>" target="_blank"><?php echo $this->manifest->authorUrl; ?></a></li>

View File

@ -29,9 +29,9 @@ class ComponentbuilderViewComponentbuilder extends JViewLegacy
$this->icons = $this->get('Icons');
$this->contributors = ComponentbuilderHelper::getContributors();
$this->wiki = $this->get('Wiki');
$this->gitea = $this->get('Gitea');
$this->noticeboard = $this->get('Noticeboard');
$this->readme = $this->get('Readme');
$this->version = $this->get('Version');
// get the manifest details of the component
$this->manifest = ComponentbuilderHelper::manifest();

View File

@ -64,6 +64,16 @@ $componentParams = $this->params; // will be removed just use $this->params inst
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'powerTab', 'licensing', JText::_('COM_COMPONENTBUILDER_POWER_LICENSING', true)); ?>
<div class="row-fluid form-horizontal-desktop">
</div>
<div class="row-fluid form-horizontal-desktop">
<div class="span12">
<?php echo JLayoutHelper::render('power.licensing_fullwidth', $this); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php $this->ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>
<?php $this->tab_name = 'powerTab'; ?>
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>

View File

@ -71,7 +71,7 @@ $edit = "index.php?option=com_componentbuilder&view=powers&task=power.edit";
</div>
</td>
<td class="hidden-phone">
<?php echo $this->escape($item->namespace); ?>
<?php echo $item->namespace; ?>
</td>
<td class="hidden-phone">
<div><?php echo JText::_('COM_COMPONENTBUILDER_TYPE'); ?>:
@ -80,7 +80,8 @@ $edit = "index.php?option=com_componentbuilder&view=powers&task=power.edit";
<a href="index.php?option=com_componentbuilder&view=powers&task=power.edit&id=<?php echo $item->extends_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->extends_name); ?></a>
<?php else: ?>
<?php echo $this->escape($item->extends_name); ?>
<?php endif; ?><?php endif; ?>
<?php endif; ?><?php elseif ($item->extends === '-1') : ?><br /><?php echo JText::_('COM_COMPONENTBUILDER_EXTENDS'); ?>:
<?php echo $this->escape($item->extends_custom); ?><?php endif; ?>
</div>
</td>
<td class="hidden-phone">

View File

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

View File

@ -0,0 +1,316 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive');
// allow main menu selection
$this->app->input->set('hidemainmenu', false);
// set the basu URL
$url_base = JUri::base() . 'index.php?option=com_componentbuilder';
$url_search = $url_base . '&view=search';
?>
<?php if ($this->canDo->get('search.access')): ?>
<script type="text/javascript">
Joomla.submitbutton = function(task) {
if (task === 'search.back') {
parent.history.back();
return false;
} else {
var form = document.getElementById('adminForm');
form.task.value = task;
form.submit();
}
}
</script>
<?php $urlId = (isset($this->item->id)) ? '&id='. (int) $this->item->id : ''; ?>
<div class="alert alert-warning" role="alert">
<?php echo JText::_('COM_COMPONENTBUILDER_THE_CHANGES_YOU_MAKE_HERE_CAN_NOT_BE_UNDONE_THEREFORE_YOU_MUST_ALWAYS_USE_THE_UPDATE_AND_REPLACE_FEATURES_WITH_GREAT_CAUTION_SEARCH_FEATURE_IS_IN_BETA_STAGE'); ?>
</div>
<hr />
<?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php if ($this->form): ?>
<form action="<?php echo JRoute::_($url_search); ?>" method="post"
name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<div class="form-horizontal">
<div class="row-fluid" id="search_progress_block" style="display: none">
<div class="uk-progress uk-progress-striped uk-active">
<div id="search_progress_bar" class="uk-progress-bar" style="width: 0%;">0%</div>
</div>
</div>
<div class="row-fluid" id="replace_progress_block" style="display: none">
<div class="uk-progress uk-progress-small uk-progress-danger uk-progress-striped uk-active">
<div id="replace_progress_bar" class="uk-progress-bar" style="width: 0%;"></div>
</div>
</div>
<div class="row-fluid" id="search_details_block" style="display: none">
<span id="search_details">
<span class="search_details_title"><?php echo JText::_('COM_COMPONENTBUILDER_SEARCHED_FOR'); ?></span>:
&nbsp;[<span id="searched" class="found_code">....</span>]&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<span id="replace_details" style="display: none">
<span class="search_details_title"><?php echo JText::_('COM_COMPONENTBUILDER_REPLACED_WITH'); ?></span>:
&nbsp;[<span id="replaced" class="found_code">....</span>]
</span>
<button style="float: right;" type="button" onclick="showSearch();" class="btn button-new btn-success">
<span class="icon-search icon-white" aria-hidden="true"></span>
<?php echo JText::_('COM_COMPONENTBUILDER_SEARCH_DATABASE_AGAIN'); ?>
</button>
</div>
<div class="row-fluid" id="search_settings_block">
<div class="span7">
<?php echo $this->form->renderField('type_search'); ?>
<?php echo $this->form->renderField('search_value'); ?>
<?php echo $this->form->renderField('replace_value'); ?>
</div>
<div class="span4">
<?php echo $this->form->renderFieldset('settings'); ?>
</div>
</div>
<div class="row-fluid" id="search_results_block">
<hr>
<div id="search_results_table_block">
<?php echo JLayoutHelper::render('table', ['id' => 'search_results_table', 'headers' => $this->table_headers, 'items' => 7, 'init' => false]); ?>
</div>
</div>
<div class="row-fluid" id="item_view_block">
<hr>
<div>
<span id="item_notice_block" style="display: none">
<span id="item_edit_button"></span>&nbsp;
<?php echo JText::_('COM_COMPONENTBUILDER_TABLE'); ?>:&nbsp;<b><span id="item_table_name">
</span></b>(<?php echo JText::_('COM_COMPONENTBUILDER_ID'); ?>:<b><span id="item_row_id">
</span></b>)&nbsp;|&nbsp;
<?php echo JText::_('COM_COMPONENTBUILDER_FIELD'); ?>:&nbsp;<b><span id="item_field_name">
</span></b>(<?php echo JText::_('COM_COMPONENTBUILDER_LINE'); ?>:<b><span id="item_line_number">
</span></b>)&nbsp;&nbsp;&nbsp;
<button type="button" id="item_button_update" onclick="" class="hasTooltip btn btn-small button-new btn-success"
title="<?php echo JText::_('COM_COMPONENTBUILDER_SAVE_ALL_CHANGES_MADE_TO_THE_SELECTED_ITEM'); ?>">
<?php echo JText::_('COM_COMPONENTBUILDER_SAVE_ITEM'); ?>
</button>
</span>
<span id="update_all_block" style="display: none;">
<button style="float: right;" type="button" onclick="replaceAllCheck();" class="hasTooltip btn btn-small button-new btn-danger"
title="<?php echo JText::_('COM_COMPONENTBUILDER_UPDATE_ALL_ITEMS_FOUND_WITH_THIS_DATABASE_SEARCH_WITH_THE_REPLACE_VALUE'); ?>">
<?php echo JText::_('COM_COMPONENTBUILDER_UPDATE_ALL'); ?>
</button>
</span>
</div>
<hr>
<?php echo $this->form->getInput('item_code'); ?>
</div>
</div>
</form>
<?php endif; ?>
</div>
<?php if (isset($this->item['tables']) && ComponentbuilderHelper::checkArray($this->item['tables'])) : ?>
<script>
// To class="uk-autoload uk-progress" UIkit.notify
// get search table values
const searchTables = <?php echo json_encode($this->item['tables']); ?>;
// the search Ajax URLs
const UrlAjax = '<?php echo $url_base; ?>&format=json&raw=true&<?php echo JSession::getFormToken(); ?>=1&task=ajax.';
// the search URL
const UrlSearch = '<?php echo $url_search; ?>';
// make sure our controller is set
let controller = null;
let controller_replace = null;
// some counters
var fieldCount = 0;
var lineCount = 0;
// start search time keepers
var startSearchTime, endSearchTime;
// active edit button of row selected
var editButtonSelected;
// get search progress area
const searchProgressObject = document.getElementById("search_progress_block");
const searchProgressBarObject = document.getElementById("search_progress_bar");
const replaceProgressObject = document.getElementById("replace_progress_block");
const replaceProgressBarObject = document.getElementById("replace_progress_bar");
// get search settings area
const searchSettingsObject = document.getElementById("search_settings_block");
const searchDetailsObject = document.getElementById("search_details_block");
const searchedObject = document.getElementById("searched");
// get replace settings area
const replaceDetailsObject = document.getElementById("replace_details");
const replacedObject = document.getElementById("replaced");
// set the search mode objects
const modeObject = document.getElementById("type_search");
const typeSearchObject = document.getElementById("type_search0");
const typeReplaceObject = document.getElementById("type_search1");
const typeSearchLabelObject = document.querySelector('[for=type_search0]');
const typeReplaceLabelObject = document.querySelector('[for=type_search1]');
// set the search settings objects
const searchObject = document.getElementById("search_value");
const replaceObject = document.getElementById("replace_value");
const matchObject = document.getElementById("search_behaviour0");
const wholeObject = document.getElementById("search_behaviour1");
const regexObject = document.getElementById("search_behaviour2");
const tableObject = document.getElementById("table_name");
// Do the search on key up of search or replace input elements
searchObject.onkeyup = onChange;
// when the made changes and there is replace value do search
modeObject.onchange = onChange;
replaceObject.onkeyup = onChange;
// Do the search on key up of search input elements
matchObject.onchange = onChange;
wholeObject.onchange = onChange;
regexObject.onchange = onChange;
tableObject.onchange = onChange;
// set the item notice area
const itemNoticeObject = document.getElementById("item_notice_block");
const itemEditButtonObject = document.getElementById("item_edit_button");
const itemTableNameObject = document.getElementById("item_table_name");
const itemRowIdObject = document.getElementById("item_row_id");
const itemFieldNameObject = document.getElementById("item_field_name");
const itemLineNumberObject = document.getElementById("item_line_number");
// set the update buttons
const buttonUpdateItemObject = document.getElementById("item_button_update");
const buttonUpdateAllObject = document.getElementById("update_all_block");
// get the editor
var editorObject;
// set some global objects
document.addEventListener('DOMContentLoaded', function () {
// get the editor
editorObject = Joomla.editors.instances['item_code'];
});
// configurations of the table
const tableConfigObject = {
responsive: true,
order: [[ 2, "asc" ]],
select: true,
paging: true,
lengthMenu: [5, 10, 20 ,50, 80, 100, 150, 200, 500, 1000, 1500, 2000],
pageLength: 80,
scrollY: 170,
columnDefs: [
{ 'targets': [ 0 ], 'visible': false, 'searchable': false },
{ 'targets': [ 0, 1 ], type: 'html' },
{ responsivePriority: 1, targets: 1 },
{ responsivePriority: 2, targets: 2 },
{ responsivePriority: 3, targets: 3 }
],
columns: [
{
data: 'edit'
},
{
data: 'code'
},
{
data: 'table'
},
{
data: 'field'
},
{
data: 'id',
width: "15px",
className: "small_column"
},
{
data: 'line',
width: "15px",
className: "small_column"
}
]
};
// set some table object
var tableSearchObject;
var tableLengthObject;
var tableActiveObject;
// The Result Table Code
document.addEventListener('DOMContentLoaded', function () {
// init the table
let searchResultsTable = new DataTable('#search_results_table', tableConfigObject);
searchResultsTable.on( 'select', function ( e, dt, type, indexes ) {
if ( type === 'row' ) {
// get the data from the row
let data = searchResultsTable.rows( indexes ).data();
// get the item data
let item_id = data[0].id;
let item_table = data[0].table;
let item_field = data[0].field;
let item_line = data[0].line;
// set the active edit button
editButtonSelected = data[0].edit;
// set active row
tableActiveObject = searchResultsTable.row( indexes );
// get selected item
getSelectedItem(item_table, item_id, item_field, item_line);
// hide the search settings
hideSearch();
}
});
searchResultsTable.on( 'deselect', function ( e, dt, type, indexes ) {
if ( type === 'row' ) {
clearSelectedItem(false);
}
});
// set the table search object
tableSearchObject = document.getElementById("search_results_table_filter");
tableLengthObject = document.getElementById("search_results_table_length");
showSearch();
<?php if (strlen($this->urlvalues['search_value']) > 2): ?>
onChange();
<?php endif; ?>
});
</script>
<?php endif; ?>
<?php else: ?>
<h1><?php echo JText::_('COM_COMPONENTBUILDER_NO_ACCESS_GRANTED'); ?></h1>
<?php endif; ?>

View File

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

View File

@ -0,0 +1,430 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Form\Form;
use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory;
/**
* Componentbuilder Html View class for the Search
*/
class ComponentbuilderViewSearch extends HtmlView
{
// Overwriting JView display method
function display($tpl = null)
{
// get component params
$this->params = JComponentHelper::getParams('com_componentbuilder');
// get the application
$this->app = JFactory::getApplication();
// get the user object
$this->user = JFactory::getUser();
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('search');
// Initialise variables.
$this->item = $this->get('Item');
$this->urlvalues = $this->get('UrlValues');
if ($this->getLayout() !== 'modal')
{
// Include helper submenu
ComponentbuilderHelper::addSubmenu('search');
JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=search');
$this->sidebar = JHtmlSidebar::render();
}
// get the needed form fields
$this->form = $this->getDynamicForm();
// build our table headers
$this->table_headers = array(
'edit' => 'E',
'code' => JText::_('COM_COMPONENTBUILDER_FOUND_TEXT'),
'table' => JText::_('COM_COMPONENTBUILDER_TABLE'),
'field' => JText::_('COM_COMPONENTBUILDER_FIELD'),
'id' => JText::_('ID'),
'line' => JText::_('COM_COMPONENTBUILDER_LINE')
);
// set some JavaScript Language
JText::script('COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_UPDATE_ROW');
JText::script('COM_COMPONENTBUILDER_FIELD_IN_THE');
JText::script('COM_COMPONENTBUILDER_TABLE');
JText::script('COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE');
JText::script('COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_REPLACE_BALLB_SEARCH_RESULTS');
JText::script('COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_BYOU_HAVE_BEEN_WARNEDB');
JText::script('COM_COMPONENTBUILDER_ARE_YOU_THEREFORE_ABSOLUTELY_SURE_YOU_WANT_TO_CONTINUE');
JText::script('COM_COMPONENTBUILDER_THE_SEARCH_PROCESS_HAD_AN_ERROR_WITH_TABLE');
JText::script('COM_COMPONENTBUILDER_THE_REPLACE_PROCESS_HAD_AN_ERROR_WITH_TABLE');
JText::script('COM_COMPONENTBUILDER_REPLACE_PROCESS_COMPLETE');
JText::script('COM_COMPONENTBUILDER_SEARCHING');
JText::script('COM_COMPONENTBUILDER_TABLES_WITH');
JText::script('COM_COMPONENTBUILDER_FIELDS_THAT_HAD');
JText::script('COM_COMPONENTBUILDER_LINES');
JText::script('COM_COMPONENTBUILDER_AND_FINISHED_THE_SEARCH_IN');
JText::script('COM_COMPONENTBUILDER_SECONDS');
JText::script('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_DO_A_REVERSE_SEARCH');
JText::script('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_REPEAT_THE_SAME_SEARCH');
JText::script('COM_COMPONENTBUILDER_YES_UPDATE_ALL');
JText::script('COM_COMPONENTBUILDER_NO');
JText::script('COM_COMPONENTBUILDER_YES');
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
// add the tool bar
$this->addToolBar();
}
// set the document
$this->setDocument();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);
}
/**
* Get the dynamic build form fields needed on the page
*
* @return Form|null The array of form fields
*
* @since 3.2.0
*/
public function getDynamicForm(): ?Form
{
if(ComponentbuilderHelper::checkArray($this->item) &&
ComponentbuilderHelper::checkArray($this->item['tables']) &&
ComponentbuilderHelper::checkArray($this->item['components']))
{
// start the form
$form = new Form('Search');
$form->load('<form
addrulepath="/administrator/components/com_componentbuilder/models/rules"
addfieldpath="/administrator/components/com_componentbuilder/models/fields">
<fieldset name="search"></fieldset>
<fieldset name="settings"></fieldset>
<fieldset name="view"></fieldset>
</form>');
// Search Mode
$attributes = [
'type' => 'radio',
'name' => 'type_search',
'label' => 'COM_COMPONENTBUILDER_MODE',
'class' => 'btn-group',
'description' => 'COM_COMPONENTBUILDER_SEARCH_OR_SEARCH_AND_REPLACE',
'default' => $this->urlvalues['type_search']];
// set the mode options
$options = [
1 => 'COM_COMPONENTBUILDER_SEARCH',
2 => 'COM_COMPONENTBUILDER_REPLACE'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'search');
}
// search text attributes
$attributes = [
'type' => 'text',
'name' => 'search_value',
'label' => 'COM_COMPONENTBUILDER_SEARCH',
'size' => 150,
'maxlength' => 200,
'description' => 'COM_COMPONENTBUILDER_HERE_YOU_CAN_ENTER_YOUR_SEARCH_TEXT',
'filter' => 'RAW',
'class' => 'search-value span12',
'hint' => 'COM_COMPONENTBUILDER_ENTER_YOUR_SEARCH_TEXT',
'autocomplete' => true,
'default' => $this->urlvalues['search_value']];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'search');
}
// replace text attributes
$attributes = [
'type' => 'text',
'name' => 'replace_value',
'label' => 'COM_COMPONENTBUILDER_REPLACE',
'size' => 150,
'maxlength' => 200,
'description' => 'COM_COMPONENTBUILDER_HERE_YOU_CAN_ENTER_THE_REPLACE_TEXT_THAT_YOU_WOULD_LIKE_TO_USE_AS_REPLACEMENT_FOR_THE_SEARCH_TEXT_FOUND',
'filter' => 'RAW',
'class' => 'replace-value span12',
'hint' => 'COM_COMPONENTBUILDER_ENTER_YOUR_REPLACE_TEXT',
'autocomplete' => true,
'showon' => 'type_search:2',
'default' => $this->urlvalues['replace_value']];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'search');
}
// Search Behaviour
$default = [];
if ($this->urlvalues['match_case'] == 1)
{
$default[] = 'match_case';
}
if ($this->urlvalues['whole_word'] == 1)
{
$default[] = 'whole_word';
}
if ($this->urlvalues['regex_search'] == 1)
{
$default[] = 'regex_search';
}
$attributes = [
'type' => 'checkboxes',
'name' => 'search_behaviour',
'label' => 'COM_COMPONENTBUILDER_BEHAVIOUR',
'description' => 'COM_COMPONENTBUILDER_SET_THE_SEARCH_BEHAVIOUR_HERE'];
if (ComponentbuilderHelper::checkArray($default))
{
$attributes['default'] = implode(',', $default);
}
// set the mode options
$options = [
'match_case' => 'COM_COMPONENTBUILDER_MATCH_CASE',
'whole_word' => 'COM_COMPONENTBUILDER_WHOLE_WORD',
'regex_search' => 'COM_COMPONENTBUILDER_REGEX_SEARCH'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'settings');
}
// component attributes
$attributes = [
'type' => 'list',
'name' => 'component_id',
'label' => 'COM_COMPONENTBUILDER_COMPONENTS_BR_SMALLDISABLED_SOONSMALL',
'class' => 'list_class',
'description' => 'COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_TO_SEARCH',
'required' => 'true',
'disable' => 'true',
'readonly' => 'true',
'default' => -1];
// start the component options
$options = [];
$options['-1'] = 'COM_COMPONENTBUILDER__SEARCH_ALL_';
// load component options from array
foreach($this->item['components'] as $component)
{
$options[(int) $component->id] = $this->escape($component->name);
}
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'settings');
}
// table attributes
$attributes = [
'type' => 'list',
'name' => 'table_name',
'label' => 'COM_COMPONENTBUILDER_TABLES',
'class' => 'list_class',
'description' => 'COM_COMPONENTBUILDER_SELECT_THE_TABLE_TO_SEARCH',
'required' => 'true',
'default' => -1];
// start the component options
$options = [];
$options['-1'] = 'COM_COMPONENTBUILDER__SEARCH_ALL_';
// load table options from array
foreach($this->item['tables'] as $table)
{
$options[$table] = $this->escape($table);
}
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'settings');
}
// editor attributes
$attributes = [
'type' => 'editor',
'name' => 'item_code',
'label' => 'COM_COMPONENTBUILDER_ITEM_CODE',
'width' => '100%',
'height' => '150px',
'class' => 'item_code_editor',
'syntax' => 'php',
'buttons' => 'false',
'filter' => 'raw',
'editor' => 'codemirror|none'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'view');
}
// return the form array
return $form;
}
return null;
}
/**
* Prepares the document
*/
protected function setDocument()
{
// always make sure jquery is loaded.
JHtml::_('jquery.framework');
// Load the header checker class.
require_once( JPATH_COMPONENT_ADMINISTRATOR.'/helpers/headercheck.php' );
// Initialize the header checker.
$HeaderCheck = new componentbuilderHeaderCheck;
// always load these files.
$this->document->addStyleSheet(JURI::root(true) . "/media/com_componentbuilder/datatable/css/datatables.min.css", (ComponentbuilderHelper::jVersion()->isCompatible("3.8.0")) ? array("version" => "auto") : "text/css");
$this->document->addScript(JURI::root(true) . "/media/com_componentbuilder/datatable/js/pdfmake.min.js", (ComponentbuilderHelper::jVersion()->isCompatible("3.8.0")) ? array("version" => "auto") : "text/javascript");
$this->document->addScript(JURI::root(true) . "/media/com_componentbuilder/datatable/js/vfs_fonts.js", (ComponentbuilderHelper::jVersion()->isCompatible("3.8.0")) ? array("version" => "auto") : "text/javascript");
$this->document->addScript(JURI::root(true) . "/media/com_componentbuilder/datatable/js/datatables.min.js", (ComponentbuilderHelper::jVersion()->isCompatible("3.8.0")) ? array("version" => "auto") : "text/javascript");
// Add View JavaScript File
$this->document->addScript(JURI::root(true) . "/administrator/components/com_componentbuilder/assets/js/search.js", (ComponentbuilderHelper::jVersion()->isCompatible("3.8.0")) ? array("version" => "auto") : "text/javascript");
// Load uikit options.
$uikit = $this->params->get('uikit_load');
// Set script size.
$size = $this->params->get('uikit_min');
// Set css style.
$style = $this->params->get('uikit_style');
// The uikit css.
if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
{
JHtml::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']);
}
// The uikit js.
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
{
JHtml::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']);
}
// Load the script to find all uikit components needed.
if ($uikit != 2)
{
// Set the default uikit components in this view.
$uikitComp = array();
$uikitComp[] = 'UIkit.notify';
$uikitComp[] = 'uk-progress';
}
// Load the needed uikit components in this view.
if ($uikit != 2 && isset($uikitComp) && ComponentbuilderHelper::checkArray($uikitComp))
{
// load just in case.
jimport('joomla.filesystem.file');
// loading...
foreach ($uikitComp as $class)
{
foreach (ComponentbuilderHelper::$uk_components[$class] as $name)
{
// check if the CSS file exists.
if (File::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css'))
{
// load the css.
JHtml::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']);
}
// check if the JavaScript file exists.
if (File::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js'))
{
// load the js.
JHtml::_('script', 'media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']);
}
}
}
}
// add the document default css file
$this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_componentbuilder/assets/css/search.css', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
// hide the main menu
$this->app->input->set('hidemainmenu', true);
// 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 = JText::_('COM_COMPONENTBUILDER_SEARCH');
}
// add title to the page
JToolbarHelper::title($title,'search');
// add cpanel button
JToolBarHelper::custom('search.dashboard', 'grid-2', '', 'COM_COMPONENTBUILDER_DASH', false);
if ($this->canDo->get('search.compiler'))
{
// add Compiler button.
JToolBarHelper::custom('search.openCompiler', 'cogs custom-button-opencompiler', '', 'COM_COMPONENTBUILDER_COMPILER', false);
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('search');
if (ComponentbuilderHelper::checkString($this->help_url))
{
JToolbarHelper::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');
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
*
* @return mixed The escaped value.
*/
public function escape($var)
{
// use the helper htmlEscape method instead.
return ComponentbuilderHelper::htmlEscape($var, $this->_charset);
}
}
?>

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="4" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>9th July, 2022</creationDate>
<creationDate>4th November, 2022</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>3.1.2</version>
<version>3.1.11</version>
<description><![CDATA[
<h1>Component Builder (v.3.1.2)</h1>
<h1>Component Builder (v.3.1.11)</h1>
<div style="clear: both;"></div>
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
@ -39,6 +39,7 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo
<folder>js</folder>
<folder>css</folder>
<folder>images</folder>
<folder>datatable</folder>
<folder>uikit-v2</folder>
<folder>footable-v3</folder>
</media>
@ -74,6 +75,7 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo
<submenu>
<!-- Instead of link you can specify individual link attributes -->
<menu option="com_componentbuilder" view="compiler">COM_COMPONENTBUILDER_MENU_COMPILER</menu>
<menu option="com_componentbuilder" view="search">COM_COMPONENTBUILDER_MENU_SEARCH</menu>
<menu option="com_componentbuilder" view="joomla_components">COM_COMPONENTBUILDER_MENU_JOOMLA_COMPONENTS</menu>
<menu option="com_componentbuilder" view="joomla_modules">COM_COMPONENTBUILDER_MENU_JOOMLA_MODULES</menu>
<menu option="com_componentbuilder" view="joomla_plugins">COM_COMPONENTBUILDER_MENU_JOOMLA_PLUGINS</menu>
@ -120,6 +122,6 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo
</administration>
<updateservers>
<server type="extension" enabled="1" element="com_componentbuilder" name="Component Builder">https://git.vdm.dev/joomla/Component-Builder/raw/branch/staging/componentbuilder_update_server.xml</server>
<server type="extension" enabled="1" element="com_componentbuilder" name="Component Builder">https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/componentbuilder_update_server.xml</server>
</updateservers>
</extension>

View File

@ -1079,10 +1079,28 @@
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>3.1.2</version>
<version>3.1.5</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.1.2.zip</downloadurl>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.1.5.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
</tags>
<maintainer>Llewellyn van der Merwe</maintainer>
<maintainerurl>https://dev.vdm.io</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</update>
<update>
<name>Component Builder</name>
<description>Builds Complex Joomla Components</description>
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>3.1.11</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.1.11.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>

View File

@ -1,13 +1,13 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Gitea;

View File

@ -1,13 +1,13 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Gitea;

View File

@ -1,13 +1,13 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Gitea;

View File

@ -1,13 +1,13 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Gitea\Package\Repo;

View File

@ -1,13 +1,13 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Gitea\Package\Repo;

View File

@ -0,0 +1,131 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Abstraction;
use Joomla\Registry\Registry as JoomlaRegistry;
use Joomla\CMS\Factory;
use Joomla\Input\Input;
use VDM\Joomla\Utilities\Component\Helper;
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
/**
* Config
*
* @since 3.2.0
*/
abstract class BaseConfig extends JoomlaRegistry
{
/**
* Hold a JInput object for easier access to the input variables.
*
* @var Input
* @since 3.2.0
*/
protected $input;
/**
* The Params
*
* @var JoomlaRegistry
* @since 3.2.0
*/
protected JoomlaRegistry $params;
/**
* Constructor
*
* @param Input|null $input Input
* @param Registry|null $params The component parameters
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Input $input = null, ?JoomlaRegistry $params = null)
{
$this->input = $input ?: Factory::getApplication()->input;
$this->params = $params ?: Helper::getParams('com_componentbuilder');
// use underscore as the separator
$this->separator = '_';
// Instantiate the internal data object.
$this->data = new \stdClass();
}
/**
* setting any config value
*
* @param String $key The value's key/path name
* @param mixed $value Optional default value, returned if the internal value is null.
*
* @since 3.2.0
*/
public function __set($key, $value)
{
$this->set($key, $value);
}
/**
* getting any valid value
*
* @param String $key The value's key/path name
*
* @since 3.2.0
* @throws \InvalidArgumentException If $key is not a valid function name.
*/
public function __get($key)
{
// check if it has been set
if (($value = $this->get($key, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_')
{
return $value;
}
throw new \InvalidArgumentException(sprintf('Argument %s could not be found as function or path.', $key));
}
/**
* Get a config value.
*
* @param string $path Registry path (e.g. joomla.content.showauthor)
* @param mixed $default Optional default value, returned if the internal value is null.
*
* @return mixed Value of entry or null
*
* @since 3.2.0
*/
public function get($path, $default = null)
{
// function name with no underscores
$method = 'get' . ucfirst(ClassfunctionHelper::safe(str_replace('_', '', $path)));
// check if it has been set
if (($value = parent::get($path, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_')
{
return $value;
}
elseif (method_exists($this, $method))
{
$value = $this->{$method}();
$this->set($path, $value);
return $value;
}
return $default;
}
}

View File

@ -0,0 +1,49 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Abstraction;
use Joomla\Registry\Registry as JoomlaRegistry;
/**
* Registry
*
* So we have full control over this class
*
* @since 3.2.0
*/
abstract class BaseRegistry extends JoomlaRegistry implements \JsonSerializable, \ArrayAccess, \IteratorAggregate, \Countable
{
/**
* Method to iterate over any part of the registry
*
* @param string $path Registry path (e.g. joomla.content.showauthor)
*
* @return \ArrayIterator This object represented as an ArrayIterator.
*
* @since 3.4.0
*/
public function _($path)
{
$data = $this->extract($path);
if ($data === null)
{
return null;
}
return $data->getIterator();
}
}

View File

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

View File

@ -0,0 +1,145 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\Component;
use Joomla\CMS\Factory;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Component\PlaceholderInterface;
/**
* Get a Components Global Placeholders
*
* @since 3.2.0
*/
class Placeholder implements PlaceholderInterface
{
/**
* Placeholders
*
* @var array
* @since 3.2.0
**/
protected $placeholders = null;
/**
* Compiler Config
*
* @var Config
* @since 3.2.0
**/
protected $config;
/**
* Database object to query local DB
*
* @var \JDatabaseDriver
* @since 3.2.0
**/
protected $db;
/**
* Constructor.
*
* @param Config $config The compiler config object.
* @param \JDatabaseDriver $db The Database Driver object.
*
* @since 3.2.0
**/
public function __construct(?Config $config = null, ?\JDatabaseDriver $db = null)
{
$this->config = $config ?: Compiler::_('Config');
$this->db = $db ?: Factory::getDbo();
}
/**
* get all System Placeholders
*
* @return array The global placeholders
*
* @since 3.2.0
*/
public function get(): array
{
// set only once
if (is_array($this->placeholders))
{
return $this->placeholders;
}
// load the config
$config = $this->config;
// load the db
$db = $this->db;
// reset bucket
$bucket = array();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.target', 'a.value')));
// from these tables
$query->from('#__componentbuilder_placeholder AS a');
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the items
$db->execute();
if ($db->getNumRows())
{
$bucket = $db->loadAssocList('target', 'value');
// open all the code
foreach ($bucket as $key => &$code)
{
$code = base64_decode($code);
}
}
// set component place holders
$bucket[Placefix::_h('component')] = $config->component_code_name;
$bucket[Placefix::_h('Component')] = StringHelper::safe($config->component_code_name, 'F');
$bucket[Placefix::_h('COMPONENT')] = StringHelper::safe($config->component_code_name, 'U');
$bucket[Placefix::_('component')] = $bucket[Placefix::_h('component')];
$bucket[Placefix::_('Component')] = $bucket[Placefix::_h('Component')];
$bucket[Placefix::_('COMPONENT')] = $bucket[Placefix::_h('COMPONENT')];
$bucket[Placefix::_h('LANG_PREFIX')] = $config->lang_prefix;
$bucket[Placefix::_('LANG_PREFIX')] = $bucket[Placefix::_h('LANG_PREFIX')];
// get the current components overrides
if (($_placeholders = GetHelper::var(
'component_placeholders', $config->component_id,
'joomla_component', 'addplaceholders'
)) !== false
&& JsonHelper::check($_placeholders))
{
$_placeholders = json_decode($_placeholders, true);
if (ArrayHelper::check($_placeholders))
{
foreach ($_placeholders as $row)
{
$bucket[$row['target']] = $row['value'];
}
}
}
$this->placeholders = $bucket;
return $bucket;
}
}

View File

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

View File

@ -0,0 +1,421 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
/**
* Compiler Configurations
*
* @since 3.2.0
*/
class Config extends BaseConfig
{
/**
* get posted component id
*
* @return int Component id
* @since 3.2.0
*/
protected function getComponentid(): int
{
return $this->input->post->get('component_id', 0, 'INT');
}
/**
* get components code name
*
* @return string The components code name
* @since 3.2.0
*/
protected function getComponentcodename(): string
{
// get components code name
return StringHelper::safe(GetHelper::var(
'joomla_component', $this->component_id, 'id', 'name_code'
));
}
/**
* get component context
*
* @return string The component context
* @since 3.2.0
*/
protected function getComponentcontext(): string
{
// get component context
return $this->component_code_name . '.' . $this->component_id;
}
/**
* get component code name length
*
* @return int The component code name length
* @since 3.2.0
*/
protected function getComponentcodenamelength(): int
{
// get component name length
return strlen($this->component_code_name);
}
/**
* get posted Joomla version
*
* @return int Joomla version code
* @since 3.2.0
*/
protected function getJoomlaversion(): int
{
return $this->input->post->get('joomla_version', 3, 'INT');
}
/**
* get posted Joomla version name
*
* @return string Joomla version code name
* @since 3.2.0
*/
protected function getJoomlaversionname(): string
{
return StringHelper::safe($this->joomla_version);
}
/**
* get indentation value
*
* @return string Indentation value
* @since 3.2.0
*/
protected function getIndentationvalue(): string
{
return "\t"; // TODO add to GUI as an Global Option?
}
/**
* get posted backup switch
*
* @return int Backup switch number
* @since 3.2.0
*/
protected function getBackup(): int
{
return $this->input->post->get('backup', 0, 'INT');
}
/**
* get posted repository switch
*
* @return int Repository switch number
* @since 3.2.0
*/
protected function getRepository(): int
{
return $this->input->post->get('repository', 0, 'INT');
}
/**
* get posted debuglinenr switch
*
* @return int Debuglinenr switch number
* @since 3.2.0
*/
protected function getDebuglinenr(): int
{
// get posted value
$value = $this->input->post->get('debug_line_nr', 2, 'INT');
// get active value
$add = ($value == 0) ? false : (
($value == 1) ? true : (
((int) GetHelper::var('joomla_component', $this->component_id, 'id', 'debug_linenr' ) == 1) ? true : false
)
);
return $add;
}
/**
* get posted minify switch
*
* @return int Minify switch number
* @since 3.2.0
*/
protected function getMinify(): int
{
$minify = $this->input->post->get('minify', 2, 'INT');
// if value is 2 use global value
$minify = ($minify != 2) ? $minify : $this->params->get('minify', 0);
return $minify;
}
/**
* get posted remove line breaks switch
*
* @return bool Remove line breaks switch number
* @since 3.2.0
*/
protected function getRemovelinebreaks(): bool
{
$value = 2; // 2 is global (use the components value) TODO: get from post
// get active value
$remove = ($value == 0) ? false : (
($value == 1) ? true : (
((int) GetHelper::var('joomla_component', $this->component_id, 'id', 'remove_line_breaks' ) == 1) ? true : false
)
);
return $remove;
}
/**
* get system tidy state
*
* @return bool Tidy is active
* @since 3.2.0
*/
protected function getTidy(): bool
{
// check if we have Tidy enabled
return \extension_loaded('Tidy');
}
/**
* get language tag
*
* @return string The active language tag
* @since 3.2.0
*/
protected function getLangtag(): string
{
// get the global language
return $this->params->get('language', 'en-GB');
}
/**
* get language prefix
*
* @return string The language prefix
* @since 3.2.0
*/
protected function getLangprefix(): string
{
// get components code name
return 'COM_' . StringHelper::safe(GetHelper::var(
'joomla_component', $this->component_id, 'id', 'name_code'
), 'U');
}
/**
* get language target
*
* @return string The language active target
* @since 3.2.0
*/
protected function getLangtarget(): string
{
// we start with admin
// but this is a switch value and is changed many times
return 'admin';
}
/**
* get language string targets
*
* @return array The language prefix
* @since 3.2.0
*/
protected function getLangstringtargets(): array
{
// these strings are used to search for language strings in all content
return array_values($this->lang_string_key_targets);
}
/**
* get language string targets (by key name)
*
* @return array The language prefix
* @since 3.2.0
*/
protected function getLangstringkeytargets(): array
{
// these strings are used to search for language strings in all content
return [
'jjt' => 'Joomla' . '.JText._(',
'js' => 'JText:' . ':script(',
't' => 'Text:' . ':_(', // namespace and J version will be found
'ts' => 'Text:' . ':sprintf(', // namespace and J version will be found
'jt' => 'JustTEXT:' . ':_('
];
}
/**
* get field builder type
*
* @return int The field builder type
* @since 3.2.0
*/
protected function getFieldbuildertype(): int
{
// get the field type builder
return $this->params->get(
'compiler_field_builder_type', 2
);
}
/**
* get compiler path
*
* @return string The compiler path
* @since 3.2.0
*/
protected function getCompilerpath(): string
{
// get the compiler path
return $this->params->get(
'compiler_folder_path',
JPATH_COMPONENT_ADMINISTRATOR . '/compiler'
);
}
/**
* get jcb powers path
*
* @return string The jcb powers path
* @since 3.2.0
*/
protected function getJcbpowerspath(): string
{
// get jcb powers path
return $this->params->get('jcb_powers_path', 'libraries/jcb_powers');
}
/**
* get switch to add assets table fix
*
* @return int Switch number to add assets table fix
* @since 3.2.0
*/
protected function getAddassetstablefix(): int
{
// get global add assets table fix
$global = $this->params->get(
'assets_table_fix', 1
);
// get component value
$add = (($add_assets_table_fix = (int) GetHelper::var(
'joomla_component', $this->component_id, 'id',
'assets_table_fix'
)) == 3) ? $global : $add_assets_table_fix;
return $add;
}
/**
* get switch add placeholders
*
* @return bool Switch to add placeholders
* @since 3.2.0
*/
protected function getAddplaceholders(): bool
{
// get posted value
$value = $this->input->post->get('add_placeholders', 2, 'INT');
// get active value
$add = ($value == 0) ? false : (
($value == 1) ? true : (
((int) GetHelper::var('joomla_component', $this->component_id, 'id', 'add_placeholders' ) == 1) ? true : false
)
);
return $add;
}
/**
* get switch add power
*
* @return bool Switch to add power
* @since 3.2.0
*/
protected function getAddpower(): bool
{
// get posted value
$value = $this->input->post->get('powers', 2, 'INT');
// get active value
$add = ($value == 0) ? false : (
($value == 1) ? true : (
((int) GetHelper::var('joomla_component', $this->component_id, 'id', 'add_powers' ) == 1) ? true : false
)
);
return $add;
}
/**
* get switch build target switch
*
* @return string Switch to control the build flow
* @since 3.2.0
*/
protected function getBuildtarget(): string
{
// we start with admin
// but this is a switch value and is changed many times
return 'admin';
}
/**
* get basic encryption switch
*
* @return bool Switch to control the encryption
* @since 3.2.0
*/
protected function getBasicencryption(): bool
{
return false;
}
/**
* get medium encryption switch
*
* @return bool Switch to control the encryption
* @since 3.2.0
*/
protected function getMediumencryption(): bool
{
return false;
}
/**
* get whmcs encryption switch
*
* @return bool Switch to control the encryption
* @since 3.2.0
*/
protected function getWhmcsencryption(): bool
{
return false;
}
}

View File

@ -0,0 +1,637 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler;
use Joomla\CMS\Factory;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Language\Extractor;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\External;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\CustomcodeInterface;
/**
* Compiler Custom Code
*
* @since 3.2.0
*/
class Customcode implements CustomcodeInterface
{
/**
* The function name memory ids
*
* @var array
* @since 3.2.0
**/
public array $functionNameMemory = [];
/**
* The active custom code
*
* @var array
* @since 3.2.0
*/
public $active = [];
/**
* The custom code memory
*
* @var array
* @since 3.2.0
*/
public $memory = [];
/**
* The placeholders for custom code keys
*
* @var array
*/
protected $keys
= array(
'&#91;' => '[',
'&#93;' => ']',
'&#44;' => ',',
'&#43;' => '+',
'&#61;' => '='
);
/**
* The custom code to be added
*
* @var array
* @since 3.2.0
*/
protected $data = [];
/**
* Compiler Config
*
* @var Config
* @since 3.2.0
**/
protected Config $config;
/**
* Compiler Placeholder
*
* @var Placeholder
* @since 3.2.0
**/
protected Placeholder $placeholder;
/**
* Compiler Language Extractor
*
* @var Extractor
* @since 3.2.0
**/
protected Extractor $extractor;
/**
* Compiler Custom Code External
*
* @var External
* @since 3.2.0
**/
protected External $external;
/**
* Database object to query local DB
*
* @var \JDatabaseDriver
* @since 3.2.0
**/
protected $db;
/**
* Constructor.
*
* @param Config|null $config The compiler config object.
* @param Placeholder|null $placeholder The compiler placeholder object.
* @param Extractor|null $extractor The compiler language extractor object.
* @param External|null $external The compiler external custom code object.
* @param \JDatabaseDriver $db The Database Driver object.
*
* @since 3.2.0
*/
public function __construct(?Config $config = null, ?Placeholder $placeholder = null,
?Extractor $extractor = null, ?External $external = null, ?\JDatabaseDriver $db = null)
{
$this->config = $config ?: Compiler::_('Config');
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
$this->extractor = $extractor ?: Compiler::_('Language.Extractor');
$this->external = $external ?: Compiler::_('Customcode.External');
$this->db = $db ?: Factory::getDbo();
}
/**
* Update **ALL** dynamic values in a 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
* @since 3.2.0
*/
public function update(string $string, int $debug = 0): string
{
if (StringHelper::check($string))
{
$string = $this->extractor->engine(
$this->set(
$this->external->set($string, $debug), $debug
)
);
}
// if debug
if ($debug)
{
jexit();
}
return $string;
}
/**
* 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
* @param int|null $not The not switch
*
* @return string
* @since 3.2.0
*/
public function set(string $string, int $debug = 0, ?int $not = null): string
{
// insure the code is loaded
$loaded = false;
// check if content has custom code place holder
if (strpos($string, '[CUSTO' . 'MCODE=') !== false)
{
// if debug
if ($debug)
{
echo 'Custom Code String:';
var_dump($string);
}
// the ids found in this content
$bucket = array();
$found = GetHelper::allBetween(
$string, '[CUSTO' . 'MCODE=', ']'
);
if (ArrayHelper::check($found))
{
foreach ($found as $key)
{
// if debug
if ($debug)
{
echo '$key before update:';
var_dump($key);
}
// check if we have args
if (is_numeric($key))
{
$id = (int) $key;
}
elseif (StringHelper::check($key)
&& strpos($key, '+') === false)
{
$getFuncName = trim($key);
if (!isset($this->functionNameMemory[$getFuncName]))
{
if (!$found_local = GetHelper::var(
'custom_code', $getFuncName, 'function_name',
'id'
))
{
continue;
}
$this->functionNameMemory[$getFuncName]
= $found_local;
}
$id = (int) $this->functionNameMemory[$getFuncName];
}
elseif (StringHelper::check($key)
&& strpos(
$key, '+'
) !== false)
{
$array = explode('+', $key);
// set ID
if (is_numeric($array[0]))
{
$id = (int) $array[0];
}
elseif (StringHelper::check($array[0]))
{
$getFuncName = trim($array[0]);
if (!isset($this->functionNameMemory[$getFuncName]))
{
if (!$found_local
= GetHelper::var(
'custom_code', $getFuncName,
'function_name', 'id'
))
{
continue;
}
$this->functionNameMemory[$getFuncName]
= $found_local;
}
$id = (int) $this->functionNameMemory[$getFuncName];
}
else
{
continue;
}
// load args for this ID
if (isset($array[1]))
{
if (!isset($this->data[$id]['args']))
{
$this->data[$id]['args'] = array();
}
// only load if not already loaded
if (!isset($this->data[$id]['args'][$key]))
{
if (strpos($array[1], ',') !== false)
{
// update the function values with the custom code key placeholders (this allow the use of [] + and , in the values)
$this->data[$id]['args'][$key]
= array_map(
function ($_key) {
return $this->placeholder->update(
$_key,
$this->keys
);
}, (array) explode(',', $array[1])
);
}
elseif (StringHelper::check(
$array[1]
))
{
$this->data[$id]['args'][$key]
= array();
// update the function values with the custom code key placeholders (this allow the use of [] + and , in the values)
$this->data[$id]['args'][$key][]
= $this->placeholder->update(
$array[1],
$this->keys
);
}
}
}
}
else
{
continue;
}
// make sure to remove the not if set
if ($not && is_numeric($not) && $not > 0 && $not == $id)
{
continue;
}
$bucket[$id] = $id;
}
}
// if debug
if ($debug)
{
echo 'Bucket:';
var_dump($bucket);
}
// check if any custom code placeholders where found
if (ArrayHelper::check($bucket))
{
$_tmpLang = $this->config->lang_target;
// insure we add the langs to both site and admin
$this->config->lang_target = 'both';
// now load the code to memory
$loaded = $this->get($bucket, false, $debug);
// revert lang to current setting
$this->config->lang_target = $_tmpLang;
}
// if debug
if ($debug)
{
echo 'Loaded:';
var_dump($loaded);
}
// when the custom code is loaded
if ($loaded === true)
{
$string = $this->insert($bucket, $string, $debug);
}
// if debug
if ($debug)
{
echo 'Custom Code String After Update:';
var_dump($string);
}
}
return $string;
}
/**
* Load the custom code from the system
*
* @param array|null $ids The custom code ides if known
* @param bool $setLang The set lang switch
* @param int $debug The switch to debug the update
*
* @return bool
* @since 3.2.0
*/
public function get(?array $ids = null, bool $setLang = true, $debug = 0): bool
{
// should the result be stored in memory
$loadInMemory = false;
// Create a new query object.
$query = $this->db->getQuery(true);
$query->from(
$this->db->quoteName('#__componentbuilder_custom_code', 'a')
);
if (ArrayHelper::check($ids))
{
if (($idArray = $this->check($ids)) !== false)
{
$query->select(
$this->db->quoteName(
array('a.id', 'a.code', 'a.comment_type')
)
);
$query->where(
$this->db->quoteName('a.id') . ' IN (' . implode(
',', $idArray
) . ')'
);
$query->where(
$this->db->quoteName('a.target') . ' = 2'
); // <--- to load the correct target
$loadInMemory = true;
}
else
{
// all values are already in memory continue
return true;
}
}
else
{
$query->select(
$this->db->quoteName(
array('a.id', 'a.code', 'a.comment_type', 'a.component',
'a.from_line', 'a.hashtarget', 'a.hashendtarget',
'a.path', 'a.to_line', 'a.type')
)
);
$query->where(
$this->db->quoteName('a.component') . ' = '
. (int) $this->config->component_id
);
$query->where(
$this->db->quoteName('a.target') . ' = 1'
); // <--- to load the correct target
$query->order(
$this->db->quoteName('a.from_line') . ' ASC'
); // <--- insure we always add code from top of file
// reset custom code
$this->active = array();
}
$query->where($this->db->quoteName('a.published') . ' >= 1');
$this->db->setQuery($query);
$this->db->execute();
if ($this->db->getNumRows())
{
$bucket = $this->db->loadAssocList('id');
// open the code
foreach ($bucket as $nr => &$customCode)
{
$customCode['code'] = base64_decode($customCode['code']);
// always insure that the external code is loaded
$customCode['code'] = $this->external->set(
$customCode['code']
);
// set the lang only if needed (we do the other later when we add it to the correct position)
if ($setLang)
{
$customCode['code'] = $this->extractor->engine(
$customCode['code']
);
}
// check for more custom code (since this is a custom code placeholder)
else
{
$customCode['code'] = $this->set(
$customCode['code'], $debug, $nr
);
}
// build the hash array
if (isset($customCode['hashtarget']))
{
$customCode['hashtarget'] = explode(
"__", $customCode['hashtarget']
);
// is this a replace code, set end has array
if ($customCode['type'] == 1
&& strpos($customCode['hashendtarget'], '__') !== false)
{
$customCode['hashendtarget'] = explode(
"__", $customCode['hashendtarget']
);
// NOW see if this is an end of page target (TODO not sure if the string is always d41d8cd98f00b204e9800998ecf8427e)
// I know this fix is not air-tight, but it should work as the value of an empty line when md5'ed is ^^^^
// Then if the line number is only >>>one<<< it is almost always end of the page.
// So I am using those two values to detect end of page replace ending, to avoid mismatching the ending target hash.
if ($customCode['hashendtarget'][0] == 1
&& 'd41d8cd98f00b204e9800998ecf8427e' === $customCode['hashendtarget'][1])
{
// unset since this will force the replacement unto end of page.
unset($customCode['hashendtarget']);
}
}
}
}
// load this code into memory if needed
if ($loadInMemory === true)
{
$this->memory = $this->memory + $bucket;
}
// add to active set
$this->active = array_merge($this->active, $bucket);
return true;
}
return false;
}
/**
* Insert the custom code into the string
*
* @param array|null $ids The custom code ides if known
* @param string $string The string to insert custom code into
* @param int $debug The switch to debug the update
*
* @return string on success
* @since 3.2.0
*/
protected function insert(array $ids, string $string, int $debug = 0): string
{
$code = array();
// load the code
foreach ($ids as $id)
{
$this->buildPlaceholders(
$this->memory[$id], $code, $debug
);
}
// if debug
if ($debug)
{
echo 'Place holders to Update String:';
var_dump($code);
echo 'Custom Code String Before Update:';
var_dump($string);
}
// now update the string
return $this->placeholder->update($string, $code);
}
/**
* Build custom code placeholders
*
* @param array $item The memory item
* @param array $code The custom code bucket
* @param int $debug The switch to debug the update
*
* @return void
* @since 3.2.0
*/
protected function buildPlaceholders(array $item, array &$code, int $debug = 0)
{
// check if there is args for this code
if (isset($this->data[$item['id']]['args'])
&& ArrayHelper::check(
$this->data[$item['id']]['args']
))
{
// since we have args we cant update this code via IDE (TODO)
$placeholder = $this->placeholder->keys(3, null);
// if debug
if ($debug)
{
echo 'Custom Code Placeholders:';
var_dump($placeholder);
}
// we have args and so need to load each
foreach (
$this->data[$item['id']]['args'] as $key => $args
)
{
$this->placeholder->setType('arg', $args);
// if debug
if ($debug)
{
echo 'Custom Code Global Placeholders:';
var_dump($this->placeholder->active);
}
$code['[CUSTOM' . 'CODE=' . $key . ']'] = $placeholder['start']
. PHP_EOL . $this->placeholder->update(
$item['code'], $this->placeholder->active
) . $placeholder['end'];
}
// always clear the args
$this->placeholder->clearType('arg');
}
else
{
if (($keyPlaceholder = array_search(
$item['id'], $this->functionNameMemory
)) === false)
{
$keyPlaceholder = $item['id'];
}
// check what type of place holders we should load here
$placeholderType = (int) $item['comment_type'] . '2';
if (stripos($item['code'], Placefix::b() . 'view') !== false
|| stripos($item['code'], Placefix::b() . 'sview') !== false
|| stripos($item['code'], Placefix::b() . 'arg') !== false)
{
// if view is being set dynamicly then we can't update this code via IDE (TODO)
$placeholderType = 3;
}
// if now ars were found, clear it
$this->placeholder->clearType('arg');
// load args for this code
$placeholder = $this->placeholder->keys(
$placeholderType, $item['id']
);
$code['[CUSTOM' . 'CODE=' . $keyPlaceholder . ']']
= $placeholder['start'] . PHP_EOL
. $this->placeholder->update(
$item['code'], $this->placeholder->active
) . $placeholder['end'];
}
}
/**
* check if we already have these ids in local memory
*
* @param array $ids The custom code ids
*
* @return Mixed
* @since 3.2.0
*/
protected function check(array $ids)
{
// reset custom code
$this->active = [];
foreach ($ids as $pointer => $id)
{
if (isset($this->memory[$id]))
{
$this->active[] = $this->memory[$id];
unset($ids[$pointer]);
}
}
// check if any ids left to fetch
if (ArrayHelper::check($ids))
{
return $ids;
}
return false;
}
}

View File

@ -0,0 +1,284 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\Customcode;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Customcode;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Hash;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\LockBase;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\DispenserInterface;
/**
* Compiler Custom Code Dispenser
*
* @since 3.2.0
*/
class Dispenser implements DispenserInterface
{
/**
* Customcode Dispenser Hub
*
* @var array
* @since 3.2.0
**/
public array $hub;
/**
* Compiler Placeholder
*
* @var Placeholder
* @since 3.2.0
**/
protected Placeholder $placeholder;
/**
* Compiler Customcode
*
* @var Customcode
* @since 3.2.0
**/
protected Customcode $customcode;
/**
* Compiler Customcode in Gui
*
* @var Gui
* @since 3.2.0
**/
protected Gui $gui;
/**
* Compiler Customcode to Hash
*
* @var Hash
* @since 3.2.0
**/
protected Hash $hash;
/**
* Compiler Customcode to LockBase
*
* @var LockBase
* @since 3.2.0
**/
protected LockBase $base64;
/**
* Constructor.
*
* @param Placeholder|null $placeholder The compiler placeholder object.
* @param Customcode|null $customcode The compiler customcode object.
* @param Gui|null $gui The compiler customcode gui object.
* @param Hash|null $hash The compiler customcode hash object.
* @param LockBase|null $base64 The compiler customcode lock base64 object.
*
* @since 3.2.0
*/
public function __construct(?Placeholder $placeholder = null, ?Customcode $customcode = null,
?Gui $gui = null, ?Hash $hash = null, ?LockBase $base64 = null)
{
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
$this->customcode = $customcode ?: Compiler::_('Customcode');
$this->gui = $gui ?: Compiler::_('Customcode.Gui');
$this->hash = $hash ?: Compiler::_('Customcode.Hash');
$this->base64 = $base64 ?: Compiler::_('Customcode.LockBase');
}
/**
* 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
* @since 3.2.0
*/
public function set(&$script, string $first, ?string $second = null, ?string $third = null,
array $config = array(), bool $base64 = true, bool $dynamic = true, bool $add = false): bool
{
// only load if we have a string
if (!StringHelper::check($script))
{
return false;
}
// this needs refactoring (TODO)
if (!isset($this->hub[$first])
|| ($second
&& !isset($this->hub[$first][$second])))
{
// check if the script first key is set
if ($second && !isset($this->hub[$first]))
{
$this->hub[$first] = array();
}
elseif ($add && !$second
&& !isset($this->hub[$first]))
{
$this->hub[$first] = '';
}
// check if the script second key is set
if ($second && $third
&& !isset($this->hub[$first][$second]))
{
$this->hub[$first][$second] = array();
}
elseif ($add && $second && !$third
&& !isset($this->hub[$first][$second]))
{
$this->hub[$first][$second] = '';
}
// check if the script third key is set
if ($add && $second && $third
&& !isset($this->hub[$first][$second][$third]))
{
$this->hub[$first][$second][$third] = '';
}
}
// prep the script string
if ($base64 && $dynamic)
{
$script = $this->customcode->update(base64_decode($script));
}
elseif ($base64)
{
$script = base64_decode($script);
}
elseif ($dynamic) // this does not happen (just incase)
{
$script = $this->customcode->update($script);
}
// check if we still have a string
if (StringHelper::check($script))
{
// now load the placeholder snippet if needed
if ($base64 || $dynamic)
{
$script = $this->gui->set($script, $config);
}
// add Dynamic HASHING option of a file/string
$script = $this->hash->set($script);
// add base64 locking option of a string
$script = $this->base64->set($script);
// load the script
if ($first && $second && $third)
{
// now act on loading option
if ($add)
{
$this->hub[$first][$second][$third]
.= $script;
}
else
{
$this->hub[$first][$second][$third]
= $script;
}
}
elseif ($first && $second)
{
// now act on loading option
if ($add)
{
$this->hub[$first][$second] .= $script;
}
else
{
$this->hub[$first][$second] = $script;
}
}
else
{
// now act on loading option
if ($add)
{
$this->hub[$first] .= $script;
}
else
{
$this->hub[$first] = $script;
}
}
return true;
}
return false;
}
/**
* Get the script from the customcode dispenser
*
* @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|null $note The switch/note to add to the script
* @param bool $unset The switch to unset the value if found
* @param mixed|null $default The switch/string to use as default return if script not found
* @param string $suffix The suffix to add after the script if found
*
* @return mixed The string/script if found or the default value if not found
*
* @since 3.2.0
*/
public function get(string $first, string $second, string $prefix = '', ?string $note = null,
bool $unset = false, $default = null, string $suffix = '')
{
// default is to return an empty string
$script = '';
// check if there is any custom script
if (isset($this->hub[$first][$second])
&& StringHelper::check(
$this->hub[$first][$second]
))
{
// add not if set
if ($note)
{
$script .= $note;
}
// load the actual script
$script .= $prefix . str_replace(
array_keys($this->placeholder->active),
array_values($this->placeholder->active),
$this->hub[$first][$second]
) . $suffix;
// clear some memory
if ($unset)
{
unset($this->hub[$first][$second]);
}
}
// if not found return default
if (!StringHelper::check($script) && $default)
{
return $default;
}
return $script;
}
}

View File

@ -0,0 +1,407 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\Customcode;
use Joomla\CMS\Factory;
use Joomla\CMS\User\User;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\Path;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\ExternalInterface;
/**
* Compiler External Custom Code
*
* @since 3.2.0
*/
class External implements ExternalInterface
{
/**
* The external code/string to be added
*
* @var array
* @since 3.2.0
*/
protected array $code = [];
/**
* The external code/string cutter
*
* @var array
* @since 3.2.0
*/
protected array $cutter = [];
/**
* Compiler Placeholder
*
* @var Placeholder
* @since 3.2.0
**/
protected Placeholder $placeholder;
/**
* Database object to query local DB
*
* @var \JDatabaseDriver
* @since 3.2.0
**/
protected \JDatabaseDriver $db;
/**
* User object
*
* @var User
* @since 3.2.0
**/
protected User $user;
/**
* Database object to query local DB
*
* @var CMSApplication
* @since 3.2.0
**/
protected CMSApplication $app;
/**
* Constructor.
*
* @param Placeholder|null $placeholder The compiler placeholder object.
* @param \JDatabaseDriver|null $db The Database Driver object.
* @param User|null $user The User object.
* @param CMSApplication|null $app The CMS Application object.
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Placeholder $placeholder = null,
?\JDatabaseDriver $db = null, ?User $user = null, ?CMSApplication $app = null)
{
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
$this->db = $db ?: Factory::getDbo();
$this->user = $user ?: Factory::getUser();
$this->app = $app ?: Factory::getApplication();
}
/**
* 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
* @since 3.2.0
*/
public function set(string $string, int $debug = 0): string
{
// check if content has custom code placeholder
if (strpos($string, '[EXTERNA' . 'LCODE=') !== false)
{
// if debug
if ($debug)
{
echo 'External Code String:';
var_dump($string);
}
// target content
$bucket = array();
$found = GetHelper::allBetween(
$string, '[EXTERNA' . 'LCODE=', ']'
);
if (ArrayHelper::check($found))
{
// build local bucket
foreach ($found as $target)
{
// check for cutting sequence
// example: >{3|4
// will cut 3 rows at top and 4 rows at bottom
// if the external code has 8 or more lines
if (($pos = strpos($target, '>{')) !== false)
{
// the length
$target_len = strlen($target);
// where to cut
$cutting = $target_len - $pos;
// get the sequence
$sequence = substr($target, "-$cutting");
// remove from the URL
$target_url = str_replace($sequence, '', $target);
// set the cut key for this target if not set
$this->cutter[trim($target)] = str_replace('>{', '', $sequence);
}
else
{
$target_url = $target;
}
// check if the target is valid URL or path
if ((!filter_var($target_url, FILTER_VALIDATE_URL) === false
&& FileHelper::exists($target_url))
|| (Path::clean($target_url) === $target_url
&& FileHelper::exists($target_url)))
{
$this->getCode($target, $bucket);
}
// give notice that target is not a valid url/path
else
{
// set key
$key = '[EXTERNA' . 'LCODE=' . $target . ']';
// set the notice
$this->app->enqueueMessage(
Text::_('COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_WARNINGHTHREE'
), 'Warning'
);
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_THE_BSB_IS_NOT_A_VALID_URLPATH',
$key
), 'Warning'
);
// remove the placeholder
$bucket[$key] = '';
}
}
// now update local string if bucket has values
if (ArrayHelper::check($bucket))
{
$string = $this->placeholder->update($string, $bucket);
}
}
// if debug
if ($debug)
{
echo 'External Code String After Update:';
var_dump($string);
}
}
return $string;
}
/**
* Get the External Code/String
*
* @param string $string The content to check
* @param array $bucket The Placeholders bucket
*
* @return void
* @since 3.2.0
*/
protected function getCode(string $target, array &$bucket)
{
// set URL key
$target_key = trim($target);
// set key
$key = '[EXTERNA' . 'LCODE=' . $target . ']';
// remove the cut sequence from the url
if (isset($this->cutter[$target_key]))
{
// remove from the URL
$target_url = trim(str_replace('>{' . $this->cutter[$target_key], '', $target));
}
else
{
$target_url = trim($target);
}
// check if we already fetched this
if (!isset($this->code[$target_key]))
{
// get the data string (code)
$this->code[$target_key]
= FileHelper::getContent($target_url);
// check if we must cut this
if (isset($this->cutter[$target_key]) &&
$this->cutter[$target_key])
{
$this->code[$target_key] = $this->cut(
$this->code[$target_key],
$this->cutter[$target_key],
$key
);
}
// did we get any value
if (StringHelper::check(
$this->code[$target_key]
))
{
// check for changes
$live_hash = md5($this->code[$target_key]);
// check if it exists local
if ($hash = GetHelper::var(
'external_code', $target_key, 'target', 'hash'
))
{
// must be an admin make a change to use EXTERNAL code (we may add a custom access switch - use ADMIN for now)
if ($hash !== $live_hash && $this->user->authorise(
'core.admin', 'com_componentbuilder'
))
{
// update the hash since it changed
$object = new \stdClass();
$object->target = $target_key;
$object->hash = $live_hash;
// update local hash
$this->db->updateObject(
'#__componentbuilder_external_code', $object,
'target'
);
// give notice of the change
$this->app->enqueueMessage(
Text::_('COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_WARNINGHTHREE'),
'Warning'
);
$this->app->enqueueMessage(
Text::sprintf('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',
$key
), 'Warning'
);
}
elseif ($hash !== $live_hash)
{
// set the notice
$this->app->enqueueMessage(
Text::_('COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_ERRORHTHREE'),
'Error'
);
$this->app->enqueueMessage(
Text::sprintf('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',
$this->user->get('name'), $key
), 'Error'
);
// remove the code/string
$this->code[$target_key] = '';
}
}
// only an admin can add new EXTERNAL code (we may add a custom access switch - use ADMIN for now)
elseif ($this->user->authorise(
'core.admin', 'com_componentbuilder'
))
{
// add the hash to track changes
$object = new \stdClass();
$object->target = $target_key;
$object->hash = $live_hash;
// insert local hash
$this->db->insertObject(
'#__componentbuilder_external_code', $object
);
// give notice the first time this is added
$this->app->enqueueMessage(
Text::_('COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_NOTICEHTHREE'),
'Warning'
);
$this->app->enqueueMessage(
Text::sprintf('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',
$key
), 'Warning'
);
}
else
{
// set the notice
$this->app->enqueueMessage(
Text::_('COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_ERRORHTHREE'),
'Error'
);
$this->app->enqueueMessage(
Text::sprintf('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',
$this->user->get('name'), $key
), 'Error'
);
// remove the code/string
$this->code[$target_key] = '';
}
}
else
{
// set notice that we could not get a valid string from the target
$this->app->enqueueMessage(
Text::_('COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_WARNINGHTHREE'), 'Error'
);
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_THE_BSB_RETURNED_AN_INVALID_STRING', $key
), 'Error'
);
}
}
// add to local bucket
if (isset($this->code[$target_key]))
{
// update the placeholder with the external code string
$bucket[$key] = $this->code[$target_key];
}
else
{
// remove the placeholder
$bucket[$key] = '';
}
}
/**
* 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
* @since 3.2.0
*/
protected function cut(string $string, string $sequence, string $key): string
{
// we first break the string up in rows
$rows = (array) explode(PHP_EOL, $string);
// get the cutting sequence
$cutter = (array) explode('|', $sequence);
// we only continue if we have more rows than we have to cut
if (array_sum($cutter) < ArrayHelper::check($rows))
{
// remove the rows at the bottom if needed
if (isset($cutter[1]) && $cutter[1] > 0)
{
array_splice($rows, "-$cutter[1]");
}
// remove the rows at the top if needed
if ($cutter[0] > 0)
{
$rows = array_splice($rows, $cutter[0]);
}
// return the remaining rows
return implode(PHP_EOL, $rows);
}
// we set an error message about too few lines to cut
$this->app->enqueueMessage(
Text::_('COM_COMPONENTBUILDER_HR_HTHREEEXTERNAL_CODE_NOTICEHTHREE'),
'Error'
);
$this->app->enqueueMessage(
Text::sprintf('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',
$key
), 'Error'
);
return '';
}
}

View File

@ -0,0 +1,928 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\Customcode;
use Joomla\CMS\Factory;
use Joomla\CMS\User\User;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Language\Text;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Extractor\Paths;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder\Reverse;
use VDM\Joomla\Componentbuilder\Compiler\Component\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Path;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\ExtractorInterface;
/**
* Compiler Custom Code Extractor
*
* 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 = !==[INSERT>$$$$]==> !==[/INSERT>$$$$]==>
* New Replace Code = !==[REPLACE>$$$$]==> !==[/REPLACE>$$$$]==>
*
* ///////////////////////////////// when JCB adds it back ///////////////////////////////
* JCB Add Inserted Code =
* JCB Add Replaced Code =
*
* //////////////////////////// changeing existing custom code ///////////////////////////
* Update Inserted Code = !==[INSERTED>$$$$]==> !==[/INSERTED>$$$$]==>
* Update Replaced Code = !==[REPLACED>$$$$]==> !==[/REPLACED>$$$$]==>
*
* ////////23 is the ID of the code in the system don't change it!!!!!!!!!!!!!!!!!!!!!!!!!!
*
* More info read: https://git.vdm.dev/joomla/Component-Builder/wiki/TIPS:-Custom-Code
*
* @since 3.2.0
*/
class Extractor implements ExtractorInterface
{
/**
* The placeholder keys
*
* @var array
* @since 3.2.0
*/
protected array $PKeys
= [
1 => 'REPLACE<>$$$$]',
2 => 'INSERT<>$$$$]',
3 => 'REPLACED<>$$$$]',
4 => 'INSERTED<>$$$$]'
];
/**
* The custom code in local files that already exist in system
*
* @var array
* @since 3.2.0
*/
protected array $existing = [];
/**
* The custom code in local files that are new
*
* @var array
* @since 3.2.0
*/
protected array $new = [];
/**
* The index of code already loaded
*
* @var array
* @since 3.2.0
*/
protected array $done = [];
/**
* The search counter
*
* @var array
* @since 3.2.0
*/
protected array $counter = [1 => 0, 2 => 0];
/**
* The file types to search
*
* @var array
* @since 3.2.0
*/
protected array $fileTypes = ['\.php', '\.js', '\.xml'];
/**
* The local placeholders
*
* @var array
* @since 3.2.0
*/
protected array $placeholders;
/**
* Today's date in SQL format
*
* @var string
* @since 3.2.0
*/
protected string $today;
/**
* Compiler Config
*
* @var Config
* @since 3.2.0
**/
protected Config $config;
/**
* Compiler Customcode Gui
*
* @var Gui
* @since 3.2.0
**/
protected Gui $gui;
/**
* Compiler Customcode Extractor Paths
*
* @var Paths
* @since 3.2.0
**/
protected Paths $paths;
/**
* Compiler Placeholder Reverse
*
* @var Reverse
* @since 3.2.0
**/
protected Reverse $reverse;
/**
* Compiler Component Placeholder
*
* @var Placeholder
* @since 3.2.0
**/
protected Placeholder $componentPlaceholder;
/**
* Current User Object
*
* @var User
* @since 3.2.0
**/
protected User $user;
/**
* Database object to query local DB
*
* @var \JDatabaseDriver
* @since 3.2.0
**/
protected \JDatabaseDriver $db;
/**
* Database object to query local DB
*
* @var CMSApplication
* @since 3.2.0
**/
protected CMSApplication $app;
/**
* Constructor.
*
* @param Config|null $config The compiler config object.
* @param Gui|null $gui The compiler customcode gui object.
* @param Paths|null $paths The compiler customcode extractor paths object.
* @param Reverse|null $reverse The compiler placeholder reverse object.
* @param Placeholder|null $placeholder The compiler component placeholder object.
* @param User|null $user The current User object.
* @param \JDatabaseDriver|null $db The Database Driver object.
* @param CMSApplication|null $app The CMS Application object.
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Config $config = null, ?Gui $gui = null, ?Paths $paths = null,
?Reverse $reverse = null, ?Placeholder $placeholder = null,
?User $user = null, ?\JDatabaseDriver $db = null, ?CMSApplication $app = null)
{
$this->config = $config ?: Compiler::_('Config');
$this->gui = $gui ?: Compiler::_('Customcode.Gui');
$this->paths = $paths ?: Compiler::_('Customcode.Extractor.Paths');
$this->reverse = $reverse ?: Compiler::_('Placeholder.Reverse');
$this->componentPlaceholder = $placeholder ?: Compiler::_('Component.Placeholder');
$this->user = $user ?: Factory::getUser();
$this->db = $db ?: Factory::getDbo();
$this->app = $app ?: Factory::getApplication();
// set today's date
$this->today = Factory::getDate()->toSql();
// set some local placeholders
$placeholders = array_flip(
$this->componentPlaceholder->get()
);
$placeholders[StringHelper::safe(
$this->config->component_code_name, 'F'
) . 'Helper::'] = Placefix::_('Component') . 'Helper::';
$placeholders['COM_' . StringHelper::safe(
$this->config->component_code_name, 'U'
)] = 'COM_' . Placefix::_('COMPONENT');
$placeholders['com_' . $this->config->component_code_name] = 'com_' . Placefix::_('component');
// set the local placeholders
$this->placeholders = array_reverse($placeholders, true);
}
/**
* get the custom code from the local files
*
* @return void
* @since 3.2.0
*/
public function run()
{
// we must first store the current working directory
$joomla = getcwd();
foreach ($this->paths->active as $target => $path)
{
// we are changing the working directory to the component path
chdir($path);
foreach ($this->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)
{
// search the file
$this->searchFileContent($file, $target);
// insert new code
$this->insert(100);
// update existing custom code
$this->update(30);
}
}
}
}
// change back to Joomla working directory
chdir($joomla);
// make sure all code is stored
$this->insert();
// update existing custom code
$this->update();
}
/**
* search a file for placeholders and store result
*
* @param string $file The file path to search
*
* @return array on success
* @since 3.2.0
*/
protected function searchFileContent(&$file, &$target)
{
// we add a new search for the GUI CODE Blocks
$this->gui->search($file, $this->placeholders, $this->today, $target);
// reset each time per file
$loadEndFingerPrint = false;
$endFingerPrint = [];
$fingerPrint = [];
$codeBucket = [];
$pointer = [];
$reading = [];
$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 must 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 ($this->PKeys 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 = '<!--[' . $search . '-->';
$endHTML = '<!--[/' . $search . '-->';
// check if the ending placeholder 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->new[$pointer[$targetKey]][]
= $this->db->quote(
(int) $lineNumber
); // 'toline'
// first reverse engineer this code block
$c0de = $this->reverse->engine(
implode('', $codeBucket[$pointer[$targetKey]]),
$this->placeholders, $target
);
$this->new[$pointer[$targetKey]][]
= $this->db->quote(
base64_encode($c0de)
); // 'code'
if ($_type == 2)
{
// load the last value
$this->new[$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->existing[$pointer[$targetKey]]['fields'][]
= $this->db->quoteName('to_line') . ' = '
. $this->db->quote($lineNumber);
// first reverse engineer this code block
$c0de = $this->reverse->engine(
implode('', $codeBucket[$pointer[$targetKey]]),
$this->placeholders, $target,
$this->existing[$pointer[$targetKey]]['id']
);
$this->existing[$pointer[$targetKey]]['fields'][]
= $this->db->quoteName('code') . ' = '
. $this->db->quote(base64_encode($c0de));
if ($_type == 2)
{
// load the last value
$this->existing[$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->new[$pointer[$targetKey]][]
= $this->db->quote(
$hashendtarget
); // 'hashendtarget'
}
// the record already exist so we must update
elseif ($i === 2)
{
$this->existing[$pointer[$targetKey]]['fields'][]
= $this->db->quoteName('hashendtarget') . ' = '
. $this->db->quote($hashendtarget);
}
// reset the needed values
$endFingerPrint = [];
$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(
Text::_('COM_COMPONENTBUILDER_HR_HTHREECUSTOM_CODES_WARNINGHTHREE'),
'Warning'
);
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_WE_FOUND_DYNAMIC_CODE_BALL_IN_ONE_LINEB_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->done[$id]))
{
// reset found comment type
$commentType = 0;
continue;
}
// store the id to avoid duplication
$this->done[$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] = $this->counter[$i];
// activate the reader
$reading[$targetKey] = true;
// start code bucket
$codeBucket[$pointer[$targetKey]] = [];
// 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
Path::fix($path);
// all new records we can do a bulk insert
if ($i === 1 || !$id)
{
// start the bucket for this code
$this->new[$pointer[$targetKey]] = [];
$this->new[$pointer[$targetKey]][]
= $this->db->quote(
$path
); // 'path'
$this->new[$pointer[$targetKey]][]
= $this->db->quote(
(int) $_type
); // 'type'
$this->new[$pointer[$targetKey]][]
= $this->db->quote(
1
); // 'target'
$this->new[$pointer[$targetKey]][]
= $this->db->quote(
$commentType
); // 'comment_type'
$this->new[$pointer[$targetKey]][]
= $this->db->quote(
(int) $this->config->component_id
); // 'component'
$this->new[$pointer[$targetKey]][]
= $this->db->quote(
1
); // 'published'
$this->new[$pointer[$targetKey]][]
= $this->db->quote(
$this->today
); // 'created'
$this->new[$pointer[$targetKey]][]
= $this->db->quote(
(int) $this->user->id
); // 'created_by'
$this->new[$pointer[$targetKey]][]
= $this->db->quote(
1
); // 'version'
$this->new[$pointer[$targetKey]][]
= $this->db->quote(
1
); // 'access'
$this->new[$pointer[$targetKey]][]
= $this->db->quote(
$hashtarget
); // 'hashtarget'
$this->new[$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->existing[$pointer[$targetKey]] = [];
$this->existing[$pointer[$targetKey]]['id']
= (int) $id;
$this->existing[$pointer[$targetKey]]['conditions'] = [];
$this->existing[$pointer[$targetKey]]['conditions'][]
= $this->db->quoteName('id') . ' = '
. $this->db->quote($id);
$this->existing[$pointer[$targetKey]]['fields'] = [];
$this->existing[$pointer[$targetKey]]['fields'][]
= $this->db->quoteName('path') . ' = '
. $this->db->quote($path);
$this->existing[$pointer[$targetKey]]['fields'][]
= $this->db->quoteName('type') . ' = '
. $this->db->quote($_type);
$this->existing[$pointer[$targetKey]]['fields'][]
= $this->db->quoteName('comment_type') . ' = '
. $this->db->quote($commentType);
$this->existing[$pointer[$targetKey]]['fields'][]
= $this->db->quoteName('component') . ' = '
. $this->db->quote($this->config->component_id);
$this->existing[$pointer[$targetKey]]['fields'][]
= $this->db->quoteName('from_line') . ' = '
. $this->db->quote($lineNumber);
$this->existing[$pointer[$targetKey]]['fields'][]
= $this->db->quoteName('modified') . ' = '
. $this->db->quote($this->today);
$this->existing[$pointer[$targetKey]]['fields'][]
= $this->db->quoteName('modified_by') . ' = '
. $this->db->quote($this->user->id);
$this->existing[$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
$this->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->new[$pointer[$backupTargetKey]][]
= $this->db->quote($hashendtarget); // 'hashendtarget'
}
// the record already exist so we must use module to update
elseif ($backupI === 2)
{
$this->existing[$pointer[$backupTargetKey]]['fields'][]
= $this->db->quoteName('hashendtarget') . ' = '
. $this->db->quote($hashendtarget);
}
}
}
/**
* Insert the code
*
* @param int $when To set when to update
*
* @return void
* @since 3.2.0
*/
protected function insert(int $when = 1)
{
if (ArrayHelper::check($this->new) >= $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->new 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->new = [];
if (!$continue)
{
return; // insure we don't 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 code
*
* @param int $when To set when to update
*
* @return void
* @since 3.2.0
*/
protected function update(int $when = 1)
{
if (ArrayHelper::check($this->existing) >= $when)
{
foreach ($this->existing 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->existing = [];
}
}
/**
* 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 string on success
* @since 3.2.0
*/
protected function setStartReplace(int $id, int $commentType, string $startReplace): string
{
if ($id > 0)
{
switch ($commentType)
{
case 1: // the PHP & JS type
$startReplace .= '/*' . $id . '*/';
break;
case 2: // the HTML type
$startReplace .= '<!--' . $id . '-->';
break;
}
}
return $startReplace;
}
/**
* 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|int true on success
* @since 3.2.0
*/
protected function addLineChecker(string $replaceKey, int $type, string $lineContent)
{
$check = explode($replaceKey, $lineContent);
switch ($type)
{
case 1:
// beginning of code
if (isset($check[1]) && StringHelper::check($check[1]))
{
return trim($check[1]);
}
break;
case 2:
// end of code
if (isset($check[0]) && StringHelper::check($check[0]))
{
return trim($check[0]);
}
break;
}
return false;
}
/**
* search for the system id in the line given
*
* @param string $lineContent The file path to search
* @param array $placeholders The values to search for
* @param int $commentType The comment type
*
* @return mixed on success
* @since 3.2.0
*/
protected function getSystemID(string &$lineContent, array $placeholders, int $commentType)
{
$trim = '/';
if ($commentType == 2)
{
$trim = '<!--';
}
// remove place holder from content
$string = trim(
str_replace($placeholders[$commentType] . $trim, '', $lineContent)
);
// now get all numbers
$numbers = [];
preg_match_all('!\d+!', $string, $numbers);
// return the first number
if (isset($numbers[0])
&& ArrayHelper::check(
$numbers[0]
))
{
return reset($numbers[0]);
}
return false;
}
}

View File

@ -0,0 +1,429 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\Customcode\Extractor;
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\Folder;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Component\Placeholder as ComponentPlaceholder;
use VDM\Joomla\Componentbuilder\Compiler\Customcode;
use VDM\Joomla\Componentbuilder\Compiler\Language\Extractor;
/**
* Compiler Custom Code Paths
*
* @since 3.2.0
*/
class Paths
{
/**
* The local paths
*
* @var array
* @since 3.2.0
**/
public array $active = [];
/**
* Compiler Component Placeholder
*
* @var array
* @since 3.2.0
**/
protected array $componentPlaceholder;
/**
* Compiler Config
*
* @var Config
* @since 3.2.0
**/
protected Config $config;
/**
* Compiler Placeholder
*
* @var Placeholder
* @since 3.2.0
**/
protected Placeholder $placeholder;
/**
* Compiler Customcode
*
* @var Customcode
* @since 3.2.0
**/
protected Customcode $customcode;
/**
* Compiler Language Extractor
*
* @var Extractor
* @since 3.2.0
**/
protected Extractor $extractor;
/**
* Database object to query local DB
*
* @var \JDatabaseDriver
* @since 3.2.0
**/
protected \JDatabaseDriver $db;
/**
* Constructor.
*
* @param Config|null $config The compiler config object.
* @param Placeholder|null $placeholder The compiler placeholder object.
* @param ComponentPlaceholder|null $componentPlaceholder The compiler component placeholder object.
* @param Customcode|null $customcode The compiler customcode object.
* @param Extractor|null $extractor The compiler language extractor object.
* @param \JDatabaseDriver|null $db The Database Driver object.
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Config $config = null, ?Placeholder $placeholder = null,
?ComponentPlaceholder $componentPlaceholder = null, ?Customcode $customcode = null,
?Extractor $extractor = null, ?\JDatabaseDriver $db = null)
{
$this->config = $config ?: Compiler::_('Config');
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
/** @var ComponentPlaceholder $componentPlaceholder */
$componentPlaceholder = $componentPlaceholder ?: Compiler::_('Component.Placeholder');
$this->customcode = $customcode ?: Compiler::_('Customcode');
$this->extractor = $extractor ?: Compiler::_('Language.Extractor');
$this->db = $db ?: Factory::getDbo();
// load the placeholders to local array
$this->componentPlaceholder = $componentPlaceholder->get();
// load the paths on initialization
$this->load();
}
/**
* get the local installed path of this component
*
* @return void
* @since 3.2.0
*/
protected function load()
{
// set the local paths to search
$local_paths = array();
// admin path
$local_paths['admin'] = JPATH_ADMINISTRATOR . '/components/com_'
. $this->config->component_code_name;
// site path
$local_paths['site'] = JPATH_ROOT . '/components/com_'
. $this->config->component_code_name;
// media path
$local_paths['media'] = JPATH_ROOT . '/media/com_'
. $this->config->component_code_name;
// power path
$local_paths['power'] = JPATH_ROOT . '/' . $this->config->get('jcb_powers_path', 'libraries/jcb_powers');
// lets also go over the REPOS - TODO
// Painful but we need to folder paths for the linked modules
if (($module_ids = $this->getModuleIDs()) !== false)
{
foreach ($module_ids as $module_id)
{
// get the module folder path
if (($path = $this->getModulePath($module_id)) !== false)
{
// set the path
$local_paths['module_' . str_replace('/', '_', $path)] = $path;
}
}
}
// Painful but we need to folder paths for the linked plugins
if (($plugin_ids = $this->getPluginIDs()) !== false)
{
foreach ($plugin_ids as $plugin_id)
{
// get the plugin group and folder name
if (($path = $this->getPluginPath($plugin_id)) !== false)
{
// set the path
$local_paths['plugin_' . str_replace('/', '_', $path)] = JPATH_ROOT . '/plugins/' . $path;
}
}
}
// check if the local install is found
foreach ($local_paths as $key => $localPath)
{
if (!Folder::exists($localPath))
{
unset($local_paths[$key]);
}
}
if (ArrayHelper::check($local_paths))
{
$this->active = $local_paths;
}
}
/**
* get the Joomla Modules IDs
*
* @return mixed of IDs on success
* @since 3.2.0
*/
protected function getModuleIDs()
{
if (($addjoomla_modules = GetHelper::var(
'component_modules', $this->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;
}
/**
* get the Joomla module path
*
* @return mixed of module path and target site area on success
* @since 3.2.0
*/
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 = $this->placeholder->update(
$this->customcode->update($module->name),
$this->componentPlaceholder
);
// 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
$this->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 plugins IDs
*
* @return mixed of IDs on success
* @since 3.2.0
*/
protected function getPluginIDs()
{
if (($addjoomla_plugins = GetHelper::var(
'component_plugins', $this->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 mixed of plugin path on success
* @deprecated 3.3
*/
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 = $this->placeholder->update(
$this->customcode->update($plugin->name),
$this->componentPlaceholder
);
// 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
$this->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;
}
}

View File

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

View File

@ -0,0 +1,257 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\Customcode;
use Joomla\CMS\Factory;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Language\Text;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\String\FieldHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder\Reverse;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\GuiInterface;
/**
* Compiler Gui Custom Code
*
* @since 3.2.0
*/
class Gui implements GuiInterface
{
/**
* Compiler Config
*
* @var Config
* @since 3.2.0
**/
protected Config $config;
/**
* Compiler Placeholder Reverse
*
* @var Reverse
* @since 3.2.0
**/
protected Reverse $reverse;
/**
* Database object to query local DB
*
* @var \JDatabaseDriver
* @since 3.2.0
**/
protected \JDatabaseDriver $db;
/**
* Database object to query local DB
*
* @var CMSApplication
* @since 3.2.0
**/
protected CMSApplication $app;
/**
* Constructor.
*
* @param Config|null $config The compiler config object.
* @param Reverse|null $reverse The compiler placeholder reverse object.
* @param \JDatabaseDriver|null $db The Database Driver object.
* @param CMSApplication|null $app The CMS Application object.
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Config $config = null, ?Reverse $reverse = null,
?\JDatabaseDriver $db = null, ?CMSApplication $app = null)
{
$this->config = $config ?: Compiler::_('Config');
$this->reverse = $reverse ?: Compiler::_('Placeholder.Reverse');
$this->db = $db ?: Factory::getDbo();
$this->app = $app ?: Factory::getApplication();
}
/**
* Set the JCB GUI code placeholder
*
* @param string $string The code string
* @param array $config The placeholder config values
*
* @return string
* @since 3.2.0
*/
public function set(string $string, array $config): string
{
if (StringHelper::check($string))
{
if ($this->config->get('add_placeholders', false)
&& $this->check($string) && ArrayHelper::check($config)
&& isset($config['table']) && StringHelper::check($config['table'])
&& isset($config['field']) && StringHelper::check($config['field'])
&& isset($config['type']) && StringHelper::check($config['type'])
&& isset($config['id']) && is_numeric($config['id']))
{
// if we have a key we must get the ID
if (isset($config['key']) && StringHelper::check($config['key']) && $config['key'] !== 'id')
{
if (($id = GetHelper::var($config['table'], $config['id'], $config['key'], 'id')) !== false && is_numeric($id))
{
$config['id'] = $id;
}
else
{
// we must give a error message to inform the user of this issue. (should never happen)
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_ID_MISMATCH_WAS_DETECTED_WITH_THE_SSSS_GUI_CODE_FIELD_SO_THE_PLACEHOLDER_WAS_NOT_SET',
$config['table'], $config['field'],
$config['key'], $config['id']
), 'Error'
);
// check some config
if (!isset($config['prefix']))
{
$config['prefix'] = '';
}
return $config['prefix'] . $string;
}
}
// check some config
if (!isset($config['prefix']))
{
$config['prefix'] = PHP_EOL;
}
// add placeholder based on type of code
switch (strtolower($config['type']))
{
// adding with html commenting
case 'html':
$front = $config['prefix'] . '<!--' . '[JCBGUI.';
$sufix = '$$$$]-->' . PHP_EOL;
$back = '<!--[/JCBGUI' . $sufix;
break;
// adding with php commenting
default:
$front = $config['prefix'] . '/***' . '[JCBGUI.';
$sufix = '$$$$]***/' . PHP_EOL;
$back = '/***[/JCBGUI' . $sufix;
break;
}
return $front . $config['table'] . '.' . $config['field'] . '.'
. $config['id'] . '.' . $sufix . $string . $back;
}
// check some config
if (!isset($config['prefix']))
{
$config['prefix'] = '';
}
return $config['prefix'] . $string;
}
return $string;
}
/**
* 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
* @since 3.2.0
*/
public function search(string &$file, array &$placeholders, string &$today, string &$target)
{
// get file content
$file_conent = FileHelper::getContent($file);
$guiCode = array();
// we add a new search for the GUI CODE Blocks
$guiCode[] = GetHelper::allBetween(
$file_conent, '/***[JCB' . 'GUI<>', '/***[/JCBGUI' . '$$$$]***/'
);
$guiCode[] = GetHelper::allBetween(
$file_conent, '<!--[JCB' . 'GUI<>', '<!--[/JCBGUI' . '$$$$]-->'
);
if (($guiCode = ArrayHelper::merge($guiCode)) !== false
&& ArrayHelper::check($guiCode, true))
{
foreach ($guiCode as $code)
{
$first_line = strtok($code, PHP_EOL);
// get the GUI target details
$query = explode('.', trim($first_line, '.'));
// only continue if we have 3 values in the query
if (is_array($query) && count($query) >= 3)
{
// cleanup the newlines around the code
$code = trim(str_replace($first_line, '', $code), PHP_EOL)
. PHP_EOL;
// set the ID
$id = (int) $query[2];
// make the field name save
$field = FieldHelper::safe($query[1]);
// make the table name save
$table = StringHelper::safe($query[0]);
// reverse placeholder as much as we can
$code = $this->reverse->engine(
$code, $placeholders, $target, $id, $field, $table
);
// update the GUI/Tables/Database
$object = new \stdClass();
$object->id = $id;
$object->{$field} = base64_encode(
$code
); // (TODO) this may not always work...
// update the value in GUI
$this->db->updateObject(
'#__componentbuilder_' . (string) $table, $object, 'id'
);
}
}
}
}
/**
* 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 bool true if GUI code placeholders can be added
* @since 3.2.0
*/
protected function check(string &$code): bool
{
// 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;
}
}

View File

@ -0,0 +1,110 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\Customcode;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
/**
* Compiler Custom Code MD5
*
* @since 3.2.0
*/
class Hash
{
/**
* Compiler Placeholder
*
* @var Placeholder
* @since 3.2.0
**/
protected Placeholder $placeholder;
/**
* Constructor.
*
* @param Placeholder|null $placeholder The compiler placeholder object.
*
* @since 3.2.0
*/
public function __construct(?Placeholder $placeholder = null)
{
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
}
/**
* Set the MD5 hashed string or file or string
*
* @param string $script The code string
*
* @return string
* @since 3.2.0
*/
public function set(string $script): string
{
// check if we should hash a string
if (\strpos($script, 'HASH' . 'STRING((((') !== false)
{
// get the strings
$values = GetHelper::allBetween(
$script, 'HASH' . 'STRING((((', '))))'
);
$locker = array();
// convert them
foreach ($values as $value)
{
$locker['HASH' . 'STRING((((' . $value . '))))']
= \md5($value);
}
// update the script
return $this->placeholder->update($script, $locker);
}
// check if we should hash a file
if (\strpos($script, 'HASH' . 'FILE((((') !== false)
{
// get the strings
$values = GetHelper::allBetween(
$script, 'HASH' . 'FILE((((', '))))'
);
$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['HASH' . 'FILE((((' . $path . '))))']
= \md5($value);
}
else
{
// could not retrieve the file so we show error
$locker['HASH' . 'FILE((((' . $path . '))))']
= 'ERROR';
}
}
// update the script
return $this->placeholder->update($script, $locker);
}
return $script;
}
}

View File

@ -0,0 +1,86 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\Customcode;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\LockBaseInterface;
/**
* Compiler Custom Code Base64
*
* @since 3.2.0
*/
class LockBase implements LockBaseInterface
{
/**
* Compiler Placeholder
*
* @var Placeholder
* @since 3.2.0
**/
protected Placeholder $placeholder;
/**
* Constructor.
*
* @param Placeholder|null $placeholder The compiler placeholder object.
*
* @since 3.2.0
*/
public function __construct(?Placeholder $placeholder = null)
{
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
}
/**
* Set a string as bsae64 (basic)
*
* @param string $script The code string
*
* @return string
* @since 3.2.0
*/
public function set(string $script): string
{
if (\strpos($script, 'LOCK'.'BASE64((((') !== false)
{
// get the strings
$values = GetHelper::allBetween(
$script, 'LOCK'.'BASE64((((', '))))'
);
$locker = array();
// convert them
foreach ($values as $value)
{
$locker['LOCK'.'BASE64((((' . $value . '))))']
= "base64_decode( preg_replace('/\s+/', ''," .
PHP_EOL . Indent::_(2) . "'" .
\wordwrap(
\base64_encode($value), 64, PHP_EOL . Indent::_(2), true
) .
"'))";
}
// update the script
return $this->placeholder->update($script, $locker);
}
return $script;
}
}

View File

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

View File

@ -0,0 +1,371 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\Extension\JoomlaThree;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Extension\InstallInterface;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\GetScriptInterface;
/**
* Loading the Extension Installation Script Class
*
* @since 3.2.0
*/
class InstallScript implements GetScriptInterface
{
/**
* The extension
*
* @var InstallInterface|Object
* @since 3.2.0
*/
protected object $extension;
/**
* The methods
*
* @var array
* @since 3.2.0
*/
protected array $methods = ['php_script', 'php_preflight', 'php_postflight', 'php_method'];
/**
* The types
*
* @var array
* @since 3.2.0
*/
protected array $types = ['construct', 'install', 'update', 'uninstall', 'discover_install'];
/**
* The construct bucket
*
* @var array
* @since 3.2.0
*/
protected array $construct = [];
/**
* The install bucket
*
* @var array
* @since 3.2.0
*/
protected array $install = [];
/**
* The update bucket
*
* @var array
* @since 3.2.0
*/
protected array $update = [];
/**
* The uninstall bucket
*
* @var array
* @since 3.2.0
*/
protected array $uninstall = [];
/**
* The preflight switch
*
* @var bool
* @since 3.2.0
*/
protected bool $preflightActive = false;
/**
* The preflight bucket
*
* @var array
* @since 3.2.0
*/
protected array $preflightBucket = ['install' => [], 'uninstall' => [], 'discover_install' => [], 'update' => []];
/**
* The postflight switch
*
* @var bool
* @since 3.2.0
*/
protected bool $postflightActive = false;
/**
* The postflight bucket
*
* @var array
* @since 3.2.0
*/
protected array $postflightBucket = ['install' => [], 'uninstall' => [], 'discover_install' => [], 'update' => []];
/**
* get install script
*
* @param Object $extension The extension object
*
* @return string
* @since 3.2.0
*/
public function get(object $extension): string
{
// loop over methods and types
foreach ($this->methods as $method)
{
foreach ($this->types as $type)
{
if (isset($extension->{'add_' . $method . '_' . $type})
&& $extension->{'add_' . $method . '_' . $type} == 1
&& StringHelper::check(
$extension->{$method . '_' . $type}
))
{
// add to the main methods
if ('php_method' === $method || 'php_script' === $method)
{
$this->{$type}[] = $extension->{$method . '_' . $type};
}
else
{
// get the flight key
$flight = str_replace('php_', '', $method);
// load the script to our bucket
$this->{$flight . 'Bucket'}[$type][] = $extension->{$method . '_' . $type};
// show that the method is active
$this->{$flight . 'Active'} = true;
}
}
}
}
$this->extension = $extension;
// return the class
return $this->build();
}
/**
* build the install class
*
* @return string
* @since 3.2.0
*/
protected function build(): string
{
// start build
$script = $this->head();
// load constructor if set
$script .= $this->construct();
// load install method if set
$script .= $this->main('install');
// load update method if set
$script .= $this->main('update');
// load uninstall method if set
$script .= $this->main('uninstall');
// load preflight method if set
$script .= $this->flight('preflight');
// load postflight method if set
$script .= $this->flight('postflight');
// close the class
$script .= PHP_EOL . '}' . PHP_EOL;
return $script;
}
/**
* get install script head
*
* @return string
* @since 3.2.0
*/
protected function head(): string
{
// get the extension
$extension = $this->extension;
// start build
$script = PHP_EOL . '/**';
$script .= PHP_EOL . ' * ' . $extension->official_name
. ' script file.';
$script .= PHP_EOL . ' *';
$script .= PHP_EOL . ' * @package ' . $extension->class_name;
$script .= PHP_EOL . ' */';
$script .= PHP_EOL . 'class ' . $extension->installer_class_name;
$script .= PHP_EOL . '{';
return $script;
}
/**
* get constructor
*
* @return string
* @since 3.2.0
*/
protected function construct(): string
{
// return empty string if not set
if (!ArrayHelper::check($this->construct))
{
return '';
}
// the __construct script
$script = PHP_EOL . PHP_EOL . Indent::_(1) . '/**';
$script .= PHP_EOL . Indent::_(1) . ' * Constructor';
$script .= PHP_EOL . Indent::_(1) . ' *';
$script .= PHP_EOL . Indent::_(1)
. ' * @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script';
$script .= PHP_EOL . Indent::_(1) . ' */';
$script .= PHP_EOL . Indent::_(1)
. 'public function __construct($adapter)';
$script .= PHP_EOL . Indent::_(1) . '{';
$script .= PHP_EOL . implode(PHP_EOL . PHP_EOL, $this->construct);
// close the function
$script .= PHP_EOL . Indent::_(1) . '}';
return $script;
}
/**
* build main methods
*
* @param string $name the method being called
*
* @return string
* @since 3.2.0
*/
protected function main(string $name): string
{
// return empty string if not set
if (!ArrayHelper::check($this->{$name}))
{
return '';
}
// load the install method
$script = PHP_EOL . PHP_EOL . Indent::_(1) . '/**';
$script .= PHP_EOL . Indent::_(1) . " * Called on $name";
$script .= PHP_EOL . Indent::_(1) . ' *';
$script .= PHP_EOL . Indent::_(1)
. ' * @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script';
$script .= PHP_EOL . Indent::_(1) . ' *';
$script .= PHP_EOL . Indent::_(1)
. ' * @return boolean True on success';
$script .= PHP_EOL . Indent::_(1) . ' */';
$script .= PHP_EOL . Indent::_(1) . 'public function '
. $name . '($adapter)';
$script .= PHP_EOL . Indent::_(1) . '{';
$script .= PHP_EOL . implode(PHP_EOL . PHP_EOL, $this->{$name});
// return true
if ('uninstall' !== $name)
{
$script .= PHP_EOL . Indent::_(2) . 'return true;';
}
// close the function
$script .= PHP_EOL . Indent::_(1) . '}';
return $script;
}
/**
* build flight methods
*
* @param string $name the method being called
*
* @return string
* @since 3.2.0
*/
protected function flight(string $name): string
{
// return empty string if not set
if (empty($this->{$name . 'Active'}))
{
return '';
}
// the pre/post function types
$script = PHP_EOL . PHP_EOL . Indent::_(1) . '/**';
$script .= PHP_EOL . Indent::_(1)
. ' * Called before any type of action';
$script .= PHP_EOL . Indent::_(1) . ' *';
$script .= PHP_EOL . Indent::_(1)
. ' * @param string $route Which action is happening (install|uninstall|discover_install|update)';
$script .= PHP_EOL . Indent::_(1)
. ' * @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script';
$script .= PHP_EOL . Indent::_(1) . ' *';
$script .= PHP_EOL . Indent::_(1)
. ' * @return boolean True on success';
$script .= PHP_EOL . Indent::_(1) . ' */';
$script .= PHP_EOL . Indent::_(1) . 'public function '
. $name . '($route, $adapter)';
$script .= PHP_EOL . Indent::_(1) . '{';
$script .= PHP_EOL . Indent::_(2) . '//' . Line::_(__Line__, __Class__)
. ' get application';
$script .= PHP_EOL . Indent::_(2)
. '$app = JFactory::getApplication();' . PHP_EOL;
// add the default version check (TODO) must make this dynamic
if ('preflight' === $name)
{
$script .= PHP_EOL . Indent::_(2) . '//' . Line::_(__Line__, __Class__)
.' the default for both install and update';
$script .= PHP_EOL . Indent::_(2)
. '$jversion = new JVersion();';
$script .= PHP_EOL . Indent::_(2)
. "if (!\$jversion->isCompatible('3.8.0'))";
$script .= PHP_EOL . Indent::_(2) . '{';
$script .= PHP_EOL . Indent::_(3)
. "\$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');";
$script .= PHP_EOL . Indent::_(3) . 'return false;';
$script .= PHP_EOL . Indent::_(2) . '}' . PHP_EOL;
}
// now add the scripts
foreach ($this->{$name . 'Bucket'} as $route => $_script)
{
if (ArrayHelper::check($_script))
{
// set the if and script
$script .= PHP_EOL . Indent::_(2) . "if ('" . $route
. "' === \$route)";
$script .= PHP_EOL . Indent::_(2) . '{';
$script .= PHP_EOL . implode(
PHP_EOL . PHP_EOL, $_script
);
$script .= PHP_EOL . Indent::_(2) . '}' . PHP_EOL;
}
}
// return true
$script .= PHP_EOL . Indent::_(2) . 'return true;';
// close the function
$script .= PHP_EOL . Indent::_(1) . '}';
return $script;
}
}

View File

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

View File

@ -0,0 +1,122 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler;
use Joomla\DI\Container;
use VDM\Joomla\Componentbuilder\Compiler\Service\Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Service\Event;
use VDM\Joomla\Componentbuilder\Compiler\Service\History;
use VDM\Joomla\Componentbuilder\Compiler\Service\Language;
use VDM\Joomla\Componentbuilder\Compiler\Service\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Service\Customcode;
use VDM\Joomla\Componentbuilder\Compiler\Service\Power;
use VDM\Joomla\Componentbuilder\Compiler\Service\Component;
use VDM\Joomla\Componentbuilder\Compiler\Service\Extension;
use VDM\Joomla\Componentbuilder\Compiler\Service\Field;
/**
* Compiler Factory
*
* @since 3.2.0
*/
abstract class Factory
{
/**
* Global Compiler Container
*
* @var Container
* @since 3.2.0
**/
protected static $container = null;
/**
* Current Joomla Version Being Build
*
* @var int
* @since 3.2.0
**/
protected static $JoomlaVersion;
/**
* Get any class from the compiler container
*
* @param string $key The container class key
*
* @return mixed
* @since 3.2.0
*/
public static function _($key)
{
return self::getContainer()->get($key);
}
/**
* Get version specific class from the compiler container
*
* @param string $key The container class key
*
* @return mixed
* @since 3.2.0
*/
public static function _J($key)
{
if (empty(self::$JoomlaVersion))
{
self::$JoomlaVersion = self::getContainer()->get('Config')->joomla_version;
}
return self::getContainer()->get('J' . self::$JoomlaVersion . '.' . $key);
}
/**
* Get a the global compiler container
*
* @return Container
* @since 3.2.0
*/
public static function getContainer(): Container
{
if (!self::$container)
{
self::$container = self::createContainer();
}
return self::$container;
}
/**
* Create a container object
*
* @return Container
* @since 3.2.0
*/
protected static function createContainer(): Container
{
$container = (new Container())
->registerServiceProvider(new Compiler())
->registerServiceProvider(new Event())
->registerServiceProvider(new History())
->registerServiceProvider(new Language())
->registerServiceProvider(new Placeholder())
->registerServiceProvider(new Customcode())
->registerServiceProvider(new Power())
->registerServiceProvider(new Component())
->registerServiceProvider(new Extension())
->registerServiceProvider(new Field());
return $container;
}
}

View File

@ -0,0 +1,142 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Compiler\Field\Data;
use VDM\Joomla\Componentbuilder\Compiler\Field\Name;
use VDM\Joomla\Componentbuilder\Compiler\Field\TypeName;
use VDM\Joomla\Componentbuilder\Compiler\Field\UniqueName;
/**
* Compiler Field
*
* @since 3.2.0
*/
class Field
{
/**
* Compiler Field Data
*
* @var Data
* @since 3.2.0
**/
protected Data $data;
/**
* Compiler Field Name
*
* @var Name
* @since 3.2.0
**/
protected Name $name;
/**
* Compiler Field Type Name
*
* @var TypeName
* @since 3.2.0
**/
protected TypeName $typeName;
/**
* Compiler Field Unique Name
*
* @var UniqueName
* @since 3.2.0
**/
protected UniqueName $uniqueName;
/**
* Constructor
*
* @param Data|null $data The compiler field data object.
* @param Name|null $name The compiler field name object.
* @param TypeName|null $typeName The compiler field type name object.
* @param UniqueName|null $uniqueName The compiler field unique name object.
*
* @since 3.2.0
*/
public function __construct(?Data $data = null, ?Name $name = null, ?TypeName $typeName = null, ?UniqueName $uniqueName = null)
{
$this->data = $data ?: Compiler::_('Field.Data');
$this->name = $name ?: Compiler::_('Field.Name');
$this->typeName = $typeName ?: Compiler::_('Field.Type.Name');
$this->uniqueName = $uniqueName ?: Compiler::_('Field.Unique.Name');
}
/**
* set Field details
*
* @param array $field The field array.
* @param string|null $singleViewName The single view name.
* @param string|null $listViewName The list view name.
* @param string $amicably The peaceful resolve.
*
* @return void
* @since 3.2.0
*/
public function set(array &$field, ?string $singleViewName = null, ?string $listViewName = null, string $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->data->get(
$field['field'], $singleViewName, $listViewName
);
}
// set real field name
if (!isset($field['base_name']))
{
$field['base_name'] = $this->name->get($field);
}
// set code name for field type
if (!isset($field['type_name']))
{
$field['type_name'] = $this->typeName->get($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->uniqueName->set(
$field['base_name'], $listViewName . $amicably
);
}
}
}

View File

@ -0,0 +1,232 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\Field;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Dispenser;
/**
* Compiler Field Customcode
*
* @since 3.2.0
*/
class Customcode
{
/**
* Tracking the update of fields per/view
*
* @var array
* @since 3.2.0
*/
protected array $views;
/**
* Compiler Customcode Dispenser
*
* @var Dispenser
* @since 3.2.0
*/
protected Dispenser $dispenser;
/**
* Constructor
*
* @param Dispenser|null $dispenser The compiler customcode dispenser object.
*
* @since 3.2.0
*/
public function __construct(?Dispenser $dispenser = null)
{
$this->dispenser = $dispenser ?: Compiler::_('Customcode.Dispenser');
}
/**
* Update field customcode
*
* @param int $id The field id
* @param object $field The field object
* @param string|null $singleViewName The view edit or single name
* @param string|null $listViewName The view list name
*
* @return void
* @since 3.2.0
*/
public function update(int $id, object &$field, $singleViewName = null, $listViewName = null)
{
// check if we should load scripts for single view
if ($singleViewName && StringHelper::check($singleViewName)
&& !isset($this->views[$singleViewName][$id]))
{
// add_javascript_view_footer
if ($field->add_javascript_view_footer == 1
&& StringHelper::check(
$field->javascript_view_footer
))
{
$convert__ = true;
if (isset($field->javascript_view_footer_decoded)
&& $field->javascript_view_footer_decoded)
{
$convert__ = false;
}
$this->dispenser->set(
$field->javascript_view_footer,
'view_footer',
$singleViewName,
null,
array(
'table' => 'field',
'id' => (int) $id,
'field' => 'javascript_view_footer',
'type' => 'js',
'prefix' => PHP_EOL),
$convert__,
$convert__,
true
);
if (!isset($field->javascript_view_footer_decoded))
{
$field->javascript_view_footer_decoded
= true;
}
if (strpos($field->javascript_view_footer, "token") !== false
|| strpos($field->javascript_view_footer, "task=ajax") !== false)
{
if (!isset($this->dispenser->hub['token']))
{
$this->dispenser->hub['token'] = [];
}
if (!isset($this->dispenser->hub['token'][$singleViewName])
|| !$this->dispenser->hub['token'][$singleViewName])
{
$this->dispenser->hub['token'][$singleViewName]
= true;
}
}
}
// add_css_view
if ($field->add_css_view == 1)
{
$convert__ = true;
if (isset($field->css_view_decoded)
&& $field->css_view_decoded)
{
$convert__ = false;
}
$this->dispenser->set(
$field->css_view,
'css_view',
$singleViewName,
null,
array('prefix' => PHP_EOL),
$convert__,
$convert__,
true
);
if (!isset($field->css_view_decoded))
{
$field->css_view_decoded = true;
}
}
// add this only once to single view.
$this->views[$singleViewName][$id] = true;
}
// check if we should load scripts for list views
if ($listViewName && StringHelper::check($listViewName)
&& !isset($this->views[$listViewName][$id]))
{
// add_javascript_views_footer
if ($field->add_javascript_views_footer == 1
&& StringHelper::check(
$field->javascript_views_footer
))
{
$convert__ = true;
if (isset($field->javascript_views_footer_decoded)
&& $field->javascript_views_footer_decoded)
{
$convert__ = false;
}
$this->dispenser->set(
$field->javascript_views_footer,
'views_footer',
$singleViewName,
null,
array(
'table' => 'field',
'id' => (int) $id,
'field' => 'javascript_views_footer',
'type' => 'js',
'prefix' => PHP_EOL),
$convert__,
$convert__,
true
);
if (!isset($field->javascript_views_footer_decoded))
{
$field->javascript_views_footer_decoded = true;
}
if (strpos($field->javascript_views_footer, "token") !== false
|| strpos($field->javascript_views_footer, "task=ajax") !== false)
{
if (!isset($this->dispenser->hub['token']))
{
$this->dispenser->hub['token'] = [];
}
if (!isset($this->dispenser->hub['token'][$listViewName])
|| !$this->dispenser->hub['token'][$listViewName])
{
$this->dispenser->hub['token'][$listViewName]
= true;
}
}
}
// add_css_views
if ($field->add_css_views == 1)
{
$convert__ = true;
if (isset($field->css_views_decoded)
&& $field->css_views_decoded)
{
$convert__ = false;
}
$this->dispenser->set(
$field->css_views,
'css_views',
$singleViewName,
null,
array('prefix' => PHP_EOL),
$convert__,
$convert__,
true
);
if (!isset($field->css_views_decoded))
{
$field->css_views_decoded = true;
}
}
// add this only once to list view.
$this->views[$listViewName][$id] = true;
}
}
}

View File

@ -0,0 +1,329 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\Field;
use Joomla\CMS\Factory;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\EventInterface;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\HistoryInterface;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Customcode;
use VDM\Joomla\Componentbuilder\Compiler\Field\Customcode as FieldCustomcode;
use VDM\Joomla\Componentbuilder\Compiler\Field\Validation;
/**
* Compiler Field Data
*
* @since 3.2.0
*/
class Data
{
/**
* Compiler Fields
*
* @var array
* @since 3.2.0
*/
protected array $fields;
/**
* Compiler Config
*
* @var Config
* @since 3.2.0
*/
protected Config $config;
/**
* Compiler Event
*
* @var EventInterface
* @since 3.2.0
*/
protected EventInterface $event;
/**
* Compiler History
*
* @var HistoryInterface
* @since 3.2.0
*/
protected HistoryInterface $history;
/**
* Compiler Placeholder
*
* @var Placeholder
* @since 3.2.0
*/
protected Placeholder $placeholder;
/**
* Compiler Customcode
*
* @var Customcode
* @since 3.2.0
*/
protected Customcode $customcode;
/**
* Compiler Field Customcode
*
* @var FieldCustomcode
* @since 3.2.0
*/
protected FieldCustomcode $fieldCustomcode;
/**
* Compiler Field Validation
*
* @var Validation
* @since 3.2.0
*/
protected Validation $validation;
/**
* Database object to query local DB
*
* @var \JDatabaseDriver
* @since 3.2.0
**/
protected \JDatabaseDriver $db;
/**
* Constructor
*
* @param Config|null $config The compiler config object.
* @param EventInterface|null $event The compiler event api object.
* @param HistoryInterface|null $history The compiler history object.
* @param Placeholder|null $placeholder The compiler placeholder object.
* @param Customcode|null $customcode The compiler customcode object.
* @param FieldCustomcode|null $fieldCustomcode The field customcode object.
* @param Validation|null $validation The field validation rule object.
* @param \JDatabaseDriver|null $db The database object.
*
* @since 3.2.0
*/
public function __construct(?Config $config = null, ?EventInterface $event = null, ?HistoryInterface $history = null,
?Placeholder $placeholder = null, ?Customcode $customcode = null, ?FieldCustomcode $fieldCustomcode = null,
?Validation $validation = null, ?\JDatabaseDriver $db = null)
{
$this->config = $config ?: Compiler::_('Config');
$this->event = $event ?: Compiler::_('Event');
$this->history = $history ?: Compiler::_('History');
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
$this->customcode = $customcode ?: Compiler::_('Customcode');
$this->fieldCustomcode = $fieldCustomcode ?: Compiler::_('Field.Customcode');
$this->validation = $validation ?: Compiler::_('Field.Validation');
$this->db = $db ?: Factory::getDbo();
}
/**
* Get all Field Data
*
* @param int $id The field ID
* @param string|null $singleViewName The view edit or single name
* @param string|null $listViewName The view list name
*
* @return object|null The field data
* @since 3.2.0
*/
public function get(int $id, ?string $singleViewName = null, ?string $listViewName = null): ?object
{
if ($id > 0 && !isset($this->fields[$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)
);
// TODO we need to update the event signatures
$context = $this->config->component_context;
// Trigger Event: jcb_ce_onBeforeQueryFieldData
$this->event->trigger(
'jcb_ce_onBeforeQueryFieldData',
array(&$context, &$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
$this->event->trigger(
'jcb_ce_onBeforeModelFieldData',
array(&$context, &$field)
);
// adding a fix for the changed name of type to fieldtype
$field->type = $field->fieldtype;
// load the values form params
$field->xml = $this->customcode->update(json_decode($field->xml));
// check if we have validate (validation rule and set it if found)
$this->validation->set($id, $field->xml);
// 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
&& !$this->config->whmcs_encryption)
{
$this->config->whmcs_encryption = true;
}
// check if we have basic encryption
elseif (3 == $field->store
&& !$this->config->basic_encryption)
{
$this->config->basic_encryption = true;
}
// check if we have better encryption
elseif (5 == $field->store
&& $this->config->medium_encryption)
{
$this->config->medium_encryption = 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, $this->placeholder->update(
$this->customcode->update(
base64_decode(
$field->initiator_on_save_model
)
), $this->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, $this->placeholder->update(
$this->customcode->update(
base64_decode(
$field->initiator_on_get_model
)
), $this->placeholder->active
)
);
}
// set the field modeling
$field->model_field['save'] = explode(
PHP_EOL, $this->placeholder->update(
$this->customcode->update(
base64_decode($field->on_save_model_field)
), $this->placeholder->active
)
);
$field->model_field['get'] = explode(
PHP_EOL, $this->placeholder->update(
$this->customcode->update(
base64_decode($field->on_get_model_field)
), $this->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->history->get('field', $id);
// Trigger Event: jcb_ce_onAfterModelFieldData
$this->event->trigger(
'jcb_ce_onAfterModelFieldData',
array(&$context, &$field)
);
$this->fields[$id] = $field;
}
else
{
return null;
}
}
if ($id > 0 && isset($this->fields[$id]))
{
// update the customcode of the field
$this->fieldCustomcode->update($id, $this->fields[$id], $singleViewName, $listViewName);
// return the field
return $this->fields[$id];
}
return null;
}
}

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