Compare commits

..

7 Commits

84 changed files with 4264 additions and 609 deletions

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.6) 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.10) 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)
@ -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*: 20th September, 2022
+ *Version*: 3.1.6
+ *Last Build*: 2nd November, 2022
+ *Version*: 3.1.10
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **331597**
+ *Line count*: **333951**
+ *Field count*: **2004**
+ *File count*: **2169**
+ *Folder count*: **375**
+ *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

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.6) 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.10) 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)
@ -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*: 20th September, 2022
+ *Version*: 3.1.6
+ *Last Build*: 2nd November, 2022
+ *Version*: 3.1.10
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **331597**
+ *Line count*: **333951**
+ *Field count*: **2004**
+ *File count*: **2169**
+ *Folder count*: **375**
+ *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

@ -10,4 +10,28 @@
/* 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;
}

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

@ -0,0 +1,724 @@
/**
* @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();
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(Url + 'doSearch', options).then(response => {
total++;
// 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) {
searchProgressBarObject.innerHTML = Joomla.JText._('COM_COMPONENTBUILDER_SEARCH_FINISHED_IN') + ' ' + getSearchLenght() + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_SECONDS');
setTimeout(function () {
searchProgressObject.style.display = 'none';
}, 3000);
}
// return the json response
if (response.ok) {
return response.json();
}
}).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);
}
}).catch(error => {
console.log(error);
});
}
} 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 = Url + 'getSearchValue';
} else {
// add the line value
formData.append('line_nr', line);
// calling URL
postURL = Url + '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 () {
// we clear the table again
clearAll();
// show the search settings again
showSearch();
// clear search values
clearSearch();
// 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);
replaceAll(controller.signal, tables);
} else {
replaceAll(controller.signal, searchTables);
}
});
};
/**
* JS Function to execute the search
*/
const replaceAll = 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_replace_values = false;
let total = 0;
let index;
for (index = 0; index < tables.length; 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(Url + 'replaceAll', options).then(response => {
total++;
if (response.ok) {
return response.json();
}
}).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});
}
}).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 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);
});
};
/**
* 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(Url + '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 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

@ -67,8 +67,11 @@ class ComponentbuilderControllerAjax extends BaseController
$this->registerTask('fieldTypeProperties', 'ajax');
$this->registerTask('getFieldPropertyDesc', 'ajax');
$this->registerTask('getCodeGlueOptions', 'ajax');
$this->registerTask('searchTable', 'ajax');
$this->registerTask('updateTable', 'ajax');
$this->registerTask('doSearch', 'ajax');
$this->registerTask('replaceAll', 'ajax');
$this->registerTask('getSearchValue', 'ajax');
$this->registerTask('getReplaceValue', 'ajax');
$this->registerTask('setValue', 'ajax');
$this->registerTask('snippetDetails', 'ajax');
$this->registerTask('setSnippetGithub', 'ajax');
$this->registerTask('getSnippets', 'ajax');
@ -1633,18 +1636,19 @@ class ComponentbuilderControllerAjax extends BaseController
}
}
break;
case 'searchTable':
case 'doSearch':
try
{
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
$type_searchValue = $jinput->get('type_search', 1, 'INT');
$search_valueValue = $jinput->get('search_value', NULL, 'RAW');
$match_caseValue = $jinput->get('match_case', 0, 'INT');
$whole_wordValue = $jinput->get('whole_word', 0, 'INT');
$regex_searchValue = $jinput->get('regex_search', 0, 'INT');
$component_idValue = $jinput->get('component_id', 0, 'INT');
if($table_nameValue && $user->id != 0 && $search_valueValue)
if($table_nameValue && $user->id != 0 && $type_searchValue && $search_valueValue)
{
$result = $this->getModel('ajax')->searchTable($table_nameValue, $search_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue);
$result = $this->getModel('ajax')->doSearch($table_nameValue, $type_searchValue, $search_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue);
}
else
{
@ -1679,7 +1683,7 @@ class ComponentbuilderControllerAjax extends BaseController
}
}
break;
case 'updateTable':
case 'replaceAll':
try
{
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
@ -1691,7 +1695,148 @@ class ComponentbuilderControllerAjax extends BaseController
$component_idValue = $jinput->get('component_id', 0, 'INT');
if($table_nameValue && $user->id != 0 && $search_valueValue)
{
$result = $this->getModel('ajax')->updateTable($table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue);
$result = $this->getModel('ajax')->replaceAll($table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue);
}
else
{
$result = false;
}
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'getSearchValue':
try
{
$field_nameValue = $jinput->get('field_name', NULL, 'WORD');
$row_idValue = $jinput->get('row_id', NULL, 'INT');
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
$search_valueValue = $jinput->get('search_value', NULL, 'RAW');
$replace_valueValue = $jinput->get('replace_value', NULL, 'RAW');
$match_caseValue = $jinput->get('match_case', 0, 'INT');
$whole_wordValue = $jinput->get('whole_word', 0, 'INT');
$regex_searchValue = $jinput->get('regex_search', 0, 'INT');
if($field_nameValue && $user->id != 0 && $row_idValue && $table_nameValue && $search_valueValue)
{
$result = $this->getModel('ajax')->getSearchValue($field_nameValue, $row_idValue, $table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue);
}
else
{
$result = false;
}
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'getReplaceValue':
try
{
$field_nameValue = $jinput->get('field_name', NULL, 'WORD');
$row_idValue = $jinput->get('row_id', NULL, 'INT');
$line_nrValue = $jinput->get('line_nr', 0, 'STRING');
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
$search_valueValue = $jinput->get('search_value', NULL, 'RAW');
$replace_valueValue = $jinput->get('replace_value', NULL, 'RAW');
$match_caseValue = $jinput->get('match_case', 0, 'INT');
$whole_wordValue = $jinput->get('whole_word', 0, 'INT');
$regex_searchValue = $jinput->get('regex_search', 0, 'INT');
if($field_nameValue && $user->id != 0 && $row_idValue && $table_nameValue && $search_valueValue)
{
$result = $this->getModel('ajax')->getReplaceValue($field_nameValue, $row_idValue, $line_nrValue, $table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue);
}
else
{
$result = false;
}
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'setValue':
try
{
$valueValue = $jinput->get('value', NULL, 'RAW');
$row_idValue = $jinput->get('row_id', NULL, 'INT');
$field_nameValue = $jinput->get('field_name', NULL, 'WORD');
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
if($valueValue && $user->id != 0 && $row_idValue && $field_nameValue && $table_nameValue)
{
$result = $this->getModel('ajax')->setValue($valueValue, $row_idValue, $field_nameValue, $table_nameValue);
}
else
{

View File

@ -51,7 +51,7 @@ class ComponentbuilderControllerCompiler extends AdminController
*
* @return true on success
*/
public function getCompilerAnimations()
public function getDynamicContent()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
@ -65,7 +65,7 @@ class ComponentbuilderControllerCompiler extends AdminController
{
// get the model
$model = $this->getModel('compiler');
if ($model->getCompilerAnimations($message))
if ($model->getDynamicContent($message))
{
$message = JText::_('COM_COMPONENTBUILDER_BALL_THE_COMPILER_ANIMATIONS_WERE_SUCCESSFULLY_DOWNLOADED_TO_THIS_JOOMLA_INSTALLB');
$this->setRedirect($redirect_url, $message, 'message');

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;

View File

@ -1312,6 +1312,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"
@ -1331,6 +1332,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"
@ -1721,6 +1723,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"
@ -4704,6 +4707,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"
@ -4717,6 +4721,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"
@ -5030,6 +5036,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."
@ -5444,6 +5451,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."
@ -5487,6 +5496,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"
@ -5587,6 +5597,8 @@ 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"
@ -5609,6 +5621,7 @@ 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!"
@ -5675,6 +5688,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"
@ -7738,6 +7752,7 @@ 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_LINK="Link"
COM_COMPONENTBUILDER_LINK_LOCAL_DYNAMIC="Link & Local (dynamic)"
COM_COMPONENTBUILDER_LINK_TO_THE_CONTRIBUTOR="Link to the contributor"
@ -7749,6 +7764,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)"
@ -7756,6 +7772,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"
@ -7790,7 +7807,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_S="No instances where found %s"
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"
@ -8141,9 +8158,12 @@ 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_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."
@ -8152,18 +8172,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_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_FINISHED_IN="Search finished in"
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"
@ -8175,8 +8202,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"
@ -8317,6 +8346,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."
@ -9000,6 +9030,8 @@ COM_COMPONENTBUILDER_S_S_NUMBER_BSB_COULD_NOT_BE_DOWNLOADED_SUCCESSFULLY_TO_THIS
COM_COMPONENTBUILDER_S_WE_DETECTED_A_CHANGE_IN_BEXTERNALCODEB_BUT_YOU_DO_NOT_HAVE_PERMISSION_TO_ALLOW_THIS_CHANGE_SO_BSB_WAS_REMOVED_FROM_THE_COMPILATION_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFOBR_SMALLADMIN_ACCESS_REQUIREDSMALL="%s, we detected a change in <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_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"
@ -9196,7 +9228,10 @@ COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_EXIST="The
COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_RETURN_ANY_DATA="The url (%s) set to retrieve the packages does not return any data!"
COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JCB_SYSTEM_HAS_INTERNET_CONNECTION="The wiki can only be loaded when your JCB system has internet connection."
COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING="The wiki is loading"
COM_COMPONENTBUILDER_THIS_AREA_IS_STILL_UNDER_DEVELOPMENT_ALTHOUGH_IT_WORKS_IT_SHOULD_BE_USED_WITH_EXTREME_CAUTION_AS_ITS_NOT_STABLE="This area is still under development, although it works, it should be used with extreme caution as its not stable."
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."
@ -9272,7 +9307,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"
@ -9388,8 +9425,11 @@ COM_COMPONENTBUILDER_WE_FOUND_DYNAMIC_CODE_BALL_IN_ONE_LINEB_AND_IGNORED_IT_PLEA
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_YES="Yes"
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."
@ -9421,6 +9461,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!"

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

@ -14,7 +14,8 @@ defined('_JEXEC') or die('Restricted access');
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;
/**
@ -3609,6 +3610,7 @@ class ComponentbuilderModelAjax extends ListModel
* Search for value in a table
*
* @param string $tableName The main table to search
* @param int $typeSearch The type of search being done
* @param string $searchValue The value to search for
* @param int $matchCase The switch to control match case
* @param int $wholeWord The switch to control whole word
@ -3618,26 +3620,34 @@ class ComponentbuilderModelAjax extends ListModel
* @return array|null
* @since 3.2.0
**/
public function searchTable(string $tableName, string $searchValue,
public function doSearch(string $tableName, int $typeSearch, string $searchValue,
int $matchCase, int $wholeWord, int $regexSearch, int $componentId): ?array
{
// check if this is a valid table
if (SearchFactory::_('Table')->exist($tableName))
{
// load the configurations
SearchFactory::_('Config')->table_name = $tableName;
SearchFactory::_('Config')->search_value = $searchValue;
SearchFactory::_('Config')->match_case = $matchCase;
SearchFactory::_('Config')->whole_word = $wholeWord;
SearchFactory::_('Config')->regex_search = $regexSearch;
SearchFactory::_('Config')->component_id = $componentId;
if (($items = SearchFactory::_('Agent')->find()) !== null)
try
{
return ['success' => JText::sprintf('COM_COMPONENTBUILDER_WE_FOUND_SOME_INSTANCES_IN_S', $tableName), 'items' => $items];
}
// load the configurations
SearchFactory::_('Config')->table_name = $tableName;
SearchFactory::_('Config')->type_search = $typeSearch;
SearchFactory::_('Config')->search_value = $searchValue;
SearchFactory::_('Config')->match_case = $matchCase;
SearchFactory::_('Config')->whole_word = $wholeWord;
SearchFactory::_('Config')->regex_search = $regexSearch;
SearchFactory::_('Config')->component_id = $componentId;
return ['success' => JText::sprintf('COM_COMPONENTBUILDER_NO_INSTANCES_WHERE_FOUND_S', $tableName)];
if (($items = SearchFactory::_('Agent')->table($tableName)) !== null)
{
return ['success' => JText::sprintf('COM_COMPONENTBUILDER_WE_FOUND_SOME_INSTANCES_IN_S', $tableName), 'items' => $items];
}
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')];
@ -3648,33 +3658,159 @@ class ComponentbuilderModelAjax extends ListModel
*
* @param string $tableName The main table to search
* @param string $searchValue The value to search for
* @param string|null $replaceValue The value to replace search value
* @param int $matchCase The switch to control match case
* @param int $wholeWord The switch to control whole word
* @param int $regexSearch The switch to control regex search
* @param int $componentId The option to filter by component
* @param string|null $replaceValue The value to replace search value
* @param int $matchCase The switch to control match case
* @param int $wholeWord The switch to control whole word
* @param int $regexSearch The switch to control regex search
* @param int $componentId The option to filter by component
*
* @return array|null
* @since 3.2.0
**/
public function updateTable(string $tableName, string $searchValue, ?string $replaceValue = null,
public function replaceAll(string $tableName, string $searchValue, ?string $replaceValue = null,
int $matchCase, int $wholeWord, int $regexSearch, int $componentId): ?array
{
// check if this is a valid table
if (SearchFactory('Table')->exist($tableName))
if (SearchFactory::_('Table')->exist($tableName))
{
// load the configurations
SearchFactory('Config')->table_name = $tableName;
SearchFactory('Config')->search_value = $searchValue;
SearchFactory('Config')->replace_value = $replaceValue;
SearchFactory('Config')->match_case = $matchCase;
SearchFactory('Config')->whole_word = $wholeWord;
SearchFactory('Config')->regex_search = $regexSearch;
SearchFactory('Config')->component_id = $componentId;
try
{
// load the configurations
SearchFactory::_('Config')->table_name = $tableName;
SearchFactory::_('Config')->search_value = $searchValue;
SearchFactory::_('Config')->replace_value = $replaceValue;
SearchFactory::_('Config')->match_case = $matchCase;
SearchFactory::_('Config')->whole_word = $wholeWord;
SearchFactory::_('Config')->regex_search = $regexSearch;
SearchFactory::_('Config')->component_id = $componentId;
SearchFactory('Agent')->replace();
if (($number = SearchFactory::_('Agent')->replace()) !== 0)
{
return ['success' => JText::sprintf('COM_COMPONENTBUILDER_ALL_FOUND_INSTANCES_IN_S_WHERE_REPLACED', $tableName)];
}
return ['not_found' => JText::sprintf('COM_COMPONENTBUILDER_NO_INSTANCES_WHERE_FOUND_IN_S', $tableName)];
}
catch(Exception $error)
{
return ['error' => $error->getMessage()];
}
}
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
}
return ['success' => JText::sprintf('COM_COMPONENTBUILDER_ALL_FOUND_INSTANCES_IN_S_WHERE_REPLACED', $tableName)];
/**
* Get a selected search value from a given table and row
*
* @param string $fieldName The field key
* @param int $rowId The item ID
* @param string $tableName The table
* @param string $searchValue The value to search for
* @param string|null $replaceValue The value to replace search value
* @param int $matchCase The switch to control match case
* @param int $wholeWord The switch to control whole word
* @param int $regexSearch The switch to control regex search
*
* @return array
* @since 3.2.0
**/
public function getSearchValue(string $fieldName, int $rowId, string $tableName,
string $searchValue, ?string $replaceValue = null, int $matchCase, int $wholeWord, int $regexSearch): array
{
// check if this is a valid table and field
if ($rowId > 0 && SearchFactory::_('Table')->exist($tableName, $fieldName))
{
try
{
// load the configurations
SearchFactory::_('Config')->table_name = $tableName;
SearchFactory::_('Config')->type_search = 1;
SearchFactory::_('Config')->search_value = $searchValue;
SearchFactory::_('Config')->replace_value = $replaceValue;
SearchFactory::_('Config')->match_case = $matchCase;
SearchFactory::_('Config')->whole_word = $wholeWord;
SearchFactory::_('Config')->regex_search = $regexSearch;
if (($value = SearchFactory::_('Agent')->getValue($rowId, $fieldName, 0, $tableName)) !== null)
{
// load the value
return ['value' => $value];
}
}
catch(Exception $error)
{
return ['error' => $error->getMessage()];
}
}
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
}
/**
* Get a replaced search value from a given table and row
*
* @param string $fieldName The field key
* @param int $rowId The item ID
* @param mixed $line The line line
* @param string $tableName The table
* @param string $searchValue The value to search for
* @param string|null $replaceValue The value to replace search value
* @param int $matchCase The switch to control match case
* @param int $wholeWord The switch to control whole word
* @param int $regexSearch The switch to control regex search
*
* @return array
* @since 3.2.0
**/
public function getReplaceValue(string $fieldName, int $rowId, $line, string $tableName,
string $searchValue, ?string $replaceValue = null, int $matchCase, int $wholeWord, int $regexSearch): array
{
// check if this is a valid table and field
if ($rowId > 0 && SearchFactory::_('Table')->exist($tableName, $fieldName))
{
try
{
// load the configurations
SearchFactory::_('Config')->table_name = $tableName;
SearchFactory::_('Config')->type_search = 2;
SearchFactory::_('Config')->search_value = $searchValue;
SearchFactory::_('Config')->replace_value = $replaceValue;
SearchFactory::_('Config')->match_case = $matchCase;
SearchFactory::_('Config')->whole_word = $wholeWord;
SearchFactory::_('Config')->regex_search = $regexSearch;
// load the value
if (($value = SearchFactory::_('Agent')->getValue($rowId, $fieldName, $line, $tableName, true)) !== null)
{
return ['value' => $value];
}
}
catch(Exception $error)
{
return ['error' => $error->getMessage()];
}
}
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
}
/**
* Set selected search value in a given table and row
*
* @param mixed $value The field value
* @param int $rowId The item ID
* @param string $fieldName The field key
* @param string $tableName The table
*
* @return array
* @since 3.2.0
**/
public function setValue($value, int $rowId, string $fieldName, string $tableName): array
{
// check if this is a valid table and field
if ($rowId > 0 && SearchFactory::_('Table')->exist($tableName, $fieldName) &&
SearchFactory::_('Agent')->setValue($value, $rowId, $fieldName, $tableName))
{
return ['success' => JText::sprintf(
'<b>%s</b> (%s:%s) was successfully updated!',
$tableName, $rowId, $fieldName)];
}
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
}

View File

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

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

@ -448,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

@ -271,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.')');
}
}

View File

@ -114,8 +114,8 @@ class ComponentbuilderModelSearch extends ItemModel
$query = $db->getQuery(true);
// Get data
// load the tables and components (soon)
$data = ['tables' => SearchFactory::_('Table')->tables(), 'components' => null];
// load the tables and components
$data = ['tables' => SearchFactory::_('Table')->tables(), 'components' => $this->getComponents()];
if (empty($data))
@ -148,6 +148,50 @@ class ComponentbuilderModelSearch extends ItemModel
return $this->_item[$pk];
}
/**
* Custom Method
*
* @return mixed item data object on success, false on failure.
*
*/
public function getUrlValues()
{
if (!isset($this->initSet) || !$this->initSet)
{
$this->user = JFactory::getUser();
$this->userId = $this->user->get('id');
$this->guest = $this->user->get('guest');
$this->groups = $this->user->get('groups');
$this->authorisedGroups = $this->user->getAuthorisedGroups();
$this->levels = $this->user->getAuthorisedViewLevels();
$this->initSet = true;
}
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Get data
$data = [
'type_search' => SearchFactory::_('Config')->get('type_search', 1),
'search_value' => SearchFactory::_('Config')->get('search_value', ''),
'replace_value' => SearchFactory::_('Config')->get('replace_value', ''),
'match_case' => SearchFactory::_('Config')->get('match_case', 0),
'whole_word' => SearchFactory::_('Config')->get('whole_word', 0),
'regex_search' => SearchFactory::_('Config')->get('regex_search', 0)
];
if (empty($data))
{
return false;
}
// return data object.
return $data;
}
/**
* Get the uikit needed components
*
@ -162,4 +206,38 @@ class ComponentbuilderModelSearch extends ItemModel
}
return false;
}
/**
* Get all components in the system
*
* @return array
* @since 3.2.0
**/
public function getComponents(): array
{
// Get a db connection.
$db = $this->getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select only id and system name
$query->select($db->quoteName(array('id', 'system_name'),array('id', 'name')));
$query->from($db->quoteName('#__componentbuilder_joomla_component'));
// only the active components
$query->where($db->quoteName('published') . ' = 1');
// Order it by the ordering field.
$query->order('modified DESC');
$query->order('created DESC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
// return the result
return $db->loadObjectList();
}
}

File diff suppressed because one or more lines are too long

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)
@ -35,7 +34,7 @@ Joomla.submitbutton = function(task, key)
} else {
var component = jQuery('#component_id').val();
var isValid = true;
if(component == '' && task == 'compiler.compiler'){
isValid = false;
}
@ -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') ?>';
var token = '<?php echo JSession::getFormToken(); ?>';
var all_is_good = '<?php echo JText::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_THERE_IS_NO_NOTICE_AT_THIS_TIME'); ?>';
jQuery('#compilerForm').on('change', '#component_id',function (e)
{
var component = jQuery('#component_id').val();
if(component == "") {
jQuery('#component-details').html("<?= $selectNotice ?>");
jQuery('#component-details').html("<?php echo $selectNotice; ?>");
jQuery("#noticeboard").show();
jQuery('.notice').show();
} else {
@ -233,9 +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))
{
@ -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

@ -16,7 +16,10 @@ JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive');
use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory;
$this->app->input->set('hidemainmenu', false);
$selectNotice = '<h3>' . JText::_('COM_COMPONENTBUILDER_HI') . ' ' . $this->user->name . '</h3>';
$selectNotice .= '<p>' . JText::_('COM_COMPONENTBUILDER_ENTER_YOUR_SEARCH_TEXT') . '</p>';
?>
<?php if ($this->canDo->get('search.access')): ?>
<script type="text/javascript">
@ -32,8 +35,11 @@ use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory;
}
</script>
<?php $urlId = (isset($this->item->id)) ? '&id='. (int) $this->item->id : ''; ?>
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=search' . $urlId); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<div class="alert alert-danger" role="alert">
<?php echo JText::_('COM_COMPONENTBUILDER_THIS_AREA_IS_STILL_UNDER_DEVELOPMENT_ALTHOUGH_IT_WORKS_IT_SHOULD_BE_USED_WITH_EXTREME_CAUTION_AS_ITS_NOT_STABLE'); ?>
</div>
<hr />
<?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
@ -42,33 +48,246 @@ use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory;
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php
// let's do some tests with the API
$tableName = 'admin_view';
$searchValue = '\b\w+Helper';
// set the search configurations
SearchFactory::_('Config')->table_name = $tableName;
SearchFactory::_('Config')->search_value = $searchValue;
SearchFactory::_('Config')->match_case = 1;
SearchFactory::_('Config')->whole_word = 0;
SearchFactory::_('Config')->regex_search = 1;
SearchFactory::_('Config')->component_id = 0;
<?php if ($this->form): ?>
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=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="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
if (($items = SearchFactory::_('Agent')->find()) !== null)
{
echo JText::sprintf('COM_COMPONENTBUILDER_WE_FOUND_SOME_INSTANCES_IN_S', $tableName) . '<br /><pre>';
var_dump($items);
echo '</pre>';
}
else
{
echo JText::sprintf('COM_COMPONENTBUILDER_NO_INSTANCES_WHERE_FOUND_S', $tableName);
}
?>
</div>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
// get search table values
const searchTables = <?php echo json_encode($this->item['tables']); ?>;
// the search Ajax URLs
const Url = '<?php echo JUri::base(); ?>index.php?option=com_componentbuilder&format=json&raw=true&<?php echo JSession::getFormToken(); ?>=1&task=ajax.';
// make sure our controller is set
let controller = null;
// 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");
// 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 object
const modeObject = document.getElementById("type_search");
// 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

@ -13,6 +13,9 @@
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
@ -32,13 +35,39 @@ class ComponentbuilderViewSearch extends HtmlView
$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_SEARCH_FINISHED_IN');
JText::script('COM_COMPONENTBUILDER_SECONDS');
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
@ -59,6 +88,202 @@ class ComponentbuilderViewSearch extends HtmlView
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
*/
@ -72,6 +297,15 @@ class ComponentbuilderViewSearch extends HtmlView
// 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.
@ -89,6 +323,41 @@ class ComponentbuilderViewSearch extends HtmlView
{
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');
}

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>20th September, 2022</creationDate>
<creationDate>2nd 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.6</version>
<version>3.1.10</version>
<description><![CDATA[
<h1>Component Builder (v.3.1.6)</h1>
<h1>Component Builder (v.3.1.10)</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>

View File

@ -1097,10 +1097,10 @@
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>3.1.6</version>
<version>3.1.10</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.6.zip</downloadurl>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.1.10.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>

View File

@ -9,10 +9,10 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder;
namespace VDM\Joomla\Componentbuilder\Abstraction;
use Joomla\Registry\Registry;
use Joomla\Registry\Registry as JoomlaRegistry;
use Joomla\CMS\Factory;
use Joomla\Input\Input;
use VDM\Joomla\Utilities\Component\Helper;
@ -20,11 +20,11 @@ use VDM\Joomla\Utilities\String\ClassfunctionHelper;
/**
* Configurations
* Config
*
* @since 3.2.0
*/
abstract class BaseConfig extends Registry
abstract class BaseConfig extends JoomlaRegistry
{
/**
* Hold a JInput object for easier access to the input variables.
@ -37,10 +37,10 @@ abstract class BaseConfig extends Registry
/**
* The Params
*
* @var Registry
* @var JoomlaRegistry
* @since 3.2.0
*/
protected Registry $params;
protected JoomlaRegistry $params;
/**
* Constructor
@ -51,7 +51,7 @@ abstract class BaseConfig extends Registry
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Input $input = null, ?Registry $params = null)
public function __construct(?Input $input = null, ?JoomlaRegistry $params = null)
{
$this->input = $input ?: Factory::getApplication()->input;
$this->params = $params ?: Helper::getParams('com_componentbuilder');
@ -92,7 +92,7 @@ abstract class BaseConfig extends Registry
return $value;
}
throw new \InvalidArgumentException(sprintf('Argument %s could not be found as function [%s], or path.', $key, $method));
throw new \InvalidArgumentException(sprintf('Argument %s could not be found as function or path.', $key));
}
/**

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

@ -14,7 +14,7 @@ namespace VDM\Joomla\Componentbuilder\Compiler;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\BaseConfig;
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
/**

View File

@ -13,6 +13,16 @@ 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;
/**
@ -43,7 +53,7 @@ abstract class Factory
*
* @param string $key The container class key
*
* @return Mixed
* @return mixed
* @since 3.2.0
*/
public static function _($key)
@ -56,7 +66,7 @@ abstract class Factory
*
* @param string $key The container class key
*
* @return Mixed
* @return mixed
* @since 3.2.0
*/
public static function _J($key)
@ -94,20 +104,19 @@ abstract class Factory
protected static function createContainer(): Container
{
$container = (new Container())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Compiler())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Event())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\History())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Language())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Placeholder())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Customcode())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Power())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Component())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Extension())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Field());
->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

@ -44,6 +44,14 @@ class Power implements PowerInterface
**/
public array $active = [];
/**
* The url to the power, if there is an error.
*
* @var string
* @since 3.2.0
**/
protected string $fixUrl;
/**
* The state of all loaded powers
*
@ -167,7 +175,7 @@ class Power implements PowerInterface
*
* @param string $guid The global unique id of the power
*
* @return bool
* @return bool true on successful setting of a power
* @since 3.2.0
*/
protected function set(string $guid): bool
@ -182,254 +190,87 @@ class Power implements PowerInterface
// Create a new query object.
$query = $this->db->getQuery(true);
// select all values
$query->select('a.*');
// from these tables
// from this table
$query->from('#__componentbuilder_power AS a');
$query->where($this->db->quoteName('a.guid') . ' = ' . $this->db->quote($guid));
$this->db->setQuery($query);
$this->db->execute();
if ($this->db->getNumRows())
{
// make sure that in recursion we
// don't try to load this power again
// since during the load of a power we also load
// all powers linked to it
$this->state[$guid] = true;
// get the power data
$this->active[$guid] = $this->db->loadObject();
// make sure to add any language strings found to all language files
// since we can't know where this is used at this point
$tmp_lang_target = $this->config->lang_target;
$this->config->lang_target = 'both';
// we set the fix usr if needed
$fix_url
$this->fixUrl
= '"index.php?option=com_componentbuilder&view=powers&task=power.edit&id='
. $this->active[$guid]->id . '" target="_blank"';
// set some keys
$this->active[$guid]->target_type = 'P0m3R!';
$this->active[$guid]->key = $this->active[$guid]->id . '_' . $this->active[$guid]->target_type;
// now set the name
$this->active[$guid]->name = $this->placeholder->update(
$this->customcode->update($this->active[$guid]->name),
$this->placeholder->active
);
// now set the code_name and class name
$this->active[$guid]->code_name = $this->active[$guid]->class_name = ClassfunctionHelper::safe(
$this->active[$guid]->name
);
// set official name
$this->active[$guid]->official_name = StringHelper::safe(
$this->active[$guid]->name, 'W'
);
// set namespace
$this->active[$guid]->namespace = $this->placeholder->update(
$this->active[$guid]->namespace, $this->placeholder->active
);
// validate namespace
if (strpos($this->active[$guid]->namespace, '\\') === false)
// set name space
if (!$this->setNamespace($guid))
{
// we raise an error message
$this->app->enqueueMessage(
Text::sprintf('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',
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->namespace,
'"https://www.php-fig.org/psr/psr-4/" target="_blank"', $this->active[$guid]->type,
$fix_url),
'Error'
);
$this->state[$guid] = false;
unset($this->active[$guid]);
// reset back to starting value
$this->config->lang_target = $tmp_lang_target;
// we break out here
return false;
}
else
{
// setup the path array
$path_array = (array) explode('\\', $this->active[$guid]->namespace);
// make sure all sub folders in src dir is set and remove all characters that will not work in folders naming
$this->active[$guid]->namespace = NamespaceHelper::safe(str_replace('.', '\\', $this->active[$guid]->namespace));
// make sure it has two or more
if (ArrayHelper::check($path_array) <= 1)
{
// we raise an error message
$this->app->enqueueMessage(
Text::sprintf('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',
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->namespace,
'"https://www.php-fig.org/psr/psr-4/" target="_blank"', $this->active[$guid]->type,
$fix_url),
'Error'
);
$this->state[$guid] = false;
unset($this->active[$guid]);
// reset back to starting value
$this->config->lang_target = $tmp_lang_target;
// we break out here
return false;
}
// get the file and class name (the last value in array)
$file_name = array_pop($path_array);
// src array bucket
$src_array = array();
// do we have src folders
if (strpos($file_name, '.') !== false)
{
// we have src folders in the namespace
$src_array = (array) explode('.', $file_name);
// get the file and class name (the last value in array)
$this->active[$guid]->file_name = array_pop($src_array);
// namespace array
$namespace_array = array_merge($path_array, $src_array);
}
else
{
// set the file name
$this->active[$guid]->file_name = $file_name;
// namespace array
$namespace_array = $path_array;
}
// the last value is the same as the class name
if ($this->active[$guid]->file_name !== $this->active[$guid]->class_name)
{
// we raise an error message
$this->app->enqueueMessage(
Text::sprintf('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',
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->type, $this->active[$guid]->class_name, $this->active[$guid]->file_name,
'"https://www.php-fig.org/psr/psr-4/" target="_blank"',
$fix_url),
'Error'
);
$this->state[$guid] = false;
unset($this->active[$guid]);
// reset back to starting value
$this->config->lang_target = $tmp_lang_target;
// we break out here
return false;
}
// make sure the arrays are namespace safe
$path_array = array_map(function ($val) {
return NamespaceHelper::safe($val);
}, $path_array);
$namespace_array = array_map(function ($val) {
return NamespaceHelper::safe($val);
}, $namespace_array);
// set the actual class namespace
$this->active[$guid]->_namespace = implode('\\', $namespace_array);
// prefix values
$this->active[$guid]->_namespace_prefix = $path_array;
// get the parent folder (the first value in array)
$prefix_folder = implode('.', $path_array);
// make sub folders if still found
$sub_folder = '';
if (ArrayHelper::check($src_array))
{
// make sure the arrays are namespace safe
$sub_folder = '/' . implode('/', array_map(function ($val) {
return NamespaceHelper::safe($val);
}, $src_array));
}
// now we set the paths
$this->active[$guid]->path_jcb = $this->config->get('jcb_powers_path', 'libraries/jcb_powers');
$this->active[$guid]->path_parent = $this->active[$guid]->path_jcb . '/' . $prefix_folder;
$this->active[$guid]->path = $this->active[$guid]->path_parent . '/src' . $sub_folder;
}
// load use ids
$use = array();
$as = array();
// check if we have use selection
$this->active[$guid]->use_selection = (isset($this->active[$guid]->use_selection)
&& JsonHelper::check(
$this->active[$guid]->use_selection
)) ? json_decode($this->active[$guid]->use_selection, true) : null;
if ($this->active[$guid]->use_selection)
{
$use = array_values(array_map(function ($u) use(&$as) {
// track the AS options
if (empty($u['as']))
{
$as[$u['use']] = 'default';
}
else
{
$as[$u['use']] = (string) $u['as'];
}
// return the guid
return $u['use'];
}, $this->active[$guid]->use_selection));
}
// check if we have load selection
$this->active[$guid]->load_selection = (isset($this->active[$guid]->load_selection)
&& JsonHelper::check(
$this->active[$guid]->load_selection
)) ? json_decode($this->active[$guid]->load_selection, true) : null;
if ($this->active[$guid]->load_selection)
{
// load use ids
array_map(function ($l) {
// just load it directly and be done with it
return $this->set($l['load']);
}, $this->active[$guid]->load_selection);
}
// see if we have implements
$this->active[$guid]->implement_names = array();
// does this implement
$this->active[$guid]->implements = (isset($this->active[$guid]->implements)
&& JsonHelper::check(
$this->active[$guid]->implements
)) ? json_decode($this->active[$guid]->implements, true) : null;
if ($this->active[$guid]->implements)
{
foreach ($this->active[$guid]->implements as $implement)
{
if ($implement == -1
&& StringHelper::check($this->active[$guid]->implements_custom))
{
$this->active[$guid]->implement_names[] = $this->placeholder->update(
$this->customcode->update($this->active[$guid]->implements_custom),
$this->placeholder->active
);
// just add this once
unset($this->active[$guid]->implements_custom);
}
// does this extend existing
elseif (GuidHelper::valid($implement))
{
// check if it was set
if ($this->set($implement))
{
// get the name
$this->active[$guid]->implement_names[] = $this->get($implement, 1)->class_name;
// add to use
$use[] = $implement;
}
}
}
}
// does this extend something
$this->active[$guid]->extends_name = null;
// we first check for custom extending options
if ($this->active[$guid]->extends == -1
&& StringHelper::check($this->active[$guid]->extends_custom))
{
$this->active[$guid]->extends_name = $this->placeholder->update(
$this->customcode->update($this->active[$guid]->extends_custom),
$this->placeholder->active
);
// just add once
unset($this->active[$guid]->extends_custom);
}
// does this extend existing
elseif (GuidHelper::valid($this->active[$guid]->extends))
{
// check if it was set
if ($this->set($this->active[$guid]->extends))
{
// get the name
$this->active[$guid]->extends_name = $this->get($this->active[$guid]->extends, 1)->class_name;
// add to use
$use[] = $this->active[$guid]->extends;
}
}
$use = [];
$as = [];
// set extra classes
$this->setLoadSelection($guid);
// set use classes
$this->setUseSelection($guid, $use, $as);
// set implement interfaces
$this->setImplements($guid, $use);
// set extend class
$this->setExtend($guid, $use);
// set GUI mapper
$guiMapper = array('table' => 'power', 'id' => (int) $this->active[$guid]->id, 'type' => 'php');
// add the licensing template
if ($this->active[$guid]->add_licensing_template == 2 &&
StringHelper::check($this->active[$guid]->licensing_template))
@ -453,11 +294,13 @@ class Power implements PowerInterface
$this->active[$guid]->add_licensing_template = 1;
$this->active[$guid]->licensing_template = '';
}
// add the header script
if ($this->active[$guid]->add_head == 1)
{
// set GUI mapper field
$guiMapper['field'] = 'head';
// base64 Decode code
$this->active[$guid]->head = $this->gui->set(
$this->placeholder->update(
@ -470,35 +313,13 @@ class Power implements PowerInterface
$guiMapper
) . PHP_EOL;
}
// now add all the extra use statements
if (ArrayHelper::check($use))
{
foreach (array_unique($use) as $u)
{
if ($this->set($u))
{
$add_use = $this->get($u, 1)->namespace;
// check if it is already added manually, you know how some people are
if (strpos($this->active[$guid]->head, $add_use) === false)
{
// check if it has an AS option
if (isset($as[$u]) && StringHelper::check($as[$u]) && $as[$u] !== 'default')
{
$this->active[$guid]->head .= 'use ' . $add_use . ' as ' . $as[$u] . ';' . PHP_EOL;
}
else
{
$this->active[$guid]->head .= 'use ' . $add_use . ';' . PHP_EOL;
}
}
}
}
}
// now set the description
$this->active[$guid]->description = (StringHelper::check($this->active[$guid]->description)) ? $this->placeholder->update(
$this->customcode->update($this->active[$guid]->description),
$this->placeholder->active
) : '';
// add the main code if set
if (StringHelper::check($this->active[$guid]->main_class_code))
{
@ -516,12 +337,17 @@ class Power implements PowerInterface
$guiMapper
);
}
// load the use classes
$this->setUseAs($guid, $use, $as);
// reset back to starting value
$this->config->lang_target = $tmp_lang_target;
return true;
}
}
// we failed to get the power,
// so we raise an error message
// only if guid is valid
@ -532,10 +358,332 @@ class Power implements PowerInterface
'Error'
);
}
// let's not try again
$this->state[$guid] = false;
return false;
}
}
/**
* Set the namespace for this power
*
* @param string $guid The global unique id of the power
*
* @return void
* @since 3.2.0
*/
protected function setNamespace(string $guid)
{
// set namespace
$this->active[$guid]->namespace = $this->placeholder->update(
$this->active[$guid]->namespace, $this->placeholder->active
);
// validate namespace
if (strpos($this->active[$guid]->namespace, '\\') === false)
{
// we raise an error message
$this->app->enqueueMessage(
Text::sprintf('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',
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->namespace,
'"https://www.php-fig.org/psr/psr-4/" target="_blank"', $this->active[$guid]->type,
$this->fixUrl),
'Error'
);
// we break out here
return false;
}
// setup the path array
$path_array = (array) explode('\\', $this->active[$guid]->namespace);
// make sure all sub folders in src dir is set and remove all characters that will not work in folders naming
$this->active[$guid]->namespace = NamespaceHelper::safe(str_replace('.', '\\', $this->active[$guid]->namespace));
// make sure it has two or more
if (ArrayHelper::check($path_array) <= 1)
{
// we raise an error message
$this->app->enqueueMessage(
Text::sprintf('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',
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->namespace,
'"https://www.php-fig.org/psr/psr-4/" target="_blank"', $this->active[$guid]->type,
$this->fixUrl),
'Error'
);
// we break out here
return false;
}
// get the file and class name (the last value in array)
$file_name = array_pop($path_array);
// src array bucket
$src_array = [];
// do we have src folders
if (strpos($file_name, '.') !== false)
{
// we have src folders in the namespace
$src_array = (array) explode('.', $file_name);
// get the file and class name (the last value in array)
$this->active[$guid]->file_name = array_pop($src_array);
// namespace array
$namespace_array = array_merge($path_array, $src_array);
}
else
{
// set the file name
$this->active[$guid]->file_name = $file_name;
// namespace array
$namespace_array = $path_array;
}
// the last value is the same as the class name
if ($this->active[$guid]->file_name !== $this->active[$guid]->class_name)
{
// we raise an error message
$this->app->enqueueMessage(
Text::sprintf('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',
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->type, $this->active[$guid]->class_name, $this->active[$guid]->file_name,
'"https://www.php-fig.org/psr/psr-4/" target="_blank"',
$this->fixUrl),
'Error'
);
// we break out here
return false;
}
// make sure the arrays are namespace safe
$path_array = array_map(function ($val) {
return NamespaceHelper::safe($val);
}, $path_array);
$namespace_array = array_map(function ($val) {
return NamespaceHelper::safe($val);
}, $namespace_array);
// set the actual class namespace
$this->active[$guid]->_namespace = implode('\\', $namespace_array);
// prefix values
$this->active[$guid]->_namespace_prefix = $path_array;
// get the parent folder (the first value in array)
$prefix_folder = implode('.', $path_array);
// make sub folders if still found
$sub_folder = '';
if (ArrayHelper::check($src_array))
{
// make sure the arrays are namespace safe
$sub_folder = '/' . implode('/', array_map(function ($val) {
return NamespaceHelper::safe($val);
}, $src_array));
}
// now we set the paths
$this->active[$guid]->path_jcb = $this->config->get('jcb_powers_path', 'libraries/jcb_powers');
$this->active[$guid]->path_parent = $this->active[$guid]->path_jcb . '/' . $prefix_folder;
$this->active[$guid]->path = $this->active[$guid]->path_parent . '/src' . $sub_folder;
return true;
}
/**
* Set Use Classess
*
* @param string $guid The global unique id of the power
* @param array $use The use array
* @param array $as The use as array
*
* @return void
* @since 3.2.0
*/
protected function setUseSelection(string $guid, array &$use, array &$as)
{
// check if we have use selection
$this->active[$guid]->use_selection = (isset($this->active[$guid]->use_selection)
&& JsonHelper::check(
$this->active[$guid]->use_selection
)) ? json_decode($this->active[$guid]->use_selection, true) : null;
if ($this->active[$guid]->use_selection)
{
$use = array_values(array_map(function ($u) use(&$as) {
// track the AS options
if (empty($u['as']))
{
$as[$u['use']] = 'default';
}
else
{
$as[$u['use']] = (string) $u['as'];
}
// return the guid
return $u['use'];
}, $this->active[$guid]->use_selection));
}
}
/**
* Load Extra Classes
*
* @param string $guid The global unique id of the power
*
* @return void
* @since 3.2.0
*/
protected function setLoadSelection(string $guid)
{
// check if we have load selection
$this->active[$guid]->load_selection = (isset($this->active[$guid]->load_selection)
&& JsonHelper::check(
$this->active[$guid]->load_selection
)) ? json_decode($this->active[$guid]->load_selection, true) : null;
if ($this->active[$guid]->load_selection)
{
// load use ids
array_map(function ($power) {
// just load it directly and be done with it
return $this->set($power['load']);
}, $this->active[$guid]->load_selection);
}
}
/**
* Set Implements Interface classes
*
* @param string $guid The global unique id of the power
* @param array $use The use array
*
* @return void
* @since 3.2.0
*/
protected function setImplements(string $guid, array &$use)
{
// see if we have implements
$this->active[$guid]->implement_names = [];
// does this implement
$this->active[$guid]->implements = (isset($this->active[$guid]->implements)
&& JsonHelper::check(
$this->active[$guid]->implements
)) ? json_decode($this->active[$guid]->implements, true) : null;
if ($this->active[$guid]->implements)
{
foreach ($this->active[$guid]->implements as $implement)
{
if ($implement == -1
&& StringHelper::check($this->active[$guid]->implements_custom))
{
$this->active[$guid]->implement_names[] = $this->placeholder->update(
$this->customcode->update($this->active[$guid]->implements_custom),
$this->placeholder->active
);
// just add this once
unset($this->active[$guid]->implements_custom);
}
// does this extend existing
elseif (GuidHelper::valid($implement))
{
// check if it was set
if ($this->set($implement))
{
// get the name
$this->active[$guid]->implement_names[] = $this->get($implement, 1)->class_name;
// add to use
$use[] = $implement;
}
}
}
}
}
/**
* Set Extend Class
*
* @param string $guid The global unique id of the power
* @param array $use The use array
*
* @return void
* @since 3.2.0
*/
protected function setExtend(string $guid, array &$use)
{
// does this extend something
$this->active[$guid]->extends_name = null;
// we first check for custom extending options
if ($this->active[$guid]->extends == -1
&& StringHelper::check($this->active[$guid]->extends_custom))
{
$this->active[$guid]->extends_name = $this->placeholder->update(
$this->customcode->update($this->active[$guid]->extends_custom),
$this->placeholder->active
);
// just add once
unset($this->active[$guid]->extends_custom);
}
// does this extend existing
elseif (GuidHelper::valid($this->active[$guid]->extends))
{
// check if it was set
if ($this->set($this->active[$guid]->extends))
{
// get the name
$this->active[$guid]->extends_name = $this->get($this->active[$guid]->extends, 1)->class_name;
// add to use
$use[] = $this->active[$guid]->extends;
}
}
}
/**
* Set Extra Use Classes
*
* @param string $guid The global unique id of the power
* @param array $use The use array
*
* @return void
* @since 3.2.0
*/
protected function setUseAs($guid, $use, $as)
{
// now add all the extra use statements
if (ArrayHelper::check($use))
{
foreach (array_unique($use) as $u)
{
if ($this->set($u))
{
// get the namespace
$add_use = $this->get($u, 1)->namespace;
// check if it has an AS option
if (isset($as[$u]) && StringHelper::check($as[$u]) && $as[$u] !== 'default')
{
$add_use = 'use ' . $add_use . ' as ' . $as[$u] . ';';
}
else
{
$add_use = 'use ' . $add_use . ';';
}
// check if it is already added manually
if (strpos($this->active[$guid]->head, $add_use) === false)
{
$this->active[$guid]->head .= $add_use . PHP_EOL;
}
}
}
}
}
}

View File

@ -12,18 +12,16 @@
namespace VDM\Joomla\Componentbuilder\Compiler;
use Joomla\Registry\Registry as JoomlaRegistry;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Abstraction\BaseRegistry;
/**
* Compiler Registry
*
* So we have full control over this class
*
* @since 3.2.0
*/
class Registry extends JoomlaRegistry implements \JsonSerializable, \ArrayAccess, \IteratorAggregate, \Countable
class Registry extends BaseRegistry
{
/**
* Default indentation value
@ -33,27 +31,6 @@ class Registry extends JoomlaRegistry implements \JsonSerializable, \ArrayAccess
*/
protected $indent = 2;
/**
* 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();
}
/**
* Method to export a set of values to a PHP array
*

View File

@ -9,7 +9,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Search;
namespace VDM\Joomla\Componentbuilder\Search\Abstraction;
use VDM\Joomla\Componentbuilder\Search\Factory;
@ -17,11 +17,11 @@ use VDM\Joomla\Componentbuilder\Search\Config;
/**
* Search Type Regex
* Search Engine
*
* @since 3.2.0
*/
abstract class Type
abstract class Engine
{
/**
* Search Config

View File

@ -9,7 +9,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Search;
namespace VDM\Joomla\Componentbuilder\Search\Abstraction;
use VDM\Joomla\Utilities\StringHelper;

View File

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

View File

@ -12,6 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Search;
use Joomla\CMS\Language\Text;
use VDM\Joomla\Componentbuilder\Search\Factory;
use VDM\Joomla\Componentbuilder\Search\Config;
use VDM\Joomla\Componentbuilder\Search\Database\Get;
@ -19,6 +20,8 @@ use VDM\Joomla\Componentbuilder\Search\Database\Set;
use VDM\Joomla\Componentbuilder\Search\Agent\Find;
use VDM\Joomla\Componentbuilder\Search\Agent\Replace;
use VDM\Joomla\Componentbuilder\Search\Agent\Search;
use VDM\Joomla\Componentbuilder\Search\Agent\Update;
use VDM\Joomla\Componentbuilder\Search\Table;
/**
@ -76,21 +79,63 @@ class Agent
*/
protected Search $search;
/**
* Update
*
* @var Update
* @since 3.2.0
*/
protected Update $update;
/**
* Table
*
* @var Table
* @since 3.2.0
*/
protected Table $table;
/**
* Return value to search view
*
* @var string
* @since 3.2.0
*/
protected string $return;
/**
* Marker start and end values
*
* @var array
* @since 3.2.0
*/
protected array $marker;
/**
* Marker start and end html values
*
* @var array
* @since 3.2.0
*/
protected array $markerHtml;
/**
* Constructor
*
* @param Config|null $config The search config object.
* @param Get|null $get The search get database object.
* @param Set|null $set The search get database object.
* @param Find|null $find The search find object.
* @param Replace|null $replace The search replace object.
* @param Search|null $search The search object.
* @param Config|null $config The search config object.
* @param Get|null $get The search get database object.
* @param Set|null $set The search get database object.
* @param Find|null $find The search find object.
* @param Replace|null $replace The search replace object.
* @param Search|null $search The search object.
* @param Update|null $update The update object.
* @param Table|null $table The table object.
*
* @since 3.2.0
*/
public function __construct(?Config $config = null, ?Get $get = null,
?Set$set = null, ?Find $find = null, ?Replace $replace = null,
?Search $search = null)
?Search $search = null, ?Update $update = null, ?Table $table = null)
{
$this->config = $config ?: Factory::_('Config');
$this->get = $get ?: Factory::_('Get.Database');
@ -98,6 +143,113 @@ class Agent
$this->find = $find ?: Factory::_('Agent.Find');
$this->replace = $replace ?: Factory::_('Agent.Replace');
$this->search = $search ?: Factory::_('Agent.Search');
$this->update = $update ?: Factory::_('Agent.Update');
$this->table = $table ?: Factory::_('Table');
}
/**
* Get the value of a field in a row and table
*
* @param int $id The item ID
* @param string $field The field key
* @param mixed $line The field line
* @param string|null $table The table
* @param bool $update The switch to triger an update (default is false)
*
* @return string
* @since 3.2.0
*/
public function getValue(int $id, string $field, $line = null,
?string $table = null, bool $update = false): string
{
// set the table name
if (empty($table))
{
$table = $this->config->table_name;
}
if (($value = $this->get->value($id, $field, $table)) !== null)
{
// we only return strings that can load in an editor
if (is_string($value))
{
// try to update the value if required
if ($update && ($updated_value = $this->update->value($value, $line)) !== null)
{
return $updated_value;
}
return $value;
}
return '// VALUE CAN NOT BE LOADED (AT THIS TIME) SINCE ITS NOT A STRING';
}
return null;
}
/**
* Set the value of a field in a row and table
*
* @param mixed $value The field value
* @param int $id The item ID
* @param string $field The field key
* @param string|null $table The table
*
* @return bool
* @since 3.2.0
*/
public function setValue($value, int $id, string $field, ?string $table = null): bool
{
// set the table name
if (empty($table))
{
$table = $this->config->table_name;
}
return $this->set->value($value, $id, $field, $table);
}
/**
* Return Table Ready Search Results
*
* @param string|null $table The table being searched
*
* @return array|null
* @since 3.2.0
*/
public function table(?string $table = null): ?array
{
// set the table name
if (empty($table))
{
$table = $this->config->table_name;
}
if(($values = $this->find($table)) !== null)
{
// build return value
$this->setReturnValue();
// set the markers
$this->setMarkers();
// start table bucket
$table_rows = [];
foreach ($values as $id => $fields)
{
foreach ($fields as $field => $lines)
{
foreach ($lines as $line => $code)
{
$table_rows[] = $this->getRow($code, $table, $field, $id, $line);
}
}
}
return $table_rows;
}
return null;
}
/**
@ -133,10 +285,10 @@ class Agent
*
* @param string|null $table The table being searched
*
* @return void
* @return int
* @since 3.2.0
*/
public function replace(?string $table = null)
public function replace(?string $table = null): int
{
// set the table name
if (empty($table))
@ -145,6 +297,7 @@ class Agent
}
$set = 1;
$replaced = 0;
// continue loading items until all was loaded
while(($items = $this->get->items($table, $set)) !== null)
@ -156,7 +309,10 @@ class Agent
$this->replace->items($this->find->get($table), $table);
// update the database
$this->set->items($this->replace->get($table), $table);
if ($this->set->items($this->replace->get($table), $table))
{
$replaced++;
}
// reset found items
$this->find->reset($table);
@ -164,6 +320,105 @@ class Agent
$set++;
}
// we return the number of times we replaced
return $replaced;
}
/**
* Return prepared code string for table
*
* @param string $code The code value fro the table
* @param string|null $table The table
* @param string $field The field key
* @param int $id The the row id
* @param mixed $line The code line where found
*
* @return array
* @since 3.2.0
*/
protected function getRow(string $code, string $table, string $field, int $id, $line): array
{
return [
'edit' => $this->getRowEditButton($table, $field, $id, $line),
'code' => $this->getRowCode($code),
'table' => $table,
'field' => $field,
'id' => $id,
'line' => $line
];
}
/**
* Return prepared code string for table
*
* @param string $code The code value fro the table
*
* @return string
* @since 3.2.0
*/
protected function getRowCode(string $code): string
{
return str_replace($this->marker, $this->markerHtml, htmlentities($code));
}
/**
* Get the Item button to edit an item
*
* @param string|null $view The single view
* @param string $field The field key
* @param int $id The the row id
* @param mixed $line The code line where found
*
* @return string
* @since 3.2.0
*/
protected function getRowEditButton(string $view, string $field, int $id, $line): string
{
// get list view
$views = $this->table->get($view, $field, 'list');
$tab = $this->table->get($view, $field, 'tab_name');
// return edit link
return '<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder' .
'&view=' . $views .
'&task=' . $view . '.edit' .
'&id=' . $id .
'&open_tab=' . $tab .
'&open_field=' . $field .
'&return=' . $this->return . '" title="' .
Text::sprintf('COM_COMPONENTBUILDER_EDIT_S_S_DIRECTLY', $view, $field) . '." ><span class="icon-edit"></span></a>';
}
/**
* Set the return value for this search
*
* @return void
* @since 3.2.0
*/
protected function setReturnValue()
{
// set the return value so the search auto load on return
$this->return = urlencode(base64_encode('index.php?option=com_componentbuilder&view=search' .
'&type_search=' . (int) $this->config->type_search .
'&match_case=' . (int) $this->config->match_case .
'&whole_word=' . (int) $this->config->whole_word .
'&regex_search=' . (int) $this->config->regex_search .
'&search_value=' . (string) urlencode($this->config->search_value) .
'&replace_value=' . (string) urlencode($this->config->replace_value)));
}
/**
* Set the markers of the found code
*
* @return void
* @since 3.2.0
*/
protected function setMarkers()
{
// set the markers
$this->marker = [$this->config->marker_start, $this->config->marker_end];
$this->markerHtml = ['<span class="found_code">','</span>'];
}
}

View File

@ -283,6 +283,7 @@ class Search implements SearchInterface
{
$this->found[$table][$id][$field] = [];
}
// we should add a call to get the item name if the table has a name field TODO
}
}

View File

@ -12,7 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Search;
use VDM\Joomla\Componentbuilder\BaseConfig;
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
/**
@ -22,6 +22,17 @@ use VDM\Joomla\Componentbuilder\BaseConfig;
*/
class Config extends BaseConfig
{
/**
* get type search being preformed
*
* @return int the search type 1 = search, 2 = search & replace
* @since 3.2.0
*/
protected function getTypesearch(): ?int
{
return $this->input->get('type_search', 1, 'INT');
}
/**
* get posted search value
*
@ -30,7 +41,7 @@ class Config extends BaseConfig
*/
protected function getSearchvalue(): ?string
{
return $this->input->post->get('search_value', null, 'RAW');
return $this->input->get('search_value', null, 'RAW');
}
/**
@ -41,7 +52,7 @@ class Config extends BaseConfig
*/
protected function getReplacevalue(): string
{
return $this->input->post->get('replace_value', '', 'RAW');
return $this->input->get('replace_value', '', 'RAW');
}
/**
@ -52,7 +63,7 @@ class Config extends BaseConfig
*/
protected function getMatchcase(): int
{
return $this->input->post->get('match_case', 0, 'INT');
return $this->input->get('match_case', 0, 'INT');
}
/**
@ -63,7 +74,7 @@ class Config extends BaseConfig
*/
protected function getWholeword(): int
{
return $this->input->post->get('whole_word', 0, 'INT');
return $this->input->get('whole_word', 0, 'INT');
}
/**
@ -72,9 +83,9 @@ class Config extends BaseConfig
* @return int Regex
* @since 3.2.0
*/
protected function getRegex(): int
protected function getRegexsearch(): int
{
return $this->input->post->get('regex_search', 0, 'INT');
return $this->input->get('regex_search', 0, 'INT');
}
/**
@ -85,7 +96,7 @@ class Config extends BaseConfig
*/
protected function getComponentid(): int
{
return $this->input->post->get('component_id', 0, 'INT');
return $this->input->get('component_id', 0, 'INT');
}
/**
@ -96,7 +107,7 @@ class Config extends BaseConfig
*/
protected function getTablename(): string
{
return $this->input->post->get('table_name', null, 'word');
return $this->input->get('table_name', null, 'word');
}
/**
@ -107,7 +118,7 @@ class Config extends BaseConfig
*/
protected function getFieldname(): string
{
return $this->input->post->get('field_name', null, 'word');
return $this->input->get('field_name', null, 'word');
}
/**
@ -118,7 +129,7 @@ class Config extends BaseConfig
*/
protected function getItemid(): int
{
return $this->input->post->get('item_id', 0, 'INT');
return $this->input->get('item_id', 0, 'INT');
}
/**

View File

@ -87,17 +87,17 @@ class Get implements GetInterface
}
/**
* Get values from a given table
* Get a value from a given table
* Example: $this->value(23, 'value_key', 'table_name');
*
* @param string $field The field key
* @param int $id The item ID
* @param string $field The field key
* @param string|null $table The table
*
* @return mixed
* @since 3.2.0
*/
public function value(string $field, int $id, string $table = null)
public function value(int $id, string $field, string $table = null)
{
// load the table
if (empty($table))
@ -112,11 +112,11 @@ class Get implements GetInterface
$query = $this->db->getQuery(true);
// Order it by the ordering field.
$query->select($name);
$query->select($this->db->quoteName($name));
$query->from($this->db->quoteName('#__componentbuilder_' . $table));
// get by id
$query->where($this->db->quoteName('id') . " = " . $id);
$query->where($this->db->quoteName('id') . " = " . (int) $id);
// Reset the query using our newly populated query object.
$this->db->setQuery($query);

View File

@ -17,6 +17,7 @@ use VDM\Joomla\Componentbuilder\Search\Factory;
use VDM\Joomla\Componentbuilder\Search\Config;
use VDM\Joomla\Componentbuilder\Search\Table;
use VDM\Joomla\Componentbuilder\Search\Model\Set as Model;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Search\Interfaces\SetInterface;
@ -152,13 +153,13 @@ class Set implements SetInterface
* Set values to a given table
* Example: $this->items(Array, 'table_name');
*
* @param array $items The items being saved
* @param array|null $items The items being saved
* @param string|null $table The table
*
* @return bool
* @since 3.2.0
*/
public function items(array $items, string $table = null): bool
public function items(?array $items, string $table = null): bool
{
// load the table
if (empty($table))

View File

@ -9,14 +9,14 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Search\Type;
namespace VDM\Joomla\Componentbuilder\Search\Engine;
use VDM\Joomla\Componentbuilder\Search\Config;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Search\Interfaces\SearchTypeInterface;
use VDM\Joomla\Componentbuilder\Search\Type;
use VDM\Joomla\Componentbuilder\Search\Abstraction\Engine;
/**
@ -24,7 +24,7 @@ use VDM\Joomla\Componentbuilder\Search\Type;
*
* @since 3.2.0
*/
class Basic extends Type implements SearchTypeInterface
class Basic extends Engine implements SearchTypeInterface
{
/**
* Regex Search Value
@ -46,7 +46,7 @@ class Basic extends Type implements SearchTypeInterface
parent::__construct($config);
// quote all regular expression characters
$searchValue = \preg_quote($this->searchValue);
$searchValue = preg_quote($this->searchValue, '/');
$start = ''; $end = '';

View File

@ -9,14 +9,14 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Search\Type;
namespace VDM\Joomla\Componentbuilder\Search\Engine;
use VDM\Joomla\Componentbuilder\Search\Config;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Search\Interfaces\SearchTypeInterface;
use VDM\Joomla\Componentbuilder\Search\Type;
use VDM\Joomla\Componentbuilder\Search\Abstraction\Engine;
/**
@ -24,7 +24,7 @@ use VDM\Joomla\Componentbuilder\Search\Type;
*
* @since 3.2.0
*/
class Regex extends Type implements SearchTypeInterface
class Regex extends Engine implements SearchTypeInterface
{
/**
* Regex Search Value

View File

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

View File

@ -13,6 +13,10 @@ namespace VDM\Joomla\Componentbuilder\Search;
use Joomla\DI\Container;
use VDM\Joomla\Componentbuilder\Search\Service\Search;
use VDM\Joomla\Componentbuilder\Search\Service\Model;
use VDM\Joomla\Componentbuilder\Search\Service\Database;
use VDM\Joomla\Componentbuilder\Search\Service\Agent;
/**
@ -68,10 +72,10 @@ abstract class Factory
protected static function createContainer(): Container
{
$container = (new Container())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Search\Service\Search())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Search\Service\Model())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Search\Service\Database())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Search\Service\Agent());
->registerServiceProvider(new Search())
->registerServiceProvider(new Model())
->registerServiceProvider(new Database())
->registerServiceProvider(new Agent());
return $container;
}

View File

@ -20,17 +20,17 @@ namespace VDM\Joomla\Componentbuilder\Search\Interfaces;
interface GetInterface
{
/**
* Get values from a given table
* Get a value from a given table
* Example: $this->value(23, 'value_key', 'table_name');
*
* @param string $field The field key
* @param int $id The item ID
* @param string $field The field key
* @param string|null $table The table
*
* @return mixed
* @since 3.2.0
*/
public function value(string $field, int $id, string $table = null);
public function value(int $id, string $field, string $table = null);
/**
* Get values from a given table

View File

@ -15,7 +15,7 @@ namespace VDM\Joomla\Componentbuilder\Search\Model;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Search\Interfaces\ModelInterface;
use VDM\Joomla\Componentbuilder\Search\Model;
use VDM\Joomla\Componentbuilder\Search\Abstraction\Model;
/**

View File

@ -13,7 +13,7 @@ namespace VDM\Joomla\Componentbuilder\Search\Model;
use VDM\Joomla\Componentbuilder\Search\Interfaces\ModelInterface;
use VDM\Joomla\Componentbuilder\Search\Model;
use VDM\Joomla\Componentbuilder\Search\Abstraction\Model;
/**

View File

@ -70,7 +70,9 @@ class Agent implements ServiceProviderInterface
$container->get('Set.Database'),
$container->get('Agent.Find'),
$container->get('Agent.Replace'),
$container->get('Agent.Search')
$container->get('Agent.Search'),
$container->get('Agent.Update'),
$container->get('Table')
);
}

View File

@ -17,8 +17,8 @@ use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\Search\Config;
use VDM\Joomla\Componentbuilder\Search\Table;
use VDM\Joomla\Componentbuilder\Search\Interfaces\SearchTypeInterface as SearchEngine;
use VDM\Joomla\Componentbuilder\Search\Type\Regex;
use VDM\Joomla\Componentbuilder\Search\Type\Basic;
use VDM\Joomla\Componentbuilder\Search\Engine\Regex;
use VDM\Joomla\Componentbuilder\Search\Engine\Basic;
/**

View File

@ -2981,14 +2981,15 @@ class Table
}
/**
* Check if a table exist
* Check if a table (and field) exist
*
* @param string|null $table The area
* @param string|null $field The area
*
* @return bool
* @since 3.2.0
*/
public function exist(?string $table = null): bool
public function exist(?string $table = null, ?string $field = null): bool
{
// load the table
if (empty($table))
@ -2996,9 +2997,20 @@ class Table
$table = $this->config->table_name;
}
if (isset($table) && isset($this->tables[$table]))
if (is_string($table) && isset($this->tables[$table]))
{
return true;
// if we have a field
if (is_string($field))
{
if (isset($this->tables[$table][$field]))
{
return true;
}
}
else
{
return true;
}
}
return false;

View File

@ -26,18 +26,19 @@ abstract class GetHelper
/**
* Get a Variable
*
* @param string $table The table from which to get the variable
* @param string $where The value where
* @param string $whereString The target/field string where/name
* @param string $what The return field
* @param string $operator The operator between $whereString/field and $where/value
* @param string $main The component in which the table is found
* @param string|null $table The table from which to get the variable
* @param mixed $where The value where
* @param string $whereString The target/field string where/name
* @param string $what The return field
* @param string $operator The operator between $whereString/field and $where/value
* @param string $main The component in which the table is found
*
* @return mix string/int/float
*
* @return mixed string/int/float
* @since 3.0.9
*/
public static function var($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = null)
public static function var(?string $table = null, $where = null,
string $whereString = 'user', string $what = 'id',
string $operator = '=', ?string $main = null)
{
if(empty($where))
{
@ -85,25 +86,27 @@ abstract class GetHelper
{
return $db->loadResult();
}
return false;
}
/**
* Get array of variables
*
* @param string $table The table from which to get the variables
* @param string $where The value where
* @param string $whereString The target/field string where/name
* @param string $what The return field
* @param string $operator The operator between $whereString/field and $where/value
* @param string $main The component in which the table is found
* @param bool $unique The switch to return a unique array
* @param string|null $table The table from which to get the variables
* @param mixed $where The value where
* @param string $whereString The target/field string where/name
* @param string $what The return field
* @param string $operator The operator between $whereString/field and $where/value
* @param string $main The component in which the table is found
* @param bool $unique The switch to return a unique array
*
* @return array
*
* @return array|null
* @since 3.0.9
*/
public static function vars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = null, $unique = true)
public static function vars(?string $table = null, $where = null,
string $whereString = 'user', string $what = 'id', string $operator = 'IN',
?string $main = null, bool $unique = true): ?array
{
if(empty($where))
{
@ -147,11 +150,11 @@ abstract class GetHelper
// add strings to array search
if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator)
{
$query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")');
$query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","', $where) . '")');
}
else
{
$query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')');
$query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',', $where) . ')');
}
$db->setQuery($query);
@ -166,71 +169,83 @@ abstract class GetHelper
return $db->loadColumn();
}
}
return false;
return null;
}
/**
* get all strings between two other strings
*
* @param string $content The content to search
* @param string $start The starting value
* @param string $end The ending value
* @param string $content The content to search
* @param string $start The starting value
* @param string $end The ending value
*
* @return array On success
*
* @return array|null On success
* @since 3.0.9
*/
public static function allBetween($content, $start, $end)
public static function allBetween(string $content, string $start, string $end): ?array
{
// reset bucket
$bucket = array();
$bucket = [];
for ($i = 0; ; $i++)
{
// search for string
$found = self::between($content,$start,$end);
$found = self::between($content, $start, $end);
if (StringHelper::check($found))
{
// add to bucket
$bucket[] = $found;
// build removal string
$remove = $start.$found.$end;
$remove = $start . $found . $end;
// remove from content
$content = str_replace($remove,'',$content);
$content = str_replace($remove, '', $content);
}
else
{
break;
}
// safety catch
if ($i == 500)
{
break;
}
}
// only return unique array of values
return array_unique($bucket);
if (ArrayHelper::check($bucket))
{
return array_unique($bucket);
}
return null;
}
/**
* get a string between two other strings
*
* @param string $content The content to search
* @param string $start The starting value
* @param string $end The ending value
* @param string $default The default value if none found
* @param string $content The content to search
* @param string $start The starting value
* @param string $end The ending value
* @param string $default The default value if none found
*
* @return string On success / empty string on failure
*
* @since 3.0.9
*/
public static function between($content, $start, $end, $default = '')
public static function between(string $content, string $start, string $end, string $default = ''): string
{
$r = explode($start, $content);
if (isset($r[1]))
$array = explode($start, $content);
if (isset($array[1]) && strpos($array[1], $end) !== false)
{
$r = explode($end, $r[1]);
return $r[0];
$array = explode($end, $array[1]);
// return string found between
return $array[0];
}
return $default;
}

View File

@ -237,7 +237,7 @@ abstract class StringHelper
*
* @since 3.0.9
*/
public static function html($var, $charset = 'UTF-8', $shorten = false, $length = 40)
public static function html($var, $charset = 'UTF-8', $shorten = false, $length = 40, $addTip = true)
{
if (self::check($var))
{
@ -254,7 +254,7 @@ abstract class StringHelper
);
if ($shorten)
{
return self::shorten($string, $length);
return self::shorten($string, $length, $addTip);
}
return $string;
}

View File

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

57
media/datatable/css/datatables.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

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

View File

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

1238
media/datatable/js/datatables.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

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

3
media/datatable/js/pdfmake.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -9422,7 +9422,7 @@ class com_componentbuilderInstallerScript
echo '<a target="_blank" href="https://dev.vdm.io" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 3.1.6 Was Successful! Let us know if anything is not working as expected.</h3>';
<h3>Upgrade to Version 3.1.10 Was Successful! Let us know if anything is not working as expected.</h3>';
// Set db if not set already.
if (!isset($db))

View File

@ -56,13 +56,13 @@ spl_autoload_register(function ($class) {
}
});
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Language\Language;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
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;

View File

@ -25,6 +25,7 @@ COM_COMPONENTBUILDER_DTOWNERDTDDSDD="<dt>Owner</dt><dd>%s</dd>"
COM_COMPONENTBUILDER_DTWEBSITEDTDDSDD="<dt>Website</dt><dd>%s</dd>"
COM_COMPONENTBUILDER_EDIT="Edit"
COM_COMPONENTBUILDER_EDIT_S="Edit %s"
COM_COMPONENTBUILDER_EDIT_S_S_DIRECTLY="Edit %s (%s) directly"
COM_COMPONENTBUILDER_EMAIL_S="Email: %s"
COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SENT="Email with the new key was sent"
COM_COMPONENTBUILDER_EMCOMPANYEM_BSB="<em>Company:</em> <b>%s</b>"