diff --git a/README.md b/README.md index 015b7e54b..2075284fc 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,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 safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.6) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.7) 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) @@ -112,11 +112,11 @@ Component Builder is mapped as a component in itself on my local development env + *Name*: [Component Builder](http://vdm.bz/component-builder) + *First Build*: 30th April, 2015 + *Last Build*: 14th December, 2017 -+ *Version*: 2.6.6 ++ *Version*: 2.6.7 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **177938** -+ *File count*: **1142** ++ *Line count*: **178213** ++ *File count*: **1145** + *Folder count*: **184** > This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder). diff --git a/admin/README.txt b/admin/README.txt index 015b7e54b..2075284fc 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -10,7 +10,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 safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.6) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.7) 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) @@ -112,11 +112,11 @@ Component Builder is mapped as a component in itself on my local development env + *Name*: [Component Builder](http://vdm.bz/component-builder) + *First Build*: 30th April, 2015 + *Last Build*: 14th December, 2017 -+ *Version*: 2.6.6 ++ *Version*: 2.6.7 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **177938** -+ *File count*: **1142** ++ *Line count*: **178213** ++ *File count*: **1145** + *Folder count*: **184** > This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder). diff --git a/admin/assets/js/get_snippets.js b/admin/assets/js/get_snippets.js new file mode 100644 index 000000000..6652bc0d6 --- /dev/null +++ b/admin/assets/js/get_snippets.js @@ -0,0 +1,542 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 2.6.x + @created 30th April, 2015 + @package Component Builder + @subpackage get_snippets.js + @author Llewellyn van der Merwe + @github Joomla Component Builder + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* JS Document */ +// start the moment the document is ready +jQuery(document).ready(function () { + // just get the available libraries + getLibraries(snippetsPath); +}); + +// add an ajax call tracker +var ajaxcall = null; +var fromLocal = false; + +jQuery(document).ready(function(){ + jQuery('body').on('click','.getreaction',function(){ + // Ajax request + var btn = jQuery(this); + btn.prop('disabled', true); + setTimeout(function(){ + btn.prop('disabled', false); + }, 3000); + var type = btn.data('type'); + if ('getLibraries' === type) { + getLibraries(snippetsPath); + } else if ('getSnippets' === type) { + var name = btn.data('name'); + getSnippets(snippetsPath, name); + } else if ('all' === type) { + var status = btn.data('status'); + bulkSnippetGithub(status); + } else if ('bulk' === type) { + checkBulkSnippetGithub(); + } else if ('get' === type) { + var path = btn.data('path'); + var status = btn.data('status'); + setSnippetGithub(path, status); + } else { + var path = btn.data('path'); + getSnippetModal(path, type); + } + }); +}); + +// load every thing once ready +jQuery(document).ajaxStop(function () { + if (0 === jQuery.active) { + //do something special + if ('snippets' === ajaxcall) { + setTimeout( function() { + jQuery('#snippets-github').html('

'+Joomla.JText._('COM_COMPONENTBUILDER_JCB_COMMUNITY_SNIPPETS')+'

'); + jQuery('#snippets-display').show(); + jQuery('#snippets-grid').trigger('display.uk.check'); + jQuery('#loading').hide(); + }, 1000); + } + } +}); + +// get the libraries +function getLibraries(path) { + var _paths = jQuery.jStorage.get('JCB-Snippets-Paths', null); + // always hide the snippets display + jQuery('#snippets-display').hide(); + // always reset the grid + jQuery('#libraries-grid').html(''); + // set the ajax scope + ajaxcall = 'libraries'; + if (_paths) { + buildLibraries(_paths); + } else { + jQuery.get(path) + .success(function(paths) { + // load only this library paths + jQuery.jStorage.set('JCB-Snippets-Paths', paths, {TTL: expire}); + buildLibraries(paths); + }) + .error(function(jqXHR, textStatus, errorThrown) { + jQuery('#snippets-github').html(returnError); + }); + } +} + +// build the ibraries object +function buildLibraries(paths) { + var _temp = jQuery.jStorage.get('JCB-Libraries', null); + if (_temp) { + setLibraries(_temp); + } else { + var temp = {}; + jQuery.each(paths.tree, function(key,value) { + if (value.path.match(".json$")) { + var libName = value.path.split(/ -(.+)/)[0]; + libName = libName.trim() + temp[libName] = libName; + } + }); + // load only this library paths + jQuery.jStorage.set('JCB-Libraries', temp, {TTL: expire}); + setLibraries(temp); + } +} + +// set the libraries +function setLibraries(names) { + // now load the lib buttons + jQuery.each(names, function(value) { + setLibrary(value); + }); + setTimeout( function() { + jQuery('#snippets-github').html('

'+Joomla.JText._('COM_COMPONENTBUILDER_AVAILABLE_LIBRARIES')+'

'); + jQuery('#libraries-display').show(); + jQuery('#libraries-grid').trigger('display.uk.check'); + }, 1000); +} + +// set the snippets +function setLibrary(name) { + // get useful ID + var keyID = getKeyID(name); + // build the library display + var html = '
'; + html += '
'; + html += '

' + name + '

'; + html += '
'; + // set the data buttons + html += setLibButtons(name); + // close the box panel + html += '
'; + html += '
'; + // now we have the library + jQuery('#libraries-grid').append(html); +} + +function setLibButtons(name) { + return ''; +} + +// get the snippets +function getSnippets(path, libraryName) { + jQuery('#loading').show(); + // get local values if set + var _paths = jQuery.jStorage.get('JCB-Snippets-Paths', null); + // always reset the grid + jQuery('#snippets-grid').html(''); + // always hide libraries + jQuery('#libraries-display').hide(); + // set the ajax scope + ajaxcall = 'snippets'; + fromLocal = false; + if (_paths) { + setSnippets(_paths, libraryName); + jQuery('#snippets-github').html('

'+Joomla.JText._('COM_COMPONENTBUILDER_JCB_COMMUNITY_SNIPPETS')+'

'); + } else { + jQuery.get(path) + .success(function(paths) { + // load only this library paths + jQuery.jStorage.set('JCB-Snippets-Paths', paths, {TTL: expire}); + setSnippets(paths, libraryName); + }) + .error(function(jqXHR, textStatus, errorThrown) { + jQuery('#snippets-github').html(returnError); + }); + } + // only use if loading localy + if (fromLocal) { + jQuery('#snippets-display').show(); + jQuery('#snippets-grid').trigger('display.uk.check'); + jQuery('#loading').hide(); + } +} + +// set the snippets +function setSnippets(paths, libraryName) { + // set the ajax scope + ajaxcall = 'snippets'; + jQuery.each(paths.tree, function(key,value) { + if (value.path.match(".json$") && value.path.match("^"+libraryName)) { + var _snippet = jQuery.jStorage.get(value.path, null); + if (_snippet) { + setSnippet(_snippet, value.path); + fromLocal = true; + } else { + jQuery.get(snippetPath+value.path) + .success(function(snippet) { + // convert the string to json.object + snippet = jQuery.parseJSON(snippet); + jQuery.jStorage.set(value.path, snippet, {TTL: expire}); + setSnippet(snippet, value.path); + }) + .error(function(jqXHR, textStatus, errorThrown) { + // we could do more + }); + } + } + }); +} + +// set the snippets +function setSnippet(snippet, key) { + // get useful ID + var keyID = getKeyID(key); + // get the status + var status = getSnippetStatus(snippet, key); + // add to bulk updater + if ('equal' !== status) { + bulkItems[status].push(key); + } + // build the snippet display + var html = '
'; + html += '
'; + html += '
'; + html += '

' + snippet.library+ ' - (' + snippet.type + ') ' + snippet.name + '

'; + html += snippet.heading + '
'; + // set the data buttons + html += setDataButtons(snippet, key, status); + // set the snippet ref button + html += setRefButtons(snippet, key, status, keyID); + // set the contributor buttons + html += setContributorButtons(snippet, key); + // close the box panel + html += '
'; + html += '
'; + // now we have the snippet + jQuery('#snippets-grid').append(html); +} + +// set the snippet status +function getSnippetStatus(snippet, key) { + // check if JCB already has this snippet + if(local_snippets.hasOwnProperty(key)){ + // first get local time stamp + var local_created = strtotime(local_snippets[key].created); + var local_modified = strtotime(local_snippets[key].modified); + // now get github time stamps + var created = strtotime(snippet.created); + var modified = strtotime(snippet.modified); + // work out the status + if (local_created == created) { + if (local_modified == modified) { + return 'equal'; + } else if (local_modified > modified) { + return 'ahead'; + } else if (local_modified < modified) { + return 'behind'; + } + } + return 'diverged'; + } + return 'new'; +} + +function setDataButtons(snippet, key, status) { + var html = '
'; + html += ''; + html += ''; + html += ''; + html += '
'; + // return data buttons + return html; +} + +function setRefButtons(snippet, key, status, keyID) { + var html = '
' + snippet.name + '
'; + // set the update button + html += '
'; + if ('equal' !== status) { + if ('new' === status) { + var tooltip = Joomla.JText._('COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_INSTALL_IT_LOCALLY'); + } else { + var tooltip = Joomla.JText._('COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_UPDATE_THE_LOCAL_VERSION'); + } + html += ''; + } else { + html += ''; + } + html += '
'; + // return data buttons + return html; +} + +function setContributorButtons(snippet, key) { + // set the contributor name + if (snippet.contributor_company) { + var contributor_name = snippet.contributor_company; + } else if (snippet.contributor_name) { + var contributor_name = snippet.contributor_name; + } else { + var contributor_name = Joomla.JText._('COM_COMPONENTBUILDER_JCB_COMMUNITY'); + } + // set the contributor url + if (snippet.contributor_website) { + var contributor_url = snippet.contributor_website; + } else if (snippet.contributor_email) { + var contributor_url = 'mailto:'+snippet.contributor_email; + } else { + var contributor_url = 'https://github.com/vdm-io/Joomla-Component-Builder-Snippets'; + } + var html = '
'; + html += ''; + html += ' ' + contributor_name + ''; + html += ' '+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_BLAME')+''; + html += '
'; + // return contributor buttons + return html; +} + +// do a bulk update +function checkBulkSnippetGithub() { + // check if there is new items + if (bulkItems.new.length === 0) { + jQuery('#bulk-button-new').prop('disabled', true); + jQuery('#bulk-button-new').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_NEW_SNIPPETS_AT_THIS_TIME')); + jQuery('#bulk-notice-new').show(); + } + // check if there is diverged items + if (bulkItems.diverged.length === 0) { + jQuery('#bulk-button-diverged').prop('disabled', true); + jQuery('#bulk-button-diverged').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_DIVERGED_SNIPPETS_AT_THIS_TIME')); + jQuery('#bulk-notice-diverged').show(); + } + // check if there is ahead items + if (bulkItems.ahead.length === 0) { + jQuery('#bulk-button-ahead').prop('disabled', true); + jQuery('#bulk-button-ahead').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_AHEAD_SNIPPETS_AT_THIS_TIME')); + jQuery('#bulk-notice-ahead').show(); + } + // check if there is behind items + if (bulkItems.behind.length === 0) { + jQuery('#bulk-button-behind').prop('disabled', true); + jQuery('#bulk-button-behind').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_OUT_OF_DATE_SNIPPETS_AT_THIS_TIME')); + jQuery('#bulk-notice-behind').show(); + } + // check if all we should close the all button + if (bulkItems.behind.length === 0 && bulkItems.new.length === 0 && bulkItems.ahead.length === 0 && bulkItems.diverged.length === 0) { + jQuery('#bulk-button-all').prop('disabled', true); + jQuery('#bulk-button-all').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME')); + jQuery('#bulk-notice-all').show(); + } +} + +// do a bulk update +function bulkSnippetGithub(status) { + // if all then trigger those with values + if ('all' === status) { + bulkSnippetGithub('behind'); + bulkSnippetGithub('new'); + bulkSnippetGithub('ahead'); + bulkSnippetGithub('diverged'); + } else if (bulkItems[status].length > 0) { + jQuery.each(bulkItems[status], function(i, key){ + setTimeout(function(){ + doBulkUpdate_server(key, status).done(function(result) { + if (result.message) { + // only show errors + if ('error' === result.status || 'warning' === result.status) { + UIkit.notify(result.message, {status: result.status}); + } + // update local items + if ('success' === result.status) { + // get key ID + var keyID = getKeyID(key); + // update snippet if we can + updateSnippetDisplay(keyID, 'equal'); + } + } else { + UIkit.notify(Joomla.JText._('COM_COMPONENTBUILDER_SNIPPET_COULD_NOT_BE_UPDATEDSAVED'), {status:'danger'}); + } + }); + }, 200); + }); + // reset array + bulkItems[status].length = 0; + // update the buttons (since we only do the bulk update once) + checkBulkSnippetGithub(); + } +} + +function doBulkUpdate_server(path, status) { + // set the ajax scope + ajaxcall = null; + var getUrl = "index.php?option=com_[[[component]]]&task=ajax.setSnippetGithub&format=json"; + if (token.length > 0 && path.length > 0 && status.length > 0) { + var request = 'token='+token+'&path='+path+'&status='+status; + } + return jQuery.ajax({ + type: 'POST', + url: getUrl, + dataType: 'jsonp', + data: request, + jsonp: 'callback' + }); +} + +// set the snippet from gitHub +function setSnippetGithub(key, status) { + var message = getConfirmUpdate(status); + UIkit.modal.confirm(message, function(){ + // will be executed on confirm. + setSnippetGithub_server(key, status).done(function(result) { + if (result.message) { + UIkit.notify(result.message, {status: result.status}); + if ('success' === result.status) { + // get key ID + var keyID = getKeyID(key); + // update snippet if we can + updateSnippetDisplay(keyID, 'equal'); + } + } else { + UIkit.notify(Joomla.JText._('COM_COMPONENTBUILDER_SNIPPET_COULD_NOT_BE_UPDATEDSAVED'), {status:'danger'}); + } + }); + }); +} + +function setSnippetGithub_server(path, status) { + // set the ajax scope + ajaxcall = null; + var getUrl = "index.php?option=com_[[[component]]]&task=ajax.setSnippetGithub&format=json"; + if (token.length > 0 && path.length > 0 && status.length > 0) { + var request = 'token='+token+'&path='+path+'&status='+status; + } + return jQuery.ajax({ + type: 'POST', + url: getUrl, + dataType: 'jsonp', + data: request, + jsonp: 'callback' + }); +} + +// update the snippet display +function updateSnippetDisplay(keyID, status) { + // update badge + jQuery('#'+keyID+'-badge').html(' ' +status); + jQuery('#'+keyID+'-badge').attr('href' , '#'+status+'-meaning'); + // update button + if ('equal' === status) { + // update notice + jQuery('#'+keyID+'-getbutton').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_NO_NEED_TO_GET_IT_SINCE_IT_IS_ALREADY_IN_SYNC_WITH_YOUR_LOCAL_VERSION')); + jQuery('#'+keyID+'-getbutton').prop('disabled', true); + jQuery('#'+keyID+'-getbutton').html(' ' + Joomla.JText._('COM_COMPONENTBUILDER_LOCAL_SNIPPET')); + // counter delay just incase + setTimeout(function(){ + jQuery('#'+keyID+'-getbutton').prop('disabled', true); + }, 2000); + } + // update the data filter + jQuery('#'+keyID+'-panel').attr('data-uk-filter', status); + // tell the grid to update + jQuery('#snippets-grid').trigger('display.uk.check'); +} + +// set the modal +function getSnippetModal(key, type) { + // set the ajax scope + ajaxcall = 'snippets'; + var _snippet = jQuery.jStorage.get(key, null); + if (_snippet) { + // show modal + showSnippetModal(_snippet, type); + } else { + jQuery.get('https://raw.githubusercontent.com/vdm-io/Joomla-Component-Builder-Snippets/master/'+key) + .success(function(snippet) { + // convert the string to json.object + snippet = jQuery.parseJSON(snippet); + jQuery.jStorage.set(key, snippet, {TTL: expire}); + // show modal + showSnippetModal(snippet, type); + }) + .error(function(jqXHR, textStatus, errorThrown) { + // we could do more + }); + } +} + +// show the modal +function showSnippetModal(snippet, type) { + var html = '
'; + html += ''; + html += '

' + snippet.library + ' - (' + snippet.type + ') ' + snippet.name + '

'; + if ('contributor' === type) { + html += '
'; + html += '
'+Joomla.JText._('COM_COMPONENTBUILDER_COMPANY_NAME')+'
'; + html += '
'+snippet.contributor_company+'
'; + html += '
'+Joomla.JText._('COM_COMPONENTBUILDER_AUTHOR_NAME')+'
'; + html += '
'+snippet.contributor_name+'
'; + html += '
'+Joomla.JText._('COM_COMPONENTBUILDER_AUTHOR_EMAIL')+'
'; + html += '
'+snippet.contributor_email+'
'; + html += '
'+Joomla.JText._('COM_COMPONENTBUILDER_AUTHOR_WEBSITE')+'
'; + html += '
'+snippet.contributor_website+'
'; + html += '
'; + } else { + html += '
'; + } + html += '
C: ' + snippet.created + ' | M: ' + snippet.modified + ''; + html += '
'; + // get current page position + var scroll = jQuery(window).scrollTop(); + // add html to modal + var modal = UIkit.modal.blockUI(html, {center:true, bgclose:true}).on({ + 'hide.uk.modal': function(){ + // scroll fix since the modal pops to the top of the page + jQuery(window).scrollTop(scroll); + } + }); + // show modal + modal.show(); +} + +// get key ID +function getKeyID(key) { + // get useful ID + var keyID = key.replace('-', ''); + keyID = keyID.replace('.json', ''); + keyID = keyID.replace(/\s+/ig, '-'); + keyID = keyID.replace(/\(/g, ''); + keyID = keyID.replace(/\)/g, ''); + // return the id build + return keyID; +} \ No newline at end of file diff --git a/admin/compiler/joomla_3/JControllerForm.php b/admin/compiler/joomla_3/JControllerForm.php index dd0e15a85..6c4a5e2db 100644 --- a/admin/compiler/joomla_3/JControllerForm.php +++ b/admin/compiler/joomla_3/JControllerForm.php @@ -105,10 +105,10 @@ class ###Component###Controller###View### extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -220,11 +220,11 @@ class ###Component###Controller###View### extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/compiler/joomla_3/JControllerForm_site.php b/admin/compiler/joomla_3/JControllerForm_site.php index 5ddd57d3b..8904ee4b5 100644 --- a/admin/compiler/joomla_3/JControllerForm_site.php +++ b/admin/compiler/joomla_3/JControllerForm_site.php @@ -102,13 +102,13 @@ class ###Component###Controller###View### extends JControllerForm $append = ''; if ($refid) - { + { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -220,11 +220,11 @@ class ###Component###Controller###View### extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/compiler/joomla_3/JControllerLegacy.php b/admin/compiler/joomla_3/JControllerLegacy.php index 38a10e588..a94d8357b 100644 --- a/admin/compiler/joomla_3/JControllerLegacy.php +++ b/admin/compiler/joomla_3/JControllerLegacy.php @@ -42,7 +42,7 @@ class ###Component###Controller extends JControllerLegacy * * @return void */ - function display($cachable = false, $urlparams = false) + function display($cachable = false, $urlparams = false) { // set default view if not set $view = $this->input->getCmd('view', '###Component###'); @@ -51,58 +51,58 @@ class ###Component###Controller extends JControllerLegacy $id = $this->input->getInt('id'); // Check for edit form. - if(###Component###Helper::checkArray($data)) - { - if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_###component###.edit.'.$data['view'], $id)) - { - // Somehow the person just went to the form - we don't allow that. - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); - $this->setMessage($this->getError(), 'error'); - // check if item was opend from other then its own list view - $ref = $this->input->getCmd('ref', 0); - $refid = $this->input->getInt('refid', 0); - // set redirect - if ($refid > 0 && ###Component###Helper::checkString($ref)) - { - // redirect to item of ref - $this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); - } - elseif (###Component###Helper::checkString($ref)) - { + if(###Component###Helper::checkArray($data)) + { + if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_###component###.edit.'.$data['view'], $id)) + { + // Somehow the person just went to the form - we don't allow that. + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + $this->setMessage($this->getError(), 'error'); + // check if item was opend from other then its own list view + $ref = $this->input->getCmd('ref', 0); + $refid = $this->input->getInt('refid', 0); + // set redirect + if ($refid > 0 && ###Component###Helper::checkString($ref)) + { + // redirect to item of ref + $this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); + } + elseif (###Component###Helper::checkString($ref)) + { - // redirect to ref - $this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.(string)$ref, false)); - } - else - { - // normal redirect back to the list view - $this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.$data['views'], false)); - } + // redirect to ref + $this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.(string)$ref, false)); + } + else + { + // normal redirect back to the list view + $this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.$data['views'], false)); + } - return false; - } - } + return false; + } + } return parent::display($cachable, $urlparams); } protected function getViewRelation($view) { - if (###Component###Helper::checkString($view)) - { - $views = array(###VIEWARRAY### - ); - // check if this is a list view - if (in_array($view,$views)) - { - return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view); - } - // check if it is an edit view - elseif (array_key_exists($view,$views)) - { - return array('edit' => true, 'view' => $view, 'views' => $views[$view]); - } - } + if (###Component###Helper::checkString($view)) + { + $views = array(###VIEWARRAY### + ); + // check if this is a list view + if (in_array($view,$views)) + { + return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view); + } + // check if it is an edit view + elseif (array_key_exists($view,$views)) + { + return array('edit' => true, 'view' => $view, 'views' => $views[$view]); + } + } return false; } } diff --git a/admin/compiler/joomla_3/JControllerLegacyAjax.php b/admin/compiler/joomla_3/JControllerLegacyAjax.php index 66bcedcc4..cd3a5f289 100644 --- a/admin/compiler/joomla_3/JControllerLegacyAjax.php +++ b/admin/compiler/joomla_3/JControllerLegacyAjax.php @@ -55,20 +55,20 @@ class ###Component###ControllerAjax extends JControllerLegacy $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); if($token == $call_token) - { + { $task = $this->getTask(); switch($task) - {###AJAX_INPUT_RETURN### + {###AJAX_INPUT_RETURN### } } - else - { + else + { if($callback = $jinput->get('callback', null, 'CMD')) - { + { echo $callback."(".json_encode(false).");"; } - else - { + else + { echo "(".json_encode(false).");"; } } diff --git a/admin/compiler/joomla_3/JControllerLegacyAjaxSite.php b/admin/compiler/joomla_3/JControllerLegacyAjaxSite.php index ddea7efad..93eafcfae 100644 --- a/admin/compiler/joomla_3/JControllerLegacyAjaxSite.php +++ b/admin/compiler/joomla_3/JControllerLegacyAjaxSite.php @@ -55,20 +55,20 @@ class ###Component###ControllerAjax extends JControllerLegacy $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); if($token == $call_token) - { + { $task = $this->getTask(); switch($task) - {###AJAX_SITE_INPUT_RETURN### + {###AJAX_SITE_INPUT_RETURN### } } - else - { + else + { if($callback = $jinput->get('callback', null, 'CMD')) - { + { echo $callback."(".json_encode(false).");"; } - else - { + else + { echo "(".json_encode(false).");"; } } diff --git a/admin/compiler/joomla_3/JControllerLegacyHelp.php b/admin/compiler/joomla_3/JControllerLegacyHelp.php index e529e76ea..45a7cda8f 100644 --- a/admin/compiler/joomla_3/JControllerLegacyHelp.php +++ b/admin/compiler/joomla_3/JControllerLegacyHelp.php @@ -51,7 +51,8 @@ class ###Component###ControllerHelp extends JControllerLegacy // Check Token! $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); - if($user->id != 0 && $token == $call_token){ + if($user->id != 0 && $token == $call_token) + { $task = $this->getTask(); switch($task){ case 'getText': @@ -67,25 +68,25 @@ class ###Component###ControllerHelp extends JControllerLegacy $result = ''; } echo $result; - // stop execution gracefully - jexit(); + // stop execution gracefully + jexit(); } - catch(Exception $e) + catch(Exception $e) { - // stop execution gracefully + // stop execution gracefully jexit(); } break; } } - else - { - // stop execution gracefully + else + { + // stop execution gracefully jexit(); } } - protected function getHelpDocumentText($id) + protected function getHelpDocumentText($id) { $db = JFactory::getDbo(); $query = $db->getQuery(true); diff --git a/admin/compiler/joomla_3/JControllerLegacyHelp_site.php b/admin/compiler/joomla_3/JControllerLegacyHelp_site.php index c3fa7208b..67ca284ab 100644 --- a/admin/compiler/joomla_3/JControllerLegacyHelp_site.php +++ b/admin/compiler/joomla_3/JControllerLegacyHelp_site.php @@ -51,7 +51,8 @@ class ###Component###ControllerHelp extends JControllerLegacy // Check Token! $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); - if($token == $call_token){ + if($token == $call_token) + { $task = $this->getTask(); switch($task){ case 'getText': @@ -67,25 +68,25 @@ class ###Component###ControllerHelp extends JControllerLegacy $result = ''; } echo $result; - // stop execution gracefully - jexit(); + // stop execution gracefully + jexit(); } catch(Exception $e) { - // stop execution gracefully + // stop execution gracefully jexit(); } break; } } - else - { - // stop execution gracefully + else + { + // stop execution gracefully jexit(); } } - protected function getHelpDocumentText($id) + protected function getHelpDocumentText($id) { $db = JFactory::getDbo(); $query = $db->getQuery(true); diff --git a/admin/compiler/joomla_3/JControllerLegacySITE.php b/admin/compiler/joomla_3/JControllerLegacySITE.php index 400aaf6c0..effb2a5a9 100644 --- a/admin/compiler/joomla_3/JControllerLegacySITE.php +++ b/admin/compiler/joomla_3/JControllerLegacySITE.php @@ -42,18 +42,18 @@ class ###Component###Controller extends JControllerLegacy * * @return void */ - function display($cachable = false, $urlparams = false) + function display($cachable = false, $urlparams = false) { // set default view if not set $view = $this->input->getCmd('view', '###SITE_DEFAULT_VIEW###'); $isEdit = $this->checkEditView($view); $layout = $this->input->get('layout', null, 'WORD'); - $id = $this->input->getInt('id'); + $id = $this->input->getInt('id'); $cachable = true; // Check for edit form. - if($isEdit) - { + if($isEdit) + { if ($layout == 'edit' && !$this->checkEditId('com_###component###.edit.'.$view, $id)) { // Somehow the person just went to the form - we don't allow that. @@ -70,7 +70,6 @@ class ###Component###Controller extends JControllerLegacy } elseif (###Component###Helper::checkString($ref)) { - // redirect to ref $this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.(string)$ref, false)); } @@ -81,23 +80,23 @@ class ###Component###Controller extends JControllerLegacy } return false; } - } + } return parent::display($cachable, $urlparams); } protected function checkEditView($view) { - if (###Component###Helper::checkString($view)) - { - $views = array(###SITE_EDIT_VIEW_ARRAY### - ); - // check if this is a edit view - if (in_array($view,$views)) - { - return true; - } - } + if (###Component###Helper::checkString($view)) + { + $views = array(###SITE_EDIT_VIEW_ARRAY### + ); + // check if this is a edit view + if (in_array($view,$views)) + { + return true; + } + } return false; } } diff --git a/admin/compiler/joomla_3/JControllerLegacy_custom_admin.php b/admin/compiler/joomla_3/JControllerLegacy_custom_admin.php index 4f892783e..396a6c0f3 100644 --- a/admin/compiler/joomla_3/JControllerLegacy_custom_admin.php +++ b/admin/compiler/joomla_3/JControllerLegacy_custom_admin.php @@ -42,7 +42,7 @@ class ###Component###Controller###SView### extends JControllerLegacy parent::__construct($config); } - public function dashboard() + public function dashboard() { $this->setRedirect(JRoute::_('index.php?option=com_###component###', false)); return; diff --git a/admin/compiler/joomla_3/JModelList_custom_admin.php b/admin/compiler/joomla_3/JModelList_custom_admin.php index df3d0241b..5a7c3571c 100644 --- a/admin/compiler/joomla_3/JModelList_custom_admin.php +++ b/admin/compiler/joomla_3/JModelList_custom_admin.php @@ -37,16 +37,16 @@ jimport('joomla.application.component.modellist'); */ class ###Component###Model###SViews### extends JModelList { - /** + /** * Model user data. * - * @var strings + * @var strings */ - protected $user; - protected $userId; - protected $guest; - protected $groups; - protected $levels; + protected $user; + protected $userId; + protected $guest; + protected $groups; + protected $levels; protected $app; protected $input; protected $uikitComp; @@ -58,14 +58,14 @@ class ###Component###Model###SViews### extends JModelList */ protected function getListQuery() { - // Get the current user for authorisation checks - $this->user = JFactory::getUser(); + // Get the current user for authorisation checks + $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->groups = $this->user->get('groups'); + $this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); - $this->app = JFactory::getApplication(); + $this->app = JFactory::getApplication(); $this->input = $this->app->input; $this->initSet = true; ###CUSTOM_ADMIN_GET_LIST_QUERY### } @@ -77,16 +77,16 @@ class ###Component###Model###SViews### extends JModelList */ public function getItems() { - $user = JFactory::getUser(); - // check if this user has permission to access items - if (!$user->authorise('###sviews###.access', 'com_###component###')) - { + $user = JFactory::getUser(); + // check if this user has permission to access items + if (!$user->authorise('###sviews###.access', 'com_###component###')) + { $app = JFactory::getApplication(); $app->enqueueMessage(JText::_('Not authorised!'), 'error'); // redirect away if not a correct (TODO for now we go to default view) $app->redirect('index.php?option=com_###component###'); return false; - }###LICENSE_LOCKED_CHECK### ###CUSTOM_ADMIN_BEFORE_GET_ITEMS### + }###LICENSE_LOCKED_CHECK### ###CUSTOM_ADMIN_BEFORE_GET_ITEMS### // load parent items $items = parent::getItems(); diff --git a/admin/compiler/joomla_3/JModelList_site.php b/admin/compiler/joomla_3/JModelList_site.php index 389be6d02..cc2abd418 100644 --- a/admin/compiler/joomla_3/JModelList_site.php +++ b/admin/compiler/joomla_3/JModelList_site.php @@ -59,13 +59,13 @@ class ###Component###Model###SViews### extends JModelList protected function getListQuery() { // Get the current user for authorisation checks - $this->user = JFactory::getUser(); + $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->groups = $this->user->get('groups'); + $this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); - $this->app = JFactory::getApplication(); + $this->app = JFactory::getApplication(); $this->input = $this->app->input; $this->initSet = true; ###SITE_GET_LIST_QUERY### } diff --git a/admin/compiler/joomla_3/JViewLegacy_custom_admin.php b/admin/compiler/joomla_3/JViewLegacy_custom_admin.php index a160e5cc2..e51ef6a0c 100644 --- a/admin/compiler/joomla_3/JViewLegacy_custom_admin.php +++ b/admin/compiler/joomla_3/JViewLegacy_custom_admin.php @@ -40,24 +40,24 @@ class ###Component###View###SView### extends JViewLegacy // Overwriting JView display method function display($tpl = null) { - // get component params + // get component params $this->params = JComponentHelper::getParams('com_###component###'); // get the application $this->app = JFactory::getApplication(); // get the user object $this->user = JFactory::getUser(); - // get global action permissions + // get global action permissions $this->canDo = ###Component###Helper::getActions('###sview###');###CUSTOM_ADMIN_DIPLAY_METHOD### }###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS### - /** + /** * Prepares the document */ protected function setDocument() {###CUSTOM_ADMIN_LIBRARIES_LOADER### ###CUSTOM_ADMIN_DOCUMENT_METADATA### ###CUSTOM_ADMIN_UIKIT_LOADER### ###CUSTOM_ADMIN_GOOGLECHART_LOADER### ###CUSTOM_ADMIN_FOOTABLE_LOADER### ###CUSTOM_ADMIN_DOCUMENT_CUSTOM_PHP### - // add the document default css file + // add the document default css file $this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_###component###/assets/css/###sview###.css');###CUSTOM_ADMIN_DOCUMENT_CUSTOM_CSS### ###CUSTOM_ADMIN_DOCUMENT_CUSTOM_JS### - } + } /** * Setting the toolbar @@ -78,26 +78,26 @@ class ###Component###View###SView### extends JViewLegacy } // add title to the page JToolbarHelper::title($title,'###ICOMOON###'); - // add the back button - // JToolBarHelper::custom('###sview###.back', 'undo-2', '', 'COM_###COMPONENT###_BACK', false); - // add cpanel button + // add the back button + // JToolBarHelper::custom('###sview###.back', 'undo-2', '', 'COM_###COMPONENT###_BACK', false); + // add cpanel button JToolBarHelper::custom('###sview###.dashboard', 'grid-2', '', 'COM_###COMPONENT###_DASH', false);###CUSTOM_ADMIN_CUSTOM_BUTTONS### // set help url for this view if found - $help_url = ###Component###Helper::getHelpUrl('###sviews###'); - if (###Component###Helper::checkString($help_url)) - { + $help_url = ###Component###Helper::getHelpUrl('###sviews###'); + if (###Component###Helper::checkString($help_url)) + { JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); - } + } - // add the options comp button - if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_###component###'); } }###CUSTOM_ADMIN_GET_MODULE### - /** + /** * Escapes a value for output in a view script. * * @param mixed $var The output to escape. @@ -106,8 +106,8 @@ class ###Component###View###SView### extends JViewLegacy */ public function escape($var) { - // use the helper htmlEscape method instead. + // use the helper htmlEscape method instead. return ###Component###Helper::htmlEscape($var, $this->_charset); } } -?> \ No newline at end of file +?> diff --git a/admin/compiler/joomla_3/JViewLegacy_edit.php b/admin/compiler/joomla_3/JViewLegacy_edit.php index 77adae305..1ec6b6b92 100644 --- a/admin/compiler/joomla_3/JViewLegacy_edit.php +++ b/admin/compiler/joomla_3/JViewLegacy_edit.php @@ -56,15 +56,15 @@ class ###Component###View###View### extends JViewLegacy $this->refid = $jinput->get('refid', 0, 'int'); $this->referral = ''; if ($this->refid) - { - // return to the item that refered to this item - $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; - } - elseif($this->ref) - { - // return to the list view that refered to this item - $this->referral = '&ref='.(string)$this->ref; - }###LINKEDVIEWITEMS### + { + // return to the item that refered to this item + $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that refered to this item + $this->referral = '&ref='.(string)$this->ref; + }###LINKEDVIEWITEMS### // Set the toolbar $this->addToolBar(); @@ -91,7 +91,7 @@ class ###Component###View###View### extends JViewLegacy ###ADDTOOLBAR### } - /** + /** * Escapes a value for output in a view script. * * @param mixed $var The output to escape. @@ -105,7 +105,7 @@ class ###Component###View###View### extends JViewLegacy // use the helper htmlEscape method instead and shorten the string return ###Component###Helper::htmlEscape($var, $this->_charset, true, 30); } - // use the helper htmlEscape method instead. + // use the helper htmlEscape method instead. return ###Component###Helper::htmlEscape($var, $this->_charset); } diff --git a/admin/compiler/joomla_3/JViewLegacy_edit_site.php b/admin/compiler/joomla_3/JViewLegacy_edit_site.php index 57fdca976..c5a70864a 100644 --- a/admin/compiler/joomla_3/JViewLegacy_edit_site.php +++ b/admin/compiler/joomla_3/JViewLegacy_edit_site.php @@ -48,7 +48,7 @@ class ###Component###View###View### extends JViewLegacy $this->item = $this->get('Item'); $this->script = $this->get('Script'); $this->state = $this->get('State'); - // get action permissions + // get action permissions $this->canDo = ###Component###Helper::getActions('###view###',$this->item); // get input $jinput = JFactory::getApplication()->input; @@ -56,15 +56,15 @@ class ###Component###View###View### extends JViewLegacy $this->refid = $jinput->get('refid', 0, 'int'); $this->referral = ''; if ($this->refid) - { - // return to the item that refered to this item - $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; - } - elseif($this->ref) - { - // return to the list view that refered to this item - $this->referral = '&ref='.(string)$this->ref; - }###LINKEDVIEWITEMS### + { + // return to the item that refered to this item + $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that refered to this item + $this->referral = '&ref='.(string)$this->ref; + }###LINKEDVIEWITEMS### // Set the toolbar $this->addToolBar(); @@ -95,7 +95,7 @@ class ###Component###View###View### extends JViewLegacy $this->toolbar = JToolbar::getInstance(); } - /** + /** * Escapes a value for output in a view script. * * @param mixed $var The output to escape. @@ -109,7 +109,7 @@ class ###Component###View###View### extends JViewLegacy // use the helper htmlEscape method instead and shorten the string return ###Component###Helper::htmlEscape($var, $this->_charset, true, 30); } - // use the helper htmlEscape method instead. + // use the helper htmlEscape method instead. return ###Component###Helper::htmlEscape($var, $this->_charset); } diff --git a/admin/compiler/joomla_3/JViewLegacy_import.php b/admin/compiler/joomla_3/JViewLegacy_import.php index 833072364..8510dc6ce 100644 --- a/admin/compiler/joomla_3/JViewLegacy_import.php +++ b/admin/compiler/joomla_3/JViewLegacy_import.php @@ -104,10 +104,10 @@ class ###Component###ViewImport extends JViewLegacy } // set help url for this view if found - $help_url = ###Component###Helper::getHelpUrl('import'); - if (###Component###Helper::checkString($help_url)) - { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); - } + $help_url = ###Component###Helper::getHelpUrl('import'); + if (###Component###Helper::checkString($help_url)) + { + JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); + } } } diff --git a/admin/compiler/joomla_3/JViewLegacy_import_custom.php b/admin/compiler/joomla_3/JViewLegacy_import_custom.php index 69fb002b1..7207087fc 100644 --- a/admin/compiler/joomla_3/JViewLegacy_import_custom.php +++ b/admin/compiler/joomla_3/JViewLegacy_import_custom.php @@ -52,10 +52,10 @@ class ###Component###View###View### extends JViewLegacy } // set help url for this view if found - $help_url = ###Component###Helper::getHelpUrl('###view###'); - if (###Component###Helper::checkString($help_url)) - { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); - } + $help_url = ###Component###Helper::getHelpUrl('###view###'); + if (###Component###Helper::checkString($help_url)) + { + JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); + } } } diff --git a/admin/compiler/joomla_3/JViewLegacy_list.php b/admin/compiler/joomla_3/JViewLegacy_list.php index 5246cdbf0..9103cf8b6 100644 --- a/admin/compiler/joomla_3/JViewLegacy_list.php +++ b/admin/compiler/joomla_3/JViewLegacy_list.php @@ -56,8 +56,7 @@ class ###Component###View###Views### extends JViewLegacy $this->user = JFactory::getUser(); $this->listOrder = $this->escape($this->state->get('list.ordering')); $this->listDirn = $this->escape($this->state->get('list.direction')); - $this->saveOrder = $this->listOrder == 'ordering'; - // get global action permissions + // get global action permissions $this->canDo = ###Component###Helper::getActions('###view###');###JVIEWLISTCANDO### // We don't need toolbar in the modal window. @@ -65,11 +64,11 @@ class ###Component###View###Views### extends JViewLegacy { $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); - // load the batch html - if ($this->canCreate && $this->canEdit && $this->canState) - { - $this->batchDisplay = JHtmlBatch_::render(); - } + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } } // Check for errors. @@ -92,86 +91,86 @@ class ###Component###View###Views### extends JViewLegacy { JToolBarHelper::title(JText::_('COM_###COMPONENT###_###VIEWS###'), '###ICOMOON###'); JHtmlSidebar::setAction('index.php?option=com_###component###&view=###views###'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) - { + { JToolBarHelper::addNew('###view###.add'); } - // Only load if there are items - if (###Component###Helper::checkArray($this->items)) + // Only load if there are items + if (###Component###Helper::checkArray($this->items)) { - if ($this->canEdit) - { - JToolBarHelper::editList('###view###.edit'); - } + if ($this->canEdit) + { + JToolBarHelper::editList('###view###.edit'); + } - if ($this->canState) - { - JToolBarHelper::publishList('###views###.publish'); - JToolBarHelper::unpublishList('###views###.unpublish'); - JToolBarHelper::archiveList('###views###.archive'); + if ($this->canState) + { + JToolBarHelper::publishList('###views###.publish'); + JToolBarHelper::unpublishList('###views###.unpublish'); + JToolBarHelper::archiveList('###views###.archive'); - if ($this->canDo->get('core.admin')) - { - JToolBarHelper::checkin('###views###.checkin'); - } - } + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('###views###.checkin'); + } + } - // Add a batch button - if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) - { - // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); - // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); - // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); - // add the button to the page - $dhtml = $layout->render(array('title' => $title)); - $bar->appendButton('Custom', $dhtml, 'batch'); - }###CUSTOM_ADMIN_DYNAMIC_BUTTONS### ###ADMIN_CUSTOM_BUTTONS_LIST### + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + }###CUSTOM_ADMIN_DYNAMIC_BUTTONS### ###ADMIN_CUSTOM_BUTTONS_LIST### - if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) - { - JToolbarHelper::deleteList('', '###views###.delete', 'JTOOLBAR_EMPTY_TRASH'); - } - elseif ($this->canState && $this->canDelete) - { - JToolbarHelper::trash('###views###.trash'); - }###EXPORTBUTTON### - }###ADMIN_CUSTOM_FUNCTION_ONLY_BUTTONS_LIST### ###IMPORTBUTTON### + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', '###views###.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('###views###.trash'); + }###EXPORTBUTTON### + }###ADMIN_CUSTOM_FUNCTION_ONLY_BUTTONS_LIST### ###IMPORTBUTTON### - // set help url for this view if found - $help_url = ###Component###Helper::getHelpUrl('###views###'); - if (###Component###Helper::checkString($help_url)) - { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); - } + // set help url for this view if found + $help_url = ###Component###Helper::getHelpUrl('###views###'); + if (###Component###Helper::checkString($help_url)) + { + JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); + } - // add the options comp button - if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) - { - JToolBarHelper::preferences('com_###component###'); - } + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_###component###'); + } - if ($this->canState) - { + if ($this->canState) + { JHtmlSidebar::addFilter( JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_###COMPONENT###_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_###COMPONENT###_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } } JHtmlSidebar::addFilter( @@ -183,11 +182,11 @@ class ###Component###View###Views### extends JViewLegacy if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_###COMPONENT###_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + JText::_('COM_###COMPONENT###_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); - } ###CATEGORYFILTER### ###OTHERFILTERS### + }###CATEGORYFILTER### ###OTHERFILTERS### } /** @@ -205,7 +204,7 @@ class ###Component###View###Views### extends JViewLegacy $this->document->addStyleSheet(JURI::root() . "administrator/components/com_###component###/assets/css/###views###.css"); } - /** + /** * Escapes a value for output in a view script. * * @param mixed $var The output to escape. @@ -216,10 +215,10 @@ class ###Component###View###Views### extends JViewLegacy { if(strlen($var) > 50) { - // use the helper htmlEscape method instead and shorten the string + // use the helper htmlEscape method instead and shorten the string return ###Component###Helper::htmlEscape($var, $this->_charset, true); } - // use the helper htmlEscape method instead. + // use the helper htmlEscape method instead. return ###Component###Helper::htmlEscape($var, $this->_charset); } @@ -231,5 +230,5 @@ class ###Component###View###Views### extends JViewLegacy protected function getSortFields() { ###SORTFIELDS### - } ###FILTERFUNCTIONS### + }###FILTERFUNCTIONS### } diff --git a/admin/compiler/joomla_3/JViewLegacy_list_custom_admin.php b/admin/compiler/joomla_3/JViewLegacy_list_custom_admin.php index 64bb5a5d5..10e12a0d9 100644 --- a/admin/compiler/joomla_3/JViewLegacy_list_custom_admin.php +++ b/admin/compiler/joomla_3/JViewLegacy_list_custom_admin.php @@ -40,24 +40,24 @@ class ###Component###View###SViews### extends JViewLegacy // Overwriting JView display method function display($tpl = null) { - // get component params + // get component params $this->params = JComponentHelper::getParams('com_###component###'); // get the application $this->app = JFactory::getApplication(); // get the user object $this->user = JFactory::getUser(); - // get global action permissions + // get global action permissions $this->canDo = ###Component###Helper::getActions('###sview###');###CUSTOM_ADMIN_DIPLAY_METHOD### }###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS### - /** + /** * Prepares the document */ protected function setDocument() {###CUSTOM_ADMIN_LIBRARIES_LOADER### ###CUSTOM_ADMIN_UIKIT_LOADER### ###CUSTOM_ADMIN_GOOGLECHART_LOADER### ###CUSTOM_ADMIN_FOOTABLE_LOADER### ###CUSTOM_ADMIN_DOCUMENT_CUSTOM_PHP### - // add the document default css file + // add the document default css file $this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_###component###/assets/css/###sviews###.css');###CUSTOM_ADMIN_DOCUMENT_CUSTOM_CSS### ###CUSTOM_ADMIN_DOCUMENT_CUSTOM_JS### - } + } /** * Setting the toolbar @@ -65,29 +65,29 @@ class ###Component###View###SViews### extends JViewLegacy protected function addToolBar() { // hide the main menu - $this->app->input->set('hidemainmenu', true); + $this->app->input->set('hidemainmenu', true); // add title to the page JToolbarHelper::title(JText::_('COM_###COMPONENT###_###SVIEWS###'),'###ICOMOON###'); - // add the back button - // JToolBarHelper::custom('###sviews###.back', 'undo-2', '', 'COM_###COMPONENT###_BACK', false); - // add cpanel button + // add the back button + // JToolBarHelper::custom('###sviews###.back', 'undo-2', '', 'COM_###COMPONENT###_BACK', false); + // add cpanel button JToolBarHelper::custom('###sviews###.dashboard', 'grid-2', '', 'COM_###COMPONENT###_DASH', false);###CUSTOM_ADMIN_CUSTOM_BUTTONS### // set help url for this view if found - $help_url = ###Component###Helper::getHelpUrl('###sviews###'); - if (###Component###Helper::checkString($help_url)) - { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); - } + $help_url = ###Component###Helper::getHelpUrl('###sviews###'); + if (###Component###Helper::checkString($help_url)) + { + JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); + } - // add the options comp button - if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_###component###'); } }###CUSTOM_ADMIN_GET_MODULE### - /** + /** * Escapes a value for output in a view script. * * @param mixed $var The output to escape. @@ -96,7 +96,7 @@ class ###Component###View###SViews### extends JViewLegacy */ public function escape($var) { - // use the helper htmlEscape method instead. + // use the helper htmlEscape method instead. return ###Component###Helper::htmlEscape($var, $this->_charset); } } diff --git a/admin/compiler/joomla_3/JViewLegacy_list_site.php b/admin/compiler/joomla_3/JViewLegacy_list_site.php index 6369af260..7b7e038cc 100644 --- a/admin/compiler/joomla_3/JViewLegacy_list_site.php +++ b/admin/compiler/joomla_3/JViewLegacy_list_site.php @@ -48,14 +48,14 @@ class ###Component###View###SViews### extends JViewLegacy $this->user = JFactory::getUser();###SITE_DIPLAY_METHOD### }###SITE_EXTRA_DIPLAY_METHODS### - /** + /** * Prepares the document */ protected function _prepareDocument() {###SITE_LIBRARIES_LOADER### ###SITE_UIKIT_LOADER### ###SITE_GOOGLECHART_LOADER### ###SITE_FOOTABLE_LOADER### ###SITE_DOCUMENT_METADATA### ###SITE_DOCUMENT_CUSTOM_PHP### // add the document default css file $this->document->addStyleSheet(JURI::root(true) .'/components/com_###component###/assets/css/###sview###.css');###SITE_DOCUMENT_CUSTOM_CSS### ###SITE_DOCUMENT_CUSTOM_JS### - } + } /** * Setting the toolbar @@ -75,7 +75,7 @@ class ###Component###View###SViews### extends JViewLegacy $this->toolbar = JToolbar::getInstance(); }###SITE_GET_MODULE### - /** + /** * Escapes a value for output in a view script. * * @param mixed $var The output to escape. @@ -84,7 +84,7 @@ class ###Component###View###SViews### extends JViewLegacy */ public function escape($var, $sorten = false, $length = 40) { - // use the helper htmlEscape method instead. + // use the helper htmlEscape method instead. return ###Component###Helper::htmlEscape($var, $this->_charset, $sorten, $length); } } diff --git a/admin/compiler/joomla_3/JViewLegacy_site.php b/admin/compiler/joomla_3/JViewLegacy_site.php index 3752acb8c..66c087eff 100644 --- a/admin/compiler/joomla_3/JViewLegacy_site.php +++ b/admin/compiler/joomla_3/JViewLegacy_site.php @@ -48,14 +48,14 @@ class ###Component###View###SView### extends JViewLegacy $this->user = JFactory::getUser();###SITE_DIPLAY_METHOD### }###SITE_EXTRA_DIPLAY_METHODS### - /** + /** * Prepares the document */ protected function _prepareDocument() {###SITE_LIBRARIES_LOADER### ###SITE_UIKIT_LOADER### ###SITE_GOOGLECHART_LOADER### ###SITE_FOOTABLE_LOADER### ###SITE_DOCUMENT_METADATA### ###SITE_DOCUMENT_CUSTOM_PHP### // add the document default css file $this->document->addStyleSheet(JURI::root(true) .'/components/com_###component###/assets/css/###sview###.css');###SITE_DOCUMENT_CUSTOM_CSS### ###SITE_DOCUMENT_CUSTOM_JS### - } + } /** * Setting the toolbar @@ -64,7 +64,7 @@ class ###Component###View###SView### extends JViewLegacy { // adding the joomla toolbar to the front JLoader::register('JToolbarHelper', JPATH_ADMINISTRATOR.'/includes/toolbar.php');###SITE_CUSTOM_BUTTONS### - + // set help url for this view if found $help_url = ###Component###Helper::getHelpUrl('###sview###'); if (###Component###Helper::checkString($help_url)) @@ -75,7 +75,7 @@ class ###Component###View###SView### extends JViewLegacy $this->toolbar = JToolbar::getInstance(); }###SITE_GET_MODULE### - /** + /** * Escapes a value for output in a view script. * * @param mixed $var The output to escape. @@ -84,7 +84,7 @@ class ###Component###View###SView### extends JViewLegacy */ public function escape($var, $sorten = false, $length = 40) { - // use the helper htmlEscape method instead. + // use the helper htmlEscape method instead. return ###Component###Helper::htmlEscape($var, $this->_charset, $sorten, $length); } } diff --git a/admin/compiler/joomla_3/settings.json b/admin/compiler/joomla_3/settings.json index 9e5cd8796..f9fcc2cf3 100644 --- a/admin/compiler/joomla_3/settings.json +++ b/admin/compiler/joomla_3/settings.json @@ -1,738 +1,748 @@ { - "create": { - "admin": { - "assets": { - "css": "css", - "images": { - "icons": "icons" - }, - "js": "js" - }, - "controllers": "controllers", - "helpers": { - "html": "html" - }, - "language": { - "en-GB": "en-GB" - }, - "layouts": "layouts", - "models": { - "fields": "fields", - "forms": "forms", - "rules": "rules" - }, - "sql": { - "updates": { - "mysql": "mysql" - } - }, - "tables": "tables", - "views": "views" - }, - "site": { - "assets": { - "css": "css", - "images": "images", - "js": "js" - }, - "controllers": "controllers", - "helpers": "helpers", - "language": { - "en-GB": "en-GB" - }, - "layouts": "layouts", - "models": "models", - "views": "views" - }, - "media": { - "css": "css", - "images": "images", - "js": "js" - } - }, - "move": { - "static": { - "access.xml": { - "naam":"access.xml", - "path": "c0mp0n3nt/admin", - "rename": false, - "type": "file" - }, - "config.xml": { - "naam":"config.xml", - "path": "c0mp0n3nt/admin", - "rename": false, - "type": "file" - }, - "JControllerLegacy.php": { - "naam":"JControllerLegacy.php", - "path": "c0mp0n3nt/admin", - "rename": "new", - "newName": "controller.php", - "type": "file" - }, - "component.xml": { - "naam":"component.xml", - "path": "c0mp0n3nt/", - "rename": "component", - "type": "file" - }, - "component_admin.php": { - "naam":"component_admin.php", - "path": "c0mp0n3nt/admin", - "rename": "component_admin", - "type": "file" - }, - "admin.css": { - "naam":"admin.css", - "path": "c0mp0n3nt/admin/assets/css", - "rename": false, - "type": "file" - }, - "admin.js": { - "naam":"admin.js", - "path": "c0mp0n3nt/admin/assets/js", - "rename": false, - "type": "file" - }, - "site.css": { - "naam":"site.css", - "path": "c0mp0n3nt/site/assets/css", - "rename": false, - "type": "file" - }, - "site.js": { - "naam":"site.js", - "path": "c0mp0n3nt/site/assets/js", - "rename": false, - "type": "file" - }, - "batch_.php": { - "naam":"batch_.php", - "path": "c0mp0n3nt/admin/helpers/html", - "rename": false, - "type": "file" - }, - "batchselection.php": { - "naam":"batchselection.php", - "path": "c0mp0n3nt/admin/layouts", - "rename": false, - "type": "file" - }, - "component_site.php": { - "naam":"component_site.php", - "path": "c0mp0n3nt/site", - "rename": "component_site", - "type": "file" - }, - "router.php": { - "naam":"router.php", - "path": "c0mp0n3nt/site", - "rename": false, - "type": "file" - }, - "routeHelper.php": { - "naam":"routeHelper.php", - "path": "c0mp0n3nt/site/helpers", - "rename": "new", - "newName": "route.php", - "type": "file" - }, - "JControllerLegacySITE.php": { - "naam":"JControllerLegacySITE.php", - "path": "c0mp0n3nt/site", - "rename": "new", - "newName": "controller.php", - "type": "file" - }, - "Helper.php": { - "naam":"Helper.php", - "path": "c0mp0n3nt/admin/helpers", - "rename": "Helper", - "type": "file" - }, - "Helper_site.php": { - "naam":"Helper_site.php", - "path": "c0mp0n3nt/site/helpers", - "rename": "Helper_site", - "type": "file" - }, - "Helper_category.php": { - "naam":"Helper_category.php", - "path": "c0mp0n3nt/site/helpers", - "rename": "new", - "newName": "category.php", - "type": "file" - }, - "script.php": { - "naam":"script.php", - "path": "c0mp0n3nt/", - "rename": false, - "type": "file" - }, - "install.mysql.utf8.sql": { - "naam":"install.mysql.utf8.sql", - "path": "c0mp0n3nt/admin/sql", - "rename": false, - "type": "file" - }, - "uninstall.mysql.utf8.sql": { - "naam":"uninstall.mysql.utf8.sql", - "path": "c0mp0n3nt/admin/sql", - "rename": false, - "type": "file" - }, - "headercheck_admin.php": { - "naam":"headercheck_admin.php", - "path": "c0mp0n3nt/admin/helpers", - "rename": "new", - "newName": "headercheck.php", - "type": "file" - }, - "LICENSE.txt": { - "naam":"LICENSE.txt", - "path": "c0mp0n3nt/", - "rename": false, - "type": "file" - }, - "README.txt": { - "naam":"README.txt", - "path": "c0mp0n3nt/admin", - "rename": false, - "type": "file" - }, - "README.md": { - "naam":"README.md", - "path": "c0mp0n3nt/", - "rename": false, - "type": "file" - }, - "headercheck.php": { - "naam":"headercheck.php", - "path": "c0mp0n3nt/site/helpers", - "rename": false, - "type": "file" - } - }, - "dynamic": { - "admin": { - "vdm.php": { - "path": "c0mp0n3nt/admin", - "rename": false, - "type": "encrypt" - }, - "Helper_email.php": { - "path": "c0mp0n3nt/admin/helpers", - "rename": "Helper_", - "type": "emailer" - }, - "DASHJControllerAdmin.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "DASHJControllerAdmin", - "type": "dashboard" - }, - "DASHJModelList.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "DASHJModelList", - "type": "dashboard" - }, - "DASHJViewLagacy.php": { - "path": "c0mp0n3nt/admin/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "dashboard" - }, - "default_vdm.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "dashboard" - }, - "default_main.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "dashboard" - }, - "DASHdefault.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": "new", - "newName": "default.php", - "type": "dashboard" - }, - "dashboard.css": { - "path": "c0mp0n3nt/admin/assets/css", - "rename": false, - "type": "dashboard" - }, - "module_forms.xml": { - "path": "c0mp0n3nt/admin/models/forms", - "rename": "module_forms", - "type": "single" - }, - "module_forms.js": { - "path": "c0mp0n3nt/admin/models/forms", - "rename": "module_forms", - "type": "single" - }, - "edit.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "single" - }, - "JModelAdmin.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "JModelAdmin", - "type": "single" - }, - "JControllerForm.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "JControllerForm", - "type": "single" - }, - "JTable.php": { - "path": "c0mp0n3nt/admin/tables", - "rename": "JTable", - "type": "single" - }, - "submitbutton.js": { - "path": "c0mp0n3nt/admin/views/VIEW", - "rename": false, - "type": "single" - }, - "JViewLegacy_edit.php": { - "path": "c0mp0n3nt/admin/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "single" - }, - "view.css": { - "path": "c0mp0n3nt/admin/assets/css", - "rename": "view", - "type": "single" - }, - "JControllerAdmin.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "JControllerAdmin", - "type": "list" - }, - "JModelList.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "JModelList", - "type": "list" - }, - "views.css": { - "path": "c0mp0n3nt/admin/assets/css", - "rename": "views", - "type": "list" - }, - "JViewLegacy_list.php": { - "path": "c0mp0n3nt/admin/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "list" - }, - "default.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "list" - }, - "default_batch_body.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "list" - }, - "default_batch_footer.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "list" - }, - "default_toolbar.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "list" - }, - "default_head.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "list" - }, - "default_body.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "list" - }, - "default_foot.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": false, - "type": "list" - }, - "JFormRule.php": { - "path": "c0mp0n3nt/admin/models/rules", - "rename": "JFormRule", - "type": "rule" - }, - "layoutitems.php": { - "path": "c0mp0n3nt/admin/layouts/VIEW", - "rename": "layoutitems", - "type": "layoutitems" - }, - "layoutfull.php": { - "path": "c0mp0n3nt/admin/layouts/VIEW", - "rename": "layoutfull", - "type": "layoutfull" - }, - "layoutlinkedview.php": { - "path": "c0mp0n3nt/admin/layouts/VIEW", - "rename": "layoutlinkedview", - "type": "layoutlinkedview" - }, - "layouttitle.php": { - "path": "c0mp0n3nt/admin/layouts/VIEW", - "rename": "layouttitle", - "type": "layouttitle" - }, - "layoutpublished.php": { - "path": "c0mp0n3nt/admin/layouts/VIEW", - "rename": "layoutpublished", - "type": "layoutpublished" - }, - "layoutmetadata.php": { - "path": "c0mp0n3nt/admin/layouts/VIEW", - "rename": "layoutmetadata", - "type": "layoutmetadata" - }, - "JFormFieldList.php": { - "path": "c0mp0n3nt/admin/models/fields", - "rename": "JFormFieldList", - "type": "fieldlist" - }, - "JFormFieldRadio.php": { - "path": "c0mp0n3nt/admin/models/fields", - "rename": "JFormFieldRadio", - "type": "fieldradio" - }, - "JFormFieldCheckboxes.php": { - "path": "c0mp0n3nt/admin/models/fields", - "rename": "JFormFieldCheckboxes", - "type": "fieldcheckboxes" - }, - "JFormFieldUser.php": { - "path": "c0mp0n3nt/admin/models/fields", - "rename": "JFormFieldUser", - "type": "fielduser" - }, - "JControllerLegacyAjax.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "new", - "newName": "ajax.json.php", - "type": "ajax" - }, - "JModelListAjax.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "new", - "newName": "ajax.php", - "type": "ajax" - }, - "JControllerLegacy_import.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "new", - "newName": "import.php", - "type": "import" - }, - "JModelLegacy_import.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "new", - "newName": "import.php", - "type": "import" - }, - "JViewLegacy_import.php": { - "path": "c0mp0n3nt/admin/views/import", - "rename": "new", - "newName": "view.html.php", - "type": "import" - }, - "default_import.php": { - "path": "c0mp0n3nt/admin/views/import/tmpl", - "rename": "new", - "newName": "default.php", - "type": "import" - }, - "import.gif": { - "path": "c0mp0n3nt/admin/assets/images", - "rename": false, - "type": "import" - }, - "JControllerLegacy_import_custom.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "JControllerLegacy_import_custom", - "type": "customimport" - }, - "JModelLegacy_import_custom.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "JModelLegacy_import_custom", - "type": "customimport" - }, - "JViewLegacy_import_custom.php": { - "path": "c0mp0n3nt/admin/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "customimport" - }, - "default_import_custom.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": "new", - "newName": "default.php", - "type": "customimport" - }, - "JControllerLegacyHelp.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "new", - "newName": "help.php", - "type": "help" - }, - "1.0.0.sql": { - "path": "c0mp0n3nt/admin/sql/updates/mysql", - "rename": "1.0.0", - "type": "sql_update" - }, - "update_server.xml": { - "path": "c0mp0n3nt/", - "rename": "update_server", - "type": "update_server" - } - }, - "site": { - "JViewLegacy_list_site.php": { - "path": "c0mp0n3nt/site/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "list" - }, - "JModelList_site.php": { - "path": "c0mp0n3nt/site/models", - "rename": "JModelList_site", - "type": "list" - }, - "views_site.css": { - "path": "c0mp0n3nt/site/assets/css", - "rename": "views_site", - "type": "list" - }, - "default_list_site.php": { - "path": "c0mp0n3nt/site/views/VIEW/tmpl", - "rename": "new", - "newName": "default.php", - "type": "list" - }, - "JViewLegacy_site.php": { - "path": "c0mp0n3nt/site/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "single" - }, - "view_site.css": { - "path": "c0mp0n3nt/site/assets/css", - "rename": "view_site", - "type": "single" - }, - "JModelItem_site.php": { - "path": "c0mp0n3nt/site/models", - "rename": "JModelItem_site", - "type": "single" - }, - "default_site.php": { - "path": "c0mp0n3nt/site/views/VIEW/tmpl", - "rename": "new", - "newName": "default.php", - "type": "single" - }, - "default_site_template.php": { - "path": "c0mp0n3nt/site/views/VIEW/tmpl", - "rename": "site_template", - "type": "template" - }, - "layout_site.php": { - "path": "c0mp0n3nt/site/layouts", - "rename": "layout_site", - "type": "layout" - }, - "layoutitems.php": { - "path": "c0mp0n3nt/site/layouts/VIEW", - "rename": "layoutitems", - "type": "layoutitems" - }, - "layoutfull.php": { - "path": "c0mp0n3nt/site/layouts/VIEW", - "rename": "layoutfull", - "type": "layoutfull" - }, - "layoutlinkedview.php": { - "path": "c0mp0n3nt/site/layouts/VIEW", - "rename": "layoutlinkedview", - "type": "layoutlinkedview" - }, - "layouttitle.php": { - "path": "c0mp0n3nt/site/layouts/VIEW", - "rename": "layouttitle", - "type": "layouttitle" - }, - "layoutpublished.php": { - "path": "c0mp0n3nt/site/layouts/VIEW", - "rename": "layoutpublished", - "type": "layoutpublished" - }, - "layoutmetadata.php": { - "path": "c0mp0n3nt/site/layouts/VIEW", - "rename": "layoutmetadata", - "type": "layoutmetadata" - }, - "default.xml": { - "path": "c0mp0n3nt/site/views/VIEW/tmpl", - "rename": false, - "type": "menu" - }, - "module_forms.xml": { - "path": "c0mp0n3nt/site/models/forms", - "rename": "module_forms", - "type": "edit" - }, - "module_forms.js": { - "path": "c0mp0n3nt/site/models/forms", - "rename": "module_forms", - "type": "edit" - }, - "edit_site.php": { - "path": "c0mp0n3nt/site/views/VIEW/tmpl", - "rename": "new", - "newName": "edit.php", - "type": "edit" - }, - "JModelAdmin_site.php": { - "path": "c0mp0n3nt/site/models", - "rename": "JModelAdmin_site", - "type": "edit" - }, - "JControllerForm_site.php": { - "path": "c0mp0n3nt/site/controllers", - "rename": "JControllerForm_site", - "type": "edit" - }, - "submitbutton.js": { - "path": "c0mp0n3nt/site/views/VIEW", - "rename": false, - "type": "edit" - }, - "JViewLegacy_edit_site.php": { - "path": "c0mp0n3nt/site/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "edit" - }, - "view_site_edit.css": { - "path": "c0mp0n3nt/site/assets/css", - "rename": "view_site_edit", - "type": "edit" - }, - "JControllerLegacyAjaxSite.php": { - "path": "c0mp0n3nt/site/controllers", - "rename": "new", - "newName": "ajax.json.php", - "type": "ajax" - }, - "JModelListAjaxSite.php": { - "path": "c0mp0n3nt/site/models", - "rename": "new", - "newName": "ajax.php", - "type": "ajax" - }, - "JControllerLegacyHelp_site.php": { - "path": "c0mp0n3nt/site/controllers", - "rename": "new", - "newName": "help.php", - "type": "help" - }, - "JControllerForm_custom_site.php": { - "path": "c0mp0n3nt/site/controllers", - "rename": "JControllerForm_custom_site", - "type": "custom_form" - }, - "submitbutton_site.js": { - "path": "c0mp0n3nt/site/views/VIEW", - "rename": "new", - "newName": "submitbutton.js", - "type": "custom_form" - }, - "Helper_category_view.php": { - "path": "c0mp0n3nt/site/helpers", - "rename": "Helper_category_view", - "type": "category" - } - }, - "custom_admin": { - "JViewLegacy_list_custom_admin.php": { - "path": "c0mp0n3nt/admin/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "list" - }, - "JModelList_custom_admin.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "JModelList_custom_admin", - "type": "list" - }, - "default_list_custom_admin.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": "new", - "newName": "default.php", - "type": "list" - }, - "JControllerAdmin_custom_admin.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "JControllerAdmin_custom_admin", - "type": "list" - }, - "views_custom_admin.css": { - "path": "c0mp0n3nt/admin/assets/css", - "rename": "views_custom_admin", - "type": "list" - }, - "view_custom_admin.css": { - "path": "c0mp0n3nt/admin/assets/css", - "rename": "view_custom_admin", - "type": "single" - }, - "JViewLegacy_custom_admin.php": { - "path": "c0mp0n3nt/admin/views/VIEW", - "rename": "new", - "newName": "view.html.php", - "type": "single" - }, - "JModelItem_custom_admin.php": { - "path": "c0mp0n3nt/admin/models", - "rename": "JModelItem_custom_admin", - "type": "single" - }, - "default_custom_admin.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": "new", - "newName": "default.php", - "type": "single" - }, - "JControllerLegacy_custom_admin.php": { - "path": "c0mp0n3nt/admin/controllers", - "rename": "JControllerLegacy_custom_admin", - "type": "single" - }, - "default_custom_admin_template.php": { - "path": "c0mp0n3nt/admin/views/VIEW/tmpl", - "rename": "custom_admin_template", - "type": "template" - }, - "layout_custom_admin.php": { - "path": "c0mp0n3nt/admin/layouts", - "rename": "layout_custom_admin", - "type": "layout" - } - } - } - } + "create": { + "admin": { + "assets": { + "css": "css", + "images": { + "icons": "icons" + }, + "js": "js" + }, + "controllers": "controllers", + "helpers": { + "html": "html" + }, + "language": { + "en-GB": "en-GB" + }, + "layouts": "layouts", + "models": { + "fields": "fields", + "forms": "forms", + "rules": "rules" + }, + "sql": { + "updates": { + "mysql": "mysql" + } + }, + "tables": "tables", + "views": "views" + }, + "site": { + "assets": { + "css": "css", + "images": "images", + "js": "js" + }, + "controllers": "controllers", + "helpers": "helpers", + "language": { + "en-GB": "en-GB" + }, + "layouts": "layouts", + "models": "models", + "views": "views" + }, + "media": { + "css": "css", + "images": "images", + "js": "js" + } + }, + "move": { + "static": { + "access.xml": { + "naam": "access.xml", + "path": "c0mp0n3nt/admin", + "rename": false, + "type": "file" + }, + "config.xml": { + "naam": "config.xml", + "path": "c0mp0n3nt/admin", + "rename": false, + "type": "file" + }, + "JControllerLegacy.php": { + "naam": "JControllerLegacy.php", + "path": "c0mp0n3nt/admin", + "rename": "new", + "newName": "controller.php", + "type": "file" + }, + "component.xml": { + "naam": "component.xml", + "path": "c0mp0n3nt/", + "rename": "component", + "type": "file" + }, + "component_admin.php": { + "naam": "component_admin.php", + "path": "c0mp0n3nt/admin", + "rename": "component_admin", + "type": "file" + }, + "admin.css": { + "naam": "admin.css", + "path": "c0mp0n3nt/admin/assets/css", + "rename": false, + "type": "file" + }, + "admin.js": { + "naam": "admin.js", + "path": "c0mp0n3nt/admin/assets/js", + "rename": false, + "type": "file" + }, + "site.css": { + "naam": "site.css", + "path": "c0mp0n3nt/site/assets/css", + "rename": false, + "type": "file" + }, + "site.js": { + "naam": "site.js", + "path": "c0mp0n3nt/site/assets/js", + "rename": false, + "type": "file" + }, + "batch_.php": { + "naam": "batch_.php", + "path": "c0mp0n3nt/admin/helpers/html", + "rename": false, + "type": "file" + }, + "batchselection.php": { + "naam": "batchselection.php", + "path": "c0mp0n3nt/admin/layouts", + "rename": false, + "type": "file" + }, + "component_site.php": { + "naam": "component_site.php", + "path": "c0mp0n3nt/site", + "rename": "component_site", + "type": "file" + }, + "router.php": { + "naam": "router.php", + "path": "c0mp0n3nt/site", + "rename": false, + "type": "file" + }, + "routeHelper.php": { + "naam": "routeHelper.php", + "path": "c0mp0n3nt/site/helpers", + "rename": "new", + "newName": "route.php", + "type": "file" + }, + "JControllerLegacySITE.php": { + "naam": "JControllerLegacySITE.php", + "path": "c0mp0n3nt/site", + "rename": "new", + "newName": "controller.php", + "type": "file" + }, + "Helper.php": { + "naam": "Helper.php", + "path": "c0mp0n3nt/admin/helpers", + "rename": "Helper", + "type": "file" + }, + "Helper_site.php": { + "naam": "Helper_site.php", + "path": "c0mp0n3nt/site/helpers", + "rename": "Helper_site", + "type": "file" + }, + "Helper_category.php": { + "naam": "Helper_category.php", + "path": "c0mp0n3nt/site/helpers", + "rename": "new", + "newName": "category.php", + "type": "file" + }, + "script.php": { + "naam": "script.php", + "path": "c0mp0n3nt/", + "rename": false, + "type": "file" + }, + "install.mysql.utf8.sql": { + "naam": "install.mysql.utf8.sql", + "path": "c0mp0n3nt/admin/sql", + "rename": false, + "type": "file" + }, + "uninstall.mysql.utf8.sql": { + "naam": "uninstall.mysql.utf8.sql", + "path": "c0mp0n3nt/admin/sql", + "rename": false, + "type": "file" + }, + "headercheck_admin.php": { + "naam": "headercheck_admin.php", + "path": "c0mp0n3nt/admin/helpers", + "rename": "new", + "newName": "headercheck.php", + "type": "file" + }, + "LICENSE.txt": { + "naam": "LICENSE.txt", + "path": "c0mp0n3nt/", + "rename": false, + "type": "file" + }, + "README.txt": { + "naam": "README.txt", + "path": "c0mp0n3nt/admin", + "rename": false, + "type": "file" + }, + "README.md": { + "naam": "README.md", + "path": "c0mp0n3nt/", + "rename": false, + "type": "file" + }, + "headercheck.php": { + "naam": "headercheck.php", + "path": "c0mp0n3nt/site/helpers", + "rename": false, + "type": "file" + } + }, + "dynamic": { + "admin": { + "vdm.php": { + "path": "c0mp0n3nt/admin", + "rename": false, + "type": "encrypt" + }, + "Helper_email.php": { + "path": "c0mp0n3nt/admin/helpers", + "rename": "Helper_", + "type": "emailer" + }, + "DASHJControllerAdmin.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "DASHJControllerAdmin", + "type": "dashboard" + }, + "DASHJModelList.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "DASHJModelList", + "type": "dashboard" + }, + "DASHJViewLagacy.php": { + "path": "c0mp0n3nt/admin/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "dashboard" + }, + "default_vdm.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "dashboard" + }, + "default_main.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "dashboard" + }, + "DASHdefault.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": "new", + "newName": "default.php", + "type": "dashboard" + }, + "dashboard.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": false, + "type": "dashboard" + }, + "module_forms.xml": { + "path": "c0mp0n3nt/admin/models/forms", + "rename": "module_forms", + "type": "single" + }, + "module_forms.js": { + "path": "c0mp0n3nt/admin/models/forms", + "rename": "module_forms", + "type": "single" + }, + "edit.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "single" + }, + "JModelAdmin.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "JModelAdmin", + "type": "single" + }, + "JControllerForm.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "JControllerForm", + "type": "single" + }, + "JTable.php": { + "path": "c0mp0n3nt/admin/tables", + "rename": "JTable", + "type": "single" + }, + "submitbutton.js": { + "path": "c0mp0n3nt/admin/views/VIEW", + "rename": false, + "type": "single" + }, + "JViewLegacy_edit.php": { + "path": "c0mp0n3nt/admin/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "single" + }, + "view.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": "view", + "type": "single" + }, + "JControllerAdmin.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "JControllerAdmin", + "type": "list" + }, + "JModelList.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "JModelList", + "type": "list" + }, + "views.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": "views", + "type": "list" + }, + "JViewLegacy_list.php": { + "path": "c0mp0n3nt/admin/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "list" + }, + "default.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "list" + }, + "default_batch_body.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "list" + }, + "default_batch_footer.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "list" + }, + "default_toolbar.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "list" + }, + "default_head.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "list" + }, + "default_body.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "list" + }, + "default_foot.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "list" + }, + "JFormRule.php": { + "path": "c0mp0n3nt/admin/models/rules", + "rename": "JFormRule", + "type": "rule" + }, + "layoutitems.php": { + "path": "c0mp0n3nt/admin/layouts/VIEW", + "rename": "layoutitems", + "type": "layoutitems" + }, + "layoutfull.php": { + "path": "c0mp0n3nt/admin/layouts/VIEW", + "rename": "layoutfull", + "type": "layoutfull" + }, + "layoutlinkedview.php": { + "path": "c0mp0n3nt/admin/layouts/VIEW", + "rename": "layoutlinkedview", + "type": "layoutlinkedview" + }, + "layouttitle.php": { + "path": "c0mp0n3nt/admin/layouts/VIEW", + "rename": "layouttitle", + "type": "layouttitle" + }, + "layoutpublished.php": { + "path": "c0mp0n3nt/admin/layouts/VIEW", + "rename": "layoutpublished", + "type": "layoutpublished" + }, + "layoutmetadata.php": { + "path": "c0mp0n3nt/admin/layouts/VIEW", + "rename": "layoutmetadata", + "type": "layoutmetadata" + }, + "JFormFieldList.php": { + "path": "c0mp0n3nt/admin/models/fields", + "rename": "JFormFieldList", + "type": "fieldlist" + }, + "JFormFieldRadio.php": { + "path": "c0mp0n3nt/admin/models/fields", + "rename": "JFormFieldRadio", + "type": "fieldradio" + }, + "JFormFieldCheckboxes.php": { + "path": "c0mp0n3nt/admin/models/fields", + "rename": "JFormFieldCheckboxes", + "type": "fieldcheckboxes" + }, + "JFormFieldUser.php": { + "path": "c0mp0n3nt/admin/models/fields", + "rename": "JFormFieldUser", + "type": "fielduser" + }, + "JControllerLegacyAjax.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "new", + "newName": "ajax.json.php", + "type": "ajax" + }, + "JModelListAjax.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "new", + "newName": "ajax.php", + "type": "ajax" + }, + "JControllerLegacy_import.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "new", + "newName": "import.php", + "type": "import" + }, + "JModelLegacy_import.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "new", + "newName": "import.php", + "type": "import" + }, + "JViewLegacy_import.php": { + "path": "c0mp0n3nt/admin/views/import", + "rename": "new", + "newName": "view.html.php", + "type": "import" + }, + "default_import.php": { + "path": "c0mp0n3nt/admin/views/import/tmpl", + "rename": "new", + "newName": "default.php", + "type": "import" + }, + "import.gif": { + "path": "c0mp0n3nt/admin/assets/images", + "rename": false, + "type": "import" + }, + "JControllerLegacy_import_custom.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "JControllerLegacy_import_custom", + "type": "customimport" + }, + "JModelLegacy_import_custom.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "JModelLegacy_import_custom", + "type": "customimport" + }, + "JViewLegacy_import_custom.php": { + "path": "c0mp0n3nt/admin/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "customimport" + }, + "default_import_custom.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": "new", + "newName": "default.php", + "type": "customimport" + }, + "JControllerLegacyHelp.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "new", + "newName": "help.php", + "type": "help" + }, + "1.0.0.sql": { + "path": "c0mp0n3nt/admin/sql/updates/mysql", + "rename": "1.0.0", + "type": "sql_update" + }, + "update_server.xml": { + "path": "c0mp0n3nt/", + "rename": "update_server", + "type": "update_server" + } + }, + "site": { + "JViewLegacy_list_site.php": { + "path": "c0mp0n3nt/site/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "list" + }, + "JModelList_site.php": { + "path": "c0mp0n3nt/site/models", + "rename": "JModelList_site", + "type": "list" + }, + "views_site.css": { + "path": "c0mp0n3nt/site/assets/css", + "rename": "views_site", + "type": "list" + }, + "default_list_site.php": { + "path": "c0mp0n3nt/site/views/VIEW/tmpl", + "rename": "new", + "newName": "default.php", + "type": "list" + }, + "JViewLegacy_site.php": { + "path": "c0mp0n3nt/site/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "single" + }, + "view_site.css": { + "path": "c0mp0n3nt/site/assets/css", + "rename": "view_site", + "type": "single" + }, + "JModelItem_site.php": { + "path": "c0mp0n3nt/site/models", + "rename": "JModelItem_site", + "type": "single" + }, + "default_site.php": { + "path": "c0mp0n3nt/site/views/VIEW/tmpl", + "rename": "new", + "newName": "default.php", + "type": "single" + }, + "default_site_template.php": { + "path": "c0mp0n3nt/site/views/VIEW/tmpl", + "rename": "site_template", + "type": "template" + }, + "layout_site.php": { + "path": "c0mp0n3nt/site/layouts", + "rename": "layout_site", + "type": "layout" + }, + "layoutitems.php": { + "path": "c0mp0n3nt/site/layouts/VIEW", + "rename": "layoutitems", + "type": "layoutitems" + }, + "layoutfull.php": { + "path": "c0mp0n3nt/site/layouts/VIEW", + "rename": "layoutfull", + "type": "layoutfull" + }, + "layoutlinkedview.php": { + "path": "c0mp0n3nt/site/layouts/VIEW", + "rename": "layoutlinkedview", + "type": "layoutlinkedview" + }, + "layouttitle.php": { + "path": "c0mp0n3nt/site/layouts/VIEW", + "rename": "layouttitle", + "type": "layouttitle" + }, + "layoutpublished.php": { + "path": "c0mp0n3nt/site/layouts/VIEW", + "rename": "layoutpublished", + "type": "layoutpublished" + }, + "layoutmetadata.php": { + "path": "c0mp0n3nt/site/layouts/VIEW", + "rename": "layoutmetadata", + "type": "layoutmetadata" + }, + "default.xml": { + "path": "c0mp0n3nt/site/views/VIEW/tmpl", + "rename": false, + "type": "menu" + }, + "module_forms.xml": { + "path": "c0mp0n3nt/site/models/forms", + "rename": "module_forms", + "type": "edit" + }, + "module_forms.js": { + "path": "c0mp0n3nt/site/models/forms", + "rename": "module_forms", + "type": "edit" + }, + "edit_site.php": { + "path": "c0mp0n3nt/site/views/VIEW/tmpl", + "rename": "new", + "newName": "edit.php", + "type": "edit" + }, + "JModelAdmin_site.php": { + "path": "c0mp0n3nt/site/models", + "rename": "JModelAdmin_site", + "type": "edit" + }, + "JControllerForm_site.php": { + "path": "c0mp0n3nt/site/controllers", + "rename": "JControllerForm_site", + "type": "edit" + }, + "submitbutton.js": { + "path": "c0mp0n3nt/site/views/VIEW", + "rename": false, + "type": "edit" + }, + "JViewLegacy_edit_site.php": { + "path": "c0mp0n3nt/site/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "edit" + }, + "view_site_edit.css": { + "path": "c0mp0n3nt/site/assets/css", + "rename": "view_site_edit", + "type": "edit" + }, + "JControllerLegacyAjaxSite.php": { + "path": "c0mp0n3nt/site/controllers", + "rename": "new", + "newName": "ajax.json.php", + "type": "ajax" + }, + "JModelListAjaxSite.php": { + "path": "c0mp0n3nt/site/models", + "rename": "new", + "newName": "ajax.php", + "type": "ajax" + }, + "JControllerLegacyHelp_site.php": { + "path": "c0mp0n3nt/site/controllers", + "rename": "new", + "newName": "help.php", + "type": "help" + }, + "JControllerForm_custom_site.php": { + "path": "c0mp0n3nt/site/controllers", + "rename": "JControllerForm_custom_site", + "type": "custom_form" + }, + "submitbutton_site.js": { + "path": "c0mp0n3nt/site/views/VIEW", + "rename": "new", + "newName": "submitbutton.js", + "type": "custom_form" + }, + "Helper_category_view.php": { + "path": "c0mp0n3nt/site/helpers", + "rename": "Helper_category_view", + "type": "category" + }, + "viewFileSite.js": { + "path": "c0mp0n3nt/site/assets/js", + "rename": "viewFileSite", + "type": "javascript_file" + } + }, + "custom_admin": { + "JViewLegacy_list_custom_admin.php": { + "path": "c0mp0n3nt/admin/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "list" + }, + "JModelList_custom_admin.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "JModelList_custom_admin", + "type": "list" + }, + "default_list_custom_admin.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": "new", + "newName": "default.php", + "type": "list" + }, + "JControllerAdmin_custom_admin.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "JControllerAdmin_custom_admin", + "type": "list" + }, + "views_custom_admin.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": "views_custom_admin", + "type": "list" + }, + "view_custom_admin.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": "view_custom_admin", + "type": "single" + }, + "JViewLegacy_custom_admin.php": { + "path": "c0mp0n3nt/admin/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "single" + }, + "JModelItem_custom_admin.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "JModelItem_custom_admin", + "type": "single" + }, + "default_custom_admin.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": "new", + "newName": "default.php", + "type": "single" + }, + "JControllerLegacy_custom_admin.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "JControllerLegacy_custom_admin", + "type": "single" + }, + "default_custom_admin_template.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": "custom_admin_template", + "type": "template" + }, + "layout_custom_admin.php": { + "path": "c0mp0n3nt/admin/layouts", + "rename": "layout_custom_admin", + "type": "layout" + }, + "viewFileCustomAdmin.js": { + "path": "c0mp0n3nt/admin/assets/js", + "rename": "viewFileCustomAdmin", + "type": "javascript_file" + } + } + } + } } \ No newline at end of file diff --git a/admin/compiler/joomla_3/viewFile.js b/admin/compiler/joomla_3/viewFile.js new file mode 100644 index 000000000..9c701e5be --- /dev/null +++ b/admin/compiler/joomla_3/viewFile.js @@ -0,0 +1,4 @@ +###BOM### + +/* JS Document */ +###ADMINJS### \ No newline at end of file diff --git a/admin/compiler/joomla_3/viewFileCustomAdmin.js b/admin/compiler/joomla_3/viewFileCustomAdmin.js new file mode 100644 index 000000000..8abce3885 --- /dev/null +++ b/admin/compiler/joomla_3/viewFileCustomAdmin.js @@ -0,0 +1,4 @@ +###BOM### + +/* JS Document */ +###CUSTOM_ADMIN_JAVASCRIPT_FILE### \ No newline at end of file diff --git a/admin/compiler/joomla_3/viewFileSite.js b/admin/compiler/joomla_3/viewFileSite.js new file mode 100644 index 000000000..12ed97db2 --- /dev/null +++ b/admin/compiler/joomla_3/viewFileSite.js @@ -0,0 +1,4 @@ +###BOM### + +/* JS Document */ +###SITE_JAVASCRIPT_FILE### \ No newline at end of file diff --git a/admin/controller.php b/admin/controller.php index 9a52d777f..9561495ff 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -39,7 +39,7 @@ class ComponentbuilderController extends JControllerLegacy * * @return void */ - function display($cachable = false, $urlparams = false) + function display($cachable = false, $urlparams = false) { // set default view if not set $view = $this->input->getCmd('view', 'Componentbuilder'); @@ -48,46 +48,46 @@ class ComponentbuilderController extends JControllerLegacy $id = $this->input->getInt('id'); // Check for edit form. - if(ComponentbuilderHelper::checkArray($data)) - { - if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_componentbuilder.edit.'.$data['view'], $id)) - { - // Somehow the person just went to the form - we don't allow that. - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); - $this->setMessage($this->getError(), 'error'); - // check if item was opend from other then its own list view - $ref = $this->input->getCmd('ref', 0); - $refid = $this->input->getInt('refid', 0); - // set redirect - if ($refid > 0 && ComponentbuilderHelper::checkString($ref)) - { - // redirect to item of ref - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); - } - elseif (ComponentbuilderHelper::checkString($ref)) - { + if(ComponentbuilderHelper::checkArray($data)) + { + if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_componentbuilder.edit.'.$data['view'], $id)) + { + // Somehow the person just went to the form - we don't allow that. + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + $this->setMessage($this->getError(), 'error'); + // check if item was opend from other then its own list view + $ref = $this->input->getCmd('ref', 0); + $refid = $this->input->getInt('refid', 0); + // set redirect + if ($refid > 0 && ComponentbuilderHelper::checkString($ref)) + { + // redirect to item of ref + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); + } + elseif (ComponentbuilderHelper::checkString($ref)) + { - // redirect to ref - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view='.(string)$ref, false)); - } - else - { - // normal redirect back to the list view - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view='.$data['views'], false)); - } + // redirect to ref + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view='.(string)$ref, false)); + } + else + { + // normal redirect back to the list view + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view='.$data['views'], false)); + } - return false; - } - } + return false; + } + } return parent::display($cachable, $urlparams); } protected function getViewRelation($view) { - if (ComponentbuilderHelper::checkString($view)) - { - $views = array( + if (ComponentbuilderHelper::checkString($view)) + { + $views = array( 'joomla_component' => 'joomla_components', 'admin_view' => 'admin_views', 'custom_admin_view' => 'custom_admin_views', @@ -118,18 +118,18 @@ class ComponentbuilderController extends JControllerLegacy 'snippet_type' => 'snippet_types', 'library_config' => 'libraries_config', 'library_files_folders_urls' => 'libraries_files_folders_urls' - ); - // check if this is a list view - if (in_array($view,$views)) - { - return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view); - } - // check if it is an edit view - elseif (array_key_exists($view,$views)) - { - return array('edit' => true, 'view' => $view, 'views' => $views[$view]); - } - } + ); + // check if this is a list view + if (in_array($view,$views)) + { + return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view); + } + // check if it is an edit view + elseif (array_key_exists($view,$views)) + { + return array('edit' => true, 'view' => $view, 'views' => $views[$view]); + } + } return false; } } diff --git a/admin/controllers/admin_fields.php b/admin/controllers/admin_fields.php index 6f33ae718..101f3d29f 100644 --- a/admin/controllers/admin_fields.php +++ b/admin/controllers/admin_fields.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerAdmin_fields extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerAdmin_fields extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/admin_fields_conditions.php b/admin/controllers/admin_fields_conditions.php index ab95405b6..0b5f79099 100644 --- a/admin/controllers/admin_fields_conditions.php +++ b/admin/controllers/admin_fields_conditions.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerAdmin_fields_conditions extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerAdmin_fields_conditions extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/admin_view.php b/admin/controllers/admin_view.php index f239faef7..5610ef468 100644 --- a/admin/controllers/admin_view.php +++ b/admin/controllers/admin_view.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerAdmin_view extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerAdmin_view extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index f845eb1fc..93d127187 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -73,10 +73,10 @@ class ComponentbuilderControllerAjax extends JControllerLegacy $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); if($token == $call_token) - { + { $task = $this->getTask(); switch($task) - { + { case 'isNew': try { @@ -887,14 +887,14 @@ class ComponentbuilderControllerAjax extends JControllerLegacy break; } } - else - { + else + { if($callback = $jinput->get('callback', null, 'CMD')) - { + { echo $callback."(".json_encode(false).");"; } - else - { + else + { echo "(".json_encode(false).");"; } } diff --git a/admin/controllers/component_admin_views.php b/admin/controllers/component_admin_views.php index 1bbfd1896..f74ca9b70 100644 --- a/admin/controllers/component_admin_views.php +++ b/admin/controllers/component_admin_views.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerComponent_admin_views extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerComponent_admin_views extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/component_config.php b/admin/controllers/component_config.php index 9f16fa549..04d1f5220 100644 --- a/admin/controllers/component_config.php +++ b/admin/controllers/component_config.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerComponent_config extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerComponent_config extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/component_custom_admin_menus.php b/admin/controllers/component_custom_admin_menus.php index 965907a9c..0c3cc89f0 100644 --- a/admin/controllers/component_custom_admin_menus.php +++ b/admin/controllers/component_custom_admin_menus.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerComponent_custom_admin_menus extends JController { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerComponent_custom_admin_menus extends JController $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/component_custom_admin_views.php b/admin/controllers/component_custom_admin_views.php index 88295e292..bcbf2b6a2 100644 --- a/admin/controllers/component_custom_admin_views.php +++ b/admin/controllers/component_custom_admin_views.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerComponent_custom_admin_views extends JController { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerComponent_custom_admin_views extends JController $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/component_dashboard.php b/admin/controllers/component_dashboard.php index 412f1f7b9..f4c411364 100644 --- a/admin/controllers/component_dashboard.php +++ b/admin/controllers/component_dashboard.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerComponent_dashboard extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerComponent_dashboard extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/component_files_folders.php b/admin/controllers/component_files_folders.php index 8e7133f2f..65dcb8a0f 100644 --- a/admin/controllers/component_files_folders.php +++ b/admin/controllers/component_files_folders.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerComponent_files_folders extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerComponent_files_folders extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/component_mysql_tweaks.php b/admin/controllers/component_mysql_tweaks.php index 3a08647de..bdebea6a8 100644 --- a/admin/controllers/component_mysql_tweaks.php +++ b/admin/controllers/component_mysql_tweaks.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerComponent_mysql_tweaks extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerComponent_mysql_tweaks extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/component_site_views.php b/admin/controllers/component_site_views.php index 85e873758..366d3fdfe 100644 --- a/admin/controllers/component_site_views.php +++ b/admin/controllers/component_site_views.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerComponent_site_views extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerComponent_site_views extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/component_updates.php b/admin/controllers/component_updates.php index 4d6b6b639..670ccbfe5 100644 --- a/admin/controllers/component_updates.php +++ b/admin/controllers/component_updates.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerComponent_updates extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerComponent_updates extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/custom_admin_view.php b/admin/controllers/custom_admin_view.php index 1bbad600b..c2cf7b824 100644 --- a/admin/controllers/custom_admin_view.php +++ b/admin/controllers/custom_admin_view.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerCustom_admin_view extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerCustom_admin_view extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/custom_code.php b/admin/controllers/custom_code.php index 55628f4a0..a5c799a7e 100644 --- a/admin/controllers/custom_code.php +++ b/admin/controllers/custom_code.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerCustom_code extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerCustom_code extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/dynamic_get.php b/admin/controllers/dynamic_get.php index ebfb0cd27..b2db5bcaa 100644 --- a/admin/controllers/dynamic_get.php +++ b/admin/controllers/dynamic_get.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerDynamic_get extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerDynamic_get extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/field.php b/admin/controllers/field.php index a1598f1ad..dbe21b334 100644 --- a/admin/controllers/field.php +++ b/admin/controllers/field.php @@ -158,10 +158,10 @@ class ComponentbuilderControllerField extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -273,11 +273,11 @@ class ComponentbuilderControllerField extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/fieldtype.php b/admin/controllers/fieldtype.php index 681378c18..9c2e006b0 100644 --- a/admin/controllers/fieldtype.php +++ b/admin/controllers/fieldtype.php @@ -158,10 +158,10 @@ class ComponentbuilderControllerFieldtype extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -273,11 +273,11 @@ class ComponentbuilderControllerFieldtype extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/ftp.php b/admin/controllers/ftp.php index 3e10d8c4f..9338475c1 100644 --- a/admin/controllers/ftp.php +++ b/admin/controllers/ftp.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerFtp extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerFtp extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/help.php b/admin/controllers/help.php index 941039bfa..0c58c6c71 100644 --- a/admin/controllers/help.php +++ b/admin/controllers/help.php @@ -48,7 +48,8 @@ class ComponentbuilderControllerHelp extends JControllerLegacy // Check Token! $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); - if($user->id != 0 && $token == $call_token){ + if($user->id != 0 && $token == $call_token) + { $task = $this->getTask(); switch($task){ case 'getText': @@ -64,25 +65,25 @@ class ComponentbuilderControllerHelp extends JControllerLegacy $result = ''; } echo $result; - // stop execution gracefully - jexit(); + // stop execution gracefully + jexit(); } - catch(Exception $e) + catch(Exception $e) { - // stop execution gracefully + // stop execution gracefully jexit(); } break; } } - else - { - // stop execution gracefully + else + { + // stop execution gracefully jexit(); } } - protected function getHelpDocumentText($id) + protected function getHelpDocumentText($id) { $db = JFactory::getDbo(); $query = $db->getQuery(true); diff --git a/admin/controllers/help_document.php b/admin/controllers/help_document.php index 07c70203b..1ddd4b3f6 100644 --- a/admin/controllers/help_document.php +++ b/admin/controllers/help_document.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerHelp_document extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerHelp_document extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/joomla_component.php b/admin/controllers/joomla_component.php index 9eff11704..d5d5330aa 100644 --- a/admin/controllers/joomla_component.php +++ b/admin/controllers/joomla_component.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerJoomla_component extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerJoomla_component extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/language.php b/admin/controllers/language.php index 3e041d5d8..ef979f490 100644 --- a/admin/controllers/language.php +++ b/admin/controllers/language.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerLanguage extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerLanguage extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/language_translation.php b/admin/controllers/language_translation.php index a7655d467..1876d674b 100644 --- a/admin/controllers/language_translation.php +++ b/admin/controllers/language_translation.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerLanguage_translation extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerLanguage_translation extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/layout.php b/admin/controllers/layout.php index db252606c..2cefa3187 100644 --- a/admin/controllers/layout.php +++ b/admin/controllers/layout.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerLayout extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerLayout extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/library.php b/admin/controllers/library.php index e45db5475..5fb2fe38e 100644 --- a/admin/controllers/library.php +++ b/admin/controllers/library.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerLibrary extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerLibrary extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/library_config.php b/admin/controllers/library_config.php index 2edb5eec0..04712651c 100644 --- a/admin/controllers/library_config.php +++ b/admin/controllers/library_config.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerLibrary_config extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerLibrary_config extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/library_files_folders_urls.php b/admin/controllers/library_files_folders_urls.php index b6061cfce..eda3af15b 100644 --- a/admin/controllers/library_files_folders_urls.php +++ b/admin/controllers/library_files_folders_urls.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerLibrary_files_folders_urls extends JControllerFo { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerLibrary_files_folders_urls extends JControllerFo $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/site_view.php b/admin/controllers/site_view.php index f53fe1ce3..a168419a5 100644 --- a/admin/controllers/site_view.php +++ b/admin/controllers/site_view.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerSite_view extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerSite_view extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/snippet.php b/admin/controllers/snippet.php index 382b493c4..0e86fedd5 100644 --- a/admin/controllers/snippet.php +++ b/admin/controllers/snippet.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerSnippet extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerSnippet extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/snippet_type.php b/admin/controllers/snippet_type.php index 3d6613c96..dae5d897c 100644 --- a/admin/controllers/snippet_type.php +++ b/admin/controllers/snippet_type.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerSnippet_type extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerSnippet_type extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/controllers/template.php b/admin/controllers/template.php index 01e7d39cf..e5ba4cc48 100644 --- a/admin/controllers/template.php +++ b/admin/controllers/template.php @@ -159,10 +159,10 @@ class ComponentbuilderControllerTemplate extends JControllerForm { $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; } - elseif ($ref) - { + elseif ($ref) + { $append .= '&ref='.(string)$ref; - } + } if ($tmpl) { @@ -274,11 +274,11 @@ class ComponentbuilderControllerTemplate extends JControllerForm $this->ref = $this->input->get('ref', 0, 'word'); $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } $saved = parent::save($key, $urlVar); diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php index e000b987a..32ebd78fa 100644 --- a/admin/helpers/compiler.php +++ b/admin/helpers/compiler.php @@ -1,27 +1,28 @@ - @my wife Roline van der Merwe - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Builds Complex Joomla Components - -/-----------------------------------------------------------------------------------------------------------------------------*/ +/* --------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| + /-------------------------------------------------------------------------------------------------------------------------------/ + + @version 2.6.x + @created 30th April, 2015 + @package Component Builder + @subpackage compiler.php + @author Llewellyn van der Merwe + @my wife Roline van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + + /----------------------------------------------------------------------------------------------------------------------------- */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); @@ -39,8 +40,9 @@ class Compiler extends Infusion * * @var string */ + private $tempPath; - + /* * The timer * @@ -48,19 +50,18 @@ class Compiler extends Infusion */ private $time_start; private $time_end; - public $secondsCompiled; - - public $filepath = ''; + public $secondsCompiled; + public $filepath = ''; // fixed pathes - protected $dynamicIntegration = false; - protected $backupPath = false; - protected $repoPath = false; - protected $addCustomCodeAt = array(); + protected $dynamicIntegration = false; + protected $backupPath = false; + protected $repoPath = false; + protected $addCustomCodeAt = array(); /** * Constructor */ - public function __construct($config = array ()) + public function __construct($config = array()) { // to check the compiler speed $this->time_start = microtime(true); @@ -68,17 +69,17 @@ class Compiler extends Infusion if (parent::__construct($config)) { // set temp directory - $comConfig = JFactory::getConfig(); - $this->tempPath = $comConfig->get('tmp_path'); + $comConfig = JFactory::getConfig(); + $this->tempPath = $comConfig->get('tmp_path'); // set some folder paths in relation to distribution if ($config['addBackup']) { - $this->backupPath = $this->params->get('backup_folder_path', $this->tempPath).'/'.$this->componentBackupName.'.zip'; - $this->dynamicIntegration = true; + $this->backupPath = $this->params->get('backup_folder_path', $this->tempPath) . '/' . $this->componentBackupName . '.zip'; + $this->dynamicIntegration = true; } if ($config['addRepo']) { - $this->repoPath = $this->params->get('git_folder_path', null); + $this->repoPath = $this->params->get('git_folder_path', null); } // remove site folder if not needed (TODO add check if custom script was moved to site folder then we must do a more complex cleanup here) if ($this->removeSiteFolder) @@ -86,12 +87,12 @@ class Compiler extends Infusion // first remove the files and folders $this->removeFolder($this->componentPath . '/site'); // clear form component xml - $xmlPath = $this->componentPath . '/'. $this->fileContentStatic['###component###']. '.xml'; + $xmlPath = $this->componentPath . '/' . $this->fileContentStatic['###component###'] . '.xml'; $componentXML = ComponentbuilderHelper::getFileContents($xmlPath); - $textToSite = ComponentbuilderHelper::getBetween($componentXML,'',''); - $textToSiteLang = ComponentbuilderHelper::getBetween($componentXML,'',''); - $componentXML = str_replace(array(''.$textToSite."", ''.$textToSiteLang.""), array('',''), $componentXML); - $this->writeFile($xmlPath,$componentXML); + $textToSite = ComponentbuilderHelper::getBetween($componentXML, '', ''); + $textToSiteLang = ComponentbuilderHelper::getBetween($componentXML, '', ''); + $componentXML = str_replace(array('' . $textToSite . "", '' . $textToSiteLang . ""), array('', ''), $componentXML); + $this->writeFile($xmlPath, $componentXML); } // now update the files if (!$this->updateFiles()) @@ -100,7 +101,7 @@ class Compiler extends Infusion } // now insert into the new files if ($this->getCustomCode()) - { + { $this->addCustomCode(); } // set the lang data now @@ -112,11 +113,9 @@ class Compiler extends Infusion { foreach ($this->langNot as $tag => $percentage) { - $this->app->enqueueMessage(JText::sprintf('The %s language has %s% translated, you will need to translate %s% of the language strings before it will be added.', - $tag, $percentage, $this->percentageLanguageAdd), 'Warning'); + $this->app->enqueueMessage(JText::sprintf('The %s language has %s% translated, you will need to translate %s% of the language strings before it will be added.', $tag, $percentage, $this->percentageLanguageAdd), 'Warning'); } - $this->app->enqueueMessage(JText::sprintf('You can change this percentage of translated strings required in the global options of JCB.
Please watch this tutorial for more help surrounding the JCB translations manager.', - '"https://youtu.be/zzAcVkn_cWU?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE" target="_blank" title="JCB Tutorial surrounding Translation Manager"'), 'Notice'); + $this->app->enqueueMessage(JText::sprintf('You can change this percentage of translated strings required in the global options of JCB.
Please watch this tutorial for more help surrounding the JCB translations manager.', '"https://youtu.be/zzAcVkn_cWU?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE" target="_blank" title="JCB Tutorial surrounding Translation Manager"'), 'Notice'); } // set why the strings were added $whyAddedLang = JText::sprintf('because more then %s% of the strings have been translated.', $this->percentageLanguageAdd); @@ -129,8 +128,7 @@ class Compiler extends Infusion { foreach ($this->langSet as $tag => $percentage) { - $this->app->enqueueMessage(JText::sprintf('The %s language has %s% translated. Was addeded %s', - $tag, $percentage, $whyAddedLang), 'Notice'); + $this->app->enqueueMessage(JText::sprintf('The %s language has %s% translated. Was addeded %s', $tag, $percentage, $whyAddedLang), 'Notice'); } } } @@ -158,7 +156,7 @@ class Compiler extends Infusion $mismatch = array_unique($this->langMismatch); } // set a notice if we have a mismatch - if (ComponentbuilderHelper::checkArray($mismatch)) + if (isset($mismatch) && ComponentbuilderHelper::checkArray($mismatch)) { if (count($mismatch) > 1) { @@ -171,9 +169,8 @@ class Compiler extends Infusion // add the mismatching issues foreach ($mismatch as $string) { - $constant = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($string,'U'); - $this->app->enqueueMessage(JText::sprintf('The Joomla.JText._(\'%s\') language constant for (%s) does not have a corresponding JText::Script() decalaration.', - $constant, $string), 'Warning'); + $constant = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($string, 'U'); + $this->app->enqueueMessage(JText::sprintf('The Joomla.JText._(\'%s\') language constant for (%s) does not have a corresponding JText::Script() decalaration.', $constant, $string), 'Warning'); } $this->app->enqueueMessage('
', 'Warning'); } @@ -186,7 +183,7 @@ class Compiler extends Infusion } return false; } - + /** * Set the line number in comments * @@ -199,11 +196,11 @@ class Compiler extends Infusion { if ($this->debugLinenr) { - return ' [Compiler '.$nr.']'; + return ' [Compiler ' . $nr . ']'; } return ''; } - + /** * Set the dynamic data to the created fils * @@ -223,26 +220,26 @@ class Compiler extends Infusion { $this->fileContentStatic['###FILENAME###'] = $static['name']; $php = ''; - if (ComponentbuilderHelper::checkFileType($static['name'],'php')) + if (ComponentbuilderHelper::checkFileType($static['name'], 'php')) { $php = "setPlaceholders($string, $this->fileContentStatic, 3); // add to zip array - $this->writeFile($static['path'],$answer); + $this->writeFile($static['path'], $answer); } else { $answer = $this->setPlaceholders($string, $this->fileContentStatic, 3); // add to zip array - $this->writeFile($static['path'],$answer); + $this->writeFile($static['path'], $answer); } - $this->lineCount = $this->lineCount + substr_count($answer, PHP_EOL ); + $this->lineCount = $this->lineCount + substr_count($answer, PHP_EOL); } } // now we do the dynamic files @@ -260,28 +257,28 @@ class Compiler extends Infusion // do some weird stuff to improve the verion and dates being added to the license $this->fixLicenseValues($file); $php = ''; - if (ComponentbuilderHelper::checkFileType($file['name'],'php')) + if (ComponentbuilderHelper::checkFileType($file['name'], 'php')) { $php = "setPlaceholders($string, $this->fileContentStatic, 3); $answer = $this->setPlaceholders($answer, $this->fileContentDynamic[$view], 3); // add to zip array - $this->writeFile($file['path'],$answer); + $this->writeFile($file['path'], $answer); } else { $answer = $this->setPlaceholders($string, $this->fileContentStatic, 3); $answer = $this->setPlaceholders($answer, $this->fileContentDynamic[$view], 3); // add to zip array - $this->writeFile($file['path'],$answer); + $this->writeFile($file['path'], $answer); } - $this->lineCount = $this->lineCount + substr_count($answer, PHP_EOL ); + $this->lineCount = $this->lineCount + substr_count($answer, PHP_EOL); } } } @@ -295,7 +292,7 @@ class Compiler extends Infusion } return false; } - + /** * move the local update server xml file to a remote ftp server * @@ -307,7 +304,7 @@ class Compiler extends Infusion // move the update server to host if ($this->componentData->add_update_server == 1 && $this->componentData->update_server_target == 1 && isset($this->updateServerFileName) && $this->dynamicIntegration) { - $xml_update_server_path = $this->componentPath.'/'.$this->updateServerFileName.'.xml'; + $xml_update_server_path = $this->componentPath . '/' . $this->updateServerFileName . '.xml'; // make sure we have the correct file if (JFile::exists($xml_update_server_path) && isset($this->componentData->update_server_ftp)) { @@ -321,7 +318,7 @@ class Compiler extends Infusion $this->componentData->update_server_ftp = rtrim($basic->decryptString($this->componentData->update_server_ftp), "\0"); } // now move the file - $this->moveFileToFtpServer($xml_update_server_path,$this->componentData->update_server_ftp); + $this->moveFileToFtpServer($xml_update_server_path, $this->componentData->update_server_ftp); } } } @@ -345,7 +342,7 @@ class Compiler extends Infusion } else { - $value = '@update number '.$value.' of this MVC'; + $value = '@update number ' . $value . ' of this MVC'; } } $this->fileContentStatic[$key] = $value; @@ -362,34 +359,34 @@ class Compiler extends Infusion protected function setCountingStuff() { // what is the size in terms of an A4 book - $this->pageCount = round($this->lineCount / 56); + $this->pageCount = round($this->lineCount / 56); // setup the unrealistic numbers - $this->folderSeconds = $this->folderCount * 5; - $this->fileSeconds = $this->fileCount * 5; - $this->lineSeconds = $this->lineCount * 10; - $this->seconds = $this->folderSeconds + $this->fileSeconds + $this->lineSeconds; - $this->totalHours = round($this->seconds / 3600); - $this->totalDays = round($this->totalHours / 8); + $this->folderSeconds = $this->folderCount * 5; + $this->fileSeconds = $this->fileCount * 5; + $this->lineSeconds = $this->lineCount * 10; + $this->seconds = $this->folderSeconds + $this->fileSeconds + $this->lineSeconds; + $this->totalHours = round($this->seconds / 3600); + $this->totalDays = round($this->totalHours / 8); // setup the more realistic numbers - $this->secondsDebugging = $this->seconds / 4; - $this->secondsPlanning = $this->seconds / 7; - $this->secondsMapping = $this->seconds / 10; - $this->secondsOffice = $this->seconds / 6; - $this->actualSeconds = $this->folderSeconds + $this->fileSeconds + $this->lineSeconds + $this->secondsDebugging + $this->secondsPlanning + $this->secondsMapping + $this->secondsOffice; - $this->actualTotalHours = round($this->actualSeconds / 3600); - $this->actualTotalDays = round($this->actualTotalHours / 8); - $this->debuggingHours = round($this->secondsDebugging / 3600); - $this->planningHours = round($this->secondsPlanning / 3600); - $this->mappingHours = round($this->secondsMapping / 3600); - $this->officeHours = round($this->secondsOffice / 3600); + $this->secondsDebugging = $this->seconds / 4; + $this->secondsPlanning = $this->seconds / 7; + $this->secondsMapping = $this->seconds / 10; + $this->secondsOffice = $this->seconds / 6; + $this->actualSeconds = $this->folderSeconds + $this->fileSeconds + $this->lineSeconds + $this->secondsDebugging + $this->secondsPlanning + $this->secondsMapping + $this->secondsOffice; + $this->actualTotalHours = round($this->actualSeconds / 3600); + $this->actualTotalDays = round($this->actualTotalHours / 8); + $this->debuggingHours = round($this->secondsDebugging / 3600); + $this->planningHours = round($this->secondsPlanning / 3600); + $this->mappingHours = round($this->secondsMapping / 3600); + $this->officeHours = round($this->secondsOffice / 3600); // the actual time spent - $this->actualHoursSpent = $this->actualTotalHours - $this->totalHours; - $this->actualDaysSpent = $this->actualTotalDays - $this->totalDays; + $this->actualHoursSpent = $this->actualTotalHours - $this->totalHours; + $this->actualDaysSpent = $this->actualTotalDays - $this->totalDays; // calculate the projects actual time frame of completion - $this->projectWeekTime = round($this->actualTotalDays / 5,1); - $this->projectMonthTime = round($this->actualTotalDays / 24,1); + $this->projectWeekTime = round($this->actualTotalDays / 5, 1); + $this->projectMonthTime = round($this->actualTotalDays / 24, 1); } - + private function buildReadMe() { // do a final run to update the readme file @@ -408,7 +405,7 @@ class Compiler extends Infusion } unset($this->newFiles['static']); } - + private function setReadMe($path) { // set readme data if not set already @@ -421,45 +418,45 @@ class Compiler extends Infusion // update the file $answer = $this->setPlaceholders($string, $this->fileContentStatic); // add to zip array - $this->writeFile($path,$answer); - } - + $this->writeFile($path, $answer); + } + private function buildReadMeData() { // set some defaults - $this->fileContentStatic['###LINE_COUNT###'] = $this->lineCount; - $this->fileContentStatic['###FIELD_COUNT###'] = $this->fieldCount; - $this->fileContentStatic['###FILE_COUNT###'] = $this->fileCount; - $this->fileContentStatic['###FOLDER_COUNT###'] = $this->folderCount; - $this->fileContentStatic['###PAGE_COUNT###'] = $this->pageCount; - $this->fileContentStatic['###folders###'] = $this->folderSeconds; - $this->fileContentStatic['###foldersSeconds###'] = $this->folderSeconds; - $this->fileContentStatic['###files###'] = $this->fileSeconds; - $this->fileContentStatic['###filesSeconds###'] = $this->fileSeconds; - $this->fileContentStatic['###lines###'] = $this->lineSeconds; - $this->fileContentStatic['###linesSeconds###'] = $this->lineSeconds; - $this->fileContentStatic['###seconds###'] = $this->actualSeconds; - $this->fileContentStatic['###actualSeconds###'] = $this->actualSeconds; - $this->fileContentStatic['###totalHours###'] = $this->totalHours; - $this->fileContentStatic['###totalDays###'] = $this->totalDays; - $this->fileContentStatic['###debugging###'] = $this->secondsDebugging; - $this->fileContentStatic['###secondsDebugging###'] = $this->secondsDebugging; - $this->fileContentStatic['###planning###'] = $this->secondsPlanning; - $this->fileContentStatic['###secondsPlanning###'] = $this->secondsPlanning; - $this->fileContentStatic['###mapping###'] = $this->secondsMapping; - $this->fileContentStatic['###secondsMapping###'] = $this->secondsMapping; - $this->fileContentStatic['###office###'] = $this->secondsOffice; - $this->fileContentStatic['###secondsOffice###'] = $this->secondsOffice; - $this->fileContentStatic['###actualTotalHours###'] = $this->actualTotalHours; - $this->fileContentStatic['###actualTotalDays###'] = $this->actualTotalDays; - $this->fileContentStatic['###debuggingHours###'] = $this->debuggingHours; - $this->fileContentStatic['###planningHours###'] = $this->planningHours; - $this->fileContentStatic['###mappingHours###'] = $this->mappingHours; - $this->fileContentStatic['###officeHours###'] = $this->officeHours; - $this->fileContentStatic['###actualHoursSpent###'] = $this->actualHoursSpent; - $this->fileContentStatic['###actualDaysSpent###'] = $this->actualDaysSpent; - $this->fileContentStatic['###projectWeekTime###'] = $this->projectWeekTime; - $this->fileContentStatic['###projectMonthTime###'] = $this->projectMonthTime; + $this->fileContentStatic['###LINE_COUNT###'] = $this->lineCount; + $this->fileContentStatic['###FIELD_COUNT###'] = $this->fieldCount; + $this->fileContentStatic['###FILE_COUNT###'] = $this->fileCount; + $this->fileContentStatic['###FOLDER_COUNT###'] = $this->folderCount; + $this->fileContentStatic['###PAGE_COUNT###'] = $this->pageCount; + $this->fileContentStatic['###folders###'] = $this->folderSeconds; + $this->fileContentStatic['###foldersSeconds###'] = $this->folderSeconds; + $this->fileContentStatic['###files###'] = $this->fileSeconds; + $this->fileContentStatic['###filesSeconds###'] = $this->fileSeconds; + $this->fileContentStatic['###lines###'] = $this->lineSeconds; + $this->fileContentStatic['###linesSeconds###'] = $this->lineSeconds; + $this->fileContentStatic['###seconds###'] = $this->actualSeconds; + $this->fileContentStatic['###actualSeconds###'] = $this->actualSeconds; + $this->fileContentStatic['###totalHours###'] = $this->totalHours; + $this->fileContentStatic['###totalDays###'] = $this->totalDays; + $this->fileContentStatic['###debugging###'] = $this->secondsDebugging; + $this->fileContentStatic['###secondsDebugging###'] = $this->secondsDebugging; + $this->fileContentStatic['###planning###'] = $this->secondsPlanning; + $this->fileContentStatic['###secondsPlanning###'] = $this->secondsPlanning; + $this->fileContentStatic['###mapping###'] = $this->secondsMapping; + $this->fileContentStatic['###secondsMapping###'] = $this->secondsMapping; + $this->fileContentStatic['###office###'] = $this->secondsOffice; + $this->fileContentStatic['###secondsOffice###'] = $this->secondsOffice; + $this->fileContentStatic['###actualTotalHours###'] = $this->actualTotalHours; + $this->fileContentStatic['###actualTotalDays###'] = $this->actualTotalDays; + $this->fileContentStatic['###debuggingHours###'] = $this->debuggingHours; + $this->fileContentStatic['###planningHours###'] = $this->planningHours; + $this->fileContentStatic['###mappingHours###'] = $this->mappingHours; + $this->fileContentStatic['###officeHours###'] = $this->officeHours; + $this->fileContentStatic['###actualHoursSpent###'] = $this->actualHoursSpent; + $this->fileContentStatic['###actualDaysSpent###'] = $this->actualDaysSpent; + $this->fileContentStatic['###projectWeekTime###'] = $this->projectWeekTime; + $this->fileContentStatic['###projectMonthTime###'] = $this->projectMonthTime; } private function zipComponent() @@ -468,15 +465,15 @@ class Compiler extends Infusion if (ComponentbuilderHelper::checkString($this->repoPath)) { // set the repo path - $repoFullPath = $this->repoPath.'/com_'.$this->componentData->sales_name.'__joomla_'.$this->joomlaVersion; + $repoFullPath = $this->repoPath . '/com_' . $this->componentData->sales_name . '__joomla_' . $this->joomlaVersion; // remove old data $this->removeFolder($repoFullPath, $this->componentData->toignore); // set the new data JFolder::copy($this->componentPath, $repoFullPath, '', true); } // the name of the zip file to create - $this->filepath = $this->tempPath.'/'.$this->componentFolderName.'.zip'; - + $this->filepath = $this->tempPath . '/' . $this->componentFolderName . '.zip'; + //create the zip file if (ComponentbuilderHelper::zip($this->componentPath, $this->filepath)) { @@ -485,7 +482,7 @@ class Compiler extends Infusion { JFile::copy($this->filepath, $this->backupPath); } - + // move to sales server host if ($this->componentData->add_sales_server == 1 && $this->dynamicIntegration) { @@ -502,7 +499,7 @@ class Compiler extends Infusion $this->componentData->sales_server_ftp = rtrim($basic->decryptString($this->componentData->sales_server_ftp), "\0"); } // now move the file - $this->moveFileToFtpServer($this->filepath, $this->componentData->sales_server_ftp, $this->componentSalesName.'.zip',false); + $this->moveFileToFtpServer($this->filepath, $this->componentData->sales_server_ftp, $this->componentSalesName . '.zip', false); } } // remove the component folder since we are done @@ -513,7 +510,7 @@ class Compiler extends Infusion } return false; } - + private function moveFileToFtpServer($localPath, $clientInput, $remote = null, $removeLocal = true) { // get the ftp opbject @@ -522,7 +519,7 @@ class Compiler extends Infusion if ($ftp instanceof JClientFtp && $ftp->isConnected()) { // move the file - if ($ftp->store($localPath,$remote)) + if ($ftp->store($localPath, $remote)) { // if moved then remove the file from repository if ($removeLocal) @@ -534,7 +531,7 @@ class Compiler extends Infusion $ftp->quit(); } } - + private function getFTP($clientInput) { $s1GnAtnr3 = md5($clientInput); @@ -581,41 +578,39 @@ class Compiler extends Infusion } return false; } - + protected function addCustomCode() { // reset all these $this->clearFromPlaceHolders('view'); $this->clearFromPlaceHolders('arg'); - foreach($this->customCode as $nr => $target) + foreach ($this->customCode as $nr => $target) { // reset each time per custom code $fingerPrint = array(); - if (isset($target['hashtarget'][0]) && $target['hashtarget'][0] > 3 - && isset($target['path']) && ComponentbuilderHelper::checkString($target['path']) - && isset($target['hashtarget'][1]) && ComponentbuilderHelper::checkString($target['hashtarget'][1])) + if (isset($target['hashtarget'][0]) && $target['hashtarget'][0] > 3 && isset($target['path']) && ComponentbuilderHelper::checkString($target['path']) && isset($target['hashtarget'][1]) && ComponentbuilderHelper::checkString($target['hashtarget'][1])) { - $file = $this->componentPath . '/'. $target['path']; - $size = (int) $target['hashtarget'][0]; - $hash = $target['hashtarget'][1]; - $cut = $size - 1; - $found = false; - $bites = 0; - $lineBites = array(); - $replace = array(); + $file = $this->componentPath . '/' . $target['path']; + $size = (int) $target['hashtarget'][0]; + $hash = $target['hashtarget'][1]; + $cut = $size - 1; + $found = false; + $bites = 0; + $lineBites = array(); + $replace = array(); if ($target['type'] == 1 && isset($target['hashendtarget'][0]) && $target['hashendtarget'][0] > 0) { - $foundEnd = false; - $sizeEnd = (int) $target['hashendtarget'][0]; - $hashEnd = $target['hashendtarget'][1]; - $cutEnd = $sizeEnd - 1; + $foundEnd = false; + $sizeEnd = (int) $target['hashendtarget'][0]; + $hashEnd = $target['hashendtarget'][1]; + $cutEnd = $sizeEnd - 1; } else { // replace to the end of the file - $foundEnd = true; + $foundEnd = true; } - $counter = 0; + $counter = 0; // check if file exist if (JFile::exists($file)) { @@ -635,12 +630,12 @@ class Compiler extends Infusion // check lines each time if it fits our target if (count($fingerPrint) === $sizeEnd && !$foundEnd) { - $fingerTest = md5(implode('',$fingerPrint)); + $fingerTest = md5(implode('', $fingerPrint)); if ($fingerTest === $hashEnd) { // we are done here $foundEnd = true; - $replace = array_slice($replace, 0, count($replace)-$sizeEnd); + $replace = array_slice($replace, 0, count($replace) - $sizeEnd); break; } else @@ -659,7 +654,7 @@ class Compiler extends Infusion // check lines each time if it fits our target if (count($fingerPrint) === $size && !$found) { - $fingerTest = md5(implode('',$fingerPrint)); + $fingerTest = md5(implode('', $fingerPrint)); if ($fingerTest === $hash) { // we are done here @@ -680,8 +675,8 @@ class Compiler extends Infusion } if ($found) { - $placeholder = $this->getPlaceHolder((int) $target['comment_type'].$target['type'], $target['id']); - $data = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($target['code'], $this->placeholders). $placeholder['end'] . PHP_EOL; + $placeholder = $this->getPlaceHolder((int) $target['comment_type'] . $target['type'], $target['id']); + $data = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($target['code'], $this->placeholders) . $placeholder['end'] . PHP_EOL; if ($target['type'] == 2) { // found it now add code from the next line @@ -732,12 +727,12 @@ class Compiler extends Infusion $code = explode(PHP_EOL, $target['code']); $code = PHP_EOL . $commentType . implode($_commentType . PHP_EOL . $commentType, $code) . $_commentType . PHP_EOL; // get place holders - $placeholder = $this->getPlaceHolder((int) $target['comment_type'].$target['type'], $target['id']); + $placeholder = $this->getPlaceHolder((int) $target['comment_type'] . $target['type'], $target['id']); // build the data - $data = $placeholder['start'] . $code . $placeholder['end']. PHP_EOL; + $data = $placeholder['start'] . $code . $placeholder['end'] . PHP_EOL; // get the bites before insertion - $bitBucket = array(); - foreach($lineBites as $line => $value) + $bitBucket = array(); + foreach ($lineBites as $line => $value) { if ($line < $target['from_line']) { @@ -775,7 +770,8 @@ class Compiler extends Infusion // done close both files fclose($fpFile); fclose($fpTemp); - + // any help to improve this is welcome... } + } diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index c5ddc01cf..3c691a5aa 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -1,27 +1,28 @@ - @my wife Roline van der Merwe - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Builds Complex Joomla Components - -/-----------------------------------------------------------------------------------------------------------------------------*/ +/* --------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| + /-------------------------------------------------------------------------------------------------------------------------------/ + + @version 2.6.0 + @created 30th April, 2015 + @package Component Builder + @subpackage compiler.php + @author Llewellyn van der Merwe + @my wife Roline van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + + /----------------------------------------------------------------------------------------------------------------------------- */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); @@ -31,207 +32,208 @@ defined('_JEXEC') or die('Restricted access'); */ class Get { + /** * The app * * @var object */ public $app; - + /** * The Params * * @var object */ public $params; - + /** * The placeholders * * @var array */ public $placeholders = array(); - + /** * The Compiler Path * * @var object */ public $compilerPath; - + /** * Switch to add custom code placeholders * * @var bool */ public $addPlaceholders = false; - + /** * The Component data * * @var object */ public $componentData; - - /*********************************************************************************************** - * The custom script placeholders - we use the (xxx) to avoid detection it should be (***) - * ##################################---> PHP/JS <---#################################### + + /* * ********************************************************************************************* + * The custom script placeholders - we use the (xxx) to avoid detection it should be (***) + * ##################################---> PHP/JS <---#################################### * - * New Insert Code = /xxx[INSERT<>$$$$]xxx/ /xxx[/INSERT<>$$$$]xxx/ - * New Replace Code = /xxx[REPLACE<>$$$$]xxx/ /xxx[/REPLACE<>$$$$]xxx/ + * New Insert Code = /xxx[INSERT<>$$$$]xxx/ /xxx[/INSERT<>$$$$]xxx/ + * New Replace Code = /xxx[REPLACE<>$$$$]xxx/ /xxx[/REPLACE<>$$$$]xxx/ * - * //////////////////////////////// when JCB adds it back ////////////////////////////////// - * JCB Add Inserted Code = /xxx[INSERTED$$$$]xxx//x23x/ /xxx[/INSERTED$$$$]xxx/ - * JCB Add Replaced Code = /xxx[REPLACED$$$$]xxx//x25x/ /xxx[/REPLACED$$$$]xxx/ + * //////////////////////////////// when JCB adds it back ////////////////////////////////// + * JCB Add Inserted Code = /xxx[INSERTED$$$$]xxx//x23x/ /xxx[/INSERTED$$$$]xxx/ + * JCB Add Replaced Code = /xxx[REPLACED$$$$]xxx//x25x/ /xxx[/REPLACED$$$$]xxx/ * - * /////////////////////////////// changeing existing custom code ///////////////////////// - * Update Inserted Code = /xxx[INSERTED<>$$$$]xxx//x23x/ /xxx[/INSERTED<>$$$$]xxx/ - * Update Replaced Code = /xxx[REPLACED<>$$$$]xxx//x25x/ /xxx[/REPLACED<>$$$$]xxx/ + * /////////////////////////////// changeing existing custom code ///////////////////////// + * Update Inserted Code = /xxx[INSERTED<>$$$$]xxx//x23x/ /xxx[/INSERTED<>$$$$]xxx/ + * Update Replaced Code = /xxx[REPLACED<>$$$$]xxx//x25x/ /xxx[/REPLACED<>$$$$]xxx/ * - * The custom script placeholders - we use the (==) to avoid detection it should be (--) - * ###################################---> HTML <---##################################### + * The custom script placeholders - we use the (==) to avoid detection it should be (--) + * ###################################---> HTML <---##################################### * * New Insert Code = $$$$]==> $$$$]==> - * New Replace Code = $$$$]==> $$$$]==> + * New Replace Code = $$$$]==> $$$$]==> * - * ///////////////////////////////// when JCB adds it back /////////////////////////////// - * JCB Add Inserted Code = - * JCB Add Replaced Code = + * ///////////////////////////////// when JCB adds it back /////////////////////////////// + * JCB Add Inserted Code = + * JCB Add Replaced Code = * - * //////////////////////////// changeing existing custom code /////////////////////////// - * Update Inserted Code = $$$$]==> $$$$]==> - * Update Replaced Code = $$$$]==> $$$$]==> + * //////////////////////////// changeing existing custom code /////////////////////////// + * Update Inserted Code = $$$$]==> $$$$]==> + * Update Replaced Code = $$$$]==> $$$$]==> * - * ////////23 is the ID of the code in the system don't change it!!!!!!!!!!!!!!!!!!!!!!!!!! + * ////////23 is the ID of the code in the system don't change it!!!!!!!!!!!!!!!!!!!!!!!!!! * - * @var array - ***********************************************************************************************/ - protected $customCodePlaceholders = array( - 1 => 'REPLACE<>$$$$]', - 2 => 'INSERT<>$$$$]', - 3 => 'REPLACED<>$$$$]', - 4 => 'INSERTED<>$$$$]' - ); - + * @var array + * ********************************************************************************************* */ + protected $customCodePlaceholders = array( + 1 => 'REPLACE<>$$$$]', + 2 => 'INSERT<>$$$$]', + 3 => 'REPLACED<>$$$$]', + 4 => 'INSERTED<>$$$$]' + ); + /** * The custom code to be added * * @var array */ public $customCode; - + /** * The custom code to be added * * @var array */ protected $customCodeData = array(); - + /** * The function name memory ids * * @var array */ public $functionNameMemory = array(); - + /** * The custom code for local memory * * @var array */ public $customCodeMemory = array(); - + /** * The custom code in local files that aready exist in system * * @var array */ protected $existingCustomCode = array(); - + /** * The custom code in local files this are new * * @var array */ protected $newCustomCode = array(); - + /** * The index of code already loaded * * @var array */ - protected $codeAreadyDone = array(); - + protected $codeAreadyDone = array(); + /* * The line numbers Switch * * @var boolean */ - public $debugLinenr = false; - + public $debugLinenr = false; + /* * The percentage when a language should be added * * @var boolean */ public $percentageLanguageAdd = 0; - + /** * The Placholder Language prefix * * @var string */ public $langPrefix; - + /** * The Language content * * @var array */ public $langContent = array(); - + /** * The Languages bucket * * @var array */ - public $languages = array('en-GB' => array()); - + public $languages = array('en-GB' => array()); + /** * The Multi Languages bucket * * @var array */ public $multiLangString = array(); - + /** * The new lang to add * * @var array */ protected $newLangStrings = array(); - + /** * The existing lang to update * * @var array */ protected $existingLangStrings = array(); - + /** * The Language JS matching check * * @var array */ public $langMismatch = array(); - + /** * The Language SC matching check * * @var array */ public $langMatch = array(); - + /** * The Language string targets * @@ -242,309 +244,309 @@ class Get 'JText::script(', 'JText::_(', 'JText::sprintf(' - ); - + ); + /** * The Component Code Name * * @var string */ public $componentCodeName; - + /** * The Component ID * * @var int */ public $componentID; - + /** * The current user * * @var array */ public $user; - + /** * The database object * * @var array */ public $db; - + /** * The Component version * * @var string */ public $component_version; - + /** * The UIKIT Switch * * @var boolean */ public $uikit = 0; - + /** * The UIKIT component checker * * @var array */ public $uikitComp = array(); - + /** * The FOOTABLE Switch * * @var boolean */ public $footable = false; - + /** * The FOOTABLE Version * * @var int */ public $footableVersion; - + /** * The Google Chart Switch per view * * @var array */ public $googleChart = array(); - + /** * The Google Chart Switch * * @var boolean */ public $googlechart = false; - + /** * The Import & Export Switch * * @var boolean */ public $addEximport = false; - + /** * The Tag & History Switch * * @var boolean */ public $setTagHistory = false; - + /** * The site edit views * * @var array */ public $siteEditView = array(); - + /** * The Language target * * @var string */ public $lang = 'admin'; - + /** * The Build target Switch * * @var string */ public $target; - + /** * The unique codes * * @var array */ public $uniquecodes = array(); - + /** * The unique keys * * @var array */ public $uniquekeys = array(); - + /** * The Ad contributors Switch * * @var boolean */ public $addContributors = false; - + /** * The Custom Script Builder * * @var array */ public $customScriptBuilder = array(); - + /** * The Footable Script Builder * * @var array */ public $footableScripts = array(); - + /** * The pathe to the bom file to be used * * @var string */ public $bomPath; - + /** * The SQL Tweak of admin views * * @var array */ public $sqlTweak = array(); - + /** * The admin views data array * * @var array */ private $_adminViewData = array(); - + /** * The field data array * * @var array */ private $_fieldData = array(); - + /** * The linked admin view tabs * * @var array */ public $linkedAdminViews = array(); - + /** * The Add Ajax Switch * * @var boolean */ public $addAjax = false; - + /** * The Add Site Ajax Switch * * @var boolean */ public $addSiteAjax = false; - + /** * The get Module Script Switch * * @var array */ public $getModule = array(); - + /** * The template data * * @var array */ public $templateData = array(); - + /** * The layout data * * @var array */ public $layoutData = array(); - + /** * The Advanced Encryption Switch * * @var boolean */ public $advancedEncryption = false; - + /** * The Basic Encryption Switch * * @var boolean */ public $basicEncryption = false; - + /** * The Custom field Switch per view * * @var array */ public $customFieldScript = array(); - + /** * The site main get * * @var array */ public $siteMainGet = array(); - + /** * The site dynamic get * * @var array */ public $siteDynamicGet = array(); - + /** * The get AS lookup * * @var array */ public $getAsLookup = array(); - + /** * The site fields * * @var array */ public $siteFields = array(); - + /** * The add SQL * * @var array */ public $addSQL = array(); - + /** * The update SQL * * @var array */ public $updateSQL = array(); - + /** * The Library Manager * * @var array */ public $libManager = array(); - + /** * The Libraries * * @var array */ public $libraries = array(); - + /** * Is Tidy Enabled * * @var bool */ public $tidy = false; - + /** * Set Tidy warning once switch * @@ -552,40 +554,41 @@ class Get */ public $setTidyWarning = false; - /*** + /* * * * Constructor */ - public function __construct($config = array ()) + + public function __construct($config = array()) { if (isset($config) && count($config)) { // load application - $this->app = JFactory::getApplication(); + $this->app = JFactory::getApplication(); // check if we have Tidy enabled - $this->tidy = extension_loaded('Tidy'); + $this->tidy = extension_loaded('Tidy'); // Set the params - $this->params = JComponentHelper::getParams('com_componentbuilder'); + $this->params = JComponentHelper::getParams('com_componentbuilder'); // load the compiler path - $this->compilerPath = $this->params->get('compiler_folder_path', JPATH_COMPONENT_ADMINISTRATOR.'/compiler'); + $this->compilerPath = $this->params->get('compiler_folder_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler'); // set the component ID - $this->componentID = (int) $config['componentId']; + $this->componentID = (int) $config['componentId']; // set this components code name if ($name_code = ComponentbuilderHelper::getVar('joomla_component', $this->componentID, 'id', 'name_code')) { // set lang prefix - $this->langPrefix = 'COM_'.ComponentbuilderHelper::safeString($name_code,'U'); + $this->langPrefix = 'COM_' . ComponentbuilderHelper::safeString($name_code, 'U'); // set component code name - $this->componentCodeName = ComponentbuilderHelper::safeString($name_code); + $this->componentCodeName = ComponentbuilderHelper::safeString($name_code); // set if placeholders should be added to customcode - $global = ((int) ComponentbuilderHelper::getVar('joomla_component', $this->componentID, 'id', 'add_placeholders') == 1) ? true:false; - $this->addPlaceholders = ((int) $config['addPlaceholders'] == 0) ? false : (((int) $config['addPlaceholders'] == 1) ? true : $global); + $global = ((int) ComponentbuilderHelper::getVar('joomla_component', $this->componentID, 'id', 'add_placeholders') == 1) ? true : false; + $this->addPlaceholders = ((int) $config['addPlaceholders'] == 0) ? false : (((int) $config['addPlaceholders'] == 1) ? true : $global); // set if line numbers should be added to comments - $global = ((int) ComponentbuilderHelper::getVar('joomla_component', $this->componentID, 'id', 'debug_linenr') == 1) ? true:false; - $this->debugLinenr = ((int) $config['debugLinenr'] == 0) ? false : (((int) $config['debugLinenr'] == 1) ? true : $global); + $global = ((int) ComponentbuilderHelper::getVar('joomla_component', $this->componentID, 'id', 'debug_linenr') == 1) ? true : false; + $this->debugLinenr = ((int) $config['debugLinenr'] == 0) ? false : (((int) $config['debugLinenr'] == 1) ? true : $global); // set the current user - $this->user = JFactory::getUser(); + $this->user = JFactory::getUser(); // Get a db connection. - $this->db = JFactory::getDbo(); + $this->db = JFactory::getDbo(); // check if this component is install on the current website if ($paths = $this->getLocalInstallPaths()) { @@ -602,8 +605,7 @@ class Get $this->componentData->component_version = '1.0.0'; } // update the version - if (!isset($this->componentData->old_component_version) - && (ComponentbuilderHelper::checkArray($this->addSQL) || ComponentbuilderHelper::checkArray($this->updateSQL))) + if (!isset($this->componentData->old_component_version) && (ComponentbuilderHelper::checkArray($this->addSQL) || ComponentbuilderHelper::checkArray($this->updateSQL))) { // set the new version $version = (array) explode('.', $this->componentData->component_version); @@ -611,7 +613,7 @@ class Get end($version); $key = key($version); // just increment the last - $version[$key]++; + $version[$key] ++; // set the old version $this->componentData->old_component_version = $this->componentData->component_version; // set the new version, and set update switch @@ -619,13 +621,13 @@ class Get } // set the percentage when a language can be added $this->percentageLanguageAdd = (int) $this->params->get('percentagelanguageadd', 50); - + return true; } } return false; } - + /** * Set the line number in comments * @@ -638,11 +640,11 @@ class Get { if ($this->debugLinenr) { - return ' [Get '.$nr.']'; + return ' [Get ' . $nr . ']'; } return ''; } - + /** * get all Component Data * @@ -660,37 +662,36 @@ class Get $query->select( $this->db->quoteName( array( - 'b.addadmin_views', - 'b.id', - 'h.addconfig', - 'd.addcustom_admin_views', - 'g.addcustommenus', - 'j.addfiles', - 'j.addfolders', - 'c.addsite_views', - 'i.dashboard_tab', - 'i.php_dashboard_methods', - 'f.sql_tweak', - 'e.version_update', - 'e.id' - ), - array( - 'addadmin_views', - 'addadmin_views_id', - 'addconfig', - 'addcustom_admin_views', - 'addcustommenus', - 'addfiles', - 'addfolders', - 'addsite_views', - 'dashboard_tab', - 'php_dashboard_methods', - 'sql_tweak', - 'version_update', - 'version_update_id' - ) + 'b.addadmin_views', + 'b.id', + 'h.addconfig', + 'd.addcustom_admin_views', + 'g.addcustommenus', + 'j.addfiles', + 'j.addfolders', + 'c.addsite_views', + 'i.dashboard_tab', + 'i.php_dashboard_methods', + 'f.sql_tweak', + 'e.version_update', + 'e.id' + ), array( + 'addadmin_views', + 'addadmin_views_id', + 'addconfig', + 'addcustom_admin_views', + 'addcustommenus', + 'addfiles', + 'addfolders', + 'addsite_views', + 'dashboard_tab', + 'php_dashboard_methods', + 'sql_tweak', + 'version_update', + 'version_update_id' ) - ); + ) + ); // from these tables $query->from('#__componentbuilder_joomla_component AS a'); $query->join('LEFT', $this->db->quoteName('#__componentbuilder_component_admin_views', 'b') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('b.joomla_component') . ')'); @@ -702,14 +703,14 @@ class Get $query->join('LEFT', $this->db->quoteName('#__componentbuilder_component_config', 'h') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('h.joomla_component') . ')'); $query->join('LEFT', $this->db->quoteName('#__componentbuilder_component_dashboard', 'i') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('i.joomla_component') . ')'); $query->join('LEFT', $this->db->quoteName('#__componentbuilder_component_files_folders', 'j') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('j.joomla_component') . ')'); - $query->where($this->db->quoteName('a.id') . ' = '. (int) $this->componentID); + $query->where($this->db->quoteName('a.id') . ' = ' . (int) $this->componentID); // Reset the query using our newly populated query object. $this->db->setQuery($query); // Load the results as a list of stdClass objects $component = $this->db->loadObject(); - + // set upater $updater = array( 'unique' => array( @@ -745,7 +746,7 @@ class Get ); // update the repeatable fields $component = ComponentbuilderHelper::convertRepeatableFields($component, $searchRepeatables, $updater); - + // set component place holders $this->placeholders['###component###'] = ComponentbuilderHelper::safeString($component->name_code); $this->placeholders['###Component###'] = ComponentbuilderHelper::safeString($component->name_code, 'F'); @@ -753,32 +754,32 @@ class Get $this->placeholders['[[[component]]]'] = $this->placeholders['###component###']; $this->placeholders['[[[Component]]]'] = $this->placeholders['###Component###']; $this->placeholders['[[[COMPONENT]]]'] = $this->placeholders['###COMPONENT###']; - + // set component sales name $component->sales_name = ComponentbuilderHelper::safeString($component->system_name); - + // ensure version naming is correct $this->component_version = preg_replace('/[^0-9.]+/', '', $component->component_version); - + // set the addfolders data - $component->addfolders = (isset($component->addfolders) && ComponentbuilderHelper::checkJson($component->addfolders)) ? json_decode($component->addfolders,true):null; + $component->addfolders = (isset($component->addfolders) && ComponentbuilderHelper::checkJson($component->addfolders)) ? json_decode($component->addfolders, true) : null; if (ComponentbuilderHelper::checkArray($component->addfolders)) { $component->folders = array_values($component->addfolders); } unset($component->addfolders); - + // set the addfiles data - $component->addfiles = (isset($component->addfiles) && ComponentbuilderHelper::checkJson($component->addfiles)) ? json_decode($component->addfiles,true):null; + $component->addfiles = (isset($component->addfiles) && ComponentbuilderHelper::checkJson($component->addfiles)) ? json_decode($component->addfiles, true) : null; if (ComponentbuilderHelper::checkArray($component->addfiles)) { $component->files = array_values($component->addfiles); } unset($component->addfiles); - + // set the uikit switch $this->uikit = $component->adduikit; - + // set the footable switch if ($component->addfootable) { @@ -786,35 +787,36 @@ class Get // add the version $this->footableVersion = (1 == $component->addfootable || 2 == $component->addfootable) ? 2 : $component->addfootable; } - + // set the addcustommenus data - $component->addcustommenus = (isset($component->addcustommenus) && ComponentbuilderHelper::checkJson($component->addcustommenus)) ? json_decode($component->addcustommenus,true):null; + $component->addcustommenus = (isset($component->addcustommenus) && ComponentbuilderHelper::checkJson($component->addcustommenus)) ? json_decode($component->addcustommenus, true) : null; if (ComponentbuilderHelper::checkArray($component->addcustommenus)) { $component->custommenus = array_values($component->addcustommenus); } unset($component->addcustommenus); - + // set the sql_tweak data - $component->sql_tweak = (isset($component->sql_tweak) && ComponentbuilderHelper::checkJson($component->sql_tweak)) ? json_decode($component->sql_tweak,true):null; + $component->sql_tweak = (isset($component->sql_tweak) && ComponentbuilderHelper::checkJson($component->sql_tweak)) ? json_decode($component->sql_tweak, true) : null; if (ComponentbuilderHelper::checkArray($component->sql_tweak)) { // build the tweak settings - $this->setSqlTweaking(array_map(function($array) { - return array_map(function($value) { - if (!ComponentbuilderHelper::checkArray($value) && !ComponentbuilderHelper::checkObject($value) - && strval($value) === strval(intval($value))) + $this->setSqlTweaking(array_map(function($array) + { + return array_map(function($value) { - return (int) $value; - } - return $value; - }, $array); - }, array_values($component->sql_tweak))); + if (!ComponentbuilderHelper::checkArray($value) && !ComponentbuilderHelper::checkObject($value) && strval($value) === strval(intval($value))) + { + return (int) $value; + } + return $value; + }, $array); + }, array_values($component->sql_tweak))); } unset($component->sql_tweak); - + // set the admin_view data - $component->addadmin_views = (isset($component->addadmin_views) && ComponentbuilderHelper::checkJson($component->addadmin_views)) ? json_decode($component->addadmin_views,true):null; + $component->addadmin_views = (isset($component->addadmin_views) && ComponentbuilderHelper::checkJson($component->addadmin_views)) ? json_decode($component->addadmin_views, true) : null; if (ComponentbuilderHelper::checkArray($component->addadmin_views)) { // sort the views acording to order @@ -835,10 +837,11 @@ class Get return 1; }); // build the admin_views settings - $component->admin_views = array_map(function($array) { - $array = array_map(function($value) { - if (!ComponentbuilderHelper::checkArray($value) && !ComponentbuilderHelper::checkObject($value) - && strval($value) === strval(intval($value))) + $component->admin_views = array_map(function($array) + { + $array = array_map(function($value) + { + if (!ComponentbuilderHelper::checkArray($value) && !ComponentbuilderHelper::checkObject($value) && strval($value) === strval(intval($value))) { return (int) $value; } @@ -864,19 +867,20 @@ class Get } // set the site_view data - $component->addsite_views = (isset($component->addsite_views) && ComponentbuilderHelper::checkJson($component->addsite_views)) ? json_decode($component->addsite_views,true):null; + $component->addsite_views = (isset($component->addsite_views) && ComponentbuilderHelper::checkJson($component->addsite_views)) ? json_decode($component->addsite_views, true) : null; if (ComponentbuilderHelper::checkArray($component->addsite_views)) { $this->lang = 'site'; $this->target = 'site'; // build the site_views settings - $component->site_views = array_map(function($array) { + $component->site_views = array_map(function($array) + { // has become a lacacy issue, can't remove this $array['view'] = $array['siteview']; $array['settings'] = $this->getCustomViewData($array['view']); - return array_map(function($value) { - if (!ComponentbuilderHelper::checkArray($value) && !ComponentbuilderHelper::checkObject($value) - && strval($value) === strval(intval($value))) + return array_map(function($value) + { + if (!ComponentbuilderHelper::checkArray($value) && !ComponentbuilderHelper::checkObject($value) && strval($value) === strval(intval($value))) { return (int) $value; } @@ -888,19 +892,20 @@ class Get } // set the custom_admin_views data - $component->addcustom_admin_views = (isset($component->addcustom_admin_views) && ComponentbuilderHelper::checkJson($component->addcustom_admin_views)) ? json_decode($component->addcustom_admin_views,true):null; + $component->addcustom_admin_views = (isset($component->addcustom_admin_views) && ComponentbuilderHelper::checkJson($component->addcustom_admin_views)) ? json_decode($component->addcustom_admin_views, true) : null; if (ComponentbuilderHelper::checkArray($component->addcustom_admin_views)) { $this->lang = 'admin'; $this->target = 'custom_admin'; // build the custom_admin_views settings - $component->custom_admin_views = array_map(function($array) { + $component->custom_admin_views = array_map(function($array) + { // has become a lacacy issue, can't remove this $array['view'] = $array['customadminview']; $array['settings'] = $this->getCustomViewData($array['view'], 'custom_admin_view'); - return array_map(function($value) { - if (!ComponentbuilderHelper::checkArray($value) && !ComponentbuilderHelper::checkObject($value) - && strval($value) === strval(intval($value))) + return array_map(function($value) + { + if (!ComponentbuilderHelper::checkArray($value) && !ComponentbuilderHelper::checkObject($value) && strval($value) === strval(intval($value))) { return (int) $value; } @@ -912,10 +917,11 @@ class Get } // set the config data - $component->addconfig = (isset($component->addconfig) && ComponentbuilderHelper::checkJson($component->addconfig)) ? json_decode($component->addconfig,true):null; + $component->addconfig = (isset($component->addconfig) && ComponentbuilderHelper::checkJson($component->addconfig)) ? json_decode($component->addconfig, true) : null; if (ComponentbuilderHelper::checkArray($component->addconfig)) { - $component->config = array_map(function($array) { + $component->config = array_map(function($array) + { $array['alias'] = 0; $array['title'] = 0; $array['settings'] = $this->getFieldData($array['field']); @@ -924,23 +930,23 @@ class Get // unset original value unset($component->addconfig); } - + // set the addcustommenus data - $component->addcontributors = (isset($component->addcontributors) && ComponentbuilderHelper::checkJson($component->addcontributors)) ? json_decode($component->addcontributors,true):null; + $component->addcontributors = (isset($component->addcontributors) && ComponentbuilderHelper::checkJson($component->addcontributors)) ? json_decode($component->addcontributors, true) : null; if (ComponentbuilderHelper::checkArray($component->addcontributors)) { $this->addContributors = true; $component->contributors = array_values($component->addcontributors); } unset($component->addcontributors); - + // set the addcustommenus data - $component->version_update = (isset($component->version_update) && ComponentbuilderHelper::checkJson($component->version_update)) ? json_decode($component->version_update,true):null; + $component->version_update = (isset($component->version_update) && ComponentbuilderHelper::checkJson($component->version_update)) ? json_decode($component->version_update, true) : null; if (ComponentbuilderHelper::checkArray($component->version_update)) { $component->version_update = array_values($component->version_update); } - + // build update SQL $old_admin_views = $this->getHistoryWatch('component_admin_views', $component->addadmin_views_id); $old_component = $this->getHistoryWatch('joomla_component', $this->componentID); @@ -993,32 +999,32 @@ class Get $this->customScriptBuilder['component_css'] = ''; } unset($component->css); - + // set the lang target $this->lang = 'admin'; // add PHP in ADMIN - $addScriptMethods = array('php_preflight','php_postflight','php_method'); - $addScriptTypes = array('install','update','uninstall'); + $addScriptMethods = array('php_preflight', 'php_postflight', 'php_method'); + $addScriptTypes = array('install', 'update', 'uninstall'); foreach ($addScriptMethods as $scriptMethod) - { + { foreach ($addScriptTypes as $scriptType) { - if (isset($component->{'add_'.$scriptMethod.'_'.$scriptType}) && $component->{'add_'.$scriptMethod.'_'.$scriptType} == 1 && ComponentbuilderHelper::checkString($component->{$scriptMethod.'_'.$scriptType})) + if (isset($component->{'add_' . $scriptMethod . '_' . $scriptType}) && $component->{'add_' . $scriptMethod . '_' . $scriptType} == 1 && ComponentbuilderHelper::checkString($component->{$scriptMethod . '_' . $scriptType})) { - $this->customScriptBuilder[$scriptMethod][$scriptType] = $this->setDynamicValues(base64_decode($component->{$scriptMethod.'_'.$scriptType})); + $this->customScriptBuilder[$scriptMethod][$scriptType] = $this->setDynamicValues(base64_decode($component->{$scriptMethod . '_' . $scriptType})); } else { $this->customScriptBuilder[$scriptMethod][$scriptType] = ''; } - unset($component->{$scriptMethod.'_'.$scriptType}); + unset($component->{$scriptMethod . '_' . $scriptType}); } } // add_php_helper if ($component->add_php_helper_admin == 1 && ComponentbuilderHelper::checkString($component->php_helper_admin)) { $this->lang = 'admin'; - $this->customScriptBuilder['component_php_helper_admin'] = PHP_EOL.PHP_EOL.$this->setDynamicValues(base64_decode($component->php_helper_admin)); + $this->customScriptBuilder['component_php_helper_admin'] = PHP_EOL . PHP_EOL . $this->setDynamicValues(base64_decode($component->php_helper_admin)); } else { @@ -1040,7 +1046,7 @@ class Get if ($component->add_php_helper_both == 1 && ComponentbuilderHelper::checkString($component->php_helper_both)) { $this->lang = 'both'; - $this->customScriptBuilder['component_php_helper_both'] = PHP_EOL.PHP_EOL.$this->setDynamicValues(base64_decode($component->php_helper_both)); + $this->customScriptBuilder['component_php_helper_both'] = PHP_EOL . PHP_EOL . $this->setDynamicValues(base64_decode($component->php_helper_both)); } else { @@ -1050,7 +1056,7 @@ class Get if ($component->add_php_helper_site == 1 && ComponentbuilderHelper::checkString($component->php_helper_site)) { $this->lang = 'site'; - $this->customScriptBuilder['component_php_helper_site'] = PHP_EOL.PHP_EOL.$this->setDynamicValues(base64_decode($component->php_helper_site)); + $this->customScriptBuilder['component_php_helper_site'] = PHP_EOL . PHP_EOL . $this->setDynamicValues(base64_decode($component->php_helper_site)); } else { @@ -1077,11 +1083,11 @@ class Get // bom if (ComponentbuilderHelper::checkString($component->bom)) { - $this->bomPath = $this->compilerPath.'/'.$component->bom; + $this->bomPath = $this->compilerPath . '/' . $component->bom; } else { - $this->bomPath = $this->compilerPath.'/default.txt'; + $this->bomPath = $this->compilerPath . '/default.txt'; } unset($component->bom); // README @@ -1096,12 +1102,13 @@ class Get // set lang now $nowLang = $this->lang; $this->lang = 'admin'; - + // dashboard methods - $component->dashboard_tab = (isset($component->dashboard_tab) && ComponentbuilderHelper::checkJson($component->dashboard_tab)) ? json_decode($component->dashboard_tab,true):null; + $component->dashboard_tab = (isset($component->dashboard_tab) && ComponentbuilderHelper::checkJson($component->dashboard_tab)) ? json_decode($component->dashboard_tab, true) : null; if (ComponentbuilderHelper::checkArray($component->dashboard_tab)) { - $component->dashboard_tab = array_map( function($array) { + $component->dashboard_tab = array_map(function($array) + { $array['html'] = $this->setDynamicValues($array['html']); return $array; }, array_values($component->dashboard_tab)); @@ -1122,7 +1129,7 @@ class Get } // reset back to nowlang $this->lang = $nowLang; - + // add the update FTP server sig if ($component->add_update_server == 1 && is_numeric($component->update_server_ftp) && $component->update_server_ftp > 0) { @@ -1159,11 +1166,11 @@ class Get // the default is to ignore the repo folder $component->toignore = array('.git'); } - + // return the found component data return $component; } - + /** * Get all Admin View Data * @@ -1183,23 +1190,22 @@ class Get $query->select( $this->db->quoteName( array( - 'b.addfields', - 'b.id', - 'c.addconditions', - 'c.id' - ), - array( - 'addfields', - 'addfields_id', - 'addconditions', - 'addconditions_id' - ) + 'b.addfields', + 'b.id', + 'c.addconditions', + 'c.id' + ), array( + 'addfields', + 'addfields_id', + 'addconditions', + 'addconditions_id' ) - ); + ) + ); $query->from('#__componentbuilder_admin_view AS a'); $query->join('LEFT', $this->db->quoteName('#__componentbuilder_admin_fields', 'b') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('b.admin_view') . ')'); $query->join('LEFT', $this->db->quoteName('#__componentbuilder_admin_fields_conditions', 'c') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('c.admin_view') . ')'); - $query->where($this->db->quoteName('a.id') . ' = '. (int) $id); + $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); // Reset the query using our newly populated query object. $this->db->setQuery($query); @@ -1209,7 +1215,7 @@ class Get // setup view name to use in storing the data $name_single = ComponentbuilderHelper::safeString($view->name_single); $name_list = ComponentbuilderHelper::safeString($view->name_list); - + // set upater $updater = array( 'unique' => array( @@ -1227,14 +1233,14 @@ class Get 'addconditions' => 'target_field', 'ajax_input' => 'value_name', 'custom_button' => 'name', - 'addlinked_views' => 'adminview', + 'addlinked_views' => 'adminview', 'addtables' => 'table', - 'addtabs' => 'name', + 'addtabs' => 'name', 'addpermissions' => 'action' ); // update the repeatable fields $view = ComponentbuilderHelper::convertRepeatableFields($view, $searchRepeatables, $updater); - + // setup token check if (!isset($this->customScriptBuilder['token'])) { @@ -1254,16 +1260,16 @@ class Get $this->placeholders['[[[View]]]'] = $this->placeholders['###View###']; $this->placeholders['[[[Views]]]'] = $this->placeholders['###Views###']; $this->placeholders['[[[VIEW]]]'] = $this->placeholders['###VIEW###']; - $this->placeholders['[[[VIEWS]]]'] = $this->placeholders['###VIEWS###']; + $this->placeholders['[[[VIEWS]]]'] = $this->placeholders['###VIEWS###']; // add the tables - $view->addtables = (isset($view->addtables) && ComponentbuilderHelper::checkJson($view->addtables)) ? json_decode($view->addtables,true):null; + $view->addtables = (isset($view->addtables) && ComponentbuilderHelper::checkJson($view->addtables)) ? json_decode($view->addtables, true) : null; if (ComponentbuilderHelper::checkArray($view->addtables)) { $view->tables = array_values($view->addtables); } unset($view->addtables); // add the tabs - $view->addtabs = (isset($view->addtabs) && ComponentbuilderHelper::checkJson($view->addtabs)) ? json_decode($view->addtabs,true):null; + $view->addtabs = (isset($view->addtabs) && ComponentbuilderHelper::checkJson($view->addtabs)) ? json_decode($view->addtabs, true) : null; if (ComponentbuilderHelper::checkArray($view->addtabs)) { $nr = 1; @@ -1287,7 +1293,7 @@ class Get $view->tabs[15] = 'publishing'; unset($view->addtabs); // add permissions - $view->addpermissions = (isset($view->addpermissions) && ComponentbuilderHelper::checkJson($view->addpermissions)) ? json_decode($view->addpermissions,true):null; + $view->addpermissions = (isset($view->addpermissions) && ComponentbuilderHelper::checkJson($view->addpermissions)) ? json_decode($view->addpermissions, true) : null; if (ComponentbuilderHelper::checkArray($view->addpermissions)) { $view->permissions = array_values($view->addpermissions); @@ -1296,7 +1302,7 @@ class Get // reset fields $view->fields = array(); // set fields - $view->addfields = (isset($view->addfields) && ComponentbuilderHelper::checkJson($view->addfields)) ? json_decode($view->addfields,true):null; + $view->addfields = (isset($view->addfields) && ComponentbuilderHelper::checkJson($view->addfields)) ? json_decode($view->addfields, true) : null; if (ComponentbuilderHelper::checkArray($view->addfields)) { // build update SQL @@ -1306,14 +1312,15 @@ class Get if (isset($old_view->addfields) && ComponentbuilderHelper::checkJson($old_view->addfields)) { $this->setUpdateSQL(json_decode($old_view->addfields, true), $view->addfields, 'field', $name_single); - } + } // clear this data unset($old_view); } if (ComponentbuilderHelper::checkArray($view->addfields)) { // load the field data - $view->fields = array_map( function($array) use($name_single, $name_list){ + $view->fields = array_map(function($array) use($name_single, $name_list) + { $array['settings'] = $this->getFieldData($array['field'], $name_single, $name_list); return $array; }, array_values($view->addfields)); @@ -1340,7 +1347,7 @@ class Get }); } } - unset($view->addfields); + unset($view->addfields); // build update SQL if ($old_view = $this->getHistoryWatch('admin_view', $id)) { @@ -1348,12 +1355,12 @@ class Get if (ComponentbuilderHelper::checkString($old_view->name_single)) { $this->setUpdateSQL(ComponentbuilderHelper::safeString($old_view->name_single), $name_single, 'table_name', $name_single); - } + } // clear this data unset($old_view); - } + } // set the conditions - $view->addconditions = (isset($view->addconditions) && ComponentbuilderHelper::checkJson($view->addconditions)) ? json_decode($view->addconditions,true):null; + $view->addconditions = (isset($view->addconditions) && ComponentbuilderHelper::checkJson($view->addconditions)) ? json_decode($view->addconditions, true) : null; if (ComponentbuilderHelper::checkArray($view->addconditions)) { $view->conditions = array(); @@ -1369,23 +1376,23 @@ class Get if ((int) $fieldValues['field'] == (int) $fieldId) { // load the field details - $required = ComponentbuilderHelper::getBetween($fieldValues['settings']->xml,'required="','"'); - $required = ($required == true) ? 'yes' : 'no'; - $filter = ComponentbuilderHelper::getBetween($fieldValues['settings']->xml,'filter="','"'); - $filter = ComponentbuilderHelper::checkString($filter) ? $filter : 'none'; + $required = ComponentbuilderHelper::getBetween($fieldValues['settings']->xml, 'required="', '"'); + $required = ($required == true) ? 'yes' : 'no'; + $filter = ComponentbuilderHelper::getBetween($fieldValues['settings']->xml, 'filter="', '"'); + $filter = ComponentbuilderHelper::checkString($filter) ? $filter : 'none'; // get name - $name = ComponentbuilderHelper::getBetween($fieldValues['settings']->xml,'name="','"'); - $name = ComponentbuilderHelper::checkString($name) ? $name : $fieldValues['settings']->name; + $name = ComponentbuilderHelper::getBetween($fieldValues['settings']->xml, 'name="', '"'); + $name = ComponentbuilderHelper::checkString($name) ? $name : $fieldValues['settings']->name; // get type - $type = ComponentbuilderHelper::getBetween($fieldValues['settings']->xml,'type="','"'); - $type = ComponentbuilderHelper::checkString($type) ? $type : $fieldValues['settings']->type_name; + $type = ComponentbuilderHelper::getBetween($fieldValues['settings']->xml, 'type="', '"'); + $type = ComponentbuilderHelper::checkString($type) ? $type : $fieldValues['settings']->type_name; // set the field name $conditionValue['target_field'][$fieldKey] = array( 'name' => ComponentbuilderHelper::safeString($name), 'type' => ComponentbuilderHelper::safeString($type), 'required' => $required, 'filter' => $filter - ); + ); break; } } @@ -1400,19 +1407,19 @@ class Get if ((int) $fieldValue['field'] == (int) $conditionValue['match_field']) { // get name - $name = ComponentbuilderHelper::getBetween($fieldValue['settings']->xml,'name="','"'); + $name = ComponentbuilderHelper::getBetween($fieldValue['settings']->xml, 'name="', '"'); $name = ComponentbuilderHelper::checkString($name) ? $name : $fieldValue['settings']->name; // get type - $type = ComponentbuilderHelper::getBetween($fieldValue['settings']->xml,'type="','"'); + $type = ComponentbuilderHelper::getBetween($fieldValue['settings']->xml, 'type="', '"'); $type = ComponentbuilderHelper::checkString($type) ? $type : $fieldValue['settings']->type_name; // set the field details - $conditionValue['match_name'] = ComponentbuilderHelper::safeString($name); - $conditionValue['match_type'] = ComponentbuilderHelper::safeString($type); - $conditionValue['match_xml'] = $fieldValue['settings']->xml; + $conditionValue['match_name'] = ComponentbuilderHelper::safeString($name); + $conditionValue['match_type'] = ComponentbuilderHelper::safeString($type); + $conditionValue['match_xml'] = $fieldValue['settings']->xml; // if custom field load field being extended if (!ComponentbuilderHelper::typeField($type)) { - $conditionValue['match_extends'] = ComponentbuilderHelper::getBetween($fieldValue['settings']->xml,'extends="','"'); + $conditionValue['match_extends'] = ComponentbuilderHelper::getBetween($fieldValue['settings']->xml, 'extends="', '"'); } else { @@ -1430,7 +1437,7 @@ class Get unset($view->addconditions); // set linked views $this->linkedAdminViews[$name_single] = null; - $view->addlinked_views = (isset($view->addlinked_views) && ComponentbuilderHelper::checkJson($view->addlinked_views)) ? json_decode($view->addlinked_views,true):null; + $view->addlinked_views = (isset($view->addlinked_views) && ComponentbuilderHelper::checkJson($view->addlinked_views)) ? json_decode($view->addlinked_views, true) : null; if (ComponentbuilderHelper::checkArray($view->addlinked_views)) { // setup linked views to global data sets @@ -1440,10 +1447,10 @@ class Get // set the lang target $this->lang = 'admin'; // add_javascript - $addArrayJ = array('javascript_view_file','javascript_view_footer','javascript_views_file','javascript_views_footer'); + $addArrayJ = array('javascript_view_file', 'javascript_view_footer', 'javascript_views_file', 'javascript_views_footer'); foreach ($addArrayJ as $scripter) { - if (isset($view->{'add_'.$scripter}) && $view->{'add_'.$scripter} == 1 && ComponentbuilderHelper::checkString($view->$scripter)) + if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1 && ComponentbuilderHelper::checkString($view->$scripter)) { $view->$scripter = $this->setDynamicValues(base64_decode($view->$scripter)); $scripter_target = str_replace('javascript_', '', $scripter); @@ -1456,7 +1463,7 @@ class Get $this->customScriptBuilder[$scripter_target][$name_single] = ''; } $this->customScriptBuilder[$scripter_target][$name_single] .= $view->$scripter; - if (strpos($view->$scripter,"token") !== false || strpos($view->$scripter,"task=ajax") !== false) + if (strpos($view->$scripter, "token") !== false || strpos($view->$scripter, "task=ajax") !== false) { if (!$this->customScriptBuilder['token'][$name_single]) { @@ -1470,7 +1477,7 @@ class Get $addArrayC = array('css_view', 'css_views'); foreach ($addArrayC as $scripter) { - if (isset($view->{'add_'.$scripter}) && $view->{'add_'.$scripter} == 1) + if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1) { if (!isset($this->customScriptBuilder[$scripter][$name_single])) { @@ -1481,63 +1488,63 @@ class Get } } // add_php - $addArrayP = array('php_getitem','php_before_save','php_save','php_postsavehook','php_getitems','php_getitems_after_all','php_getlistquery','php_allowedit','php_before_delete','php_after_delete','php_before_publish','php_after_publish','php_batchcopy','php_batchmove','php_document'); + $addArrayP = array('php_getitem', 'php_before_save', 'php_save', 'php_postsavehook', 'php_getitems', 'php_getitems_after_all', 'php_getlistquery', 'php_allowedit', 'php_before_delete', 'php_after_delete', 'php_before_publish', 'php_after_publish', 'php_batchcopy', 'php_batchmove', 'php_document'); foreach ($addArrayP as $scripter) { - if (isset($view->{'add_'.$scripter}) && $view->{'add_'.$scripter} == 1) + if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1) { $this->customScriptBuilder[$scripter][$name_single] = $this->setDynamicValues(base64_decode($view->$scripter)); unset($view->$scripter); } } - // add the custom buttons - if (isset($view->add_custom_button) && $view->add_custom_button == 1) - { + // add the custom buttons + if (isset($view->add_custom_button) && $view->add_custom_button == 1) + { // set for the edit views - if (ComponentbuilderHelper::checkString($view->php_model)) - { - $view->php_model = $this->setDynamicValues(base64_decode($view->php_model)); - } + if (ComponentbuilderHelper::checkString($view->php_model)) + { + $view->php_model = $this->setDynamicValues(base64_decode($view->php_model)); + } if (ComponentbuilderHelper::checkString($view->php_controller)) - { + { $view->php_controller = $this->setDynamicValues(base64_decode($view->php_controller)); } // set for the list views - if (isset($view->php_model_list) && ComponentbuilderHelper::checkString($view->php_model_list)) - { - $view->php_model_list = $this->setDynamicValues(base64_decode($view->php_model_list)); - } + if (isset($view->php_model_list) && ComponentbuilderHelper::checkString($view->php_model_list)) + { + $view->php_model_list = $this->setDynamicValues(base64_decode($view->php_model_list)); + } if (isset($view->php_controller_list) && ComponentbuilderHelper::checkString($view->php_controller_list)) - { + { $view->php_controller_list = $this->setDynamicValues(base64_decode($view->php_controller_list)); } - // set the button array - $view->custom_button = (isset($view->custom_button) && ComponentbuilderHelper::checkJson($view->custom_button)) ? json_decode($view->custom_button,true):null; + // set the button array + $view->custom_button = (isset($view->custom_button) && ComponentbuilderHelper::checkJson($view->custom_button)) ? json_decode($view->custom_button, true) : null; if (ComponentbuilderHelper::checkArray($view->custom_button)) - { - $view->custom_buttons = array_values($view->custom_button); - } - unset($view->custom_button); - } + { + $view->custom_buttons = array_values($view->custom_button); + } + unset($view->custom_button); + } // set custom import scripts if (isset($view->add_custom_import) && $view->add_custom_import == 1) { - $addImportArray = array('php_import_ext','php_import_display','php_import','php_import_setdata','php_import_save','html_import_view'); + $addImportArray = array('php_import_ext', 'php_import_display', 'php_import', 'php_import_setdata', 'php_import_save', 'html_import_view'); foreach ($addImportArray as $importScripter) { if (isset($view->$importScripter) && strlen($view->$importScripter) > 0) { - $this->customScriptBuilder[$importScripter]['import_'.$name_list] = $this->setDynamicValues(base64_decode($view->$importScripter)); + $this->customScriptBuilder[$importScripter]['import_' . $name_list] = $this->setDynamicValues(base64_decode($view->$importScripter)); unset($view->$importScripter); } else { // load the default - $this->customScriptBuilder[$importScripter]['import_'.$name_list] = ComponentbuilderHelper::getImportScripts($importScripter, true); + $this->customScriptBuilder[$importScripter]['import_' . $name_list] = ComponentbuilderHelper::getImportScripts($importScripter, true); } } } - + // add_Ajax for this view if (isset($view->add_php_ajax) && $view->add_php_ajax == 1) { @@ -1554,7 +1561,7 @@ class Get } } // check if controller input as been set - $view->ajax_input = (isset($view->ajax_input) && ComponentbuilderHelper::checkJson($view->ajax_input)) ? json_decode($view->ajax_input,true):null; + $view->ajax_input = (isset($view->ajax_input) && ComponentbuilderHelper::checkJson($view->ajax_input)) ? json_decode($view->ajax_input, true) : null; if (ComponentbuilderHelper::checkArray($view->ajax_input)) { if ($addAjaxSite) @@ -1612,7 +1619,7 @@ class Get // return the found view data return $this->_adminViewData[$id]; } - + /** * Get all Custom View Data * @@ -1628,8 +1635,8 @@ class Get $query = $this->db->getQuery(true); $query->select('a.*'); - $query->from('#__componentbuilder_'.$table.' AS a'); - $query->where($this->db->quoteName('a.id') . ' = '. (int) $id); + $query->from('#__componentbuilder_' . $table . ' AS a'); + $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); // Reset the query using our newly populated query object. $this->db->setQuery($query); @@ -1660,16 +1667,16 @@ class Get 'table' => $table, 'key' => 'id', 'val' => (int) $id - ); + ); // update the repeatable fields $view = ComponentbuilderHelper::convertRepeatableFields($view, $searchRepeatables, $updater); - + // set the default data $view->default = $this->setDynamicValues(base64_decode($view->default)); // fix alias to use in code $view->code = $this->uniqueCode(ComponentbuilderHelper::safeString($view->codename)); $view->Code = ComponentbuilderHelper::safeString($view->code, 'F'); - $view->CODE = ComponentbuilderHelper::safeString($view->code, 'U'); + $view->CODE = ComponentbuilderHelper::safeString($view->code, 'U'); // load the library if (!isset($this->libManager[$this->target])) { @@ -1708,7 +1715,7 @@ class Get // setup template array $this->templateData[$this->target][$view->code] = array(); // setup template and layout data - $this->setTemplateAndLayoutData($view->default,$view->code); + $this->setTemplateAndLayoutData($view->default, $view->code); // insure the uikit components are loaded if (2 == $this->uikit || 1 == $this->uikit) { @@ -1716,7 +1723,7 @@ class Get { $this->uikitComp[$view->code] = array(); } - $this->uikitComp[$view->code] = ComponentbuilderHelper::getUikitComp($view->default,$this->uikitComp[$view->code]); + $this->uikitComp[$view->code] = ComponentbuilderHelper::getUikitComp($view->default, $this->uikitComp[$view->code]); } // check for footable if (!isset($this->footableScripts[$this->target][$view->code]) || !$this->footableScripts[$this->target][$view->code]) @@ -1741,15 +1748,15 @@ class Get } } // set the main get data - $main_get = $this->setGetData(array($view->main_get),$view->code); + $main_get = $this->setGetData(array($view->main_get), $view->code); $view->main_get = $main_get[0]; // set the custom_get data - $view->custom_get = $this->setGetData(json_decode($view->custom_get, true),$view->code); + $view->custom_get = $this->setGetData(json_decode($view->custom_get, true), $view->code); // set array adding array of scripts - $addArray = array('php_view','php_jview','php_jview_display','php_document','js_document','css_document','css'); + $addArray = array('php_view', 'php_jview', 'php_jview_display', 'php_document', 'javascript_file', 'js_document', 'css_document', 'css'); foreach ($addArray as $scripter) { - if (isset($view->{'add_'.$scripter}) && $view->{'add_'.$scripter} == 1 && ComponentbuilderHelper::checkString($view->$scripter)) + if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1 && ComponentbuilderHelper::checkString($view->$scripter)) { $view->$scripter = $this->setDynamicValues(base64_decode($view->$scripter)); if (2 == $this->uikit || 1 == $this->uikit) @@ -1759,11 +1766,11 @@ class Get $this->uikitComp[$view->code] = array(); } // set uikit to views - $this->uikitComp[$view->code] = ComponentbuilderHelper::getUikitComp($view->$scripter,$this->uikitComp[$view->code]); + $this->uikitComp[$view->code] = ComponentbuilderHelper::getUikitComp($view->$scripter, $this->uikitComp[$view->code]); } - - $this->setTemplateAndLayoutData($view->$scripter,$view->code); - + + $this->setTemplateAndLayoutData($view->$scripter, $view->code); + // check for footable if (!isset($this->footableScripts[$this->target][$view->code]) || !$this->footableScripts[$this->target][$view->code]) { @@ -1805,7 +1812,7 @@ class Get if (isset($view->add_php_ajax) && $view->add_php_ajax == 1) { // check if controller input as been set - $view->ajax_input = (isset($view->ajax_input) && ComponentbuilderHelper::checkJson($view->ajax_input)) ? json_decode($view->ajax_input,true):null; + $view->ajax_input = (isset($view->ajax_input) && ComponentbuilderHelper::checkJson($view->ajax_input)) ? json_decode($view->ajax_input, true) : null; if (ComponentbuilderHelper::checkArray($view->ajax_input)) { $this->customScriptBuilder[$this->target]['ajax_controller'][$view->code] = array_values($view->ajax_input); @@ -1815,7 +1822,7 @@ class Get // load the ajax class mathods (if set) if (ComponentbuilderHelper::checkString($view->php_ajaxmethod)) { - + $this->customScriptBuilder[$this->target]['ajax_model'][$view->code] = $this->setDynamicValues(base64_decode($view->php_ajaxmethod)); $this->addSiteAjax = true; } @@ -1833,7 +1840,7 @@ class Get $view->php_controller = base64_decode($view->php_controller); $view->php_controller = $this->setDynamicValues($view->php_controller); // set the button array - $view->custom_button = (isset($view->custom_button) && ComponentbuilderHelper::checkJson($view->custom_button)) ? json_decode($view->custom_button,true):null; + $view->custom_button = (isset($view->custom_button) && ComponentbuilderHelper::checkJson($view->custom_button)) ? json_decode($view->custom_button, true) : null; if (ComponentbuilderHelper::checkArray($view->custom_button)) { $view->custom_buttons = array_values($view->custom_button); @@ -1843,7 +1850,7 @@ class Get // return the found view data return $view; } - + /** * Get all Field Data * @@ -1866,7 +1873,7 @@ class Get $query->select($this->db->quoteName(array('c.name', 'c.properties'), array('type_name', 'properties'))); $query->from('#__componentbuilder_field AS a'); $query->join('LEFT', $this->db->quoteName('#__componentbuilder_fieldtype', 'c') . ' ON (' . $this->db->quoteName('a.fieldtype') . ' = ' . $this->db->quoteName('c.id') . ')'); - $query->where($this->db->quoteName('a.id') . ' = '. $this->db->quote($id)); + $query->where($this->db->quoteName('a.id') . ' = ' . $this->db->quote($id)); // Reset the query using our newly populated query object. $this->db->setQuery($query); @@ -1878,7 +1885,7 @@ class Get // adding a fix for the changed name of type to fieldtype $field->type = $field->fieldtype; - + // repeatable fields to update $searchRepeatables = array( // repeatablefield => checker @@ -1897,25 +1904,25 @@ class Get $field->xml = $this->setDynamicValues(json_decode($field->xml)); // load the type values form type params - $field->properties = (isset($field->properties) && ComponentbuilderHelper::checkJson($field->properties)) ? json_decode($field->properties, true):null; + $field->properties = (isset($field->properties) && ComponentbuilderHelper::checkJson($field->properties)) ? json_decode($field->properties, true) : null; if (ComponentbuilderHelper::checkArray($field->properties)) { $field->properties = array_values($field->properties); } // check if we have advanced encryption - if (4 == $field->store && (!isset($this->advancedEncryption) || !$this->advancedEncryption)) + if (4 == $field->store && (!isset($this->advancedEncryption) || !$this->advancedEncryption)) { - $this->advancedEncryption = true; + $this->advancedEncryption = true; } // check if we have basic encryption - elseif (3 == $field->store && (!isset($this->basicEncryption) || !$this->basicEncryption)) + elseif (3 == $field->store && (!isset($this->basicEncryption) || !$this->basicEncryption)) { - $this->basicEncryption = true; + $this->basicEncryption = true; } - + // get the last used version $field->history = $this->getHistoryWatch('field', $id); - + $this->_fieldData[$id] = $field; } else @@ -1932,7 +1939,7 @@ class Get // add_javascript_view_footer if ($this->_fieldData[$id]->add_javascript_view_footer == 1 && ComponentbuilderHelper::checkString($this->_fieldData[$id]->javascript_view_footer)) { - if(!isset($this->customScriptBuilder['view_footer'])) + if (!isset($this->customScriptBuilder['view_footer'])) { $this->customScriptBuilder['view_footer'] = array(); } @@ -1945,11 +1952,11 @@ class Get $this->_fieldData[$id]->javascript_view_footer = $this->setDynamicValues(base64_decode($this->_fieldData[$id]->javascript_view_footer)); $this->_fieldData[$id]->javascript_view_footer_decoded = true; } - $this->customScriptBuilder['view_footer'][$name_single] .= PHP_EOL.$this->_fieldData[$id]->javascript_view_footer; - if ( strpos($this->_fieldData[$id]->javascript_view_footer,"token") !== false || - strpos($this->_fieldData[$id]->javascript_view_footer,"task=ajax") !== false) + $this->customScriptBuilder['view_footer'][$name_single] .= PHP_EOL . $this->_fieldData[$id]->javascript_view_footer; + if (strpos($this->_fieldData[$id]->javascript_view_footer, "token") !== false || + strpos($this->_fieldData[$id]->javascript_view_footer, "task=ajax") !== false) { - if(!isset($this->customScriptBuilder['token'])) + if (!isset($this->customScriptBuilder['token'])) { $this->customScriptBuilder['token'] = array(); } @@ -1973,12 +1980,12 @@ class Get } if (!isset($this->_fieldData[$id]->css_view_decoded)) { - $this->_fieldData[$id]->css_view = base64_decode($this->_fieldData[$id]->css_view); + $this->_fieldData[$id]->css_view = base64_decode($this->_fieldData[$id]->css_view); // check for custom code $this->setCustomCodeData($this->_fieldData[$id]->css_view); $this->_fieldData[$id]->css_view_decoded = true; } - $this->customScriptBuilder['css_view'][$name_single] .= PHP_EOL.$this->_fieldData[$id]->css_view; + $this->customScriptBuilder['css_view'][$name_single] .= PHP_EOL . $this->_fieldData[$id]->css_view; } // add this only once to view. @@ -1990,7 +1997,7 @@ class Get // add_javascript_views_footer if ($this->_fieldData[$id]->add_javascript_views_footer == 1 && ComponentbuilderHelper::checkString($this->_fieldData[$id]->javascript_views_footer)) { - if(!isset($this->customScriptBuilder['views_footer'])) + if (!isset($this->customScriptBuilder['views_footer'])) { $this->customScriptBuilder['views_footer'] = array(); } @@ -2004,10 +2011,10 @@ class Get $this->_fieldData[$id]->javascript_views_footer_decoded = true; } $this->customScriptBuilder['views_footer'][$name_list] .= $this->_fieldData[$id]->javascript_views_footer; - if ( strpos($this->_fieldData[$id]->javascript_views_footer,"token") !== false || - strpos($this->_fieldData[$id]->javascript_views_footer,"task=ajax") !== false) + if (strpos($this->_fieldData[$id]->javascript_views_footer, "token") !== false || + strpos($this->_fieldData[$id]->javascript_views_footer, "task=ajax") !== false) { - if(!isset($this->customScriptBuilder['token'])) + if (!isset($this->customScriptBuilder['token'])) { $this->customScriptBuilder['token'] = array(); } @@ -2030,7 +2037,7 @@ class Get } if (!isset($this->_fieldData[$id]->css_views_decoded)) { - $this->_fieldData[$id]->css_views = base64_decode($this->_fieldData[$id]->css_views); + $this->_fieldData[$id]->css_views = base64_decode($this->_fieldData[$id]->css_views); // check for custom code $this->setCustomCodeData($this->_fieldData[$id]->css_views); $this->_fieldData[$id]->css_views_decoded = true; @@ -2049,7 +2056,7 @@ class Get } return false; } - + /** * Set get Data * @@ -2081,67 +2088,62 @@ class Get foreach ($results as $_nr => &$result) { // add calculations if set - if($result->addcalculation == 1 && ComponentbuilderHelper::checkString($result->php_calculation)) + if ($result->addcalculation == 1 && ComponentbuilderHelper::checkString($result->php_calculation)) { $result->php_calculation = $this->setDynamicValues(base64_decode($result->php_calculation)); } // add php custom scripting (php_before_getitem) - if($result->add_php_before_getitem == 1 && ComponentbuilderHelper::checkString($result->php_before_getitem)) + if ($result->add_php_before_getitem == 1 && ComponentbuilderHelper::checkString($result->php_before_getitem)) { - if (!isset($this->customScriptBuilder[$this->target.'_php_before_getitem'][$view_code])) + if (!isset($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view_code])) { - $this->customScriptBuilder[$this->target.'_php_before_getitem'][$view_code] = ''; + $this->customScriptBuilder[$this->target . '_php_before_getitem'][$view_code] = ''; } - $this->customScriptBuilder[$this->target.'_php_before_getitem'][$view_code] .= - $this->setDynamicValues(PHP_EOL.PHP_EOL.base64_decode($result->php_before_getitem)); + $this->customScriptBuilder[$this->target . '_php_before_getitem'][$view_code] .= $this->setDynamicValues(PHP_EOL . PHP_EOL . base64_decode($result->php_before_getitem)); unset($result->php_before_getitem); } // add php custom scripting (php_after_getitem) - if($result->add_php_after_getitem == 1 && ComponentbuilderHelper::checkString($result->php_after_getitem)) + if ($result->add_php_after_getitem == 1 && ComponentbuilderHelper::checkString($result->php_after_getitem)) { - if (!isset($this->customScriptBuilder[$this->target.'_php_after_getitem'][$view_code])) + if (!isset($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view_code])) { - $this->customScriptBuilder[$this->target.'_php_after_getitem'][$view_code] = ''; + $this->customScriptBuilder[$this->target . '_php_after_getitem'][$view_code] = ''; } - $this->customScriptBuilder[$this->target.'_php_after_getitem'][$view_code] .= - $this->setDynamicValues(PHP_EOL.PHP_EOL.base64_decode($result->php_after_getitem)); + $this->customScriptBuilder[$this->target . '_php_after_getitem'][$view_code] .= $this->setDynamicValues(PHP_EOL . PHP_EOL . base64_decode($result->php_after_getitem)); unset($result->php_after_getitem); } // add php custom scripting (php_before_getitems) - if($result->add_php_before_getitems == 1 && ComponentbuilderHelper::checkString($result->php_before_getitems)) + if ($result->add_php_before_getitems == 1 && ComponentbuilderHelper::checkString($result->php_before_getitems)) { - if (!isset($this->customScriptBuilder[$this->target.'_php_before_getitems'][$view_code])) + if (!isset($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view_code])) { - $this->customScriptBuilder[$this->target.'_php_before_getitems'][$view_code] = ''; + $this->customScriptBuilder[$this->target . '_php_before_getitems'][$view_code] = ''; } - $this->customScriptBuilder[$this->target.'_php_before_getitems'][$view_code] .= - $this->setDynamicValues(PHP_EOL.PHP_EOL.base64_decode($result->php_before_getitems)); + $this->customScriptBuilder[$this->target . '_php_before_getitems'][$view_code] .= $this->setDynamicValues(PHP_EOL . PHP_EOL . base64_decode($result->php_before_getitems)); unset($result->php_before_getitems); } // add php custom scripting (php_after_getitems) - if($result->add_php_after_getitems == 1 && ComponentbuilderHelper::checkString($result->php_after_getitems)) + if ($result->add_php_after_getitems == 1 && ComponentbuilderHelper::checkString($result->php_after_getitems)) { - if (!isset($this->customScriptBuilder[$this->target.'_php_after_getitems'][$view_code])) + if (!isset($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view_code])) { - $this->customScriptBuilder[$this->target.'_php_after_getitems'][$view_code] = ''; + $this->customScriptBuilder[$this->target . '_php_after_getitems'][$view_code] = ''; } - $this->customScriptBuilder[$this->target.'_php_after_getitems'][$view_code] .= - $this->setDynamicValues(PHP_EOL.PHP_EOL.base64_decode($result->php_after_getitems)); + $this->customScriptBuilder[$this->target . '_php_after_getitems'][$view_code] .= $this->setDynamicValues(PHP_EOL . PHP_EOL . base64_decode($result->php_after_getitems)); unset($result->php_after_getitems); } // add php custom scripting (php_getlistquery) - if($result->add_php_getlistquery == 1 && ComponentbuilderHelper::checkString($result->php_getlistquery)) + if ($result->add_php_getlistquery == 1 && ComponentbuilderHelper::checkString($result->php_getlistquery)) { - if (!isset($this->customScriptBuilder[$this->target.'_php_getlistquery'][$view_code])) + if (!isset($this->customScriptBuilder[$this->target . '_php_getlistquery'][$view_code])) { - $this->customScriptBuilder[$this->target.'_php_getlistquery'][$view_code] = ''; + $this->customScriptBuilder[$this->target . '_php_getlistquery'][$view_code] = ''; } - $this->customScriptBuilder[$this->target.'_php_getlistquery'][$view_code] .= - $this->setDynamicValues(PHP_EOL.base64_decode($result->php_getlistquery)); + $this->customScriptBuilder[$this->target . '_php_getlistquery'][$view_code] .= $this->setDynamicValues(PHP_EOL . base64_decode($result->php_getlistquery)); unset($result->php_getlistquery); } // set the getmethod code name - $result->key = ComponentbuilderHelper::safeString($view_code. ' ' .$result->name . ' ' .$result->id); + $result->key = ComponentbuilderHelper::safeString($view_code . ' ' . $result->name . ' ' . $result->id); // reset buckets $result->main_get = array(); $result->custom_get = array(); @@ -2149,25 +2151,25 @@ class Get switch ($result->main_source) { case 1: - // set the view data - $result->main_get[0]['selection'] = $this->setDataSelection($result->key, $view_code, $result->view_selection, $result->view_table_main, 'a', '', 'view'); - $result->main_get[0]['as'] = 'a'; - $result->main_get[0]['key'] = $result->key; - unset($result->view_selection); - break; + // set the view data + $result->main_get[0]['selection'] = $this->setDataSelection($result->key, $view_code, $result->view_selection, $result->view_table_main, 'a', '', 'view'); + $result->main_get[0]['as'] = 'a'; + $result->main_get[0]['key'] = $result->key; + unset($result->view_selection); + break; case 2: - // set the database data - $result->main_get[0]['selection'] = $this->setDataSelection($result->key, $view_code, $result->db_selection, $result->db_table_main, 'a', '', 'db'); - $result->main_get[0]['as'] = 'a'; - $result->main_get[0]['key'] = $result->key; - unset($result->db_selection); - break; + // set the database data + $result->main_get[0]['selection'] = $this->setDataSelection($result->key, $view_code, $result->db_selection, $result->db_table_main, 'a', '', 'db'); + $result->main_get[0]['as'] = 'a'; + $result->main_get[0]['key'] = $result->key; + unset($result->db_selection); + break; case 3: - // set custom script - $result->main_get[0]['selection'] = array( - 'select' => base64_decode($result->php_custom_get), - 'from' => '', 'table' => '', 'type' => ''); - break; + // set custom script + $result->main_get[0]['selection'] = array( + 'select' => base64_decode($result->php_custom_get), + 'from' => '', 'table' => '', 'type' => ''); + break; } // set join_view_table details $result->join_view_table = json_decode($result->join_view_table, true); @@ -2178,17 +2180,16 @@ class Get if (ComponentbuilderHelper::checkString($option['selection'])) { // convert the type - $option['type'] = $typeArray[$option['type']]; + $option['type'] = $typeArray[$option['type']]; // convert the operator - $option['operator'] = $operatorArray[$option['operator']]; + $option['operator'] = $operatorArray[$option['operator']]; // get the on field values - $on_field = array(); // array(on_field_as, on_field) - $on_field = array_map('trim', explode('.',$option['on_field'])); + $on_field = array(); // array(on_field_as, on_field) + $on_field = array_map('trim', explode('.', $option['on_field'])); // get the join field values - $join_field = array(); // array(join_field_as, join_field) - $join_field = array_map('trim', explode('.',$option['join_field'])); - $option['selection'] = - $this->setDataSelection($result->key, $view_code, $option['selection'], $option['view_table'], $option['as'], $option['row_type'], 'view'); + $join_field = array(); // array(join_field_as, join_field) + $join_field = array_map('trim', explode('.', $option['join_field'])); + $option['selection'] = $this->setDataSelection($result->key, $view_code, $option['selection'], $option['view_table'], $option['as'], $option['row_type'], 'view'); $option['key'] = $result->key; // load to the getters if ($option['row_type'] == 1) @@ -2225,17 +2226,16 @@ class Get if (ComponentbuilderHelper::checkString($option1['selection'])) { // convert the type - $option1['type'] = $typeArray[$option1['type']]; + $option1['type'] = $typeArray[$option1['type']]; // convert the operator - $option1['operator'] = $operatorArray[$option1['operator']]; + $option1['operator'] = $operatorArray[$option1['operator']]; // get the on field values - $on_field = array(); // array(on_field_as, on_field) - $on_field = array_map('trim', explode('.',$option1['on_field'])); + $on_field = array(); // array(on_field_as, on_field) + $on_field = array_map('trim', explode('.', $option1['on_field'])); // get the join field values - $join_field = array(); // array(join_field_as, join_field) - $join_field = array_map('trim', explode('.',$option1['join_field'])); - $option1['selection'] = - $this->setDataSelection($result->key, $view_code, $option1['selection'], $option1['db_table'], $option1['as'], $option1['row_type'], 'db'); + $join_field = array(); // array(join_field_as, join_field) + $join_field = array_map('trim', explode('.', $option1['join_field'])); + $option1['selection'] = $this->setDataSelection($result->key, $view_code, $option1['selection'], $option1['db_table'], $option1['as'], $option1['row_type'], 'db'); $option1['key'] = $result->key; // load to the getters if ($option1['row_type'] == 1) @@ -2319,7 +2319,7 @@ class Get } return false; } - + /** * To limit the SQL Demo date build in the views * @@ -2327,12 +2327,12 @@ class Get * * @return void * - */ + */ public function setSqlTweaking($settings) { if (ComponentbuilderHelper::checkArray($settings)) { - foreach($settings as $setting) + foreach ($settings as $setting) { // should sql dump be added if (1 == $setting['add_sql']) @@ -2347,7 +2347,7 @@ class Get // now get the ids if (strpos($ids, ',') !== false) { - $id_array = (array) array_map('trim',explode(',', $ids)); + $id_array = (array) array_map('trim', explode(',', $ids)); } else { @@ -2364,8 +2364,8 @@ class Get // build range if (count($id_range) == 2) { - $range = range($id_range[0],$id_range[1]); - $id_array_new = array_merge($id_array_new,$range); + $range = range($id_range[0], $id_range[1]); + $id_array_new = array_merge($id_array_new, $range); } } } @@ -2381,20 +2381,19 @@ class Get // sort sort($id_array, SORT_NUMERIC); // now set it to global - $this->sqlTweak[ (int) $setting['adminview']]['where'] = implode(',', $id_array); + $this->sqlTweak[(int) $setting['adminview']]['where'] = implode(',', $id_array); } } } else { // remove all sql dump options - $this->sqlTweak[ (int) $setting['adminview']]['remove'] = true; - + $this->sqlTweak[(int) $setting['adminview']]['remove'] = true; } } } } - + /** * check if an update SQL is needed * @@ -2409,8 +2408,7 @@ class Get protected function setUpdateSQL($old, $new, $type, $key = null) { // check if there were new items added - if (ComponentbuilderHelper::checkArray($new) - && ComponentbuilderHelper::checkArray($old)) + if (ComponentbuilderHelper::checkArray($new) && ComponentbuilderHelper::checkArray($old)) { // check if this is old repeatable field if (isset($new[$type])) @@ -2432,7 +2430,7 @@ class Get elseif (!isset($old[$type])) { // we have new values - foreach($old as $oldItem) + foreach ($old as $oldItem) { if (isset($oldItem[$type])) { @@ -2480,7 +2478,7 @@ class Get elseif (!isset($old[$type])) { // we have new values - foreach($old as $oldItem) + foreach ($old as $oldItem) { if (isset($oldItem[$type])) { @@ -2515,9 +2513,7 @@ class Get } } } - elseif ($key && ComponentbuilderHelper::checkString($new) - && ComponentbuilderHelper::checkString($old) - && $new !== $old) + elseif ($key && ComponentbuilderHelper::checkString($new) && ComponentbuilderHelper::checkString($old) && $new !== $old) { // the string changed, lets add to SQL update if (!isset($this->updateSQL[$type]) || !ComponentbuilderHelper::checkArray($this->updateSQL[$type])) @@ -2525,10 +2521,10 @@ class Get $this->updateSQL[$type] = array(); } // set at key - $this->updateSQL[$type][$key] = array('old' => $old, 'new' => $new); + $this->updateSQL[$type][$key] = array('old' => $old, 'new' => $new); } } - + /** * Set the add sql * @@ -2567,7 +2563,7 @@ class Get } } } - + /** * Get Item History values * @@ -2586,10 +2582,10 @@ class Get $query->select('h.*'); $query->from('#__ucm_history AS h'); - $query->where($this->db->quoteName('h.ucm_item_id') . ' = '. (int) $id); + $query->where($this->db->quoteName('h.ucm_item_id') . ' = ' . (int) $id); // Join over the content type for the type id $query->join('LEFT', '#__content_types AS ct ON ct.type_id = h.ucm_type_id'); - $query->where('ct.type_alias = ' . $this->db->quote('com_componentbuilder.'.$type)); + $query->where('ct.type_alias = ' . $this->db->quote('com_componentbuilder.' . $type)); $query->order('h.save_date DESC'); $this->db->setQuery($query, 0, 1); $this->db->execute(); @@ -2616,7 +2612,7 @@ class Get } // Join over the content type for the type id $query->join('LEFT', '#__content_types AS ct ON ct.type_id = h.ucm_type_id'); - $query->where('ct.type_alias = ' . $this->db->quote('com_componentbuilder.'.$type)); + $query->where('ct.type_alias = ' . $this->db->quote('com_componentbuilder.' . $type)); $query->order('h.save_date DESC'); $this->db->setQuery($query); $this->db->execute(); @@ -2635,14 +2631,14 @@ class Get // return the last used history record or null. return $this->tmpHistory; } - + /** * Set Item History Watch * * @param Object $object The history object * @param int $action The action to take - * 0 = remove watch - * 1 = add watch + * 0 = remove watch + * 1 = add watch * @param string $type The type of item * * @return bool @@ -2664,7 +2660,7 @@ class Get { case 0: // remove watch - if(isset($version_note['component']) && ($key = array_search($this->componentID, $version_note['component'])) !== false) + if (isset($version_note['component']) && ($key = array_search($this->componentID, $version_note['component'])) !== false) { // last version that was used to build/compile $this->tmpHistory = json_decode($object->version_data); @@ -2676,7 +2672,7 @@ class Get // since it was not found, no need to update anything return true; } - break; + break; case 1: // add watch if (!in_array($this->componentID, $version_note['component'])) @@ -2688,7 +2684,7 @@ class Get // since it is there already, no need to update anything return true; } - break; + break; } // check if we need to still keep this locked if (isset($version_note['component']) && ComponentbuilderHelper::checkArray($version_note['component'])) @@ -2707,7 +2703,7 @@ class Get // run the update return $this->db->updateObject('#__ucm_history', $object, 'version_id'); } - + /** * Set Template and Layout Data * @@ -2717,16 +2713,16 @@ class Get * @return void * */ - public function setTemplateAndLayoutData($default,$view) + public function setTemplateAndLayoutData($default, $view) { // set the Tempale date - $temp1 = ComponentbuilderHelper::getAllBetween($default, "\$this->loadTemplate('","')"); - $temp2 = ComponentbuilderHelper::getAllBetween($default, '$this->loadTemplate("','")'); + $temp1 = ComponentbuilderHelper::getAllBetween($default, "\$this->loadTemplate('", "')"); + $temp2 = ComponentbuilderHelper::getAllBetween($default, '$this->loadTemplate("', '")'); $templates = array(); $again = array(); if (ComponentbuilderHelper::checkArray($temp1) && ComponentbuilderHelper::checkArray($temp2)) { - $templates = array_merge($temp1,$temp2); + $templates = array_merge($temp1, $temp2); } else { @@ -2743,25 +2739,26 @@ class Get { foreach ($templates as $template) { - if (!isset($this->templateData[$this->target][$view]) || !array_key_exists($template,$this->templateData[$this->target][$view])) + if (!isset($this->templateData[$this->target][$view]) || !array_key_exists($template, $this->templateData[$this->target][$view])) { - $data = $this->getDataWithAlias($template,'template',$view); + $data = $this->getDataWithAlias($template, 'template', $view); if (ComponentbuilderHelper::checkArray($data)) { $this->templateData[$this->target][$view][$template] = $data; // call self to get child data - $again[] = array($data['html'],$view); - $again[] = array($data['php_view'],$view); + $again[] = array($data['html'], $view); + $again[] = array($data['php_view'], $view); } } } } // set the layout data - $lay1 = ComponentbuilderHelper::getAllBetween($default, "JLayoutHelper::render('","',"); - $lay2 = ComponentbuilderHelper::getAllBetween($default, 'JLayoutHelper::render("','",');; + $lay1 = ComponentbuilderHelper::getAllBetween($default, "JLayoutHelper::render('", "',"); + $lay2 = ComponentbuilderHelper::getAllBetween($default, 'JLayoutHelper::render("', '",'); + ; if (ComponentbuilderHelper::checkArray($lay1) && ComponentbuilderHelper::checkArray($lay2)) { - $layouts = array_merge($lay1,$lay2); + $layouts = array_merge($lay1, $lay2); } else { @@ -2778,15 +2775,15 @@ class Get { foreach ($layouts as $layout) { - if (!isset($this->layoutData[$this->target]) || !ComponentbuilderHelper::checkArray($this->layoutData[$this->target]) || !array_key_exists($layout,$this->layoutData[$this->target])) + if (!isset($this->layoutData[$this->target]) || !ComponentbuilderHelper::checkArray($this->layoutData[$this->target]) || !array_key_exists($layout, $this->layoutData[$this->target])) { - $data = $this->getDataWithAlias($layout,'layout',$view); + $data = $this->getDataWithAlias($layout, 'layout', $view); if (ComponentbuilderHelper::checkArray($data)) { $this->layoutData[$this->target][$layout] = $data; // call self to get child data - $again[] = array($data['html'],$view); - $again[] = array($data['php_view'],$view); + $again[] = array($data['html'], $view); + $again[] = array($data['php_view'], $view); } } } @@ -2795,11 +2792,11 @@ class Get { foreach ($again as $go) { - $this->setTemplateAndLayoutData($go[0],$go[1]); + $this->setTemplateAndLayoutData($go[0], $go[1]); } } } - + /** * Get Data With Alias * @@ -2815,7 +2812,7 @@ class Get // Create a new query object. $query = $this->db->getQuery(true); $query->select('a.*'); - $query->from('#__componentbuilder_'.$table.' AS a'); + $query->from('#__componentbuilder_' . $table . ' AS a'); $this->db->setQuery($query); $rows = $this->db->loadObjectList(); foreach ($rows as $row) @@ -2874,7 +2871,7 @@ class Get $this->uikitComp[$view] = array(); } // set uikit to views - $this->uikitComp[$view] = ComponentbuilderHelper::getUikitComp($contnent,$this->uikitComp[$view]); + $this->uikitComp[$view] = ComponentbuilderHelper::getUikitComp($contnent, $this->uikitComp[$view]); } // set footable to views and turn it on if (!isset($this->footableScripts[$this->target][$view]) || !$this->footableScripts[$this->target][$view]) @@ -2918,7 +2915,7 @@ class Get } return false; } - + /** * Get Library Data and store globaly * @@ -2929,7 +2926,7 @@ class Get */ protected function getLibrary($id) { - + // check if the lib has already been set if (!isset($this->libraries[$id])) { @@ -2938,35 +2935,35 @@ class Get { case 1: // No Library return false; - break; + break; case 3: // Uikit v3 if (2 == $this->uikit || 3 == $this->uikit) { // already being loaded $this->libraries[$id] = false; } - break; + break; case 4: // Uikit v2 if (2 == $this->uikit || 1 == $this->uikit) { // already being loaded $this->libraries[$id] = false; } - break; + break; case 5: // FooTable v2 if (!isset($this->footableVersion) || 2 == $this->footableVersion) { // already being loaded $this->libraries[$id] = false; } - break; + break; case 6: // FooTable v3 if (3 == $this->footableVersion) { // already being loaded $this->libraries[$id] = false; } - break; + break; } } // check if the lib has already been set @@ -2978,43 +2975,42 @@ class Get $query->select( $this->db->quoteName( array( - 'a.id', - 'a.name', - 'a.how', - 'a.type', - 'a.addconditions', - 'b.addconfig', - 'c.addfiles', - 'c.addfolders', - 'c.addurls', - 'a.php_setdocument' - ), - array( - 'id', - 'name', - 'how', - 'type', - 'addconditions', - 'addconfig', - 'addfiles', - 'addfolders', - 'addurls', - 'php_setdocument' - ) + 'a.id', + 'a.name', + 'a.how', + 'a.type', + 'a.addconditions', + 'b.addconfig', + 'c.addfiles', + 'c.addfolders', + 'c.addurls', + 'a.php_setdocument' + ), array( + 'id', + 'name', + 'how', + 'type', + 'addconditions', + 'addconfig', + 'addfiles', + 'addfolders', + 'addurls', + 'php_setdocument' ) - ); + ) + ); // from these tables $query->from('#__componentbuilder_library AS a'); $query->join('LEFT', $this->db->quoteName('#__componentbuilder_library_config', 'b') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('b.library') . ')'); $query->join('LEFT', $this->db->quoteName('#__componentbuilder_library_files_folders_urls', 'c') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('c.library') . ')'); - $query->where($this->db->quoteName('a.id') . ' = '. (int) $id); + $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); // Reset the query using our newly populated query object. $this->db->setQuery($query); // Load the results as a list of stdClass objects $library = $this->db->loadObject(); - + // check if this lib uses build-in behaviour if ($library->how == 4) { @@ -3040,31 +3036,32 @@ class Get if ($library->how > 0) { // set the addfolders data - $library->addfolders = (isset($library->addfolders) && ComponentbuilderHelper::checkJson($library->addfolders)) ? json_decode($library->addfolders,true):null; + $library->addfolders = (isset($library->addfolders) && ComponentbuilderHelper::checkJson($library->addfolders)) ? json_decode($library->addfolders, true) : null; if (ComponentbuilderHelper::checkArray($library->addfolders)) { $library->folders = array_values($library->addfolders); } // set the addfiles data - $library->addfiles = (isset($library->addfiles) && ComponentbuilderHelper::checkJson($library->addfiles)) ? json_decode($library->addfiles,true):null; + $library->addfiles = (isset($library->addfiles) && ComponentbuilderHelper::checkJson($library->addfiles)) ? json_decode($library->addfiles, true) : null; if (ComponentbuilderHelper::checkArray($library->addfiles)) { $library->files = array_values($library->addfiles); } // set the addurls data - $library->addurls = (isset($library->addurls) && ComponentbuilderHelper::checkJson($library->addurls)) ? json_decode($library->addurls,true):null; + $library->addurls = (isset($library->addurls) && ComponentbuilderHelper::checkJson($library->addurls)) ? json_decode($library->addurls, true) : null; if (ComponentbuilderHelper::checkArray($library->addurls)) { $library->urls = array_values($library->addurls); - } + } // add config fields only if needed if ($library->how > 1) { // set the config data - $library->addconfig = (isset($library->addconfig) && ComponentbuilderHelper::checkJson($library->addconfig)) ? json_decode($library->addconfig,true):null; + $library->addconfig = (isset($library->addconfig) && ComponentbuilderHelper::checkJson($library->addconfig)) ? json_decode($library->addconfig, true) : null; if (ComponentbuilderHelper::checkArray($library->addconfig)) { - $library->config = array_map(function($array) { + $library->config = array_map(function($array) + { $array['alias'] = 0; $array['title'] = 0; $array['settings'] = $this->getFieldData($array['field']); @@ -3085,7 +3082,7 @@ class Get elseif (2 == $library->how) { // set the addconditions data - $library->addconditions = (isset($library->addconditions) && ComponentbuilderHelper::checkJson($library->addconditions)) ? json_decode($library->addconditions,true):null; + $library->addconditions = (isset($library->addconditions) && ComponentbuilderHelper::checkJson($library->addconditions)) ? json_decode($library->addconditions, true) : null; if (ComponentbuilderHelper::checkArray($library->addconditions)) { $library->conditions = array_values($library->addconditions); @@ -3112,7 +3109,7 @@ class Get } return false; } - + /** * Set Language Place Holders * @@ -3125,24 +3122,24 @@ class Get { // get targets to search for $langStringTargets = array_filter( - $this->langStringTargets, - function($get) use($content){ - if (strpos($content, $get) !== false) - { - return true; - } - return false; - }); + $this->langStringTargets, function($get) use($content) + { + if (strpos($content, $get) !== false) + { + return true; + } + return false; + }); // check if we should continue if (ComponentbuilderHelper::checkArray($langStringTargets)) { // insure string is not broken - $content = str_replace('COM_###COMPONENT###',$this->langPrefix,$content); + $content = str_replace('COM_###COMPONENT###', $this->langPrefix, $content); // first get the Joomla.JText._() - if (in_array('Joomla.JText._(',$langStringTargets)) + if (in_array('Joomla.JText._(', $langStringTargets)) { - $jsTEXT[] = ComponentbuilderHelper::getAllBetween($content, "Joomla.JText._('","'"); - $jsTEXT[] = ComponentbuilderHelper::getAllBetween($content, 'Joomla.JText._("','"'); + $jsTEXT[] = ComponentbuilderHelper::getAllBetween($content, "Joomla.JText._('", "'"); + $jsTEXT[] = ComponentbuilderHelper::getAllBetween($content, 'Joomla.JText._("', '"'); // combine into one array $jsTEXT = ComponentbuilderHelper::mergeArrays($jsTEXT); // we need to add a check to insure these JavaScript lang matchup @@ -3154,10 +3151,10 @@ class Get } } // now get the JText::script() - if (in_array('JText::script(',$langStringTargets)) + if (in_array('JText::script(', $langStringTargets)) { - $scTEXT[] = ComponentbuilderHelper::getAllBetween($content, "JText::script('","'"); - $scTEXT[] = ComponentbuilderHelper::getAllBetween($content, 'JText::script("','"'); + $scTEXT[] = ComponentbuilderHelper::getAllBetween($content, "JText::script('", "'"); + $scTEXT[] = ComponentbuilderHelper::getAllBetween($content, 'JText::script("', '"'); // combine into one array $scTEXT = ComponentbuilderHelper::mergeArrays($scTEXT); // we need to add a check to insure these JavaScript lang matchup @@ -3169,15 +3166,15 @@ class Get } } // set language data - foreach($langStringTargets as $langStringTarget) + foreach ($langStringTargets as $langStringTarget) { // need some special treatment here if ($langStringTarget === 'Joomla.JText._(' || $langStringTarget === 'JText::script(') { continue; } - $langCheck[] = ComponentbuilderHelper::getAllBetween($content, $langStringTarget."'","'"); - $langCheck[] = ComponentbuilderHelper::getAllBetween($content, $langStringTarget.'"','"'); + $langCheck[] = ComponentbuilderHelper::getAllBetween($content, $langStringTarget . "'", "'"); + $langCheck[] = ComponentbuilderHelper::getAllBetween($content, $langStringTarget . '"', '"'); } $langArray = ComponentbuilderHelper::mergeArrays($langCheck); if (ComponentbuilderHelper::checkArray($langArray)) //<-- not really needed hmmm @@ -3185,21 +3182,21 @@ class Get foreach ($langArray as $string) { // this is there to insure we dont break already added Language strings - if (ComponentbuilderHelper::safeString($string,'U') === $string) + if (ComponentbuilderHelper::safeString($string, 'U') === $string) { continue; } // only load if string is not already set - $keyLang = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($string,'U'); + $keyLang = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($string, 'U'); if (!isset($this->langContent[$this->lang][$keyLang])) { $this->langContent[$this->lang][$keyLang] = trim($string); } // load the language targets - foreach($langStringTargets as $langStringTarget) + foreach ($langStringTargets as $langStringTarget) { - $langHolders[$langStringTarget."'".$string."'"] = $langStringTarget."'".$keyLang."'"; - $langHolders[$langStringTarget.'"'.$string.'"'] = $langStringTarget.'"'.$keyLang.'"'; + $langHolders[$langStringTarget . "'" . $string . "'"] = $langStringTarget . "'" . $keyLang . "'"; + $langHolders[$langStringTarget . '"' . $string . '"'] = $langStringTarget . '"' . $keyLang . '"'; } } // only continue if we have value to replace @@ -3211,7 +3208,7 @@ class Get } return $content; } - + /** * Set Data Selection of the dynamic get * @@ -3230,19 +3227,19 @@ class Get { if (ComponentbuilderHelper::checkString($string)) { - $lines = explode(PHP_EOL,$string); + $lines = explode(PHP_EOL, $string); if (ComponentbuilderHelper::checkArray($lines)) { if ('db' === $type) { - $table = '#__'.$asset; + $table = '#__' . $asset; $queryName = $asset; - $view = ''; + $view = ''; } elseif ('view' === $type) { $view = $this->getViewTableName($asset); - $table = '#__'.$this->componentCodeName.'_'.$view; + $table = '#__' . $this->componentCodeName . '_' . $view; $queryName = $view; } $gets = array(); @@ -3250,13 +3247,13 @@ class Get // first load all options foreach ($lines as $line) { - if (strpos($line,'AS') !== false) + if (strpos($line, 'AS') !== false) { - list($get,$key) = explode("AS",$line); + list($get, $key) = explode("AS", $line); } - elseif (strpos($line,'as') !== false) + elseif (strpos($line, 'as') !== false) { - list($get,$key) = explode("as",$line); + list($get, $key) = explode("as", $line); } else { @@ -3267,10 +3264,10 @@ class Get $get = trim($get); $key = trim($key); // only add the view (we must adapt this) - if (isset($this->getAsLookup[$method_key][$get]) && 'a' != $as && 1 == $row_type && 'view' === $type && strpos('#'.$key,'#'.$view.'_') === false) + if (isset($this->getAsLookup[$method_key][$get]) && 'a' != $as && 1 == $row_type && 'view' === $type && strpos('#' . $key, '#' . $view . '_') === false) { // this is a problem (TODO) since we may want to not add the view name. - $key = $view.'_'.trim($key); + $key = $view . '_' . trim($key); } // continue only if we have get if (ComponentbuilderHelper::checkString($get)) @@ -3283,21 +3280,21 @@ class Get } else { - $key = str_replace($as.'.','',$get); + $key = str_replace($as . '.', '', $get); $this->getAsLookup[$method_key][$get] = $key; $keys[] = $this->db->quote($key); } if (ComponentbuilderHelper::checkString($view)) { - $field = str_replace($as.'.','',$get); + $field = str_replace($as . '.', '', $get); $this->siteFields[$view][$field][$method_key] = array('site' => $view_code, 'get' => $get, 'as' => $as, 'key' => $key); } } } if (ComponentbuilderHelper::checkArray($gets) && ComponentbuilderHelper::checkArray($keys)) { - $querySelect = '$query->select($db->quoteName('.PHP_EOL."\t\t\t".'array('.implode(',',$gets).'),'.PHP_EOL."\t\t\t".'array('.implode(',',$keys).')));'; - $queryFrom = '$db->quoteName('.$this->db->quote($table).', '.$this->db->quote($as).')'; + $querySelect = '$query->select($db->quoteName(' . PHP_EOL . "\t\t\t" . 'array(' . implode(',', $gets) . '),' . PHP_EOL . "\t\t\t" . 'array(' . implode(',', $keys) . ')));'; + $queryFrom = '$db->quoteName(' . $this->db->quote($table) . ', ' . $this->db->quote($as) . ')'; // return the select query return array('select' => $querySelect, 'from' => $queryFrom, 'name' => $queryName, 'table' => $table, 'type' => $type, 'select_gets' => $gets, 'select_keys' => $keys); } @@ -3305,7 +3302,7 @@ class Get } return false; } - + /** * Get the View Table Name * @@ -3319,13 +3316,12 @@ class Get // Create a new query object. $query = $this->db->getQuery(true); $query->select($this->db->quoteName(array('a.name_single'))); - $query->from($this->db->quoteName('#__componentbuilder_admin_view','a')); - $query->where($this->db->quoteName('a.id') . ' = '. (int) $id); + $query->from($this->db->quoteName('#__componentbuilder_admin_view', 'a')); + $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); $this->db->setQuery($query); return ComponentbuilderHelper::safeString($this->db->loadResult()); - } - + /** * Build the SQL dump String for a view * @@ -3349,9 +3345,9 @@ class Get if ($counter === 'a') { // the main table fields - if (strpos($table['sourcemap'],PHP_EOL) !== false) + if (strpos($table['sourcemap'], PHP_EOL) !== false) { - $fields = explode(PHP_EOL,$table['sourcemap']); + $fields = explode(PHP_EOL, $table['sourcemap']); if (ComponentbuilderHelper::checkArray($fields)) { // reset array buckets @@ -3359,18 +3355,18 @@ class Get $targetArray = array(); foreach ($fields as $field) { - if (strpos($field,"=>") !== false) + if (strpos($field, "=>") !== false) { - list($source,$target) = explode("=>",$field); - $sourceArray[] = $counter.'.'.trim($source); + list($source, $target) = explode("=>", $field); + $sourceArray[] = $counter . '.' . trim($source); $targetArray[] = trim($target); } } if (ComponentbuilderHelper::checkArray($sourceArray) && ComponentbuilderHelper::checkArray($targetArray)) { // add to query - $query->select($this->db->quoteName($sourceArray,$targetArray)); - $query->from('#__'.$table['table'].' AS a'); + $query->select($this->db->quoteName($sourceArray, $targetArray)); + $query->from('#__' . $table['table'] . ' AS a'); } // we may need to filter the selection if (isset($this->sqlTweak[$view_id]['where'])) @@ -3384,9 +3380,9 @@ class Get else { // the other tables - if (strpos($table['sourcemap'],PHP_EOL) !== false) + if (strpos($table['sourcemap'], PHP_EOL) !== false) { - $fields = explode(PHP_EOL,$table['sourcemap']); + $fields = explode(PHP_EOL, $table['sourcemap']); if (ComponentbuilderHelper::checkArray($fields)) { // reset array buckets @@ -3394,23 +3390,23 @@ class Get $targetArray = array(); foreach ($fields as $field) { - if (strpos($field,"=>") !== false) + if (strpos($field, "=>") !== false) { - list($source,$target) = explode("=>",$field); - $sourceArray[] = $counter.'.'.trim($source); + list($source, $target) = explode("=>", $field); + $sourceArray[] = $counter . '.' . trim($source); $targetArray[] = trim($target); } - if (strpos($field,"==") !== false) + if (strpos($field, "==") !== false) { - list($aKey,$bKey) = explode("==",$field); + list($aKey, $bKey) = explode("==", $field); // add to query - $query->join('LEFT', $this->db->quoteName('#__'.$table['table'], $counter) . ' ON (' . $this->db->quoteName('a.'.trim($aKey)) . ' = ' . $this->db->quoteName($counter.'.'.trim($bKey)) . ')'); + $query->join('LEFT', $this->db->quoteName('#__' . $table['table'], $counter) . ' ON (' . $this->db->quoteName('a.' . trim($aKey)) . ' = ' . $this->db->quoteName($counter . '.' . trim($bKey)) . ')'); } } if (ComponentbuilderHelper::checkArray($sourceArray) && ComponentbuilderHelper::checkArray($targetArray)) { // add to query - $query->select($this->db->quoteName($sourceArray,$targetArray)); + $query->select($this->db->quoteName($sourceArray, $targetArray)); } } } @@ -3426,13 +3422,13 @@ class Get $data = $this->db->loadObjectList(); // start building the MySql dump $dump = "--"; - $dump .= PHP_EOL."-- Dumping data for table `#__[[[component]]]_".$view."`"; - $dump .= PHP_EOL."--"; - $dump .= PHP_EOL.PHP_EOL."INSERT INTO `#__[[[component]]]_".$view."` ("; + $dump .= PHP_EOL . "-- Dumping data for table `#__[[[component]]]_" . $view . "`"; + $dump .= PHP_EOL . "--"; + $dump .= PHP_EOL . PHP_EOL . "INSERT INTO `#__[[[component]]]_" . $view . "` ("; foreach ($data as $line) { $comaSet = 0; - foreach($line as $fieldName => $fieldValue) + foreach ($line as $fieldName => $fieldValue) { if ($comaSet == 0) { @@ -3440,7 +3436,7 @@ class Get } else { - $dump .= ", ".$this->db->quoteName($fieldName); + $dump .= ", " . $this->db->quoteName($fieldName); } $comaSet++; } @@ -3452,14 +3448,14 @@ class Get { if ($coma == 0) { - $dump .= PHP_EOL."("; + $dump .= PHP_EOL . "("; } else { - $dump .= ",".PHP_EOL."("; + $dump .= "," . PHP_EOL . "("; } $comaSet = 0; - foreach($line as $fieldName => $fieldValue) + foreach ($line as $fieldName => $fieldValue) { if ($comaSet == 0) { @@ -3467,7 +3463,7 @@ class Get } else { - $dump .= ", ". $this->mysql_escape($fieldValue); + $dump .= ", " . $this->mysql_escape($fieldValue); } $comaSet++; } @@ -3481,7 +3477,7 @@ class Get } return false; } - + /** * Escape the values for a SQL dump * @@ -3493,24 +3489,24 @@ class Get public function mysql_escape($value) { // if array then return maped - if(ComponentbuilderHelper::checkArray($value)) + if (ComponentbuilderHelper::checkArray($value)) { return array_map(__METHOD__, $value); } // if string make sure it is correctly escaped - if(ComponentbuilderHelper::checkString($value) && !is_numeric($value)) + if (ComponentbuilderHelper::checkString($value) && !is_numeric($value)) { return $this->db->quote($value); } // if empty value return place holder - if(empty($value)) + if (empty($value)) { return "''"; } // if not array or string then return number return $value; } - + /** * Creating an uniqueCode * @@ -3521,15 +3517,15 @@ class Get */ public function uniqueCode($code) { - if (!isset($this->uniquecodes[$this->target]) || !in_array($code,$this->uniquecodes[$this->target])) + if (!isset($this->uniquecodes[$this->target]) || !in_array($code, $this->uniquecodes[$this->target])) { $this->uniquecodes[$this->target][] = $code; return $code; } // make sure it is unique - return $this->uniqueCode($code.$this->uniquekey(1)); + return $this->uniqueCode($code . $this->uniquekey(1)); } - + /** * Creating an unique local key * @@ -3563,7 +3559,7 @@ class Get $this->uniquekeys[] = $key; return $key; } - + /** * Check for footable scripts * @@ -3574,13 +3570,13 @@ class Get */ public function getFootableScripts($content) { - if (strpos($content,'footable') !== false) + if (strpos($content, 'footable') !== false) { return true; } return false; } - + /** * Check for getModules script * @@ -3591,13 +3587,13 @@ class Get */ public function getGetModule($content) { - if (strpos($content,'this->getModules(') !== false) + if (strpos($content, 'this->getModules(') !== false) { return true; } return false; } - + /** * Check for get Google Chart script * @@ -3608,13 +3604,13 @@ class Get */ public function getGoogleChart($content) { - if (strpos($content,'Chartbuilder(') !== false) + if (strpos($content, 'Chartbuilder(') !== false) { return true; } return false; } - + /** * Set the dynamic values in strings here * @@ -3631,7 +3627,7 @@ class Get } return $string; } - + /** * We start set the custom code data & can load it in to string * @@ -3647,11 +3643,11 @@ class Get // insure the code is loaded $loaded = false; // check if content has custom code place holder - if (strpos($string, '[CUSTO'.'MCODE=') !== false) + if (strpos($string, '[CUSTO' . 'MCODE=') !== false) { // the ids found in this content $bucket = array(); - $found = ComponentbuilderHelper::getAllBetween($string, '[CUSTO'.'MCODE=', ']'); + $found = ComponentbuilderHelper::getAllBetween($string, '[CUSTO' . 'MCODE=', ']'); if (ComponentbuilderHelper::checkArray($found)) { foreach ($found as $key) @@ -3711,7 +3707,7 @@ class Get { if (strpos($array[1], ',') !== false) { - $this->customCodeData[$id]['args'][$key] = explode(',', $array[1]); + $this->customCodeData[$id]['args'][$key] = explode(',', $array[1]); } elseif (ComponentbuilderHelper::checkString($array[1])) { @@ -3719,7 +3715,7 @@ class Get $this->customCodeData[$id]['args'][$key][] = $array[1]; } } - } + } } else { @@ -3747,7 +3743,7 @@ class Get } return $string; } - + /** * Insert the custom code into the string * @@ -3759,14 +3755,14 @@ class Get protected function insertCustomCode($string) { $code = array(); - foreach($this->customCode as $item) + foreach ($this->customCode as $item) { $this->buildCustomCodePlaceholders($item, $code); } // now update the string return $this->setPlaceholders($string, $code); } - + /** * Insert the custom code into the string * @@ -3774,7 +3770,7 @@ class Get * * @return string on success * - */ + */ protected function buildCustomCodePlaceholders($item, &$code) { // check if there is args for this code @@ -3786,7 +3782,7 @@ class Get foreach ($this->customCodeData[$item['id']]['args'] as $key => $args) { $this->setThesePlaceHolders('arg', $args); - $code['[CUSTOM'.'CODE='.$key.']'] = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($item['code'], $this->placeholders). $placeholder['end']; + $code['[CUSTOM' . 'CODE=' . $key . ']'] = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($item['code'], $this->placeholders) . $placeholder['end']; } // always clear the args $this->clearFromPlaceHolders('arg'); @@ -3798,7 +3794,7 @@ class Get $keyPlaceholder = $item['id']; } // check what type of place holders we should load here - $placeholderType = (int) $item['comment_type'].'2'; + $placeholderType = (int) $item['comment_type'] . '2'; if (stripos($item['code'], '[[[view') !== false || stripos($item['code'], '[[[sview') !== false || stripos($item['code'], '[[[arg') !== false) { // if view is being set dynamicly then we can't update this code via IDE (TODO) @@ -3807,11 +3803,11 @@ class Get // if now ars were found, clear it $this->clearFromPlaceHolders('arg'); // load args for this code - $placeholder = $this->getPlaceHolder($placeholderType, $item['id']); - $code['[CUSTOM'.'CODE='.$keyPlaceholder.']'] = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($item['code'], $this->placeholders). $placeholder['end']; + $placeholder = $this->getPlaceHolder($placeholderType, $item['id']); + $code['[CUSTOM' . 'CODE=' . $keyPlaceholder . ']'] = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($item['code'], $this->placeholders) . $placeholder['end']; } } - + /** * Set a type of placeholder with set of values * @@ -3829,12 +3825,12 @@ class Get $number = 0; foreach ($values as $value) { - $this->placeholders['[[['.$key.$number.']]]'] = $value; + $this->placeholders['[[[' . $key . $number . ']]]'] = $value; $number++; } } } - + /** * Remove a type of placeholder by main string * @@ -3852,7 +3848,7 @@ class Get } } } - + /** * to unset stuff that are private or protected * @@ -3861,7 +3857,7 @@ class Get { unset($this->$remove); } - + /** * Get the other languages * @@ -3875,11 +3871,14 @@ class Get { // Create a new query object. $query = $this->db->getQuery(true); - $query->from($this->db->quoteName('#__componentbuilder_language_translation','a')); + $query->from($this->db->quoteName('#__componentbuilder_language_translation', 'a')); if (ComponentbuilderHelper::checkArray($values)) { - $query->select($this->db->quoteName(array('a.id','a.translation','a.entranslation','a.components','a.published'))); - $query->where($this->db->quoteName('a.entranslation') . ' IN (' . implode(',',array_map(function($a){ return $this->db->quote($a); }, $values)) . ')'); + $query->select($this->db->quoteName(array('a.id', 'a.translation', 'a.entranslation', 'a.components', 'a.published'))); + $query->where($this->db->quoteName('a.entranslation') . ' IN (' . implode(',', array_map(function($a) + { + return $this->db->quote($a); + }, $values)) . ')'); $this->db->setQuery($query); $this->db->execute(); if ($this->db->getNumRows()) @@ -3889,7 +3888,7 @@ class Get } return false; } - + /** * Set the Current language values to DB * @@ -3917,8 +3916,7 @@ class Get $this->multiLangString[$string]['translation'] = json_decode($this->multiLangString[$string]['translation'], true); } // if we have an array continue - if (isset($this->multiLangString[$string]['translation']) - && ComponentbuilderHelper::checkArray($this->multiLangString[$string]['translation'])) + if (isset($this->multiLangString[$string]['translation']) && ComponentbuilderHelper::checkArray($this->multiLangString[$string]['translation'])) { // great lets build the multi languages strings foreach ($this->multiLangString[$string]['translation'] as $translations) @@ -3945,7 +3943,7 @@ class Get } } // do the database managment - if(ComponentbuilderHelper::checkString($string) && ($key = array_search($string, $strings)) !== false) + if (ComponentbuilderHelper::checkString($string) && ($key = array_search($string, $strings)) !== false) { if (isset($this->multiLangString[$string])) { @@ -3988,14 +3986,14 @@ class Get else { // add the new lang placeholder to the db - $this->newLangStrings[$counterInsert] = array(); - $this->newLangStrings[$counterInsert][] = $this->db->quote(json_encode(array($this->componentID))); // 'components' - $this->newLangStrings[$counterInsert][] = $this->db->quote($string); // 'entranslation' - $this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'published' - $this->newLangStrings[$counterInsert][] = $this->db->quote($today); // 'created' - $this->newLangStrings[$counterInsert][] = $this->db->quote((int) $this->user->id); // 'created_by' - $this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'version' - $this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'access' + $this->newLangStrings[$counterInsert] = array(); + $this->newLangStrings[$counterInsert][] = $this->db->quote(json_encode(array($this->componentID))); // 'components' + $this->newLangStrings[$counterInsert][] = $this->db->quote($string); // 'entranslation' + $this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'published' + $this->newLangStrings[$counterInsert][] = $this->db->quote($today); // 'created' + $this->newLangStrings[$counterInsert][] = $this->db->quote((int) $this->user->id); // 'created_by' + $this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'version' + $this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'access' $counterInsert++; @@ -4011,7 +4009,7 @@ class Get $this->setExistingLangStrings(); $this->setNewLangStrings(); } - + /** * store the language placeholders * @@ -4028,11 +4026,11 @@ class Get $query = $this->db->getQuery(true); $continue = false; // Insert columns. - $columns = array('components','entranslation','published','created','created_by','version','access'); + $columns = array('components', 'entranslation', 'published', 'created', 'created_by', 'version', 'access'); // Prepare the insert query. $query->insert($this->db->quoteName('#__componentbuilder_language_translation')); $query->columns($this->db->quoteName($columns)); - foreach($this->newLangStrings as $values) + foreach ($this->newLangStrings as $values) { if (count($values) == 7) { @@ -4054,8 +4052,8 @@ class Get $this->db->setQuery($query); $this->db->execute(); } - } - + } + /** * update the language placeholders * @@ -4068,7 +4066,7 @@ class Get { if (count($this->existingLangStrings) >= $when) { - foreach($this->existingLangStrings as $values) + foreach ($this->existingLangStrings as $values) { // Create a new query object. $query = $this->db->getQuery(true); @@ -4079,10 +4077,10 @@ class Get $this->db->execute(); } // clear the values array - $this->existingLangStrings = array(); + $this->existingLangStrings = array(); } - } - + } + /** * Remove exiting language translation stings * @@ -4095,10 +4093,10 @@ class Get { // Create a new query object. $query = $this->db->getQuery(true); - + // delete all custom keys for user 1001. $conditions = array( - $this->db->quoteName('id') . ' = ' . (int) $id + $this->db->quoteName('id') . ' = ' . (int) $id ); $query->delete($this->db->quoteName('#__componentbuilder_language_translation')); @@ -4107,7 +4105,7 @@ class Get $this->db->setQuery($query); $this->db->execute(); } - + /** * Function to purge the unused languge strings * @@ -4120,10 +4118,13 @@ class Get { // Create a new query object. $query = $this->db->getQuery(true); - $query->from($this->db->quoteName('#__componentbuilder_language_translation','a')); - $query->select($this->db->quoteName(array('a.id','a.translation','a.components'))); + $query->from($this->db->quoteName('#__componentbuilder_language_translation', 'a')); + $query->select($this->db->quoteName(array('a.id', 'a.translation', 'a.components'))); // get all string that are not linked to this component - $query->where($this->db->quoteName('a.entranslation') . ' NOT IN (' . implode(',',array_map(function($a){ return $this->db->quote($a); }, $values)) . ')'); + $query->where($this->db->quoteName('a.entranslation') . ' NOT IN (' . implode(',', array_map(function($a) + { + return $this->db->quote($a); + }, $values)) . ')'); $query->where($this->db->quoteName('a.published') . ' = 1'); $this->db->setQuery($query); $this->db->execute(); @@ -4185,7 +4186,7 @@ class Get $this->setExistingLangStrings(); } } - + /** * just to add lang string to the existing Lang Strings array * @@ -4195,17 +4196,17 @@ class Get protected function setUpdateExistingLangStrings($id, $components, $published, $today, $counterUpdate) { // start the bucket for this lang - $this->existingLangStrings[$counterUpdate] = array(); - $this->existingLangStrings[$counterUpdate]['id'] = (int) $id; - $this->existingLangStrings[$counterUpdate]['conditions'] = array(); - $this->existingLangStrings[$counterUpdate]['conditions'][] = $this->db->quoteName('id') . ' = ' . $this->db->quote($id); - $this->existingLangStrings[$counterUpdate]['fields'] = array(); - $this->existingLangStrings[$counterUpdate]['fields'][] = $this->db->quoteName('components') . ' = ' . $this->db->quote(json_encode($components)); - $this->existingLangStrings[$counterUpdate]['fields'][] = $this->db->quoteName('published') . ' = ' . $this->db->quote($published); - $this->existingLangStrings[$counterUpdate]['fields'][] = $this->db->quoteName('modified') . ' = ' . $this->db->quote($today); - $this->existingLangStrings[$counterUpdate]['fields'][] = $this->db->quoteName('modified_by') . ' = ' . $this->db->quote((int) $this->user->id); + $this->existingLangStrings[$counterUpdate] = array(); + $this->existingLangStrings[$counterUpdate]['id'] = (int) $id; + $this->existingLangStrings[$counterUpdate]['conditions'] = array(); + $this->existingLangStrings[$counterUpdate]['conditions'][] = $this->db->quoteName('id') . ' = ' . $this->db->quote($id); + $this->existingLangStrings[$counterUpdate]['fields'] = array(); + $this->existingLangStrings[$counterUpdate]['fields'][] = $this->db->quoteName('components') . ' = ' . $this->db->quote(json_encode($components)); + $this->existingLangStrings[$counterUpdate]['fields'][] = $this->db->quoteName('published') . ' = ' . $this->db->quote($published); + $this->existingLangStrings[$counterUpdate]['fields'][] = $this->db->quoteName('modified') . ' = ' . $this->db->quote($today); + $this->existingLangStrings[$counterUpdate]['fields'][] = $this->db->quoteName('modified_by') . ' = ' . $this->db->quote((int) $this->user->id); } - + /** * get the custom code from the system * @@ -4218,13 +4219,13 @@ class Get $loadInMemory = false; // Create a new query object. $query = $this->db->getQuery(true); - $query->from($this->db->quoteName('#__componentbuilder_custom_code','a')); + $query->from($this->db->quoteName('#__componentbuilder_custom_code', 'a')); if (ComponentbuilderHelper::checkArray($ids)) { if ($idArray = $this->customCodeMemory($ids)) { - $query->select($this->db->quoteName(array('a.id','a.code','a.comment_type'))); - $query->where($this->db->quoteName('a.id') . ' IN (' . implode(',',$idArray) . ')'); + $query->select($this->db->quoteName(array('a.id', 'a.code', 'a.comment_type'))); + $query->where($this->db->quoteName('a.id') . ' IN (' . implode(',', $idArray) . ')'); $query->where($this->db->quoteName('a.target') . ' = 2'); // <--- to load the correct target $loadInMemory = true; } @@ -4236,8 +4237,8 @@ class Get } else { - $query->select($this->db->quoteName(array('a.id','a.code','a.comment_type','a.component','a.from_line','a.hashtarget','a.hashendtarget','a.path','a.to_line','a.type'))); - $query->where($this->db->quoteName('a.component') . ' = '. (int) $this->componentData->id); + $query->select($this->db->quoteName(array('a.id', 'a.code', 'a.comment_type', 'a.component', 'a.from_line', 'a.hashtarget', 'a.hashendtarget', 'a.path', 'a.to_line', 'a.type'))); + $query->where($this->db->quoteName('a.component') . ' = ' . (int) $this->componentData->id); $query->where($this->db->quoteName('a.target') . ' = 1'); // <--- to load the correct target $query->order($this->db->quoteName('a.from_line') . ' ASC'); // <--- insrue we always add code from top of file // reset custom code @@ -4250,7 +4251,7 @@ class Get { $bucket = $this->db->loadAssocList('id'); // open the code - foreach($bucket as $nr => &$customCode) + foreach ($bucket as $nr => &$customCode) { $customCode['code'] = base64_decode($customCode['code']); if ($setLang) @@ -4276,7 +4277,7 @@ class Get } return false; } - + /** * check if we already have these ids in local memory * @@ -4302,7 +4303,7 @@ class Get } return false; } - + /** * store the code * @@ -4319,11 +4320,11 @@ class Get $query = $this->db->getQuery(true); $continue = false; // Insert columns. - $columns = array('path','type','target','comment_type','component','published','created','created_by','version','access','hashtarget','from_line','to_line','code','hashendtarget'); + $columns = array('path', 'type', 'target', 'comment_type', 'component', 'published', 'created', 'created_by', 'version', 'access', 'hashtarget', 'from_line', 'to_line', 'code', 'hashendtarget'); // Prepare the insert query. $query->insert($this->db->quoteName('#__componentbuilder_custom_code')); $query->columns($this->db->quoteName($columns)); - foreach($this->newCustomCode as $values) + foreach ($this->newCustomCode as $values) { if (count($values) == 15) { @@ -4346,7 +4347,7 @@ class Get $this->db->execute(); } } - + /** * store the code * @@ -4359,7 +4360,7 @@ class Get { if (count($this->existingCustomCode) >= $when) { - foreach($this->existingCustomCode as $code) + foreach ($this->existingCustomCode as $code) { // Create a new query object. $query = $this->db->getQuery(true); @@ -4370,10 +4371,10 @@ class Get $this->db->execute(); } // clear the values array - $this->existingCustomCode = array(); + $this->existingCustomCode = array(); } } - + /** * get the custom code from the local files * @@ -4389,12 +4390,12 @@ class Get $joomla = getcwd(); $counter = array(1 => 0, 2 => 0); // file types to get - $fileTypes = array('\.php', '\.js'); + $fileTypes = array('\.php', '\.js'); // set some local placeholders $placeholders = array(); - $placeholders[ComponentbuilderHelper::safeString($this->componentCodeName, 'F').'Helper::'] = '[[[Component]]]Helper::'; - $placeholders['COM_'.ComponentbuilderHelper::safeString($this->componentCodeName, 'U')] = 'COM_[[[COMPONENT]]]'; - $placeholders['com_'.$this->componentCodeName] = 'com_[[[component]]]'; + $placeholders[ComponentbuilderHelper::safeString($this->componentCodeName, 'F') . 'Helper::'] = '[[[Component]]]Helper::'; + $placeholders['COM_' . ComponentbuilderHelper::safeString($this->componentCodeName, 'U')] = 'COM_[[[COMPONENT]]]'; + $placeholders['com_' . $this->componentCodeName] = 'com_[[[component]]]'; foreach ($paths as $target => $path) { // we are changing the working directory to the componet path @@ -4432,7 +4433,7 @@ class Get $this->setExistingCustomCode(); } } - + /** * search a file for placeholders and store result * @@ -4448,26 +4449,26 @@ class Get protected function searchFileContent(&$counter, &$file, &$target, &$searchArray, &$placeholders, &$today) { // reset each time per file - $loadEndFingerPrint = false; - $endFingerPrint = array(); - $fingerPrint = array(); - $codeBucket = array(); - $pointer = array(); - $reading = array(); - $reader = 0; + $loadEndFingerPrint = false; + $endFingerPrint = array(); + $fingerPrint = array(); + $codeBucket = array(); + $pointer = array(); + $reading = array(); + $reader = 0; // reset found Start type - $commentType = 0; + $commentType = 0; // make sure we have the path correct (the script file is not in admin path for example) // there may be more... will nead to keep our eye on this... since files could be moved during install $file = str_replace('./', '', $file); if ($file !== 'script.php') { - $path = $target . '/' . $file; + $path = $target . '/' . $file; } else { - $path = $file; - } + $path = $file; + } foreach (new SplFileObject($file) as $lineNumber => $lineContent) { // we musk keep last few lines to dynamic find target entry later @@ -4479,18 +4480,18 @@ class Get } foreach ($searchArray as $type => $search) { - $i = (int) ($type == 3 ||$type == 4) ? 2 : 1; - $_type = (int) ($type == 1 || $type == 3) ? 1 : 2; + $i = (int) ($type == 3 || $type == 4) ? 2 : 1; + $_type = (int) ($type == 1 || $type == 3) ? 1 : 2; if ($reader === 0 || $reader === $i) { - $targetKey = $type; - $start = '/***['.$search.'***/'; - $end = '/***[/'.$search.'***/'; - $startHTML = ''; - $endHTML = ''; + $targetKey = $type; + $start = '/***[' . $search . '***/'; + $end = '/***[/' . $search . '***/'; + $startHTML = ''; + $endHTML = ''; // check if the ending place holder was found - if(isset($reading[$targetKey]) && $reading[$targetKey] && - ((trim($lineContent) === $end || strpos($lineContent, $end) !== false) || + if (isset($reading[$targetKey]) && $reading[$targetKey] && + ((trim($lineContent) === $end || strpos($lineContent, $end) !== false) || (trim($lineContent) === $endHTML || strpos($lineContent, $endHTML) !== false))) { // trim the placeholder and if there is still data then load it @@ -4499,31 +4500,31 @@ class Get $codeBucket[$pointer[$targetKey]][] = $_line; } // deactivate the reader - $reading[$targetKey] = false; + $reading[$targetKey] = false; if ($_type == 2) { // deactivate search - $reader = 0; + $reader = 0; } else { // activate fingerPrint for replacement end target - $loadEndFingerPrint = true; - $backupTargetKey = $targetKey; - $backupI = $i; + $loadEndFingerPrint = true; + $backupTargetKey = $targetKey; + $backupI = $i; } // all new records we can do a bulk insert if ($i === 1) { // end the bucket info for this code block - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote((int) $lineNumber); // 'toline' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote((int) $lineNumber); // 'toline' // first reverse engineer this code block $c0de = $this->reversePlaceholders(implode('', $codeBucket[$pointer[$targetKey]]), $placeholders); - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(base64_encode($c0de)); // 'code' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(base64_encode($c0de)); // 'code' if ($_type == 2) { // load the last value - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(0); // 'hashendtarget' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(0); // 'hashendtarget' } } // the record already exist so we must update instead @@ -4544,12 +4545,12 @@ class Get // check if the endfingerprint is ready to save if (count($endFingerPrint) === 3) { - $hashendtarget = '3__'.md5(implode('',$endFingerPrint)); + $hashendtarget = '3__' . md5(implode('', $endFingerPrint)); // all new records we can do a bulk insert if ($i === 1) { // load the last value - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote($hashendtarget); // 'hashendtarget' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote($hashendtarget); // 'hashendtarget' } // the record already exist so we must use module to update elseif ($i === 2) @@ -4557,10 +4558,10 @@ class Get $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('hashendtarget') . ' = ' . $this->db->quote($hashendtarget); } // reset the needed values - $endFingerPrint = array(); - $loadEndFingerPrint = false; + $endFingerPrint = array(); + $loadEndFingerPrint = false; // deactivate reader (to allow other search) - $reader = 0; + $reader = 0; } // then read in the code if (isset($reading[$targetKey]) && $reading[$targetKey]) @@ -4570,20 +4571,20 @@ class Get // see if the custom code line starts now with PHP/JS comment type if ((!isset($reading[$targetKey]) || !$reading[$targetKey]) && (($i === 1 && trim($lineContent) === $start) || strpos($lineContent, $start) !== false)) { - $commentType = 1; // PHP/JS type - $startReplace = $start; - $endReplace = $end; + $commentType = 1; // PHP/JS type + $startReplace = $start; + $endReplace = $end; } // see if the custom code line starts now with HTML comment type elseif ((!isset($reading[$targetKey]) || !$reading[$targetKey]) && (($i === 1 && trim($lineContent) === $startHTML) || strpos($lineContent, $startHTML) !== false)) { - $commentType = 2; // HTML type - $startReplace = $startHTML; - $endReplace = $endHTML; + $commentType = 2; // HTML type + $startReplace = $startHTML; + $endReplace = $endHTML; } // check if the starting place holder was found - if($commentType > 0) - { + if ($commentType > 0) + { // if we have all on one line we have a problem (don't load it TODO) if (strpos($lineContent, $endReplace) !== false) { @@ -4612,71 +4613,70 @@ class Get // start replace $startReplace = $this->setStartReplace($id, $commentType, $startReplace); // set active reader (to lock out other search) - $reader = $i; + $reader = $i; // set pointer - $pointer[$targetKey] = $counter[$i]; + $pointer[$targetKey] = $counter[$i]; // activate the reader - $reading[$targetKey] = true; + $reading[$targetKey] = true; // start code bucket - $codeBucket[$pointer[$targetKey]] = array(); + $codeBucket[$pointer[$targetKey]] = array(); // trim the placeholder and if there is still data then load it if ($_line = $this->addLineChecker($startReplace, 1, $lineContent)) { $codeBucket[$pointer[$targetKey]][] = $_line; } // get the finger print around the custom code - $inFinger = count($fingerPrint); - $getFinger = $inFinger - 1; - $hasharray = array_slice($fingerPrint, -$inFinger, $getFinger, true); - $hasleng = count($hasharray); - $hashtarget = $hasleng.'__'.md5(implode('',$hasharray)); + $inFinger = count($fingerPrint); + $getFinger = $inFinger - 1; + $hasharray = array_slice($fingerPrint, -$inFinger, $getFinger, true); + $hasleng = count($hasharray); + $hashtarget = $hasleng . '__' . md5(implode('', $hasharray)); // all new records we can do a buldk insert if ($i === 1 || !$id) { // start the bucket for this code - $this->newCustomCode[$pointer[$targetKey]] = array(); - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote($path); // 'path' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote((int) $_type); // 'type' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'target' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote($commentType); // 'comment_type' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote((int) $this->componentID); // 'component' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'published' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote($today); // 'created' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote((int) $this->user->id); // 'created_by' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'version' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'access' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote($hashtarget); // 'hashtarget' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote((int) $lineNumber); // 'fromline' + $this->newCustomCode[$pointer[$targetKey]] = array(); + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote($path); // 'path' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote((int) $_type); // 'type' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'target' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote($commentType); // 'comment_type' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote((int) $this->componentID); // 'component' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'published' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote($today); // 'created' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote((int) $this->user->id); // 'created_by' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'version' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'access' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote($hashtarget); // 'hashtarget' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote((int) $lineNumber); // 'fromline' } // the record already exist so we must update instead elseif ($i === 2 && $id > 0) { // start the bucket for this code - $this->existingCustomCode[$pointer[$targetKey]] = array(); - $this->existingCustomCode[$pointer[$targetKey]]['id'] = (int) $id; - $this->existingCustomCode[$pointer[$targetKey]]['conditions'] = array(); - $this->existingCustomCode[$pointer[$targetKey]]['conditions'][] = $this->db->quoteName('id') . ' = ' . $this->db->quote($id); - $this->existingCustomCode[$pointer[$targetKey]]['fields'] = array(); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('path') . ' = ' . $this->db->quote($path); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('type') . ' = ' . $this->db->quote($_type); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('comment_type') . ' = ' . $this->db->quote($commentType); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('component') . ' = ' . $this->db->quote($this->componentID); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('from_line') . ' = ' . $this->db->quote($lineNumber); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('modified') . ' = ' . $this->db->quote($today); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('modified_by') . ' = ' . $this->db->quote($this->user->id); - $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('hashtarget') . ' = ' . $this->db->quote($hashtarget); + $this->existingCustomCode[$pointer[$targetKey]] = array(); + $this->existingCustomCode[$pointer[$targetKey]]['id'] = (int) $id; + $this->existingCustomCode[$pointer[$targetKey]]['conditions'] = array(); + $this->existingCustomCode[$pointer[$targetKey]]['conditions'][] = $this->db->quoteName('id') . ' = ' . $this->db->quote($id); + $this->existingCustomCode[$pointer[$targetKey]]['fields'] = array(); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('path') . ' = ' . $this->db->quote($path); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('type') . ' = ' . $this->db->quote($_type); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('comment_type') . ' = ' . $this->db->quote($commentType); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('component') . ' = ' . $this->db->quote($this->componentID); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('from_line') . ' = ' . $this->db->quote($lineNumber); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('modified') . ' = ' . $this->db->quote($today); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('modified_by') . ' = ' . $this->db->quote($this->user->id); + $this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $this->db->quoteName('hashtarget') . ' = ' . $this->db->quote($hashtarget); } else // this should actualy never happen { // de activate the reader - $reading[$targetKey] = false; - $reader = 0; - + $reading[$targetKey] = false; + $reader = 0; } // reset found comment type $commentType = 0; // update the counter - $counter[$i]++; + $counter[$i] ++; } } } @@ -4692,7 +4692,7 @@ class Get if (count($endFingerPrint) > 0) { $leng = count($endFingerPrint); - $hashendtarget = $leng . '__' . md5(implode('',$endFingerPrint)); + $hashendtarget = $leng . '__' . md5(implode('', $endFingerPrint)); } else { @@ -4702,7 +4702,7 @@ class Get if ($backupI === 1) { // load the last value - $this->newCustomCode[$pointer[$backupTargetKey]][] = $this->db->quote($hashendtarget); // 'hashendtarget' + $this->newCustomCode[$pointer[$backupTargetKey]][] = $this->db->quote($hashendtarget); // 'hashendtarget' } // the record already exist so we must use module to update elseif ($backupI === 2) @@ -4711,7 +4711,7 @@ class Get } } } - + /** * Check if this line should be added * @@ -4725,7 +4725,7 @@ class Get protected function addLineChecker($replaceKey, $type, $lineContent) { $check = explode($replaceKey, $lineContent); - switch($type) + switch ($type) { case 1: // beginning of code @@ -4734,7 +4734,7 @@ class Get { return $check[1]; } - break; + break; case 2: // end of code $i = trim($check[0]); @@ -4742,11 +4742,11 @@ class Get { return $check[0]; } - break; + break; } return false; } - + /** * search for the system id in the line given * @@ -4761,19 +4761,19 @@ class Get { if ($id > 0) { - switch($commentType) + switch ($commentType) { case 1: // the PHP & JS type - $startReplace .= '/*'.$id.'*/'; - break; + $startReplace .= '/*' . $id . '*/'; + break; case 2: // the HTML type - $startReplace .= ''; - break; + $startReplace .= ''; + break; } } return $startReplace; } - + /** * search for the system id in the line given * @@ -4791,7 +4791,7 @@ class Get $trim = '', - 'end' => ''); + 'start' => '', + 'end' => ''); } else { return array( - 'start' => "\t\t\t", + 'start' => "\t\t\t", 'end' => "\t\t\t"); } break; @@ -5016,25 +5016,25 @@ class Get if ($this->addPlaceholders === true) { return array( - 'start' => '', - 'end' => ''); + 'start' => '', + 'end' => ''); } else { return array( - 'start' => "\t\t\t", + 'start' => "\t\t\t", 'end' => "\t\t\t"); } break; case 3: return array( - 'start' => "\t\t\t", - 'end' => "\t\t\t"); + 'start' => "\t\t\t", + 'end' => "\t\t\t"); break; } return false; } - + /** * get the local installed path of this component * @@ -5046,11 +5046,11 @@ class Get // set the local paths to search $localPaths = array(); // admin path - $localPaths['admin'] = JPATH_ADMINISTRATOR . '/components/com_'. $this->componentCodeName; + $localPaths['admin'] = JPATH_ADMINISTRATOR . '/components/com_' . $this->componentCodeName; // site path - $localPaths['site'] = JPATH_ROOT . '/components/com_'. $this->componentCodeName; + $localPaths['site'] = JPATH_ROOT . '/components/com_' . $this->componentCodeName; // TODO later to include the JS and CSS - $localPaths['media'] = JPATH_ROOT . '/media/com_'. $this->componentCodeName; + $localPaths['media'] = JPATH_ROOT . '/media/com_' . $this->componentCodeName; // check if the local install is found foreach ($localPaths as $key => $localPath) { @@ -5065,4 +5065,5 @@ class Get } return false; } + } diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index aaa5207df..1b0971dc1 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -1,27 +1,28 @@ - @my wife Roline van der Merwe - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Builds Complex Joomla Components - -/-----------------------------------------------------------------------------------------------------------------------------*/ +/* --------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| + /-------------------------------------------------------------------------------------------------------------------------------/ + + @version 2.6.x + @created 30th April, 2015 + @package Component Builder + @subpackage compiler.php + @author Llewellyn van der Merwe + @my wife Roline van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + + /----------------------------------------------------------------------------------------------------------------------------- */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); @@ -30,291 +31,292 @@ defined('_JEXEC') or die('Restricted access'); * Structure class */ class Structure extends Get -{ +{ + /** * The foulder counter * * @var int */ public $folderCount = 0; - + /** * The foulder counter * * @var int */ public $fileCount = 0; - + /** * The page counter * * @var int */ public $pageCount = 0; - + /** * The line counter * * @var int */ public $lineCount = 0; - + /** * The field counter * * @var int */ public $fieldCount = 0; - + /** * The seconds counter * * @var int */ public $seconds = 0; - + /** * The actual seconds counter * * @var int */ public $actualSeconds = 0; - + /** * The folder seconds counter * * @var int */ public $folderSeconds = 0; - + /** * The file seconds counter * * @var int */ public $fileSeconds = 0; - + /** * The line seconds counter * * @var int */ public $lineSeconds = 0; - + /** * The seconds debugging counter * * @var int */ public $secondsDebugging = 0; - + /** * The seconds planning counter * * @var int */ public $secondsPlanning = 0; - + /** * The seconds mapping counter * * @var int */ public $secondsMapping = 0; - + /** * The seconds office counter * * @var int */ public $secondsOffice = 0; - + /** * The total hours counter * * @var int */ public $totalHours = 0; - + /** * The debugging hours counter * * @var int */ public $debuggingHours = 0; - + /** * The planning hours counter * * @var int */ public $planningHours = 0; - + /** * The mapping hours counter * * @var int */ public $mappingHours = 0; - + /** * The office hours counter * * @var int */ public $officeHours = 0; - + /** * The actual Total Hours counter * * @var int */ public $actualTotalHours = 0; - + /** * The actual hours spent counter * * @var int */ public $actualHoursSpent = 0; - + /** * The actual days spent counter * * @var int */ public $actualDaysSpent = 0; - + /** * The total days counter * * @var int */ public $totalDays = 0; - + /** * The actual Total Days counter * * @var int */ public $actualTotalDays = 0; - + /** * The project week time counter * * @var int */ public $projectWeekTime = 0; - + /** * The project month time counter * * @var int */ public $projectMonthTime = 0; - + /** * The Joomla Version * * @var string */ public $joomlaVersion; - + /** * The template path * * @var string */ public $templatePath; - + /** * The custom template path * * @var string */ public $templatePathCustom; - + /** * The Joomla Version Data * * @var object */ public $joomlaVersionData; - + /** * Static File Content * * @var array */ public $fileContentStatic = array(); - + /** * Dynamic File Content * * @var array */ public $fileContentDynamic = array(); - + /** * The Component Sales name * * @var string */ public $componentSalesName; - + /** * The Component Backup name * * @var string */ public $componentBackupName; - + /** * The Component Folder name * * @var string */ public $componentFolderName; - + /** * The Component path * * @var string */ public $componentPath; - + /** * The not new static items * * @var array */ public $notNew = array(); - + /** * The new files * * @var array */ public $newFiles = array(); - + /** * The Checkin Switch * * @var boolean */ public $addCheckin = false; - + /** * The array of last modified dates * * @var array */ protected $lastModifiedDate = array(); - + /** * Constructor */ - public function __construct($config = array ()) + public function __construct($config = array()) { // first we run the perent constructor if (parent::__construct($config)) @@ -322,24 +324,24 @@ class Structure extends Get // run global updater ComponentbuilderHelper::runGlobalUpdater(); // set the Joomla version - $this->joomlaVersion = $config['joomlaVersion']; + $this->joomlaVersion = $config['joomlaVersion']; // set the template path - $this->templatePath = $this->compilerPath.'/joomla_'.$config['joomlaVersion']; + $this->templatePath = $this->compilerPath . '/joomla_' . $config['joomlaVersion']; // set some default names - $this->componentSalesName = 'com_'.$this->componentData->sales_name.'__J'.$this->joomlaVersion; - $this->componentBackupName = 'com_'.$this->componentData->sales_name.'_v'.str_replace('.','_',$this->componentData->component_version).'__J'.$this->joomlaVersion; - $this->componentFolderName = 'com_'.$this->componentData->name_code.'_v'.str_replace('.','_',$this->componentData->component_version).'__J'.$this->joomlaVersion; - + $this->componentSalesName = 'com_' . $this->componentData->sales_name . '__J' . $this->joomlaVersion; + $this->componentBackupName = 'com_' . $this->componentData->sales_name . '_v' . str_replace('.', '_', $this->componentData->component_version) . '__J' . $this->joomlaVersion; + $this->componentFolderName = 'com_' . $this->componentData->name_code . '_v' . str_replace('.', '_', $this->componentData->component_version) . '__J' . $this->joomlaVersion; + // set component folder path - $this->componentPath = $this->compilerPath.'/'.$this->componentFolderName; + $this->componentPath = $this->compilerPath . '/' . $this->componentFolderName; // set the template path for custom - $this->templatePathCustom = $this->params->get('custom_folder_path', JPATH_COMPONENT_ADMINISTRATOR.'/custom'); + $this->templatePathCustom = $this->params->get('custom_folder_path', JPATH_COMPONENT_ADMINISTRATOR . '/custom'); // make sure there is no old build $this->removeFolder($this->componentPath); // load the libraries files/folders and url's $this->setLibaries(); // set the Joomla Version Data - $this->joomlaVersionData = $this->setJoomlaVersionData(); + $this->joomlaVersionData = $this->setJoomlaVersionData(); // set the new folders if (!$this->setFolders()) { @@ -359,7 +361,7 @@ class Structure extends Get } return false; } - + /** * Set the line number in comments * @@ -372,11 +374,11 @@ class Structure extends Get { if ($this->debugLinenr) { - return ' [Structure '.$nr.']'; + return ' [Structure ' . $nr . ']'; } return ''; } - + /** * Build the Libraries files, folders, url's and config * @@ -396,14 +398,14 @@ class Structure extends Get $this->indexHTML(''); } // create media path if not set - if (!JFolder::exists( $this->componentPath . '/media')) + if (!JFolder::exists($this->componentPath . '/media')) { JFolder::create($this->componentPath . '/media'); // count the folder created $this->folderCount++; $this->indexHTML('/media'); } - foreach($this->libraries as $id => &$library) + foreach ($this->libraries as $id => &$library) { if (ComponentbuilderHelper::checkObject($library)) { @@ -429,7 +431,7 @@ class Structure extends Get if (isset($library->urls) && ComponentbuilderHelper::checkArray($library->urls)) { // build media folder path - $libFolder = strtolower( preg_replace('/\s+/', '-', ComponentbuilderHelper::safeString($library->name, 'filename', ' ', false))); + $libFolder = strtolower(preg_replace('/\s+/', '-', ComponentbuilderHelper::safeString($library->name, 'filename', ' ', false))); $mediaPath = '/media/' . $libFolder; // should we add the local folder $addLocalFolder = false; @@ -439,7 +441,7 @@ class Structure extends Get if (isset($url['type']) && $url['type'] > 1 && isset($url['url']) && ComponentbuilderHelper::checkString($url['url'])) { // create media/lib path if not set - if (!JFolder::exists( $this->componentPath . $mediaPath)) + if (!JFolder::exists($this->componentPath . $mediaPath)) { JFolder::create($this->componentPath . $mediaPath); // count the folder created @@ -491,7 +493,7 @@ class Structure extends Get { $this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] = ''; } - $this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] .= PHP_EOL."\t\t".$libFolder.""; + $this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] .= PHP_EOL . "\t\t" . $libFolder . ""; } } // if config fields are found load into component config (avoiding dublicates) @@ -499,7 +501,8 @@ class Structure extends Get { foreach ($library->config as $cofig) { - $found = array_filter($this->componentData->config, function($item) use($cofig) { + $found = array_filter($this->componentData->config, function($item) use($cofig) + { return $item['field'] == $cofig['field']; }); // set the config data if not found @@ -513,7 +516,7 @@ class Structure extends Get } } } - + /** * Write data to file * @@ -524,7 +527,7 @@ class Structure extends Get { return ComponentbuilderHelper::writeFile($path, $data); } - + /** * Build the Initial Folders * @@ -546,9 +549,9 @@ class Structure extends Get // now build all folders needed for this component foreach ($this->joomlaVersionData->create as $main => $folders) { - if (!JFolder::exists($this->componentPath.'/'.$main)) + if (!JFolder::exists($this->componentPath . '/' . $main)) { - JFolder::create($this->componentPath.'/'.$main); + JFolder::create($this->componentPath . '/' . $main); // count the folder created $this->folderCount++; $this->indexHTML($main); @@ -557,79 +560,79 @@ class Structure extends Get { foreach ($folders as $sub => $subFolders) { - if (!JFolder::exists($this->componentPath.'/'.$main.'/'.$sub)) + if (!JFolder::exists($this->componentPath . '/' . $main . '/' . $sub)) { - JFolder::create($this->componentPath.'/'.$main.'/'.$sub); + JFolder::create($this->componentPath . '/' . $main . '/' . $sub); // count the folder created $this->folderCount++; - $this->indexHTML($main.'/'.$sub); + $this->indexHTML($main . '/' . $sub); } if (ComponentbuilderHelper::checkObject($subFolders)) { foreach ($subFolders as $sub_2 => $subFolders_2) { - if (!JFolder::exists($this->componentPath.'/'.$main.'/'.$sub.'/'.$sub_2)) + if (!JFolder::exists($this->componentPath . '/' . $main . '/' . $sub . '/' . $sub_2)) { - JFolder::create($this->componentPath.'/'.$main.'/'.$sub.'/'.$sub_2); + JFolder::create($this->componentPath . '/' . $main . '/' . $sub . '/' . $sub_2); // count the folder created $this->folderCount++; - $this->indexHTML($main.'/'.$sub.'/'.$sub_2); + $this->indexHTML($main . '/' . $sub . '/' . $sub_2); } if (ComponentbuilderHelper::checkObject($subFolders_2)) { foreach ($subFolders_2 as $sub_3 => $subFolders_3) { - if (!JFolder::exists($this->componentPath.'/'.$main.'/'.$sub.'/'.$sub_2.'/'.$sub_3)) + if (!JFolder::exists($this->componentPath . '/' . $main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3)) { - JFolder::create($this->componentPath.'/'.$main.'/'.$sub.'/'.$sub_2.'/'.$sub_3); + JFolder::create($this->componentPath . '/' . $main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3); // count the folder created $this->folderCount++; - $this->indexHTML($main.'/'.$sub.'/'.$sub_2.'/'.$sub_3); + $this->indexHTML($main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3); } if (ComponentbuilderHelper::checkObject($subFolders_3)) { foreach ($subFolders_3 as $sub_4 => $subFolders_4) { - if (!JFolder::exists($this->componentPath.'/'.$main.'/'.$sub.'/'.$sub_2.'/'.$sub_3.'/'.$sub_4)) + if (!JFolder::exists($this->componentPath . '/' . $main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3 . '/' . $sub_4)) { - JFolder::create($this->componentPath.'/'.$main.'/'.$sub.'/'.$sub_2.'/'.$sub_3.'/'.$sub_4); + JFolder::create($this->componentPath . '/' . $main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3 . '/' . $sub_4); // count the folder created $this->folderCount++; - $this->indexHTML($main.'/'.$sub.'/'.$sub_2.'/'.$sub_3.'/'.$sub_4); + $this->indexHTML($main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3 . '/' . $sub_4); } if (ComponentbuilderHelper::checkObject($subFolders_4)) { foreach ($subFolders_4 as $sub_5 => $subFolders_5) { - if (!JFolder::exists($this->componentPath.'/'.$main.'/'.$sub.'/'.$sub_2.'/'.$sub_3.'/'.$sub_4.'/'.$sub_5)) + if (!JFolder::exists($this->componentPath . '/' . $main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3 . '/' . $sub_4 . '/' . $sub_5)) { - JFolder::create($this->componentPath.'/'.$main.'/'.$sub.'/'.$sub_2.'/'.$sub_3.'/'.$sub_4.'/'.$sub_5); + JFolder::create($this->componentPath . '/' . $main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3 . '/' . $sub_4 . '/' . $sub_5); // count the folder created $this->folderCount++; - $this->indexHTML($main.'/'.$sub.'/'.$sub_2.'/'.$sub_3.'/'.$sub_4.'/'.$sub_5); + $this->indexHTML($main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3 . '/' . $sub_4 . '/' . $sub_5); } if (ComponentbuilderHelper::checkObject($subFolders_5)) { foreach ($subFolders_5 as $sub_6 => $subFolders_6) { - if (!JFolder::exists($this->componentPath.'/'.$main.'/'.$sub.'/'.$sub_2.'/'.$sub_3.'/'.$sub_4.'/'.$sub_5.'/'.$sub_6)) + if (!JFolder::exists($this->componentPath . '/' . $main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3 . '/' . $sub_4 . '/' . $sub_5 . '/' . $sub_6)) { - JFolder::create($this->componentPath.'/'.$main.'/'.$sub.'/'.$sub_2.'/'.$sub_3.'/'.$sub_4.'/'.$sub_5.'/'.$sub_6); + JFolder::create($this->componentPath . '/' . $main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3 . '/' . $sub_4 . '/' . $sub_5 . '/' . $sub_6); // count the folder created $this->folderCount++; - $this->indexHTML($main.'/'.$sub.'/'.$sub_2.'/'.$sub_3.'/'.$sub_4.'/'.$sub_5.'/'.$sub_6); + $this->indexHTML($main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3 . '/' . $sub_4 . '/' . $sub_5 . '/' . $sub_6); } if (ComponentbuilderHelper::checkObject($subFolders_6)) { foreach ($subFolders_6 as $sub_7 => $subFolders_7) { - if (!JFolder::exists($this->componentPath.'/'.$main.'/'.$sub.'/'.$sub_2.'/'.$sub_3.'/'.$sub_4.'/'.$sub_5.'/'.$sub_6.'/'.$sub_7)) + if (!JFolder::exists($this->componentPath . '/' . $main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3 . '/' . $sub_4 . '/' . $sub_5 . '/' . $sub_6 . '/' . $sub_7)) { - JFolder::create($this->componentPath.'/'.$main.'/'.$sub.'/'.$sub_2.'/'.$sub_3.'/'.$sub_4.'/'.$sub_5.'/'.$sub_6.'/'.$sub_7); + JFolder::create($this->componentPath . '/' . $main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3 . '/' . $sub_4 . '/' . $sub_5 . '/' . $sub_6 . '/' . $sub_7); // count the folder created $this->folderCount++; - $this->indexHTML($main.'/'.$sub.'/'.$sub_2.'/'.$sub_3.'/'.$sub_4.'/'.$sub_5.'/'.$sub_6.'/'.$sub_7); + $this->indexHTML($main . '/' . $sub . '/' . $sub_2 . '/' . $sub_3 . '/' . $sub_4 . '/' . $sub_5 . '/' . $sub_6 . '/' . $sub_7); } } } @@ -650,7 +653,7 @@ class Structure extends Get } return false; } - + /** * Set the Static File & Folder * @@ -668,12 +671,12 @@ class Structure extends Get // do license check $LICENSE = false; $licenseChecker = strtolower($this->componentData->license); - if (strpos($licenseChecker,'gnu') !== false && strpos($licenseChecker,'gpl') !== false) + if (strpos($licenseChecker, 'gnu') !== false && strpos($licenseChecker, 'gpl') !== false) { $LICENSE = true; } // do README check - $README = false; + $README = false; // add the README file if needed if ($this->componentData->addreadme) { @@ -711,27 +714,27 @@ class Structure extends Get continue; } // set destination path - $zipPath = str_replace('c0mp0n3nt/','', $details->path); - $path = str_replace('c0mp0n3nt/',$this->componentPath.'/', $details->path); + $zipPath = str_replace('c0mp0n3nt/', '', $details->path); + $path = str_replace('c0mp0n3nt/', $this->componentPath . '/', $details->path); // set the template folder path $templatePath = (isset($details->custom) && $details->custom) ? $this->templatePathCustom : $this->templatePath; // now mov the file if ($details->type === 'file') { // move the file to its place - JFile::copy($templatePath.'/'.$item, $path.'/'.$new); + JFile::copy($templatePath . '/' . $item, $path . '/' . $new); // count the file created $this->fileCount++; // store the new files - if (!in_array($ftem,$this->notNew)) + if (!in_array($ftem, $this->notNew)) { - $this->newFiles['static'][] = array( 'path' => $path.'/'.$new, 'name' => $new, 'zip' => $zipPath.'/'.$new ); + $this->newFiles['static'][] = array('path' => $path . '/' . $new, 'name' => $new, 'zip' => $zipPath . '/' . $new); } } elseif ($details->type === 'folder') { // move the folder to its place - JFolder::copy($templatePath.'/'.$item, $path.'/'.$new); + JFolder::copy($templatePath . '/' . $item, $path . '/' . $new); // count the folder created $this->folderCount++; } @@ -740,7 +743,7 @@ class Structure extends Get } return false; } - + /** * Set the Dynamic File & Folder * @@ -755,7 +758,7 @@ class Structure extends Get { // setup dashboard $target = array('admin' => $this->componentData->name_code); - $this->buildDynamique($target,'dashboard'); + $this->buildDynamique($target, 'dashboard'); // now the rest of the views foreach ($this->componentData->admin_views as $nr => $view) { @@ -766,21 +769,21 @@ class Structure extends Get if ($view['settings']->name_list != 'null') { $target = array('admin' => $view['settings']->name_list); - $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version); - $this->buildDynamique($target,'list', false, $config); + $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified, '###VERSION###' => $view['settings']->version); + $this->buildDynamique($target, 'list', false, $config); } if ($view['settings']->name_single != 'null') { $target = array('admin' => $view['settings']->name_single); - $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version); - $this->buildDynamique($target,'single', false, $config); + $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified, '###VERSION###' => $view['settings']->version); + $this->buildDynamique($target, 'single', false, $config); } - if ( isset($view['edit_create_site_view']) && $view['edit_create_site_view']) + if (isset($view['edit_create_site_view']) && $view['edit_create_site_view']) { // setup the front site edit-view files $target = array('site' => $view['settings']->name_single); - $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version); - $this->buildDynamique($target,'edit', false, $config); + $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified, '###VERSION###' => $view['settings']->version); + $this->buildDynamique($target, 'edit', false, $config); } } // quick set of checkin once @@ -803,15 +806,15 @@ class Structure extends Get { // set list view $target = array('site' => $view['settings']->code); - $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version); - $this->buildDynamique($target,'list', false, $config); + $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified, '###VERSION###' => $view['settings']->version); + $this->buildDynamique($target, 'list', false, $config); } elseif ($view['settings']->main_get->gettype == 1) { // set single view $target = array('site' => $view['settings']->code); - $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version); - $this->buildDynamique($target,'single', false, $config); + $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified, '###VERSION###' => $view['settings']->version); + $this->buildDynamique($target, 'single', false, $config); } } $front = true; @@ -826,14 +829,14 @@ class Structure extends Get { // set list view$view $target = array('custom_admin' => $view['settings']->code); - $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version); - $this->buildDynamique($target,'list', false, $config); + $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified, '###VERSION###' => $view['settings']->version); + $this->buildDynamique($target, 'list', false, $config); } elseif ($view['settings']->main_get->gettype == 1) { // set single view $target = array('custom_admin' => $view['settings']->code); - $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version); + $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified, '###VERSION###' => $view['settings']->version); $this->buildDynamique($target, 'single', false, $config); } } @@ -846,7 +849,7 @@ class Structure extends Get } return false; } - + /** * get the created date of the (view) * @@ -856,7 +859,7 @@ class Structure extends Get * */ public function getCreatedDate($view) - { + { if (isset($view['settings']->created) && ComponentbuilderHelper::checkString($view['settings']->created)) { // first set the main date @@ -869,7 +872,7 @@ class Structure extends Get } return JFactory::getDate($date)->format('jS F, Y'); } - + /** * get the last modified date of a MVC (view) * @@ -881,9 +884,7 @@ class Structure extends Get public function getLastModifiedDate($view) { // first set the main date - if (isset($view['settings']->modified) - && ComponentbuilderHelper::checkString($view['settings']->modified) - && '0000-00-00 00:00:00' !== $view['settings']->modified) + if (isset($view['settings']->modified) && ComponentbuilderHelper::checkString($view['settings']->modified) && '0000-00-00 00:00:00' !== $view['settings']->modified) { $date = strtotime($view['settings']->modified); } @@ -895,7 +896,7 @@ class Structure extends Get // search for the last modified date if (isset($view['adminview'])) { - $id = $view['adminview'].'admin'; + $id = $view['adminview'] . 'admin'; // now check if value has been set if (!isset($this->lastModifiedDate[$id])) { @@ -903,9 +904,7 @@ class Structure extends Get { foreach ($view['settings']->fields as $field) { - if (isset($field['settings']) && ComponentbuilderHelper::checkObject($field['settings']) - && isset($field['settings']->modified) && ComponentbuilderHelper::checkString($field['settings']->modified) - && '0000-00-00 00:00:00' !== $field['settings']->modified) + if (isset($field['settings']) && ComponentbuilderHelper::checkObject($field['settings']) && isset($field['settings']->modified) && ComponentbuilderHelper::checkString($field['settings']->modified) && '0000-00-00 00:00:00' !== $field['settings']->modified) { $anotherDate = strtotime($field['settings']->modified); if ($anotherDate > $date) @@ -918,14 +917,12 @@ class Structure extends Get } } elseif (isset($view['siteview'])) - { - $id = $view['siteview'].'site'; + { + $id = $view['siteview'] . 'site'; // now check if value has been set if (!isset($this->lastModifiedDate[$id])) { - if (isset($view['settings']->main_get->modified) - && ComponentbuilderHelper::checkString($view['settings']->main_get->modified) - && '0000-00-00 00:00:00' !== $view['settings']->main_get->modified) + if (isset($view['settings']->main_get->modified) && ComponentbuilderHelper::checkString($view['settings']->main_get->modified) && '0000-00-00 00:00:00' !== $view['settings']->main_get->modified) { $anotherDate = strtotime($view['settings']->main_get->modified); if ($anotherDate > $date) @@ -936,14 +933,12 @@ class Structure extends Get } } elseif (isset($view['customadminview'])) - { - $id = $view['customadminview'].'customadmin'; + { + $id = $view['customadminview'] . 'customadmin'; // now check if value has been set if (!isset($this->lastModifiedDate[$id])) { - if (isset($view['settings']->main_get->modified) - && ComponentbuilderHelper::checkString($view['settings']->main_get->modified) - && '0000-00-00 00:00:00' !== $view['settings']->main_get->modified) + if (isset($view['settings']->main_get->modified) && ComponentbuilderHelper::checkString($view['settings']->main_get->modified) && '0000-00-00 00:00:00' !== $view['settings']->main_get->modified) { $anotherDate = strtotime($view['settings']->main_get->modified); if ($anotherDate > $date) @@ -963,10 +958,10 @@ class Structure extends Get { $this->lastModifiedDate[$id] = $date; } - + return JFactory::getDate($this->lastModifiedDate[$id])->format('jS F, Y'); } - + /** * Set the Static File & Folder * @@ -982,7 +977,7 @@ class Structure extends Get { if (ComponentbuilderHelper::checkArray($target)) { - foreach ($target as $main => $name) + foreach ($target as $main => $name) { // make sure it is lower case $name = ComponentbuilderHelper::safeString($name); @@ -992,17 +987,17 @@ class Structure extends Get if ($details->type == $type) { // set destination path - $path = ''; - if (strpos($details->path,'VIEW') !== false) + $path = ''; + if (strpos($details->path, 'VIEW') !== false) { - $path = str_replace('VIEW',$name,$details->path); + $path = str_replace('VIEW', $name, $details->path); } else { $path = $details->path; } - $zipPath = str_replace('c0mp0n3nt/','', $path); - $path = str_replace('c0mp0n3nt/',$this->componentPath.'/', $path); + $zipPath = str_replace('c0mp0n3nt/', '', $path); + $path = str_replace('c0mp0n3nt/', $this->componentPath . '/', $path); // setup the folder if (!JFolder::exists($path)) @@ -1018,7 +1013,7 @@ class Structure extends Get if ($fileName) { $new = str_replace($details->rename, $fileName, $item); - $name = $name.'_'.$fileName; + $name = $name . '_' . $fileName; } elseif ($details->rename === 'new') { @@ -1033,15 +1028,15 @@ class Structure extends Get { $new = $item; } - if (!JFile::exists($path.'/'.$new)) + if (!JFile::exists($path . '/' . $new)) { // move the file to its place - JFile::copy($this->templatePath.'/'.$item, $path.'/'.$new,'',true); + JFile::copy($this->templatePath . '/' . $item, $path . '/' . $new, '', true); // count the file created $this->fileCount++; } // setup array for new file - $newFIle = array( 'path' => $path.'/'.$new, 'name' => $new , 'view' => $name, 'zip' => $zipPath.'/'.$new); + $newFIle = array('path' => $path . '/' . $new, 'name' => $new, 'view' => $name, 'zip' => $zipPath . '/' . $new); if (ComponentbuilderHelper::checkArray($config)) { $newFIle['config'] = $config; @@ -1055,7 +1050,7 @@ class Structure extends Get } return false; } - + /** * set the Joomla Version Data * @@ -1066,44 +1061,44 @@ class Structure extends Get private function setJoomlaVersionData() { // set the version data - $versionData = json_decode(ComponentbuilderHelper::getFileContents($this->templatePath.'/settings.json')); + $versionData = json_decode(ComponentbuilderHelper::getFileContents($this->templatePath . '/settings.json')); // add custom folders if ((isset($this->componentData->folders) && ComponentbuilderHelper::checkArray($this->componentData->folders)) || $this->addEximport || $this->uikit || $this->footable) { if ($this->addEximport) { // move the import view folder in place - $importView = array( 'folder' => 'importViews', 'path' => 'admin/views/import', 'rename' => 1); + $importView = array('folder' => 'importViews', 'path' => 'admin/views/import', 'rename' => 1); $this->componentData->folders[] = $importView; // move the PHPExel Folder - $PHPExcel = array( 'folder' => 'PHPExcel', 'path' => 'admin/helpers', 'rename' => 0); + $PHPExcel = array('folder' => 'PHPExcel', 'path' => 'admin/helpers', 'rename' => 0); $this->componentData->folders[] = $PHPExcel; } if (2 == $this->uikit || 1 == $this->uikit) { // move the UIKIT Folder into place - $uikit = array( 'folder' => 'uikit-v2', 'path' => 'media', 'rename' => 0); + $uikit = array('folder' => 'uikit-v2', 'path' => 'media', 'rename' => 0); $this->componentData->folders[] = $uikit; - } + } if (2 == $this->uikit || 3 == $this->uikit) { // move the UIKIT-3 Folder into place - $uikit = array( 'folder' => 'uikit-v3', 'path' => 'media', 'rename' => 0); + $uikit = array('folder' => 'uikit-v3', 'path' => 'media', 'rename' => 0); $this->componentData->folders[] = $uikit; } if ($this->footable && (!isset($this->footableVersion) || 2 == $this->footableVersion)) { // move the footable folder into place - $footable = array( 'folder' => 'footable-v2', 'path' => 'media', 'rename' => 0); + $footable = array('folder' => 'footable-v2', 'path' => 'media', 'rename' => 0); $this->componentData->folders[] = $footable; } elseif ($this->footable && 3 == $this->footableVersion) { // move the footable folder into place - $footable = array( 'folder' => 'footable-v3', 'path' => 'media', 'rename' => 0); + $footable = array('folder' => 'footable-v3', 'path' => 'media', 'rename' => 0); $this->componentData->folders[] = $footable; } - + // pointer tracker $pointer_tracker = 'h'; foreach ($this->componentData->folders as $custom) @@ -1112,16 +1107,16 @@ class Structure extends Get $custom['path'] = rtrim($custom['path'], '/'); $custom['path'] = ltrim($custom['path'], '/'); // make sure we use the correct name - $pathArray = (array) explode('/',$custom['path']); + $pathArray = (array) explode('/', $custom['path']); $firstFolder = array_values($pathArray)[0]; $lastFolder = end($pathArray); // only rename folder if last has folder name if (isset($custom['rename']) && $custom['rename'] == 1) { - $custom['path'] = str_replace('/'.$lastFolder,'',$custom['path']); + $custom['path'] = str_replace('/' . $lastFolder, '', $custom['path']); $rename = 'new'; $newname = $lastFolder; - if(($tkey = array_search($lastFolder, $pathArray)) !== false) + if (($tkey = array_search($lastFolder, $pathArray)) !== false) { unset($pathArray[$tkey]); } @@ -1139,7 +1134,7 @@ class Structure extends Get } if (count($pathArray) == 1 && $firstFolder === 'media') { - $this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] .= PHP_EOL."\t\t".$lastFolder.""; + $this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] .= PHP_EOL . "\t\t" . $lastFolder . ""; } // check if we sould add it to the site xml list if (!isset($this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'])) @@ -1148,7 +1143,7 @@ class Structure extends Get } if (count($pathArray) == 1 && $firstFolder === 'site') { - $this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'] .= PHP_EOL."\t\t".$lastFolder.""; + $this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'] .= PHP_EOL . "\t\t" . $lastFolder . ""; } // check if we sould add it to the admin xml list if (!isset($this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'])) @@ -1157,15 +1152,15 @@ class Structure extends Get } if (count($pathArray) == 1 && $firstFolder === 'admin') { - $this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'] .= PHP_EOL."\t\t\t".$lastFolder.""; + $this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'] .= PHP_EOL . "\t\t\t" . $lastFolder . ""; } // make we have not duplicates - $key_pointer = ComponentbuilderHelper::safeString($custom['folder']).'_f'.$pointer_tracker; + $key_pointer = ComponentbuilderHelper::safeString($custom['folder']) . '_f' . $pointer_tracker; $pointer_tracker++; // set new folder to object $versionData->move->static->$key_pointer = new stdClass(); $versionData->move->static->$key_pointer->naam = $custom['folder']; - $versionData->move->static->$key_pointer->path = 'c0mp0n3nt/'.$custom['path']; + $versionData->move->static->$key_pointer->path = 'c0mp0n3nt/' . $custom['path']; $versionData->move->static->$key_pointer->rename = $rename; $versionData->move->static->$key_pointer->newName = $newname; $versionData->move->static->$key_pointer->type = 'folder'; @@ -1180,24 +1175,24 @@ class Structure extends Get if ($this->addEximport) { // move the PHPExel main file - $PHPExcel = array( 'file' => 'PHPExcel.php', 'path' => 'admin/helpers', 'rename' => 0); + $PHPExcel = array('file' => 'PHPExcel.php', 'path' => 'admin/helpers', 'rename' => 0); $this->componentData->files[] = $PHPExcel; } if ($this->googlechart) { // move the google chart files - $googleChart = array( 'file' => 'google.jsapi.js', 'path' => 'media/js', 'rename' => 0); + $googleChart = array('file' => 'google.jsapi.js', 'path' => 'media/js', 'rename' => 0); $this->componentData->files[] = $googleChart; - $googleChart = array( 'file' => 'chartbuilder.php', 'path' => 'admin/helpers', 'rename' => 0); + $googleChart = array('file' => 'chartbuilder.php', 'path' => 'admin/helpers', 'rename' => 0); $this->componentData->files[] = $googleChart; } - + // pointer tracker $pointer_tracker = 'h'; foreach ($this->componentData->files as $custom) { // make we have not duplicates - $key_pointer = ComponentbuilderHelper::safeString($custom['file']).'_g'.$pointer_tracker; + $key_pointer = ComponentbuilderHelper::safeString($custom['file']) . '_g' . $pointer_tracker; $pointer_tracker++; // set new file to object $versionData->move->static->$key_pointer = new stdClass(); @@ -1208,7 +1203,7 @@ class Structure extends Get { $pathInfo['dirname'] = rtrim($pathInfo['dirname'], '/'); $pathInfo['dirname'] = ltrim($pathInfo['dirname'], '/'); - $versionData->move->static->$key_pointer->path = 'c0mp0n3nt/'.$pathInfo['dirname']; + $versionData->move->static->$key_pointer->path = 'c0mp0n3nt/' . $pathInfo['dirname']; $versionData->move->static->$key_pointer->rename = 'new'; $versionData->move->static->$key_pointer->newName = $pathInfo['basename']; // set the name @@ -1218,7 +1213,7 @@ class Structure extends Get { $custom['path'] = rtrim($custom['path'], '/'); $custom['path'] = ltrim($custom['path'], '/'); - $versionData->move->static->$key_pointer->path = 'c0mp0n3nt/'.$custom['path']; + $versionData->move->static->$key_pointer->path = 'c0mp0n3nt/' . $custom['path']; $versionData->move->static->$key_pointer->rename = false; // set the name $name = $custom['file']; @@ -1236,7 +1231,7 @@ class Structure extends Get } return $versionData; } - + /** * set the index.html file in a folder path * @@ -1249,18 +1244,18 @@ class Structure extends Get { if (strlen($path) > 0) { - JFile::copy($this->templatePath.'/index.html', $this->componentPath.'/'.$path.'/index.html'); + JFile::copy($this->templatePath . '/index.html', $this->componentPath . '/' . $path . '/index.html'); // count the file created $this->fileCount++; } else { - JFile::copy($this->templatePath.'/index.html', $this->componentPath.'/index.html'); + JFile::copy($this->templatePath . '/index.html', $this->componentPath . '/index.html'); // count the file created $this->fileCount++; } } - + /** * Remove folders with files * diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index e17e33744..6d30f7308 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -1,27 +1,28 @@ - @my wife Roline van der Merwe - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Builds Complex Joomla Components - -/-----------------------------------------------------------------------------------------------------------------------------*/ +/* --------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| + /-------------------------------------------------------------------------------------------------------------------------------/ + + @version 2.6.x + @created 30th April, 2015 + @package Component Builder + @subpackage compiler.php + @author Llewellyn van der Merwe + @my wife Roline van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + + /----------------------------------------------------------------------------------------------------------------------------- */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); @@ -31,12 +32,12 @@ defined('_JEXEC') or die('Restricted access'); */ class Fields extends Structure { + /** * Metadate Switch * * @var array */ - public $metadataBuilder = array(); /** @@ -45,315 +46,315 @@ class Fields extends Structure * @var array */ public $accessBuilder = array(); - + /** * edit view tabs counter * * @var array */ public $tabCounter = array(); - + /** * layout builder * * @var array */ public $layoutBuilder = array(); - + /** * used to fix the zero order * * @var array */ private $zeroOrderFix = array(); - + /** * Site field data * * @var array */ public $siteFieldData = array(); - + /** * Category other name bucket * * @var array */ public $catOtherName = array(); - + /** * list of fields that are not being escaped * * @var array */ public $doNotEscape = array(); - + /** * tags builder * * @var array */ public $tagsBuilder = array(); - + /** * query builder * * @var array */ public $queryBuilder = array(); - + /** * unique keys for database field * * @var array */ public $dbUniqueKeys = array(); - + /** * keys for database field * * @var array */ public $dbKeys = array(); - + /** * history builder * * @var array */ public $historyBuilder = array(); - + /** * alias builder * * @var array */ public $aliasBuilder = array(); - + /** * title builder * * @var array */ public $titleBuilder = array(); - + /** * list builder * * @var array */ public $listBuilder = array(); - + /** * custom Builder List * * @var array */ public $customBuilderList = array(); - + /** * Hidden Fields Builder * * @var array */ public $hiddenFieldsBuilder = array(); - + /** * INT Field Builder * * @var array */ public $intFieldsBuilder = array(); - + /** * Dynamic Fields Builder * * @var array */ public $dynamicfieldsBuilder = array(); - + /** * Main text Builder * * @var array */ public $maintextBuilder = array(); - + /** * Custom Builder * * @var array */ public $customBuilder = array(); - + /** * Custom Field Links Builder * * @var array */ public $customFieldLinksBuilder = array(); - + /** * Set Script for User Switch * * @var array */ public $setScriptUserSwitch = array(); - + /** * Set Script for Media Switch * * @var array */ public $setScriptMediaSwitch = array(); - + /** * Category builder * * @var array */ public $categoryBuilder = array(); - + /** * Category Code builder * * @var array */ public $catCodeBuilder = array(); - + /** * Check Box builder * * @var array */ public $checkboxBuilder = array(); - + /** * Json String Builder * * @var array */ public $jsonStringBuilder = array(); - + /** * Json String Builder for return values to array * * @var array */ public $jsonItemBuilderArray = array(); - + /** * Json Item Builder * * @var array */ public $jsonItemBuilder = array(); - + /** * Base 64 Builder * * @var array */ public $base64Builder = array(); - + /** * Basic Encryption Builder * * @var array */ public $basicEncryptionBuilder = array(); - + /** * Advnaced Encryption Builder * * @var array */ public $advancedEncryptionBuilder = array(); - + /** * Get Items Method List String Fix Builder * * @var array */ public $getItemsMethodListStringFixBuilder = array(); - + /** * Get Items Method Eximport String Fix Builder * * @var array */ public $getItemsMethodEximportStringFixBuilder = array(); - + /** * Selection Translation Fix Builder * * @var array */ - public $selectionTranslationFixBuilder = array(); - + public $selectionTranslationFixBuilder = array(); + /** * Sort Builder * * @var array */ public $sortBuilder = array(); - + /** * Search Builder * * @var array */ public $searchBuilder = array(); - + /** * Filter Builder * * @var array */ public $filterBuilder = array(); - + /** * Set Group Control * * @var array */ public $setGroupControl = array(); - + /** * Set Field Names * * @var array */ - public $fieldsNames = array(); - + public $fieldsNames = array(); + /** * Set unique Names * * @var array */ public $uniqueNames = array(); - + /** * Default Fields * * @var array */ public $defaultFields = array('created', 'created_by', 'modified', 'modified_by', 'published', 'ordering', 'access', 'version', 'hits', 'id'); - + /** * Default Fields set to publishing * * @var array */ public $newPublishingFields = array(); - + /** * Default Fields set to publishing * * @var array */ public $movedPublishingFields = array(); - + /** * Set the line number in comments * @@ -366,7 +367,7 @@ class Fields extends Structure { if ($this->debugLinenr) { - return ' [Fields '.$nr.']'; + return ' [Fields ' . $nr . ']'; } return ''; } @@ -487,13 +488,13 @@ class Fields extends Structure if (!isset($this->fieldsNames[$viewName]['id'])) { $attributes = array( - 'name' => 'id', - 'type' => 'text', - 'class' => 'readonly', - 'label' => 'JGLOBAL_FIELD_ID_LABEL', - 'description' => 'JGLOBAL_FIELD_ID_DESC', - 'size' => 10, - 'default' => 0 + 'name' => 'id', + 'type' => 'text', + 'class' => 'readonly', + 'label' => 'JGLOBAL_FIELD_ID_LABEL', + 'description' => 'JGLOBAL_FIELD_ID_DESC', + 'size' => 10, + 'default' => 0 ); $fieldXML = $fieldSetXML->addChild('field'); $this->xmlAddAttributes($fieldXML, $attributes); @@ -504,13 +505,13 @@ class Fields extends Structure if (!isset($this->fieldsNames[$viewName]['created'])) { $attributes = array( - 'name' => 'created', - 'type' => 'calendar', - 'label' => $langView . '_CREATED_DATE_LABEL', - 'description' => $langView . '_CREATED_DATE_DESC', - 'size' => 22, - 'format' => '%Y-%m-%d %H:%M:%S', - 'filter' => 'user_utc' + 'name' => 'created', + 'type' => 'calendar', + 'label' => $langView . '_CREATED_DATE_LABEL', + 'description' => $langView . '_CREATED_DATE_DESC', + 'size' => 22, + 'format' => '%Y-%m-%d %H:%M:%S', + 'filter' => 'user_utc' ); $attributes = array_merge($attributes, $readOnlyXML); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Created Field. Type: Calendar (joomla)"); @@ -523,10 +524,10 @@ class Fields extends Structure if (!isset($this->fieldsNames[$viewName]['created_by'])) { $attributes = array( - 'name' => 'created_by', - 'type' => 'user', - 'label' => $langView . '_CREATED_BY_LABEL', - 'description' => $langView . '_CREATED_BY_DESC', + 'name' => 'created_by', + 'type' => 'user', + 'label' => $langView . '_CREATED_BY_LABEL', + 'description' => $langView . '_CREATED_BY_DESC', ); $attributes = array_merge($attributes, $readOnlyXML); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Created Field. Type: User (joomla)"); @@ -539,9 +540,9 @@ class Fields extends Structure if (!isset($this->fieldsNames[$viewName]['published'])) { $attributes = array( - 'name' => 'published', - 'type' => 'list', - 'label' => 'JSTATUS' + 'name' => 'published', + 'type' => 'list', + 'label' => 'JSTATUS' ); $attributes = array_merge($attributes, $readOnlyXML); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Published Field. Type: List (joomla)"); @@ -560,15 +561,15 @@ class Fields extends Structure if (!isset($this->fieldsNames[$viewName]['modified'])) { $attributes = array( - 'name' => 'modified', - 'type' => 'calendar', - 'class' => 'readonly', - 'label' => $langView . '_MODIFIED_DATE_LABEL', - 'description' => $langView . '_MODIFIED_DATE_DESC', - 'size' => 22, - 'readonly' => "true", - 'format' => '%Y-%m-%d %H:%M:%S', - 'filter' => 'user_utc' + 'name' => 'modified', + 'type' => 'calendar', + 'class' => 'readonly', + 'label' => $langView . '_MODIFIED_DATE_LABEL', + 'description' => $langView . '_MODIFIED_DATE_DESC', + 'size' => 22, + 'readonly' => "true", + 'format' => '%Y-%m-%d %H:%M:%S', + 'filter' => 'user_utc' ); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Modified Field. Type: Calendar (joomla)"); $fieldXML = $fieldSetXML->addChild('field'); @@ -580,13 +581,13 @@ class Fields extends Structure if (!isset($this->fieldsNames[$viewName]['modified_by'])) { $attributes = array( - 'name' => 'modified_by', - 'type' => 'user', - 'label' => $langView . '_MODIFIED_BY_LABEL', - 'description' => $langView . '_MODIFIED_BY_DESC', - 'class' => 'readonly', - 'readonly' => 'true', - 'filter' => 'unset' + 'name' => 'modified_by', + 'type' => 'user', + 'label' => $langView . '_MODIFIED_BY_LABEL', + 'description' => $langView . '_MODIFIED_BY_DESC', + 'class' => 'readonly', + 'readonly' => 'true', + 'filter' => 'unset' ); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Modified Field. Type: User (joomla)"); $fieldXML = $fieldSetXML->addChild('field'); @@ -598,12 +599,12 @@ class Fields extends Structure if (isset($this->accessBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName]) && !isset($this->fieldsNames[$viewName]['access'])) { $attributes = array( - 'name' => 'access', - 'type' => 'accesslevel', - 'label' => 'JFIELD_ACCESS_LABEL', - 'description' => 'JFIELD_ACCESS_DESC', - 'default' => 1, - 'required' => "false" + 'name' => 'access', + 'type' => 'accesslevel', + 'label' => 'JFIELD_ACCESS_LABEL', + 'description' => 'JFIELD_ACCESS_DESC', + 'default' => 1, + 'required' => "false" ); $attributes = array_merge($attributes, $readOnlyXML); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Access Field. Type: Accesslevel (joomla)"); @@ -616,14 +617,14 @@ class Fields extends Structure if (!isset($this->fieldsNames[$viewName]['ordering'])) { $attributes = array( - 'name' => 'ordering', - 'type' => 'number', - 'class' => 'inputbox validate-ordering', - 'label' => $langView . '_ORDERING_LABEL', - 'description' => '', - 'default' => 0, - 'size' => 6, - 'required' => "false" + 'name' => 'ordering', + 'type' => 'number', + 'class' => 'inputbox validate-ordering', + 'label' => $langView . '_ORDERING_LABEL', + 'description' => '', + 'default' => 0, + 'size' => 6, + 'required' => "false" ); $attributes = array_merge($attributes, $readOnlyXML); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Ordering Field. Type: Numbers (joomla)"); @@ -636,14 +637,14 @@ class Fields extends Structure if (!isset($this->fieldsNames[$viewName]['version'])) { $attributes = array( - 'name' => 'version', - 'type' => 'text', - 'class' => 'readonly', - 'label' => $langView . '_VERSION_LABEL', - 'description' => $langView . '_VERSION_DESC', - 'size' => 6, - 'readonly' => "true", - 'filter' => 'unset' + 'name' => 'version', + 'type' => 'text', + 'class' => 'readonly', + 'label' => $langView . '_VERSION_LABEL', + 'description' => $langView . '_VERSION_DESC', + 'size' => 6, + 'readonly' => "true", + 'filter' => 'unset' ); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Version Field. Type: Text (joomla)"); $fieldXML = $fieldSetXML->addChild('field'); @@ -656,12 +657,12 @@ class Fields extends Structure { // metakey $attributes = array( - 'name' => 'metakey', - 'type' => 'textarea', - 'label' => 'JFIELD_META_KEYWORDS_LABEL', - 'description' => 'JFIELD_META_KEYWORDS_DESC', - 'rows' => 3, - 'cols' => 30 + 'name' => 'metakey', + 'type' => 'textarea', + 'label' => 'JFIELD_META_KEYWORDS_LABEL', + 'description' => 'JFIELD_META_KEYWORDS_DESC', + 'rows' => 3, + 'cols' => 30 ); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metakey Field. Type: Textarea (joomla)"); $fieldXML = $fieldSetXML->addChild('field'); @@ -701,20 +702,20 @@ class Fields extends Structure $this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Robots Field. Type: List (joomla)"); $robots = $fieldsFieldSetXML->addChild('field'); $attributes = array( - 'name' => 'robots', - 'type' => 'list', - 'label' => 'JFIELD_METADATA_ROBOTS_LABEL', - 'description' => 'JFIELD_METADATA_ROBOTS_DESC' + 'name' => 'robots', + 'type' => 'list', + 'label' => 'JFIELD_METADATA_ROBOTS_LABEL', + 'description' => 'JFIELD_METADATA_ROBOTS_DESC' ); $this->xmlAddAttributes($robots, $attributes); // count the static field created $this->fieldCount++; $options = array( - 'JGLOBAL_USE_GLOBAL' => '', - 'JGLOBAL_INDEX_FOLLOW' => 'index, follow', - 'JGLOBAL_NOINDEX_FOLLOW' => 'noindex, follow', - 'JGLOBAL_INDEX_NOFOLLOW' => 'index, nofollow', - 'JGLOBAL_NOINDEX_NOFOLLOW' => 'noindex, nofollow', + 'JGLOBAL_USE_GLOBAL' => '', + 'JGLOBAL_INDEX_FOLLOW' => 'index, follow', + 'JGLOBAL_NOINDEX_FOLLOW' => 'noindex, follow', + 'JGLOBAL_INDEX_NOFOLLOW' => 'index, nofollow', + 'JGLOBAL_NOINDEX_NOFOLLOW' => 'noindex, nofollow', ); foreach ($options as $text => $value) { @@ -726,11 +727,11 @@ class Fields extends Structure $this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Author Field. Type: Text (joomla)"); $author = $fieldsFieldSetXML->addChild('field'); $attributes = array( - 'name' => 'author', - 'type' => 'text', - 'label' => 'JAUTHOR', - 'description' => 'JFIELD_METADATA_AUTHOR_DESC', - 'size' => 20 + 'name' => 'author', + 'type' => 'text', + 'label' => 'JAUTHOR', + 'description' => 'JFIELD_METADATA_AUTHOR_DESC', + 'size' => 20 ); $this->xmlAddAttributes($author, $attributes); // count the static field created @@ -739,14 +740,14 @@ class Fields extends Structure $this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Rights Field. Type: Textarea (joomla)"); $rights = $fieldsFieldSetXML->addChild('field'); $attributes = array( - 'name' => 'rights', - 'type' => 'textarea', - 'label' => 'JFIELD_META_RIGHTS_LABEL', - 'description' => 'JFIELD_META_RIGHTS_DESC', - 'required' => 'false', - 'filter' => 'string', - 'cols' => 30, - 'rows' => 2 + 'name' => 'rights', + 'type' => 'textarea', + 'label' => 'JFIELD_META_RIGHTS_LABEL', + 'description' => 'JFIELD_META_RIGHTS_DESC', + 'required' => 'false', + 'filter' => 'string', + 'cols' => 30, + 'rows' => 2 ); $this->xmlAddAttributes($rights, $attributes); // count the static field created @@ -807,8 +808,8 @@ class Fields extends Structure if (ComponentbuilderHelper::checkArray($fieldAttributes)) { // set the array of field names - $this->setFieldsNames($viewName,$fieldAttributes['name']); - + $this->setFieldsNames($viewName, $fieldAttributes['name']); + if ($this->defaultField($typeName, 'option')) { //reset options array @@ -1136,9 +1137,9 @@ class Fields extends Structure { $form = $field->fieldXML->addChild('form'); $attributes = array( - 'hidden' => 'true', - 'name' => 'list_' . $fieldAttributes['name'] . '_modal', - 'repeat' => 'true' + 'hidden' => 'true', + 'name' => 'list_' . $fieldAttributes['name'] . '_modal', + 'repeat' => 'true' ); $this->xmlAddAttributes($form, $attributes); @@ -1248,7 +1249,7 @@ class Fields extends Structure * @return void * */ - public function setLayoutBuilder(&$viewName,&$tabName,&$name,&$field) + public function setLayoutBuilder(&$viewName, &$tabName, &$name, &$field) { // first fix the zero order // to insure it lands before all the other fields @@ -1338,14 +1339,14 @@ class Fields extends Structure */ public function buildSiteFieldData($view, $field, $set, $type) { - $decode = array('json','base64','basic_encryption','advance_encryption'); - $textareas = array('textarea','editor'); + $decode = array('json', 'base64', 'basic_encryption', 'advance_encryption'); + $textareas = array('textarea', 'editor'); if (isset($this->siteFields[$view][$field]) && ComponentbuilderHelper::checkArray($this->siteFields[$view][$field])) { foreach ($this->siteFields[$view][$field] as $code => $array) { // set the decoding methods - if (in_array($set,$decode)) + if (in_array($set, $decode)) { $this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']] = array('decode' => $set, 'type' => $type); } @@ -1466,9 +1467,9 @@ class Fields extends Structure if (ComponentbuilderHelper::checkString($otherName) && ComponentbuilderHelper::checkString($otherViews) && ComponentbuilderHelper::checkString($otherView)) { $this->catOtherName[$listViewName] = array( - 'name' => ComponentbuilderHelper::safeString($otherName), - 'views' => ComponentbuilderHelper::safeString($otherViews), - 'view' => ComponentbuilderHelper::safeString($otherView) + 'name' => ComponentbuilderHelper::safeString($otherName), + 'views' => ComponentbuilderHelper::safeString($otherViews), + 'view' => ComponentbuilderHelper::safeString($otherView) ); } } @@ -1793,7 +1794,7 @@ class Fields extends Structure return; } // count how many times the field is used - $this->uniqueNames[$view]['counter'][$name]++; + $this->uniqueNames[$view]['counter'][$name] ++; return; } @@ -1825,7 +1826,6 @@ class Fields extends Structure return $name; } - /** * set Builders * @@ -1947,16 +1947,16 @@ class Fields extends Structure { // load to list builder $this->listBuilder[$listViewName][] = array( - 'type' => $typeName, - 'code' => $name, - 'lang' => $listLangName, - 'title' => (isset($field['title']) && $field['title']) ? true : false, - 'alias' => (isset($field['alias']) && $field['alias']) ? true : false, - 'link' => (isset($field['link']) && $field['link']) ? true : false, - 'sort' => (isset($field['sort']) && $field['sort']) ? true : false, - 'custom' => $custom, - 'multiple' => $multiple, - 'options' => $options); + 'type' => $typeName, + 'code' => $name, + 'lang' => $listLangName, + 'title' => (isset($field['title']) && $field['title']) ? true : false, + 'alias' => (isset($field['alias']) && $field['alias']) ? true : false, + 'link' => (isset($field['link']) && $field['link']) ? true : false, + 'sort' => (isset($field['sort']) && $field['sort']) ? true : false, + 'custom' => $custom, + 'multiple' => $multiple, + 'options' => $options); $this->customBuilderList[$listViewName][] = $name; } @@ -2156,26 +2156,26 @@ class Fields extends Structure public function setCustomFieldTypeFile($data, $viewName_list, $viewName_single) { // make sure it is not already been build - if (!isset($this->fileContentDynamic['customfield_'.$data['type']]) || !ComponentbuilderHelper::checkArray($this->fileContentDynamic['customfield_'.$data['type']])) + if (!isset($this->fileContentDynamic['customfield_' . $data['type']]) || !ComponentbuilderHelper::checkArray($this->fileContentDynamic['customfield_' . $data['type']])) { // first build the custom field type file $target = array('admin' => 'customfield'); - $this->buildDynamique($target,'field'.$data['custom']['extends'], $data['custom']['type']); + $this->buildDynamique($target, 'field' . $data['custom']['extends'], $data['custom']['type']); // set tab and break replacements $tabBreak = array( - '\t' => "\t", - '\n' => PHP_EOL + '\t' => "\t", + '\n' => PHP_EOL ); // make field dynamic $replace = array( '###TABLE###' => $data['custom']['table'], '###ID###' => $data['custom']['id'], '###TEXT###' => $data['custom']['text'], - '###CODE_TEXT###' => $data['code'].'_'.$data['custom']['text'], + '###CODE_TEXT###' => $data['code'] . '_' . $data['custom']['text'], '###CODE###' => $data['code'], '###component###' => $this->fileContentStatic['###component###'], '###Component###' => $this->fileContentStatic['###Component###'], - '###view_type###' => $viewName_single.'_'.$data['type'], + '###view_type###' => $viewName_single . '_' . $data['type'], '###type###' => $data['type'], '###view###' => $viewName_single, '###views###' => $viewName_list @@ -2195,7 +2195,7 @@ class Fields extends Structure } else { - $phpCode .= PHP_EOL."\t\t".$this->setPlaceholders($code, $tabBreak); + $phpCode .= PHP_EOL . "\t\t" . $this->setPlaceholders($code, $tabBreak); } } } @@ -2244,30 +2244,30 @@ class Fields extends Structure $phpxCode = 'return null;'; } // temp holder for name - $tempName = $data['custom']['label'].' Group'; + $tempName = $data['custom']['label'] . ' Group'; // set lang - $groupLangName = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($tempName,'U'); + $groupLangName = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($tempName, 'U'); // add to lang array - $this->langContent[$this->lang][$groupLangName] = ComponentbuilderHelper::safeString($tempName,'W'); + $this->langContent[$this->lang][$groupLangName] = ComponentbuilderHelper::safeString($tempName, 'W'); // build the Group Control $this->setGroupControl[$data['type']] = $groupLangName; // ###JFORM_GETGROUPS_PHP### <<>> - $this->fileContentDynamic['customfield_'.$data['type']]['###JFORM_GETGROUPS_PHP###'] = $phpCode; + $this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETGROUPS_PHP###'] = $phpCode; // ###JFORM_GETEXCLUDED_PHP### <<>> - $this->fileContentDynamic['customfield_'.$data['type']]['###JFORM_GETEXCLUDED_PHP###'] = $phpxCode; + $this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETEXCLUDED_PHP###'] = $phpxCode; } else { // ###JFORM_GETOPTIONS_PHP### <<>> - $this->fileContentDynamic['customfield_'.$data['type']]['###JFORM_GETOPTIONS_PHP###'] = $phpCode; + $this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETOPTIONS_PHP###'] = $phpCode; } // ###Type### <<>> - $this->fileContentDynamic['customfield_'.$data['type']]['###Type###'] = ComponentbuilderHelper::safeString($data['custom']['type'],'F'); + $this->fileContentDynamic['customfield_' . $data['type']]['###Type###'] = ComponentbuilderHelper::safeString($data['custom']['type'], 'F'); // ###type### <<>> - $this->fileContentDynamic['customfield_'.$data['type']]['###type###'] = $data['custom']['type']; + $this->fileContentDynamic['customfield_' . $data['type']]['###type###'] = $data['custom']['type']; // ###type### <<>> - $this->fileContentDynamic['customfield_'.$data['type']]['###ADD_BUTTON###'] = $this->setAddButttonToListField($data['custom']['view'],$data['custom']['views']); + $this->fileContentDynamic['customfield_' . $data['type']]['###ADD_BUTTON###'] = $this->setAddButttonToListField($data['custom']['view'], $data['custom']['views']); } } @@ -2281,39 +2281,39 @@ class Fields extends Structure * */ public function defaultField($type, $option = 'default') - { + { // list of default fields // https://docs.joomla.org/Form_field $defaults = array( - 'default' => array( - 'accesslevel', 'cachehandler', 'calendar', 'captcha', 'category', 'checkbox', - 'checkboxes', 'color', 'combo', 'componentlayout', 'contentlanguage', 'editor', - 'chromestyle', 'contenttype', 'databaseconnection', 'editors', 'email', 'file', - 'filelist', 'folderlist', 'groupedlist', 'hidden', 'file', 'headertag', 'helpsite', - 'imagelist', 'integer', 'language', 'list', 'media', 'menu', 'note', 'number', 'password', - 'plugins', 'radio', 'repeatable', 'range', 'rules', 'subform', 'sessionhandler', 'spacer', 'sql', 'tag', - 'tel', 'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduleposition', 'moduletag', - 'templatestyle', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup' - ), - 'plain' => array( - 'accesslevel', 'checkbox', 'cachehandler', 'calendar', 'category', 'chromestyle', 'color', - 'contenttype', 'combo', 'componentlayout', 'databaseconnection', 'editor', 'editors', - 'email', 'file', 'filelist', 'folderlist', 'headertag', 'helpsite', - 'hidden', 'imagelist', 'integer', 'language', 'media', 'menu', - 'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduletag', 'number', 'password', 'range', 'rules', - 'sessionhandler', 'tag', 'tel', 'text', 'textarea', - 'timezone', 'url', 'user', 'usergroup' - ), - 'spacer' => array( - 'note', 'spacer' - ), - 'option' => array( - 'plugins', 'checkboxes', 'contentlanguage', 'list', 'radio', 'sql' - ), - 'special' => array( - 'contentlanguage', 'groupedlist', 'moduleposition', 'plugin', - 'repeatable', 'templatestyle', 'subform' - ) + 'default' => array( + 'accesslevel', 'cachehandler', 'calendar', 'captcha', 'category', 'checkbox', + 'checkboxes', 'color', 'combo', 'componentlayout', 'contentlanguage', 'editor', + 'chromestyle', 'contenttype', 'databaseconnection', 'editors', 'email', 'file', + 'filelist', 'folderlist', 'groupedlist', 'hidden', 'file', 'headertag', 'helpsite', + 'imagelist', 'integer', 'language', 'list', 'media', 'menu', 'note', 'number', 'password', + 'plugins', 'radio', 'repeatable', 'range', 'rules', 'subform', 'sessionhandler', 'spacer', 'sql', 'tag', + 'tel', 'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduleposition', 'moduletag', + 'templatestyle', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup' + ), + 'plain' => array( + 'accesslevel', 'checkbox', 'cachehandler', 'calendar', 'category', 'chromestyle', 'color', + 'contenttype', 'combo', 'componentlayout', 'databaseconnection', 'editor', 'editors', + 'email', 'file', 'filelist', 'folderlist', 'headertag', 'helpsite', + 'hidden', 'imagelist', 'integer', 'language', 'media', 'menu', + 'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduletag', 'number', 'password', 'range', 'rules', + 'sessionhandler', 'tag', 'tel', 'text', 'textarea', + 'timezone', 'url', 'user', 'usergroup' + ), + 'spacer' => array( + 'note', 'spacer' + ), + 'option' => array( + 'plugins', 'checkboxes', 'contentlanguage', 'list', 'radio', 'sql' + ), + 'special' => array( + 'contentlanguage', 'groupedlist', 'moduleposition', 'plugin', + 'repeatable', 'templatestyle', 'subform' + ) ); if (in_array($type, $defaults[$option])) @@ -2415,9 +2415,9 @@ class Fields extends Structure if ($this->tidy) { $tidy = new Tidy(); - $tidy->parseString($xmlString,array('indent'=>true,'indent-spaces'=>8,'input-xml'=>true,'output-xml'=>true,'indent-attributes'=>true,'wrap-attributes'=>true,'wrap'=>false)); + $tidy->parseString($xmlString, array('indent' => true, 'indent-spaces' => 8, 'input-xml' => true, 'output-xml' => true, 'indent-attributes' => true, 'wrap-attributes' => true, 'wrap' => false)); $tidy->cleanRepair(); - return $this->xmlIndent((string)$tidy,' ',8,true,false); + return $this->xmlIndent((string) $tidy, ' ', 8, true, false); } // set tidy waring atleast once elseif (!$this->setTidyWarning) @@ -2429,7 +2429,7 @@ class Fields extends Structure } return $xmlString; } - + /** * xmlIndent * @@ -2442,18 +2442,18 @@ class Fields extends Structure * @return string XML output * */ - public function xmlIndent($string,$char=' ',$depth=0,$skipfirst=false,$skiplast=false) + public function xmlIndent($string, $char = ' ', $depth = 0, $skipfirst = false, $skiplast = false) { $output = array(); - $lines = explode("\n",$string); + $lines = explode("\n", $string); $first = true; - $last = count($lines)-1; - foreach($lines as $i=>$line) + $last = count($lines) - 1; + foreach ($lines as $i => $line) { - $output[] = (($first&&$skipfirst)||$i===$last&&$skiplast)?$line:str_repeat($char,$depth).$line; + $output[] = (($first && $skipfirst) || $i === $last && $skiplast) ? $line : str_repeat($char, $depth) . $line; $first = false; } - return implode("\n",$output); + return implode("\n", $output); } } diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 57641e0ce..f0a0ef5ae 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -1,27 +1,28 @@ - @my wife Roline van der Merwe - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Builds Complex Joomla Components - -/-----------------------------------------------------------------------------------------------------------------------------*/ +/* --------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| + /-------------------------------------------------------------------------------------------------------------------------------/ + + @version 2.6.x + @created 30th April, 2015 + @package Component Builder + @subpackage compiler.php + @author Llewellyn van der Merwe + @my wife Roline van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + + /----------------------------------------------------------------------------------------------------------------------------- */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); @@ -30,167 +31,167 @@ defined('_JEXEC') or die('Restricted access'); * Compiler class */ class Interpretation extends Fields -{ +{ + /** * The contributors * * @var string */ public $theContributors = ''; - + /** * The unistall builder * * @var array */ public $uninstallBuilder = array(); - + /** * The update SQL builder * * @var array */ public $updateSQLBuilder = array(); - + /** * The List Column Builder * * @var array */ public $listColnrBuilder = array(); - + /** * The permissions Builder * * @var array */ public $permissionBuilder = array(); - + /** * The dashboard permissions builder * * @var array */ public $permissionDashboard = array(); - + /** * The permissions core * * @var array */ public $permissionCore = array(); - + /** * The customs field builder * * @var array */ public $customFieldBuilder = array(); - + /** * The category builder * * @var array */ public $buildCategories = array(); - + /** * The icon builder * * @var array */ public $iconBuilder = array(); - + /** * The validation fix builder * * @var array */ public $validationFixBuilder = array(); - + /** * The edit body script builder * * @var array */ public $editBodyViewScriptBuilder = array(); - + /** * The target relation control * * @var array */ public $targetRelationControl = array(); - + /** * The target control script checker * * @var array */ public $targetControlsScriptChecker = array(); - + /** * The router helper * * @var array */ public $setRouterHelpDone = array(); - + /** * The other where * * @var array */ public $otherWhere = array(); - + /** * The dashboard get custom data * * @var array */ public $DashboardGetCustomData = array(); - + /** * The custom admin added * * @var array */ public $customAdminAdded = array(); - + /** * The extensions params * * @var array - */ + */ protected $extensionsParams = array(); - + /** * The asset rules * * @var array */ public $assetsRules = array(); - + /** * View Has Category Request * * @var array */ protected $hasCatIdRequest = array(); - + /** * View Has Id Request * * @var array */ protected $hasIdRequest = array(); - protected $libwarning = array(); /** * Constructor */ - public function __construct($config = array ()) + public function __construct($config = array()) { // first we run the perent constructor if (parent::__construct($config)) @@ -199,7 +200,7 @@ class Interpretation extends Fields } return false; } - + /** * Set the line number in comments * @@ -212,14 +213,14 @@ class Interpretation extends Fields { if ($this->debugLinenr) { - return ' [Interpretation '.$nr.']'; + return ' [Interpretation ' . $nr . ']'; } return ''; } /** * add email helper - */ + */ public function addEmailHelper() { if (isset($this->componentData->add_email_helper) && $this->componentData->add_email_helper) @@ -228,13 +229,13 @@ class Interpretation extends Fields $component = $this->fileContentStatic['###component###']; $Component = $this->fileContentStatic['###Component###']; $target = array('admin' => 'emailer'); - $done = $this->buildDynamique($target,'emailer',$component); + $done = $this->buildDynamique($target, 'emailer', $component); if ($done) { // the text for the file ###BAKING### - $this->fileContentDynamic['emailer_'.$component]['###BAKING###'] = ''; // <<-- to insure it gets updated + $this->fileContentDynamic['emailer_' . $component]['###BAKING###'] = ''; // <<-- to insure it gets updated // return the code need to load the abstract class - return PHP_EOL."JLoader::register('".$Component."Email', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/".$component."email.php'); "; + return PHP_EOL . "JLoader::register('" . $Component . "Email', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/" . $component . "email.php'); "; } } return ''; @@ -242,19 +243,19 @@ class Interpretation extends Fields /** * set the lock license (NOT OKAY) - */ + */ public function setLockLicense() { if ($this->componentData->add_license && $this->componentData->license_type == 3) { if (!isset($this->fileContentStatic['###HELPER_SITE_LICENSE_LOCK###'])) { - $_VDM = '_'.ComponentbuilderHelper::safeString($this->uniquekey(10),'U'); + $_VDM = '_' . ComponentbuilderHelper::safeString($this->uniquekey(10), 'U'); // add it to the system - $this->fileContentStatic['###HELPER_SITE_LICENSE_LOCK###'] = $this->setHelperLicenseLock($_VDM,'site'); - $this->fileContentStatic['###HELPER_LICENSE_LOCK###'] = $this->setHelperLicenseLock($_VDM,'admin'); + $this->fileContentStatic['###HELPER_SITE_LICENSE_LOCK###'] = $this->setHelperLicenseLock($_VDM, 'site'); + $this->fileContentStatic['###HELPER_LICENSE_LOCK###'] = $this->setHelperLicenseLock($_VDM, 'admin'); $this->fileContentStatic['###LICENSE_LOCKED_INT###'] = $this->setInitLicenseLock($_VDM); - $this->fileContentStatic['###LICENSE_LOCKED_DEFINED###'] = PHP_EOL.PHP_EOL.'defined(\''.$_VDM.'\') or die(JText::_(\'NIE_REG_NIE\'));'; + $this->fileContentStatic['###LICENSE_LOCKED_DEFINED###'] = PHP_EOL . PHP_EOL . 'defined(\'' . $_VDM . '\') or die(JText::_(\'NIE_REG_NIE\'));'; } } else @@ -269,34 +270,34 @@ class Interpretation extends Fields /** * @param $view - */ + */ public function setLockLicensePer(&$view, $target) { if ($this->componentData->add_license && $this->componentData->license_type == 3) { if (!isset($this->fileContentDynamic[$view]['###BOOLMETHOD###'])) { - $boolMethod = 'get'.ComponentbuilderHelper::safeString($this->uniquekey(3, false, 'ddd'), 'W'); - $globalbool = 'set'.ComponentbuilderHelper::safeString($this->uniquekey(3), 'W'); + $boolMethod = 'get' . ComponentbuilderHelper::safeString($this->uniquekey(3, false, 'ddd'), 'W'); + $globalbool = 'set' . ComponentbuilderHelper::safeString($this->uniquekey(3), 'W'); // add it to the system - $this->fileContentDynamic[$view]['###LICENSE_LOCKED_SET_BOOL###'] = $this->setBoolLicenseLock($boolMethod,$globalbool); - $this->fileContentDynamic[$view]['###LICENSE_LOCKED_CHECK###'] = $this->checkStatmentLicenseLocked($boolMethod); - $this->fileContentDynamic[$view]['###LICENSE_TABLE_LOCKED_CHECK###'] = $this->checkStatmentLicenseLocked($boolMethod, '$table'); - $this->fileContentDynamic[$view]['###BOOLMETHOD###'] = $boolMethod; + $this->fileContentDynamic[$view]['###LICENSE_LOCKED_SET_BOOL###'] = $this->setBoolLicenseLock($boolMethod, $globalbool); + $this->fileContentDynamic[$view]['###LICENSE_LOCKED_CHECK###'] = $this->checkStatmentLicenseLocked($boolMethod); + $this->fileContentDynamic[$view]['###LICENSE_TABLE_LOCKED_CHECK###'] = $this->checkStatmentLicenseLocked($boolMethod, '$table'); + $this->fileContentDynamic[$view]['###BOOLMETHOD###'] = $boolMethod; } } else { // don't add it to the system - $this->fileContentDynamic[$view]['###LICENSE_LOCKED_SET_BOOL###'] = ''; - $this->fileContentDynamic[$view]['###LICENSE_LOCKED_CHECK###'] = ''; - $this->fileContentDynamic[$view]['###LICENSE_TABLE_LOCKED_CHECK###'] = ''; + $this->fileContentDynamic[$view]['###LICENSE_LOCKED_SET_BOOL###'] = ''; + $this->fileContentDynamic[$view]['###LICENSE_LOCKED_CHECK###'] = ''; + $this->fileContentDynamic[$view]['###LICENSE_TABLE_LOCKED_CHECK###'] = ''; } } - + public function checkStatmentLicenseLocked($boolMethod, $thIIS = '$this') { - $statment[] = PHP_EOL."\t\tif (!".$thIIS."->".$boolMethod."())"; + $statment[] = PHP_EOL . "\t\tif (!" . $thIIS . "->" . $boolMethod . "())"; $statment[] = "\t\t{"; $statment[] = "\t\t\t\$app = JFactory::getApplication();"; $statment[] = "\t\t\t\$app->enqueueMessage(JText::_('NIE_REG_NIE'), 'error');"; @@ -306,53 +307,53 @@ class Interpretation extends Fields // return the genuine mentod statement return implode(PHP_EOL, $statment); } - - public function setBoolLicenseLock($boolMethod,$globalbool) + + public function setBoolLicenseLock($boolMethod, $globalbool) { - $bool[] = PHP_EOL.PHP_EOL."\t/**"; + $bool[] = PHP_EOL . PHP_EOL . "\t/**"; $bool[] = "\t* The private bool."; $bool[] = "\t**/"; - $bool[] = "\tprivate $".$globalbool.";"; - $bool[] = PHP_EOL."\t/**"; + $bool[] = "\tprivate $" . $globalbool . ";"; + $bool[] = PHP_EOL . "\t/**"; $bool[] = "\t* Check if this install has a license."; $bool[] = "\t**/"; - $bool[] = "\tpublic function ".$boolMethod."()"; + $bool[] = "\tpublic function " . $boolMethod . "()"; $bool[] = "\t{"; - $bool[] = "\t\tif(!empty(\$this->".$globalbool."))"; + $bool[] = "\t\tif(!empty(\$this->" . $globalbool . "))"; $bool[] = "\t\t{"; - $bool[] = "\t\t\treturn \$this->".$globalbool.";"; + $bool[] = "\t\t\treturn \$this->" . $globalbool . ";"; $bool[] = "\t\t}"; - $bool[] = "\t\t//".$this->setLine(__LINE__)." Get the global params"; - $bool[] = "\t\t\$params = JComponentHelper::getParams('com_".$this->fileContentStatic['###component###']."', true);"; + $bool[] = "\t\t//" . $this->setLine(__LINE__) . " Get the global params"; + $bool[] = "\t\t\$params = JComponentHelper::getParams('com_" . $this->fileContentStatic['###component###'] . "', true);"; $bool[] = "\t\t\$license_key = \$params->get('license_key', null);"; $bool[] = "\t\tif (\$license_key)"; $bool[] = "\t\t{"; - $bool[] = "\t\t\t//".$this->setLine(__LINE__)." load the file"; - $bool[] = "\t\t\tJLoader::import( 'vdm', JPATH_ADMINISTRATOR .'/components/com_".$this->fileContentStatic['###component###']."');"; + $bool[] = "\t\t\t//" . $this->setLine(__LINE__) . " load the file"; + $bool[] = "\t\t\tJLoader::import( 'vdm', JPATH_ADMINISTRATOR .'/components/com_" . $this->fileContentStatic['###component###'] . "');"; $bool[] = "\t\t\t\$the = new VDM(\$license_key);"; - $bool[] = "\t\t\t\$this->".$globalbool." = \$the->_is;"; - $bool[] = "\t\t\treturn \$this->".$globalbool.";"; + $bool[] = "\t\t\t\$this->" . $globalbool . " = \$the->_is;"; + $bool[] = "\t\t\treturn \$this->" . $globalbool . ";"; $bool[] = "\t\t}"; $bool[] = "\t\treturn false;"; $bool[] = "\t}"; // return the genuine mentod statement return implode(PHP_EOL, $bool); } - - public function setHelperLicenseLock($_VDM,$target) + + public function setHelperLicenseLock($_VDM, $target) { - $helper[] = PHP_EOL.PHP_EOL."\t/**"; + $helper[] = PHP_EOL . PHP_EOL . "\t/**"; $helper[] = "\t* Check if this install has a license."; $helper[] = "\t**/"; $helper[] = "\tpublic static function isGenuine()"; $helper[] = "\t{"; - $helper[] = "\t\t//".$this->setLine(__LINE__)." Get the global params"; - $helper[] = "\t\t\$params = JComponentHelper::getParams('com_".$this->fileContentStatic['###component###']."', true);"; + $helper[] = "\t\t//" . $this->setLine(__LINE__) . " Get the global params"; + $helper[] = "\t\t\$params = JComponentHelper::getParams('com_" . $this->fileContentStatic['###component###'] . "', true);"; $helper[] = "\t\t\$license_key = \$params->get('license_key', null);"; $helper[] = "\t\tif (\$license_key)"; $helper[] = "\t\t{"; - $helper[] = "\t\t\t//".$this->setLine(__LINE__)." load the file"; - $helper[] = "\t\t\tJLoader::import( 'vdm', JPATH_ADMINISTRATOR .'/components/com_".$this->fileContentStatic['###component###']."');"; + $helper[] = "\t\t\t//" . $this->setLine(__LINE__) . " load the file"; + $helper[] = "\t\t\tJLoader::import( 'vdm', JPATH_ADMINISTRATOR .'/components/com_" . $this->fileContentStatic['###component###'] . "');"; $helper[] = "\t\t\t\$the = new VDM(\$license_key);"; $helper[] = "\t\t\treturn \$the->_is;"; $helper[] = "\t\t}"; @@ -361,21 +362,21 @@ class Interpretation extends Fields // return the genuine mentod statement return implode(PHP_EOL, $helper); } - + public function setInitLicenseLock($_VDM) { - $init[] = PHP_EOL."if (!defined('".$_VDM."'))"; + $init[] = PHP_EOL . "if (!defined('" . $_VDM . "'))"; $init[] = "{"; - $init[] = "\t\$allow = ".$this->fileContentStatic['###Component###']."Helper::isGenuine();"; + $init[] = "\t\$allow = " . $this->fileContentStatic['###Component###'] . "Helper::isGenuine();"; $init[] = "\tif (\$allow)"; $init[] = "\t{"; - $init[] = "\t\tdefine('".$_VDM."', 1);"; + $init[] = "\t\tdefine('" . $_VDM . "', 1);"; $init[] = "\t}"; $init[] = "}"; // return the initializing statement return implode(PHP_EOL, $init); } - + public function setVDMCryption() { // make sure we have the correct file @@ -397,9 +398,9 @@ class Interpretation extends Fields $theKey = base64_encode(serialize($key)); // set the script $encrypt[] = "/**"; - $encrypt[] = "* ".$this->setLine(__LINE__)."VDM Class "; + $encrypt[] = "* " . $this->setLine(__LINE__) . "VDM Class "; $encrypt[] = "**/"; - $encrypt[] = PHP_EOL."class VDM"; + $encrypt[] = PHP_EOL . "class VDM"; $encrypt[] = "{"; $encrypt[] = "\tpublic \$_key = false;"; $encrypt[] = "\tpublic \$_is = false;"; @@ -426,7 +427,7 @@ class Interpretation extends Fields $encrypt[] = "\t"; $encrypt[] = "\tprivate function get(\$Vk5smi0wjnjb,\$V2uekt2wcgwk)"; $encrypt[] = "\t{"; - $encrypt[] = "\t\t\$Viioj50xuqu2 = unserialize(base64_decode('".$theKey."'));"; + $encrypt[] = "\t\t\$Viioj50xuqu2 = unserialize(base64_decode('" . $theKey . "'));"; $encrypt[] = "\t\t\$Visqfrd1caus = time() . md5(mt_rand(1000000000, 9999999999) . \$Vk5smi0wjnjb);"; $encrypt[] = "\t\t\$Vo4tezfgcf3e = date(\"Ymd\");"; $encrypt[] = "\t\t\$Vozblwvfym2f = \$_SERVER['SERVER_NAME'];"; @@ -435,7 +436,7 @@ class Interpretation extends Fields $encrypt[] = "\t\t\$Vc2rayehw4f0 = unserialize(base64_decode('czozNjoibW9kdWxlcy9zZXJ2ZXJzL2xpY2Vuc2luZy92ZXJpZnkucGhwIjs='));"; $encrypt[] = "\t\t\$Vlpolphukogz = false;"; $encrypt[] = "\t\tif (\$V2uekt2wcgwk) {"; - $encrypt[] = "\t\t\t\$V2uekt2wcgwk = str_replace(\"".'".PHP_EOL."'."\", '', \$V2uekt2wcgwk);"; + $encrypt[] = "\t\t\t\$V2uekt2wcgwk = str_replace(\"" . '".PHP_EOL."' . "\", '', \$V2uekt2wcgwk);"; $encrypt[] = "\t\t\t\$Vm5cxjdc43g4 = substr(\$V2uekt2wcgwk, 0, strlen(\$V2uekt2wcgwk) - 32);"; $encrypt[] = "\t\t\t\$Vbgx0efeu2sy = substr(\$V2uekt2wcgwk, strlen(\$V2uekt2wcgwk) - 32);"; $encrypt[] = "\t\t\tif (\$Vbgx0efeu2sy == md5(\$Vm5cxjdc43g4 . \$Viioj50xuqu2['geheim'])) {"; @@ -496,7 +497,7 @@ class Interpretation extends Fields $encrypt[] = "\t\t\t} else {"; $encrypt[] = "\t\t\t\t\$Vrpmu4bvnmkp = fsockopen(\$Viioj50xuqu2['kasier'], 80, \$Vc0t5kmpwkwk, \$Va3g41fnofhu, 5);"; $encrypt[] = "\t\t\t\tif (\$Vrpmu4bvnmkp) {"; - $encrypt[] = "\t\t\t\t\t\$Vznkm0a0me1y = \"\r".PHP_EOL."\";"; + $encrypt[] = "\t\t\t\t\t\$Vznkm0a0me1y = \"\r" . PHP_EOL . "\";"; $encrypt[] = "\t\t\t\t\t\$V2sgyscukmgiop = \"POST \".\$Viioj50xuqu2['kasier'] . \$Vc2rayehw4f0 . \" HTTP/1.0\" . \$Vznkm0a0me1y;"; $encrypt[] = "\t\t\t\t\t\$V2sgyscukmgiop .= \"Host: \".\$Viioj50xuqu2['kasier'] . \$Vznkm0a0me1y;"; $encrypt[] = "\t\t\t\t\t\$V2sgyscukmgiop .= \"Content-type: application/x-www-form-urlencoded\" . \$Vznkm0a0me1y;"; @@ -525,7 +526,7 @@ class Interpretation extends Fields $encrypt[] = "\t\t\t\t\treturn \$Vwasqoybpyed;"; $encrypt[] = "\t\t\t\t}"; $encrypt[] = "\t\t\t} else {"; - $encrypt[] = "\t\t\t\tpreg_match_all('".'/<(.*?)>([^<]+)<\/\\1>/i'."', \$Vqojefyeohg5, \$V1ot20wob03f);"; + $encrypt[] = "\t\t\t\tpreg_match_all('" . '/<(.*?)>([^<]+)<\/\\1>/i' . "', \$Vqojefyeohg5, \$V1ot20wob03f);"; $encrypt[] = "\t\t\t\t\$Vwasqoybpyed = array();"; $encrypt[] = "\t\t\t\tforeach (\$V1ot20wob03f[1] AS \$V2sgyscukmgi=>\$V1u00zkzmb1d) {"; $encrypt[] = "\t\t\t\t\t\$Vwasqoybpyed[\$V1u00zkzmb1d] = \$V1ot20wob03f[2][\$V2sgyscukmgi];"; @@ -548,7 +549,7 @@ class Interpretation extends Fields $encrypt[] = "\t\t\t\t\$Vqojefyeohg5ing = md5(\$Vo4tezfgcf3e . \$Viioj50xuqu2['geheim']) . \$Vqojefyeohg5ing;"; $encrypt[] = "\t\t\t\t\$Vqojefyeohg5ing = strrev(\$Vqojefyeohg5ing);"; $encrypt[] = "\t\t\t\t\$Vqojefyeohg5ing = \$Vqojefyeohg5ing . md5(\$Vqojefyeohg5ing . \$Viioj50xuqu2['geheim']);"; - $encrypt[] = "\t\t\t\t\$Vqojefyeohg5ing = wordwrap(\$Vqojefyeohg5ing, 80, \"".'".PHP_EOL."'."\", true);"; + $encrypt[] = "\t\t\t\t\$Vqojefyeohg5ing = wordwrap(\$Vqojefyeohg5ing, 80, \"" . '".PHP_EOL."' . "\", true);"; $encrypt[] = "\t\t\t\t\$Vwasqoybpyed['eiegrendel'] = \$Vqojefyeohg5ing;"; $encrypt[] = "\t\t\t}"; $encrypt[] = "\t\t\t\$Vwasqoybpyed['nuut'] = true;"; @@ -559,7 +560,7 @@ class Interpretation extends Fields $encrypt[] = "}"; // return the help methods - return implode(PHP_EOL,$encrypt); + return implode(PHP_EOL, $encrypt); } } return ''; @@ -575,31 +576,31 @@ class Interpretation extends Fields { // set advanced encrypt file into place $target = array('admin' => 'encrypt'); - $done = $this->buildDynamique($target,'encrypt'); + $done = $this->buildDynamique($target, 'encrypt'); // the text for the file ###VDM_ENCRYPTION_BODY### $this->fileContentDynamic['encrypt']['###VDM_ENCRYPTION_BODY###'] = $this->setVDMCryption(); // ###ENCRYPT_FILE### - $this->fileContentStatic['###ENCRYPT_FILE###'] = PHP_EOL."\t\t\tvdm.php"; + $this->fileContentStatic['###ENCRYPT_FILE###'] = PHP_EOL . "\t\t\tvdm.php"; } // get component name - $component = $this->fileContentStatic['###component###']; + $component = $this->fileContentStatic['###component###']; // set the getCryptKey function to the helper class $function = array(); if (isset($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder)) { - $function[] = PHP_EOL.PHP_EOL."\tpublic static function getCryptKey(\$type, \$default = null)"; + $function[] = PHP_EOL . PHP_EOL . "\tpublic static function getCryptKey(\$type, \$default = null)"; $function[] = "\t{"; - $function[] = "\t\t//".$this->setLine(__LINE__)." Get the global params"; - $function[] = "\t\t\$params = JComponentHelper::getParams('com_".$component."', true);"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Get the global params"; + $function[] = "\t\t\$params = JComponentHelper::getParams('com_" . $component . "', true);"; $function[] = "\t\tif ('advanced' === \$type)"; $function[] = "\t\t{"; $function[] = "\t\t\t\$advanced_key = \$params->get('advanced_key', \$default);"; $function[] = "\t\t\tif (\$advanced_key)"; $function[] = "\t\t\t{"; - $function[] = "\t\t\t\t//".$this->setLine(__LINE__)." load the file"; + $function[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " load the file"; $function[] = "\t\t\t\tJLoader::import( 'vdm', JPATH_COMPONENT_ADMINISTRATOR);"; - $function[] = PHP_EOL."\t\t\t\t\$the = new VDM(\$advanced_key);"; - $function[] = PHP_EOL."\t\t\t\treturn \$the->_key;"; + $function[] = PHP_EOL . "\t\t\t\t\$the = new VDM(\$advanced_key);"; + $function[] = PHP_EOL . "\t\t\t\treturn \$the->_key;"; $function[] = "\t\t\t}"; $function[] = "\t\t}"; $function[] = "\t\telseif ('basic' === \$type)"; @@ -615,19 +616,19 @@ class Interpretation extends Fields } elseif (isset($this->advancedEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder)) { - $function[] = PHP_EOL.PHP_EOL."\tpublic static function getCryptKey(\$type, \$default = null)"; + $function[] = PHP_EOL . PHP_EOL . "\tpublic static function getCryptKey(\$type, \$default = null)"; $function[] = "\t{"; $function[] = "\t\tif ('advanced' === \$type)"; $function[] = "\t\t{"; - $function[] = "\t\t\t//".$this->setLine(__LINE__)." Get the global params"; - $function[] = "\t\t\t\$params = JComponentHelper::getParams('com_".$component."', true);"; + $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " Get the global params"; + $function[] = "\t\t\t\$params = JComponentHelper::getParams('com_" . $component . "', true);"; $function[] = "\t\t\t\$advanced_key = \$params->get('advanced_key', \$default);"; $function[] = "\t\t\tif (\$advanced_key)"; $function[] = "\t\t\t{"; - $function[] = "\t\t\t\t//".$this->setLine(__LINE__)." load the file"; + $function[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " load the file"; $function[] = "\t\t\t\tJLoader::import( 'vdm', JPATH_COMPONENT_ADMINISTRATOR);"; - $function[] = PHP_EOL."\t\t\t\t\$the = new VDM(\$advanced_key);"; - $function[] = PHP_EOL."\t\t\t\treturn \$the->_key;"; + $function[] = PHP_EOL . "\t\t\t\t\$the = new VDM(\$advanced_key);"; + $function[] = PHP_EOL . "\t\t\t\treturn \$the->_key;"; $function[] = "\t\t\t}"; $function[] = "\t\t}"; $function[] = "\t\treturn false;"; @@ -635,12 +636,12 @@ class Interpretation extends Fields } elseif (isset($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder)) { - $function[] = PHP_EOL.PHP_EOL."\tpublic static function getCryptKey(\$type, \$default = null)"; + $function[] = PHP_EOL . PHP_EOL . "\tpublic static function getCryptKey(\$type, \$default = null)"; $function[] = "\t{"; $function[] = "\t\tif ('basic' === \$type)"; $function[] = "\t\t{"; - $function[] = "\t\t\t//".$this->setLine(__LINE__)." Get the global params"; - $function[] = "\t\t\t\$params = JComponentHelper::getParams('com_".$component."', true);"; + $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " Get the global params"; + $function[] = "\t\t\t\$params = JComponentHelper::getParams('com_" . $component . "', true);"; $function[] = "\t\t\t\$basic_key = \$params->get('basic_key', \$default);"; $function[] = "\t\t\tif (\$basic_key)"; $function[] = "\t\t\t{"; @@ -651,11 +652,11 @@ class Interpretation extends Fields $function[] = "\t}"; } // return the help methods - return implode(PHP_EOL,$function); + return implode(PHP_EOL, $function); } return ''; } - + public function setVersionController() { if (ComponentbuilderHelper::checkArray($this->componentData->version_update) || ComponentbuilderHelper::checkArray($this->updateSQLBuilder)) @@ -666,7 +667,7 @@ class Interpretation extends Fields { $updateXML[] = ''; } - + // add the dynamic sql switch $addDynamicSQL = true; $addActive = true; @@ -675,7 +676,7 @@ class Interpretation extends Fields foreach ($this->componentData->version_update as $nr => &$update) { $this->setUpdateXMLSQL($update, $updateXML, $addDynamicSQL); - + if ($update['version'] == $this->componentData->component_version) { $addActive = false; @@ -701,9 +702,9 @@ class Interpretation extends Fields // ###UPDATE_SERVER_XML### $name = str_replace('.xml', '', substr($this->componentData->update_server, strrpos($this->componentData->update_server, '/') + 1)); $target = array('admin' => $name); - $this->buildDynamique($target,'update_server'); + $this->buildDynamique($target, 'update_server'); $this->fileContentDynamic[$name]['###UPDATE_SERVER_XML###'] = implode(PHP_EOL, $updateXML); - + // set the Update server file name $this->updateServerFileName = $name; } @@ -713,8 +714,8 @@ class Interpretation extends Fields { // ###UPDATESERVER### $updateServer = array(); - $updateServer[] = PHP_EOL."\t"; - $updateServer[] = "\t\t".''.$this->componentData->update_server.''; + $updateServer[] = PHP_EOL . "\t"; + $updateServer[] = "\t\t" . '' . $this->componentData->update_server . ''; $updateServer[] = "\t"; // return the array to string $updateServer = implode(PHP_EOL, $updateServer); @@ -733,9 +734,9 @@ class Interpretation extends Fields $nr = 0; foreach ($this->componentData->version_update as $values) { - $buket['version_update'.$nr] = $values; + $buket['version_update' . $nr] = $values; $nr++; - } + } // update the joomla component table $newJ = array(); $newJ['id'] = (int) $this->componentID; @@ -743,7 +744,6 @@ class Interpretation extends Fields // update the component with the new dynamic SQL $modelJ = ComponentbuilderHelper::getModel('joomla_component'); $modelJ->save($newJ); // <-- to insure the history is also updated - // reset the watch here $this->getHistoryWatch('joomla_component', $this->componentID); @@ -762,8 +762,8 @@ class Interpretation extends Fields $modelU = ComponentbuilderHelper::getModel('component_updates'); $modelU->save($newU); // <-- to insure the history is also updated } - } - + } + public function setDynamicUpdateXMLSQL(&$updateXML, $current_version = false) { // start building the update @@ -782,15 +782,15 @@ class Interpretation extends Fields // setup new version $update_['version'] = $this->componentData->old_component_version; // setup SQL - $update_['mysql'] = trim(implode(PHP_EOL.PHP_EOL, $this->updateSQLBuilder)); + $update_['mysql'] = trim(implode(PHP_EOL . PHP_EOL, $this->updateSQLBuilder)); // setup URL if (isset($this->lastupdateURL)) { $paceholders = array( $this->componentData->component_version => $this->componentData->old_component_version, - str_replace('.','-', $this->componentData->component_version) => str_replace('.','-', $this->componentData->old_component_version), - str_replace('.','_', $this->componentData->component_version) => str_replace('.','_', $this->componentData->old_component_version), - str_replace('.','', $this->componentData->component_version) => str_replace('.','', $this->componentData->old_component_version) + str_replace('.', '-', $this->componentData->component_version) => str_replace('.', '-', $this->componentData->old_component_version), + str_replace('.', '_', $this->componentData->component_version) => str_replace('.', '_', $this->componentData->old_component_version), + str_replace('.', '', $this->componentData->component_version) => str_replace('.', '', $this->componentData->old_component_version) ); $update_['url'] = $this->setPlaceholders($this->lastupdateURL, $paceholders); } @@ -806,7 +806,7 @@ class Interpretation extends Fields // add dynamic SQL $this->setUpdateXMLSQL($update_, $updateXML, $addDynamicSQL); } - + public function setUpdateXMLSQL(&$update, &$updateXML, &$addDynamicSQL) { // ensure version naming is correct @@ -818,8 +818,7 @@ class Interpretation extends Fields } // add dynamic SQL $force = false; - if ($addDynamicSQL && ComponentbuilderHelper::checkArray($this->updateSQLBuilder) - && (isset($this->componentData->old_component_version) && $this->componentData->old_component_version == $update['version'])) + if ($addDynamicSQL && ComponentbuilderHelper::checkArray($this->updateSQLBuilder) && (isset($this->componentData->old_component_version) && $this->componentData->old_component_version == $update['version'])) { $searchMySQL = preg_replace('/\s+/', '', $update['mysql']); // add the updates to the SQL only if not found @@ -827,7 +826,7 @@ class Interpretation extends Fields { if (strpos($searchMySQL, $search) === FALSE) { - $update['mysql'] .= PHP_EOL.PHP_EOL.$query; + $update['mysql'] .= PHP_EOL . PHP_EOL . $query; } } // make sure no unneeded white space is added @@ -840,8 +839,8 @@ class Interpretation extends Fields { $name = ComponentbuilderHelper::safeString($update['version']); $target = array('admin' => $name); - $this->buildDynamique($target,'sql_update',$update['version']); - $this->fileContentDynamic[$name.'_'.$update['version']]['###UPDATE_VERSION_MYSQL###'] = $update['mysql']; + $this->buildDynamique($target, 'sql_update', $update['version']); + $this->fileContentDynamic[$name . '_' . $update['version']]['###UPDATE_VERSION_MYSQL###'] = $update['mysql']; } elseif (isset($update['url']) && ComponentbuilderHelper::checkString($update['url'])) { @@ -852,25 +851,25 @@ class Interpretation extends Fields { // build update xml $updateXML[] = "\t"; - $updateXML[] = "\t\t".$this->fileContentStatic['###Component_name###'].""; - $updateXML[] = "\t\t".$this->fileContentStatic['###SHORT_DESCRIPTION###'].""; - $updateXML[] = "\t\tcom_".$this->fileContentStatic['###component###'].""; + $updateXML[] = "\t\t" . $this->fileContentStatic['###Component_name###'] . ""; + $updateXML[] = "\t\t" . $this->fileContentStatic['###SHORT_DESCRIPTION###'] . ""; + $updateXML[] = "\t\tcom_" . $this->fileContentStatic['###component###'] . ""; $updateXML[] = "\t\tcomponent"; - $updateXML[] = "\t\t".$update['version'].""; - $updateXML[] = "\t\t".''.$this->fileContentStatic['###AUTHORWEBSITE###'].''; + $updateXML[] = "\t\t" . $update['version'] . ""; + $updateXML[] = "\t\t" . '' . $this->fileContentStatic['###AUTHORWEBSITE###'] . ''; $updateXML[] = "\t\t"; if (!isset($update['url']) || !ComponentbuilderHelper::checkString($update['url'])) { $update['url'] = 'http://domain.com/demo.zip'; } - $updateXML[] = "\t\t\t".''.$update['url'].''; + $updateXML[] = "\t\t\t" . '' . $update['url'] . ''; $updateXML[] = "\t\t"; $updateXML[] = "\t\t"; $updateXML[] = "\t\t\tstable"; $updateXML[] = "\t\t"; - $updateXML[] = "\t\t".$this->fileContentStatic['###AUTHOR###'].""; - $updateXML[] = "\t\t".$this->fileContentStatic['###AUTHORWEBSITE###'].""; - $updateXML[] = "\t\t".''; + $updateXML[] = "\t\t" . $this->fileContentStatic['###AUTHOR###'] . ""; + $updateXML[] = "\t\t" . $this->fileContentStatic['###AUTHORWEBSITE###'] . ""; + $updateXML[] = "\t\t" . ''; $updateXML[] = "\t"; } } @@ -878,7 +877,7 @@ class Interpretation extends Fields public function noHelp() { $help = array(); - $help[] = PHP_EOL.PHP_EOL."\t/**"; + $help[] = PHP_EOL . PHP_EOL . "\t/**"; $help[] = "\t* Can be used to build help urls."; $help[] = "\t**/"; $help[] = "\tpublic static function getHelpUrl(\$view)"; @@ -886,7 +885,7 @@ class Interpretation extends Fields $help[] = "\t\treturn false;"; $help[] = "\t}"; // return the no help method - return implode(PHP_EOL,$help); + return implode(PHP_EOL, $help); } public function checkHelp($viewName_single) @@ -895,10 +894,10 @@ class Interpretation extends Fields { // set help file into admin place $target = array('admin' => 'help'); - $admindone = $this->buildDynamique($target,'help'); + $admindone = $this->buildDynamique($target, 'help'); // set the help file into site place $target = array('site' => 'help'); - $sitedone = $this->buildDynamique($target,'help'); + $sitedone = $this->buildDynamique($target, 'help'); if ($admindone && $sitedone) { // ###HELP### @@ -922,7 +921,7 @@ class Interpretation extends Fields $target = 'site_view'; } $help = array(); - $help[] = PHP_EOL.PHP_EOL."\t/**"; + $help[] = PHP_EOL . PHP_EOL . "\t/**"; $help[] = "\t* Load the Component Help URLs."; $help[] = "\t**/"; $help[] = "\tpublic static function getHelpUrl(\$view)"; @@ -932,9 +931,9 @@ class Interpretation extends Fields $help[] = "\t\t\$db = JFactory::getDbo();"; $help[] = "\t\t\$query = \$db->getQuery(true);"; $help[] = "\t\t\$query->select(array('a.id','a.groups','a.target','a.type','a.article','a.url'));"; - $help[] = "\t\t\$query->from('#__".$this->fileContentStatic['###component###']."_help_document AS a');"; - $help[] = "\t\t\$query->where('a.".$target." = '.\$db->quote(\$view));"; - $help[] = "\t\t\$query->where('a.location = ".(int) $location."');"; + $help[] = "\t\t\$query->from('#__" . $this->fileContentStatic['###component###'] . "_help_document AS a');"; + $help[] = "\t\t\$query->where('a." . $target . " = '.\$db->quote(\$view));"; + $help[] = "\t\t\$query->where('a.location = " . (int) $location . "');"; $help[] = "\t\t\$query->where('a.published = 1');"; $help[] = "\t\t\$db->setQuery(\$query);"; $help[] = "\t\t\$db->execute();"; @@ -950,23 +949,23 @@ class Interpretation extends Fields $help[] = "\t\t\t\t\t\t\$targetgroups = json_decode(\$help->groups, true);"; $help[] = "\t\t\t\t\t\tif (!array_intersect(\$targetgroups, \$groups))"; $help[] = "\t\t\t\t\t\t{"; - $help[] = "\t\t\t\t\t\t\t//".$this->setLine(__LINE__)." if user not in those target groups then remove the item"; + $help[] = "\t\t\t\t\t\t\t//" . $this->setLine(__LINE__) . " if user not in those target groups then remove the item"; $help[] = "\t\t\t\t\t\t\tunset(\$helps[\$nr]);"; $help[] = "\t\t\t\t\t\t\tcontinue;"; $help[] = "\t\t\t\t\t\t}"; $help[] = "\t\t\t\t\t}"; - $help[] = "\t\t\t\t\t//".$this->setLine(__LINE__)." set the return type"; + $help[] = "\t\t\t\t\t//" . $this->setLine(__LINE__) . " set the return type"; $help[] = "\t\t\t\t\tswitch (\$help->type)"; $help[] = "\t\t\t\t\t{"; - $help[] = "\t\t\t\t\t\t//".$this->setLine(__LINE__)." set joomla article"; + $help[] = "\t\t\t\t\t\t//" . $this->setLine(__LINE__) . " set joomla article"; $help[] = "\t\t\t\t\t\tcase 1:"; $help[] = "\t\t\t\t\t\t\treturn self::loadArticleLink(\$help->article);"; $help[] = "\t\t\t\t\t\tbreak;"; - $help[] = "\t\t\t\t\t\t//".$this->setLine(__LINE__)." set help text"; + $help[] = "\t\t\t\t\t\t//" . $this->setLine(__LINE__) . " set help text"; $help[] = "\t\t\t\t\t\tcase 2:"; $help[] = "\t\t\t\t\t\t\treturn self::loadHelpTextLink(\$help->id);"; $help[] = "\t\t\t\t\t\tbreak;"; - $help[] = "\t\t\t\t\t\t//".$this->setLine(__LINE__)." set Link"; + $help[] = "\t\t\t\t\t\t//" . $this->setLine(__LINE__) . " set Link"; $help[] = "\t\t\t\t\t\tcase 3:"; $help[] = "\t\t\t\t\t\t\treturn \$help->url;"; $help[] = "\t\t\t\t\t\tbreak;"; @@ -976,23 +975,23 @@ class Interpretation extends Fields $help[] = "\t\t}"; $help[] = "\t\treturn false;"; $help[] = "\t}"; - $help[] = PHP_EOL."\t/**"; + $help[] = PHP_EOL . "\t/**"; $help[] = "\t* Get the Article Link."; $help[] = "\t**/"; $help[] = "\tprotected static function loadArticleLink(\$id)"; $help[] = "\t{"; $help[] = "\t\treturn JURI::root().'index.php?option=com_content&view=article&id='.\$id.'&tmpl=component&layout=modal';"; $help[] = "\t}"; - $help[] = PHP_EOL."\t/**"; + $help[] = PHP_EOL . "\t/**"; $help[] = "\t* Get the Help Text Link."; $help[] = "\t**/"; $help[] = "\tprotected static function loadHelpTextLink(\$id)"; $help[] = "\t{"; $help[] = "\t\t\$token = JSession::getFormToken();"; - $help[] = "\t\treturn 'index.php?option=com_".$this->fileContentStatic['###component###']."&task=help.getText&id=' . (int) \$id . '&token=' . \$token;"; + $help[] = "\t\treturn 'index.php?option=com_" . $this->fileContentStatic['###component###'] . "&task=help.getText&id=' . (int) \$id . '&token=' . \$token;"; $help[] = "\t}"; // return the help methods - return implode(PHP_EOL,$help); + return implode(PHP_EOL, $help); } public function setExelHelperMethods() @@ -1000,44 +999,44 @@ class Interpretation extends Fields if ($this->addEximport) { $exel = array(); - $exel[] = PHP_EOL.PHP_EOL."\t/**"; + $exel[] = PHP_EOL . PHP_EOL . "\t/**"; $exel[] = "\t * Prepares the xml document"; $exel[] = "\t */"; - $exel[] = "\tpublic static function xls(\$rows,\$fileName = null,\$title = null,\$subjectTab = null,\$creator = '".$this->fileContentStatic['###COMPANYNAME###']."',\$description = null,\$category = null,\$keywords = null,\$modified = null)"; + $exel[] = "\tpublic static function xls(\$rows,\$fileName = null,\$title = null,\$subjectTab = null,\$creator = '" . $this->fileContentStatic['###COMPANYNAME###'] . "',\$description = null,\$category = null,\$keywords = null,\$modified = null)"; $exel[] = "\t{"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." set the user"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " set the user"; $exel[] = "\t\t\$user = JFactory::getUser();"; $exel[] = "\t\t"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." set fieldname if not set"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " set fieldname if not set"; $exel[] = "\t\tif (!\$fileName)"; $exel[] = "\t\t{"; $exel[] = "\t\t\t\$fileName = 'exported_'.JFactory::getDate()->format('jS_F_Y');"; $exel[] = "\t\t}"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." set modiefied if not set"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " set modiefied if not set"; $exel[] = "\t\tif (!\$modified)"; $exel[] = "\t\t{"; $exel[] = "\t\t\t\$modified = \$user->name;"; $exel[] = "\t\t}"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." set title if not set"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " set title if not set"; $exel[] = "\t\tif (!\$title)"; $exel[] = "\t\t{"; $exel[] = "\t\t\t\$title = 'Book1';"; $exel[] = "\t\t}"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." set tab name if not set"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " set tab name if not set"; $exel[] = "\t\tif (!\$subjectTab)"; $exel[] = "\t\t{"; $exel[] = "\t\t\t\$subjectTab = 'Sheet1';"; $exel[] = "\t\t}"; $exel[] = "\t\t"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." make sure the file is loaded\t\t"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " make sure the file is loaded\t\t"; $exel[] = "\t\tJLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');"; $exel[] = "\t\t"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." Create new PHPExcel object"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " Create new PHPExcel object"; $exel[] = "\t\t\$objPHPExcel = new PHPExcel();"; $exel[] = "\t\t"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." Set document properties"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " Set document properties"; $exel[] = "\t\t\$objPHPExcel->getProperties()->setCreator(\$creator)"; - $exel[] = "\t\t\t\t\t\t\t\t\t ->setCompany('".$this->fileContentStatic['###COMPANYNAME###']."')"; + $exel[] = "\t\t\t\t\t\t\t\t\t ->setCompany('" . $this->fileContentStatic['###COMPANYNAME###'] . "')"; $exel[] = "\t\t\t\t\t\t\t\t\t ->setLastModifiedBy(\$modified)"; $exel[] = "\t\t\t\t\t\t\t\t\t ->setTitle(\$title)"; $exel[] = "\t\t\t\t\t\t\t\t\t ->setSubject(\$subjectTab);"; @@ -1054,7 +1053,7 @@ class Interpretation extends Fields $exel[] = "\t\t\t\$objPHPExcel->getProperties()->setCategory(\$category);"; $exel[] = "\t\t}"; $exel[] = "\t\t"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." Some styles"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " Some styles"; $exel[] = "\t\t\$headerStyles = array("; $exel[] = "\t\t\t'font' => array("; $exel[] = "\t\t\t\t'bold' => true,"; @@ -1076,7 +1075,7 @@ class Interpretation extends Fields $exel[] = "\t\t\t\t'name' => 'Verdana'"; $exel[] = "\t\t));"; $exel[] = "\t\t"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." Add some data"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " Add some data"; $exel[] = "\t\tif (self::checkArray(\$rows))"; $exel[] = "\t\t{"; $exel[] = "\t\t\t\$i = 1;"; @@ -1103,20 +1102,20 @@ class Interpretation extends Fields $exel[] = "\t\t\treturn false;"; $exel[] = "\t\t}"; $exel[] = "\t\t"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." Rename worksheet"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " Rename worksheet"; $exel[] = "\t\t\$objPHPExcel->getActiveSheet()->setTitle(\$subjectTab);"; $exel[] = "\t\t"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." Set active sheet index to the first sheet, so Excel opens this as the first sheet"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " Set active sheet index to the first sheet, so Excel opens this as the first sheet"; $exel[] = "\t\t\$objPHPExcel->setActiveSheetIndex(0);"; $exel[] = "\t\t"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." Redirect output to a client's web browser (Excel5)"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " Redirect output to a client's web browser (Excel5)"; $exel[] = "\t\theader('Content-Type: application/vnd.ms-excel');"; $exel[] = "\t\theader('Content-Disposition: attachment;filename=\"'.\$fileName.'.xls\"');"; $exel[] = "\t\theader('Cache-Control: max-age=0');"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." If you're serving to IE 9, then the following may be needed"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " If you're serving to IE 9, then the following may be needed"; $exel[] = "\t\theader('Cache-Control: max-age=1');"; $exel[] = "\t\t"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." If you're serving to IE over SSL, then the following may be needed"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " If you're serving to IE over SSL, then the following may be needed"; $exel[] = "\t\theader ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past"; $exel[] = "\t\theader ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified"; $exel[] = "\t\theader ('Cache-Control: cache, must-revalidate'); // HTTP/1.1"; @@ -1132,27 +1131,27 @@ class Interpretation extends Fields $exel[] = "\t*/"; $exel[] = "\tpublic static function getFileHeaders(\$dataType)"; $exel[] = "\t{\t\t"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." make sure these files are loaded\t\t"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " make sure these files are loaded\t\t"; $exel[] = "\t\tJLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');"; $exel[] = "\t\tJLoader::import('ChunkReadFilter', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/PHPExcel/Reader');"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." get session object"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " get session object"; $exel[] = "\t\t\$session\t= JFactory::getSession();"; $exel[] = "\t\t\$package\t= \$session->get('package', null);"; $exel[] = "\t\t\$package\t= json_decode(\$package, true);"; - $exel[] = "\t\t//".$this->setLine(__LINE__)." set the headers"; + $exel[] = "\t\t//" . $this->setLine(__LINE__) . " set the headers"; $exel[] = "\t\tif(isset(\$package['dir']))"; $exel[] = "\t\t{"; $exel[] = "\t\t\t\$chunkFilter = new PHPExcel_Reader_chunkReadFilter();"; - $exel[] = "\t\t\t//".$this->setLine(__LINE__)." only load first three rows"; + $exel[] = "\t\t\t//" . $this->setLine(__LINE__) . " only load first three rows"; $exel[] = "\t\t\t\$chunkFilter->setRows(2,1);"; - $exel[] = "\t\t\t//".$this->setLine(__LINE__)." identify the file type"; + $exel[] = "\t\t\t//" . $this->setLine(__LINE__) . " identify the file type"; $exel[] = "\t\t\t\$inputFileType = PHPExcel_IOFactory::identify(\$package['dir']);"; - $exel[] = "\t\t\t//".$this->setLine(__LINE__)." create the reader for this file type"; + $exel[] = "\t\t\t//" . $this->setLine(__LINE__) . " create the reader for this file type"; $exel[] = "\t\t\t\$excelReader = PHPExcel_IOFactory::createReader(\$inputFileType);"; - $exel[] = "\t\t\t//".$this->setLine(__LINE__)." load the limiting filter"; + $exel[] = "\t\t\t//" . $this->setLine(__LINE__) . " load the limiting filter"; $exel[] = "\t\t\t\$excelReader->setReadFilter(\$chunkFilter);"; $exel[] = "\t\t\t\$excelReader->setReadDataOnly(true);"; - $exel[] = "\t\t\t//".$this->setLine(__LINE__)." load the rows (only first three)"; + $exel[] = "\t\t\t//" . $this->setLine(__LINE__) . " load the rows (only first three)"; $exel[] = "\t\t\t\$excelObj = \$excelReader->load(\$package['dir']);"; $exel[] = "\t\t\t\$headers = array();"; $exel[] = "\t\t\tforeach (\$excelObj->getActiveSheet()->getRowIterator() as \$row)"; @@ -1178,7 +1177,7 @@ class Interpretation extends Fields $exel[] = "\t\treturn false;"; $exel[] = "\t}"; // return the help methods - return implode(PHP_EOL,$exel); + return implode(PHP_EOL, $exel); } return ''; } @@ -1188,43 +1187,43 @@ class Interpretation extends Fields if ($add) { $method = array(); - $method[] = PHP_EOL.PHP_EOL."\t/**"; + $method[] = PHP_EOL . PHP_EOL . "\t/**"; $method[] = "\t* Greate user and update given table"; $method[] = "\t*/"; $method[] = "\tpublic static function createUser(\$new)"; $method[] = "\t{"; - $method[] = "\t\t//".$this->setLine(__LINE__)." load the user component language files if there is an error."; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " load the user component language files if there is an error."; $method[] = "\t\t\$lang = JFactory::getLanguage();"; $method[] = "\t\t\$extension = 'com_users';"; $method[] = "\t\t\$base_dir = JPATH_SITE;"; $method[] = "\t\t\$language_tag = 'en-GB';"; $method[] = "\t\t\$reload = true;"; $method[] = "\t\t\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);"; - $method[] = "\t\t//".$this->setLine(__LINE__)." load the user regestration model"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " load the user regestration model"; $method[] = "\t\t\$model = self::getModel('registration', JPATH_ROOT. '/components/com_users', 'Users');"; - $method[] = "\t\t//".$this->setLine(__LINE__)." make sure no activation is needed"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " make sure no activation is needed"; $method[] = "\t\t\$useractivation = self::setParams('com_users','useractivation',0);"; - $method[] = "\t\t//".$this->setLine(__LINE__)." make sure password is send"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " make sure password is send"; $method[] = "\t\t\$sendpassword = self::setParams('com_users','sendpassword',1);"; - $method[] = "\t\t//".$this->setLine(__LINE__)." Check if password was set"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " Check if password was set"; $method[] = "\t\tif (isset(\$new['password']) && isset(\$new['password2']) && self::checkString(\$new['password']) && self::checkString(\$new['password2']))"; $method[] = "\t\t{"; - $method[] = "\t\t\t//".$this->setLine(__LINE__)." Use the users passwords"; + $method[] = "\t\t\t//" . $this->setLine(__LINE__) . " Use the users passwords"; $method[] = "\t\t\t\$password = \$new['password'];"; $method[] = "\t\t\t\$password2 = \$new['password2'];"; $method[] = "\t\t}"; $method[] = "\t\telse"; $method[] = "\t\t{"; - $method[] = "\t\t\t//".$this->setLine(__LINE__)." Set random password"; + $method[] = "\t\t\t//" . $this->setLine(__LINE__) . " Set random password"; $method[] = "\t\t\t\$password = self::randomkey(8);"; $method[] = "\t\t\t\$password2 = \$password;"; $method[] = "\t\t}"; - $method[] = "\t\t//".$this->setLine(__LINE__)." set username if not set"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " set username if not set"; $method[] = "\t\tif (!isset(\$new['username']) || !self::checkString(\$new['username']))"; $method[] = "\t\t{"; $method[] = "\t\t\t\$new['username'] = self::safeString(\$new['name']);"; $method[] = "\t\t}"; - $method[] = "\t\t//".$this->setLine(__LINE__)." linup new user data"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " linup new user data"; $method[] = "\t\t\$data = array("; $method[] = "\t\t\t'username' => \$new['username'],"; $method[] = "\t\t\t'name' => \$new['name'],"; @@ -1232,13 +1231,13 @@ class Interpretation extends Fields $method[] = "\t\t\t'password1' => \$password, // First password field"; $method[] = "\t\t\t'password2' => \$password2, // Confirm password field"; $method[] = "\t\t\t'block' => 0 );"; - $method[] = "\t\t//".$this->setLine(__LINE__)." register the new user"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " register the new user"; $method[] = "\t\t\$userId = \$model->register(\$data);"; - $method[] = "\t\t//".$this->setLine(__LINE__)." set activation back to default"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " set activation back to default"; $method[] = "\t\tself::setParams('com_users','useractivation',\$useractivation);"; - $method[] = "\t\t//".$this->setLine(__LINE__)." set send password back to default"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " set send password back to default"; $method[] = "\t\tself::setParams('com_users','sendpassword',\$sendpassword);"; - $method[] = "\t\t//".$this->setLine(__LINE__)." if user is created"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " if user is created"; $method[] = "\t\tif (\$userId > 0)"; $method[] = "\t\t{"; $method[] = "\t\t\treturn \$userId;"; @@ -1246,30 +1245,30 @@ class Interpretation extends Fields $method[] = "\t\treturn \$model->getError();"; $method[] = "\t}"; - $method[] = PHP_EOL."\tprotected static function setParams(\$component,\$target,\$value)"; + $method[] = PHP_EOL . "\tprotected static function setParams(\$component,\$target,\$value)"; $method[] = "\t{"; - $method[] = "\t\t//".$this->setLine(__LINE__)." Get the params and set the new values"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " Get the params and set the new values"; $method[] = "\t\t\$params = JComponentHelper::getParams(\$component);"; $method[] = "\t\t\$was = \$params->get(\$target, null);"; $method[] = "\t\tif (\$was != \$value)"; $method[] = "\t\t{"; $method[] = "\t\t\t\$params->set(\$target, \$value);"; - $method[] = "\t\t\t//".$this->setLine(__LINE__)." Get a new database query instance"; + $method[] = "\t\t\t//" . $this->setLine(__LINE__) . " Get a new database query instance"; $method[] = "\t\t\t\$db = JFactory::getDBO();"; $method[] = "\t\t\t\$query = \$db->getQuery(true);"; - $method[] = "\t\t\t//".$this->setLine(__LINE__)." Build the query"; + $method[] = "\t\t\t//" . $this->setLine(__LINE__) . " Build the query"; $method[] = "\t\t\t\$query->update('#__extensions AS a');"; $method[] = "\t\t\t\$query->set('a.params = ' . \$db->quote((string)\$params));"; $method[] = "\t\t\t\$query->where('a.element = ' . \$db->quote((string)\$component));"; $method[] = "\t\t\t"; - $method[] = "\t\t\t//".$this->setLine(__LINE__)." Execute the query"; + $method[] = "\t\t\t//" . $this->setLine(__LINE__) . " Execute the query"; $method[] = "\t\t\t\$db->setQuery(\$query);"; $method[] = "\t\t\t\$db->query();"; $method[] = "\t\t}"; $method[] = "\t\treturn \$was;"; $method[] = "\t}"; - - $method[] = PHP_EOL."\t/**"; + + $method[] = PHP_EOL . "\t/**"; $method[] = "\t* Update user values"; $method[] = "\t*/"; $method[] = "\tpublic static function updateUser(\$new)"; @@ -1319,7 +1318,7 @@ class Interpretation extends Fields $method[] = "\t}"; // return the help method - return implode(PHP_EOL,$method); + return implode(PHP_EOL, $method); } return ''; } @@ -1329,85 +1328,85 @@ class Interpretation extends Fields $xml = ''; // build the file $target = array('site' => $view['settings']->code); - $done = $this->buildDynamique($target,'menu'); + $done = $this->buildDynamique($target, 'menu'); if ($done) { // set the lang - $lang = ComponentbuilderHelper::safeString('com_'.$this->fileContentStatic['###component###'].'_menu_'.$view['settings']->code, 'U'); - $this->langContent['adminsys'][$lang.'_TITLE'] = $view['settings']->name; - $this->langContent['adminsys'][$lang.'_OPTION'] = $view['settings']->name; - $this->langContent['adminsys'][$lang.'_DESC'] = $view['settings']->description; + $lang = ComponentbuilderHelper::safeString('com_' . $this->fileContentStatic['###component###'] . '_menu_' . $view['settings']->code, 'U'); + $this->langContent['adminsys'][$lang . '_TITLE'] = $view['settings']->name; + $this->langContent['adminsys'][$lang . '_OPTION'] = $view['settings']->name; + $this->langContent['adminsys'][$lang . '_DESC'] = $view['settings']->description; //start loading xml $xml = ''; - $xml .= PHP_EOL.''; - $xml .= PHP_EOL."\t".''; - $xml .= PHP_EOL."\t\t".''; - $xml .= PHP_EOL."\t\t\t".''; - $xml .= PHP_EOL."\t\t".''; - $xml .= PHP_EOL."\t".''; + $xml .= PHP_EOL . ''; + $xml .= PHP_EOL . "\t" . ''; + $xml .= PHP_EOL . "\t\t" . ''; + $xml .= PHP_EOL . "\t\t\t" . ''; + $xml .= PHP_EOL . "\t\t" . ''; + $xml .= PHP_EOL . "\t" . ''; if (isset($this->hasIdRequest[$view['settings']->code]) || isset($this->hasCatIdRequest[$view['settings']->code])) { - $xml .= PHP_EOL."\t".''; - $xml .= PHP_EOL."\t".''; - $xml .= PHP_EOL."\t\t".'
fileContentStatic['###component###'].'/models/rules"'; - $xml .= PHP_EOL."\t\t\t".'addfieldpath="/administrator/components/com_'.$this->fileContentStatic['###component###'].'/models/fields">'; + $xml .= PHP_EOL . "\t" . ''; + $xml .= PHP_EOL . "\t" . ''; + $xml .= PHP_EOL . "\t\t" . '
'; if (isset($this->hasIdRequest[$view['settings']->code]) && ComponentbuilderHelper::checkArray($this->hasIdRequest[$view['settings']->code])) { - foreach($this->hasIdRequest[$view['settings']->code] as $requestFieldXML) + foreach ($this->hasIdRequest[$view['settings']->code] as $requestFieldXML) { - $xml .= PHP_EOL."\t\t\t".$requestFieldXML; + $xml .= PHP_EOL . "\t\t\t" . $requestFieldXML; } } if (isset($this->hasCatIdRequest[$view['settings']->code]) && ComponentbuilderHelper::checkArray($this->hasCatIdRequest[$view['settings']->code])) { - foreach($this->hasCatIdRequest[$view['settings']->code] as $requestFieldXML) + foreach ($this->hasCatIdRequest[$view['settings']->code] as $requestFieldXML) { - $xml .= PHP_EOL."\t\t\t".$requestFieldXML; + $xml .= PHP_EOL . "\t\t\t" . $requestFieldXML; } } - $xml .= PHP_EOL."\t\t".'
'; - $xml .= PHP_EOL."\t".'
'; + $xml .= PHP_EOL . "\t\t" . '
'; + $xml .= PHP_EOL . "\t" . '
'; } if (isset($this->frontEndParams) && isset($this->frontEndParams[$view['settings']->name])) { // first we must setup the fields for the page use - $params = $this->setupFrontendParamFields($this->frontEndParams[$view['settings']->name],$view['settings']->code); + $params = $this->setupFrontendParamFields($this->frontEndParams[$view['settings']->name], $view['settings']->code); // now load the fields if (ComponentbuilderHelper::checkArray($params)) { - $xml .= PHP_EOL."\t".''; - $xml .= PHP_EOL."\t".''; - $xml .= PHP_EOL."\t\t".'
fileContentStatic['###component###'].'/models/rules"'; - $xml .= PHP_EOL."\t\t\t".'addfieldpath="/administrator/components/com_'.$this->fileContentStatic['###component###'].'/models/fields">'; - $xml .= implode("\t\t\t",$params); - $xml .= PHP_EOL."\t\t".'
'; - $xml .= PHP_EOL."\t".'
'; + $xml .= PHP_EOL . "\t" . ''; + $xml .= PHP_EOL . "\t" . ''; + $xml .= PHP_EOL . "\t\t" . '
'; + $xml .= implode("\t\t\t", $params); + $xml .= PHP_EOL . "\t\t" . '
'; + $xml .= PHP_EOL . "\t" . '
'; } } - $xml .= PHP_EOL.'
'; + $xml .= PHP_EOL . '
'; } return $xml; } - - public function setupFrontendParamFields($params,$view) + + public function setupFrontendParamFields($params, $view) { $keep = array(); - $menuSetter = $view.'_menu'; + $menuSetter = $view . '_menu'; foreach ($params as $field) { // some switch to see if it should be added to front end params $target = ComponentbuilderHelper::getBetween($field, 'display="', '"'); if (!ComponentbuilderHelper::checkString($target) || $target === 'menu') { - + $field = str_replace('display="menu"', '', $field); // we load fields that have options - if (strpos($field,'Option Set. -->') !== false && strpos($field,$menuSetter) === false && !ComponentbuilderHelper::checkString($target)) + if (strpos($field, 'Option Set. -->') !== false && strpos($field, $menuSetter) === false && !ComponentbuilderHelper::checkString($target)) { // we add the global option - $field = str_replace('Option Set. -->', $this->setLine(__LINE__).' Global & Option Set. -->'.PHP_EOL."\t\t\t".'', $field); + $field = str_replace('Option Set. -->', $this->setLine(__LINE__) . ' Global & Option Set. -->' . PHP_EOL . "\t\t\t" . '', $field); // update the default to be global $field = preg_replace('/default=".+"/', 'default=""', $field); // update the default to be filter @@ -1426,7 +1425,7 @@ class Interpretation extends Fields return $keep; } - public function setCustomViewQuery(&$gets,&$code,$tab = '',$type = 'main') + public function setCustomViewQuery(&$gets, &$code, $tab = '', $type = 'main') { $query = ''; if (ComponentbuilderHelper::checkArray($gets)) @@ -1436,40 +1435,40 @@ class Interpretation extends Fields foreach ($gets as $nr => $the_get) { // to insure that there be no double entries of a call - $checker = md5(serialize($the_get).$code); - if (!isset($this->customViewQueryChecker[$this->target]) || !in_array($checker,$this->customViewQueryChecker[$this->target])) + $checker = md5(serialize($the_get) . $code); + if (!isset($this->customViewQueryChecker[$this->target]) || !in_array($checker, $this->customViewQueryChecker[$this->target])) { // load this unuiqe key $this->customViewQueryChecker[$this->target][] = $checker; if (ComponentbuilderHelper::checkString($the_get['selection']['type'])) { - $getItem = PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Get from ".$the_get['selection']['table']." as ".$the_get['as']; + $getItem = PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get from " . $the_get['selection']['table'] . " as " . $the_get['as']; } else { - $getItem = PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Get data"; + $getItem = PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get data"; } // set the selection - $getItem .= PHP_EOL."\t".$tab."\t".$the_get['selection']['select']; + $getItem .= PHP_EOL . "\t" . $tab . "\t" . $the_get['selection']['select']; if (($nr == 0 && (!isset($the_get['join_field']) || !ComponentbuilderHelper::checkString($the_get['join_field'])) && (isset($the_get['selection']['type']) && ComponentbuilderHelper::checkString($the_get['selection']['type']))) || ($type === 'custom' && (isset($the_get['selection']['type']) && ComponentbuilderHelper::checkString($the_get['selection']['type'])))) { - $getItem .= PHP_EOL."\t".$tab."\t".'$query->from('.$the_get['selection']['from'].');'; + $getItem .= PHP_EOL . "\t" . $tab . "\t" . '$query->from(' . $the_get['selection']['from'] . ');'; } elseif (isset($the_get['join_field']) && ComponentbuilderHelper::checkString($the_get['join_field']) && isset($the_get['selection']['type']) && ComponentbuilderHelper::checkString($the_get['selection']['type'])) { - $getItem .= PHP_EOL."\t".$tab."\t\$query->join('".$the_get['type']; - $getItem .= "', (".$the_get['selection']['from']; - $getItem .= ") . ' ON (' . \$db->quoteName('".$the_get['on_field']; - $getItem .= "') . ' ".$the_get['operator']; - $getItem .= " ' . \$db->quoteName('".$the_get['join_field']."') . ')');"; + $getItem .= PHP_EOL . "\t" . $tab . "\t\$query->join('" . $the_get['type']; + $getItem .= "', (" . $the_get['selection']['from']; + $getItem .= ") . ' ON (' . \$db->quoteName('" . $the_get['on_field']; + $getItem .= "') . ' " . $the_get['operator']; + $getItem .= " ' . \$db->quoteName('" . $the_get['join_field'] . "') . ')');"; $check = current(explode(".", $the_get['on_field'])); } // set the method defaults - $default = $this->setCustomViewMethodDefaults($the_get,$code); - if (isset($this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']]) && ComponentbuilderHelper::checkString($this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']]) && !in_array($check,$mainAsArray)) + $default = $this->setCustomViewMethodDefaults($the_get, $code); + if (isset($this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']]) && ComponentbuilderHelper::checkString($this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']]) && !in_array($check, $mainAsArray)) { // load to other query if (!isset($this->otherQuery[$this->target][$default['code']][$this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']]][$default['valueName']])) @@ -1489,7 +1488,7 @@ class Interpretation extends Fields return $query; } - public function setCustomViewFieldDecodeFilter(&$get,&$filters,$string,$removeString,$code,$tab) + public function setCustomViewFieldDecodeFilter(&$get, &$filters, $string, $removeString, $code, $tab) { $filter = ''; // check if filter is set for this field @@ -1501,105 +1500,105 @@ class Interpretation extends Fields { $as = ''; $felt = ''; - list($as,$felt) = array_map('trim', explode('.',$ter['table_key'])); + list($as, $felt) = array_map('trim', explode('.', $ter['table_key'])); if ($get['as'] == $as) { switch ($ter['filter_type']) { case 4: - // COM_COMPONENTBUILDER_DYNAMIC_GET_USER_GROUPS - $filter .= PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." filter ".$as." based on user groups"; - $filter .= PHP_EOL."\t".$tab."\t\$remove = (count(array_intersect((array) \$this->groups, (array) ".$string."->".$field."))) ? false : true;"; - $filter .= PHP_EOL."\t".$tab."\tif (\$remove)"; - $filter .= PHP_EOL."\t".$tab."\t{"; - if ($removeString == $string) - { - $filter .= PHP_EOL."\t".$tab."\t\t//".$this->setLine(__LINE__)." Remove ".$string." if user not in groups"; - $filter .= PHP_EOL."\t".$tab."\t\t".$string." = null;"; - $filter .= PHP_EOL."\t".$tab."\t\treturn false;"; - } - else - { - $filter .= PHP_EOL."\t".$tab."\t\t//".$this->setLine(__LINE__)." Unset ".$string." if user not in groups"; - $filter .= PHP_EOL."\t".$tab."\t\tunset(".$removeString.");"; - $filter .= PHP_EOL."\t".$tab."\t\tcontinue;"; - } - $filter .= PHP_EOL."\t".$tab."\t}"; - break; + // COM_COMPONENTBUILDER_DYNAMIC_GET_USER_GROUPS + $filter .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " filter " . $as . " based on user groups"; + $filter .= PHP_EOL . "\t" . $tab . "\t\$remove = (count(array_intersect((array) \$this->groups, (array) " . $string . "->" . $field . "))) ? false : true;"; + $filter .= PHP_EOL . "\t" . $tab . "\tif (\$remove)"; + $filter .= PHP_EOL . "\t" . $tab . "\t{"; + if ($removeString == $string) + { + $filter .= PHP_EOL . "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " Remove " . $string . " if user not in groups"; + $filter .= PHP_EOL . "\t" . $tab . "\t\t" . $string . " = null;"; + $filter .= PHP_EOL . "\t" . $tab . "\t\treturn false;"; + } + else + { + $filter .= PHP_EOL . "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " Unset " . $string . " if user not in groups"; + $filter .= PHP_EOL . "\t" . $tab . "\t\tunset(" . $removeString . ");"; + $filter .= PHP_EOL . "\t" . $tab . "\t\tcontinue;"; + } + $filter .= PHP_EOL . "\t" . $tab . "\t}"; + break; case 9: - // COM_COMPONENTBUILDER_DYNAMIC_GET_ARRAY_VALUE + // COM_COMPONENTBUILDER_DYNAMIC_GET_ARRAY_VALUE - $filter .= PHP_EOL.PHP_EOL."\t".$tab."\tif (".$this->fileContentStatic['###Component###']."Helper::checkArray(".$string."->".$field."))"; - $filter .= PHP_EOL."\t".$tab."\t{"; + $filter .= PHP_EOL . PHP_EOL . "\t" . $tab . "\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkArray(" . $string . "->" . $field . "))"; + $filter .= PHP_EOL . "\t" . $tab . "\t{"; - $filter .= PHP_EOL."\t".$tab."\t\t//".$this->setLine(__LINE__)." do your thing here"; + $filter .= PHP_EOL . "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " do your thing here"; - $filter .= PHP_EOL."\t".$tab."\t}"; - $filter .= PHP_EOL."\t".$tab."\telse"; - $filter .= PHP_EOL."\t".$tab."\t{"; + $filter .= PHP_EOL . "\t" . $tab . "\t}"; + $filter .= PHP_EOL . "\t" . $tab . "\telse"; + $filter .= PHP_EOL . "\t" . $tab . "\t{"; - if ($removeString == $string) - { - $filter .= PHP_EOL."\t".$tab."\t\t//".$this->setLine(__LINE__)." Remove ".$string." if not array."; - $filter .= PHP_EOL."\t".$tab."\t\t".$string." = null;"; - } - else - { - $filter .= PHP_EOL."\t".$tab."\t\t//".$this->setLine(__LINE__)." Unset ".$string." if not array."; - $filter .= PHP_EOL."\t".$tab."\t\tunset(".$removeString.");"; - $filter .= PHP_EOL."\t".$tab."\t\tcontinue;"; - } + if ($removeString == $string) + { + $filter .= PHP_EOL . "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " Remove " . $string . " if not array."; + $filter .= PHP_EOL . "\t" . $tab . "\t\t" . $string . " = null;"; + } + else + { + $filter .= PHP_EOL . "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " Unset " . $string . " if not array."; + $filter .= PHP_EOL . "\t" . $tab . "\t\tunset(" . $removeString . ");"; + $filter .= PHP_EOL . "\t" . $tab . "\t\tcontinue;"; + } - $filter .= PHP_EOL."\t".$tab."\t}"; - break; + $filter .= PHP_EOL . "\t" . $tab . "\t}"; + break; case 10: - // COM_COMPONENTBUILDER_DYNAMIC_GET_REPEATABLE_VALUE - $filter .= PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." filter ".$as." based on repeatable value"; - $filter .= PHP_EOL."\t".$tab."\tif (".$this->fileContentStatic['###Component###']."Helper::checkString(".$string."->".$field."))"; - $filter .= PHP_EOL."\t".$tab."\t{"; + // COM_COMPONENTBUILDER_DYNAMIC_GET_REPEATABLE_VALUE + $filter .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " filter " . $as . " based on repeatable value"; + $filter .= PHP_EOL . "\t" . $tab . "\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkString(" . $string . "->" . $field . "))"; + $filter .= PHP_EOL . "\t" . $tab . "\t{"; - $filter .= PHP_EOL."\t\t".$tab."\t\$array = json_decode(".$string."->".$field.",true);"; - $filter .= PHP_EOL."\t\t".$tab."\tif (".$this->fileContentStatic['###Component###']."Helper::checkArray(\$array))"; - $filter .= PHP_EOL."\t\t".$tab."\t{"; + $filter .= PHP_EOL . "\t\t" . $tab . "\t\$array = json_decode(" . $string . "->" . $field . ",true);"; + $filter .= PHP_EOL . "\t\t" . $tab . "\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$array))"; + $filter .= PHP_EOL . "\t\t" . $tab . "\t{"; - $filter .= PHP_EOL."\t\t".$tab."\t\t//".$this->setLine(__LINE__)." do your thing here"; + $filter .= PHP_EOL . "\t\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " do your thing here"; - $filter .= PHP_EOL."\t\t".$tab."\t}"; - $filter .= PHP_EOL."\t".$tab."\t\telse"; - $filter .= PHP_EOL."\t".$tab."\t\t{"; + $filter .= PHP_EOL . "\t\t" . $tab . "\t}"; + $filter .= PHP_EOL . "\t" . $tab . "\t\telse"; + $filter .= PHP_EOL . "\t" . $tab . "\t\t{"; - if ($removeString == $string) - { - $filter .= PHP_EOL."\t".$tab."\t\t\t//".$this->setLine(__LINE__)." Remove ".$string." if not array."; - $filter .= PHP_EOL."\t".$tab."\t\t\t".$string." = null;"; - } - else - { - $filter .= PHP_EOL."\t".$tab."\t\t\t//".$this->setLine(__LINE__)." Unset ".$string." if not array."; - $filter .= PHP_EOL."\t".$tab."\t\t\tunset(".$removeString.");"; - $filter .= PHP_EOL."\t".$tab."\t\t\tcontinue;"; - } + if ($removeString == $string) + { + $filter .= PHP_EOL . "\t" . $tab . "\t\t\t//" . $this->setLine(__LINE__) . " Remove " . $string . " if not array."; + $filter .= PHP_EOL . "\t" . $tab . "\t\t\t" . $string . " = null;"; + } + else + { + $filter .= PHP_EOL . "\t" . $tab . "\t\t\t//" . $this->setLine(__LINE__) . " Unset " . $string . " if not array."; + $filter .= PHP_EOL . "\t" . $tab . "\t\t\tunset(" . $removeString . ");"; + $filter .= PHP_EOL . "\t" . $tab . "\t\t\tcontinue;"; + } - $filter .= PHP_EOL."\t".$tab."\t\t}"; + $filter .= PHP_EOL . "\t" . $tab . "\t\t}"; - $filter .= PHP_EOL."\t".$tab."\t}"; - $filter .= PHP_EOL."\t".$tab."\telse"; - $filter .= PHP_EOL."\t".$tab."\t{"; + $filter .= PHP_EOL . "\t" . $tab . "\t}"; + $filter .= PHP_EOL . "\t" . $tab . "\telse"; + $filter .= PHP_EOL . "\t" . $tab . "\t{"; - if ($removeString == $string) - { - $filter .= PHP_EOL."\t".$tab."\t\t//".$this->setLine(__LINE__)." Remove ".$string." if not string."; - $filter .= PHP_EOL."\t".$tab."\t\t".$string." = null;"; - } - else - { - $filter .= PHP_EOL."\t".$tab."\t\t//".$this->setLine(__LINE__)." Unset ".$string." if not string."; - $filter .= PHP_EOL."\t".$tab."\t\tunset(".$removeString.");"; - $filter .= PHP_EOL."\t".$tab."\t\tcontinue;"; - } + if ($removeString == $string) + { + $filter .= PHP_EOL . "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " Remove " . $string . " if not string."; + $filter .= PHP_EOL . "\t" . $tab . "\t\t" . $string . " = null;"; + } + else + { + $filter .= PHP_EOL . "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " Unset " . $string . " if not string."; + $filter .= PHP_EOL . "\t" . $tab . "\t\tunset(" . $removeString . ");"; + $filter .= PHP_EOL . "\t" . $tab . "\t\tcontinue;"; + } - $filter .= PHP_EOL."\t".$tab."\t}"; - break; + $filter .= PHP_EOL . "\t" . $tab . "\t}"; + break; } } } @@ -1608,7 +1607,7 @@ class Interpretation extends Fields return $filter; } - public function setCustomViewFieldDecode(&$get,$checker,$string,$code,$tab = '') + public function setCustomViewFieldDecode(&$get, $checker, $string, $code, $tab = '') { $fieldDecode = ''; foreach ($checker as $field => $array) @@ -1617,36 +1616,36 @@ class Interpretation extends Fields { if ($array['decode'] === 'json') { - $if = PHP_EOL."\t".$tab."\tif (".$this->fileContentStatic['###Component###']."Helper::checkJson(".$string."->".$field."))".PHP_EOL."\t".$tab."\t{"; + $if = PHP_EOL . "\t" . $tab . "\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkJson(" . $string . "->" . $field . "))" . PHP_EOL . "\t" . $tab . "\t{"; // json_decode - $decoder = $string."->".$field." = json_decode(".$string."->".$field.", true);"; + $decoder = $string . "->" . $field . " = json_decode(" . $string . "->" . $field . ", true);"; // TODO Use the type of field to prepare it even more for use in the view } elseif ($array['decode'] === 'base64') { - $if = PHP_EOL."\t".$tab."\tif (!empty(".$string."->".$field.") && ".$string."->".$field." === base64_encode(base64_decode(".$string."->".$field.")))".PHP_EOL."\t".$tab."\t{"; + $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ")))" . PHP_EOL . "\t" . $tab . "\t{"; // base64_decode - $decoder = $string."->".$field." = base64_decode(".$string."->".$field.");"; + $decoder = $string . "->" . $field . " = base64_decode(" . $string . "->" . $field . ");"; // TODO Use the type of field to prepare it even more for use in the view } elseif ($array['decode'] === 'basic_encryption') { - $if = PHP_EOL."\t".$tab."\tif (!empty(".$string."->".$field.") && \$basickey && !is_numeric(".$string."->".$field.") && ".$string."->".$field." === base64_encode(base64_decode(".$string."->".$field.", true)))".PHP_EOL."\t".$tab."\t{"; + $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && \$basickey && !is_numeric(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ", true)))" . PHP_EOL . "\t" . $tab . "\t{"; // basic decryption - $decoder = $string."->".$field." = rtrim(\$basic->decryptString(".$string."->".$field."), ".'"\0"'.");"; + $decoder = $string . "->" . $field . " = rtrim(\$basic->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");"; $this->siteDecrypt['basic'][$code] = true; } elseif ($array['decode'] === 'advance_encryption') { - $if = PHP_EOL."\t".$tab."\tif (!empty(".$string."->".$field.") && \$advancedkey && !is_numeric(".$string."->".$field.") && ".$string."->".$field." === base64_encode(base64_decode(".$string."->".$field.", true)))".PHP_EOL."\t".$tab."\t{"; + $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && \$advancedkey && !is_numeric(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ", true)))" . PHP_EOL . "\t" . $tab . "\t{"; // advanced decryption - $decoder = $string."->".$field." = rtrim(\$advanced->decryptString(".$string."->".$field."), ".'"\0"'.");"; + $decoder = $string . "->" . $field . " = rtrim(\$advanced->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");"; $this->siteDecrypt['advanced'][$code] = true; } // build decoder string - $fieldDecode .= $if.PHP_EOL."\t".$tab."\t\t//".$this->setLine(__LINE__)." Decode ".$field; - $fieldDecode .= PHP_EOL."\t".$tab."\t\t".$decoder.PHP_EOL."\t".$tab."\t}"; + $fieldDecode .= $if . PHP_EOL . "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " Decode " . $field; + $fieldDecode .= PHP_EOL . "\t" . $tab . "\t\t" . $decoder . PHP_EOL . "\t" . $tab . "\t}"; } } return $fieldDecode; @@ -1656,26 +1655,27 @@ class Interpretation extends Fields { $fieldPrepare = ''; $runplugins = false; - $context = 'com_'.$this->fileContentStatic['###component###'].'.'.$code; + $context = 'com_' . $this->fileContentStatic['###component###'] . '.' . $code; foreach ($checker as $field => $array) { if (strpos($get['selection']['select'], $field) !== false) { // build decoder string - if(!$runplugins) { - $runplugins = PHP_EOL.$tab."\t//".$this->setLine(__LINE__)." Load the JEvent Dispatcher"; - $runplugins .= PHP_EOL.$tab."\tJPluginHelper::importPlugin('content');"; - $runplugins .= PHP_EOL.$tab."\t".'$this->_dispatcher = JEventDispatcher::getInstance();'; + if (!$runplugins) + { + $runplugins = PHP_EOL . $tab . "\t//" . $this->setLine(__LINE__) . " Load the JEvent Dispatcher"; + $runplugins .= PHP_EOL . $tab . "\tJPluginHelper::importPlugin('content');"; + $runplugins .= PHP_EOL . $tab . "\t" . '$this->_dispatcher = JEventDispatcher::getInstance();'; } - $fieldPrepare .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Make sure the content prepare plugins fire on ".$field; - $fieldPrepare .= PHP_EOL."\t".$tab."\t\$_".$field." = new stdClass();"; - $fieldPrepare .= PHP_EOL."\t".$tab."\t\$_".$field.'->text =& '.$string.'->'.$field.'; //'.$this->setLine(__LINE__).' value must be in text'; - $fieldPrepare .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Since all values are now in text (Joomla Limitation), we also add the field name (".$field.") to context"; - $fieldPrepare .= PHP_EOL."\t".$tab."\t".'$this->_dispatcher->trigger("onContentPrepare",array(\''.$context.'.'.$field.'\',&$_'.$field.',&$this->params));'; // we can improve the params later (TODO) + $fieldPrepare .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Make sure the content prepare plugins fire on " . $field; + $fieldPrepare .= PHP_EOL . "\t" . $tab . "\t\$_" . $field . " = new stdClass();"; + $fieldPrepare .= PHP_EOL . "\t" . $tab . "\t\$_" . $field . '->text =& ' . $string . '->' . $field . '; //' . $this->setLine(__LINE__) . ' value must be in text'; + $fieldPrepare .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Since all values are now in text (Joomla Limitation), we also add the field name (" . $field . ") to context"; + $fieldPrepare .= PHP_EOL . "\t" . $tab . "\t" . '$this->_dispatcher->trigger("onContentPrepare",array(\'' . $context . '.' . $field . '\',&$_' . $field . ',&$this->params));'; // we can improve the params later (TODO) } } // load dispatcher - $this->JEventDispatcher = array('###DISPATCHER###' => ($runplugins?:'')); + $this->JEventDispatcher = array('###DISPATCHER###' => ($runplugins ?: '')); // return content prepare fix return $fieldPrepare; } @@ -1690,8 +1690,8 @@ class Interpretation extends Fields // only load for uikit version 2 (TODO) we may need to add another check here if (2 == $this->uikit || 1 == $this->uikit) { - $fieldUikit .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Checking if ".$field." has uikit components that must be loaded."; - $fieldUikit .= PHP_EOL."\t".$tab."\t\$this->uikitComp = ".$this->fileContentStatic['###Component###']."Helper::getUikitComp(".$string."->".$field.",\$this->uikitComp);"; + $fieldUikit .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Checking if " . $field . " has uikit components that must be loaded."; + $fieldUikit .= PHP_EOL . "\t" . $tab . "\t\$this->uikitComp = " . $this->fileContentStatic['###Component###'] . "Helper::getUikitComp(" . $string . "->" . $field . ",\$this->uikitComp);"; } } } @@ -1699,7 +1699,7 @@ class Interpretation extends Fields return $fieldUikit; } - public function setCustomViewCustomJoin(&$gets,$string,$code,&$asBucket,$tab = '') + public function setCustomViewCustomJoin(&$gets, $string, $code, &$asBucket, $tab = '') { if (ComponentbuilderHelper::checkArray($gets)) { @@ -1707,12 +1707,12 @@ class Interpretation extends Fields foreach ($gets as $get) { // set the value name $default - $default = $this->setCustomViewMethodDefaults($get,$code); - if ($this->checkJoint($default,$get,$asBucket)) + $default = $this->setCustomViewMethodDefaults($get, $code); + if ($this->checkJoint($default, $get, $asBucket)) { // build custom join string - $otherJoin = PHP_EOL."\t###TAB###\t//".$this->setLine(__LINE__)." set ".$default['valueName']." to the ###STRING### object."; - $otherJoin .= PHP_EOL."\t###TAB###\t###STRING###->".$default['valueName']." = \$this->get".$default['methodName']."(###STRING###->".$this->getAsLookup[$get['key']][$get['on_field']].");"; + $otherJoin = PHP_EOL . "\t###TAB###\t//" . $this->setLine(__LINE__) . " set " . $default['valueName'] . " to the ###STRING### object."; + $otherJoin .= PHP_EOL . "\t###TAB###\t###STRING###->" . $default['valueName'] . " = \$this->get" . $default['methodName'] . "(###STRING###->" . $this->getAsLookup[$get['key']][$get['on_field']] . ");"; // load to other join if (!isset($this->otherJoin[$this->target][$default['code']][$this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']]][$default['valueName']])) { @@ -1723,20 +1723,20 @@ class Interpretation extends Fields else { // build custom join string - $customJoin .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." set ".$default['valueName']." to the ".$string." object."; - $customJoin .= PHP_EOL."\t".$tab."\t".$string."->".$default['valueName']." = \$this->get".$default['methodName']."(".$string."->".$this->getAsLookup[$get['key']][$get['on_field']].");"; + $customJoin .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " set " . $default['valueName'] . " to the " . $string . " object."; + $customJoin .= PHP_EOL . "\t" . $tab . "\t" . $string . "->" . $default['valueName'] . " = \$this->get" . $default['methodName'] . "(" . $string . "->" . $this->getAsLookup[$get['key']][$get['on_field']] . ");"; } } return $customJoin; } return ''; } - - public function checkJoint(&$default,&$get,&$asBucket) + + public function checkJoint(&$default, &$get, &$asBucket) { // check if this function is not linked to the main call - list($aJoin) = explode('.',$get['on_field']); - if (ComponentbuilderHelper::checkArray($asBucket) && in_array($aJoin,$asBucket)) + list($aJoin) = explode('.', $get['on_field']); + if (ComponentbuilderHelper::checkArray($asBucket) && in_array($aJoin, $asBucket)) { return false; } @@ -1748,7 +1748,7 @@ class Interpretation extends Fields return false; } - public function setCustomViewFilter(&$filter,&$code,$tab = '') + public function setCustomViewFilter(&$filter, &$code, $tab = '') { $filters = ''; if (ComponentbuilderHelper::checkArray($filter)) @@ -1758,104 +1758,104 @@ class Interpretation extends Fields $as = ''; $field = ''; $string = ''; - if (strpos($ter['table_key'],'.') !== false) + if (strpos($ter['table_key'], '.') !== false) { - list($as,$field) = array_map('trim', explode('.',$ter['table_key'])); + list($as, $field) = array_map('trim', explode('.', $ter['table_key'])); } switch ($ter['filter_type']) { case 1: - // COM_COMPONENTBUILDER_DYNAMIC_GET_ID - $string = PHP_EOL."\t".$tab."\t\$query->where('".$ter['table_key'] . " " . $ter['operator'] . " ' . (int) \$pk);"; - break; + // COM_COMPONENTBUILDER_DYNAMIC_GET_ID + $string = PHP_EOL . "\t" . $tab . "\t\$query->where('" . $ter['table_key'] . " " . $ter['operator'] . " ' . (int) \$pk);"; + break; case 2: - // COM_COMPONENTBUILDER_DYNAMIC_GET_USER - $string = PHP_EOL."\t".$tab."\t\$query->where('".$ter['table_key'] . " " . $ter['operator'] . " ' . (int) \$this->userId);"; - break; + // COM_COMPONENTBUILDER_DYNAMIC_GET_USER + $string = PHP_EOL . "\t" . $tab . "\t\$query->where('" . $ter['table_key'] . " " . $ter['operator'] . " ' . (int) \$this->userId);"; + break; case 3: - // COM_COMPONENTBUILDER_DYNAMIC_GET_ACCESS_LEVEL - $string = PHP_EOL."\t".$tab."\t\$query->where('".$ter['table_key'] . " " . $ter['operator'] . " (' . implode(',', \$this->levels) . ')');"; - break; + // COM_COMPONENTBUILDER_DYNAMIC_GET_ACCESS_LEVEL + $string = PHP_EOL . "\t" . $tab . "\t\$query->where('" . $ter['table_key'] . " " . $ter['operator'] . " (' . implode(',', \$this->levels) . ')');"; + break; case 4: - // COM_COMPONENTBUILDER_DYNAMIC_GET_USER_GROUPS - $decodeChecker = $this->siteFieldData['decode'][$code][$ter['key']][$as][$field]; - if (ComponentbuilderHelper::checkArray($decodeChecker) || $ter['state_key'] === 'array') - { + // COM_COMPONENTBUILDER_DYNAMIC_GET_USER_GROUPS + $decodeChecker = $this->siteFieldData['decode'][$code][$ter['key']][$as][$field]; + if (ComponentbuilderHelper::checkArray($decodeChecker) || $ter['state_key'] === 'array') + { + // set needed fields to filter after query + $this->siteFieldDecodeFilter[$this->target][$code][$ter['key']][$as][$field] = $ter; + } + else + { + $string = PHP_EOL . "\t" . $tab . "\t\$query->where('" . $ter['table_key'] . " " . $ter['operator'] . " (' . implode(',', \$this->groups) . ')');"; + } + break; + case 5: + // COM_COMPONENTBUILDER_DYNAMIC_GET_CATEGORIES + $string = PHP_EOL . "\t\t" . $tab . "//" . $this->setLine(__LINE__) . " (TODO) The dynamic category filter is not ready."; + break; + case 6: + // COM_COMPONENTBUILDER_DYNAMIC_GET_TAGS + $string = PHP_EOL . "\t\t" . $tab . "//" . $this->setLine(__LINE__) . " (TODO) The dynamic tags filter is not ready."; + break; + case 7: + // COM_COMPONENTBUILDER_DYNAMIC_GET_DATE + $string = PHP_EOL . "\t\t" . $tab . "//" . $this->setLine(__LINE__) . " (TODO) The dynamic date filter is not ready."; + break; + case 8: + // COM_COMPONENTBUILDER_DYNAMIC_GET_FUNCTIONVAR + if ($ter['operator'] === 'IN' || $ter['operator'] === 'NOT IN') + { + $string = PHP_EOL . "\t\t" . $tab . "//" . $this->setLine(__LINE__) . " Check if " . $ter['state_key'] . " is an array with values."; + $string .= PHP_EOL . "\t\t" . $tab . "\$array = " . $ter['state_key'] . ";"; + $string .= PHP_EOL . "\t\t" . $tab . "if (isset(\$array) && " . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$array))"; + $string .= PHP_EOL . "\t\t" . $tab . "{"; + $string .= PHP_EOL . "\t\t" . $tab . "\t\$query->where('" . $ter['table_key'] . " " . $ter['operator'] . " (' . implode(',', \$array) . ')');"; + $string .= PHP_EOL . "\t\t" . $tab . "}"; + $string .= PHP_EOL . "\t\t" . $tab . "else"; + $string .= PHP_EOL . "\t\t" . $tab . "{"; + $string .= PHP_EOL . "\t\t" . $tab . "\treturn false;"; + $string .= PHP_EOL . "\t\t" . $tab . "}"; + } + else + { + $string = PHP_EOL . "\t\t" . $tab . "//" . $this->setLine(__LINE__) . " Check if " . $ter['state_key'] . " is a string or numeric value."; + $string .= PHP_EOL . "\t\t" . $tab . "\$checkValue = " . $ter['state_key'] . ";"; + $string .= PHP_EOL . "\t\t" . $tab . "if (isset(\$checkValue) && " . $this->fileContentStatic['###Component###'] . "Helper::checkString(\$checkValue))"; + $string .= PHP_EOL . "\t\t" . $tab . "{"; + $string .= PHP_EOL . "\t\t" . $tab . "\t\$query->where('" . $ter['table_key'] . " " . $ter['operator'] . " ' . \$db->quote(\$checkValue));"; + $string .= PHP_EOL . "\t\t" . $tab . "}"; + $string .= PHP_EOL . "\t\t" . $tab . "elseif (is_numeric(\$checkValue))"; + $string .= PHP_EOL . "\t\t" . $tab . "{"; + $string .= PHP_EOL . "\t\t" . $tab . "\t\$query->where('" . $ter['table_key'] . " " . $ter['operator'] . " ' . \$checkValue);"; + $string .= PHP_EOL . "\t\t" . $tab . "}"; + $string .= PHP_EOL . "\t\t" . $tab . "else"; + $string .= PHP_EOL . "\t\t" . $tab . "{"; + $string .= PHP_EOL . "\t\t" . $tab . "\treturn false;"; + $string .= PHP_EOL . "\t\t" . $tab . "}"; + } + break; + case 9: + // COM_COMPONENTBUILDER_DYNAMIC_GET_ARRAY_VALUE + $string = ""; // set needed fields to filter after query $this->siteFieldDecodeFilter[$this->target][$code][$ter['key']][$as][$field] = $ter; - } - else - { - $string = PHP_EOL."\t".$tab."\t\$query->where('".$ter['table_key'] . " " . $ter['operator'] . " (' . implode(',', \$this->groups) . ')');"; - } - break; - case 5: - // COM_COMPONENTBUILDER_DYNAMIC_GET_CATEGORIES - $string = PHP_EOL."\t\t".$tab."//".$this->setLine(__LINE__)." (TODO) The dynamic category filter is not ready."; - break; - case 6: - // COM_COMPONENTBUILDER_DYNAMIC_GET_TAGS - $string = PHP_EOL."\t\t".$tab."//".$this->setLine(__LINE__)." (TODO) The dynamic tags filter is not ready."; - break; - case 7: - // COM_COMPONENTBUILDER_DYNAMIC_GET_DATE - $string = PHP_EOL."\t\t".$tab."//".$this->setLine(__LINE__)." (TODO) The dynamic date filter is not ready."; - break; - case 8: - // COM_COMPONENTBUILDER_DYNAMIC_GET_FUNCTIONVAR - if ($ter['operator'] === 'IN' || $ter['operator'] === 'NOT IN') - { - $string = PHP_EOL."\t\t".$tab."//".$this->setLine(__LINE__)." Check if " . $ter['state_key'] . " is an array with values."; - $string .= PHP_EOL."\t\t".$tab."\$array = " . $ter['state_key'].";"; - $string .= PHP_EOL."\t\t".$tab."if (isset(\$array) && ".$this->fileContentStatic['###Component###']."Helper::checkArray(\$array))"; - $string .= PHP_EOL."\t\t".$tab."{"; - $string .= PHP_EOL."\t\t".$tab."\t\$query->where('".$ter['table_key'] . " " . $ter['operator'] . " (' . implode(',', \$array) . ')');"; - $string .= PHP_EOL."\t\t".$tab."}"; - $string .= PHP_EOL."\t\t".$tab."else"; - $string .= PHP_EOL."\t\t".$tab."{"; - $string .= PHP_EOL."\t\t".$tab."\treturn false;"; - $string .= PHP_EOL."\t\t".$tab."}"; - } - else - { - $string = PHP_EOL."\t\t".$tab."//".$this->setLine(__LINE__)." Check if " . $ter['state_key'] . " is a string or numeric value."; - $string .= PHP_EOL."\t\t".$tab."\$checkValue = " . $ter['state_key'].";"; - $string .= PHP_EOL."\t\t".$tab."if (isset(\$checkValue) && ".$this->fileContentStatic['###Component###']."Helper::checkString(\$checkValue))"; - $string .= PHP_EOL."\t\t".$tab."{"; - $string .= PHP_EOL."\t\t".$tab."\t\$query->where('".$ter['table_key'] . " " . $ter['operator'] . " ' . \$db->quote(\$checkValue));"; - $string .= PHP_EOL."\t\t".$tab."}"; - $string .= PHP_EOL."\t\t".$tab."elseif (is_numeric(\$checkValue))"; - $string .= PHP_EOL."\t\t".$tab."{"; - $string .= PHP_EOL."\t\t".$tab."\t\$query->where('".$ter['table_key'] . " " . $ter['operator'] . " ' . \$checkValue);"; - $string .= PHP_EOL."\t\t".$tab."}"; - $string .= PHP_EOL."\t\t".$tab."else"; - $string .= PHP_EOL."\t\t".$tab."{"; - $string .= PHP_EOL."\t\t".$tab."\treturn false;"; - $string .= PHP_EOL."\t\t".$tab."}"; - } - break; - case 9: - // COM_COMPONENTBUILDER_DYNAMIC_GET_ARRAY_VALUE - $string = ""; - // set needed fields to filter after query - $this->siteFieldDecodeFilter[$this->target][$code][$ter['key']][$as][$field] = $ter; - break; + break; case 10: - // COM_COMPONENTBUILDER_DYNAMIC_GET_REPEATABLE_VALUE - $string = ""; - // set needed fields to filter after query - $this->siteFieldDecodeFilter[$this->target][$code][$ter['key']][$as][$field] = $ter; - break; + // COM_COMPONENTBUILDER_DYNAMIC_GET_REPEATABLE_VALUE + $string = ""; + // set needed fields to filter after query + $this->siteFieldDecodeFilter[$this->target][$code][$ter['key']][$as][$field] = $ter; + break; case 11: - // COM_COMPONENTBUILDER_DYNAMIC_GET_OTHER - if (strpos($as,'(') !== false) - { - // TODO (for now we only fix extra sql methods here) - list($dump,$as) = array_map('trim', explode('(',$as)); - $field = trim(str_replace(')', '', $field)); - } - $string = PHP_EOL."\t".$tab."\t\$query->where('".$ter['table_key'] . " " . $ter['operator'] . " ". $ter['state_key']."');"; - break; + // COM_COMPONENTBUILDER_DYNAMIC_GET_OTHER + if (strpos($as, '(') !== false) + { + // TODO (for now we only fix extra sql methods here) + list($dump, $as) = array_map('trim', explode('(', $as)); + $field = trim(str_replace(')', '', $field)); + } + $string = PHP_EOL . "\t" . $tab . "\t\$query->where('" . $ter['table_key'] . " " . $ter['operator'] . " " . $ter['state_key'] . "');"; + break; } // only add if the filter is set if (ComponentbuilderHelper::checkString($string)) @@ -1865,7 +1865,7 @@ class Interpretation extends Fields { $filters .= $string; } - elseif($as !== 'a') + elseif ($as !== 'a') { $this->otherFilter[$this->target][$code][$as][$field] = $string; } @@ -1875,32 +1875,32 @@ class Interpretation extends Fields return $filters; } - public function setCustomViewOrder(&$order,&$code,$tab = '') + public function setCustomViewOrder(&$order, &$code, $tab = '') { $ordering = ''; if (ComponentbuilderHelper::checkArray($order)) { foreach ($order as $or) { - list($as,$field) = array_map('trim', explode('.',$or['table_key'])); + list($as, $field) = array_map('trim', explode('.', $or['table_key'])); // set the string - $string = "\$query->order('".$or['table_key']." ".$or['direction']."');"; + $string = "\$query->order('" . $or['table_key'] . " " . $or['direction'] . "');"; // sort where if ($as === 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as]))) { - $ordering .= PHP_EOL."\t".$tab."\t".$string; + $ordering .= PHP_EOL . "\t" . $tab . "\t" . $string; } else { - $this->otherOrder[$this->target][$code][$as][$field] = PHP_EOL."\t\t".$string; + $this->otherOrder[$this->target][$code][$as][$field] = PHP_EOL . "\t\t" . $string; } } } return $ordering; } - public function setCustomViewWhere(&$where,&$code,$tab = '') + public function setCustomViewWhere(&$where, &$code, $tab = '') { $wheres = ''; if (ComponentbuilderHelper::checkArray($where)) @@ -1910,13 +1910,12 @@ class Interpretation extends Fields $as = ''; $field = ''; $value = ''; - list($as,$field) = array_map('trim', explode('.',$whe['table_key'])); + list($as, $field) = array_map('trim', explode('.', $whe['table_key'])); if (is_numeric($whe['value_key'])) { - $value = " ".$whe['value_key']."');"; - + $value = " " . $whe['value_key'] . "');"; } - elseif (strpos($whe['value_key'],'$') !== false) + elseif (strpos($whe['value_key'], '$') !== false) { if ($whe['operator'] === 'IN' || $whe['operator'] === 'NOT IN') { @@ -1924,23 +1923,23 @@ class Interpretation extends Fields } else { - $value = " ' . \$db->quote(".$whe['value_key']."));"; + $value = " ' . \$db->quote(" . $whe['value_key'] . "));"; } } - elseif (strpos($whe['value_key'],'.') !== false) + elseif (strpos($whe['value_key'], '.') !== false) { - if (strpos($whe['value_key'],"'") !== false) + if (strpos($whe['value_key'], "'") !== false) { - $value = " ' . \$db->quote(".$whe['value_key']."));"; + $value = " ' . \$db->quote(" . $whe['value_key'] . "));"; } else { - $value = " ".$whe['value_key']."');"; + $value = " " . $whe['value_key'] . "');"; } } elseif (ComponentbuilderHelper::checkString($whe['value_key'])) { - $value = " ".$whe['value_key']."');"; + $value = " " . $whe['value_key'] . "');"; } // only load if there is a value if (ComponentbuilderHelper::checkString($value)) @@ -1953,30 +1952,29 @@ class Interpretation extends Fields // set the string if ($whe['operator'] === 'IN' || $whe['operator'] === 'NOT IN') { - $string = "if (isset(" . $whe['value_key']. ") && ".$this->fileContentStatic['###Component###']."Helper::checkArray(" . $whe['value_key']. "))"; - $string .= PHP_EOL."\t".$tabe."\t{"; - $string .= PHP_EOL."\t".$tabe."\t\t//".$this->setLine(__LINE__)." Get where ".$whe['table_key']." is " . $whe['value_key']; - $string .= PHP_EOL."\t".$tabe."\t\t\$query->where('".$whe['table_key']." ".$whe['operator'].$value; - $string .= PHP_EOL."\t".$tabe."\t}"; - $string .= PHP_EOL."\t".$tabe."\telse"; - $string .= PHP_EOL."\t".$tabe."\t{"; - $string .= PHP_EOL."\t".$tabe."\t\treturn false;"; - $string .= PHP_EOL."\t".$tabe."\t}"; - + $string = "if (isset(" . $whe['value_key'] . ") && " . $this->fileContentStatic['###Component###'] . "Helper::checkArray(" . $whe['value_key'] . "))"; + $string .= PHP_EOL . "\t" . $tabe . "\t{"; + $string .= PHP_EOL . "\t" . $tabe . "\t\t//" . $this->setLine(__LINE__) . " Get where " . $whe['table_key'] . " is " . $whe['value_key']; + $string .= PHP_EOL . "\t" . $tabe . "\t\t\$query->where('" . $whe['table_key'] . " " . $whe['operator'] . $value; + $string .= PHP_EOL . "\t" . $tabe . "\t}"; + $string .= PHP_EOL . "\t" . $tabe . "\telse"; + $string .= PHP_EOL . "\t" . $tabe . "\t{"; + $string .= PHP_EOL . "\t" . $tabe . "\t\treturn false;"; + $string .= PHP_EOL . "\t" . $tabe . "\t}"; } else { - $string = "//".$this->setLine(__LINE__)." Get where ".$whe['table_key']." is " . $whe['value_key']; - $string .= PHP_EOL."\t".$tabe."\t\$query->where('".$whe['table_key']." ".$whe['operator'].$value; + $string = "//" . $this->setLine(__LINE__) . " Get where " . $whe['table_key'] . " is " . $whe['value_key']; + $string .= PHP_EOL . "\t" . $tabe . "\t\$query->where('" . $whe['table_key'] . " " . $whe['operator'] . $value; } // sort where if ($as === 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as]))) { - $wheres .= PHP_EOL."\t".$tab."\t".$string; + $wheres .= PHP_EOL . "\t" . $tab . "\t" . $string; } elseif ($as !== 'a') { - $this->otherWhere[$this->target][$code][$as][$field] = PHP_EOL."\t\t".$string; + $this->otherWhere[$this->target][$code][$as][$field] = PHP_EOL . "\t\t" . $string; } } } @@ -1984,7 +1982,7 @@ class Interpretation extends Fields return $wheres; } - public function setCustomViewGlobals(&$global,$string,$as,$tab = '') + public function setCustomViewGlobals(&$global, $string, $as, $tab = '') { $globals = ''; if (ComponentbuilderHelper::checkArray($global)) @@ -1992,23 +1990,23 @@ class Interpretation extends Fields $as = array_unique($as); foreach ($global as $glo) { - if (in_array($glo['as'],$as)) + if (in_array($glo['as'], $as)) { switch ($glo['type']) { case 1: - // SET STATE - $value = "\$this->setState('" . $glo['as'] . "." . $glo['name'] . "', " . $string . "->" . $glo['key'] . ");"; - break; + // SET STATE + $value = "\$this->setState('" . $glo['as'] . "." . $glo['name'] . "', " . $string . "->" . $glo['key'] . ");"; + break; case 2: - // SET THIS - $value = "\$this->" . $glo['as'] . "_" . $glo['name'] . " = " . $string . "->" . $glo['key'] . ";"; - break; + // SET THIS + $value = "\$this->" . $glo['as'] . "_" . $glo['name'] . " = " . $string . "->" . $glo['key'] . ";"; + break; } // only add if the filter is set if (ComponentbuilderHelper::checkString($value)) { - $globals .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." set the global " . $glo['name'] . " value.".PHP_EOL."\t".$tab."\t".$value; + $globals .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " set the global " . $glo['name'] . " value." . PHP_EOL . "\t" . $tab . "\t" . $value; } } } @@ -2020,12 +2018,12 @@ class Interpretation extends Fields * @param $string * @param string $type * @return mixed - */ + */ public function removeAsDot($string, $type = '') { - if (strpos($string,'.') !== false) + if (strpos($string, '.') !== false) { - list($dump,$field) = array_map('trim', explode('.',$string)); + list($dump, $field) = array_map('trim', explode('.', $string)); } else { @@ -2033,7 +2031,7 @@ class Interpretation extends Fields } return $field; } - + /** * @param type $view * @param type $type @@ -2042,7 +2040,7 @@ class Interpretation extends Fields { if (isset($view['access']) && $view['access'] == 1) { - switch($type) + switch ($type) { case 1: $userString = '$this->user'; @@ -2054,32 +2052,32 @@ class Interpretation extends Fields // check that the default and the redirect page is not the same if (isset($this->fileContentStatic['###SITE_DEFAULT_VIEW###']) && $this->fileContentStatic['###SITE_DEFAULT_VIEW###'] != $view['settings']->code) { - $redirectMessage = "\t\t\t//".$this->setLine(__LINE__)." redirect away to the default view if no access allowed."; - $redirectString = "JRoute::_('index.php?option=com_".$this->fileContentStatic['###component###']."&view=".$this->fileContentStatic['###SITE_DEFAULT_VIEW###']."')"; + $redirectMessage = "\t\t\t//" . $this->setLine(__LINE__) . " redirect away to the default view if no access allowed."; + $redirectString = "JRoute::_('index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $this->fileContentStatic['###SITE_DEFAULT_VIEW###'] . "')"; } else { - $redirectMessage = "\t\t\t//".$this->setLine(__LINE__)." redirect away to the home page if no access allowed."; + $redirectMessage = "\t\t\t//" . $this->setLine(__LINE__) . " redirect away to the home page if no access allowed."; $redirectString = 'JURI::root()'; } - $accessCheck[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." check if this user has permission to access item"; - $accessCheck[] = "\t\tif (!".$userString."->authorise('site.".$view['settings']->code.".access', 'com_".$this->fileContentStatic['###component###']."'))"; + $accessCheck[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " check if this user has permission to access item"; + $accessCheck[] = "\t\tif (!" . $userString . "->authorise('site." . $view['settings']->code . ".access', 'com_" . $this->fileContentStatic['###component###'] . "'))"; $accessCheck[] = "\t\t{"; $accessCheck[] = "\t\t\t\$app = JFactory::getApplication();"; // set lang - $langKeyWord = $this->langPrefix.'_'.ComponentbuilderHelper::safeString('Not authorised to view '.$view['settings']->code.'!','U'); + $langKeyWord = $this->langPrefix . '_' . ComponentbuilderHelper::safeString('Not authorised to view ' . $view['settings']->code . '!', 'U'); if (!isset($this->langContent['site'][$langKeyWord])) { - $this->langContent['site'][$langKeyWord] = 'Not authorised to view '.$view['settings']->code.'!'; + $this->langContent['site'][$langKeyWord] = 'Not authorised to view ' . $view['settings']->code . '!'; } - $accessCheck[] = "\t\t\t\$app->enqueueMessage(JText::_('".$langKeyWord."'), 'error');"; + $accessCheck[] = "\t\t\t\$app->enqueueMessage(JText::_('" . $langKeyWord . "'), 'error');"; $accessCheck[] = $redirectMessage; - $accessCheck[] = "\t\t\t\$app->redirect(".$redirectString.");"; + $accessCheck[] = "\t\t\t\$app->redirect(" . $redirectString . ");"; $accessCheck[] = "\t\t\treturn false;"; $accessCheck[] = "\t\t}"; - + // return the access check - return implode(PHP_EOL,$accessCheck); + return implode(PHP_EOL, $accessCheck); } return ''; } @@ -2090,7 +2088,7 @@ class Interpretation extends Fields * @param string $tab * @param string $type * @return string - */ + */ public function setCustomViewGetItem(&$get, &$code, $tab = '', $type = 'main') { if (ComponentbuilderHelper::checkObject($get)) @@ -2098,59 +2096,59 @@ class Interpretation extends Fields $this->siteDecrypt['basic'][$code] = false; $this->siteDecrypt['advanced'][$code] = false; - $getItem = PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Get a db connection."; - $getItem .= PHP_EOL."\t".$tab."\t\$db = JFactory::getDbo();"; - $getItem .= PHP_EOL.PHP_EOL.$tab."\t\t//".$this->setLine(__LINE__)." Create a new query object."; - $getItem .= PHP_EOL."\t".$tab."\t\$query = \$db->getQuery(true);"; + $getItem = PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get a db connection."; + $getItem .= PHP_EOL . "\t" . $tab . "\t\$db = JFactory::getDbo();"; + $getItem .= PHP_EOL . PHP_EOL . $tab . "\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; + $getItem .= PHP_EOL . "\t" . $tab . "\t\$query = \$db->getQuery(true);"; // set main get query - $getItem .= $this->setCustomViewQuery($get->main_get,$code,$tab); + $getItem .= $this->setCustomViewQuery($get->main_get, $code, $tab); // setup filters - $getItem .= $this->setCustomViewFilter($get->filter,$code,$tab); + $getItem .= $this->setCustomViewFilter($get->filter, $code, $tab); // setup Where - $getItem .= $this->setCustomViewWhere($get->where,$code,$tab); + $getItem .= $this->setCustomViewWhere($get->where, $code, $tab); // setup ordering - $getItem .= $this->setCustomViewOrder($get->order,$code,$tab); + $getItem .= $this->setCustomViewOrder($get->order, $code, $tab); // get ready to get query - $getItem .= PHP_EOL.PHP_EOL.$tab."\t\t//".$this->setLine(__LINE__)." Reset the query using our newly populated query object."; - $getItem .= PHP_EOL."\t".$tab."\t\$db->setQuery(\$query);"; - $getItem .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Load the results as a stdClass object."; - $getItem .= PHP_EOL."\t".$tab."\t\$data = \$db->loadObject();"; - $getItem .= PHP_EOL.PHP_EOL.$tab."\t\tif (empty(\$data))"; - $getItem .= PHP_EOL."\t".$tab."\t{"; + $getItem .= PHP_EOL . PHP_EOL . $tab . "\t\t//" . $this->setLine(__LINE__) . " Reset the query using our newly populated query object."; + $getItem .= PHP_EOL . "\t" . $tab . "\t\$db->setQuery(\$query);"; + $getItem .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Load the results as a stdClass object."; + $getItem .= PHP_EOL . "\t" . $tab . "\t\$data = \$db->loadObject();"; + $getItem .= PHP_EOL . PHP_EOL . $tab . "\t\tif (empty(\$data))"; + $getItem .= PHP_EOL . "\t" . $tab . "\t{"; if ($type === 'main') { - $getItem .= PHP_EOL."\t".$tab."\t\t\$app = JFactory::getApplication();"; - $langKeyWoord = $this->langPrefix.'_'.ComponentbuilderHelper::safeString('Not found or access denied','U'); + $getItem .= PHP_EOL . "\t" . $tab . "\t\t\$app = JFactory::getApplication();"; + $langKeyWoord = $this->langPrefix . '_' . ComponentbuilderHelper::safeString('Not found or access denied', 'U'); if (!isset($this->langContent[$this->lang][$langKeyWoord])) { $this->langContent[$this->lang][$langKeyWoord] = 'Not found, or access denied.'; } - $getItem .= PHP_EOL."\t".$tab."\t\t//".$this->setLine(__LINE__)." If no data is found redirect to default page and show warning."; - $getItem .= PHP_EOL."\t".$tab."\t\t\$app->enqueueMessage(JText::_('".$langKeyWoord."'), 'warning');"; + $getItem .= PHP_EOL . "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " If no data is found redirect to default page and show warning."; + $getItem .= PHP_EOL . "\t" . $tab . "\t\t\$app->enqueueMessage(JText::_('" . $langKeyWoord . "'), 'warning');"; if ('site' === $this->target) { // check that the default and the redirect page is not the same if (isset($this->fileContentStatic['###SITE_DEFAULT_VIEW###']) && $this->fileContentStatic['###SITE_DEFAULT_VIEW###'] != $code) { - $redirectString = "JRoute::_('index.php?option=com_".$this->fileContentStatic['###component###']."&view=".$this->fileContentStatic['###SITE_DEFAULT_VIEW###']."')"; + $redirectString = "JRoute::_('index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $this->fileContentStatic['###SITE_DEFAULT_VIEW###'] . "')"; } else { $redirectString = 'JURI::root()'; } - $getItem .= PHP_EOL."\t".$tab."\t\t\$app->redirect(".$redirectString.");"; + $getItem .= PHP_EOL . "\t" . $tab . "\t\t\$app->redirect(" . $redirectString . ");"; } else { - $getItem .= PHP_EOL."\t".$tab."\t\t\$app->redirect('index.php?option=com_".$this->fileContentStatic['###component###']."');"; + $getItem .= PHP_EOL . "\t" . $tab . "\t\t\$app->redirect('index.php?option=com_" . $this->fileContentStatic['###component###'] . "');"; } - $getItem .= PHP_EOL."\t".$tab."\t\treturn false;"; + $getItem .= PHP_EOL . "\t" . $tab . "\t\treturn false;"; } else { - $getItem .= PHP_EOL."\t".$tab."\t\treturn false;"; + $getItem .= PHP_EOL . "\t" . $tab . "\t\treturn false;"; } - $getItem .= PHP_EOL."\t".$tab."\t}"; + $getItem .= PHP_EOL . "\t" . $tab . "\t}"; // dispatcher placholder $getItem .= "###DISPATCHER###"; if (ComponentbuilderHelper::checkArray($get->main_get)) @@ -2164,20 +2162,20 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkArray($decodeChecker)) { // set decoding of needed fields - $getItem .= $this->setCustomViewFieldDecode($main_get,$decodeChecker,'$data',$code,$tab); + $getItem .= $this->setCustomViewFieldDecode($main_get, $decodeChecker, '$data', $code, $tab); } } - - if (isset ($this->siteFieldDecodeFilter[$this->target][$code][$main_get['key']][$main_get['as']])) + + if (isset($this->siteFieldDecodeFilter[$this->target][$code][$main_get['key']][$main_get['as']])) { $decodeFilter = $this->siteFieldDecodeFilter[$this->target][$code][$main_get['key']][$main_get['as']]; if (ComponentbuilderHelper::checkArray($decodeFilter)) { // also filter fields if needed - $getItem .= $this->setCustomViewFieldDecodeFilter($main_get,$decodeFilter,'$data','$data',$code,$tab); + $getItem .= $this->setCustomViewFieldDecodeFilter($main_get, $decodeFilter, '$data', '$data', $code, $tab); } } - + if (isset($this->siteFieldData['textareas'][$code][$main_get['key']][$main_get['as']])) { $contentprepareChecker = $this->siteFieldData['textareas'][$code][$main_get['key']][$main_get['as']]; @@ -2187,7 +2185,7 @@ class Interpretation extends Fields $getItem .= $this->setCustomViewFieldonContentPrepareChecker($main_get, $contentprepareChecker, '$data', $code, $tab); } } - + if (isset($this->siteFieldData['uikit'][$code][$main_get['key']][$main_get['as']])) { $uikitChecker = $this->siteFieldData['uikit'][$code][$main_get['key']][$main_get['as']]; @@ -2203,53 +2201,53 @@ class Interpretation extends Fields if ((isset($this->siteDecrypt['basic'][$code]) && $this->siteDecrypt['basic'][$code]) || (isset($this->siteDecrypt['advanced'][$code]) && $this->siteDecrypt['advanced'][$code])) { - $Component = $this->fileContentStatic['###Component###']; + $Component = $this->fileContentStatic['###Component###']; $script = ''; if (isset($this->siteDecrypt['basic'][$code]) && $this->siteDecrypt['basic'][$code]) { - $script .= PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Get the basic encryption."; - $script .= PHP_EOL."\t".$tab."\t\$basickey = ".$Component."Helper::getCryptKey('basic');"; - $script .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Get the encryption object."; - $script .= PHP_EOL."\t".$tab."\t\$basic = new FOFEncryptAes(\$basickey, 128);"; + $script .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; + $script .= PHP_EOL . "\t" . $tab . "\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; + $script .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the encryption object."; + $script .= PHP_EOL . "\t" . $tab . "\t\$basic = new FOFEncryptAes(\$basickey, 128);"; } if (isset($this->siteDecrypt['advanced'][$code]) && $this->siteDecrypt['advanced'][$code]) { - $script .= PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Get the advanced encryption."; - $script .= PHP_EOL."\t".$tab."\t\$advancedkey = ".$Component."Helper::getCryptKey('advanced');"; - $script .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Get the encryption object."; - $script .= PHP_EOL."\t".$tab."\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; + $script .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the advanced encryption."; + $script .= PHP_EOL . "\t" . $tab . "\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; + $script .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the encryption object."; + $script .= PHP_EOL . "\t" . $tab . "\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; } $getItem = $script . $getItem; } // setup Globals - $getItem .= $this->setCustomViewGlobals($get->global,'$data',$asBucket,$tab); + $getItem .= $this->setCustomViewGlobals($get->global, '$data', $asBucket, $tab); // setup the custom gets that returns multipal values - $getItem .= $this->setCustomViewCustomJoin($get->custom_get,'$data',$code,$asBucket,$tab); + $getItem .= $this->setCustomViewCustomJoin($get->custom_get, '$data', $code, $asBucket, $tab); // set calculations if ($get->addcalculation == 1) { - $get->php_calculation = (array) explode(PHP_EOL,$get->php_calculation); - $getItem .= PHP_EOL."\t".$tab."\t".implode(PHP_EOL."\t".$tab."\t",$get->php_calculation); + $get->php_calculation = (array) explode(PHP_EOL, $get->php_calculation); + $getItem .= PHP_EOL . "\t" . $tab . "\t" . implode(PHP_EOL . "\t" . $tab . "\t", $get->php_calculation); } if ($type === 'custom') { // return the object - $getItem .= PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." return data object."; - $getItem .= PHP_EOL."\t".$tab."\treturn \$data;"; + $getItem .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " return data object."; + $getItem .= PHP_EOL . "\t" . $tab . "\treturn \$data;"; } else { // set the object - $getItem .= PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." set data object to item."; - $getItem .= PHP_EOL."\t".$tab."\t\$this->_item[\$pk] = \$data;"; + $getItem .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " set data object to item."; + $getItem .= PHP_EOL . "\t" . $tab . "\t\$this->_item[\$pk] = \$data;"; } // check if the dispather should be added return str_replace(array_keys($this->JEventDispatcher), array_values($this->JEventDispatcher), $getItem); } - return PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)."add your custom code here."; + return PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . "add your custom code here."; } - public function setCustomViewCustomMethods($main_view,$code) + public function setCustomViewCustomMethods($main_view, $code) { $methods = ''; // then set the needed custom methods @@ -2266,51 +2264,51 @@ class Interpretation extends Fields if ($view->gettype == 3) { // ###SITE_GET_ITEM### <<>> - $main .= PHP_EOL.PHP_EOL."\t\tif (!isset(\$this->initSet) || !\$this->initSet)"; - $main .= PHP_EOL."\t\t{"; - $main .= PHP_EOL."\t\t\t\$this->user\t\t= JFactory::getUser();"; - $main .= PHP_EOL."\t\t\t\$this->userId\t\t= \$this->user->get('id');"; - $main .= PHP_EOL."\t\t\t\$this->guest\t\t= \$this->user->get('guest');"; - $main .= PHP_EOL."\t\t\t\$this->groups\t\t= \$this->user->get('groups');"; - $main .= PHP_EOL."\t\t\t\$this->authorisedGroups\t= \$this->user->getAuthorisedGroups();"; - $main .= PHP_EOL."\t\t\t\$this->levels\t\t= \$this->user->getAuthorisedViewLevels();"; - $main .= PHP_EOL."\t\t\t\$this->initSet\t\t= true;"; - $main .= PHP_EOL."\t\t}"; - $main .= $this->setCustomViewGetItem($view, $view->code,'','custom'); + $main .= PHP_EOL . PHP_EOL . "\t\tif (!isset(\$this->initSet) || !\$this->initSet)"; + $main .= PHP_EOL . "\t\t{"; + $main .= PHP_EOL . "\t\t\t\$this->user\t\t= JFactory::getUser();"; + $main .= PHP_EOL . "\t\t\t\$this->userId\t\t= \$this->user->get('id');"; + $main .= PHP_EOL . "\t\t\t\$this->guest\t\t= \$this->user->get('guest');"; + $main .= PHP_EOL . "\t\t\t\$this->groups\t\t= \$this->user->get('groups');"; + $main .= PHP_EOL . "\t\t\t\$this->authorisedGroups\t= \$this->user->getAuthorisedGroups();"; + $main .= PHP_EOL . "\t\t\t\$this->levels\t\t= \$this->user->getAuthorisedViewLevels();"; + $main .= PHP_EOL . "\t\t\t\$this->initSet\t\t= true;"; + $main .= PHP_EOL . "\t\t}"; + $main .= $this->setCustomViewGetItem($view, $view->code, '', 'custom'); $type = 'mixed item data object on success, false on failure.'; } elseif ($view->gettype == 4) { - $main .= PHP_EOL.PHP_EOL."\t\tif (!isset(\$this->initSet) || !\$this->initSet)"; - $main .= PHP_EOL."\t\t{"; - $main .= PHP_EOL."\t\t\t\$this->user\t\t= JFactory::getUser();"; - $main .= PHP_EOL."\t\t\t\$this->userId\t\t= \$this->user->get('id');"; - $main .= PHP_EOL."\t\t\t\$this->guest\t\t= \$this->user->get('guest');"; - $main .= PHP_EOL."\t\t\t\$this->groups\t\t= \$this->user->get('groups');"; - $main .= PHP_EOL."\t\t\t\$this->authorisedGroups\t= \$this->user->getAuthorisedGroups();"; - $main .= PHP_EOL."\t\t\t\$this->levels\t\t= \$this->user->getAuthorisedViewLevels();"; - $main .= PHP_EOL."\t\t\t\$this->initSet\t\t= true;"; - $main .= PHP_EOL."\t\t}"; - $main .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the global params"; - $main .= PHP_EOL."\t\t\$globalParams = JComponentHelper::getParams('com_".$this->fileContentStatic['###component###']."', true);"; + $main .= PHP_EOL . PHP_EOL . "\t\tif (!isset(\$this->initSet) || !\$this->initSet)"; + $main .= PHP_EOL . "\t\t{"; + $main .= PHP_EOL . "\t\t\t\$this->user\t\t= JFactory::getUser();"; + $main .= PHP_EOL . "\t\t\t\$this->userId\t\t= \$this->user->get('id');"; + $main .= PHP_EOL . "\t\t\t\$this->guest\t\t= \$this->user->get('guest');"; + $main .= PHP_EOL . "\t\t\t\$this->groups\t\t= \$this->user->get('groups');"; + $main .= PHP_EOL . "\t\t\t\$this->authorisedGroups\t= \$this->user->getAuthorisedGroups();"; + $main .= PHP_EOL . "\t\t\t\$this->levels\t\t= \$this->user->getAuthorisedViewLevels();"; + $main .= PHP_EOL . "\t\t\t\$this->initSet\t\t= true;"; + $main .= PHP_EOL . "\t\t}"; + $main .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the global params"; + $main .= PHP_EOL . "\t\t\$globalParams = JComponentHelper::getParams('com_" . $this->fileContentStatic['###component###'] . "', true);"; // ###SITE_GET_LIST_QUERY### <<>> $main .= $this->setCustomViewListQuery($view, $view->code, false); // load the object list - $main .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Reset the query using our newly populated query object."; - $main .= PHP_EOL."\t\t\$db->setQuery(\$query);"; - $main .= PHP_EOL."\t\t\$items = \$db->loadObjectList();"; - $main .= PHP_EOL.PHP_EOL."\t\tif (empty(\$items))"; - $main .= PHP_EOL."\t\t{"; - $main .= PHP_EOL."\t\t\treturn false;"; - $main .= PHP_EOL."\t\t}"; + $main .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Reset the query using our newly populated query object."; + $main .= PHP_EOL . "\t\t\$db->setQuery(\$query);"; + $main .= PHP_EOL . "\t\t\$items = \$db->loadObjectList();"; + $main .= PHP_EOL . PHP_EOL . "\t\tif (empty(\$items))"; + $main .= PHP_EOL . "\t\t{"; + $main .= PHP_EOL . "\t\t\treturn false;"; + $main .= PHP_EOL . "\t\t}"; // ###SITE_GET_ITEMS### <<>> - $main .= $this->setCustomViewGetItems($view,$view->code); - $main .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." return items"; - $main .= PHP_EOL."\t\treturn \$items;"; + $main .= $this->setCustomViewGetItems($view, $view->code); + $main .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " return items"; + $main .= PHP_EOL . "\t\treturn \$items;"; $type = 'mixed An array of objects on success, false on failure.'; } // load the main mehtod - $methods .= $this->setMainCustomMehtod($main,$view->getcustom,$type); + $methods .= $this->setMainCustomMehtod($main, $view->getcustom, $type); // ###SITE_CUSTOM_METHODS### <<>> $methods .= $this->setCustomViewCustomItemMethods($view, $view->code); } @@ -2328,7 +2326,7 @@ class Interpretation extends Fields { // build uikit get method $ukit = array(); - $ukit[] = PHP_EOL.PHP_EOL."\t/**"; + $ukit[] = PHP_EOL . PHP_EOL . "\t/**"; $ukit[] = "\t* \tUIKIT Component Classes"; $ukit[] = "\t**/"; $ukit[] = "\tpublic static \$uk_components = array("; @@ -2397,7 +2395,7 @@ class Interpretation extends Fields $ukit[] = "\t{"; $ukit[] = "\t\tif (strpos(\$content,'class=\"uk-') !== false)"; $ukit[] = "\t\t{"; - $ukit[] = "\t\t\t//".$this->setLine(__LINE__)." reset"; + $ukit[] = "\t\t\t//" . $this->setLine(__LINE__) . " reset"; $ukit[] = "\t\t\t\$temp = array();"; $ukit[] = "\t\t\tforeach (self::\$uk_components as \$looking => \$add)"; $ukit[] = "\t\t\t{"; @@ -2406,15 +2404,15 @@ class Interpretation extends Fields $ukit[] = "\t\t\t\t\t\$temp[] = \$looking;"; $ukit[] = "\t\t\t\t}"; $ukit[] = "\t\t\t}"; - $ukit[] = "\t\t\t//".$this->setLine(__LINE__)." make sure uikit is loaded to config"; + $ukit[] = "\t\t\t//" . $this->setLine(__LINE__) . " make sure uikit is loaded to config"; $ukit[] = "\t\t\tif (strpos(\$content,'class=\"uk-') !== false)"; $ukit[] = "\t\t\t{"; $ukit[] = "\t\t\t\tself::\$uikit = true;"; $ukit[] = "\t\t\t}"; - $ukit[] = "\t\t\t//".$this->setLine(__LINE__)." sorter"; + $ukit[] = "\t\t\t//" . $this->setLine(__LINE__) . " sorter"; $ukit[] = "\t\t\tif (self::checkArray(\$temp))"; $ukit[] = "\t\t\t{"; - $ukit[] = "\t\t\t\t//".$this->setLine(__LINE__)." merger"; + $ukit[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " merger"; $ukit[] = "\t\t\t\tif (self::checkArray(\$classes))"; $ukit[] = "\t\t\t\t{"; $ukit[] = "\t\t\t\t\t\$newTemp = array_merge(\$temp,\$classes);"; @@ -2431,7 +2429,7 @@ class Interpretation extends Fields $ukit[] = "\t}"; // return the help methods - return implode(PHP_EOL,$ukit); + return implode(PHP_EOL, $ukit); } return ''; } @@ -2443,44 +2441,44 @@ class Interpretation extends Fields if (2 == $this->uikit || 1 == $this->uikit) { // build uikit get method - $method .= PHP_EOL.PHP_EOL."\t/**"; - $method .= PHP_EOL."\t* Get the uikit needed components"; - $method .= PHP_EOL."\t*"; - $method .= PHP_EOL."\t* @return mixed An array of objects on success."; - $method .= PHP_EOL."\t*"; - $method .= PHP_EOL."\t*/"; - $method .= PHP_EOL."\tpublic function getUikitComp()"; - $method .= PHP_EOL."\t{"; - $method .= PHP_EOL."\t\tif (isset(\$this->uikitComp) && ".$this->fileContentStatic['###Component###']."Helper::checkArray(\$this->uikitComp))"; - $method .= PHP_EOL."\t\t{"; - $method .= PHP_EOL."\t\t\treturn \$this->uikitComp;"; - $method .= PHP_EOL."\t\t}"; - $method .= PHP_EOL."\t\treturn false;"; - $method .= PHP_EOL."\t}"; + $method .= PHP_EOL . PHP_EOL . "\t/**"; + $method .= PHP_EOL . "\t* Get the uikit needed components"; + $method .= PHP_EOL . "\t*"; + $method .= PHP_EOL . "\t* @return mixed An array of objects on success."; + $method .= PHP_EOL . "\t*"; + $method .= PHP_EOL . "\t*/"; + $method .= PHP_EOL . "\tpublic function getUikitComp()"; + $method .= PHP_EOL . "\t{"; + $method .= PHP_EOL . "\t\tif (isset(\$this->uikitComp) && " . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$this->uikitComp))"; + $method .= PHP_EOL . "\t\t{"; + $method .= PHP_EOL . "\t\t\treturn \$this->uikitComp;"; + $method .= PHP_EOL . "\t\t}"; + $method .= PHP_EOL . "\t\treturn false;"; + $method .= PHP_EOL . "\t}"; } return $method; } - public function setMainCustomMehtod(&$body,$nAme,$type) + public function setMainCustomMehtod(&$body, $nAme, $type) { $method = ''; if (ComponentbuilderHelper::checkString($body)) { // build custom method - $method .= PHP_EOL.PHP_EOL."\t/**"; - $method .= PHP_EOL."\t* Custom Method"; - $method .= PHP_EOL."\t*"; - $method .= PHP_EOL."\t* @return ".$type; - $method .= PHP_EOL."\t*"; - $method .= PHP_EOL."\t*/"; - $method .= PHP_EOL."\tpublic function ".$nAme."()"; - $method .= PHP_EOL."\t{".$body; - $method .= PHP_EOL."\t}"; + $method .= PHP_EOL . PHP_EOL . "\t/**"; + $method .= PHP_EOL . "\t* Custom Method"; + $method .= PHP_EOL . "\t*"; + $method .= PHP_EOL . "\t* @return " . $type; + $method .= PHP_EOL . "\t*"; + $method .= PHP_EOL . "\t*/"; + $method .= PHP_EOL . "\tpublic function " . $nAme . "()"; + $method .= PHP_EOL . "\t{" . $body; + $method .= PHP_EOL . "\t}"; } return $method; } - public function setCustomViewCustomItemMethods(&$main_get,$code) + public function setCustomViewCustomItemMethods(&$main_get, $code) { $methods = ''; // first set the needed item/s methods @@ -2493,40 +2491,40 @@ class Interpretation extends Fields $this->siteDecrypt['basic'][$code] = false; $this->siteDecrypt['advanced'][$code] = false; // set the method defaults - $default = $this->setCustomViewMethodDefaults($get,$code); + $default = $this->setCustomViewMethodDefaults($get, $code); // build custom method - $methods .= PHP_EOL.PHP_EOL."\t/**"; - $methods .= PHP_EOL."\t* Method to get an array of ".$default['name']." Objects."; - $methods .= PHP_EOL."\t*"; - $methods .= PHP_EOL."\t* @return mixed An array of ".$default['name']." Objects on success, false on failure."; - $methods .= PHP_EOL."\t*"; - $methods .= PHP_EOL."\t*/"; - $methods .= PHP_EOL."\tpublic function get".$default['methodName']."(\$".$default['on_field'].")"; - $methods .= PHP_EOL."\t{###CRYPT###"; - $methods .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get a db connection."; - $methods .= PHP_EOL."\t\t\$db = JFactory::getDbo();"; - $methods .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Create a new query object."; - $methods .= PHP_EOL."\t\t\$query = \$db->getQuery(true);"; - $methods .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get from ".$get['selection']['table']." as ".$default['as']; - $methods .= PHP_EOL."\t\t".$get['selection']['select']; - $methods .= PHP_EOL."\t\t".'$query->from('.$get['selection']['from'].');'; + $methods .= PHP_EOL . PHP_EOL . "\t/**"; + $methods .= PHP_EOL . "\t* Method to get an array of " . $default['name'] . " Objects."; + $methods .= PHP_EOL . "\t*"; + $methods .= PHP_EOL . "\t* @return mixed An array of " . $default['name'] . " Objects on success, false on failure."; + $methods .= PHP_EOL . "\t*"; + $methods .= PHP_EOL . "\t*/"; + $methods .= PHP_EOL . "\tpublic function get" . $default['methodName'] . "(\$" . $default['on_field'] . ")"; + $methods .= PHP_EOL . "\t{###CRYPT###"; + $methods .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get a db connection."; + $methods .= PHP_EOL . "\t\t\$db = JFactory::getDbo();"; + $methods .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; + $methods .= PHP_EOL . "\t\t\$query = \$db->getQuery(true);"; + $methods .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get from " . $get['selection']['table'] . " as " . $default['as']; + $methods .= PHP_EOL . "\t\t" . $get['selection']['select']; + $methods .= PHP_EOL . "\t\t" . '$query->from(' . $get['selection']['from'] . ');'; // set the string if ($get['operator'] === 'IN' || $get['operator'] === 'NOT IN') { - $methods .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Check if \$" . $default['on_field'] . " is an array with values."; - $methods .= PHP_EOL."\t\t\$array = \$" . $default['on_field'] . ";"; - $methods .= PHP_EOL."\t\tif (isset(\$array) && ".$this->fileContentStatic['###Component###']."Helper::checkArray(\$array, true))"; - $methods .= PHP_EOL."\t\t{"; - $methods .= PHP_EOL."\t\t\t\$query->where('".$get['join_field']." ".$get['operator']." (' . implode(',', \$array) . ')');"; - $methods .= PHP_EOL."\t\t}"; - $methods .= PHP_EOL."\t\telse"; - $methods .= PHP_EOL."\t\t{"; - $methods .= PHP_EOL."\t\t\treturn false;"; - $methods .= PHP_EOL."\t\t}"; + $methods .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Check if \$" . $default['on_field'] . " is an array with values."; + $methods .= PHP_EOL . "\t\t\$array = \$" . $default['on_field'] . ";"; + $methods .= PHP_EOL . "\t\tif (isset(\$array) && " . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$array, true))"; + $methods .= PHP_EOL . "\t\t{"; + $methods .= PHP_EOL . "\t\t\t\$query->where('" . $get['join_field'] . " " . $get['operator'] . " (' . implode(',', \$array) . ')');"; + $methods .= PHP_EOL . "\t\t}"; + $methods .= PHP_EOL . "\t\telse"; + $methods .= PHP_EOL . "\t\t{"; + $methods .= PHP_EOL . "\t\t\treturn false;"; + $methods .= PHP_EOL . "\t\t}"; } else { - $methods .= PHP_EOL."\t\t\$query->where('".$get['join_field']." ".$get['operator']." ' . \$db->quote(\$".$default['on_field']."));"; + $methods .= PHP_EOL . "\t\t\$query->where('" . $get['join_field'] . " " . $get['operator'] . " ' . \$db->quote(\$" . $default['on_field'] . "));"; } // check if other queries should be loaded $queryChecker = (isset($this->otherQuery[$this->target][$default['code']][$default['as']]) && ComponentbuilderHelper::checkArray($this->otherQuery[$this->target][$default['code']][$default['as']])) ? $this->otherQuery[$this->target][$default['code']][$default['as']] : ''; @@ -2561,12 +2559,12 @@ class Interpretation extends Fields $methods .= $string; } } - $methods .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Reset the query using our newly populated query object."; - $methods .= PHP_EOL."\t\t\$db->setQuery(\$query);"; - $methods .= PHP_EOL."\t\t\$db->execute();"; - $methods .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." check if there was data returned"; - $methods .= PHP_EOL."\t\tif (\$db->getNumRows())"; - $methods .= PHP_EOL."\t\t{"; + $methods .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Reset the query using our newly populated query object."; + $methods .= PHP_EOL . "\t\t\$db->setQuery(\$query);"; + $methods .= PHP_EOL . "\t\t\$db->execute();"; + $methods .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " check if there was data returned"; + $methods .= PHP_EOL . "\t\tif (\$db->getNumRows())"; + $methods .= PHP_EOL . "\t\t{"; // set dispatcher placeholder $methods .= "###DISPATCHER###"; // set decoding of needed fields @@ -2592,32 +2590,32 @@ class Interpretation extends Fields // set joined values $placeholders = array('###TAB###' => "\t\t", '###STRING###' => '$item'); $joinedChecker = (isset($this->otherJoin[$this->target][$default['code']][$default['as']]) && ComponentbuilderHelper::checkArray($this->otherJoin[$this->target][$default['code']][$default['as']])) ? $this->otherJoin[$this->target][$default['code']][$default['as']] : ''; - if ( (isset($decodeChecker) && ComponentbuilderHelper::checkArray($decodeChecker)) || - (isset($uikitChecker) && ComponentbuilderHelper::checkArray($uikitChecker)) || - (isset($decodeFilter) && ComponentbuilderHelper::checkArray($decodeFilter)) || - (isset($contentprepareChecker) && ComponentbuilderHelper::checkArray($contentprepareChecker)) || + if ((isset($decodeChecker) && ComponentbuilderHelper::checkArray($decodeChecker)) || + (isset($uikitChecker) && ComponentbuilderHelper::checkArray($uikitChecker)) || + (isset($decodeFilter) && ComponentbuilderHelper::checkArray($decodeFilter)) || + (isset($contentprepareChecker) && ComponentbuilderHelper::checkArray($contentprepareChecker)) || ComponentbuilderHelper::checkArray($joinedChecker)) { $decoder = ''; if (isset($decodeChecker) && ComponentbuilderHelper::checkArray($decodeChecker)) { // also filter fields if needed - $decoder = $this->setCustomViewFieldDecode($get,$decodeChecker,'$item',$default['code'],"\t\t"); + $decoder = $this->setCustomViewFieldDecode($get, $decodeChecker, '$item', $default['code'], "\t\t"); } $decoder_filter = ''; if (isset($decodeFilter) && ComponentbuilderHelper::checkArray($decodeFilter)) { - $decoder_filter = $this->setCustomViewFieldDecodeFilter($get,$decodeFilter,'$item','$items[$nr]',$default['code'],"\t\t"); + $decoder_filter = $this->setCustomViewFieldDecodeFilter($get, $decodeFilter, '$item', '$items[$nr]', $default['code'], "\t\t"); } $contentprepare = ''; if (isset($contentprepareChecker) && ComponentbuilderHelper::checkArray($contentprepareChecker)) { - $contentprepare = $this->setCustomViewFieldonContentPrepareChecker($get,$contentprepareChecker,'$item',$default['code'],"\t\t"); + $contentprepare = $this->setCustomViewFieldonContentPrepareChecker($get, $contentprepareChecker, '$item', $default['code'], "\t\t"); } $uikit = ''; if (isset($uikitChecker) && ComponentbuilderHelper::checkArray($uikitChecker)) { - $uikit = $this->setCustomViewFieldUikitChecker($get,$uikitChecker,'$item',$default['code'],"\t\t"); + $uikit = $this->setCustomViewFieldUikitChecker($get, $uikitChecker, '$item', $default['code'], "\t\t"); } $joine = ''; if (ComponentbuilderHelper::checkArray($joinedChecker)) @@ -2629,10 +2627,10 @@ class Interpretation extends Fields } if (ComponentbuilderHelper::checkString($decoder) || ComponentbuilderHelper::checkString($contentprepare) || ComponentbuilderHelper::checkString($uikit) || ComponentbuilderHelper::checkString($decoder_filter) || ComponentbuilderHelper::checkString($joine)) { - $methods .= PHP_EOL."\t\t\t\$items = \$db->loadObjectList();"; - $methods .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Convert the parameter fields into objects."; - $methods .= PHP_EOL."\t\t\tforeach (\$items as \$nr => &\$item)"; - $methods .= PHP_EOL."\t\t\t{"; + $methods .= PHP_EOL . "\t\t\t\$items = \$db->loadObjectList();"; + $methods .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Convert the parameter fields into objects."; + $methods .= PHP_EOL . "\t\t\tforeach (\$items as \$nr => &\$item)"; + $methods .= PHP_EOL . "\t\t\t{"; if (ComponentbuilderHelper::checkString($decoder)) { $methods .= $decoder; @@ -2653,136 +2651,136 @@ class Interpretation extends Fields { $methods .= $joine; } - $methods .= PHP_EOL."\t\t\t}"; - $methods .= PHP_EOL."\t\t\treturn \$items;"; + $methods .= PHP_EOL . "\t\t\t}"; + $methods .= PHP_EOL . "\t\t\treturn \$items;"; } else { - $methods .= PHP_EOL."\t\t\treturn \$db->loadObjectList();"; + $methods .= PHP_EOL . "\t\t\treturn \$db->loadObjectList();"; } } else { - $methods .= PHP_EOL."\t\t\treturn \$db->loadObjectList();"; + $methods .= PHP_EOL . "\t\t\treturn \$db->loadObjectList();"; } - $methods .= PHP_EOL."\t\t}"; - $methods .= PHP_EOL."\t\treturn false;"; - $methods .= PHP_EOL."\t}"; + $methods .= PHP_EOL . "\t\t}"; + $methods .= PHP_EOL . "\t\treturn false;"; + $methods .= PHP_EOL . "\t}"; if ((isset($this->siteDecrypt['basic'][$code]) && $this->siteDecrypt['basic'][$code]) || (isset($this->siteDecrypt['advanced'][$code]) && $this->siteDecrypt['advanced'][$code])) { - $Component = $this->fileContentStatic['###Component###']; + $Component = $this->fileContentStatic['###Component###']; $script = ''; if ($this->siteDecrypt['basic'][$code]) { - $script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the basic encryption."; - $script .= PHP_EOL."\t\t\$basickey = ".$Component."Helper::getCryptKey('basic');"; - $script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the encryption object."; - $script .= PHP_EOL."\t\t\$basic = new FOFEncryptAes(\$basickey, 128);".PHP_EOL; + $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; + $script .= PHP_EOL . "\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; + $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; + $script .= PHP_EOL . "\t\t\$basic = new FOFEncryptAes(\$basickey, 128);" . PHP_EOL; } if ($this->siteDecrypt['advanced'][$code]) { - $script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the advanced encryption."; - $script .= PHP_EOL."\t\t\$advancedkey = ".$Component."Helper::getCryptKey('advanced');"; - $script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the encryption object."; - $script .= PHP_EOL."\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);".PHP_EOL; + $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the advanced encryption."; + $script .= PHP_EOL . "\t\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; + $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; + $script .= PHP_EOL . "\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);" . PHP_EOL; } $methods = str_replace('###CRYPT###', $script, $methods); } } // insure the crypt placeholder is removed - $methods = str_replace('###CRYPT###','',$methods); + $methods = str_replace('###CRYPT###', '', $methods); } } // check if the dispatcher must be set - return str_replace(array_keys($this->JEventDispatcher), array_values($this->JEventDispatcher), $methods).PHP_EOL; + return str_replace(array_keys($this->JEventDispatcher), array_values($this->JEventDispatcher), $methods) . PHP_EOL; } - public function setCustomViewMethodDefaults($get,$code) + public function setCustomViewMethodDefaults($get, $code) { - $key = substr(ComponentbuilderHelper::safeString(preg_replace('/[0-9]+/', '', md5($get['key'])),'F'), 0, 4); - $method['on_field'] = (isset($get['on_field'])) ? $this->removeAsDot($get['on_field']):null; - $method['join_field'] = (isset($get['join_field'])) ? ComponentbuilderHelper::safeString($this->removeAsDot($get['join_field'])):null; - $method['Join_field'] = (isset($method['join_field'])) ? ComponentbuilderHelper::safeString($method['join_field'],'F'):null; - $method['name'] = ComponentbuilderHelper::safeString($get['selection']['name'],'F'); + $key = substr(ComponentbuilderHelper::safeString(preg_replace('/[0-9]+/', '', md5($get['key'])), 'F'), 0, 4); + $method['on_field'] = (isset($get['on_field'])) ? $this->removeAsDot($get['on_field']) : null; + $method['join_field'] = (isset($get['join_field'])) ? ComponentbuilderHelper::safeString($this->removeAsDot($get['join_field'])) : null; + $method['Join_field'] = (isset($method['join_field'])) ? ComponentbuilderHelper::safeString($method['join_field'], 'F') : null; + $method['name'] = ComponentbuilderHelper::safeString($get['selection']['name'], 'F'); $method['code'] = ComponentbuilderHelper::safeString($code); - $method['AS'] = ComponentbuilderHelper::safeString($get['as'],'U'); + $method['AS'] = ComponentbuilderHelper::safeString($get['as'], 'U'); $method['as'] = ComponentbuilderHelper::safeString($get['as']); $method['valueName'] = $method['on_field'] . $method['Join_field'] . $method['name'] . $method['AS']; - $method['methodName'] = ComponentbuilderHelper::safeString($method['on_field'],'F') . $method['Join_field'] . $method['name'] . $key .'_'. $method['AS']; + $method['methodName'] = ComponentbuilderHelper::safeString($method['on_field'], 'F') . $method['Join_field'] . $method['name'] . $key . '_' . $method['AS']; // return return $method; } public function getCustomScriptBuilder($first, $second, $prefix = '', $note = null, $unset = null, $default = null, $sufix = '') { - // check if there is any custom script - $script = ''; + // check if there is any custom script + $script = ''; if (isset($this->customScriptBuilder[$first][$second]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$first][$second])) { - // add not if set - if ($note) - { - $script .= $note; - } - $script .= $prefix . str_replace( array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder[$first][$second]) . $sufix; + // add not if set + if ($note) + { + $script .= $note; + } + $script .= $prefix . str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder[$first][$second]) . $sufix; // clear some memory - if ($unset) - { - unset($this->customScriptBuilder[$first][$second]); - } + if ($unset) + { + unset($this->customScriptBuilder[$first][$second]); + } } - // if not found return default - if (!ComponentbuilderHelper::checkString($script) && $default) - { - return $default; - } - return $script; - } + // if not found return default + if (!ComponentbuilderHelper::checkString($script) && $default) + { + return $default; + } + return $script; + } - public function setCustomViewListQuery(&$get,$code,$return = true) + public function setCustomViewListQuery(&$get, $code, $return = true) { if (ComponentbuilderHelper::checkObject($get)) { if ($get->pagination == 1) { - $getItem = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get a db connection."; + $getItem = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get a db connection."; } else { - $getItem = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Make sure all records load, since no pagination allowed."; - $getItem .= PHP_EOL."\t\t\$this->setState('list.limit', 0);"; - $getItem .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get a db connection."; + $getItem = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Make sure all records load, since no pagination allowed."; + $getItem .= PHP_EOL . "\t\t\$this->setState('list.limit', 0);"; + $getItem .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get a db connection."; } - $getItem .= PHP_EOL."\t\t\$db = JFactory::getDbo();"; - $getItem .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Create a new query object."; - $getItem .= PHP_EOL."\t\t\$query = \$db->getQuery(true);"; + $getItem .= PHP_EOL . "\t\t\$db = JFactory::getDbo();"; + $getItem .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; + $getItem .= PHP_EOL . "\t\t\$query = \$db->getQuery(true);"; // check if there is any custom script - $getItem .= $this->getCustomScriptBuilder($this->target.'_php_getlistquery', $code, '', PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Filtering.", true); + $getItem .= $this->getCustomScriptBuilder($this->target . '_php_getlistquery', $code, '', PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Filtering.", true); // set main get query - $getItem .= $this->setCustomViewQuery($get->main_get,$code); + $getItem .= $this->setCustomViewQuery($get->main_get, $code); // setup filters - $getItem .= $this->setCustomViewFilter($get->filter,$code); + $getItem .= $this->setCustomViewFilter($get->filter, $code); // setup where - $getItem .= $this->setCustomViewWhere($get->where,$code); + $getItem .= $this->setCustomViewWhere($get->where, $code); // setup ordering - $getItem .= $this->setCustomViewOrder($get->order,$code); + $getItem .= $this->setCustomViewOrder($get->order, $code); if ($return) { // return the query object - $getItem .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." return the query object".PHP_EOL."\t\treturn \$query;"; + $getItem .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " return the query object" . PHP_EOL . "\t\treturn \$query;"; } return $getItem; } - return PHP_EOL."\t\t//".$this->setLine(__LINE__)."add your custom code here."; + return PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . "add your custom code here."; } /** * @param $get * @param $code * @return string - */ + */ public function setCustomViewGetItems(&$get, $code) { $getItem = ''; @@ -2791,14 +2789,14 @@ class Interpretation extends Fields $Component = $this->fileContentStatic['###Component###']; if (ComponentbuilderHelper::checkObject($get)) { - $getItem .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Insure all item fields are adapted where needed."; - $getItem .= PHP_EOL."\t\tif (".$Component."Helper::checkArray(\$items))"; - $getItem .= PHP_EOL."\t\t{"; + $getItem .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Insure all item fields are adapted where needed."; + $getItem .= PHP_EOL . "\t\tif (" . $Component . "Helper::checkArray(\$items))"; + $getItem .= PHP_EOL . "\t\t{"; $getItem .= "###DISPATCHER###"; - $getItem .= PHP_EOL."\t\t\tforeach (\$items as \$nr => &\$item)"; - $getItem .= PHP_EOL."\t\t\t{"; - $getItem .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Always create a slug for sef URL's"; - $getItem .= PHP_EOL."\t\t\t\t\$item->slug = (isset(\$item->alias) && isset(\$item->id)) ? \$item->id.':'.\$item->alias : \$item->id;"; + $getItem .= PHP_EOL . "\t\t\tforeach (\$items as \$nr => &\$item)"; + $getItem .= PHP_EOL . "\t\t\t{"; + $getItem .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " Always create a slug for sef URL's"; + $getItem .= PHP_EOL . "\t\t\t\t\$item->slug = (isset(\$item->alias) && isset(\$item->id)) ? \$item->id.':'.\$item->alias : \$item->id;"; if (isset($get->main_get) && ComponentbuilderHelper::checkArray($get->main_get)) { $asBucket = array(); @@ -2810,7 +2808,7 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkArray($decodeChecker)) { // set decoding of needed fields - $getItem .= $this->setCustomViewFieldDecode($main_get,$decodeChecker,"\$item",$code,"\t\t"); + $getItem .= $this->setCustomViewFieldDecode($main_get, $decodeChecker, "\$item", $code, "\t\t"); } } // also filter fields if needed @@ -2819,7 +2817,7 @@ class Interpretation extends Fields $decodeFilter = $this->siteFieldDecodeFilter[$this->target][$code][$main_get['key']][$main_get['as']]; if (ComponentbuilderHelper::checkArray($decodeFilter)) { - $getItem .= $this->setCustomViewFieldDecodeFilter($main_get,$decodeFilter,"\$item",'$items[$nr]',$code,"\t\t"); + $getItem .= $this->setCustomViewFieldDecodeFilter($main_get, $decodeFilter, "\$item", '$items[$nr]', $code, "\t\t"); } } if (isset($this->siteFieldData['textareas'][$code][$main_get['key']][$main_get['as']])) @@ -2828,7 +2826,7 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkArray($contentprepareChecker)) { // set contentprepare checkers on needed fields - $getItem .= $this->setCustomViewFieldonContentPrepareChecker($main_get,$contentprepareChecker,"\$item",$code,"\t\t"); + $getItem .= $this->setCustomViewFieldonContentPrepareChecker($main_get, $contentprepareChecker, "\$item", $code, "\t\t"); } } if (isset($this->siteFieldData['uikit'][$code][$main_get['key']][$main_get['as']])) @@ -2837,7 +2835,7 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkArray($uikitChecker)) { // set uikit checkers on needed fields - $getItem .= $this->setCustomViewFieldUikitChecker($main_get,$uikitChecker,"\$item",$code,"\t\t"); + $getItem .= $this->setCustomViewFieldUikitChecker($main_get, $uikitChecker, "\$item", $code, "\t\t"); } } $asBucket[] = $main_get['as']; @@ -2846,21 +2844,21 @@ class Interpretation extends Fields // check if we should load the dispatcher $getItem = str_replace(array_keys($this->JEventDispatcher), array_values($this->JEventDispatcher), $getItem); // setup Globals - $getItem .= $this->setCustomViewGlobals($get->global,'$item',$asBucket,"\t\t"); + $getItem .= $this->setCustomViewGlobals($get->global, '$item', $asBucket, "\t\t"); // setup the custom gets that returns multipal values - $getItem .= $this->setCustomViewCustomJoin($get->custom_get,"\$item",$code,$asBucket,"\t\t"); + $getItem .= $this->setCustomViewCustomJoin($get->custom_get, "\$item", $code, $asBucket, "\t\t"); // set calculations if ($get->addcalculation == 1) { - $get->php_calculation = (array) explode(PHP_EOL,$get->php_calculation); + $get->php_calculation = (array) explode(PHP_EOL, $get->php_calculation); if (ComponentbuilderHelper::checkArray($get->php_calculation)) { - $_tmp = PHP_EOL."\t\t\t\t".implode(PHP_EOL."\t\t\t\t",$get->php_calculation); + $_tmp = PHP_EOL . "\t\t\t\t" . implode(PHP_EOL . "\t\t\t\t", $get->php_calculation); $getItem .= $this->setPlaceholders($_tmp, $this->placeholders); } } - $getItem .= PHP_EOL."\t\t\t}"; - $getItem .= PHP_EOL."\t\t}"; + $getItem .= PHP_EOL . "\t\t\t}"; + $getItem .= PHP_EOL . "\t\t}"; // remove empty foreach if (strlen($getItem) <= 100) { @@ -2873,17 +2871,17 @@ class Interpretation extends Fields $script = ''; if ($this->siteDecrypt['basic'][$code]) { - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the basic encryption."; - $script .= PHP_EOL."\t\t\$basickey = ".$Component."Helper::getCryptKey('basic');"; - $script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the encryption object."; - $script .= PHP_EOL."\t\t\$basic = new FOFEncryptAes(\$basickey, 128);"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; + $script .= PHP_EOL . "\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; + $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; + $script .= PHP_EOL . "\t\t\$basic = new FOFEncryptAes(\$basickey, 128);"; } if ($this->siteDecrypt['advanced'][$code]) { - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the advanced encryption."; - $script .= PHP_EOL."\t\t\$advancedkey = ".$Component."Helper::getCryptKey('advanced');"; - $script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the encryption object."; - $script .= PHP_EOL."\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the advanced encryption."; + $script .= PHP_EOL . "\t\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; + $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; + $script .= PHP_EOL . "\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; } $getItem = $script . $getItem; } @@ -2898,24 +2896,24 @@ class Interpretation extends Fields if ($view['settings']->main_get->gettype == 1) { // for single views - $method .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Initialise variables."; - $method .= PHP_EOL."\t\t\$this->item\t= \$this->get('Item');"; + $method .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Initialise variables."; + $method .= PHP_EOL . "\t\t\$this->item\t= \$this->get('Item');"; } elseif ($view['settings']->main_get->gettype == 2) { // for list views - $method .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Initialise variables."; - $method .= PHP_EOL."\t\t\$this->items\t= \$this->get('Items');"; + $method .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Initialise variables."; + $method .= PHP_EOL . "\t\t\$this->items\t= \$this->get('Items');"; // only add if pagination is requered if ($view['settings']->main_get->pagination == 1) { - $method .= PHP_EOL."\t\t\$this->pagination\t= \$this->get('Pagination');"; + $method .= PHP_EOL . "\t\t\$this->pagination\t= \$this->get('Pagination');"; } // add id to list view if (isset($this->customAdminViewListId[$view['settings']->code])) { // ###HIDDEN_INPUT_VALUES### - $this->fileContentDynamic[$view['settings']->code]['###HIDDEN_INPUT_VALUES###'] = PHP_EOL."\t".''; + $this->fileContentDynamic[$view['settings']->code]['###HIDDEN_INPUT_VALUES###'] = PHP_EOL . "\t" . ''; } else { @@ -2928,46 +2926,46 @@ class Interpretation extends Fields { foreach ($view['settings']->custom_get as $custom_get) { - $custom_get_name = str_replace('get','',$custom_get->getcustom); - $method .= PHP_EOL."\t\t\$this->".ComponentbuilderHelper::safeString($custom_get_name)."\t= \$this->get('".$custom_get_name."');"; + $custom_get_name = str_replace('get', '', $custom_get->getcustom); + $method .= PHP_EOL . "\t\t\$this->" . ComponentbuilderHelper::safeString($custom_get_name) . "\t= \$this->get('" . $custom_get_name . "');"; } } // add custom script if ($view['settings']->add_php_jview_display == 1) { - $view['settings']->php_jview_display = (array) explode(PHP_EOL,$view['settings']->php_jview_display); + $view['settings']->php_jview_display = (array) explode(PHP_EOL, $view['settings']->php_jview_display); if (ComponentbuilderHelper::checkArray($view['settings']->php_jview_display)) { - $_tmp = PHP_EOL."\t\t".implode(PHP_EOL."\t\t",$view['settings']->php_jview_display); + $_tmp = PHP_EOL . "\t\t" . implode(PHP_EOL . "\t\t", $view['settings']->php_jview_display); $method .= $this->setPlaceholders($_tmp, $this->placeholders); } } if ('site' === $this->target) { - $method .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Set the toolbar"; - $method .= PHP_EOL."\t\t\$this->addToolBar();"; - $method .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." set the document"; - $method .= PHP_EOL."\t\t\$this->_prepareDocument();"; + $method .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Set the toolbar"; + $method .= PHP_EOL . "\t\t\$this->addToolBar();"; + $method .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " set the document"; + $method .= PHP_EOL . "\t\t\$this->_prepareDocument();"; } elseif ('custom_admin' === $this->target) { - $method .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." We don't need toolbar in the modal window."; - $method .= PHP_EOL."\t\tif (\$this->getLayout() !== 'modal')"; - $method .= PHP_EOL."\t\t{"; - $method .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." add the tool bar"; - $method .= PHP_EOL."\t\t\t\$this->addToolBar();"; - $method .= PHP_EOL."\t\t}"; - $method .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." set the document"; - $method .= PHP_EOL."\t\t\$this->setDocument();"; + $method .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " We don't need toolbar in the modal window."; + $method .= PHP_EOL . "\t\tif (\$this->getLayout() !== 'modal')"; + $method .= PHP_EOL . "\t\t{"; + $method .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " add the tool bar"; + $method .= PHP_EOL . "\t\t\t\$this->addToolBar();"; + $method .= PHP_EOL . "\t\t}"; + $method .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " set the document"; + $method .= PHP_EOL . "\t\t\$this->setDocument();"; } - $method .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Check for errors."; - $method .= PHP_EOL."\t\tif (count(\$errors = \$this->get('Errors')))"; - $method .= PHP_EOL."\t\t{"; - $method .= PHP_EOL."\t\t\tthrow new Exception(implode(".'"\n", $errors), 500);'; - $method .= PHP_EOL."\t\t}"; - - $method .= PHP_EOL.PHP_EOL."\t\tparent::display(\$tpl);"; + $method .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Check for errors."; + $method .= PHP_EOL . "\t\tif (count(\$errors = \$this->get('Errors')))"; + $method .= PHP_EOL . "\t\t{"; + $method .= PHP_EOL . "\t\t\tthrow new Exception(implode(" . '"\n", $errors), 500);'; + $method .= PHP_EOL . "\t\t}"; + + $method .= PHP_EOL . PHP_EOL . "\t\tparent::display(\$tpl);"; } return $method; } @@ -2975,74 +2973,76 @@ class Interpretation extends Fields public function setPrepareDocument(&$view) { // ensure correct target is set - $TARGET = ComponentbuilderHelper::safeString($this->target,'U'); - + $TARGET = ComponentbuilderHelper::safeString($this->target, 'U'); + // set libraries ###'.$TARGET.'_LIBRARIES_LOADER### - $this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_LIBRARIES_LOADER###'] = $this->setLibrariesLoader($view); - + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_LIBRARIES_LOADER###'] = $this->setLibrariesLoader($view); + // set uikit ###'.$TARGET.'_UIKIT_LOADER### - $this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_UIKIT_LOADER###'] = $this->setUikitLoader($view); + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_UIKIT_LOADER###'] = $this->setUikitLoader($view); // set Google Charts ###'.$TARGET.'_GOOGLECHART_LOADER### - $this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_GOOGLECHART_LOADER###'] = $this->setGoogleChartLoader($view); + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_GOOGLECHART_LOADER###'] = $this->setGoogleChartLoader($view); // set Footable ###FOOTABLE_LOADER### - $this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_FOOTABLE_LOADER###'] = $this->setFootableScriptsLoader($view); + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_FOOTABLE_LOADER###'] = $this->setFootableScriptsLoader($view); // set metadata ###DOCUMENT_METADATA### - $this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_DOCUMENT_METADATA###'] = $this->setDocumentMetadata($view); + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_DOCUMENT_METADATA###'] = $this->setDocumentMetadata($view); // set custom php scripting ###DOCUMENT_CUSTOM_PHP### - $this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_DOCUMENT_CUSTOM_PHP###'] = $this->setDocumentCustomPHP($view); + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_DOCUMENT_CUSTOM_PHP###'] = $this->setDocumentCustomPHP($view); // set custom css ###DOCUMENT_CUSTOM_CSS### - $this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_DOCUMENT_CUSTOM_CSS###'] = $this->setDocumentCustomCSS($view); + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_DOCUMENT_CUSTOM_CSS###'] = $this->setDocumentCustomCSS($view); // set custom javascript ###DOCUMENT_CUSTOM_JS### - $this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_DOCUMENT_CUSTOM_JS###'] = $this->setDocumentCustomJS($view); + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_DOCUMENT_CUSTOM_JS###'] = $this->setDocumentCustomJS($view); // set custom css file ###VIEWCSS### - $this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_VIEWCSS###'] = $this->setCustomCSS($view); + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_VIEWCSS###'] = $this->setCustomCSS($view); // set the custom buttons ###CUSTOM_BUTTONS### - $this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_CUSTOM_BUTTONS###'] = $this->setCustomButtons($view); - + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_CUSTOM_BUTTONS###'] = $this->setCustomButtons($view); + // only set the custom get form method if site target if ('site' === $this->target) { // set the custom get form method ###SITE_CUSTOM_GET_FORM_METHOD### $this->fileContentDynamic[$view['settings']->code]['###SITE_CUSTOM_GET_FORM_METHOD###'] = $this->setCustomGetForm($view); } - + // see if we should add get modules to the view.html - $this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_GET_MODULE###'] = $this->setGetModules($view,$TARGET); - + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_GET_MODULE###'] = $this->setGetModules($view, $TARGET); + + // set a JavaScript file if needed + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_LIBRARIES_LOADER###'] .= $this->setJavaScriptFile($view, $TARGET); } - - public function setGetModules($view,$TARGET) + + public function setGetModules($view, $TARGET) { if (isset($this->getModule[$this->target][$view['settings']->code]) && $this->getModule[$this->target][$view['settings']->code]) { $addModule = array(); - $addModule[] = PHP_EOL.PHP_EOL."\t/**"; + $addModule[] = PHP_EOL . PHP_EOL . "\t/**"; $addModule[] = "\t * Get the modules published in a position"; $addModule[] = "\t */"; $addModule[] = "\tpublic function getModules(\$position, \$seperator = '', \$class = '')"; $addModule[] = "\t{"; - $addModule[] = "\t\t//".$this->setLine(__LINE__)." set default"; + $addModule[] = "\t\t//" . $this->setLine(__LINE__) . " set default"; $addModule[] = "\t\t\$found = false;"; - $addModule[] = "\t\t//".$this->setLine(__LINE__)." check if we aleady have these modules loaded"; + $addModule[] = "\t\t//" . $this->setLine(__LINE__) . " check if we aleady have these modules loaded"; $addModule[] = "\t\tif (isset(\$this->setModules[\$position]))"; $addModule[] = "\t\t{"; $addModule[] = "\t\t\t\$found = true;"; $addModule[] = "\t\t}"; $addModule[] = "\t\telse"; $addModule[] = "\t\t{"; - $addModule[] = "\t\t\t//".$this->setLine(__LINE__)." this is where you want to load your module position"; + $addModule[] = "\t\t\t//" . $this->setLine(__LINE__) . " this is where you want to load your module position"; $addModule[] = "\t\t\t\$modules = JModuleHelper::getModules(\$position);"; $addModule[] = "\t\t\tif (\$modules)"; $addModule[] = "\t\t\t{"; - $addModule[] = "\t\t\t\t//".$this->setLine(__LINE__)." set the place holder"; + $addModule[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " set the place holder"; $addModule[] = "\t\t\t\t\$this->setModules[\$position] = array();"; $addModule[] = "\t\t\t\tforeach(\$modules as \$module)"; $addModule[] = "\t\t\t\t{"; @@ -3051,15 +3051,15 @@ class Interpretation extends Fields $addModule[] = "\t\t\t\t\$found = true;"; $addModule[] = "\t\t\t}"; $addModule[] = "\t\t}"; - $addModule[] = "\t\t//".$this->setLine(__LINE__)." check if modules were found"; - $addModule[] = "\t\tif (\$found && isset(\$this->setModules[\$position]) && ".$this->fileContentStatic['###Component###']."Helper::checkArray(\$this->setModules[\$position]))"; + $addModule[] = "\t\t//" . $this->setLine(__LINE__) . " check if modules were found"; + $addModule[] = "\t\tif (\$found && isset(\$this->setModules[\$position]) && " . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$this->setModules[\$position]))"; $addModule[] = "\t\t{"; - $addModule[] = "\t\t\t//".$this->setLine(__LINE__)." set class"; - $addModule[] = "\t\t\tif (".$this->fileContentStatic['###Component###']."Helper::checkString(\$class))"; + $addModule[] = "\t\t\t//" . $this->setLine(__LINE__) . " set class"; + $addModule[] = "\t\t\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkString(\$class))"; $addModule[] = "\t\t\t{"; $addModule[] = "\t\t\t\t\$class = ' class=\"'.\$class.'\" ';"; $addModule[] = "\t\t\t}"; - $addModule[] = "\t\t\t//".$this->setLine(__LINE__)." set seperating return values"; + $addModule[] = "\t\t\t//" . $this->setLine(__LINE__) . " set seperating return values"; $addModule[] = "\t\t\tswitch(\$seperator)"; $addModule[] = "\t\t\t{"; $addModule[] = "\t\t\t\tcase 'none':"; @@ -3083,12 +3083,12 @@ class Interpretation extends Fields $addModule[] = "\t\t}"; $addModule[] = "\t\treturn false;"; $addModule[] = "\t}"; - - $this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_GET_MODULE_JIMPORT###'] = PHP_EOL."jimport('joomla.application.module.helper');"; - - return implode(PHP_EOL,$addModule); - } - $this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_GET_MODULE_JIMPORT###'] = ''; + + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_GET_MODULE_JIMPORT###'] = PHP_EOL . "jimport('joomla.application.module.helper');"; + + return implode(PHP_EOL, $addModule); + } + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_GET_MODULE_JIMPORT###'] = ''; return ''; } @@ -3101,10 +3101,10 @@ class Interpretation extends Fields { if ($view['settings']->add_php_document == 1) { - $view['settings']->php_document = (array) explode(PHP_EOL,$view['settings']->php_document); + $view['settings']->php_document = (array) explode(PHP_EOL, $view['settings']->php_document); if (ComponentbuilderHelper::checkArray($view['settings']->php_document)) { - $_tmp = PHP_EOL."\t\t".implode(PHP_EOL."\t\t",$view['settings']->php_document); + $_tmp = PHP_EOL . "\t\t" . implode(PHP_EOL . "\t\t", $view['settings']->php_document); return $this->setPlaceholders($_tmp, $this->placeholders); } } @@ -3114,21 +3114,21 @@ class Interpretation extends Fields public function setCustomButtons(&$view, $type = 1, $tab = '') { // ensure correct target is set - $TARGET = ComponentbuilderHelper::safeString($this->target,'U'); + $TARGET = ComponentbuilderHelper::safeString($this->target, 'U'); if (1 == $type || 2 == $type) { if (1 == $type) { - $viewName = $view['settings']->code; + $viewName = $view['settings']->code; } if (2 == $type) { - $viewName = ComponentbuilderHelper::safeString($view['settings']->name_single); + $viewName = ComponentbuilderHelper::safeString($view['settings']->name_single); } // set the custom buttons ###CUSTOM_BUTTONS_CONTROLLER### - $this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_CONTROLLER###'] = ''; + $this->fileContentDynamic[$viewName]['###' . $TARGET . '_CUSTOM_BUTTONS_CONTROLLER###'] = ''; // set the custom buttons ###CUSTOM_BUTTONS_METHOD### - $this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD###'] = ''; + $this->fileContentDynamic[$viewName]['###' . $TARGET . '_CUSTOM_BUTTONS_METHOD###'] = ''; } elseif (3 == $type) { @@ -3136,9 +3136,9 @@ class Interpretation extends Fields $viewName = ComponentbuilderHelper::safeString($view['settings']->name_single); $viewsName = ComponentbuilderHelper::safeString($view['settings']->name_list); // set the custom buttons ###CUSTOM_BUTTONS_CONTROLLER_LIST### - $this->fileContentDynamic[$viewsName]['###'.$TARGET.'_CUSTOM_BUTTONS_CONTROLLER_LIST###'] = ''; + $this->fileContentDynamic[$viewsName]['###' . $TARGET . '_CUSTOM_BUTTONS_CONTROLLER_LIST###'] = ''; // set the custom buttons ###CUSTOM_BUTTONS_METHOD_LIST### - $this->fileContentDynamic[$viewsName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD_LIST###'] = ''; + $this->fileContentDynamic[$viewsName]['###' . $TARGET . '_CUSTOM_BUTTONS_METHOD_LIST###'] = ''; } // if site add buttons to view if ($this->target === 'site') @@ -3169,9 +3169,8 @@ class Interpretation extends Fields case 5: // set buttons to buttom left of the view $this->placeholders['[[[SITE_TOOLBAR]]]'] = 'toolbar->render(); ?>'; - break; + break; } - } // check if custom button should be added if (isset($view['settings']->add_custom_button) && $view['settings']->add_custom_button == 1) @@ -3186,29 +3185,29 @@ class Interpretation extends Fields if (3 !== $type && ($custom_button['target'] != 2 || $this->target === 'site')) { // Load to lang - $keyLang = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($custom_button['name'],'U'); - $keyCode = ComponentbuilderHelper::safeString($custom_button['name']); + $keyLang = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($custom_button['name'], 'U'); + $keyCode = ComponentbuilderHelper::safeString($custom_button['name']); $this->langContent[$this->lang][$keyLang] = trim($custom_button['name']); // add cpanel button TODO does not work well on site with permissions if ($custom_button['target'] == 2) { - $buttons[] = "\t".$tab."\tif (\$this->user->authorise('".$viewName.".".$keyCode."'))"; + $buttons[] = "\t" . $tab . "\tif (\$this->user->authorise('" . $viewName . "." . $keyCode . "'))"; } else { - $buttons[] = "\t".$tab."\tif (\$this->canDo->get('".$viewName.".".$keyCode."'))"; + $buttons[] = "\t" . $tab . "\tif (\$this->canDo->get('" . $viewName . "." . $keyCode . "'))"; } - $buttons[] = "\t".$tab."\t{"; - $buttons[] = "\t".$tab."\t\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button."; - $buttons[] = "\t".$tab."\t\tJToolBarHelper::custom('".$viewName.".".$custom_button['method']."', '".$custom_button['icomoon']."', '', '".$keyLang."', false);"; - $buttons[] = "\t".$tab."\t}"; + $buttons[] = "\t" . $tab . "\t{"; + $buttons[] = "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " add " . $custom_button['name'] . " button."; + $buttons[] = "\t" . $tab . "\t\tJToolBarHelper::custom('" . $viewName . "." . $custom_button['method'] . "', '" . $custom_button['icomoon'] . "', '', '" . $keyLang . "', false);"; + $buttons[] = "\t" . $tab . "\t}"; } // load the list button elseif (3 == $type && $custom_button['target'] != 1) { // Load to lang - $keyLang = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($custom_button['name'],'U'); - $keyCode = ComponentbuilderHelper::safeString($custom_button['name']); + $keyLang = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($custom_button['name'], 'U'); + $keyCode = ComponentbuilderHelper::safeString($custom_button['name']); $this->langContent[$this->lang][$keyLang] = trim($custom_button['name']); // add cpanel button TODO does not work well on site with permissions if (isset($custom_button['type']) && $custom_button['type'] == 2) @@ -3217,19 +3216,19 @@ class Interpretation extends Fields { $this->onlyFunctionButton[$viewsName] = array(); } - $this->onlyFunctionButton[$viewsName][] = "\t".$tab."if (\$this->user->authorise('".$viewName.".".$keyCode."', 'com_".$this->fileContentStatic['###component###']."'))"; - $this->onlyFunctionButton[$viewsName][] = "\t".$tab."{"; - $this->onlyFunctionButton[$viewsName][] = "\t".$tab."\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button."; - $this->onlyFunctionButton[$viewsName][] = "\t".$tab."\tJToolBarHelper::custom('".$viewsName.".".$custom_button['method']."', '".$custom_button['icomoon']."', '', '".$keyLang."', false);"; - $this->onlyFunctionButton[$viewsName][] = "\t".$tab."}"; + $this->onlyFunctionButton[$viewsName][] = "\t" . $tab . "if (\$this->user->authorise('" . $viewName . "." . $keyCode . "', 'com_" . $this->fileContentStatic['###component###'] . "'))"; + $this->onlyFunctionButton[$viewsName][] = "\t" . $tab . "{"; + $this->onlyFunctionButton[$viewsName][] = "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " add " . $custom_button['name'] . " button."; + $this->onlyFunctionButton[$viewsName][] = "\t" . $tab . "\tJToolBarHelper::custom('" . $viewsName . "." . $custom_button['method'] . "', '" . $custom_button['icomoon'] . "', '', '" . $keyLang . "', false);"; + $this->onlyFunctionButton[$viewsName][] = "\t" . $tab . "}"; } else { - $buttons[] = "\t".$tab."\tif (\$this->user->authorise('".$viewName.".".$keyCode."', 'com_".$this->fileContentStatic['###component###']."'))"; - $buttons[] = "\t".$tab."\t{"; - $buttons[] = "\t".$tab."\t\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button."; - $buttons[] = "\t".$tab."\t\tJToolBarHelper::custom('".$viewsName.".".$custom_button['method']."', '".$custom_button['icomoon']."', '', '".$keyLang."', false);"; - $buttons[] = "\t".$tab."\t}"; + $buttons[] = "\t" . $tab . "\tif (\$this->user->authorise('" . $viewName . "." . $keyCode . "', 'com_" . $this->fileContentStatic['###component###'] . "'))"; + $buttons[] = "\t" . $tab . "\t{"; + $buttons[] = "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " add " . $custom_button['name'] . " button."; + $buttons[] = "\t" . $tab . "\t\tJToolBarHelper::custom('" . $viewsName . "." . $custom_button['method'] . "', '" . $custom_button['icomoon'] . "', '', '" . $keyLang . "', false);"; + $buttons[] = "\t" . $tab . "\t}"; } } } @@ -3241,15 +3240,13 @@ class Interpretation extends Fields if (isset($view['settings']->php_controller_list) && ComponentbuilderHelper::checkString($view['settings']->php_controller_list) && $view['settings']->php_controller_list != '//') { // set the custom buttons ###CUSTOM_BUTTONS_CONTROLLER### - $this->fileContentDynamic[$viewsName]['###'.$TARGET.'_CUSTOM_BUTTONS_CONTROLLER_LIST###'] = - PHP_EOL.PHP_EOL.$this->setPlaceholders($view['settings']->php_controller_list, $this->placeholders); + $this->fileContentDynamic[$viewsName]['###' . $TARGET . '_CUSTOM_BUTTONS_CONTROLLER_LIST###'] = PHP_EOL . PHP_EOL . $this->setPlaceholders($view['settings']->php_controller_list, $this->placeholders); } // load the model if (isset($view['settings']->php_model_list) && ComponentbuilderHelper::checkString($view['settings']->php_model_list) && $view['settings']->php_model_list != '//') { // set the custom buttons ###CUSTOM_BUTTONS_METHOD### - $this->fileContentDynamic[$viewsName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD_LIST###'] = - PHP_EOL.PHP_EOL.$this->setPlaceholders($view['settings']->php_model_list, $this->placeholders); + $this->fileContentDynamic[$viewsName]['###' . $TARGET . '_CUSTOM_BUTTONS_METHOD_LIST###'] = PHP_EOL . PHP_EOL . $this->setPlaceholders($view['settings']->php_model_list, $this->placeholders); } } else @@ -3258,14 +3255,13 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkString($view['settings']->php_controller) && $view['settings']->php_controller != '//') { // set the custom buttons ###CUSTOM_BUTTONS_CONTROLLER### - $this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_CONTROLLER###'] = - PHP_EOL.PHP_EOL.$this->setPlaceholders($view['settings']->php_controller, $this->placeholders); + $this->fileContentDynamic[$viewName]['###' . $TARGET . '_CUSTOM_BUTTONS_CONTROLLER###'] = PHP_EOL . PHP_EOL . $this->setPlaceholders($view['settings']->php_controller, $this->placeholders); if ('site' === $this->target) { // add the controller for this view // build the file $target = array($this->target => $viewName); - $this->buildDynamique($target,'custom_form'); + $this->buildDynamique($target, 'custom_form'); ###GET_FORM_CUSTOM### } } @@ -3273,14 +3269,13 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkString($view['settings']->php_model) && $view['settings']->php_model != '//') { // set the custom buttons ###CUSTOM_BUTTONS_METHOD### - $this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD###'] = - PHP_EOL.PHP_EOL.$this->setPlaceholders($view['settings']->php_model, $this->placeholders); + $this->fileContentDynamic[$viewName]['###' . $TARGET . '_CUSTOM_BUTTONS_METHOD###'] = PHP_EOL . PHP_EOL . $this->setPlaceholders($view['settings']->php_model, $this->placeholders); } } // return buttons if they were build if (ComponentbuilderHelper::checkArray($buttons)) { - return PHP_EOL.implode(PHP_EOL,$buttons); + return PHP_EOL . implode(PHP_EOL, $buttons); } } return ''; @@ -3291,7 +3286,7 @@ class Interpretation extends Fields // return buttons if they were build if (isset($this->onlyFunctionButton[$viewName_list]) && ComponentbuilderHelper::checkArray($this->onlyFunctionButton[$viewName_list])) { - return PHP_EOL.implode(PHP_EOL,$this->onlyFunctionButton[$viewName_list]); + return PHP_EOL . implode(PHP_EOL, $this->onlyFunctionButton[$viewName_list]); } return ''; } @@ -3312,27 +3307,55 @@ class Interpretation extends Fields { if ($view['settings']->add_css_document == 1) { - $view['settings']->css_document = (array) explode(PHP_EOL,$view['settings']->css_document); + $view['settings']->css_document = (array) explode(PHP_EOL, $view['settings']->css_document); if (ComponentbuilderHelper::checkArray($view['settings']->css_document)) { - $script = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Set the Custom CSS script to view".PHP_EOL."\t\t".'$this->document->addStyleDeclaration("'; - $cssDocument = PHP_EOL."\t\t\t".str_replace('"', '\"', implode(PHP_EOL."\t\t\t",$view['settings']->css_document)); - return $script.$this->setPlaceholders($cssDocument, $this->placeholders).PHP_EOL."\t\t".'");'; + $script = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Set the Custom CSS script to view" . PHP_EOL . "\t\t" . '$this->document->addStyleDeclaration("'; + $cssDocument = PHP_EOL . "\t\t\t" . str_replace('"', '\"', implode(PHP_EOL . "\t\t\t", $view['settings']->css_document)); + return $script . $this->setPlaceholders($cssDocument, $this->placeholders) . PHP_EOL . "\t\t" . '");'; } } return ''; } + public function setJavaScriptFile(&$view, $TARGET) + { + if ($view['settings']->add_javascript_file == 1 && ComponentbuilderHelper::checkString($view['settings']->javascript_file)) + { + // get dates + $created = $this->getCreatedDate($view); + $modified = $this->getLastModifiedDate($view); + // add file to view + $target = array($this->target => $view['settings']->code); + $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified, '###VERSION###' => $view['settings']->version); + $this->buildDynamique($target, 'javascript_file', false, $config); + // set path + if ('site' === $this->target) + { + $path = '/components/com_' . $this->fileContentStatic['###component###'] . '/assets/js/' . $view['settings']->code . '.js'; + } + else + { + $path = '/administrator/components/com_' . $this->fileContentStatic['###component###'] . '/assets/js/' . $view['settings']->code . '.js'; + } + // add script to file + $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_JAVASCRIPT_FILE###'] = $view['settings']->javascript_file; + // add script to view + return PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Add View JavaScript File" . PHP_EOL . "\t\t" . $this->setIncludeLibScript($path); + } + return ''; + } + public function setDocumentCustomJS(&$view) { if ($view['settings']->add_js_document == 1) { - $view['settings']->js_document = (array) explode(PHP_EOL,$view['settings']->js_document); + $view['settings']->js_document = (array) explode(PHP_EOL, $view['settings']->js_document); if (ComponentbuilderHelper::checkArray($view['settings']->js_document)) { - $script = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Set the Custom JS script to view".PHP_EOL."\t\t".'$this->document->addScriptDeclaration("'; - $jsDocument = PHP_EOL."\t\t\t".str_replace('"', '\"', implode(PHP_EOL."\t\t\t",$view['settings']->js_document)); - return $script.$this->setPlaceholders($jsDocument, $this->placeholders).PHP_EOL."\t\t".'");'; + $script = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Set the Custom JS script to view" . PHP_EOL . "\t\t" . '$this->document->addScriptDeclaration("'; + $jsDocument = PHP_EOL . "\t\t\t" . str_replace('"', '\"', implode(PHP_EOL . "\t\t\t", $view['settings']->js_document)); + return $script . $this->setPlaceholders($jsDocument, $this->placeholders) . PHP_EOL . "\t\t" . '");'; } } return ''; @@ -3361,7 +3384,7 @@ class Interpretation extends Fields if (isset($view['settings']->custom_get) && ComponentbuilderHelper::checkArray($view['settings']->custom_get)) { $found = false; - $searchFor = 'get'.$view['settings']->Code; + $searchFor = 'get' . $view['settings']->Code; foreach ($view['settings']->custom_get as $custom_get) { if ($searchFor == $custom_get->getcustom) @@ -3387,46 +3410,46 @@ class Interpretation extends Fields } return ''; } - + public function setMetadataItem($item = 'item') { $meta = array(); - $meta[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." load the meta description"; - $meta[] = "\t\tif (isset(\$this->".$item."->metadesc) && \$this->".$item."->metadesc)"; + $meta[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " load the meta description"; + $meta[] = "\t\tif (isset(\$this->" . $item . "->metadesc) && \$this->" . $item . "->metadesc)"; $meta[] = "\t\t{"; - $meta[] = "\t\t\t\$this->document->setDescription(\$this->".$item."->metadesc);"; + $meta[] = "\t\t\t\$this->document->setDescription(\$this->" . $item . "->metadesc);"; $meta[] = "\t\t}"; $meta[] = "\t\telseif (\$this->params->get('menu-meta_description'))"; $meta[] = "\t\t{"; $meta[] = "\t\t\t\$this->document->setDescription(\$this->params->get('menu-meta_description'));"; $meta[] = "\t\t}"; - $meta[] = "\t\t//".$this->setLine(__LINE__)." load the key words if set"; - $meta[] = "\t\tif (isset(\$this->".$item."->metakey) && \$this->".$item."->metakey)"; + $meta[] = "\t\t//" . $this->setLine(__LINE__) . " load the key words if set"; + $meta[] = "\t\tif (isset(\$this->" . $item . "->metakey) && \$this->" . $item . "->metakey)"; $meta[] = "\t\t{"; - $meta[] = "\t\t\t\$this->document->setMetadata('keywords', \$this->".$item."->metakey);"; + $meta[] = "\t\t\t\$this->document->setMetadata('keywords', \$this->" . $item . "->metakey);"; $meta[] = "\t\t}"; $meta[] = "\t\telseif (\$this->params->get('menu-meta_keywords'))"; $meta[] = "\t\t{"; $meta[] = "\t\t\t\$this->document->setMetadata('keywords', \$this->params->get('menu-meta_keywords'));"; $meta[] = "\t\t}"; - $meta[] = "\t\t//".$this->setLine(__LINE__)." check the robot params"; - $meta[] = "\t\tif (isset(\$this->".$item."->robots) && \$this->".$item."->robots)"; + $meta[] = "\t\t//" . $this->setLine(__LINE__) . " check the robot params"; + $meta[] = "\t\tif (isset(\$this->" . $item . "->robots) && \$this->" . $item . "->robots)"; $meta[] = "\t\t{"; - $meta[] = "\t\t\t\$this->document->setMetadata('robots', \$this->".$item."->robots);"; + $meta[] = "\t\t\t\$this->document->setMetadata('robots', \$this->" . $item . "->robots);"; $meta[] = "\t\t}"; $meta[] = "\t\telseif (\$this->params->get('robots'))"; $meta[] = "\t\t{"; $meta[] = "\t\t\t\$this->document->setMetadata('robots', \$this->params->get('robots'));"; $meta[] = "\t\t}"; - $meta[] = "\t\t//".$this->setLine(__LINE__)." check if autor is to be set"; - $meta[] = "\t\tif (isset(\$this->".$item."->created_by) && \$this->params->get('MetaAuthor') == '1')"; + $meta[] = "\t\t//" . $this->setLine(__LINE__) . " check if autor is to be set"; + $meta[] = "\t\tif (isset(\$this->" . $item . "->created_by) && \$this->params->get('MetaAuthor') == '1')"; $meta[] = "\t\t{"; - $meta[] = "\t\t\t\$this->document->setMetaData('author', \$this->".$item."->created_by);"; + $meta[] = "\t\t\t\$this->document->setMetaData('author', \$this->" . $item . "->created_by);"; $meta[] = "\t\t}"; - $meta[] = "\t\t//".$this->setLine(__LINE__)." check if metadata is available"; - $meta[] = "\t\tif (isset(\$this->".$item."->metadata) && \$this->".$item."->metadata)"; + $meta[] = "\t\t//" . $this->setLine(__LINE__) . " check if metadata is available"; + $meta[] = "\t\tif (isset(\$this->" . $item . "->metadata) && \$this->" . $item . "->metadata)"; $meta[] = "\t\t{"; - $meta[] = "\t\t\t\$mdata = json_decode(\$this->".$item."->metadata,true);"; + $meta[] = "\t\t\t\$mdata = json_decode(\$this->" . $item . "->metadata,true);"; $meta[] = "\t\t\tforeach (\$mdata as \$k => \$v)"; $meta[] = "\t\t\t{"; $meta[] = "\t\t\t\tif (\$v)"; @@ -3436,29 +3459,29 @@ class Interpretation extends Fields $meta[] = "\t\t\t}"; $meta[] = "\t\t}"; - return implode(PHP_EOL,$meta); + return implode(PHP_EOL, $meta); } - + public function setMetadataList() { $meta = array(); - $meta[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." load the meta description"; + $meta[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " load the meta description"; $meta[] = "\t\tif (\$this->params->get('menu-meta_description'))"; $meta[] = "\t\t{"; $meta[] = "\t\t\t\$this->document->setDescription(\$this->params->get('menu-meta_description'));"; $meta[] = "\t\t}"; - $meta[] = "\t\t//".$this->setLine(__LINE__)." load the key words if set"; + $meta[] = "\t\t//" . $this->setLine(__LINE__) . " load the key words if set"; $meta[] = "\t\tif (\$this->params->get('menu-meta_keywords'))"; $meta[] = "\t\t{"; $meta[] = "\t\t\t\$this->document->setMetadata('keywords', \$this->params->get('menu-meta_keywords'));"; $meta[] = "\t\t}"; - $meta[] = "\t\t//".$this->setLine(__LINE__)." check the robot params"; + $meta[] = "\t\t//" . $this->setLine(__LINE__) . " check the robot params"; $meta[] = "\t\tif (\$this->params->get('robots'))"; $meta[] = "\t\t{"; $meta[] = "\t\t\t\$this->document->setMetadata('robots', \$this->params->get('robots'));"; $meta[] = "\t\t}"; - return implode(PHP_EOL,$meta); + return implode(PHP_EOL, $meta); } public function setGoogleChartLoader(&$view) @@ -3466,50 +3489,46 @@ class Interpretation extends Fields if (isset($this->googleChart[$this->target][$view['settings']->code]) && $this->googleChart[$this->target][$view['settings']->code]) { $chart = array(); - $chart[] = PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." add the google chart builder class."; + $chart[] = PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " add the google chart builder class."; $chart[] = "\t\trequire_once JPATH_COMPONENT_ADMINISTRATOR.'/helpers/chartbuilder.php';"; - $chart[] = "\t\t//".$this->setLine(__LINE__)." load the google chart js."; - $chart[] = "\t\t\$this->document->addScript(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/js/google.jsapi.js');"; + $chart[] = "\t\t//" . $this->setLine(__LINE__) . " load the google chart js."; + $chart[] = "\t\t\$this->document->addScript(JURI::root(true) .'/media/com_" . $this->fileContentStatic['###component###'] . "/js/google.jsapi.js');"; $chart[] = "\t\t\$this->document->addScript('https://canvg.googlecode.com/svn/trunk/rgbcolor.js');"; $chart[] = "\t\t\$this->document->addScript('https://canvg.googlecode.com/svn/trunk/canvg.js');"; - return implode(PHP_EOL,$chart); + return implode(PHP_EOL, $chart); } return ''; } - + public function setLibrariesLoader($view) { // reset bucket $setter = ''; // allways load these in - $setter .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." always make sure jquery is loaded."; - $setter .= PHP_EOL."\t\tJHtml::_('jquery.framework');"; - $setter .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Load the header checker class."; + $setter .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " always make sure jquery is loaded."; + $setter .= PHP_EOL . "\t\tJHtml::_('jquery.framework');"; + $setter .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Load the header checker class."; if ($this->target === 'site') { - $setter .= PHP_EOL."\t\trequire_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' );"; + $setter .= PHP_EOL . "\t\trequire_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' );"; } else { - $setter .= PHP_EOL."\t\trequire_once( JPATH_COMPONENT_ADMINISTRATOR.'/helpers/headercheck.php' );"; + $setter .= PHP_EOL . "\t\trequire_once( JPATH_COMPONENT_ADMINISTRATOR.'/helpers/headercheck.php' );"; } - $setter .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Initialize the header checker."; - $setter .= PHP_EOL."\t\t\$HeaderCheck = new ".$this->fileContentStatic['###component###']."HeaderCheck;"; + $setter .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Initialize the header checker."; + $setter .= PHP_EOL . "\t\t\$HeaderCheck = new " . $this->fileContentStatic['###component###'] . "HeaderCheck;"; // check if this view should get libraries - if (isset($this->libManager[$this->target][$view['settings']->code]) - && ComponentbuilderHelper::checkArray($this->libManager[$this->target][$view['settings']->code])) + if (isset($this->libManager[$this->target][$view['settings']->code]) && ComponentbuilderHelper::checkArray($this->libManager[$this->target][$view['settings']->code])) { foreach ($this->libManager[$this->target][$view['settings']->code] as $id => $true) { - if (isset($this->libraries[$id]) && ComponentbuilderHelper::checkObject($this->libraries[$id]) - && isset($this->libraries[$id]->document) && ComponentbuilderHelper::checkString($this->libraries[$id]->document)) + if (isset($this->libraries[$id]) && ComponentbuilderHelper::checkObject($this->libraries[$id]) && isset($this->libraries[$id]->document) && ComponentbuilderHelper::checkString($this->libraries[$id]->document)) { - $setter .= PHP_EOL.PHP_EOL.$this->setPlaceholders( - str_replace('$document->', '$this->document->', $this->libraries[$id]->document), - $this->placeholders); + $setter .= PHP_EOL . PHP_EOL . $this->setPlaceholders( + str_replace('$document->', '$this->document->', $this->libraries[$id]->document), $this->placeholders); } - elseif (isset($this->libraries[$id]) && ComponentbuilderHelper::checkObject($this->libraries[$id]) - && isset($this->libraries[$id]->how)) + elseif (isset($this->libraries[$id]) && ComponentbuilderHelper::checkObject($this->libraries[$id]) && isset($this->libraries[$id]->how)) { $setter .= $this->setLibraryDocument($id); } @@ -3520,8 +3539,7 @@ class Interpretation extends Fields protected function setLibraryDocument($id) { - if (2 == $this->libraries[$id]->how && isset($this->libraries[$id]->conditions) - && ComponentbuilderHelper::checkArray($this->libraries[$id]->conditions)) + if (2 == $this->libraries[$id]->how && isset($this->libraries[$id]->conditions) && ComponentbuilderHelper::checkArray($this->libraries[$id]->conditions)) { // build document with the conditions values $this->setLibraryDocConditions($id, $this->setLibraryScripts($id, false)); @@ -3534,7 +3552,7 @@ class Interpretation extends Fields // check if the document was build if (isset($this->libraries[$id]->document) && ComponentbuilderHelper::checkString($this->libraries[$id]->document)) { - return PHP_EOL.PHP_EOL.$this->libraries[$id]->document; + return PHP_EOL . PHP_EOL . $this->libraries[$id]->document; } return ''; } @@ -3592,7 +3610,7 @@ class Interpretation extends Fields // set all the files foreach ($this->libraries[$id]->files as $file) { - $path = '/'.trim($file['path'], '/'); + $path = '/' . trim($file['path'], '/'); // check if path has new file name (has extetion) $pathInfo = pathinfo($path); // update the root path @@ -3605,7 +3623,7 @@ class Interpretation extends Fields else { // load document script - $scripts[md5($path.'/'.trim($file['file'],'/'))] = $this->setIncludeLibScript($_path.'/'.trim($file['file'],'/')); + $scripts[md5($path . '/' . trim($file['file'], '/'))] = $this->setIncludeLibScript($_path . '/' . trim($file['file'], '/')); } } } @@ -3617,18 +3635,18 @@ class Interpretation extends Fields { if (isset($folder['path']) && isset($folder['folder'])) { - $path = '/'.trim($folder['path'], '/'); + $path = '/' . trim($folder['path'], '/'); if (isset($folder['rename']) && 1 == $folder['rename']) { - if ($_paths = ComponentbuilderHelper::getAllFilePaths($this->componentPath.$path)) + if ($_paths = ComponentbuilderHelper::getAllFilePaths($this->componentPath . $path)) { $files[$path] = $_paths; } } else { - $path = $path.'/'.trim($folder['folder'], '/'); - if ($_paths = ComponentbuilderHelper::getAllFilePaths($this->componentPath.$path)) + $path = $path . '/' . trim($folder['folder'], '/'); + if ($_paths = ComponentbuilderHelper::getAllFilePaths($this->componentPath . $path)) { $files[$path] = $_paths; } @@ -3641,16 +3659,16 @@ class Interpretation extends Fields // update the root path $_root = $this->getScriptRootPath($root); // load per path - foreach($paths as $path) + foreach ($paths as $path) { - $scripts[md5($root.'/'.trim($path, '/'))] = $this->setIncludeLibScript($_root.'/'.trim($path, '/')); + $scripts[md5($root . '/' . trim($path, '/'))] = $this->setIncludeLibScript($_root . '/' . trim($path, '/')); } } } // if there was any code added to document then set globaly if ($buildDoc && ComponentbuilderHelper::checkArray($scripts)) { - $this->libraries[$id]->document = "\t\t//".$this->setLine(__LINE__)." always load these files.".PHP_EOL."\t\t".implode(PHP_EOL."\t\t", $scripts); + $this->libraries[$id]->document = "\t\t//" . $this->setLine(__LINE__) . " always load these files." . PHP_EOL . "\t\t" . implode(PHP_EOL . "\t\t", $scripts); // success return true; } @@ -3677,21 +3695,21 @@ class Interpretation extends Fields // use the path info to build the script if (isset($pathInfo['extension']) && $pathInfo['extension']) { - switch($pathInfo['extension']) + switch ($pathInfo['extension']) { case 'js': - return '$this->document->addScript('.$JURI.'"'.$path.'");'; - break; + return '$this->document->addScript(' . $JURI . '"' . $path . '");'; + break; case 'css': case 'less': - return '$this->document->addStyleSheet('.$JURI.'"'.$path.'");'; - break; + return '$this->document->addStyleSheet(' . $JURI . '"' . $path . '");'; + break; case 'php': if (strpos($path, 'http') === false) { - return 'require_once("'.$path.'");'; + return 'require_once("' . $path . '");'; } - break; + break; } } return ''; @@ -3701,15 +3719,15 @@ class Interpretation extends Fields { if (strpos($root, '/media/') !== false && strpos($root, '/admin/') === false && strpos($root, '/site/') === false) { - return str_replace('/media/', '/media/com_'.$this->fileContentStatic['###component###'] .'/', $root); + return str_replace('/media/', '/media/com_' . $this->fileContentStatic['###component###'] . '/', $root); } elseif (strpos($root, '/media/') === false && strpos($root, '/admin/') !== false && strpos($root, '/site/') === false) { - return str_replace('/admin/', '/administrator/components/com_'.$this->fileContentStatic['###component###'] .'/', $root); + return str_replace('/admin/', '/administrator/components/com_' . $this->fileContentStatic['###component###'] . '/', $root); } elseif (strpos($root, '/media/') === false && strpos($root, '/admin/') === false && strpos($root, '/site/') !== false) { - return str_replace('/site/', '/components/com_'.$this->fileContentStatic['###component###'] .'/', $root); + return str_replace('/site/', '/components/com_' . $this->fileContentStatic['###component###'] . '/', $root); } return $root; } @@ -3721,149 +3739,149 @@ class Interpretation extends Fields // load the defaults needed if ($this->uikit > 0) { - $setter .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Load uikit options."; - $setter .= PHP_EOL."\t\t\$uikit = \$this->params->get('uikit_load');"; - $setter .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Set script size."; - $setter .= PHP_EOL."\t\t\$size = \$this->params->get('uikit_min');"; + $setter .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Load uikit options."; + $setter .= PHP_EOL . "\t\t\$uikit = \$this->params->get('uikit_load');"; + $setter .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Set script size."; + $setter .= PHP_EOL . "\t\t\$size = \$this->params->get('uikit_min');"; $tabV = ""; // if both versions should be loaded then add some more logic if (2 == $this->uikit) { - $setter .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Load uikit version."; - $setter .= PHP_EOL."\t\t\$uikitVersion = \$this->params->get('uikit_version', 2);"; - $setter .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Use Uikit Version 2"; - $setter .= PHP_EOL."\t\tif (2 == \$uikitVersion)"; - $setter .= PHP_EOL."\t\t{"; + $setter .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Load uikit version."; + $setter .= PHP_EOL . "\t\t\$uikitVersion = \$this->params->get('uikit_version', 2);"; + $setter .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Use Uikit Version 2"; + $setter .= PHP_EOL . "\t\tif (2 == \$uikitVersion)"; + $setter .= PHP_EOL . "\t\t{"; $tabV = "\t"; } } // load the defaults needed if (2 == $this->uikit || 1 == $this->uikit) { - $setter .= PHP_EOL.$tabV."\t\t//".$this->setLine(__LINE__)." Set css style."; - $setter .= PHP_EOL.$tabV."\t\t\$style = \$this->params->get('uikit_style');"; + $setter .= PHP_EOL . $tabV . "\t\t//" . $this->setLine(__LINE__) . " Set css style."; + $setter .= PHP_EOL . $tabV . "\t\t\$style = \$this->params->get('uikit_style');"; - $setter .= PHP_EOL.PHP_EOL.$tabV."\t\t//".$this->setLine(__LINE__)." The uikit css."; - $setter .= PHP_EOL.$tabV."\t\tif ((!\$HeaderCheck->css_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)"; - $setter .= PHP_EOL.$tabV."\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/css/uikit'.\$style.\$size.'.css');"; - $setter .= PHP_EOL.$tabV."\t\t}"; - $setter .= PHP_EOL.$tabV."\t\t//".$this->setLine(__LINE__)." The uikit js."; - $setter .= PHP_EOL.$tabV."\t\tif ((!\$HeaderCheck->js_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)"; - $setter .= PHP_EOL.$tabV."\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/js/uikit'.\$size.'.js');"; - $setter .= PHP_EOL.$tabV."\t\t}"; + $setter .= PHP_EOL . PHP_EOL . $tabV . "\t\t//" . $this->setLine(__LINE__) . " The uikit css."; + $setter .= PHP_EOL . $tabV . "\t\tif ((!\$HeaderCheck->css_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)"; + $setter .= PHP_EOL . $tabV . "\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_" . $this->fileContentStatic['###component###'] . "/uikit-v2/css/uikit'.\$style.\$size.'.css');"; + $setter .= PHP_EOL . $tabV . "\t\t}"; + $setter .= PHP_EOL . $tabV . "\t\t//" . $this->setLine(__LINE__) . " The uikit js."; + $setter .= PHP_EOL . $tabV . "\t\tif ((!\$HeaderCheck->js_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)"; + $setter .= PHP_EOL . $tabV . "\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_" . $this->fileContentStatic['###component###'] . "/uikit-v2/js/uikit'.\$size.'.js');"; + $setter .= PHP_EOL . $tabV . "\t\t}"; } // load the components need if ((2 == $this->uikit || 1 == $this->uikit) && isset($this->uikitComp[$view['settings']->code]) && ComponentbuilderHelper::checkArray($this->uikitComp[$view['settings']->code])) { - $setter .= PHP_EOL.PHP_EOL.$tabV."\t\t//".$this->setLine(__LINE__)." Load the script to find all uikit components needed."; - $setter .= PHP_EOL.$tabV."\t\tif (\$uikit != 2)"; - $setter .= PHP_EOL.$tabV."\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t//".$this->setLine(__LINE__)." Set the default uikit components in this view."; - $setter .= PHP_EOL.$tabV."\t\t\t\$uikitComp = array();"; + $setter .= PHP_EOL . PHP_EOL . $tabV . "\t\t//" . $this->setLine(__LINE__) . " Load the script to find all uikit components needed."; + $setter .= PHP_EOL . $tabV . "\t\tif (\$uikit != 2)"; + $setter .= PHP_EOL . $tabV . "\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t//" . $this->setLine(__LINE__) . " Set the default uikit components in this view."; + $setter .= PHP_EOL . $tabV . "\t\t\t\$uikitComp = array();"; foreach ($this->uikitComp[$view['settings']->code] as $class) { - $setter .= PHP_EOL.$tabV."\t\t\t\$uikitComp[] = '".$class."';"; + $setter .= PHP_EOL . $tabV . "\t\t\t\$uikitComp[] = '" . $class . "';"; } // check content for more needed components if (isset($this->siteFieldData['uikit'][$view['settings']->code]) && ComponentbuilderHelper::checkArray($this->siteFieldData['uikit'][$view['settings']->code])) { - $setter .= PHP_EOL.PHP_EOL.$tabV."\t\t\t//".$this->setLine(__LINE__)." Get field uikit components needed in this view."; - $setter .= PHP_EOL.$tabV."\t\t\t\$uikitFieldComp = \$this->get('UikitComp');"; - $setter .= PHP_EOL.$tabV."\t\t\tif (isset(\$uikitFieldComp) && ".$this->fileContentStatic['###Component###']."Helper::checkArray(\$uikitFieldComp))"; - $setter .= PHP_EOL.$tabV."\t\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\tif (isset(\$uikitComp) && ".$this->fileContentStatic['###Component###']."Helper::checkArray(\$uikitComp))"; - $setter .= PHP_EOL.$tabV."\t\t\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t\$uikitComp = array_merge(\$uikitComp, \$uikitFieldComp);"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t\$uikitComp = array_unique(\$uikitComp);"; - $setter .= PHP_EOL.$tabV."\t\t\t\t}"; - $setter .= PHP_EOL.$tabV."\t\t\t\telse"; - $setter .= PHP_EOL.$tabV."\t\t\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t\$uikitComp = \$uikitFieldComp;"; - $setter .= PHP_EOL.$tabV."\t\t\t\t}"; - $setter .= PHP_EOL.$tabV."\t\t\t}"; + $setter .= PHP_EOL . PHP_EOL . $tabV . "\t\t\t//" . $this->setLine(__LINE__) . " Get field uikit components needed in this view."; + $setter .= PHP_EOL . $tabV . "\t\t\t\$uikitFieldComp = \$this->get('UikitComp');"; + $setter .= PHP_EOL . $tabV . "\t\t\tif (isset(\$uikitFieldComp) && " . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$uikitFieldComp))"; + $setter .= PHP_EOL . $tabV . "\t\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\tif (isset(\$uikitComp) && " . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$uikitComp))"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t\$uikitComp = array_merge(\$uikitComp, \$uikitFieldComp);"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t\$uikitComp = array_unique(\$uikitComp);"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t}"; + $setter .= PHP_EOL . $tabV . "\t\t\t\telse"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t\$uikitComp = \$uikitFieldComp;"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t}"; + $setter .= PHP_EOL . $tabV . "\t\t\t}"; } - $setter .= PHP_EOL.$tabV."\t\t}"; - $setter .= PHP_EOL.PHP_EOL.$tabV."\t\t//".$this->setLine(__LINE__)." Load the needed uikit components in this view."; - $setter .= PHP_EOL.$tabV."\t\tif (\$uikit != 2 && isset(\$uikitComp) && ".$this->fileContentStatic['###Component###']."Helper::checkArray(\$uikitComp))"; - $setter .= PHP_EOL.$tabV."\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t//".$this->setLine(__LINE__)." load just in case."; - $setter .= PHP_EOL.$tabV."\t\t\tjimport('joomla.filesystem.file');"; - $setter .= PHP_EOL.$tabV."\t\t\t//".$this->setLine(__LINE__)." loading..."; - $setter .= PHP_EOL.$tabV."\t\t\tforeach (\$uikitComp as \$class)"; - $setter .= PHP_EOL.$tabV."\t\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\tforeach (".$this->fileContentStatic['###Component###']."Helper::\$uk_components[\$class] as \$name)"; - $setter .= PHP_EOL.$tabV."\t\t\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t//".$this->setLine(__LINE__)." check if the CSS file exists."; - $setter .= PHP_EOL.$tabV."\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/css/components/'.\$name.\$style.\$size.'.css'))"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t\t//".$this->setLine(__LINE__)." load the css."; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/css/components/'.\$name.\$style.\$size.'.css');"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t}"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t//".$this->setLine(__LINE__)." check if the JavaScript file exists."; - $setter .= PHP_EOL.$tabV."\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/js/components/'.\$name.\$size.'.js'))"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t\t//".$this->setLine(__LINE__)." load the js."; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/js/components/'.\$name.\$size.'.js', 'text/javascript', true);"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t}"; - $setter .= PHP_EOL.$tabV."\t\t\t\t}"; - $setter .= PHP_EOL.$tabV."\t\t\t}"; - $setter .= PHP_EOL.$tabV."\t\t}"; + $setter .= PHP_EOL . $tabV . "\t\t}"; + $setter .= PHP_EOL . PHP_EOL . $tabV . "\t\t//" . $this->setLine(__LINE__) . " Load the needed uikit components in this view."; + $setter .= PHP_EOL . $tabV . "\t\tif (\$uikit != 2 && isset(\$uikitComp) && " . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$uikitComp))"; + $setter .= PHP_EOL . $tabV . "\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t//" . $this->setLine(__LINE__) . " load just in case."; + $setter .= PHP_EOL . $tabV . "\t\t\tjimport('joomla.filesystem.file');"; + $setter .= PHP_EOL . $tabV . "\t\t\t//" . $this->setLine(__LINE__) . " loading..."; + $setter .= PHP_EOL . $tabV . "\t\t\tforeach (\$uikitComp as \$class)"; + $setter .= PHP_EOL . $tabV . "\t\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\tforeach (" . $this->fileContentStatic['###Component###'] . "Helper::\$uk_components[\$class] as \$name)"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t//" . $this->setLine(__LINE__) . " check if the CSS file exists."; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_" . $this->fileContentStatic['###component###'] . "/uikit-v2/css/components/'.\$name.\$style.\$size.'.css'))"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t\t//" . $this->setLine(__LINE__) . " load the css."; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_" . $this->fileContentStatic['###component###'] . "/uikit-v2/css/components/'.\$name.\$style.\$size.'.css');"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t}"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t//" . $this->setLine(__LINE__) . " check if the JavaScript file exists."; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_" . $this->fileContentStatic['###component###'] . "/uikit-v2/js/components/'.\$name.\$size.'.js'))"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t\t//" . $this->setLine(__LINE__) . " load the js."; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_" . $this->fileContentStatic['###component###'] . "/uikit-v2/js/components/'.\$name.\$size.'.js', 'text/javascript', true);"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t}"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t}"; + $setter .= PHP_EOL . $tabV . "\t\t\t}"; + $setter .= PHP_EOL . $tabV . "\t\t}"; } elseif ((2 == $this->uikit || 1 == $this->uikit) && isset($this->siteFieldData['uikit'][$view['settings']->code]) && ComponentbuilderHelper::checkArray($this->siteFieldData['uikit'][$view['settings']->code])) { - $setter .= PHP_EOL.PHP_EOL.$tabV."\t\t//".$this->setLine(__LINE__)." Load the needed uikit components in this view."; - $setter .= PHP_EOL.$tabV."\t\t\$uikitComp = \$this->get('UikitComp');"; - $setter .= PHP_EOL.$tabV."\t\tif (\$uikit != 2 && isset(\$uikitComp) && ".$this->fileContentStatic['###Component###']."Helper::checkArray(\$uikitComp))"; - $setter .= PHP_EOL.$tabV."\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t//".$this->setLine(__LINE__)." load just in case."; - $setter .= PHP_EOL.$tabV."\t\t\tjimport('joomla.filesystem.file');"; - $setter .= PHP_EOL.$tabV."\t\t\t//".$this->setLine(__LINE__)." loading..."; - $setter .= PHP_EOL.$tabV."\t\t\tforeach (\$uikitComp as \$class)"; - $setter .= PHP_EOL.$tabV."\t\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\tforeach (".$this->fileContentStatic['###Component###']."Helper::\$uk_components[\$class] as \$name)"; - $setter .= PHP_EOL.$tabV."\t\t\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t//".$this->setLine(__LINE__)." check if the CSS file exists."; - $setter .= PHP_EOL.$tabV."\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/css/components/'.\$name.\$style.\$size.'.css'))"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t\t//".$this->setLine(__LINE__)." load the css."; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/css/components/'.\$name.\$style.\$size.'.css');"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t}"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t//".$this->setLine(__LINE__)." check if the JavaScript file exists."; - $setter .= PHP_EOL.$tabV."\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/js/components/'.\$name.\$size.'.js'))"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t\t//".$this->setLine(__LINE__)." load the js."; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/js/components/'.\$name.\$size.'.js', 'text/javascript', true);"; - $setter .= PHP_EOL.$tabV."\t\t\t\t\t}"; - $setter .= PHP_EOL.$tabV."\t\t\t\t}"; - $setter .= PHP_EOL.$tabV."\t\t\t}"; - $setter .= PHP_EOL.$tabV."\t\t}"; - } + $setter .= PHP_EOL . PHP_EOL . $tabV . "\t\t//" . $this->setLine(__LINE__) . " Load the needed uikit components in this view."; + $setter .= PHP_EOL . $tabV . "\t\t\$uikitComp = \$this->get('UikitComp');"; + $setter .= PHP_EOL . $tabV . "\t\tif (\$uikit != 2 && isset(\$uikitComp) && " . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$uikitComp))"; + $setter .= PHP_EOL . $tabV . "\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t//" . $this->setLine(__LINE__) . " load just in case."; + $setter .= PHP_EOL . $tabV . "\t\t\tjimport('joomla.filesystem.file');"; + $setter .= PHP_EOL . $tabV . "\t\t\t//" . $this->setLine(__LINE__) . " loading..."; + $setter .= PHP_EOL . $tabV . "\t\t\tforeach (\$uikitComp as \$class)"; + $setter .= PHP_EOL . $tabV . "\t\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\tforeach (" . $this->fileContentStatic['###Component###'] . "Helper::\$uk_components[\$class] as \$name)"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t//" . $this->setLine(__LINE__) . " check if the CSS file exists."; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_" . $this->fileContentStatic['###component###'] . "/uikit-v2/css/components/'.\$name.\$style.\$size.'.css'))"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t\t//" . $this->setLine(__LINE__) . " load the css."; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_" . $this->fileContentStatic['###component###'] . "/uikit-v2/css/components/'.\$name.\$style.\$size.'.css');"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t}"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t//" . $this->setLine(__LINE__) . " check if the JavaScript file exists."; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_" . $this->fileContentStatic['###component###'] . "/uikit-v2/js/components/'.\$name.\$size.'.js'))"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t\t//" . $this->setLine(__LINE__) . " load the js."; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_" . $this->fileContentStatic['###component###'] . "/uikit-v2/js/components/'.\$name.\$size.'.js', 'text/javascript', true);"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t\t}"; + $setter .= PHP_EOL . $tabV . "\t\t\t\t}"; + $setter .= PHP_EOL . $tabV . "\t\t\t}"; + $setter .= PHP_EOL . $tabV . "\t\t}"; + } // now set the version 3 if (2 == $this->uikit || 3 == $this->uikit) { if (2 == $this->uikit) { - $setter .= PHP_EOL."\t\t}"; - $setter .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Use Uikit Version 3"; - $setter .= PHP_EOL."\t\telseif (3 == \$uikitVersion)"; - $setter .= PHP_EOL."\t\t{"; + $setter .= PHP_EOL . "\t\t}"; + $setter .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Use Uikit Version 3"; + $setter .= PHP_EOL . "\t\telseif (3 == \$uikitVersion)"; + $setter .= PHP_EOL . "\t\t{"; } // add version 3 fiels to page - $setter .= PHP_EOL.$tabV."\t\t//".$this->setLine(__LINE__)." The uikit css."; - $setter .= PHP_EOL.$tabV."\t\tif ((!\$HeaderCheck->css_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)"; - $setter .= PHP_EOL.$tabV."\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v3/css/uikit'.\$size.'.css');"; - $setter .= PHP_EOL.$tabV."\t\t}"; - $setter .= PHP_EOL.$tabV."\t\t//".$this->setLine(__LINE__)." The uikit js."; - $setter .= PHP_EOL.$tabV."\t\tif ((!\$HeaderCheck->js_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)"; - $setter .= PHP_EOL.$tabV."\t\t{"; - $setter .= PHP_EOL.$tabV."\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v3/js/uikit'.\$size.'.js');"; - $setter .= PHP_EOL.$tabV."\t\t}"; + $setter .= PHP_EOL . $tabV . "\t\t//" . $this->setLine(__LINE__) . " The uikit css."; + $setter .= PHP_EOL . $tabV . "\t\tif ((!\$HeaderCheck->css_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)"; + $setter .= PHP_EOL . $tabV . "\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_" . $this->fileContentStatic['###component###'] . "/uikit-v3/css/uikit'.\$size.'.css');"; + $setter .= PHP_EOL . $tabV . "\t\t}"; + $setter .= PHP_EOL . $tabV . "\t\t//" . $this->setLine(__LINE__) . " The uikit js."; + $setter .= PHP_EOL . $tabV . "\t\tif ((!\$HeaderCheck->js_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)"; + $setter .= PHP_EOL . $tabV . "\t\t{"; + $setter .= PHP_EOL . $tabV . "\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_" . $this->fileContentStatic['###component###'] . "/uikit-v3/js/uikit'.\$size.'.js');"; + $setter .= PHP_EOL . $tabV . "\t\t}"; if (2 == $this->uikit) { - $setter .= PHP_EOL."\t\t}"; + $setter .= PHP_EOL . "\t\t}"; } } return $setter; @@ -3873,7 +3891,7 @@ class Interpretation extends Fields { if ($view['settings']->add_php_jview == 1) { - return PHP_EOL.PHP_EOL.$this->setPlaceholders($view['settings']->php_jview, $this->placeholders); + return PHP_EOL . PHP_EOL . $this->setPlaceholders($view['settings']->php_jview, $this->placeholders); } return ''; } @@ -3892,32 +3910,31 @@ class Interpretation extends Fields $this->placeholders['[[[LIMITBOX]]]'] = 'pagination->getLimitBox(); ?>'; } $body[] = $this->setPlaceholders($view['settings']->default, $this->placeholders); - $body[] = PHP_EOL.'items) && isset($this->pagination) && isset($this->pagination->pagesTotal) && $this->pagination->pagesTotal > 1): ?>'; + $body[] = PHP_EOL . 'items) && isset($this->pagination) && isset($this->pagination->pagesTotal) && $this->pagination->pagesTotal > 1): ?>'; $body[] = '
'; - $body[] = "\t".''; $body[] = '
'; $body[] = ''; - - return implode(PHP_EOL,$body); + + return implode(PHP_EOL, $body); } else { - return PHP_EOL. $this->setPlaceholders($view['settings']->default, $this->placeholders); + return PHP_EOL . $this->setPlaceholders($view['settings']->default, $this->placeholders); } - } return ''; } @@ -3930,9 +3947,9 @@ class Interpretation extends Fields if (strpos($view['settings']->default, 'Joomla.submitbutton = function(task)') === false) { $script = array(); - $script[] = PHP_EOL.""; - + return implode(PHP_EOL, $script); } - } return ''; } @@ -3954,10 +3970,10 @@ class Interpretation extends Fields { if ($view['settings']->add_php_view == 1) { - $view['settings']->php_view = (array) explode(PHP_EOL,$view['settings']->php_view); + $view['settings']->php_view = (array) explode(PHP_EOL, $view['settings']->php_view); if (ComponentbuilderHelper::checkArray($view['settings']->php_view)) { - $_tmp = PHP_EOL.PHP_EOL.implode(PHP_EOL,$view['settings']->php_view); + $_tmp = PHP_EOL . PHP_EOL . implode(PHP_EOL, $view['settings']->php_view); return $this->setPlaceholders($_tmp, $this->placeholders); } } @@ -3974,14 +3990,14 @@ class Interpretation extends Fields { // build the file $target = array($this->target => $view['settings']->code); - $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version); - $this->buildDynamique($target,'template', $template, $config); + $config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified, '###VERSION###' => $view['settings']->version); + $this->buildDynamique($target, 'template', $template, $config); // set the file data - $TARGET = ComponentbuilderHelper::safeString($this->target,'U'); + $TARGET = ComponentbuilderHelper::safeString($this->target, 'U'); // ###SITE_TEMPLATE_BODY### <<>> - $this->fileContentDynamic[$view['settings']->code.'_'.$template]['###'.$TARGET.'_TEMPLATE_BODY###'] = PHP_EOL . $this->setPlaceholders($data['html'], $this->placeholders); + $this->fileContentDynamic[$view['settings']->code . '_' . $template]['###' . $TARGET . '_TEMPLATE_BODY###'] = PHP_EOL . $this->setPlaceholders($data['html'], $this->placeholders); // ###SITE_TEMPLATE_CODE_BODY### <<>> - $this->fileContentDynamic[$view['settings']->code.'_'.$template]['###'.$TARGET.'_TEMPLATE_CODE_BODY###'] = $this->setCustomViewTemplateCode($data['php_view']); + $this->fileContentDynamic[$view['settings']->code . '_' . $template]['###' . $TARGET . '_TEMPLATE_CODE_BODY###'] = $this->setCustomViewTemplateCode($data['php_view']); } } } @@ -3990,10 +4006,10 @@ class Interpretation extends Fields { if (ComponentbuilderHelper::checkString($php)) { - $php_view = (array) explode(PHP_EOL,$php); + $php_view = (array) explode(PHP_EOL, $php); if (ComponentbuilderHelper::checkArray($php_view)) { - $php_view = PHP_EOL.PHP_EOL.implode(PHP_EOL,$php_view); + $php_view = PHP_EOL . PHP_EOL . implode(PHP_EOL, $php_view); return $this->setPlaceholders($php_view, $this->placeholders); } } @@ -4008,23 +4024,22 @@ class Interpretation extends Fields { // build the file $target = array($this->target => $layout); - $this->buildDynamique($target,'layout'); + $this->buildDynamique($target, 'layout'); // set the file data - $TARGET = ComponentbuilderHelper::safeString($this->target,'U'); + $TARGET = ComponentbuilderHelper::safeString($this->target, 'U'); // ###SITE_LAYOUT_CODE### <<>> - $php_view = (array) explode(PHP_EOL,$data['php_view']); + $php_view = (array) explode(PHP_EOL, $data['php_view']); if (ComponentbuilderHelper::checkArray($php_view)) { - $php_view = PHP_EOL.PHP_EOL.implode(PHP_EOL,$php_view); - $this->fileContentDynamic[$layout]['###'.$TARGET.'_LAYOUT_CODE###'] = $this->setPlaceholders($php_view, $this->placeholders); + $php_view = PHP_EOL . PHP_EOL . implode(PHP_EOL, $php_view); + $this->fileContentDynamic[$layout]['###' . $TARGET . '_LAYOUT_CODE###'] = $this->setPlaceholders($php_view, $this->placeholders); } else { - $this->fileContentDynamic[$layout]['###'.$TARGET.'_LAYOUT_CODE###'] = ''; + $this->fileContentDynamic[$layout]['###' . $TARGET . '_LAYOUT_CODE###'] = ''; } // ###SITE_LAYOUT_BODY### <<>> - $this->fileContentDynamic[$layout]['###'.$TARGET.'_LAYOUT_BODY###'] = PHP_EOL . $this->setPlaceholders($data['html'], $this->placeholders); - + $this->fileContentDynamic[$layout]['###' . $TARGET . '_LAYOUT_BODY###'] = PHP_EOL . $this->setPlaceholders($data['html'], $this->placeholders); } } } @@ -4069,12 +4084,12 @@ class Interpretation extends Fields if ($type !== 'static') { //var_dump($replacment); echo PHP_EOL; - $echos[$replacment] = "###".$replacment."###
"; + $echos[$replacment] = "###" . $replacment . "###
"; } elseif ($type === 'static') { //var_dump($replacment); echo PHP_EOL; - $echos[$replacment] = "###".$replacment."###
"; + $echos[$replacment] = "###" . $replacment . "###
"; } } } @@ -4082,7 +4097,7 @@ class Interpretation extends Fields foreach ($echos as $echo) { - echo $echo.'
'; + echo $echo . '
'; } } @@ -4090,17 +4105,17 @@ class Interpretation extends Fields { $script = ''; // go from json to array - if(isset($this->jsonItemBuilder[$view]) && ComponentbuilderHelper::checkArray($this->jsonItemBuilder[$view])) + if (isset($this->jsonItemBuilder[$view]) && ComponentbuilderHelper::checkArray($this->jsonItemBuilder[$view])) { foreach ($this->jsonItemBuilder[$view] as $jsonItem) { - $script .= PHP_EOL.PHP_EOL."\t\t\tif (!empty(\$item->".$jsonItem."))"; - $script .= PHP_EOL."\t\t\t{"; - $script .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Convert the ".$jsonItem." field to an array."; - $script .= PHP_EOL."\t\t\t\t\$".$jsonItem." = new Registry;"; - $script .= PHP_EOL."\t\t\t\t\$".$jsonItem."->loadString(\$item->".$jsonItem.");"; - $script .= PHP_EOL."\t\t\t\t\$item->".$jsonItem." = \$".$jsonItem."->toArray();"; - $script .= PHP_EOL."\t\t\t}"; + $script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $jsonItem . "))"; + $script .= PHP_EOL . "\t\t\t{"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " Convert the " . $jsonItem . " field to an array."; + $script .= PHP_EOL . "\t\t\t\t\$" . $jsonItem . " = new Registry;"; + $script .= PHP_EOL . "\t\t\t\t\$" . $jsonItem . "->loadString(\$item->" . $jsonItem . ");"; + $script .= PHP_EOL . "\t\t\t\t\$item->" . $jsonItem . " = \$" . $jsonItem . "->toArray();"; + $script .= PHP_EOL . "\t\t\t}"; } } // go from json to string @@ -4109,12 +4124,10 @@ class Interpretation extends Fields $makeArray = ''; foreach ($this->jsonStringBuilder[$view] as $jsonString) { - $script .= PHP_EOL.PHP_EOL."\t\t\tif (!empty(\$item->".$jsonString."))"; - $script .= PHP_EOL."\t\t\t{"; - $script .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." JSON Decode ".$jsonString."."; - if (isset($this->jsonItemBuilderArray[$view]) - && ComponentbuilderHelper::checkArray($this->jsonItemBuilderArray[$view]) - && in_array($jsonString, $this->jsonItemBuilderArray[$view])) + $script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $jsonString . "))"; + $script .= PHP_EOL . "\t\t\t{"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " JSON Decode " . $jsonString . "."; + if (isset($this->jsonItemBuilderArray[$view]) && ComponentbuilderHelper::checkArray($this->jsonItemBuilderArray[$view]) && in_array($jsonString, $this->jsonItemBuilderArray[$view])) { $makeArray = ',true'; } @@ -4122,8 +4135,8 @@ class Interpretation extends Fields { $makeArray = ',true'; } - $script .= PHP_EOL."\t\t\t\t\$item->".$jsonString." = json_decode(\$item->".$jsonString.$makeArray.");"; - $script .= PHP_EOL."\t\t\t}"; + $script .= PHP_EOL . "\t\t\t\t\$item->" . $jsonString . " = json_decode(\$item->" . $jsonString . $makeArray . ");"; + $script .= PHP_EOL . "\t\t\t}"; } } // go from base64 to string @@ -4131,51 +4144,51 @@ class Interpretation extends Fields { foreach ($this->base64Builder[$view] as $baseString) { - $script .= PHP_EOL.PHP_EOL."\t\t\tif (!empty(\$item->".$baseString."))"; // TODO && base64_encode(base64_decode(\$item->".$baseString.", true)) === \$item->".$baseString.")"; - $script .= PHP_EOL."\t\t\t{"; - $script .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." base64 Decode ".$baseString."."; - $script .= PHP_EOL."\t\t\t\t\$item->".$baseString." = base64_decode(\$item->".$baseString.");"; - $script .= PHP_EOL."\t\t\t}"; + $script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . "))"; // TODO && base64_encode(base64_decode(\$item->".$baseString.", true)) === \$item->".$baseString.")"; + $script .= PHP_EOL . "\t\t\t{"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " base64 Decode " . $baseString . "."; + $script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = base64_decode(\$item->" . $baseString . ");"; + $script .= PHP_EOL . "\t\t\t}"; } } // decryption if ((isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view])) || (isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view]))) { - $Component = $this->fileContentStatic['###Component###']; + $Component = $this->fileContentStatic['###Component###']; if (isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view])) { - $script .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Get the basic encryption."; - $script .= PHP_EOL."\t\t\t\$basickey = ".$Component."Helper::getCryptKey('basic');"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Get the encryption object."; - $script .= PHP_EOL."\t\t\t\$basic = new FOFEncryptAes(\$basickey, 128);"; + $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; + $script .= PHP_EOL . "\t\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; + $script .= PHP_EOL . "\t\t\t\$basic = new FOFEncryptAes(\$basickey, 128);"; foreach ($this->basicEncryptionBuilder[$view] as $baseString) { - $script .= PHP_EOL.PHP_EOL."\t\t\tif (!empty(\$item->".$baseString.") && \$basickey && !is_numeric(\$item->".$baseString.") && \$item->".$baseString." === base64_encode(base64_decode(\$item->".$baseString.", true)))"; - $script .= PHP_EOL."\t\t\t{"; - $script .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." basic decrypt data ".$baseString."."; - $script .= PHP_EOL."\t\t\t\t\$item->".$baseString." = rtrim(\$basic->decryptString(\$item->".$baseString."), ".'"\0"'.");"; - $script .= PHP_EOL."\t\t\t}"; + $script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . ") && \$basickey && !is_numeric(\$item->" . $baseString . ") && \$item->" . $baseString . " === base64_encode(base64_decode(\$item->" . $baseString . ", true)))"; + $script .= PHP_EOL . "\t\t\t{"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " basic decrypt data " . $baseString . "."; + $script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = rtrim(\$basic->decryptString(\$item->" . $baseString . "), " . '"\0"' . ");"; + $script .= PHP_EOL . "\t\t\t}"; } } if (isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view])) { - $script .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Get the advanced encryption key."; - $script .= PHP_EOL."\t\t\t\$advancedkey = ".$Component."Helper::getCryptKey('advanced');"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Get the encryption object."; - $script .= PHP_EOL."\t\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; + $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the advanced encryption key."; + $script .= PHP_EOL . "\t\t\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; + $script .= PHP_EOL . "\t\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; foreach ($this->advancedEncryptionBuilder[$view] as $baseString) { - $script .= PHP_EOL.PHP_EOL."\t\t\tif (!empty(\$item->".$baseString.") && \$advancedkey && !is_numeric(\$item->".$baseString.") && \$item->".$baseString." === base64_encode(base64_decode(\$item->".$baseString.", true)))"; - $script .= PHP_EOL."\t\t\t{"; - $script .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." advanced decrypt data ".$baseString."."; - $script .= PHP_EOL."\t\t\t\t\$item->".$baseString." = rtrim(\$advanced->decryptString(\$item->".$baseString."), ".'"\0"'.");"; - $script .= PHP_EOL."\t\t\t}"; + $script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . ") && \$advancedkey && !is_numeric(\$item->" . $baseString . ") && \$item->" . $baseString . " === base64_encode(base64_decode(\$item->" . $baseString . ", true)))"; + $script .= PHP_EOL . "\t\t\t{"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " advanced decrypt data " . $baseString . "."; + $script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = rtrim(\$advanced->decryptString(\$item->" . $baseString . "), " . '"\0"' . ");"; + $script .= PHP_EOL . "\t\t\t}"; } } } // add custom php to getitem method - $script .= $this->getCustomScriptBuilder('php_getitem', $view, PHP_EOL.PHP_EOL); + $script .= $this->getCustomScriptBuilder('php_getitem', $view, PHP_EOL . PHP_EOL); return $script; } @@ -4183,15 +4196,15 @@ class Interpretation extends Fields public function setCheckboxSave(&$view) { $script = ''; - if(isset($this->checkboxBuilder[$view]) && ComponentbuilderHelper::checkArray($this->checkboxBuilder[$view])) + if (isset($this->checkboxBuilder[$view]) && ComponentbuilderHelper::checkArray($this->checkboxBuilder[$view])) { foreach ($this->checkboxBuilder[$view] as $checkbox) { - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Set the empty ".$checkbox." item to data"; - $script .= PHP_EOL."\t\tif (!isset(\$data['".$checkbox."']))"; - $script .= PHP_EOL."\t\t{"; - $script .= PHP_EOL."\t\t\t\$data['".$checkbox."'] = '';"; - $script .= PHP_EOL."\t\t}"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Set the empty " . $checkbox . " item to data"; + $script .= PHP_EOL . "\t\tif (!isset(\$data['" . $checkbox . "']))"; + $script .= PHP_EOL . "\t\t{"; + $script .= PHP_EOL . "\t\t\t\$data['" . $checkbox . "'] = '';"; + $script .= PHP_EOL . "\t\t}"; } } return $script; @@ -4201,87 +4214,87 @@ class Interpretation extends Fields { $script = ''; // check if there was script added before modeling of data - $script .= $this->getCustomScriptBuilder('php_before_save', $view, PHP_EOL.PHP_EOL); + $script .= $this->getCustomScriptBuilder('php_before_save', $view, PHP_EOL . PHP_EOL); // turn array into JSON string - if(isset($this->jsonItemBuilder[$view]) && ComponentbuilderHelper::checkArray($this->jsonItemBuilder[$view])) + if (isset($this->jsonItemBuilder[$view]) && ComponentbuilderHelper::checkArray($this->jsonItemBuilder[$view])) { foreach ($this->jsonItemBuilder[$view] as $jsonItem) { - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Set the ".$jsonItem." items to data."; - $script .= PHP_EOL."\t\tif (isset(\$data['".$jsonItem."']) && is_array(\$data['".$jsonItem."']))"; - $script .= PHP_EOL."\t\t{"; - $script .= PHP_EOL."\t\t\t\$".$jsonItem." = new JRegistry;"; - $script .= PHP_EOL."\t\t\t\$".$jsonItem."->loadArray(\$data['".$jsonItem."']);"; - $script .= PHP_EOL."\t\t\t\$data['".$jsonItem."'] = (string) \$".$jsonItem.";"; - $script .= PHP_EOL."\t\t}"; - $script .= PHP_EOL."\t\telseif (!isset(\$data['".$jsonItem."']))"; - $script .= PHP_EOL."\t\t{"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Set the empty ".$jsonItem." to data"; - $script .= PHP_EOL."\t\t\t\$data['".$jsonItem."'] = '';"; - $script .= PHP_EOL."\t\t}"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Set the " . $jsonItem . " items to data."; + $script .= PHP_EOL . "\t\tif (isset(\$data['" . $jsonItem . "']) && is_array(\$data['" . $jsonItem . "']))"; + $script .= PHP_EOL . "\t\t{"; + $script .= PHP_EOL . "\t\t\t\$" . $jsonItem . " = new JRegistry;"; + $script .= PHP_EOL . "\t\t\t\$" . $jsonItem . "->loadArray(\$data['" . $jsonItem . "']);"; + $script .= PHP_EOL . "\t\t\t\$data['" . $jsonItem . "'] = (string) \$" . $jsonItem . ";"; + $script .= PHP_EOL . "\t\t}"; + $script .= PHP_EOL . "\t\telseif (!isset(\$data['" . $jsonItem . "']))"; + $script .= PHP_EOL . "\t\t{"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Set the empty " . $jsonItem . " to data"; + $script .= PHP_EOL . "\t\t\t\$data['" . $jsonItem . "'] = '';"; + $script .= PHP_EOL . "\t\t}"; } } // turn string into json string - if(isset($this->jsonStringBuilder[$view]) && ComponentbuilderHelper::checkArray($this->jsonStringBuilder[$view])) + if (isset($this->jsonStringBuilder[$view]) && ComponentbuilderHelper::checkArray($this->jsonStringBuilder[$view])) { foreach ($this->jsonStringBuilder[$view] as $jsonString) { - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Set the ".$jsonString." string to JSON string."; - $script .= PHP_EOL."\t\tif (isset(\$data['".$jsonString."']))"; - $script .= PHP_EOL."\t\t{"; - $script .= PHP_EOL."\t\t\t\$data['".$jsonString."'] = (string) json_encode(\$data['".$jsonString."']);"; - $script .= PHP_EOL."\t\t}"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Set the " . $jsonString . " string to JSON string."; + $script .= PHP_EOL . "\t\tif (isset(\$data['" . $jsonString . "']))"; + $script .= PHP_EOL . "\t\t{"; + $script .= PHP_EOL . "\t\t\t\$data['" . $jsonString . "'] = (string) json_encode(\$data['" . $jsonString . "']);"; + $script .= PHP_EOL . "\t\t}"; } } // turn string into base 64 string - if(isset($this->base64Builder[$view]) && ComponentbuilderHelper::checkArray($this->base64Builder[$view])) + if (isset($this->base64Builder[$view]) && ComponentbuilderHelper::checkArray($this->base64Builder[$view])) { foreach ($this->base64Builder[$view] as $baseString) { - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Set the ".$baseString." string to base64 string."; - $script .= PHP_EOL."\t\tif (isset(\$data['".$baseString."']))"; - $script .= PHP_EOL."\t\t{"; - $script .= PHP_EOL."\t\t\t\$data['".$baseString."'] = base64_encode(\$data['".$baseString."']);"; - $script .= PHP_EOL."\t\t}"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Set the " . $baseString . " string to base64 string."; + $script .= PHP_EOL . "\t\tif (isset(\$data['" . $baseString . "']))"; + $script .= PHP_EOL . "\t\t{"; + $script .= PHP_EOL . "\t\t\t\$data['" . $baseString . "'] = base64_encode(\$data['" . $baseString . "']);"; + $script .= PHP_EOL . "\t\t}"; } } // turn string into encrypted string - if((isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view])) || (isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view]))) + if ((isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view])) || (isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view]))) { - $Component = $this->fileContentStatic['###Component###']; - if(isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view])) + $Component = $this->fileContentStatic['###Component###']; + if (isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view])) { - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the basic encryption key."; - $script .= PHP_EOL."\t\t\$basickey = ".$Component."Helper::getCryptKey('basic');"; - $script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the encryption object"; - $script .= PHP_EOL."\t\t\$basic = new FOFEncryptAes(\$basickey, 128);"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption key."; + $script .= PHP_EOL . "\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; + $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object"; + $script .= PHP_EOL . "\t\t\$basic = new FOFEncryptAes(\$basickey, 128);"; foreach ($this->basicEncryptionBuilder[$view] as $baseString) { - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Encrypt data ".$baseString."."; - $script .= PHP_EOL."\t\tif (isset(\$data['".$baseString."']) && \$basickey)"; - $script .= PHP_EOL."\t\t{"; - $script .= PHP_EOL."\t\t\t\$data['".$baseString."'] = \$basic->encryptString(\$data['".$baseString."']);"; - $script .= PHP_EOL."\t\t}"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Encrypt data " . $baseString . "."; + $script .= PHP_EOL . "\t\tif (isset(\$data['" . $baseString . "']) && \$basickey)"; + $script .= PHP_EOL . "\t\t{"; + $script .= PHP_EOL . "\t\t\t\$data['" . $baseString . "'] = \$basic->encryptString(\$data['" . $baseString . "']);"; + $script .= PHP_EOL . "\t\t}"; } } - if(isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view])) + if (isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view])) { - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the advanced encryption key."; - $script .= PHP_EOL."\t\t\$advancedkey = ".$Component."Helper::getCryptKey('advanced');"; - $script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the encryption object"; - $script .= PHP_EOL."\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the advanced encryption key."; + $script .= PHP_EOL . "\t\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; + $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object"; + $script .= PHP_EOL . "\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; foreach ($this->advancedEncryptionBuilder[$view] as $baseString) { - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Encrypt data ".$baseString."."; - $script .= PHP_EOL."\t\tif (isset(\$data['".$baseString."']) && \$advancedkey)"; - $script .= PHP_EOL."\t\t{"; - $script .= PHP_EOL."\t\t\t\$data['".$baseString."'] = \$advanced->encryptString(\$data['".$baseString."']);"; - $script .= PHP_EOL."\t\t}"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Encrypt data " . $baseString . "."; + $script .= PHP_EOL . "\t\tif (isset(\$data['" . $baseString . "']) && \$advancedkey)"; + $script .= PHP_EOL . "\t\t{"; + $script .= PHP_EOL . "\t\t\t\$data['" . $baseString . "'] = \$advanced->encryptString(\$data['" . $baseString . "']);"; + $script .= PHP_EOL . "\t\t}"; } } } // add custom PHP to the save method - $script .= $this->getCustomScriptBuilder('php_save', $view, PHP_EOL.PHP_EOL); + $script .= $this->getCustomScriptBuilder('php_save', $view, PHP_EOL . PHP_EOL); return $script; } @@ -4290,18 +4303,18 @@ class Interpretation extends Fields // reset $oserver = ""; // set component name - $component = $this->fileContentStatic['###component###']; + $component = $this->fileContentStatic['###component###']; // add the tags observer if (isset($this->tagsBuilder[$view]) && ComponentbuilderHelper::checkString($this->tagsBuilder[$view])) { - $oserver .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Adding Tag Options"; - $oserver .= PHP_EOL."\t\tJTableObserverTags::createObserver(\$this, array('typeAlias' => 'com_".$component.".".$view."'));"; + $oserver .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Adding Tag Options"; + $oserver .= PHP_EOL . "\t\tJTableObserverTags::createObserver(\$this, array('typeAlias' => 'com_" . $component . "." . $view . "'));"; } // add the history/version observer if (isset($this->historyBuilder[$view]) && ComponentbuilderHelper::checkString($this->historyBuilder[$view])) { - $oserver .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Adding History Options"; - $oserver .= PHP_EOL."\t\tJTableObserverContenthistory::createObserver(\$this, array('typeAlias' => 'com_".$component.".".$view."'));"; + $oserver .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Adding History Options"; + $oserver .= PHP_EOL . "\t\tJTableObserverContenthistory::createObserver(\$this, array('typeAlias' => 'com_" . $component . "." . $view . "'));"; } return $oserver; } @@ -4312,20 +4325,20 @@ class Interpretation extends Fields if (array_key_exists($view, $this->catCodeBuilder)) { $code = $this->catCodeBuilder[$view]['code']; - return ", '".$code."' => \$this->".$code; + return ", '" . $code . "' => \$this->" . $code; } return ''; } - + public function setComponentToContentTypes($action) { $script = ''; if (isset($this->componentData->admin_views) && ComponentbuilderHelper::checkArray($this->componentData->admin_views)) { // set component name - $component = $this->fileContentStatic['###component###']; + $component = $this->fileContentStatic['###component###']; // reset - $dbStuff = array(); + $dbStuff = array(); // start loading the content type data foreach ($this->componentData->admin_views as $viewData) { @@ -4339,14 +4352,13 @@ class Interpretation extends Fields $checkViews = (isset($this->catCodeBuilder[$view]['views']) && ComponentbuilderHelper::checkString($this->catCodeBuilder[$view]['views'])) ? $this->catCodeBuilder[$view]['views'] : $views; if (ComponentbuilderHelper::checkArray($dbStuff[$view]) && array_key_exists($view, $this->catCodeBuilder) && ($checkViews == $views)) { - $dbStuff[$view.' category'] = $this->getCategoryContentType($view, $views, $component); + $dbStuff[$view . ' category'] = $this->getCategoryContentType($view, $views, $component); } - elseif(!isset($dbStuff[$view]) || !ComponentbuilderHelper::checkArray($dbStuff[$view])) + elseif (!isset($dbStuff[$view]) || !ComponentbuilderHelper::checkArray($dbStuff[$view])) { // remove if not array unset($dbStuff[$view]); } - } // build the db insert query if (ComponentbuilderHelper::checkArray($dbStuff)) @@ -4356,50 +4368,50 @@ class Interpretation extends Fields { $taabb = "\t"; } - $script .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Get The Database object"; - $script .= PHP_EOL."\t\t\t\$db = JFactory::getDbo();"; + $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get The Database object"; + $script .= PHP_EOL . "\t\t\t\$db = JFactory::getDbo();"; foreach ($dbStuff as $name => $tables) { if (ComponentbuilderHelper::checkArray($tables)) { $code = ComponentbuilderHelper::safeString($name); - $script .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Create the ".$name." content type object."; - $script .= PHP_EOL."\t\t\t\$".$code." = new stdClass();"; + $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Create the " . $name . " content type object."; + $script .= PHP_EOL . "\t\t\t\$" . $code . " = new stdClass();"; foreach ($tables as $table => $data) { - $script .= PHP_EOL."\t\t\t\$".$code."->".$table." = '".$data."';"; + $script .= PHP_EOL . "\t\t\t\$" . $code . "->" . $table . " = '" . $data . "';"; } if ($action === 'update') { // we first load script to check if data exist - $script .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Check if ".$name." type is already in content_type DB."; - $script .= PHP_EOL."\t\t\t\$".$code."_id = null;"; - $script .= PHP_EOL."\t\t\t\$query = \$db->getQuery(true);"; - $script .= PHP_EOL."\t\t\t\$query->select(\$db->quoteName(array('type_id')));"; - $script .= PHP_EOL."\t\t\t\$query->from(\$db->quoteName('#__content_types'));"; - $script .= PHP_EOL."\t\t\t\$query->where(\$db->quoteName('type_alias') . ' LIKE '. \$db->quote($".$code."->type_alias));"; - $script .= PHP_EOL."\t\t\t\$db->setQuery(\$query);"; - $script .= PHP_EOL."\t\t\t\$db->execute();"; + $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Check if " . $name . " type is already in content_type DB."; + $script .= PHP_EOL . "\t\t\t\$" . $code . "_id = null;"; + $script .= PHP_EOL . "\t\t\t\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . "\t\t\t\$query->select(\$db->quoteName(array('type_id')));"; + $script .= PHP_EOL . "\t\t\t\$query->from(\$db->quoteName('#__content_types'));"; + $script .= PHP_EOL . "\t\t\t\$query->where(\$db->quoteName('type_alias') . ' LIKE '. \$db->quote($" . $code . "->type_alias));"; + $script .= PHP_EOL . "\t\t\t\$db->setQuery(\$query);"; + $script .= PHP_EOL . "\t\t\t\$db->execute();"; } - $script .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Set the object into the content types table."; + $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Set the object into the content types table."; if ($action === 'update') { - $script .= PHP_EOL."\t\t\tif (\$db->getNumRows())"; - $script .= PHP_EOL."\t\t\t{"; - $script .= PHP_EOL."\t\t\t\t\$".$code."->type_id = \$db->loadResult();"; - $script .= PHP_EOL."\t\t\t\t\$".$code."_Updated = \$db->updateObject('#__content_types', \$".$code.", 'type_id');"; - $script .= PHP_EOL."\t\t\t}"; - $script .= PHP_EOL."\t\t\telse"; - $script .= PHP_EOL."\t\t\t{"; + $script .= PHP_EOL . "\t\t\tif (\$db->getNumRows())"; + $script .= PHP_EOL . "\t\t\t{"; + $script .= PHP_EOL . "\t\t\t\t\$" . $code . "->type_id = \$db->loadResult();"; + $script .= PHP_EOL . "\t\t\t\t\$" . $code . "_Updated = \$db->updateObject('#__content_types', \$" . $code . ", 'type_id');"; + $script .= PHP_EOL . "\t\t\t}"; + $script .= PHP_EOL . "\t\t\telse"; + $script .= PHP_EOL . "\t\t\t{"; } - $script .= PHP_EOL."\t\t\t".$taabb."\$".$code."_Inserted = \$db->insertObject('#__content_types', \$".$code.");"; + $script .= PHP_EOL . "\t\t\t" . $taabb . "\$" . $code . "_Inserted = \$db->insertObject('#__content_types', \$" . $code . ");"; if ($action === 'update') { - $script .= PHP_EOL."\t\t\t}"; + $script .= PHP_EOL . "\t\t\t}"; } } } - $script .= PHP_EOL.PHP_EOL; + $script .= PHP_EOL . PHP_EOL; } } return $script; @@ -4409,93 +4421,93 @@ class Interpretation extends Fields { // reset script $script = $this->setComponentToContentTypes('install'); - + // set the component name $component = $this->fileContentStatic['###component###']; - + // add the assets table update for permissions rules if (isset($this->assetsRules) && ComponentbuilderHelper::checkArray($this->assetsRules)) { if (ComponentbuilderHelper::checkString($script)) { - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Install the global extenstion assets permission."; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Install the global extenstion assets permission."; } else { - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Install the global extenstion assets permission."; - $script .= PHP_EOL."\t\t\t\$db = JFactory::getDbo();"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Install the global extenstion assets permission."; + $script .= PHP_EOL . "\t\t\t\$db = JFactory::getDbo();"; } - $script .= PHP_EOL."\t\t\t\$query = \$db->getQuery(true);"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Field to update."; - $script .= PHP_EOL."\t\t\t\$fields = array("; - $script .= PHP_EOL."\t\t\t\t\$db->quoteName('rules') . ' = ' . \$db->quote('{".implode(',', $this->assetsRules)."}'),"; - $script .= PHP_EOL."\t\t\t);"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Condition."; - $script .= PHP_EOL."\t\t\t\$conditions = array("; - $script .= PHP_EOL."\t\t\t\t\$db->quoteName('name') . ' = ' . \$db->quote('com_".$component."')"; - $script .= PHP_EOL."\t\t\t);"; - $script .= PHP_EOL."\t\t\t\$query->update(\$db->quoteName('#__assets'))->set(\$fields)->where(\$conditions);"; - $script .= PHP_EOL."\t\t\t\$db->setQuery(\$query);"; - $script .= PHP_EOL."\t\t\t\$allDone = \$db->execute();".PHP_EOL; + $script .= PHP_EOL . "\t\t\t\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Field to update."; + $script .= PHP_EOL . "\t\t\t\$fields = array("; + $script .= PHP_EOL . "\t\t\t\t\$db->quoteName('rules') . ' = ' . \$db->quote('{" . implode(',', $this->assetsRules) . "}'),"; + $script .= PHP_EOL . "\t\t\t);"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Condition."; + $script .= PHP_EOL . "\t\t\t\$conditions = array("; + $script .= PHP_EOL . "\t\t\t\t\$db->quoteName('name') . ' = ' . \$db->quote('com_" . $component . "')"; + $script .= PHP_EOL . "\t\t\t);"; + $script .= PHP_EOL . "\t\t\t\$query->update(\$db->quoteName('#__assets'))->set(\$fields)->where(\$conditions);"; + $script .= PHP_EOL . "\t\t\t\$db->setQuery(\$query);"; + $script .= PHP_EOL . "\t\t\t\$allDone = \$db->execute();" . PHP_EOL; } // add the global params for the component global settings if (isset($this->extensionsParams) && ComponentbuilderHelper::checkArray($this->extensionsParams)) { if (ComponentbuilderHelper::checkString($script)) { - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Install the global extenstion params."; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Install the global extenstion params."; } else { - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Install the global extenstion params."; - $script .= PHP_EOL."\t\t\t\$db = JFactory::getDbo();"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Install the global extenstion params."; + $script .= PHP_EOL . "\t\t\t\$db = JFactory::getDbo();"; } - $script .= PHP_EOL."\t\t\t\$query = \$db->getQuery(true);"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Field to update."; - $script .= PHP_EOL."\t\t\t\$fields = array("; - $script .= PHP_EOL."\t\t\t\t\$db->quoteName('params') . ' = ' . \$db->quote('{".implode(',', $this->extensionsParams)."}'),"; - $script .= PHP_EOL."\t\t\t);"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Condition."; - $script .= PHP_EOL."\t\t\t\$conditions = array("; - $script .= PHP_EOL."\t\t\t\t\$db->quoteName('element') . ' = ' . \$db->quote('com_".$component."')"; - $script .= PHP_EOL."\t\t\t);"; - $script .= PHP_EOL."\t\t\t\$query->update(\$db->quoteName('#__extensions'))->set(\$fields)->where(\$conditions);"; - $script .= PHP_EOL."\t\t\t\$db->setQuery(\$query);"; - $script .= PHP_EOL."\t\t\t\$allDone = \$db->execute();".PHP_EOL; + $script .= PHP_EOL . "\t\t\t\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Field to update."; + $script .= PHP_EOL . "\t\t\t\$fields = array("; + $script .= PHP_EOL . "\t\t\t\t\$db->quoteName('params') . ' = ' . \$db->quote('{" . implode(',', $this->extensionsParams) . "}'),"; + $script .= PHP_EOL . "\t\t\t);"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Condition."; + $script .= PHP_EOL . "\t\t\t\$conditions = array("; + $script .= PHP_EOL . "\t\t\t\t\$db->quoteName('element') . ' = ' . \$db->quote('com_" . $component . "')"; + $script .= PHP_EOL . "\t\t\t);"; + $script .= PHP_EOL . "\t\t\t\$query->update(\$db->quoteName('#__extensions'))->set(\$fields)->where(\$conditions);"; + $script .= PHP_EOL . "\t\t\t\$db->setQuery(\$query);"; + $script .= PHP_EOL . "\t\t\t\$allDone = \$db->execute();" . PHP_EOL; } // add the custom script - $script .= $this->getCustomScriptBuilder('php_postflight', 'install', PHP_EOL.PHP_EOL, null, true); + $script .= $this->getCustomScriptBuilder('php_postflight', 'install', PHP_EOL . PHP_EOL, null, true); // add the component install notice if (ComponentbuilderHelper::checkString($script)) { - $script .= PHP_EOL."\t\t\t".'echo \''; - $script .= PHP_EOL."\t\t\t\t".''; - $script .= PHP_EOL."\t\t\t\t".'\';'; - + $script .= PHP_EOL . "\t\t\t" . 'echo \''; + $script .= PHP_EOL . "\t\t\t\t" . ''; + $script .= PHP_EOL . "\t\t\t\t" . '\';'; + return $script; } - return PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." noting to install."; + return PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " noting to install."; } - + public function setPostUpdateScript() { // reset script $script = $this->setComponentToContentTypes('update'); // add the custom script - $script .= $this->getCustomScriptBuilder('php_postflight', 'update', PHP_EOL.PHP_EOL, null, true); + $script .= $this->getCustomScriptBuilder('php_postflight', 'update', PHP_EOL . PHP_EOL, null, true); if (isset($this->componentData->admin_views) && ComponentbuilderHelper::checkArray($this->componentData->admin_views)) { - $script .= PHP_EOL."\t\t\t".'echo \''; - $script .= PHP_EOL."\t\t\t\t".''; - $script .= PHP_EOL."\t\t\t\t".''; - $script .= PHP_EOL."\t\t\t\t

Upgrade to Version ".$this->fileContentStatic['###ACTUALVERSION###']." Was Successful! Let us know if anything is not working as expected.

';"; + $script .= PHP_EOL . "\t\t\t" . 'echo \''; + $script .= PHP_EOL . "\t\t\t\t" . ''; + $script .= PHP_EOL . "\t\t\t\t" . ''; + $script .= PHP_EOL . "\t\t\t\t

Upgrade to Version " . $this->fileContentStatic['###ACTUALVERSION###'] . " Was Successful! Let us know if anything is not working as expected.

';"; } if (ComponentbuilderHelper::checkString($script)) { return $script; } - return PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." noting to update."; + return PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " noting to update."; } public function setUninstallScript() @@ -4506,10 +4518,10 @@ class Interpretation extends Fields { $component = $this->fileContentStatic['###component###']; // start loading the data to delet - $script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get Application object"; - $script .= PHP_EOL."\t\t\$app = JFactory::getApplication();"; - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get The Database object"; - $script .= PHP_EOL."\t\t\$db = JFactory::getDbo();"; + $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get Application object"; + $script .= PHP_EOL . "\t\t\$app = JFactory::getApplication();"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get The Database object"; + $script .= PHP_EOL . "\t\t\$db = JFactory::getDbo();"; foreach ($this->uninstallScriptBuilder as $viewName => $typeAlias) { @@ -4517,125 +4529,125 @@ class Interpretation extends Fields $view = ComponentbuilderHelper::safeString($viewName); // First check if data is till in table - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Create a new query object."; - $script .= PHP_EOL."\t\t\$query = \$db->getQuery(true);"; - $script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Select id from content type table"; - $script .= PHP_EOL."\t\t\$query->select(\$db->quoteName('type_id'));"; - $script .= PHP_EOL."\t\t\$query->from(\$db->quoteName('#__content_types'));"; - $script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Where ".$viewName." alias is found"; - $script .= PHP_EOL."\t\t\$query->where( \$db->quoteName('type_alias') . ' = '. \$db->quote('".$typeAlias."') );"; - $script .= PHP_EOL."\t\t\$db->setQuery(\$query);"; - $script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Execute query to see if alias is found"; - $script .= PHP_EOL."\t\t\$db->execute();"; - $script .= PHP_EOL."\t\t\$".$view."_found = \$db->getNumRows();"; - $script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Now check if there were any rows"; - $script .= PHP_EOL."\t\tif (\$".$view."_found)"; - $script .= PHP_EOL."\t\t{"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Since there are load the needed ".$view." type ids"; - $script .= PHP_EOL."\t\t\t\$".$view."_ids = \$db->loadColumn();"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; + $script .= PHP_EOL . "\t\t\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Select id from content type table"; + $script .= PHP_EOL . "\t\t\$query->select(\$db->quoteName('type_id'));"; + $script .= PHP_EOL . "\t\t\$query->from(\$db->quoteName('#__content_types'));"; + $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Where " . $viewName . " alias is found"; + $script .= PHP_EOL . "\t\t\$query->where( \$db->quoteName('type_alias') . ' = '. \$db->quote('" . $typeAlias . "') );"; + $script .= PHP_EOL . "\t\t\$db->setQuery(\$query);"; + $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Execute query to see if alias is found"; + $script .= PHP_EOL . "\t\t\$db->execute();"; + $script .= PHP_EOL . "\t\t\$" . $view . "_found = \$db->getNumRows();"; + $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Now check if there were any rows"; + $script .= PHP_EOL . "\t\tif (\$" . $view . "_found)"; + $script .= PHP_EOL . "\t\t{"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Since there are load the needed " . $view . " type ids"; + $script .= PHP_EOL . "\t\t\t\$" . $view . "_ids = \$db->loadColumn();"; // Now remove the actual type entry - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Remove ".$viewName." from the content type table"; - $script .= PHP_EOL."\t\t\t\$".$view."_condition = array( \$db->quoteName('type_alias') . ' = '. \$db->quote('".$typeAlias."') );"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Create a new query object."; - $script .= PHP_EOL."\t\t\t\$query = \$db->getQuery(true);"; - $script .= PHP_EOL."\t\t\t\$query->delete(\$db->quoteName('#__content_types'));"; - $script .= PHP_EOL."\t\t\t\$query->where(\$".$view."_condition);"; - $script .= PHP_EOL."\t\t\t\$db->setQuery(\$query);"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Execute the query to remove ".$viewName." items"; - $script .= PHP_EOL."\t\t\t\$".$view."_done = \$db->execute();"; - $script .= PHP_EOL."\t\t\tif (\$".$view."_done);"; - $script .= PHP_EOL."\t\t\t{"; - $script .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." If succesfully remove ".$viewName." add queued success message."; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Remove " . $viewName . " from the content type table"; + $script .= PHP_EOL . "\t\t\t\$" . $view . "_condition = array( \$db->quoteName('type_alias') . ' = '. \$db->quote('" . $typeAlias . "') );"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; + $script .= PHP_EOL . "\t\t\t\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . "\t\t\t\$query->delete(\$db->quoteName('#__content_types'));"; + $script .= PHP_EOL . "\t\t\t\$query->where(\$" . $view . "_condition);"; + $script .= PHP_EOL . "\t\t\t\$db->setQuery(\$query);"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Execute the query to remove " . $viewName . " items"; + $script .= PHP_EOL . "\t\t\t\$" . $view . "_done = \$db->execute();"; + $script .= PHP_EOL . "\t\t\tif (\$" . $view . "_done);"; + $script .= PHP_EOL . "\t\t\t{"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " If succesfully remove " . $viewName . " add queued success message."; // TODO lang is not translated - $script .= PHP_EOL."\t\t\t\t\$app->enqueueMessage(JText::_('The (".$typeAlias.") type alias was removed from the #__content_type table'));"; - $script .= PHP_EOL."\t\t\t}"; + $script .= PHP_EOL . "\t\t\t\t\$app->enqueueMessage(JText::_('The (" . $typeAlias . ") type alias was removed from the #__content_type table'));"; + $script .= PHP_EOL . "\t\t\t}"; // Now remove the related items from contentitem tag map table - $script .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Remove ".$viewName." items from the contentitem tag map table"; - $script .= PHP_EOL."\t\t\t\$".$view."_condition = array( \$db->quoteName('type_alias') . ' = '. \$db->quote('".$typeAlias."') );"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Create a new query object."; - $script .= PHP_EOL."\t\t\t\$query = \$db->getQuery(true);"; - $script .= PHP_EOL."\t\t\t\$query->delete(\$db->quoteName('#__contentitem_tag_map'));"; - $script .= PHP_EOL."\t\t\t\$query->where(\$".$view."_condition);"; - $script .= PHP_EOL."\t\t\t\$db->setQuery(\$query);"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Execute the query to remove ".$viewName." items"; - $script .= PHP_EOL."\t\t\t\$".$view."_done = \$db->execute();"; - $script .= PHP_EOL."\t\t\tif (\$".$view."_done);"; - $script .= PHP_EOL."\t\t\t{"; - $script .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." If succesfully remove ".$viewName." add queued success message."; + $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Remove " . $viewName . " items from the contentitem tag map table"; + $script .= PHP_EOL . "\t\t\t\$" . $view . "_condition = array( \$db->quoteName('type_alias') . ' = '. \$db->quote('" . $typeAlias . "') );"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; + $script .= PHP_EOL . "\t\t\t\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . "\t\t\t\$query->delete(\$db->quoteName('#__contentitem_tag_map'));"; + $script .= PHP_EOL . "\t\t\t\$query->where(\$" . $view . "_condition);"; + $script .= PHP_EOL . "\t\t\t\$db->setQuery(\$query);"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Execute the query to remove " . $viewName . " items"; + $script .= PHP_EOL . "\t\t\t\$" . $view . "_done = \$db->execute();"; + $script .= PHP_EOL . "\t\t\tif (\$" . $view . "_done);"; + $script .= PHP_EOL . "\t\t\t{"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " If succesfully remove " . $viewName . " add queued success message."; // TODO lang is not translated - $script .= PHP_EOL."\t\t\t\t\$app->enqueueMessage(JText::_('The (".$typeAlias.") type alias was removed from the #__contentitem_tag_map table'));"; - $script .= PHP_EOL."\t\t\t}"; + $script .= PHP_EOL . "\t\t\t\t\$app->enqueueMessage(JText::_('The (" . $typeAlias . ") type alias was removed from the #__contentitem_tag_map table'));"; + $script .= PHP_EOL . "\t\t\t}"; // Now remove the related items from ucm content table - $script .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Remove ".$viewName." items from the ucm content table"; - $script .= PHP_EOL."\t\t\t\$".$view."_condition = array( \$db->quoteName('core_type_alias') . ' = ' . \$db->quote('".$typeAlias."') );"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Create a new query object."; - $script .= PHP_EOL."\t\t\t\$query = \$db->getQuery(true);"; - $script .= PHP_EOL."\t\t\t\$query->delete(\$db->quoteName('#__ucm_content'));"; - $script .= PHP_EOL."\t\t\t\$query->where(\$".$view."_condition);"; - $script .= PHP_EOL."\t\t\t\$db->setQuery(\$query);"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Execute the query to remove ".$viewName." items"; - $script .= PHP_EOL."\t\t\t\$".$view."_done = \$db->execute();"; - $script .= PHP_EOL."\t\t\tif (\$".$view."_done);"; - $script .= PHP_EOL."\t\t\t{"; - $script .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." If succesfully remove ".$viewName." add queued success message."; + $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Remove " . $viewName . " items from the ucm content table"; + $script .= PHP_EOL . "\t\t\t\$" . $view . "_condition = array( \$db->quoteName('core_type_alias') . ' = ' . \$db->quote('" . $typeAlias . "') );"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; + $script .= PHP_EOL . "\t\t\t\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . "\t\t\t\$query->delete(\$db->quoteName('#__ucm_content'));"; + $script .= PHP_EOL . "\t\t\t\$query->where(\$" . $view . "_condition);"; + $script .= PHP_EOL . "\t\t\t\$db->setQuery(\$query);"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Execute the query to remove " . $viewName . " items"; + $script .= PHP_EOL . "\t\t\t\$" . $view . "_done = \$db->execute();"; + $script .= PHP_EOL . "\t\t\tif (\$" . $view . "_done);"; + $script .= PHP_EOL . "\t\t\t{"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " If succesfully remove " . $viewName . " add queued success message."; // TODO lang is not translated - $script .= PHP_EOL."\t\t\t\t\$app->enqueueMessage(JText::_('The (".$typeAlias.") type alias was removed from the #__ucm_content table'));"; - $script .= PHP_EOL."\t\t\t}"; + $script .= PHP_EOL . "\t\t\t\t\$app->enqueueMessage(JText::_('The (" . $typeAlias . ") type alias was removed from the #__ucm_content table'));"; + $script .= PHP_EOL . "\t\t\t}"; // setup the foreach loop of ids - $script .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Make sure that all the ".$viewName." items are cleared from DB"; - $script .= PHP_EOL."\t\t\tforeach (\$".$view."_ids as \$".$view."_id)"; - $script .= PHP_EOL."\t\t\t{"; + $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Make sure that all the " . $viewName . " items are cleared from DB"; + $script .= PHP_EOL . "\t\t\tforeach (\$" . $view . "_ids as \$" . $view . "_id)"; + $script .= PHP_EOL . "\t\t\t{"; // Now remove the related items from ucm base table - $script .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Remove ".$viewName." items from the ucm base table"; - $script .= PHP_EOL."\t\t\t\t\$".$view."_condition = array( \$db->quoteName('ucm_type_id') . ' = ' . \$".$view."_id);"; - $script .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Create a new query object."; - $script .= PHP_EOL."\t\t\t\t\$query = \$db->getQuery(true);"; - $script .= PHP_EOL."\t\t\t\t\$query->delete(\$db->quoteName('#__ucm_base'));"; - $script .= PHP_EOL."\t\t\t\t\$query->where(\$".$view."_condition);"; - $script .= PHP_EOL."\t\t\t\t\$db->setQuery(\$query);"; - $script .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Execute the query to remove ".$viewName." items"; - $script .= PHP_EOL."\t\t\t\t\$db->execute();"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " Remove " . $viewName . " items from the ucm base table"; + $script .= PHP_EOL . "\t\t\t\t\$" . $view . "_condition = array( \$db->quoteName('ucm_type_id') . ' = ' . \$" . $view . "_id);"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; + $script .= PHP_EOL . "\t\t\t\t\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . "\t\t\t\t\$query->delete(\$db->quoteName('#__ucm_base'));"; + $script .= PHP_EOL . "\t\t\t\t\$query->where(\$" . $view . "_condition);"; + $script .= PHP_EOL . "\t\t\t\t\$db->setQuery(\$query);"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " Execute the query to remove " . $viewName . " items"; + $script .= PHP_EOL . "\t\t\t\t\$db->execute();"; // Now remove the related items from ucm history table - $script .= PHP_EOL.PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Remove ".$viewName." items from the ucm history table"; - $script .= PHP_EOL."\t\t\t\t\$".$view."_condition = array( \$db->quoteName('ucm_type_id') . ' = ' . \$".$view."_id);"; - $script .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Create a new query object."; - $script .= PHP_EOL."\t\t\t\t\$query = \$db->getQuery(true);"; - $script .= PHP_EOL."\t\t\t\t\$query->delete(\$db->quoteName('#__ucm_history'));"; - $script .= PHP_EOL."\t\t\t\t\$query->where(\$".$view."_condition);"; - $script .= PHP_EOL."\t\t\t\t\$db->setQuery(\$query);"; - $script .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Execute the query to remove ".$viewName." items"; - $script .= PHP_EOL."\t\t\t\t\$db->execute();"; + $script .= PHP_EOL . PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " Remove " . $viewName . " items from the ucm history table"; + $script .= PHP_EOL . "\t\t\t\t\$" . $view . "_condition = array( \$db->quoteName('ucm_type_id') . ' = ' . \$" . $view . "_id);"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; + $script .= PHP_EOL . "\t\t\t\t\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . "\t\t\t\t\$query->delete(\$db->quoteName('#__ucm_history'));"; + $script .= PHP_EOL . "\t\t\t\t\$query->where(\$" . $view . "_condition);"; + $script .= PHP_EOL . "\t\t\t\t\$db->setQuery(\$query);"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " Execute the query to remove " . $viewName . " items"; + $script .= PHP_EOL . "\t\t\t\t\$db->execute();"; - $script .= PHP_EOL."\t\t\t}"; + $script .= PHP_EOL . "\t\t\t}"; - $script .= PHP_EOL."\t\t}"; + $script .= PHP_EOL . "\t\t}"; } - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." If All related items was removed queued success message."; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " If All related items was removed queued success message."; // TODO lang is not translated - $script .= PHP_EOL."\t\t\$app->enqueueMessage(JText::_('All related items was removed from the #__ucm_base table'));"; - $script .= PHP_EOL."\t\t\$app->enqueueMessage(JText::_('All related items was removed from the #__ucm_history table'));"; + $script .= PHP_EOL . "\t\t\$app->enqueueMessage(JText::_('All related items was removed from the #__ucm_base table'));"; + $script .= PHP_EOL . "\t\t\$app->enqueueMessage(JText::_('All related items was removed from the #__ucm_history table'));"; // finaly remove the assets from the assets table - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Remove ".$component." assets from the assets table"; - $script .= PHP_EOL."\t\t\$".$component."_condition = array( \$db->quoteName('name') . ' LIKE ' . \$db->quote('com_".$component."%') );"; - $script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Create a new query object."; - $script .= PHP_EOL."\t\t\$query = \$db->getQuery(true);"; - $script .= PHP_EOL."\t\t\$query->delete(\$db->quoteName('#__assets'));"; - $script .= PHP_EOL."\t\t\$query->where(\$".$component."_condition);"; - $script .= PHP_EOL."\t\t\$db->setQuery(\$query);"; - $script .= PHP_EOL."\t\t\$".$view."_done = \$db->execute();"; - $script .= PHP_EOL."\t\tif (\$".$view."_done);"; - $script .= PHP_EOL."\t\t{"; - $script .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." If succesfully remove ".$component." add queued success message."; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Remove " . $component . " assets from the assets table"; + $script .= PHP_EOL . "\t\t\$" . $component . "_condition = array( \$db->quoteName('name') . ' LIKE ' . \$db->quote('com_" . $component . "%') );"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; + $script .= PHP_EOL . "\t\t\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . "\t\t\$query->delete(\$db->quoteName('#__assets'));"; + $script .= PHP_EOL . "\t\t\$query->where(\$" . $component . "_condition);"; + $script .= PHP_EOL . "\t\t\$db->setQuery(\$query);"; + $script .= PHP_EOL . "\t\t\$" . $view . "_done = \$db->execute();"; + $script .= PHP_EOL . "\t\tif (\$" . $view . "_done);"; + $script .= PHP_EOL . "\t\t{"; + $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " If succesfully remove " . $component . " add queued success message."; // TODO lang is not translated - $script .= PHP_EOL."\t\t\t\$app->enqueueMessage(JText::_('All related items was removed from the #__assets table'));"; - $script .= PHP_EOL."\t\t}"; + $script .= PHP_EOL . "\t\t\t\$app->enqueueMessage(JText::_('All related items was removed from the #__assets table'));"; + $script .= PHP_EOL . "\t\t}"; // done $script .= PHP_EOL; } @@ -4652,20 +4664,20 @@ class Interpretation extends Fields // reset array $array = array(); // set needed defaults - $alias = (array_key_exists($view, $this->aliasBuilder)) ? $this->aliasBuilder[$view] : 'null'; - $title = (array_key_exists($view, $this->titleBuilder)) ? $this->titleBuilder[$view] : 'null'; - $category = (array_key_exists($view, $this->catCodeBuilder)) ? $this->catCodeBuilder[$view]['code'] : 'null'; - $categoryHistory = (array_key_exists($view, $this->catCodeBuilder)) ? - '{"sourceColumn": "'.$category.'","targetTable": "#__categories","targetColumn": "id","displayColumn": "title"},': ''; - $Component = ComponentbuilderHelper::safeString($component, 'F'); - $View = ComponentbuilderHelper::safeString($view, 'F'); - $maintext = (isset($this->maintextBuilder[$view]) && ComponentbuilderHelper::checkString($this->maintextBuilder[$view])) ? $this->maintextBuilder[$view] : 'null'; - $hiddenFields = (isset($this->hiddenFieldsBuilder[$view]) && ComponentbuilderHelper::checkString($this->hiddenFieldsBuilder[$view])) ? $this->hiddenFieldsBuilder[$view]: ''; - $dynamicfields = (isset($this->dynamicfieldsBuilder[$view]) && ComponentbuilderHelper::checkString($this->dynamicfieldsBuilder[$view])) ? $this->dynamicfieldsBuilder[$view] : ''; - $intFields = (isset($this->intFieldsBuilder[$view]) && ComponentbuilderHelper::checkString($this->intFieldsBuilder[$view])) ? $this->intFieldsBuilder[$view] : ''; - $customfieldlinks = (isset($this->customFieldLinksBuilder[$view]) && ComponentbuilderHelper::checkString($this->customFieldLinksBuilder[$view])) ? $this->customFieldLinksBuilder[$view] : ''; + $alias = (array_key_exists($view, $this->aliasBuilder)) ? $this->aliasBuilder[$view] : 'null'; + $title = (array_key_exists($view, $this->titleBuilder)) ? $this->titleBuilder[$view] : 'null'; + $category = (array_key_exists($view, $this->catCodeBuilder)) ? $this->catCodeBuilder[$view]['code'] : 'null'; + $categoryHistory = (array_key_exists($view, $this->catCodeBuilder)) ? + '{"sourceColumn": "' . $category . '","targetTable": "#__categories","targetColumn": "id","displayColumn": "title"},' : ''; + $Component = ComponentbuilderHelper::safeString($component, 'F'); + $View = ComponentbuilderHelper::safeString($view, 'F'); + $maintext = (isset($this->maintextBuilder[$view]) && ComponentbuilderHelper::checkString($this->maintextBuilder[$view])) ? $this->maintextBuilder[$view] : 'null'; + $hiddenFields = (isset($this->hiddenFieldsBuilder[$view]) && ComponentbuilderHelper::checkString($this->hiddenFieldsBuilder[$view])) ? $this->hiddenFieldsBuilder[$view] : ''; + $dynamicfields = (isset($this->dynamicfieldsBuilder[$view]) && ComponentbuilderHelper::checkString($this->dynamicfieldsBuilder[$view])) ? $this->dynamicfieldsBuilder[$view] : ''; + $intFields = (isset($this->intFieldsBuilder[$view]) && ComponentbuilderHelper::checkString($this->intFieldsBuilder[$view])) ? $this->intFieldsBuilder[$view] : ''; + $customfieldlinks = (isset($this->customFieldLinksBuilder[$view]) && ComponentbuilderHelper::checkString($this->customFieldLinksBuilder[$view])) ? $this->customFieldLinksBuilder[$view] : ''; // build uninstall script for content types - $this->uninstallScriptBuilder[$View] = 'com_'.$component.'.'.$view; + $this->uninstallScriptBuilder[$View] = 'com_' . $component . '.' . $view; // check if this view has metadata if (isset($this->metadataBuilder[$view]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$view])) { @@ -4691,17 +4703,17 @@ class Interpretation extends Fields $accessHistory = ''; } // set the title - $array['type_title'] = $Component.' '.$View; + $array['type_title'] = $Component . ' ' . $View; // set the alias - $array['type_alias'] = 'com_'.$component.'.'.$view; + $array['type_alias'] = 'com_' . $component . '.' . $view; // set the table - $array['table'] = '{"special": {"dbtable": "#__'.$component.'_'.$view.'","key": "id","type": "'.$View.'","prefix": "'.$component.'Table","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $array['table'] = '{"special": {"dbtable": "#__' . $component . '_' . $view . '","key": "id","type": "' . $View . '","prefix": "' . $component . 'Table","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; // set field map - $array['field_mappings'] = '{"common": {"core_content_item_id": "id","core_title": "'.$title.'","core_state": "published","core_alias": "'.$alias.'","core_created_time": "created","core_modified_time": "modified","core_body": "'.$maintext.'","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "'.$core_access.'","core_params": "params","core_featured": "null","core_metadata": "'.$core_metadata.'","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "'.$core_metakey.'","core_metadesc": "'.$core_metadesc.'","core_catid": "'.$category.'","core_xreference": "null","asset_id": "asset_id"},"special": {'.$dynamicfields.'}}'; + $array['field_mappings'] = '{"common": {"core_content_item_id": "id","core_title": "' . $title . '","core_state": "published","core_alias": "' . $alias . '","core_created_time": "created","core_modified_time": "modified","core_body": "' . $maintext . '","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "' . $core_access . '","core_params": "params","core_featured": "null","core_metadata": "' . $core_metadata . '","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "' . $core_metakey . '","core_metadesc": "' . $core_metadesc . '","core_catid": "' . $category . '","core_xreference": "null","asset_id": "asset_id"},"special": {' . $dynamicfields . '}}'; // set the router class method - $array['router'] = $Component.'HelperRoute::get'.$View.'Route'; + $array['router'] = $Component . 'HelperRoute::get' . $View . 'Route'; // set content history - $array['content_history_options'] = '{"formFile": "administrator/components/com_'.$component.'/models/forms/'.$view.'.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"'.$hiddenFields.'],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"'.$intFields.'],"displayLookup": ['.$categoryHistory.'{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}'.$accessHistory.',{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}'.$customfieldlinks.']}'; + $array['content_history_options'] = '{"formFile": "administrator/components/com_' . $component . '/models/forms/' . $view . '.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"' . $hiddenFields . '],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"' . $intFields . '],"displayLookup": [' . $categoryHistory . '{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}' . $accessHistory . ',{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}' . $customfieldlinks . ']}'; return $array; } @@ -4710,21 +4722,21 @@ class Interpretation extends Fields public function getCategoryContentType($view, $views, $component) { - $category = $this->catCodeBuilder[$view]['code']; - $Component = ComponentbuilderHelper::safeString($component, 'F'); - $View = ComponentbuilderHelper::safeString($view, 'F'); + $category = $this->catCodeBuilder[$view]['code']; + $Component = ComponentbuilderHelper::safeString($component, 'F'); + $View = ComponentbuilderHelper::safeString($view, 'F'); // build uninstall script for content types - $this->uninstallScriptBuilder[$View.' '.$category] = 'com_'.$component.'.'.$views.'.category'; + $this->uninstallScriptBuilder[$View . ' ' . $category] = 'com_' . $component . '.' . $views . '.category'; // set the title - $array['type_title'] = $Component.' '.$View.' '.ComponentbuilderHelper::safeString($category, 'F'); + $array['type_title'] = $Component . ' ' . $View . ' ' . ComponentbuilderHelper::safeString($category, 'F'); // set the alias - $array['type_alias'] = 'com_'.$component.'.'.$views.'.category'; + $array['type_alias'] = 'com_' . $component . '.' . $views . '.category'; // set the table $array['table'] = '{"special":{"dbtable":"#__categories","key":"id","type":"Category","prefix":"JTable","config":"array()"},"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}'; // set field map $array['field_mappings'] = '{"common":{"core_content_item_id":"id","core_title":"title","core_state":"published","core_alias":"alias","core_created_time":"created_time","core_modified_time":"modified_time","core_body":"description", "core_hits":"hits","core_publish_up":"null","core_publish_down":"null","core_access":"access", "core_params":"params", "core_featured":"null", "core_metadata":"metadata", "core_language":"language", "core_images":"null", "core_urls":"null", "core_version":"version", "core_ordering":"null", "core_metakey":"metakey", "core_metadesc":"metadesc", "core_catid":"parent_id", "core_xreference":"null", "asset_id":"asset_id"}, "special":{"parent_id":"parent_id","lft":"lft","rgt":"rgt","level":"level","path":"path","extension":"extension","note":"note"}}'; // set the router class method - $array['router'] = $Component.'HelperRoute::getCategoryRoute'; + $array['router'] = $Component . 'HelperRoute::getCategoryRoute'; // set content history $array['content_history_options'] = '{"formFile":"administrator\/components\/com_categories\/models\/forms\/category.xml", "hideFields":["asset_id","checked_out","checked_out_time","version","lft","rgt","level","path","extension"], "ignoreChanges":["modified_user_id", "modified_time", "checked_out", "checked_out_time", "version", "hits", "path"],"convertToInt":["publish_up", "publish_down"], "displayLookup":[{"sourceColumn":"created_user_id","targetTable":"#__users","targetColumn":"id","displayColumn":"name"},{"sourceColumn":"access","targetTable":"#__viewlevels","targetColumn":"id","displayColumn":"title"},{"sourceColumn":"modified_user_id","targetTable":"#__users","targetColumn":"id","displayColumn":"name"},{"sourceColumn":"parent_id","targetTable":"#__categories","targetColumn":"id","displayColumn":"title"}]}'; @@ -4734,46 +4746,46 @@ class Interpretation extends Fields public function setRouterHelp($viewName_single, $viewName_list, $front = false) { // add if tags is added, also for all front item views - if (((isset($this->tagsBuilder[$viewName_single]) && ComponentbuilderHelper::checkString($this->tagsBuilder[$viewName_single])) || $front) && (!in_array($viewName_single,$this->setRouterHelpDone))) + if (((isset($this->tagsBuilder[$viewName_single]) && ComponentbuilderHelper::checkString($this->tagsBuilder[$viewName_single])) || $front) && (!in_array($viewName_single, $this->setRouterHelpDone))) { // insure we load a view only once $this->setRouterHelpDone[] = $viewName_single; // build view route helper $View = ComponentbuilderHelper::safeString($viewName_single, 'F'); $routeHelper = array(); - $routeHelper[] = PHP_EOL.PHP_EOL."\t/**"; - $routeHelper[] = "\t* @param int The route of the ".$View; + $routeHelper[] = PHP_EOL . PHP_EOL . "\t/**"; + $routeHelper[] = "\t* @param int The route of the " . $View; $routeHelper[] = "\t*/"; if ('category' === $viewName_single || 'categories' === $viewName_single) { - $routeHelper[] = "\tpublic static function get".$View."Route(\$id = 0)"; + $routeHelper[] = "\tpublic static function get" . $View . "Route(\$id = 0)"; } else { - $routeHelper[] = "\tpublic static function get".$View."Route(\$id = 0, \$catid = 0)"; + $routeHelper[] = "\tpublic static function get" . $View . "Route(\$id = 0, \$catid = 0)"; } $routeHelper[] = "\t{"; $routeHelper[] = "\t\tif (\$id > 0)"; $routeHelper[] = "\t\t{"; - $routeHelper[] = "\t\t\t//".$this->setLine(__LINE__)." Initialize the needel array."; + $routeHelper[] = "\t\t\t//" . $this->setLine(__LINE__) . " Initialize the needel array."; $routeHelper[] = "\t\t\t\$needles = array("; - $routeHelper[] = "\t\t\t\t'".$viewName_single."' => array((int) \$id)"; + $routeHelper[] = "\t\t\t\t'" . $viewName_single . "' => array((int) \$id)"; $routeHelper[] = "\t\t\t);"; - $routeHelper[] = "\t\t\t//".$this->setLine(__LINE__)." Create the link"; - $routeHelper[] = "\t\t\t\$link = 'index.php?option=com_".$this->fileContentStatic['###component###']."&view=".$viewName_single."&id='. \$id;"; + $routeHelper[] = "\t\t\t//" . $this->setLine(__LINE__) . " Create the link"; + $routeHelper[] = "\t\t\t\$link = 'index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $viewName_single . "&id='. \$id;"; $routeHelper[] = "\t\t}"; $routeHelper[] = "\t\telse"; $routeHelper[] = "\t\t{"; - $routeHelper[] = "\t\t\t//".$this->setLine(__LINE__)." Initialize the needel array."; + $routeHelper[] = "\t\t\t//" . $this->setLine(__LINE__) . " Initialize the needel array."; $routeHelper[] = "\t\t\t\$needles = array();"; - $routeHelper[] = "\t\t\t//".$this->setLine(__LINE__)."Create the link but don't add the id."; - $routeHelper[] = "\t\t\t\$link = 'index.php?option=com_".$this->fileContentStatic['###component###']."&view=".$viewName_single."';"; - $routeHelper[] = "\t\t}"; + $routeHelper[] = "\t\t\t//" . $this->setLine(__LINE__) . "Create the link but don't add the id."; + $routeHelper[] = "\t\t\t\$link = 'index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $viewName_single . "';"; + $routeHelper[] = "\t\t}"; if ('category' != $viewName_single && 'categories' != $viewName_single) { $routeHelper[] = "\t\tif (\$catid > 1)"; $routeHelper[] = "\t\t{"; - $routeHelper[] = "\t\t\t\$categories = JCategories::getInstance('".$this->fileContentStatic['###component###'].".".$viewName_list."');"; + $routeHelper[] = "\t\t\t\$categories = JCategories::getInstance('" . $this->fileContentStatic['###component###'] . "." . $viewName_list . "');"; $routeHelper[] = "\t\t\t\$category = \$categories->get(\$catid);"; $routeHelper[] = "\t\t\tif (\$category)"; $routeHelper[] = "\t\t\t{"; @@ -4785,23 +4797,23 @@ class Interpretation extends Fields } if (isset($this->hasMenuGlobal[$viewName_single])) { - $routeHelper[] = PHP_EOL."\t\tif (\$item = self::_findItem(\$needles, '".$viewName_single."'))"; + $routeHelper[] = PHP_EOL . "\t\tif (\$item = self::_findItem(\$needles, '" . $viewName_single . "'))"; } else - { - $routeHelper[] = PHP_EOL."\t\tif (\$item = self::_findItem(\$needles))"; + { + $routeHelper[] = PHP_EOL . "\t\tif (\$item = self::_findItem(\$needles))"; } $routeHelper[] = "\t\t{"; $routeHelper[] = "\t\t\t\$link .= '&Itemid='.\$item;"; $routeHelper[] = "\t\t}"; - $routeHelper[] = PHP_EOL."\t\treturn \$link;"; + $routeHelper[] = PHP_EOL . "\t\treturn \$link;"; $routeHelper[] = "\t}"; - return implode(PHP_EOL,$routeHelper); + return implode(PHP_EOL, $routeHelper); } return ''; } - + public function routerParseSwitch(&$view, $viewArray = null, $aliasView = true, $idView = true) { $isCategory = ''; @@ -4823,16 +4835,13 @@ class Interpretation extends Fields { if ($get['as'] === 'a') { - if (isset($get['selection']) && ComponentbuilderHelper::checkArray($get['selection']) - && isset($get['selection']['select_gets']) - && ComponentbuilderHelper::checkArray($get['selection']['select_gets'])) + if (isset($get['selection']) && ComponentbuilderHelper::checkArray($get['selection']) && isset($get['selection']['select_gets']) && ComponentbuilderHelper::checkArray($get['selection']['select_gets'])) { if (isset($get['selection']['table'])) { - $viewTable = str_replace('#__'.$this->fileContentStatic['###component###'].'_', '', $get['selection']['table']); + $viewTable = str_replace('#__' . $this->fileContentStatic['###component###'] . '_', '', $get['selection']['table']); } } - } } } @@ -4842,9 +4851,9 @@ class Interpretation extends Fields { // build view route switch $routerSwitch = array(); - - $routerSwitch[] = PHP_EOL."\t\t\tcase '".$view."':"; - $routerSwitch[] = "\t\t\t\t\$vars['view'] = '".$view."';"; + + $routerSwitch[] = PHP_EOL . "\t\t\tcase '" . $view . "':"; + $routerSwitch[] = "\t\t\t\t\$vars['view'] = '" . $view . "';"; $routerSwitch[] = "\t\t\t\tif (is_numeric(\$segments[\$count-1]))"; $routerSwitch[] = "\t\t\t\t{"; $routerSwitch[] = "\t\t\t\t\t\$vars['id'] = (int) \$segments[\$count-1];"; @@ -4854,11 +4863,11 @@ class Interpretation extends Fields // we need to get from the table of this views main get the alias so we need the table name if ($viewTable) { - $routerSwitch[] = "\t\t\t\t\t\$id = \$this->getVar('".$viewTable."', \$segments[\$count-1], 'alias', 'id'".$isCategory.");"; + $routerSwitch[] = "\t\t\t\t\t\$id = \$this->getVar('" . $viewTable . "', \$segments[\$count-1], 'alias', 'id'" . $isCategory . ");"; } else { - $routerSwitch[] = "\t\t\t\t\t\$id = \$this->getVar('".$view."', \$segments[\$count-1], 'alias', 'id'".$isCategory.");"; + $routerSwitch[] = "\t\t\t\t\t\$id = \$this->getVar('" . $view . "', \$segments[\$count-1], 'alias', 'id'" . $isCategory . ");"; } $routerSwitch[] = "\t\t\t\t\tif(\$id)"; $routerSwitch[] = "\t\t\t\t\t{"; @@ -4867,59 +4876,59 @@ class Interpretation extends Fields $routerSwitch[] = "\t\t\t\t}"; $routerSwitch[] = "\t\t\t\tbreak;"; - return implode(PHP_EOL,$routerSwitch); + return implode(PHP_EOL, $routerSwitch); } elseif ($idView) { // build view route switch $routerSwitch = array(); - - $routerSwitch[] = PHP_EOL."\t\t\tcase '".$view."':"; - $routerSwitch[] = "\t\t\t\t\$vars['view'] = '".$view."';"; + + $routerSwitch[] = PHP_EOL . "\t\t\tcase '" . $view . "':"; + $routerSwitch[] = "\t\t\t\t\$vars['view'] = '" . $view . "';"; $routerSwitch[] = "\t\t\t\tif (is_numeric(\$segments[\$count-1]))"; $routerSwitch[] = "\t\t\t\t{"; $routerSwitch[] = "\t\t\t\t\t\$vars['id'] = (int) \$segments[\$count-1];"; $routerSwitch[] = "\t\t\t\t}"; $routerSwitch[] = "\t\t\t\tbreak;"; - return implode(PHP_EOL,$routerSwitch); + return implode(PHP_EOL, $routerSwitch); } else { // build view route switch $routerSwitch = array(); - - $routerSwitch[] = PHP_EOL."\t\t\tcase '".$view."':"; - $routerSwitch[] = "\t\t\t\t\$vars['view'] = '".$view."';"; + + $routerSwitch[] = PHP_EOL . "\t\t\tcase '" . $view . "':"; + $routerSwitch[] = "\t\t\t\t\$vars['view'] = '" . $view . "';"; $routerSwitch[] = "\t\t\t\tbreak;"; - return implode(PHP_EOL,$routerSwitch); + return implode(PHP_EOL, $routerSwitch); } return ''; } - + public function routerBuildViews(&$view) { if (isset($this->fileContentStatic['###ROUTER_BUILD_VIEWS###']) && ComponentbuilderHelper::checkString($this->fileContentStatic['###ROUTER_BUILD_VIEWS###'])) { - return " || \$view === '".$view."'"; + return " || \$view === '" . $view . "'"; } else { - return "\$view === '".$view."'"; + return "\$view === '" . $view . "'"; } } public function setBatchMove($viewName_single) { // set needed defaults - $title = false; - $alias = false; - $category = false; - $batchmove = array(); - $VIEW = ComponentbuilderHelper::safeString($viewName_single, 'U'); + $title = false; + $alias = false; + $category = false; + $batchmove = array(); + $VIEW = ComponentbuilderHelper::safeString($viewName_single, 'U'); // component helper name - $Helper = $this->fileContentStatic['###Component###'].'Helper'; + $Helper = $this->fileContentStatic['###Component###'] . 'Helper'; // setup correct core target $coreLoad = false; if (isset($this->permissionCore[$viewName_single])) @@ -4930,22 +4939,22 @@ class Interpretation extends Fields // only load category if set in this view if (array_key_exists($viewName_single, $this->catCodeBuilder)) { - $category = $this->catCodeBuilder[$viewName_single]['code']; + $category = $this->catCodeBuilder[$viewName_single]['code']; } // only load alias if set in this view if (array_key_exists($viewName_single, $this->aliasBuilder)) { - $alias = $this->aliasBuilder[$viewName_single]; + $alias = $this->aliasBuilder[$viewName_single]; } // only load title if set in this view if (array_key_exists($viewName_single, $this->titleBuilder)) { - $title = $this->titleBuilder[$viewName_single]; + $title = $this->titleBuilder[$viewName_single]; } // prepare custom script - $customScript = $this->getCustomScriptBuilder('php_batchmove', $viewName_single, PHP_EOL.PHP_EOL, null, true); + $customScript = $this->getCustomScriptBuilder('php_batchmove', $viewName_single, PHP_EOL . PHP_EOL, null, true); - $batchmove[] = PHP_EOL."\t/**"; + $batchmove[] = PHP_EOL . "\t/**"; $batchmove[] = "\t * Batch move items to a new category"; $batchmove[] = "\t *"; $batchmove[] = "\t * @param integer \$value The new category ID."; @@ -4960,32 +4969,32 @@ class Interpretation extends Fields $batchmove[] = "\t{"; $batchmove[] = "\t\tif (empty(\$this->batchSet))"; $batchmove[] = "\t\t{"; - $batchmove[] = "\t\t\t//".$this->setLine(__LINE__)." Set some needed variables."; + $batchmove[] = "\t\t\t//" . $this->setLine(__LINE__) . " Set some needed variables."; $batchmove[] = "\t\t\t\$this->user = JFactory::getUser();"; $batchmove[] = "\t\t\t\$this->table = \$this->getTable();"; $batchmove[] = "\t\t\t\$this->tableClassName = get_class(\$this->table);"; $batchmove[] = "\t\t\t\$this->contentType = new JUcmType;"; $batchmove[] = "\t\t\t\$this->type = \$this->contentType->getTypeByTable(\$this->tableClassName);"; - $batchmove[] = "\t\t\t\$this->canDo = ".$Helper."::getActions('".$viewName_single."');"; + $batchmove[] = "\t\t\t\$this->canDo = " . $Helper . "::getActions('" . $viewName_single . "');"; $batchmove[] = "\t\t}"; - if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit']]) && in_array($viewName_single,$this->permissionBuilder['global'][$core['core.edit']])) + if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit']]) && in_array($viewName_single, $this->permissionBuilder['global'][$core['core.edit']])) { - $batchmove[] = PHP_EOL."\t\tif (!\$this->canDo->get('".$core['core.edit']."') && !\$this->canDo->get('".$core['core.batch']."'))"; + $batchmove[] = PHP_EOL . "\t\tif (!\$this->canDo->get('" . $core['core.edit'] . "') && !\$this->canDo->get('" . $core['core.batch'] . "'))"; } else { - $batchmove[] = PHP_EOL."\t\tif (!\$this->canDo->get('core.edit') && !\$this->canDo->get('core.batch'))"; + $batchmove[] = PHP_EOL . "\t\tif (!\$this->canDo->get('core.edit') && !\$this->canDo->get('core.batch'))"; } $batchmove[] = "\t\t{"; $batchmove[] = "\t\t\t\$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));"; $batchmove[] = "\t\t\treturn false;"; - $batchmove[] = "\t\t}".$customScript; + $batchmove[] = "\t\t}" . $customScript; - $batchmove[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." make sure published only updates if user has the permission."; - if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder['global'][$core['core.edit.state']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit.state']]) && in_array($viewName_single,$this->permissionBuilder['global'][$core['core.edit.state']])) + $batchmove[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " make sure published only updates if user has the permission."; + if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder['global'][$core['core.edit.state']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit.state']]) && in_array($viewName_single, $this->permissionBuilder['global'][$core['core.edit.state']])) { - $batchmove[] = "\t\tif (isset(\$values['published']) && !\$this->canDo->get('".$core['core.edit.state']."'))"; + $batchmove[] = "\t\tif (isset(\$values['published']) && !\$this->canDo->get('" . $core['core.edit.state'] . "'))"; } else { @@ -4995,33 +5004,33 @@ class Interpretation extends Fields $batchmove[] = "\t\t\tunset(\$values['published']);"; $batchmove[] = "\t\t}"; - $batchmove[] = "\t\t//".$this->setLine(__LINE__)." remove move_copy from array"; + $batchmove[] = "\t\t//" . $this->setLine(__LINE__) . " remove move_copy from array"; $batchmove[] = "\t\tunset(\$values['move_copy']);"; if ($category) { - $batchmove[] = PHP_EOL."\t\tif (isset(\$values['category']) && (int) \$values['category'] > 0 && !static::checkCategoryId(\$values['category']))"; + $batchmove[] = PHP_EOL . "\t\tif (isset(\$values['category']) && (int) \$values['category'] > 0 && !static::checkCategoryId(\$values['category']))"; $batchmove[] = "\t\t{"; $batchmove[] = "\t\t\treturn false;"; $batchmove[] = "\t\t}"; $batchmove[] = "\t\telseif (isset(\$values['category']) && (int) \$values['category'] > 0)"; $batchmove[] = "\t\t{"; - $batchmove[] = "\t\t\t//".$this->setLine(__LINE__)." move the category value to correct field name"; - $batchmove[] = "\t\t\t\$values['".$category."'] = \$values['category'];"; + $batchmove[] = "\t\t\t//" . $this->setLine(__LINE__) . " move the category value to correct field name"; + $batchmove[] = "\t\t\t\$values['" . $category . "'] = \$values['category'];"; $batchmove[] = "\t\t\tunset(\$values['category']);"; $batchmove[] = "\t\t}"; $batchmove[] = "\t\telseif (isset(\$values['category']))"; $batchmove[] = "\t\t{"; $batchmove[] = "\t\t\tunset(\$values['category']);"; - $batchmove[] = "\t\t}".PHP_EOL; + $batchmove[] = "\t\t}" . PHP_EOL; } - $batchmove[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Parent exists so we proceed"; + $batchmove[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Parent exists so we proceed"; $batchmove[] = "\t\tforeach (\$pks as \$pk)"; $batchmove[] = "\t\t{"; - if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder[$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder[$core['core.edit']]) && in_array($viewName_single,$this->permissionBuilder[$core['core.edit']])) + if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder[$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder[$core['core.edit']]) && in_array($viewName_single, $this->permissionBuilder[$core['core.edit']])) { - $batchmove[] = "\t\t\tif (!\$this->user->authorise('".$core['core.edit']."', \$contexts[\$pk]))"; + $batchmove[] = "\t\t\tif (!\$this->user->authorise('" . $core['core.edit'] . "', \$contexts[\$pk]))"; } else { @@ -5030,33 +5039,33 @@ class Interpretation extends Fields $batchmove[] = "\t\t\t{"; $batchmove[] = "\t\t\t\t\$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));"; - $batchmove[] = PHP_EOL."\t\t\t\treturn false;"; + $batchmove[] = PHP_EOL . "\t\t\t\treturn false;"; $batchmove[] = "\t\t\t}"; - $batchmove[] = PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Check that the row actually exists"; + $batchmove[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Check that the row actually exists"; $batchmove[] = "\t\t\tif (!\$this->table->load(\$pk))"; $batchmove[] = "\t\t\t{"; $batchmove[] = "\t\t\t\tif (\$error = \$this->table->getError())"; $batchmove[] = "\t\t\t\t{"; - $batchmove[] = "\t\t\t\t\t//".$this->setLine(__LINE__)." Fatal error"; + $batchmove[] = "\t\t\t\t\t//" . $this->setLine(__LINE__) . " Fatal error"; $batchmove[] = "\t\t\t\t\t\$this->setError(\$error);"; - $batchmove[] = PHP_EOL."\t\t\t\t\treturn false;"; + $batchmove[] = PHP_EOL . "\t\t\t\t\treturn false;"; $batchmove[] = "\t\t\t\t}"; $batchmove[] = "\t\t\t\telse"; $batchmove[] = "\t\t\t\t{"; - $batchmove[] = "\t\t\t\t\t//".$this->setLine(__LINE__)." Not fatal error"; + $batchmove[] = "\t\t\t\t\t//" . $this->setLine(__LINE__) . " Not fatal error"; $batchmove[] = "\t\t\t\t\t\$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', \$pk));"; $batchmove[] = "\t\t\t\t\tcontinue;"; $batchmove[] = "\t\t\t\t}"; $batchmove[] = "\t\t\t}"; - $batchmove[] = PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." insert all set values."; - $batchmove[] = "\t\t\tif (".$Helper."::checkArray(\$values))"; + $batchmove[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " insert all set values."; + $batchmove[] = "\t\t\tif (" . $Helper . "::checkArray(\$values))"; $batchmove[] = "\t\t\t{"; $batchmove[] = "\t\t\t\tforeach (\$values as \$key => \$value)"; $batchmove[] = "\t\t\t\t{"; - $batchmove[] = "\t\t\t\t\t//".$this->setLine(__LINE__)." Do special action for access."; + $batchmove[] = "\t\t\t\t\t//" . $this->setLine(__LINE__) . " Do special action for access."; $batchmove[] = "\t\t\t\t\tif ('access' === \$key && strlen(\$value) > 0)"; $batchmove[] = "\t\t\t\t\t{"; $batchmove[] = "\t\t\t\t\t\t\$this->table->\$key = \$value;"; @@ -5066,49 +5075,49 @@ class Interpretation extends Fields $batchmove[] = "\t\t\t\t\t\t\$this->table->\$key = \$value;"; $batchmove[] = "\t\t\t\t\t}"; $batchmove[] = "\t\t\t\t}"; - $batchmove[] = "\t\t\t}".PHP_EOL; + $batchmove[] = "\t\t\t}" . PHP_EOL; - $batchmove[] = PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Check the row."; + $batchmove[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Check the row."; $batchmove[] = "\t\t\tif (!\$this->table->check())"; $batchmove[] = "\t\t\t{"; $batchmove[] = "\t\t\t\t\$this->setError(\$this->table->getError());"; - $batchmove[] = PHP_EOL."\t\t\t\treturn false;"; + $batchmove[] = PHP_EOL . "\t\t\t\treturn false;"; $batchmove[] = "\t\t\t}"; - $batchmove[] = PHP_EOL."\t\t\tif (!empty(\$this->type))"; + $batchmove[] = PHP_EOL . "\t\t\tif (!empty(\$this->type))"; $batchmove[] = "\t\t\t{"; $batchmove[] = "\t\t\t\t\$this->createTagsHelper(\$this->tagsObserver, \$this->type, \$pk, \$this->typeAlias, \$this->table);"; $batchmove[] = "\t\t\t}"; - $batchmove[] = PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Store the row."; + $batchmove[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Store the row."; $batchmove[] = "\t\t\tif (!\$this->table->store())"; $batchmove[] = "\t\t\t{"; $batchmove[] = "\t\t\t\t\$this->setError(\$this->table->getError());"; - $batchmove[] = PHP_EOL."\t\t\t\treturn false;"; + $batchmove[] = PHP_EOL . "\t\t\t\treturn false;"; $batchmove[] = "\t\t\t}"; $batchmove[] = "\t\t}"; - $batchmove[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Clean the cache"; + $batchmove[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Clean the cache"; $batchmove[] = "\t\t\$this->cleanCache();"; - $batchmove[] = PHP_EOL."\t\treturn true;"; + $batchmove[] = PHP_EOL . "\t\treturn true;"; $batchmove[] = "\t}"; - return PHP_EOL.implode(PHP_EOL,$batchmove); + return PHP_EOL . implode(PHP_EOL, $batchmove); } public function setBatchCopy($viewName_single) { // set needed defaults - $title = false; - $alias = false; - $category = false; - $batchcopy = array(); - $VIEW = ComponentbuilderHelper::safeString($viewName_single, 'U'); + $title = false; + $alias = false; + $category = false; + $batchcopy = array(); + $VIEW = ComponentbuilderHelper::safeString($viewName_single, 'U'); // component helper name - $Helper = $this->fileContentStatic['###Component###'].'Helper'; + $Helper = $this->fileContentStatic['###Component###'] . 'Helper'; // setup correct core target $coreLoad = false; if (isset($this->permissionCore[$viewName_single])) @@ -5133,9 +5142,9 @@ class Interpretation extends Fields $title = $this->titleBuilder[$viewName_single]; } // prepare custom script - $customScript = $this->getCustomScriptBuilder('php_batchcopy', $viewName_single, PHP_EOL.PHP_EOL, null, true); + $customScript = $this->getCustomScriptBuilder('php_batchcopy', $viewName_single, PHP_EOL . PHP_EOL, null, true); - $batchcopy[] = PHP_EOL."\t/**"; + $batchcopy[] = PHP_EOL . "\t/**"; $batchcopy[] = "\t * Batch copy items to a new category or current."; $batchcopy[] = "\t *"; $batchcopy[] = "\t * @param integer \$values The new values."; @@ -5151,39 +5160,39 @@ class Interpretation extends Fields $batchcopy[] = "\t\tif (empty(\$this->batchSet))"; $batchcopy[] = "\t\t{"; - $batchcopy[] = "\t\t\t//".$this->setLine(__LINE__)." Set some needed variables."; + $batchcopy[] = "\t\t\t//" . $this->setLine(__LINE__) . " Set some needed variables."; $batchcopy[] = "\t\t\t\$this->user = JFactory::getUser();"; $batchcopy[] = "\t\t\t\$this->table = \$this->getTable();"; $batchcopy[] = "\t\t\t\$this->tableClassName = get_class(\$this->table);"; $batchcopy[] = "\t\t\t\$this->contentType = new JUcmType;"; $batchcopy[] = "\t\t\t\$this->type = \$this->contentType->getTypeByTable(\$this->tableClassName);"; - $batchcopy[] = "\t\t\t\$this->canDo = ".$Helper."::getActions('".$viewName_single."');"; + $batchcopy[] = "\t\t\t\$this->canDo = " . $Helper . "::getActions('" . $viewName_single . "');"; $batchcopy[] = "\t\t}"; - if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.create']]) && in_array($viewName_single,$this->permissionBuilder['global'][$core['core.create']])) + if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.create']]) && in_array($viewName_single, $this->permissionBuilder['global'][$core['core.create']])) { - $batchcopy[] = PHP_EOL."\t\tif (!\$this->canDo->get('".$core['core.create']."') && !\$this->canDo->get('".$core['core.batch']."'))"; + $batchcopy[] = PHP_EOL . "\t\tif (!\$this->canDo->get('" . $core['core.create'] . "') && !\$this->canDo->get('" . $core['core.batch'] . "'))"; } else { - $batchcopy[] = PHP_EOL."\t\tif (!\$this->canDo->get('core.create') || !\$this->canDo->get('core.batch'))"; + $batchcopy[] = PHP_EOL . "\t\tif (!\$this->canDo->get('core.create') || !\$this->canDo->get('core.batch'))"; } $batchcopy[] = "\t\t{"; $batchcopy[] = "\t\t\treturn false;"; - $batchcopy[] = "\t\t}".$customScript; + $batchcopy[] = "\t\t}" . $customScript; - $batchcopy[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." get list of uniqe fields"; + $batchcopy[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " get list of uniqe fields"; $batchcopy[] = "\t\t\$uniqeFields = \$this->getUniqeFields();"; - $batchcopy[] = "\t\t//".$this->setLine(__LINE__)." remove move_copy from array"; + $batchcopy[] = "\t\t//" . $this->setLine(__LINE__) . " remove move_copy from array"; $batchcopy[] = "\t\tunset(\$values['move_copy']);"; - $batchcopy[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." make sure published is set"; + $batchcopy[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " make sure published is set"; $batchcopy[] = "\t\tif (!isset(\$values['published']))"; $batchcopy[] = "\t\t{"; $batchcopy[] = "\t\t\t\$values['published'] = 0;"; $batchcopy[] = "\t\t}"; - if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder['global'][$core['core.edit.state']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit.state']]) && in_array($viewName_single,$this->permissionBuilder['global'][$core['core.edit.state']])) + if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder['global'][$core['core.edit.state']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit.state']]) && in_array($viewName_single, $this->permissionBuilder['global'][$core['core.edit.state']])) { - $batchcopy[] = "\t\telseif (isset(\$values['published']) && !\$this->canDo->get('".$core['core.edit.state']."'))"; + $batchcopy[] = "\t\telseif (isset(\$values['published']) && !\$this->canDo->get('" . $core['core.edit.state'] . "'))"; } else { @@ -5195,14 +5204,14 @@ class Interpretation extends Fields if ($category) { - $batchcopy[] = PHP_EOL."\t\tif (isset(\$values['category']) && (int) \$values['category'] > 0 && !static::checkCategoryId(\$values['category']))"; + $batchcopy[] = PHP_EOL . "\t\tif (isset(\$values['category']) && (int) \$values['category'] > 0 && !static::checkCategoryId(\$values['category']))"; $batchcopy[] = "\t\t{"; $batchcopy[] = "\t\t\treturn false;"; $batchcopy[] = "\t\t}"; $batchcopy[] = "\t\telseif (isset(\$values['category']) && (int) \$values['category'] > 0)"; $batchcopy[] = "\t\t{"; - $batchcopy[] = "\t\t\t//".$this->setLine(__LINE__)." move the category value to correct field name"; - $batchcopy[] = "\t\t\t\$values['".$category."'] = \$values['category'];"; + $batchcopy[] = "\t\t\t//" . $this->setLine(__LINE__) . " move the category value to correct field name"; + $batchcopy[] = "\t\t\t\$values['" . $category . "'] = \$values['category'];"; $batchcopy[] = "\t\t\tunset(\$values['category']);"; $batchcopy[] = "\t\t}"; $batchcopy[] = "\t\telseif (isset(\$values['category']))"; @@ -5211,81 +5220,81 @@ class Interpretation extends Fields $batchcopy[] = "\t\t}"; } - $batchcopy[] = PHP_EOL."\t\t\$newIds = array();"; + $batchcopy[] = PHP_EOL . "\t\t\$newIds = array();"; - $batchcopy[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Parent exists so let's proceed"; + $batchcopy[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Parent exists so let's proceed"; $batchcopy[] = "\t\twhile (!empty(\$pks))"; $batchcopy[] = "\t\t{"; - $batchcopy[] = "\t\t\t//".$this->setLine(__LINE__)." Pop the first ID off the stack"; + $batchcopy[] = "\t\t\t//" . $this->setLine(__LINE__) . " Pop the first ID off the stack"; $batchcopy[] = "\t\t\t\$pk = array_shift(\$pks);"; - $batchcopy[] = PHP_EOL."\t\t\t\$this->table->reset();"; + $batchcopy[] = PHP_EOL . "\t\t\t\$this->table->reset();"; - $batchcopy[] = PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." only allow copy if user may edit this item."; - if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder[$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder[$core['core.edit']]) && in_array($viewName_single,$this->permissionBuilder[$core['core.edit']])) + $batchcopy[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " only allow copy if user may edit this item."; + if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder[$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder[$core['core.edit']]) && in_array($viewName_single, $this->permissionBuilder[$core['core.edit']])) { - $batchcopy[] = PHP_EOL."\t\t\tif (!\$this->user->authorise('".$core['core.edit']."', \$contexts[\$pk]))"; + $batchcopy[] = PHP_EOL . "\t\t\tif (!\$this->user->authorise('" . $core['core.edit'] . "', \$contexts[\$pk]))"; } else { - $batchcopy[] = PHP_EOL."\t\t\tif (!\$this->user->authorise('core.edit', \$contexts[\$pk]))"; + $batchcopy[] = PHP_EOL . "\t\t\tif (!\$this->user->authorise('core.edit', \$contexts[\$pk]))"; } - $batchcopy[] = PHP_EOL."\t\t\t{"; - $batchcopy[] = PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Not fatal error"; - $batchcopy[] = PHP_EOL."\t\t\t\t\$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', \$pk));"; - $batchcopy[] = PHP_EOL."\t\t\t\tcontinue;"; - $batchcopy[] = PHP_EOL."\t\t\t}"; + $batchcopy[] = PHP_EOL . "\t\t\t{"; + $batchcopy[] = PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " Not fatal error"; + $batchcopy[] = PHP_EOL . "\t\t\t\t\$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', \$pk));"; + $batchcopy[] = PHP_EOL . "\t\t\t\tcontinue;"; + $batchcopy[] = PHP_EOL . "\t\t\t}"; - $batchcopy[] = PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Check that the row actually exists"; + $batchcopy[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Check that the row actually exists"; $batchcopy[] = "\t\t\tif (!\$this->table->load(\$pk))"; $batchcopy[] = "\t\t\t{"; $batchcopy[] = "\t\t\t\tif (\$error = \$this->table->getError())"; $batchcopy[] = "\t\t\t\t{"; - $batchcopy[] = "\t\t\t\t\t//".$this->setLine(__LINE__)." Fatal error"; + $batchcopy[] = "\t\t\t\t\t//" . $this->setLine(__LINE__) . " Fatal error"; $batchcopy[] = "\t\t\t\t\t\$this->setError(\$error);"; - $batchcopy[] = PHP_EOL."\t\t\t\t\treturn false;"; + $batchcopy[] = PHP_EOL . "\t\t\t\t\treturn false;"; $batchcopy[] = "\t\t\t\t}"; $batchcopy[] = "\t\t\t\telse"; $batchcopy[] = "\t\t\t\t{"; - $batchcopy[] = "\t\t\t\t\t//".$this->setLine(__LINE__)." Not fatal error"; + $batchcopy[] = "\t\t\t\t\t//" . $this->setLine(__LINE__) . " Not fatal error"; $batchcopy[] = "\t\t\t\t\t\$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', \$pk));"; $batchcopy[] = "\t\t\t\t\tcontinue;"; $batchcopy[] = "\t\t\t\t}"; $batchcopy[] = "\t\t\t}"; if ($category && $alias === 'alias' && $title === 'title') { - $batchcopy[] = PHP_EOL."\t\t\tif (isset(\$values['".$category."']))"; + $batchcopy[] = PHP_EOL . "\t\t\tif (isset(\$values['" . $category . "']))"; $batchcopy[] = "\t\t\t{"; - $batchcopy[] = "\t\t\t\tstatic::generateTitle((int) \$values['".$category."'], \$this->table);"; + $batchcopy[] = "\t\t\t\tstatic::generateTitle((int) \$values['" . $category . "'], \$this->table);"; $batchcopy[] = "\t\t\t}"; $batchcopy[] = "\t\t\telse"; $batchcopy[] = "\t\t\t{"; - $batchcopy[] = "\t\t\t\tstatic::generateTitle((int) \$this->table->".$category.", \$this->table);"; + $batchcopy[] = "\t\t\t\tstatic::generateTitle((int) \$this->table->" . $category . ", \$this->table);"; $batchcopy[] = "\t\t\t}"; } elseif ($category && $alias && $title) { - $batchcopy[] = PHP_EOL."\t\t\tif (isset(\$values['".$category."']))"; + $batchcopy[] = PHP_EOL . "\t\t\tif (isset(\$values['" . $category . "']))"; $batchcopy[] = "\t\t\t{"; - $batchcopy[] = "\t\t\t\tlist(\$this->table->".$title.", \$this->table->".$alias.") = \$this->generateNewTitle(\$values['".$category."'], \$this->table->".$alias.", \$this->table->".$title.");"; + $batchcopy[] = "\t\t\t\tlist(\$this->table->" . $title . ", \$this->table->" . $alias . ") = \$this->generateNewTitle(\$values['" . $category . "'], \$this->table->" . $alias . ", \$this->table->" . $title . ");"; $batchcopy[] = "\t\t\t}"; $batchcopy[] = "\t\t\telse"; $batchcopy[] = "\t\t\t{"; - $batchcopy[] = "\t\t\t\tlist(\$this->table->".$title.", \$this->table->".$alias.") = \$this->generateNewTitle(\$this->table->".$category.", \$this->table->".$alias.", \$this->table->".$title.");"; + $batchcopy[] = "\t\t\t\tlist(\$this->table->" . $title . ", \$this->table->" . $alias . ") = \$this->generateNewTitle(\$this->table->" . $category . ", \$this->table->" . $alias . ", \$this->table->" . $title . ");"; $batchcopy[] = "\t\t\t}"; } elseif (!$category && $alias && $title) { - $batchcopy[] = PHP_EOL."\t\t\tlist(\$this->table->".$title.", \$this->table->".$alias.") = \$this->_generateNewTitle(\$this->table->".$alias.", \$this->table->".$title.");"; + $batchcopy[] = PHP_EOL . "\t\t\tlist(\$this->table->" . $title . ", \$this->table->" . $alias . ") = \$this->_generateNewTitle(\$this->table->" . $alias . ", \$this->table->" . $title . ");"; } elseif (!$category && !$alias && $title && $title != 'user' && $title != 'jobnumber') // TODO [jobnumber] just for one project (not ideal) { - $batchcopy[] = PHP_EOL."\t\t\t\$this->table->".$title." = \$this->generateUniqe('".$title."',\$this->table->".$title.");"; + $batchcopy[] = PHP_EOL . "\t\t\t\$this->table->" . $title . " = \$this->generateUniqe('" . $title . "',\$this->table->" . $title . ");"; } - $batchcopy[] = PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." insert all set values"; - $batchcopy[] = "\t\t\tif (".$Helper."::checkArray(\$values))"; + $batchcopy[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " insert all set values"; + $batchcopy[] = "\t\t\tif (" . $Helper . "::checkArray(\$values))"; $batchcopy[] = "\t\t\t{"; $batchcopy[] = "\t\t\t\tforeach (\$values as \$key => \$value)"; $batchcopy[] = "\t\t\t\t{"; @@ -5294,10 +5303,10 @@ class Interpretation extends Fields $batchcopy[] = "\t\t\t\t\t\t\$this->table->\$key = \$value;"; $batchcopy[] = "\t\t\t\t\t}"; $batchcopy[] = "\t\t\t\t}"; - $batchcopy[] = "\t\t\t}".PHP_EOL; + $batchcopy[] = "\t\t\t}" . PHP_EOL; - $batchcopy[] = "\t\t\t//".$this->setLine(__LINE__)." update all uniqe fields"; - $batchcopy[] = "\t\t\tif (".$Helper."::checkArray(\$uniqeFields))"; + $batchcopy[] = "\t\t\t//" . $this->setLine(__LINE__) . " update all uniqe fields"; + $batchcopy[] = "\t\t\tif (" . $Helper . "::checkArray(\$uniqeFields))"; $batchcopy[] = "\t\t\t{"; $batchcopy[] = "\t\t\t\tforeach (\$uniqeFields as \$uniqeField)"; $batchcopy[] = "\t\t\t\t{"; @@ -5305,47 +5314,47 @@ class Interpretation extends Fields $batchcopy[] = "\t\t\t\t}"; $batchcopy[] = "\t\t\t}"; - $batchcopy[] = PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Reset the ID because we are making a copy"; + $batchcopy[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Reset the ID because we are making a copy"; $batchcopy[] = "\t\t\t\$this->table->id = 0;"; - $batchcopy[] = PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." TODO: Deal with ordering?"; - $batchcopy[] = "\t\t\t//".$this->setLine(__LINE__)." \$this->table->ordering\t= 1;"; + $batchcopy[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " TODO: Deal with ordering?"; + $batchcopy[] = "\t\t\t//" . $this->setLine(__LINE__) . " \$this->table->ordering\t= 1;"; - $batchcopy[] = PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Check the row."; + $batchcopy[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Check the row."; $batchcopy[] = "\t\t\tif (!\$this->table->check())"; $batchcopy[] = "\t\t\t{"; $batchcopy[] = "\t\t\t\t\$this->setError(\$this->table->getError());"; - $batchcopy[] = PHP_EOL."\t\t\t\treturn false;"; + $batchcopy[] = PHP_EOL . "\t\t\t\treturn false;"; $batchcopy[] = "\t\t\t}"; - $batchcopy[] = PHP_EOL."\t\t\tif (!empty(\$this->type))"; + $batchcopy[] = PHP_EOL . "\t\t\tif (!empty(\$this->type))"; $batchcopy[] = "\t\t\t{"; $batchcopy[] = "\t\t\t\t\$this->createTagsHelper(\$this->tagsObserver, \$this->type, \$pk, \$this->typeAlias, \$this->table);"; $batchcopy[] = "\t\t\t}"; - $batchcopy[] = PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Store the row."; + $batchcopy[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Store the row."; $batchcopy[] = "\t\t\tif (!\$this->table->store())"; $batchcopy[] = "\t\t\t{"; $batchcopy[] = "\t\t\t\t\$this->setError(\$this->table->getError());"; - $batchcopy[] = PHP_EOL."\t\t\t\treturn false;"; + $batchcopy[] = PHP_EOL . "\t\t\t\treturn false;"; $batchcopy[] = "\t\t\t}"; - $batchcopy[] = PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Get the new item ID"; + $batchcopy[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the new item ID"; $batchcopy[] = "\t\t\t\$newId = \$this->table->get('id');"; - $batchcopy[] = PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Add the new ID to the array"; + $batchcopy[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Add the new ID to the array"; $batchcopy[] = "\t\t\t\$newIds[\$pk] = \$newId;"; $batchcopy[] = "\t\t}"; - $batchcopy[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Clean the cache"; + $batchcopy[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Clean the cache"; $batchcopy[] = "\t\t\$this->cleanCache();"; - $batchcopy[] = PHP_EOL."\t\treturn \$newIds;"; + $batchcopy[] = PHP_EOL . "\t\treturn \$newIds;"; $batchcopy[] = "\t}"; - return PHP_EOL.implode(PHP_EOL,$batchcopy); + return PHP_EOL . implode(PHP_EOL, $batchcopy); } public function setAliasTitleFix($viewName_single) @@ -5355,75 +5364,75 @@ class Interpretation extends Fields if (array_key_exists($viewName_single, $this->aliasBuilder) && array_key_exists($viewName_single, $this->titleBuilder)) { // set needed defaults - $setCategory = false; - $alias = $this->aliasBuilder[$viewName_single]; - $title = $this->titleBuilder[$viewName_single]; - $VIEW = ComponentbuilderHelper::safeString($viewName_single, 'U'); + $setCategory = false; + $alias = $this->aliasBuilder[$viewName_single]; + $title = $this->titleBuilder[$viewName_single]; + $VIEW = ComponentbuilderHelper::safeString($viewName_single, 'U'); if (array_key_exists($viewName_single, $this->catCodeBuilder)) { - $category = $this->catCodeBuilder[$viewName_single]['code']; - $setCategory = true; + $category = $this->catCodeBuilder[$viewName_single]['code']; + $setCategory = true; } // start building the fix - $fixUniqe[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Alter the ".$title." for save as copy"; + $fixUniqe[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Alter the " . $title . " for save as copy"; $fixUniqe[] = "\t\tif (\$input->get('task') === 'save2copy')"; $fixUniqe[] = "\t\t{"; $fixUniqe[] = "\t\t\t\$origTable = clone \$this->getTable();"; $fixUniqe[] = "\t\t\t\$origTable->load(\$input->getInt('id'));"; - $fixUniqe[] = PHP_EOL."\t\t\tif (\$data['".$title."'] == \$origTable->".$title.")"; + $fixUniqe[] = PHP_EOL . "\t\t\tif (\$data['" . $title . "'] == \$origTable->" . $title . ")"; $fixUniqe[] = "\t\t\t{"; if ($setCategory) { - $fixUniqe[] = "\t\t\t\tlist(\$".$title.", \$".$alias.") = \$this->generateNewTitle(\$data['".$category."'], \$data['".$alias."'], \$data['".$title."']);"; + $fixUniqe[] = "\t\t\t\tlist(\$" . $title . ", \$" . $alias . ") = \$this->generateNewTitle(\$data['" . $category . "'], \$data['" . $alias . "'], \$data['" . $title . "']);"; } else { - $fixUniqe[] = "\t\t\t\tlist(\$".$title.", \$".$alias.") = \$this->_generateNewTitle(\$data['".$alias."'], \$data['".$title."']);"; + $fixUniqe[] = "\t\t\t\tlist(\$" . $title . ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['" . $alias . "'], \$data['" . $title . "']);"; } - $fixUniqe[] = "\t\t\t\t\$data['".$title."'] = \$".$title.";"; - $fixUniqe[] = "\t\t\t\t\$data['".$alias."'] = \$".$alias.";"; + $fixUniqe[] = "\t\t\t\t\$data['" . $title . "'] = \$" . $title . ";"; + $fixUniqe[] = "\t\t\t\t\$data['" . $alias . "'] = \$" . $alias . ";"; $fixUniqe[] = "\t\t\t}"; $fixUniqe[] = "\t\t\telse"; $fixUniqe[] = "\t\t\t{"; - $fixUniqe[] = "\t\t\t\tif (\$data['".$alias."'] == \$origTable->".$alias.")"; + $fixUniqe[] = "\t\t\t\tif (\$data['" . $alias . "'] == \$origTable->" . $alias . ")"; $fixUniqe[] = "\t\t\t\t{"; - $fixUniqe[] = "\t\t\t\t\t\$data['".$alias."'] = '';"; + $fixUniqe[] = "\t\t\t\t\t\$data['" . $alias . "'] = '';"; $fixUniqe[] = "\t\t\t\t}"; $fixUniqe[] = "\t\t\t}"; - $fixUniqe[] = PHP_EOL."\t\t\t\$data['published'] = 0;"; + $fixUniqe[] = PHP_EOL . "\t\t\t\$data['published'] = 0;"; $fixUniqe[] = "\t\t}"; - $fixUniqe[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Automatic handling of ".$alias." for empty fields"; + $fixUniqe[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Automatic handling of " . $alias . " for empty fields"; $fixUniqe[] = "\t\tif (in_array(\$input->get('task'), array('apply', 'save', 'save2new')) && (int) \$input->get('id') == 0)"; $fixUniqe[] = "\t\t{"; - $fixUniqe[] = "\t\t\tif (\$data['".$alias."'] == null)"; + $fixUniqe[] = "\t\t\tif (\$data['" . $alias . "'] == null)"; $fixUniqe[] = "\t\t\t{"; $fixUniqe[] = "\t\t\t\tif (JFactory::getConfig()->get('unicodeslugs') == 1)"; $fixUniqe[] = "\t\t\t\t{"; - $fixUniqe[] = "\t\t\t\t\t\$data['".$alias."'] = JFilterOutput::stringURLUnicodeSlug(\$data['".$title."']);"; + $fixUniqe[] = "\t\t\t\t\t\$data['" . $alias . "'] = JFilterOutput::stringURLUnicodeSlug(\$data['" . $title . "']);"; $fixUniqe[] = "\t\t\t\t}"; $fixUniqe[] = "\t\t\t\telse"; $fixUniqe[] = "\t\t\t\t{"; - $fixUniqe[] = "\t\t\t\t\t\$data['".$alias."'] = JFilterOutput::stringURLSafe(\$data['".$title."']);"; + $fixUniqe[] = "\t\t\t\t\t\$data['" . $alias . "'] = JFilterOutput::stringURLSafe(\$data['" . $title . "']);"; $fixUniqe[] = "\t\t\t\t}"; - $fixUniqe[] = PHP_EOL."\t\t\t\t\$table = JTable::getInstance('".$viewName_single."', '".$this->fileContentStatic['###component###']."Table');"; + $fixUniqe[] = PHP_EOL . "\t\t\t\t\$table = JTable::getInstance('" . $viewName_single . "', '" . $this->fileContentStatic['###component###'] . "Table');"; if ($setCategory) { - $fixUniqe[] = PHP_EOL."\t\t\t\tif (\$table->load(array('".$alias."' => \$data['".$alias."'], '".$category."' => \$data['".$category."'])) && (\$table->id != \$data['id'] || \$data['id'] == 0))"; + $fixUniqe[] = PHP_EOL . "\t\t\t\tif (\$table->load(array('" . $alias . "' => \$data['" . $alias . "'], '" . $category . "' => \$data['" . $category . "'])) && (\$table->id != \$data['id'] || \$data['id'] == 0))"; $fixUniqe[] = "\t\t\t\t{"; - $fixUniqe[] = "\t\t\t\t\t\$msg = JText::_('COM_".$this->fileContentStatic['###COMPONENT###']."_".$VIEW."_SAVE_WARNING');"; + $fixUniqe[] = "\t\t\t\t\t\$msg = JText::_('COM_" . $this->fileContentStatic['###COMPONENT###'] . "_" . $VIEW . "_SAVE_WARNING');"; $fixUniqe[] = "\t\t\t\t}"; - $fixUniqe[] = PHP_EOL."\t\t\t\tlist(\$".$title.", \$".$alias.") = \$this->generateNewTitle(\$data['".$category."'], \$data['".$alias."'], \$data['".$title."']);"; + $fixUniqe[] = PHP_EOL . "\t\t\t\tlist(\$" . $title . ", \$" . $alias . ") = \$this->generateNewTitle(\$data['" . $category . "'], \$data['" . $alias . "'], \$data['" . $title . "']);"; } else { - $fixUniqe[] = PHP_EOL."\t\t\t\tif (\$table->load(array('".$alias."' => \$data['".$alias."'])) && (\$table->id != \$data['id'] || \$data['id'] == 0))"; + $fixUniqe[] = PHP_EOL . "\t\t\t\tif (\$table->load(array('" . $alias . "' => \$data['" . $alias . "'])) && (\$table->id != \$data['id'] || \$data['id'] == 0))"; $fixUniqe[] = "\t\t\t\t{"; - $fixUniqe[] = "\t\t\t\t\t\$msg = JText::_('COM_".$this->fileContentStatic['###COMPONENT###']."_".$VIEW."_SAVE_WARNING');"; + $fixUniqe[] = "\t\t\t\t\t\$msg = JText::_('COM_" . $this->fileContentStatic['###COMPONENT###'] . "_" . $VIEW . "_SAVE_WARNING');"; $fixUniqe[] = "\t\t\t\t}"; - $fixUniqe[] = PHP_EOL."\t\t\t\tlist(\$".$title.", \$".$alias.") = \$this->_generateNewTitle(\$data['".$alias."'], \$data['".$title."']);"; + $fixUniqe[] = PHP_EOL . "\t\t\t\tlist(\$" . $title . ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['" . $alias . "'], \$data['" . $title . "']);"; } - $fixUniqe[] = "\t\t\t\t\$data['".$alias."'] = \$".$alias.";"; - $fixUniqe[] = PHP_EOL."\t\t\t\tif (isset(\$msg))"; + $fixUniqe[] = "\t\t\t\t\$data['" . $alias . "'] = \$" . $alias . ";"; + $fixUniqe[] = PHP_EOL . "\t\t\t\tif (isset(\$msg))"; $fixUniqe[] = "\t\t\t\t{"; $fixUniqe[] = "\t\t\t\t\tJFactory::getApplication()->enqueueMessage(\$msg, 'warning');"; $fixUniqe[] = "\t\t\t\t}"; @@ -5431,12 +5440,12 @@ class Interpretation extends Fields $fixUniqe[] = "\t\t}"; } // handel other uniqe fields - $fixUniqe[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Alter the uniqe field for save as copy"; + $fixUniqe[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Alter the uniqe field for save as copy"; $fixUniqe[] = "\t\tif (\$input->get('task') === 'save2copy')"; $fixUniqe[] = "\t\t{"; - $fixUniqe[] = "\t\t\t//".$this->setLine(__LINE__)." Automatic handling of other uniqe fields"; + $fixUniqe[] = "\t\t\t//" . $this->setLine(__LINE__) . " Automatic handling of other uniqe fields"; $fixUniqe[] = "\t\t\t\$uniqeFields = \$this->getUniqeFields();"; - $fixUniqe[] = "\t\t\tif (".$this->fileContentStatic['###Component###']."Helper::checkArray(\$uniqeFields))"; + $fixUniqe[] = "\t\t\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$uniqeFields))"; $fixUniqe[] = "\t\t\t{"; $fixUniqe[] = "\t\t\t\tforeach (\$uniqeFields as \$uniqeField)"; $fixUniqe[] = "\t\t\t\t{"; @@ -5445,7 +5454,7 @@ class Interpretation extends Fields $fixUniqe[] = "\t\t\t}"; $fixUniqe[] = "\t\t}"; - return PHP_EOL.implode(PHP_EOL,$fixUniqe); + return PHP_EOL . implode(PHP_EOL, $fixUniqe); } public function setGenerateNewTitle($viewName_single) @@ -5454,50 +5463,50 @@ class Interpretation extends Fields if (array_key_exists($viewName_single, $this->aliasBuilder) && array_key_exists($viewName_single, $this->titleBuilder)) { $newFunction = array(); - $newFunction[] = PHP_EOL.PHP_EOL."\t/**"; + $newFunction[] = PHP_EOL . PHP_EOL . "\t/**"; $newFunction[] = "\t* Method to change the title & alias."; $newFunction[] = "\t*"; $newFunction[] = "\t* @param string \$alias The alias."; $newFunction[] = "\t* @param string \$title The title."; - $newFunction[] = "\t*"; - $newFunction[] = "\t* @return array Contains the modified title and alias."; - $newFunction[] = "\t*"; + $newFunction[] = "\t*"; + $newFunction[] = "\t* @return array Contains the modified title and alias."; + $newFunction[] = "\t*"; $newFunction[] = "\t*/"; $newFunction[] = "\tprotected function _generateNewTitle(\$alias, \$title)"; $newFunction[] = "\t{"; - $newFunction[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Alter the title & alias"; + $newFunction[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Alter the title & alias"; $newFunction[] = "\t\t\$table = \$this->getTable();"; - $newFunction[] = PHP_EOL."\t\twhile (\$table->load(array('alias' => \$alias)))"; + $newFunction[] = PHP_EOL . "\t\twhile (\$table->load(array('alias' => \$alias)))"; $newFunction[] = "\t\t{"; $newFunction[] = "\t\t\t\$title = JString::increment(\$title);"; $newFunction[] = "\t\t\t\$alias = JString::increment(\$alias, 'dash');"; $newFunction[] = "\t\t}"; - $newFunction[] = PHP_EOL."\t\treturn array(\$title, \$alias);"; + $newFunction[] = PHP_EOL . "\t\treturn array(\$title, \$alias);"; $newFunction[] = "\t}"; - return implode(PHP_EOL,$newFunction); + return implode(PHP_EOL, $newFunction); } elseif (array_key_exists($viewName_single, $this->titleBuilder)) { $newFunction = array(); - $newFunction[] = PHP_EOL.PHP_EOL."\t/**"; + $newFunction[] = PHP_EOL . PHP_EOL . "\t/**"; $newFunction[] = "\t* Method to change the title & alias."; $newFunction[] = "\t*"; $newFunction[] = "\t* @param string \$title The title."; - $newFunction[] = "\t*"; - $newFunction[] = "\t* @return array Contains the modified title and alias."; - $newFunction[] = "\t*"; + $newFunction[] = "\t*"; + $newFunction[] = "\t* @return array Contains the modified title and alias."; + $newFunction[] = "\t*"; $newFunction[] = "\t*/"; $newFunction[] = "\tprotected function _generateNewTitle(\$title)"; $newFunction[] = "\t{"; - $newFunction[] = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Alter the title"; + $newFunction[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Alter the title"; $newFunction[] = "\t\t\$table = \$this->getTable();"; - $newFunction[] = PHP_EOL."\t\twhile (\$table->load(array('title' => \$title)))"; + $newFunction[] = PHP_EOL . "\t\twhile (\$table->load(array('title' => \$title)))"; $newFunction[] = "\t\t{"; $newFunction[] = "\t\t\t\$title = JString::increment(\$title);"; $newFunction[] = "\t\t}"; - $newFunction[] = PHP_EOL."\t\treturn \$title;"; + $newFunction[] = PHP_EOL . "\t\treturn \$title;"; $newFunction[] = "\t}"; - return implode(PHP_EOL,$newFunction); + return implode(PHP_EOL, $newFunction); } return ''; } @@ -5514,31 +5523,30 @@ class Interpretation extends Fields foreach ($this->queryBuilder as $view => $fields) { // build the uninstall array - $this->uninstallBuilder[] = "DROP TABLE IF EXISTS `#__".$component."_".$view."`;"; + $this->uninstallBuilder[] = "DROP TABLE IF EXISTS `#__" . $component . "_" . $view . "`;"; // setup the table DB string $db_ = ''; - $db_ .= "CREATE TABLE IF NOT EXISTS `#__".$component."_".$view."` ("; + $db_ .= "CREATE TABLE IF NOT EXISTS `#__" . $component . "_" . $view . "` ("; // check if the table name has changed if (isset($this->updateSQL['table_name']) && isset($this->updateSQL['table_name'][$view])) { $old_table_name = $this->updateSQL['table_name'][$view]['old']; - $this->updateSQLBuilder["RENAMETABLE`#__".$component."_".$old_table_name."`"] - = "RENAME TABLE `#__".$component."_".$old_table_name."` to `#__".$component."_".$view."`;"; + $this->updateSQLBuilder["RENAMETABLE`#__" . $component . "_" . $old_table_name . "`"] = "RENAME TABLE `#__" . $component . "_" . $old_table_name . "` to `#__" . $component . "_" . $view . "`;"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['id'])) { - $db_ .= PHP_EOL."\t`id` INT(11) NOT NULL AUTO_INCREMENT,"; + $db_ .= PHP_EOL . "\t`id` INT(11) NOT NULL AUTO_INCREMENT,"; } - $db_ .= PHP_EOL."\t`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',"; + $db_ .= PHP_EOL . "\t`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',"; ksort($fields); $last_name = 'asset_id'; foreach ($fields as $field => $data) { // set default $default = $data['default']; - if ( $default === 'Other' ) + if ($default === 'Other') { $default = $data['other']; } @@ -5548,17 +5556,17 @@ class Interpretation extends Fields } elseif ($default === 'DATETIME' || $default === 'CURRENT_TIMESTAMP') { - $default = $default.' '.$data['null_switch']; + $default = $default . ' ' . $data['null_switch']; } elseif ($default == 0 || $default) { if (is_numeric($default)) { - $default = $data['null_switch']." DEFAULT ".$default; + $default = $data['null_switch'] . " DEFAULT " . $default; } else { - $default = $data['null_switch']." DEFAULT '".$default."'"; + $default = $data['null_switch'] . " DEFAULT '" . $default . "'"; } } elseif ($data['null_switch'] === 'NULL') @@ -5567,27 +5575,24 @@ class Interpretation extends Fields } else { - $default = $data['null_switch']." DEFAULT ''"; + $default = $data['null_switch'] . " DEFAULT ''"; } // set the lenght $lenght = ''; if (isset($data['lenght']) && $data['lenght'] === 'Other' && isset($data['lenght_other']) && $data['lenght_other'] > 0) { - $lenght = '('.$data['lenght_other'].')'; + $lenght = '(' . $data['lenght_other'] . ')'; } elseif (isset($data['lenght']) && $data['lenght'] > 0) { - $lenght = '('.$data['lenght'].')'; + $lenght = '(' . $data['lenght'] . ')'; } // set the field to db - $db_ .= PHP_EOL."\t`".$field."` ".$data['type'].$lenght." ".$default.","; + $db_ .= PHP_EOL . "\t`" . $field . "` " . $data['type'] . $lenght . " " . $default . ","; // check if this a new field that should be added via SQL update - if (isset($this->addSQL['field']) && isset($this->addSQL['field'][$view]) - && ComponentbuilderHelper::checkArray($this->addSQL['field'][$view]) - && in_array($data['ID'], $this->addSQL['field'][$view])) + if (isset($this->addSQL['field']) && isset($this->addSQL['field'][$view]) && ComponentbuilderHelper::checkArray($this->addSQL['field'][$view]) && in_array($data['ID'], $this->addSQL['field'][$view])) { - $this->updateSQLBuilder["ALTERTABLE`#__".$component."_".$view."`ADD`".$field."`"] - = "ALTER TABLE `#__".$component."_".$view."` ADD `".$field."` ".$data['type'].$lenght." ".$default." AFTER `".$last_name."`;"; + $this->updateSQLBuilder["ALTERTABLE`#__" . $component . "_" . $view . "`ADD`" . $field . "`"] = "ALTER TABLE `#__" . $component . "_" . $view . "` ADD `" . $field . "` " . $data['type'] . $lenght . " " . $default . " AFTER `" . $last_name . "`;"; } // check if the field has changed name and/or data type and lenght elseif (0) @@ -5600,122 +5605,121 @@ class Interpretation extends Fields // check if default field was over written if (!isset($this->fieldsNames[$view]['params'])) { - $db_ .= PHP_EOL."\t`params` text NOT NULL DEFAULT '',"; + $db_ .= PHP_EOL . "\t`params` text NOT NULL DEFAULT '',"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['published'])) { - $db_ .= PHP_EOL."\t`published` TINYINT(3) NOT NULL DEFAULT 1,"; + $db_ .= PHP_EOL . "\t`published` TINYINT(3) NOT NULL DEFAULT 1,"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['created_by'])) { - $db_ .= PHP_EOL."\t`created_by` INT(10) unsigned NOT NULL DEFAULT 0,"; + $db_ .= PHP_EOL . "\t`created_by` INT(10) unsigned NOT NULL DEFAULT 0,"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['modified_by'])) { - $db_ .= PHP_EOL."\t`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,"; + $db_ .= PHP_EOL . "\t`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['created'])) { - $db_ .= PHP_EOL."\t`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',"; + $db_ .= PHP_EOL . "\t`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['modified'])) { - $db_ .= PHP_EOL."\t`modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',"; + $db_ .= PHP_EOL . "\t`modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['checked_out'])) { - $db_ .= PHP_EOL."\t`checked_out` int(11) unsigned NOT NULL DEFAULT 0,"; + $db_ .= PHP_EOL . "\t`checked_out` int(11) unsigned NOT NULL DEFAULT 0,"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['checked_out_time'])) { - $db_ .= PHP_EOL."\t`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',"; + $db_ .= PHP_EOL . "\t`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['version'])) { - $db_ .= PHP_EOL."\t`version` INT(10) unsigned NOT NULL DEFAULT 1,"; + $db_ .= PHP_EOL . "\t`version` INT(10) unsigned NOT NULL DEFAULT 1,"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['hits'])) { - $db_ .= PHP_EOL."\t`hits` INT(10) unsigned NOT NULL DEFAULT 0,"; + $db_ .= PHP_EOL . "\t`hits` INT(10) unsigned NOT NULL DEFAULT 0,"; } // check if view has access if (isset($this->accessBuilder[$view]) && ComponentbuilderHelper::checkString($this->accessBuilder[$view])) { - $db_ .= PHP_EOL."\t`access` INT(10) unsigned NOT NULL DEFAULT 0,"; + $db_ .= PHP_EOL . "\t`access` INT(10) unsigned NOT NULL DEFAULT 0,"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['ordering'])) { - $db_ .= PHP_EOL."\t`ordering` INT(11) NOT NULL DEFAULT 0,"; + $db_ .= PHP_EOL . "\t`ordering` INT(11) NOT NULL DEFAULT 0,"; } // check if metadata is added to this view if (isset($this->metadataBuilder[$view]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$view])) { - $db_ .= PHP_EOL."\t`metakey` TEXT NOT NULL DEFAULT '',"; - $db_ .= PHP_EOL."\t`metadesc` TEXT NOT NULL DEFAULT '',"; - $db_ .= PHP_EOL."\t`metadata` TEXT NOT NULL DEFAULT '',"; + $db_ .= PHP_EOL . "\t`metakey` TEXT NOT NULL DEFAULT '',"; + $db_ .= PHP_EOL . "\t`metadesc` TEXT NOT NULL DEFAULT '',"; + $db_ .= PHP_EOL . "\t`metadata` TEXT NOT NULL DEFAULT '',"; } - $db_ .= PHP_EOL."\tPRIMARY KEY (`id`)"; + $db_ .= PHP_EOL . "\tPRIMARY KEY (`id`)"; if (isset($this->dbUniqueKeys[$view]) && ComponentbuilderHelper::checkArray($this->dbUniqueKeys[$view])) { foreach ($this->dbUniqueKeys[$view] as $nr => $key) { - $db_ .= ",".PHP_EOL."\tUNIQUE KEY `idx_".$key."` (`".$key."`)"; + $db_ .= "," . PHP_EOL . "\tUNIQUE KEY `idx_" . $key . "` (`" . $key . "`)"; } } // check if view has access if (isset($this->accessBuilder[$view]) && ComponentbuilderHelper::checkString($this->accessBuilder[$view])) { - $db_ .= ",".PHP_EOL."\tKEY `idx_access` (`access`)"; + $db_ .= "," . PHP_EOL . "\tKEY `idx_access` (`access`)"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['checked_out'])) { - $db_ .= ",".PHP_EOL."\tKEY `idx_checkout` (`checked_out`)"; + $db_ .= "," . PHP_EOL . "\tKEY `idx_checkout` (`checked_out`)"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['created_by'])) { - $db_ .= ",".PHP_EOL."\tKEY `idx_createdby` (`created_by`)"; + $db_ .= "," . PHP_EOL . "\tKEY `idx_createdby` (`created_by`)"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['modified_by'])) { - $db_ .= ",".PHP_EOL."\tKEY `idx_modifiedby` (`modified_by`)"; + $db_ .= "," . PHP_EOL . "\tKEY `idx_modifiedby` (`modified_by`)"; } // check if default field was over written if (!isset($this->fieldsNames[$view]['published'])) { - $db_ .= ",".PHP_EOL."\tKEY `idx_state` (`published`)"; + $db_ .= "," . PHP_EOL . "\tKEY `idx_state` (`published`)"; } if (isset($this->dbKeys[$view]) && ComponentbuilderHelper::checkArray($this->dbKeys[$view])) { foreach ($this->dbKeys[$view] as $nr => $key) { - $db_ .= ",".PHP_EOL."\tKEY `idx_".$key."` (`".$key."`)"; + $db_ .= "," . PHP_EOL . "\tKEY `idx_" . $key . "` (`" . $key . "`)"; } } - $db_ .= PHP_EOL.") ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;"; - + $db_ .= PHP_EOL . ") ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;"; + // check if this is a new table that should be added via update SQL - if (isset($this->addSQL['adminview']) && ComponentbuilderHelper::checkArray($this->addSQL['adminview']) - && in_array($view, $this->addSQL['adminview'])) + if (isset($this->addSQL['adminview']) && ComponentbuilderHelper::checkArray($this->addSQL['adminview']) && in_array($view, $this->addSQL['adminview'])) { // build the update array - $this->updateSQLBuilder["CREATETABLEIFNOTEXISTS`#__".$component."_".$view."`"] = $db_; + $this->updateSQLBuilder["CREATETABLEIFNOTEXISTS`#__" . $component . "_" . $view . "`"] = $db_; } - + // add to main DB string - $db .= $db_.PHP_EOL.PHP_EOL; + $db .= $db_ . PHP_EOL . PHP_EOL; } // add custom sql dump to the file if (isset($this->customScriptBuilder['sql']) && ComponentbuilderHelper::checkArray($this->customScriptBuilder['sql'])) @@ -5723,9 +5727,8 @@ class Interpretation extends Fields foreach ($this->customScriptBuilder['sql'] as $for => $customSql) { $placeholders = array('[[[component]]]' => $component, '[[[view]]]' => $for); - $db .= $this->setPlaceholders($customSql, $placeholders).PHP_EOL.PHP_EOL; + $db .= $this->setPlaceholders($customSql, $placeholders) . PHP_EOL . PHP_EOL; } - } return $db; } @@ -5739,7 +5742,7 @@ class Interpretation extends Fields $bd = ''; foreach ($this->uninstallBuilder as $line) { - $bd .= $line.PHP_EOL; + $bd .= $line . PHP_EOL; } return $bd; } @@ -5750,75 +5753,75 @@ class Interpretation extends Fields { // add final list of needed lang strings $componentName = JFilterOutput::cleanText($this->componentData->name); - $this->langContent['adminsys'][$this->langPrefix] = $componentName; - $this->langContent['adminsys'][$this->langPrefix.'_CONFIGURATION'] = $componentName.' Configuration'; - $this->langContent[$this->lang][$this->langPrefix] = $componentName; - $this->langContent['admin'][$this->langPrefix.'_BACK'] = 'Back'; - $this->langContent['admin'][$this->langPrefix.'_DASH'] = 'Dashboard'; - $this->langContent['admin'][$this->langPrefix.'_VERSION'] = 'Version'; - $this->langContent['admin'][$this->langPrefix.'_DATE'] = 'Date'; - $this->langContent['admin'][$this->langPrefix.'_AUTHOR'] = 'Author'; - $this->langContent['admin'][$this->langPrefix.'_WEBSITE'] = 'Website'; - $this->langContent['admin'][$this->langPrefix.'_LICENSE'] = 'License'; - $this->langContent['admin'][$this->langPrefix.'_CONTRIBUTORS'] = 'Contributors'; - $this->langContent['admin'][$this->langPrefix.'_CONTRIBUTOR'] = 'Contributor'; - $this->langContent['admin'][$this->langPrefix.'_DASHBOARD'] = $componentName.' Dashboard'; - $this->langContent['admin'][$this->langPrefix.'_SAVE_SUCCESS'] = "Great! Item successfully saved."; - $this->langContent['admin'][$this->langPrefix.'_SAVE_WARNING'] = "The value already existed so please select another."; - $this->langContent['admin'][$this->langPrefix.'_HELP_MANAGER'] = "Help"; - $this->langContent['admin'][$this->langPrefix.'_NEW'] = "New"; - $this->langContent['admin'][$this->langPrefix.'_CLOSE_NEW'] = "Close & New"; - $this->langContent['admin'][$this->langPrefix.'_CREATE_NEW_S'] = "Create New %s"; - $this->langContent['admin'][$this->langPrefix.'_EDIT_S'] = "Edit %s"; - $this->langContent['admin'][$this->langPrefix.'_KEEP_ORIGINAL_STATE'] = "- Keep Original State -"; - $this->langContent['admin'][$this->langPrefix.'_KEEP_ORIGINAL_ACCESS'] = "- Keep Original Access -"; - $this->langContent['admin'][$this->langPrefix.'_KEEP_ORIGINAL_CATEGORY'] = "- Keep Original Category -"; - $this->langContent['admin'][$this->langPrefix.'_PUBLISHED'] = 'Published'; - $this->langContent['admin'][$this->langPrefix.'_INACTIVE'] = 'Inactive'; - $this->langContent['admin'][$this->langPrefix.'_ARCHIVED'] = 'Archived'; - $this->langContent['admin'][$this->langPrefix.'_TRASHED'] = 'Trashed'; + $this->langContent['adminsys'][$this->langPrefix] = $componentName; + $this->langContent['adminsys'][$this->langPrefix . '_CONFIGURATION'] = $componentName . ' Configuration'; + $this->langContent[$this->lang][$this->langPrefix] = $componentName; + $this->langContent['admin'][$this->langPrefix . '_BACK'] = 'Back'; + $this->langContent['admin'][$this->langPrefix . '_DASH'] = 'Dashboard'; + $this->langContent['admin'][$this->langPrefix . '_VERSION'] = 'Version'; + $this->langContent['admin'][$this->langPrefix . '_DATE'] = 'Date'; + $this->langContent['admin'][$this->langPrefix . '_AUTHOR'] = 'Author'; + $this->langContent['admin'][$this->langPrefix . '_WEBSITE'] = 'Website'; + $this->langContent['admin'][$this->langPrefix . '_LICENSE'] = 'License'; + $this->langContent['admin'][$this->langPrefix . '_CONTRIBUTORS'] = 'Contributors'; + $this->langContent['admin'][$this->langPrefix . '_CONTRIBUTOR'] = 'Contributor'; + $this->langContent['admin'][$this->langPrefix . '_DASHBOARD'] = $componentName . ' Dashboard'; + $this->langContent['admin'][$this->langPrefix . '_SAVE_SUCCESS'] = "Great! Item successfully saved."; + $this->langContent['admin'][$this->langPrefix . '_SAVE_WARNING'] = "The value already existed so please select another."; + $this->langContent['admin'][$this->langPrefix . '_HELP_MANAGER'] = "Help"; + $this->langContent['admin'][$this->langPrefix . '_NEW'] = "New"; + $this->langContent['admin'][$this->langPrefix . '_CLOSE_NEW'] = "Close & New"; + $this->langContent['admin'][$this->langPrefix . '_CREATE_NEW_S'] = "Create New %s"; + $this->langContent['admin'][$this->langPrefix . '_EDIT_S'] = "Edit %s"; + $this->langContent['admin'][$this->langPrefix . '_KEEP_ORIGINAL_STATE'] = "- Keep Original State -"; + $this->langContent['admin'][$this->langPrefix . '_KEEP_ORIGINAL_ACCESS'] = "- Keep Original Access -"; + $this->langContent['admin'][$this->langPrefix . '_KEEP_ORIGINAL_CATEGORY'] = "- Keep Original Category -"; + $this->langContent['admin'][$this->langPrefix . '_PUBLISHED'] = 'Published'; + $this->langContent['admin'][$this->langPrefix . '_INACTIVE'] = 'Inactive'; + $this->langContent['admin'][$this->langPrefix . '_ARCHIVED'] = 'Archived'; + $this->langContent['admin'][$this->langPrefix . '_TRASHED'] = 'Trashed'; if ($this->componentData->add_license && $this->componentData->license_type == 3) { - $this->langContent['admin']['NIE_REG_NIE'] = "

License not set for ".$componentName.".

Notify your administrator!
The license can be obtained from ".$this->componentData->companyname.".

"; + $this->langContent['admin']['NIE_REG_NIE'] = "

License not set for " . $componentName . ".

Notify your administrator!
The license can be obtained from " . $this->componentData->companyname . ".

"; } // add the langug files needed to import and export data if ($this->addEximport) { - $this->langContent['admin'][$this->langPrefix.'_EXPORT_FAILED'] = "Export Failed"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_FAILED'] = "Import Failed"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_TITLE'] = "Data Importer"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_NO_IMPORT_TYPE_FOUND'] = "Import type not found."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE'] = "Package to import not found."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_ERROR'] = "Import error."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_SUCCESS'] = "Great! Import successful."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_MSG_WARNIMPORTFILE'] = "Warning, import file error."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_MSG_NO_FILE_SELECTED'] = "No import file selected."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_MSG_PLEASE_SELECT_A_FILE'] = "Please select a file to import."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_MSG_PLEASE_SELECT_ALL_COLUMNS'] = "Please link all columns."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_MSG_PLEASE_SELECT_A_DIRECTORY'] = "Please enter the file directory."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_MSG_WARNIMPORTUPLOADERROR'] = "Warning, import upload error."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'] = "Please enter the file directory."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'] = "Path does not have a valid file."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'] = "Does not have a valid file type."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_MSG_ENTER_A_URL'] = "Please enter a url."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_MSG_INVALID_URL'] = "Invalid url."; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_CONTINUE'] = "Continue"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_FROM_UPLOAD'] = "Upload"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_SELECT_FILE'] = "Select File"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_UPLOAD_BOTTON'] = "Upload File"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_FROM_DIRECTORY'] = "Directory"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_SELECT_FILE_DIRECTORY'] = "Set the path to file"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_GET_BOTTON'] = "Get File"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_FROM_URL'] = "URL"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_SELECT_FILE_URL'] = "Enter file URL"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_UPDATE_DATA'] = "Import Data"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_FORMATS_ACCEPTED'] = "formats accepted"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_LINK_FILE_TO_TABLE_COLUMNS'] = "Link File to Table Columns"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_TABLE_COLUMNS'] = "Table Columns"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_FILE_COLUMNS'] = "File Columns"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_PLEASE_SELECT_COLUMN'] = "-- Please Select Column --"; - $this->langContent['admin'][$this->langPrefix.'_IMPORT_IGNORE_COLUMN'] = "-- Ignore This Column --"; - $this->langContent['admin'][$this->langPrefix.'_NO_ACCESS_GRANTED'] = "No Access Granted!"; + $this->langContent['admin'][$this->langPrefix . '_EXPORT_FAILED'] = "Export Failed"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_FAILED'] = "Import Failed"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_TITLE'] = "Data Importer"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_NO_IMPORT_TYPE_FOUND'] = "Import type not found."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE'] = "Package to import not found."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_ERROR'] = "Import error."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_SUCCESS'] = "Great! Import successful."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_WARNIMPORTFILE'] = "Warning, import file error."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_NO_FILE_SELECTED'] = "No import file selected."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_PLEASE_SELECT_A_FILE'] = "Please select a file to import."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_PLEASE_SELECT_ALL_COLUMNS'] = "Please link all columns."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_PLEASE_SELECT_A_DIRECTORY'] = "Please enter the file directory."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_WARNIMPORTUPLOADERROR'] = "Warning, import upload error."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'] = "Please enter the file directory."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'] = "Path does not have a valid file."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'] = "Does not have a valid file type."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_ENTER_A_URL'] = "Please enter a url."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_INVALID_URL'] = "Invalid url."; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_CONTINUE'] = "Continue"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_FROM_UPLOAD'] = "Upload"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_SELECT_FILE'] = "Select File"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_UPLOAD_BOTTON'] = "Upload File"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_FROM_DIRECTORY'] = "Directory"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_SELECT_FILE_DIRECTORY'] = "Set the path to file"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_GET_BOTTON'] = "Get File"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_FROM_URL'] = "URL"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_SELECT_FILE_URL'] = "Enter file URL"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_UPDATE_DATA'] = "Import Data"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_FORMATS_ACCEPTED'] = "formats accepted"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_LINK_FILE_TO_TABLE_COLUMNS'] = "Link File to Table Columns"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_TABLE_COLUMNS'] = "Table Columns"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_FILE_COLUMNS'] = "File Columns"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_PLEASE_SELECT_COLUMN'] = "-- Please Select Column --"; + $this->langContent['admin'][$this->langPrefix . '_IMPORT_IGNORE_COLUMN'] = "-- Ignore This Column --"; + $this->langContent['admin'][$this->langPrefix . '_NO_ACCESS_GRANTED'] = "No Access Granted!"; } // check if the both array is set if (isset($this->langContent['both']) && ComponentbuilderHelper::checkArray($this->langContent['both'])) @@ -5843,7 +5846,7 @@ class Interpretation extends Fields $this->languages['en-GB']['admin'] = $this->langContent['admin']; // remove tmp array unset($this->langContent['admin']); - + return true; } return false; @@ -5852,26 +5855,26 @@ class Interpretation extends Fields public function setLangSite() { // add final list of needed lang strings - $this->langContent['site'][$this->langPrefix] = ComponentbuilderHelper::safeString($this->componentData->name,'W'); + $this->langContent['site'][$this->langPrefix] = ComponentbuilderHelper::safeString($this->componentData->name, 'W'); // some more defaults - $this->langContent['site']['JTOOLBAR_APPLY'] = "Save"; - $this->langContent['site']['JTOOLBAR_SAVE_AS_COPY'] = "Save as Copy"; - $this->langContent['site']['JTOOLBAR_SAVE'] = "Save & Close"; - $this->langContent['site']['JTOOLBAR_SAVE_AND_NEW'] = "Save & New"; - $this->langContent['site']['JTOOLBAR_CANCEL'] = "Cancel"; - $this->langContent['site']['JTOOLBAR_CLOSE'] = "Close"; - $this->langContent['site']['JTOOLBAR_HELP'] = "Help"; - $this->langContent['site']['JGLOBAL_FIELD_ID_LABEL'] = "ID"; - $this->langContent['site']['JGLOBAL_FIELD_ID_DESC'] = "Record number in the database."; - $this->langContent['site']['JGLOBAL_FIELD_MODIFIED_LABEL'] = "Modified Date"; - $this->langContent['site']['COM_CONTENT_FIELD_MODIFIED_DESC'] = "The last date this item was modified."; - $this->langContent['site']['JGLOBAL_FIELD_MODIFIED_BY_LABEL'] = "Modified By"; - $this->langContent['site']['JGLOBAL_FIELD_MODIFIED_BY_DESC'] = "The user who did the last modification."; - $this->langContent['site'][$this->langPrefix.'_NEW'] = "New"; - $this->langContent['site'][$this->langPrefix.'_CREATE_NEW_S'] = "Create New %s"; - $this->langContent['site'][$this->langPrefix.'_EDIT_S'] = "Edit %s"; - $this->langContent['site'][$this->langPrefix.'_NO_ACCESS_GRANTED'] = "No Access Granted!"; - + $this->langContent['site']['JTOOLBAR_APPLY'] = "Save"; + $this->langContent['site']['JTOOLBAR_SAVE_AS_COPY'] = "Save as Copy"; + $this->langContent['site']['JTOOLBAR_SAVE'] = "Save & Close"; + $this->langContent['site']['JTOOLBAR_SAVE_AND_NEW'] = "Save & New"; + $this->langContent['site']['JTOOLBAR_CANCEL'] = "Cancel"; + $this->langContent['site']['JTOOLBAR_CLOSE'] = "Close"; + $this->langContent['site']['JTOOLBAR_HELP'] = "Help"; + $this->langContent['site']['JGLOBAL_FIELD_ID_LABEL'] = "ID"; + $this->langContent['site']['JGLOBAL_FIELD_ID_DESC'] = "Record number in the database."; + $this->langContent['site']['JGLOBAL_FIELD_MODIFIED_LABEL'] = "Modified Date"; + $this->langContent['site']['COM_CONTENT_FIELD_MODIFIED_DESC'] = "The last date this item was modified."; + $this->langContent['site']['JGLOBAL_FIELD_MODIFIED_BY_LABEL'] = "Modified By"; + $this->langContent['site']['JGLOBAL_FIELD_MODIFIED_BY_DESC'] = "The user who did the last modification."; + $this->langContent['site'][$this->langPrefix . '_NEW'] = "New"; + $this->langContent['site'][$this->langPrefix . '_CREATE_NEW_S'] = "Create New %s"; + $this->langContent['site'][$this->langPrefix . '_EDIT_S'] = "Edit %s"; + $this->langContent['site'][$this->langPrefix . '_NO_ACCESS_GRANTED'] = "No Access Granted!"; + // check if the both array is set if (isset($this->langContent['both']) && ComponentbuilderHelper::checkArray($this->langContent['both'])) { @@ -5895,7 +5898,7 @@ class Interpretation extends Fields $this->languages['en-GB']['site'] = $this->langContent['site']; // remove tmp array unset($this->langContent['site']); - + return true; } return false; @@ -5904,8 +5907,8 @@ class Interpretation extends Fields public function setLangSiteSys() { // add final list of needed lang strings - $this->langContent['sitesys'][$this->langPrefix] = ComponentbuilderHelper::safeString($this->componentData->name,'W'); - $this->langContent['sitesys'][$this->langPrefix.'_NO_ACCESS_GRANTED'] = "No Access Granted!"; + $this->langContent['sitesys'][$this->langPrefix] = ComponentbuilderHelper::safeString($this->componentData->name, 'W'); + $this->langContent['sitesys'][$this->langPrefix . '_NO_ACCESS_GRANTED'] = "No Access Granted!"; // check if the both site array is set if (isset($this->langContent['bothsite']) && ComponentbuilderHelper::checkArray($this->langContent['bothsite'])) @@ -5922,7 +5925,7 @@ class Interpretation extends Fields $this->languages['en-GB']['sitesys'] = $this->langContent['sitesys']; // remove tmp array unset($this->langContent['sitesys']); - + return true; } return false; @@ -5945,13 +5948,13 @@ class Interpretation extends Fields $this->languages['en-GB']['adminsys'] = $this->langContent['adminsys']; // remove tmp array unset($this->langContent['adminsys']); - + return true; } return false; } - public function setCustomAdminViewListLink($view,$viewName_list) + public function setCustomAdminViewListLink($view, $viewName_list) { if (isset($this->componentData->custom_admin_views) && ComponentbuilderHelper::checkArray($this->componentData->custom_admin_views)) { @@ -6003,12 +6006,12 @@ class Interpretation extends Fields } } - public function setListBody($viewName_single,$viewName_list) + public function setListBody($viewName_single, $viewName_list) { if (isset($this->listBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->listBuilder[$viewName_list])) { // component helper name - $Helper = $this->fileContentStatic['###Component###'].'Helper'; + $Helper = $this->fileContentStatic['###Component###'] . 'Helper'; // setup correct core target $coreLoad = false; if (isset($this->permissionCore[$viewName_single])) @@ -6020,70 +6023,70 @@ class Interpretation extends Fields $firstTimeBeingAdded = true; // add the default $body = "items as \$i => \$item): ?>"; - $body .= PHP_EOL."\tuser->authorise('core.manage', 'com_checkin') || \$item->checked_out == \$this->user->id || \$item->checked_out == 0;"; - $body .= PHP_EOL."\t\t\$userChkOut = JFactory::getUser(\$item->checked_out);"; - $body .= PHP_EOL."\t\t\$canDo = ".$Helper."::getActions('".$viewName_single."',\$item,'".$viewName_list."');"; - $body .= PHP_EOL."\t?>"; - $body .= PHP_EOL."\t".''; + $body .= PHP_EOL . "\tuser->authorise('core.manage', 'com_checkin') || \$item->checked_out == \$this->user->id || \$item->checked_out == 0;"; + $body .= PHP_EOL . "\t\t\$userChkOut = JFactory::getUser(\$item->checked_out);"; + $body .= PHP_EOL . "\t\t\$canDo = " . $Helper . "::getActions('" . $viewName_single . "',\$item,'" . $viewName_list . "');"; + $body .= PHP_EOL . "\t?>"; + $body .= PHP_EOL . "\t" . ''; // only load if not over written if (!isset($this->fieldsNames[$viewName_single]['ordering'])) { - $body .= PHP_EOL."\t\t".''; + $body .= PHP_EOL . "\t\t" . ''; // check if the item has permissions. - if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder['global'][$core['core.edit.state']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit.state']]) && in_array($viewName_single,$this->permissionBuilder['global'][$core['core.edit.state']])) + if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder['global'][$core['core.edit.state']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit.state']]) && in_array($viewName_single, $this->permissionBuilder['global'][$core['core.edit.state']])) { - $body .= PHP_EOL."\t\tget('".$core['core.edit.state']."')): ?>"; + $body .= PHP_EOL . "\t\tget('" . $core['core.edit.state'] . "')): ?>"; } else { - $body .= PHP_EOL."\t\tget('core.edit.state')): ?>"; + $body .= PHP_EOL . "\t\tget('core.edit.state')): ?>"; } - $body .= PHP_EOL."\t\t\tsaveOrder)"; - $body .= PHP_EOL."\t\t\t\t{"; - $body .= PHP_EOL."\t\t\t\t\t\$iconClass = ' inactive';"; - $body .= PHP_EOL."\t\t\t\t}"; - $body .= PHP_EOL."\t\t\t\telse"; - $body .= PHP_EOL."\t\t\t\t{"; - $body .= PHP_EOL."\t\t\t\t\t\$iconClass = ' inactive tip-top".'" hasTooltip" title="'."' . JHtml::tooltipText('JORDERINGDISABLED');"; - $body .= PHP_EOL."\t\t\t\t}"; - $body .= PHP_EOL."\t\t\t?>"; - $body .= PHP_EOL."\t\t\t".''; - $body .= PHP_EOL."\t\t\t\t".''; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t\tsaveOrder) : ?>"; - $body .= PHP_EOL."\t\t\t\t".'ordering; ?>" class="width-20 text-area-order " />'; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t"; - $body .= PHP_EOL."\t\t\t⋮"; - $body .= PHP_EOL."\t\t"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t\tsaveOrder)"; + $body .= PHP_EOL . "\t\t\t\t{"; + $body .= PHP_EOL . "\t\t\t\t\t\$iconClass = ' inactive';"; + $body .= PHP_EOL . "\t\t\t\t}"; + $body .= PHP_EOL . "\t\t\t\telse"; + $body .= PHP_EOL . "\t\t\t\t{"; + $body .= PHP_EOL . "\t\t\t\t\t\$iconClass = ' inactive tip-top" . '" hasTooltip" title="' . "' . JHtml::tooltipText('JORDERINGDISABLED');"; + $body .= PHP_EOL . "\t\t\t\t}"; + $body .= PHP_EOL . "\t\t\t?>"; + $body .= PHP_EOL . "\t\t\t" . ''; + $body .= PHP_EOL . "\t\t\t\t" . ''; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t\tsaveOrder) : ?>"; + $body .= PHP_EOL . "\t\t\t\t" . ''; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t"; + $body .= PHP_EOL . "\t\t\t⋮"; + $body .= PHP_EOL . "\t\t"; + $body .= PHP_EOL . "\t\t"; } - $body .= PHP_EOL."\t\t".''; + $body .= PHP_EOL . "\t\t" . ''; // check if the item has permissions. - if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit']]) && in_array($viewName_single,$this->permissionBuilder['global'][$core['core.edit']])) + if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit']]) && in_array($viewName_single, $this->permissionBuilder['global'][$core['core.edit']])) { - $body .= PHP_EOL."\t\tget('".$core['core.edit']."')): ?>"; + $body .= PHP_EOL . "\t\tget('" . $core['core.edit'] . "')): ?>"; } else { - $body .= PHP_EOL."\t\tget('core.edit')): ?>"; + $body .= PHP_EOL . "\t\tget('core.edit')): ?>"; } - $body .= PHP_EOL."\t\t\t\tchecked_out) : ?>"; - $body .= PHP_EOL."\t\t\t\t\t"; - $body .= PHP_EOL."\t\t\t\t\t\tid); ?>"; - $body .= PHP_EOL."\t\t\t\t\t"; - $body .= PHP_EOL."\t\t\t\t\t\t□"; - $body .= PHP_EOL."\t\t\t\t\t"; - $body .= PHP_EOL."\t\t\t\t"; - $body .= PHP_EOL."\t\t\t\t\tid); ?>"; - $body .= PHP_EOL."\t\t\t\t"; - $body .= PHP_EOL."\t\t"; - $body .= PHP_EOL."\t\t\t□"; - $body .= PHP_EOL."\t\t"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t\t\tchecked_out) : ?>"; + $body .= PHP_EOL . "\t\t\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t\t\tid); ?>"; + $body .= PHP_EOL . "\t\t\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t\t\t□"; + $body .= PHP_EOL . "\t\t\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t\tid); ?>"; + $body .= PHP_EOL . "\t\t\t\t"; + $body .= PHP_EOL . "\t\t"; + $body .= PHP_EOL . "\t\t\t□"; + $body .= PHP_EOL . "\t\t"; + $body .= PHP_EOL . "\t\t"; // check if this view has fields that should not be escaped $doNotEscape = false; if (isset($this->doNotEscape[$viewName_list])) @@ -6099,33 +6102,32 @@ class Interpretation extends Fields $item['id'] = $item['code']; if (!$item['multiple']) { - $item['code'] = $item['code'].'_'.$item['custom']['text']; + $item['code'] = $item['code'] . '_' . $item['custom']['text']; } } // check if translated value is used - if (isset($this->selectionTranslationFixBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->selectionTranslationFixBuilder[$viewName_list]) - && array_key_exists($item['code'],$this->selectionTranslationFixBuilder[$viewName_list])) + if (isset($this->selectionTranslationFixBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->selectionTranslationFixBuilder[$viewName_list]) && array_key_exists($item['code'], $this->selectionTranslationFixBuilder[$viewName_list])) { - $itemCode = ''.$item['code'].'); ?>'; + $itemCode = '' . $item['code'] . '); ?>'; } elseif (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['text'] === 'user') { - $itemCode = ''.$item['code'].')->name; ?>'; + $itemCode = '' . $item['code'] . ')->name; ?>'; } elseif ($doNotEscape) { if (in_array($item['code'], $this->doNotEscape[$viewName_list])) { - $itemCode = ''.$item['code'].'; ?>'; + $itemCode = '' . $item['code'] . '; ?>'; } else { - $itemCode = 'escape($item->'.$item['code'].'); ?>'; + $itemCode = 'escape($item->' . $item['code'] . '); ?>'; } } else { - $itemCode = 'escape($item->'.$item['code'].'); ?>'; + $itemCode = 'escape($item->' . $item['code'] . '); ?>'; } if ($item['link']) { @@ -6136,25 +6138,25 @@ class Interpretation extends Fields { $otherViews = $this->catCodeBuilder[$viewName_single]['views']; // category and linked - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\tuser->authorise('core.edit', 'com_".$this->fileContentStatic['###component###'].".".$otherViews.".category.' . (int)\$item->".$item['code'].")): ?>"; - $body .= PHP_EOL."\t\t\t\t".'escape($item->category_title); ?>'; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t\t\tescape(\$item->category_title); ?>"; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\tuser->authorise('core.edit', 'com_" . $this->fileContentStatic['###component###'] . "." . $otherViews . ".category.' . (int)\$item->" . $item['code'] . ")): ?>"; + $body .= PHP_EOL . "\t\t\t\t" . 'escape($item->category_title); ?>'; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t\t\tescape(\$item->category_title); ?>"; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t"; } elseif ($item['type'] === 'user' && !$item['title']) { // user and linked - $body .= PHP_EOL."\t\t".$item['code']."); ?>"; - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\tuser->authorise('core.edit', 'com_users')): ?>"; - $body .= PHP_EOL."\t\t\t\t".'name; ?>'; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t\t\tname; ?>"; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t" . $item['code'] . "); ?>"; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\tuser->authorise('core.edit', 'com_users')): ?>"; + $body .= PHP_EOL . "\t\t\t\t" . 'name; ?>'; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t\t\tname; ?>"; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t"; } else { @@ -6162,8 +6164,8 @@ class Interpretation extends Fields if (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['extends'] != 'user' && !$item['title']) { // link to that item instead - $link = 'index.php?option='.$item['custom']['component'].'&view='.$item['custom']['views'].'&task='.$item['custom']['view'].'.edit&id='.$item['id'].'; ?>&ref='.$viewName_list; - + $link = 'index.php?option=' . $item['custom']['component'] . '&view=' . $item['custom']['views'] . '&task=' . $item['custom']['view'] . '.edit&id=' . $item['id'] . '; ?>&ref=' . $viewName_list; + $coreLoadLink = false; if (isset($this->permissionCore[$item['custom']['view']])) { @@ -6171,56 +6173,55 @@ class Interpretation extends Fields $coreLoadLink = true; } // check if the item has permissions. - if ($coreLoadLink && (isset($coreLink['core.edit']) && isset($this->permissionBuilder[$coreLink['core.edit']])) && ComponentbuilderHelper::checkArray($this->permissionBuilder[$coreLink['core.edit']]) && in_array($item['custom']['view'],$this->permissionBuilder[$coreLink['core.edit']])) + if ($coreLoadLink && (isset($coreLink['core.edit']) && isset($this->permissionBuilder[$coreLink['core.edit']])) && ComponentbuilderHelper::checkArray($this->permissionBuilder[$coreLink['core.edit']]) && in_array($item['custom']['view'], $this->permissionBuilder[$coreLink['core.edit']])) { - $accessCheck = "\$this->user->authorise('".$coreLink['core.edit']."', 'com_".$this->fileContentStatic['###component###'].".".$item['custom']['view'].".' . (int)\$item->".$item['id'].")"; + $accessCheck = "\$this->user->authorise('" . $coreLink['core.edit'] . "', 'com_" . $this->fileContentStatic['###component###'] . "." . $item['custom']['view'] . ".' . (int)\$item->" . $item['id'] . ")"; } else { - $accessCheck = "\$this->user->authorise('core.edit', 'com_".$this->fileContentStatic['###component###'].".".$item['custom']['view'].".' . (int)\$item->".$item['id'].")"; + $accessCheck = "\$this->user->authorise('core.edit', 'com_" . $this->fileContentStatic['###component###'] . "." . $item['custom']['view'] . ".' . (int)\$item->" . $item['id'] . ")"; } } elseif (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['extends'] === 'user' && !$item['title']) { // user and linked - $body .= PHP_EOL."\t\t".$item['id']."); ?>"; - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\tuser->authorise('core.edit', 'com_users')): ?>"; - $body .= PHP_EOL."\t\t\t\t".'name; ?>'; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t\t\tname; ?>"; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t" . $item['id'] . "); ?>"; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\tuser->authorise('core.edit', 'com_users')): ?>"; + $body .= PHP_EOL . "\t\t\t\t" . 'name; ?>'; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t\t\tname; ?>"; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t"; $add = false; } else { - // start building the links + // start building the links $link = '&id=id; ?>'; - // check if custom links should be added to this list views - if (isset($this->customAdminViewListLink[$viewName_list]) && ComponentbuilderHelper::checkArray($this->customAdminViewListLink[$viewName_list]) && $firstTimeBeingAdded) - { - // make sure the custom links are only added once - $firstTimeBeingAdded = false; - // start building the links - $customAdminView = PHP_EOL."\t\t\t".'
'; - foreach ($this->customAdminViewListLink[$viewName_list] as $customLinkView) - { - $customAdminView .= PHP_EOL."\t\t\tget('".$customLinkView['link'].".access')): ?>"; - $customAdminView .= PHP_EOL."\t\t\t\t".'fileContentStatic['###COMPONENT###'].'_'.$customLinkView['NAME']."'".'); ?>" >'; - $customAdminView .= PHP_EOL."\t\t\t"; - $customAdminView .= PHP_EOL."\t\t\t\t".'fileContentStatic['###COMPONENT###'].'_'.$customLinkView['NAME']."'".'); ?>">'; - $customAdminView .= PHP_EOL."\t\t\t"; - } - $customAdminView .= PHP_EOL."\t\t\t".'
'; - - } + // check if custom links should be added to this list views + if (isset($this->customAdminViewListLink[$viewName_list]) && ComponentbuilderHelper::checkArray($this->customAdminViewListLink[$viewName_list]) && $firstTimeBeingAdded) + { + // make sure the custom links are only added once + $firstTimeBeingAdded = false; + // start building the links + $customAdminView = PHP_EOL . "\t\t\t" . '
'; + foreach ($this->customAdminViewListLink[$viewName_list] as $customLinkView) + { + $customAdminView .= PHP_EOL . "\t\t\tget('" . $customLinkView['link'] . ".access')): ?>"; + $customAdminView .= PHP_EOL . "\t\t\t\t" . 'fileContentStatic['###COMPONENT###'] . '_' . $customLinkView['NAME'] . "'" . '); ?>" >'; + $customAdminView .= PHP_EOL . "\t\t\t"; + $customAdminView .= PHP_EOL . "\t\t\t\t" . 'fileContentStatic['###COMPONENT###'] . '_' . $customLinkView['NAME'] . "'" . '); ?>">'; + $customAdminView .= PHP_EOL . "\t\t\t"; + } + $customAdminView .= PHP_EOL . "\t\t\t" . '
'; + } // check if the item has permissions. - if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit']]) && in_array($viewName_single,$this->permissionBuilder['global'][$core['core.edit']])) + if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit']]) && in_array($viewName_single, $this->permissionBuilder['global'][$core['core.edit']])) { // set permissions. - $accessCheck = "\$canDo->get('".$core['core.edit']."')"; + $accessCheck = "\$canDo->get('" . $core['core.edit'] . "')"; } else { @@ -6234,21 +6235,21 @@ class Interpretation extends Fields if ($add) { // set as linked - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t\t\t".'
'.PHP_EOL."\t\t\t\t\t".''.$itemCode.''; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t" . '
' . PHP_EOL . "\t\t\t\t\t" . '' . $itemCode . ''; if ($checkoutTriger) { - $body .= PHP_EOL."\t\t\t\t\tchecked_out): ?>"; - $body .= PHP_EOL."\t\t\t\t\t\tname, \$item->checked_out_time, '".$viewName_list.".', \$canCheckin); ?>"; - $body .= PHP_EOL."\t\t\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t\tchecked_out): ?>"; + $body .= PHP_EOL . "\t\t\t\t\t\tname, \$item->checked_out_time, '" . $viewName_list . ".', \$canCheckin); ?>"; + $body .= PHP_EOL . "\t\t\t\t\t"; } - $body .= PHP_EOL."\t\t\t\t".'
'; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t\t\t".'
'.$itemCode.'
'; - $body .= PHP_EOL."\t\t\t"; - $body .= $customAdminView; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t\t\t" . '
'; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t" . '
' . $itemCode . '
'; + $body .= PHP_EOL . "\t\t\t"; + $body .= $customAdminView; + $body .= PHP_EOL . "\t\t"; } } } @@ -6256,120 +6257,120 @@ class Interpretation extends Fields { if ($item['type'] === 'category') { - $body .= PHP_EOL."\t\t"; - $body .= PHP_EOL."\t\t\tescape(\$item->category_title); ?>"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t"; + $body .= PHP_EOL . "\t\t\tescape(\$item->category_title); ?>"; + $body .= PHP_EOL . "\t\t"; } elseif (ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['extends'] === 'user') { // custom user and linked - $body .= PHP_EOL."\t\t".$item['id']."); ?>"; - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\tuser->authorise('core.edit', 'com_users')): ?>"; - $body .= PHP_EOL."\t\t\t\t".'name; ?>'; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t\t\tname; ?>"; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t" . $item['id'] . "); ?>"; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\tuser->authorise('core.edit', 'com_users')): ?>"; + $body .= PHP_EOL . "\t\t\t\t" . 'name; ?>'; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t\t\tname; ?>"; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t"; } elseif ($item['type'] === 'user') { // user name only - $body .= PHP_EOL."\t\t".$item['code']."); ?>"; - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\tname; ?>"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t" . $item['code'] . "); ?>"; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\tname; ?>"; + $body .= PHP_EOL . "\t\t"; } else { // normal not linked - $body .= PHP_EOL."\t\t"; - $body .= PHP_EOL."\t\t\t".$itemCode; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t"; + $body .= PHP_EOL . "\t\t\t" . $itemCode; + $body .= PHP_EOL . "\t\t"; } } } // add the defaults if (!isset($this->fieldsNames[$viewName_single]['published'])) { - $body .= PHP_EOL."\t\t".''; + $body .= PHP_EOL . "\t\t" . ''; // check if the item has permissions. - if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder['global'][$core['core.edit.state']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit.state']]) && in_array($viewName_single,$this->permissionBuilder['global'][$core['core.edit.state']])) + if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder['global'][$core['core.edit.state']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit.state']]) && in_array($viewName_single, $this->permissionBuilder['global'][$core['core.edit.state']])) { - $body .= PHP_EOL."\t\tget('".$core['core.edit.state']."')) : ?>"; + $body .= PHP_EOL . "\t\tget('" . $core['core.edit.state'] . "')) : ?>"; } else { - $body .= PHP_EOL."\t\tget('core.edit.state')) : ?>"; + $body .= PHP_EOL . "\t\tget('core.edit.state')) : ?>"; } - $body .= PHP_EOL."\t\t\t\tchecked_out) : ?>"; - $body .= PHP_EOL."\t\t\t\t\t"; - $body .= PHP_EOL."\t\t\t\t\t\tpublished, \$i, '".$viewName_list.".', true, 'cb'); ?>"; - $body .= PHP_EOL."\t\t\t\t\t"; - $body .= PHP_EOL."\t\t\t\t\t\tpublished, \$i, '".$viewName_list.".', false, 'cb'); ?>"; - $body .= PHP_EOL."\t\t\t\t\t"; - $body .= PHP_EOL."\t\t\t\t"; - $body .= PHP_EOL."\t\t\t\t\tpublished, \$i, '".$viewName_list.".', true, 'cb'); ?>"; - $body .= PHP_EOL."\t\t\t\t"; - $body .= PHP_EOL."\t\t"; - $body .= PHP_EOL."\t\t\tpublished, \$i, '".$viewName_list.".', false, 'cb'); ?>"; - $body .= PHP_EOL."\t\t"; - $body .= PHP_EOL."\t\t"; - } + $body .= PHP_EOL . "\t\t\t\tchecked_out) : ?>"; + $body .= PHP_EOL . "\t\t\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t\t\tpublished, \$i, '" . $viewName_list . ".', true, 'cb'); ?>"; + $body .= PHP_EOL . "\t\t\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t\t\tpublished, \$i, '" . $viewName_list . ".', false, 'cb'); ?>"; + $body .= PHP_EOL . "\t\t\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t\tpublished, \$i, '" . $viewName_list . ".', true, 'cb'); ?>"; + $body .= PHP_EOL . "\t\t\t\t"; + $body .= PHP_EOL . "\t\t"; + $body .= PHP_EOL . "\t\t\tpublished, \$i, '" . $viewName_list . ".', false, 'cb'); ?>"; + $body .= PHP_EOL . "\t\t"; + $body .= PHP_EOL . "\t\t"; + } if (!isset($this->fieldsNames[$viewName_single]['id'])) { - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\tid; ?>"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\tid; ?>"; + $body .= PHP_EOL . "\t\t"; } - $body .= PHP_EOL."\t"; - $body .= PHP_EOL.""; + $body .= PHP_EOL . "\t"; + $body .= PHP_EOL . ""; // return the build return $body; } return ''; } - public function setListHead($viewName_single,$viewName_list) + public function setListHead($viewName_single, $viewName_list) { if (isset($this->listBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->listBuilder[$viewName_list])) { // main lang prefix - $langView = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($viewName_single,'U'); + $langView = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($viewName_single, 'U'); // set status lang - $statusLangName = $langView.'_STATUS'; + $statusLangName = $langView . '_STATUS'; // set id lang - $idLangName = $langView.'_ID'; + $idLangName = $langView . '_ID'; // add to lang array if (!isset($this->langContent[$this->lang][$statusLangName])) { $this->langContent[$this->lang][$statusLangName] = 'Status'; } // add to lang array - if (!isset($this->langContent[$this->lang][$idLangName ])) + if (!isset($this->langContent[$this->lang][$idLangName])) { $this->langContent[$this->lang][$idLangName] = 'Id'; } // set default $head = ''; - $head .= PHP_EOL."\tcanEdit&& \$this->canState): ?>"; + $head .= PHP_EOL . "\tcanEdit&& \$this->canState): ?>"; if (!isset($this->fieldsNames[$viewName_single]['ordering'])) { - $head .= PHP_EOL."\t\t".''; - $head .= PHP_EOL."\t\t\t'."', 'ordering', \$this->listDirn, \$this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?>"; - $head .= PHP_EOL."\t\t"; + $head .= PHP_EOL . "\t\t" . ''; + $head .= PHP_EOL . "\t\t\t' . "', 'ordering', \$this->listDirn, \$this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?>"; + $head .= PHP_EOL . "\t\t"; } - $head .= PHP_EOL."\t\t".''; - $head .= PHP_EOL."\t\t\t"; - $head .= PHP_EOL."\t\t"; - $head .= PHP_EOL."\t"; - $head .= PHP_EOL."\t\t".''; - $head .= PHP_EOL."\t\t\t▾"; - $head .= PHP_EOL."\t\t"; - $head .= PHP_EOL."\t\t".''; - $head .= PHP_EOL."\t\t\t■"; - $head .= PHP_EOL."\t\t"; - $head .= PHP_EOL."\t"; + $head .= PHP_EOL . "\t\t" . ''; + $head .= PHP_EOL . "\t\t\t"; + $head .= PHP_EOL . "\t\t"; + $head .= PHP_EOL . "\t"; + $head .= PHP_EOL . "\t\t" . ''; + $head .= PHP_EOL . "\t\t\t▾"; + $head .= PHP_EOL . "\t\t"; + $head .= PHP_EOL . "\t\t" . ''; + $head .= PHP_EOL . "\t\t\t■"; + $head .= PHP_EOL . "\t\t"; + $head .= PHP_EOL . "\t"; // set footer Column number $this->listColnrBuilder[$viewName_list] = 4; // build the dynamic fields @@ -6377,43 +6378,43 @@ class Interpretation extends Fields { if (ComponentbuilderHelper::checkArray($item['custom'])) { - $item['code'] = $item['code'].'_'.$item['custom']['text']; + $item['code'] = $item['code'] . '_' . $item['custom']['text']; } $class = 'nowrap hidden-phone'; if ($item['link']) { $class = 'nowrap'; } - $title = ""; + $title = ""; if ($item['sort']) { - $title = "listDirn, \$this->listOrder); ?>"; + $title = "listDirn, \$this->listOrder); ?>"; } - $head .= PHP_EOL."\t".''; - $head .= PHP_EOL."\t\t\t".$title; - $head .= PHP_EOL."\t"; - $this->listColnrBuilder[$viewName_list]++; + $head .= PHP_EOL . "\t" . ''; + $head .= PHP_EOL . "\t\t\t" . $title; + $head .= PHP_EOL . "\t"; + $this->listColnrBuilder[$viewName_list] ++; } // set default if (!isset($this->fieldsNames[$viewName_single]['published'])) { - $head .= PHP_EOL."\tcanState): ?>"; - $head .= PHP_EOL."\t\t".''; - $head .= PHP_EOL."\t\t\tlistDirn, \$this->listOrder); ?>"; - $head .= PHP_EOL."\t\t"; - $head .= PHP_EOL."\t"; - $head .= PHP_EOL."\t\t".''; - $head .= PHP_EOL."\t\t\t"; - $head .= PHP_EOL."\t\t"; - $head .= PHP_EOL."\t"; + $head .= PHP_EOL . "\tcanState): ?>"; + $head .= PHP_EOL . "\t\t" . ''; + $head .= PHP_EOL . "\t\t\tlistDirn, \$this->listOrder); ?>"; + $head .= PHP_EOL . "\t\t"; + $head .= PHP_EOL . "\t"; + $head .= PHP_EOL . "\t\t" . ''; + $head .= PHP_EOL . "\t\t\t"; + $head .= PHP_EOL . "\t\t"; + $head .= PHP_EOL . "\t"; } if (!isset($this->fieldsNames[$viewName_single]['id'])) { - $head .= PHP_EOL."\t".''; - $head .= PHP_EOL."\t\t\tlistDirn, \$this->listOrder); ?>"; - $head .= PHP_EOL."\t"; + $head .= PHP_EOL . "\t" . ''; + $head .= PHP_EOL . "\t\t\tlistDirn, \$this->listOrder); ?>"; + $head .= PHP_EOL . "\t"; } - $head .= PHP_EOL.""; + $head .= PHP_EOL . ""; return $head; } @@ -6436,7 +6437,7 @@ class Interpretation extends Fields // alignment $alignmentNames = array(1 => 'left', 2 => 'right', 3 => 'fullwidth', 4 => 'above', 5 => 'under', 6 => 'leftside', 7 => 'rightside'); // main lang prefix - $langView = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($viewName_single,'U'); + $langView = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($viewName_single, 'U'); if (isset($this->layoutBuilder[$viewName_single]) && ComponentbuilderHelper::checkArray($this->layoutBuilder[$viewName_single])) { @@ -6459,11 +6460,11 @@ class Interpretation extends Fields $linkedTab[$linkedView['adminview']] = $linkedView['tab']; if (ComponentbuilderHelper::checkString($linkedView['key']) && ComponentbuilderHelper::checkString($linkedView['parentkey'])) { - $keys[$linkedView['adminview']] = array( 'key' => $linkedView['key'], 'parentKey' => $linkedView['parentkey']); + $keys[$linkedView['adminview']] = array('key' => $linkedView['key'], 'parentKey' => $linkedView['parentkey']); } else { - $keys[$linkedView['adminview']] = array( 'key' => null, 'parentKey' => null); + $keys[$linkedView['adminview']] = array('key' => null, 'parentKey' => null); } if (isset($linkedView['addnew'])) { @@ -6489,7 +6490,7 @@ class Interpretation extends Fields $tabWidth = 12; $lrCounter = 0; // set tab lang - $tabLangName = $langView.'_'.ComponentbuilderHelper::safeString($tabName,'U'); + $tabLangName = $langView . '_' . ComponentbuilderHelper::safeString($tabName, 'U'); // set tab code name $tabCodeName = ComponentbuilderHelper::safeString($tabName); // add to lang array @@ -6516,31 +6517,31 @@ class Interpretation extends Fields foreach ($alignments as $alignment => $names) { // set layout code name - $layoutCodeName = $tabCodeName.'_'.$alignmentNames[$alignment]; + $layoutCodeName = $tabCodeName . '_' . $alignmentNames[$alignment]; // reset each time - $items = ''; + $items = ''; $itemCounter = 0; ksort($names); foreach ($names as $nr => $name) { if ($itemCounter == 0) { - $items .= "'".$name."'"; + $items .= "'" . $name . "'"; } else { - $items .= ",".PHP_EOL."\t'".$name."'"; + $items .= "," . PHP_EOL . "\t'" . $name . "'"; } $itemCounter++; } - switch($alignment) + switch ($alignment) { case 1: // left case 2: // right // count $lrCounter++; // set as items layout - $this->setLayout($viewName_single,$layoutCodeName,$items,'layoutitems'); + $this->setLayout($viewName_single, $layoutCodeName, $items, 'layoutitems'); // set the lang to tab $bucket[$tabCodeName]['lang'] = $tabLangName; // load the body @@ -6548,11 +6549,11 @@ class Interpretation extends Fields { $bucket[$tabCodeName][(int) $alignment] = ''; } - $bucket[$tabCodeName][(int) $alignment] .= ""; - break; + $bucket[$tabCodeName][(int) $alignment] .= ""; + break; case 3: // fullwidth // set as items layout - $this->setLayout($viewName_single,$layoutCodeName,$items,'layoutfull'); + $this->setLayout($viewName_single, $layoutCodeName, $items, 'layoutfull'); // set the lang to tab $bucket[$tabCodeName]['lang'] = $tabLangName; // load the body @@ -6560,47 +6561,47 @@ class Interpretation extends Fields { $bucket[$tabCodeName][(int) $alignment] = ''; } - $bucket[$tabCodeName][(int) $alignment] .= ""; - break; + $bucket[$tabCodeName][(int) $alignment] .= ""; + break; case 4: // above // set as title layout $this->setLayout($viewName_single, $layoutCodeName, $items, 'layouttitle'); // load to header - $header .= PHP_EOL."\t"; - break; + $header .= PHP_EOL . "\t"; + break; case 5: // under // set as title layout $this->setLayout($viewName_single, $layoutCodeName, $items, 'layouttitle'); // load to footer - $footer .= PHP_EOL.PHP_EOL."
".PHP_EOL.""; - break; + $footer .= PHP_EOL . PHP_EOL . "
" . PHP_EOL . ""; + break; case 6: // left side $tabWidth = $tabWidth - 2; // set as items layout $this->setLayout($viewName_single, $layoutCodeName, $items, 'layoutitems'); // load the body - $leftside .= PHP_EOL."\t"; - break; + $leftside .= PHP_EOL . "\t"; + break; case 7: // right side $tabWidth = $tabWidth - 2; // set as items layout $this->setLayout($viewName_single, $layoutCodeName, $items, 'layoutitems'); // load the body - $rightside .= PHP_EOL."\t"; - break; + $rightside .= PHP_EOL . "\t"; + break; } } } else { // set layout code name - $layoutCodeName = $tabCodeName.'_fullwidth'; + $layoutCodeName = $tabCodeName . '_fullwidth'; // set identifiers $linkedViewIdentifier[$linkedViewId] = $tabCodeName; //set function name - $codeName = ComponentbuilderHelper::safeString($this->uniquekey(3).$tabCodeName); + $codeName = ComponentbuilderHelper::safeString($this->uniquekey(3) . $tabCodeName); // set as items layout - $this->setLayout($viewName_single,$layoutCodeName,$codeName,'layoutlinkedview'); + $this->setLayout($viewName_single, $layoutCodeName, $codeName, 'layoutlinkedview'); // set the lang to tab $bucket[$tabCodeName]['lang'] = $tabLangName; // set all the linked view stuff @@ -6617,7 +6618,7 @@ class Interpretation extends Fields { $bucket[$tabCodeName][3] = ''; } - $bucket[$tabCodeName][3] .= ""; + $bucket[$tabCodeName][3] .= ""; } // width calculator :) if ($tabWidth == 8) @@ -6638,13 +6639,13 @@ class Interpretation extends Fields $span = ''; if ($mainwidth != 12) { - $span = 'span'.$mainwidth; + $span = 'span' . $mainwidth; } // start building body - $body = PHP_EOL.'
'; + $body = PHP_EOL . '
'; if (ComponentbuilderHelper::checkString($span)) { - $body .= PHP_EOL."\t".'
'; + $body .= PHP_EOL . "\t" . '
'; } // now build the template foreach ($bucket as $tabCodeName => $posions) @@ -6654,51 +6655,51 @@ class Interpretation extends Fields // get lang string $tabLangName = $posions['lang']; // build main center - $main = ''; + $main = ''; $mainbottom = ''; foreach ($posions as $posion => $string) { if ($lrCounter == 2) { - switch($posion) + switch ($posion) { case 1: // left case 2: // right - $main .= PHP_EOL."\t\t\t".'
'; - $main .= PHP_EOL."\t\t\t\t".$string; - $main .= PHP_EOL."\t\t\t".'
'; - break; + $main .= PHP_EOL . "\t\t\t" . '
'; + $main .= PHP_EOL . "\t\t\t\t" . $string; + $main .= PHP_EOL . "\t\t\t" . '
'; + break; } } else { - switch($posion) + switch ($posion) { case 1: // left case 2: // right - $main .= PHP_EOL."\t\t\t".'
'; - $main .= PHP_EOL."\t\t\t\t".$string; - $main .= PHP_EOL."\t\t\t".'
'; - break; + $main .= PHP_EOL . "\t\t\t" . '
'; + $main .= PHP_EOL . "\t\t\t\t" . $string; + $main .= PHP_EOL . "\t\t\t" . '
'; + break; } } - switch($posion) + switch ($posion) { case 3: // fullwidth - $mainbottom .= PHP_EOL."\t\t\t".'
'; - $mainbottom .= PHP_EOL."\t\t\t\t".$string; - $mainbottom .= PHP_EOL."\t\t\t".'
'; - break; + $mainbottom .= PHP_EOL . "\t\t\t" . '
'; + $mainbottom .= PHP_EOL . "\t\t\t\t" . $string; + $mainbottom .= PHP_EOL . "\t\t\t" . '
'; + break; } } // set acctive tab if ($tabCounter == 0) { - $body .= PHP_EOL.PHP_EOL."\t '".$tabCodeName."')); ?>"; + $body .= PHP_EOL . PHP_EOL . "\t '" . $tabCodeName . "')); ?>"; } // if this is a linked view set permissions $closeIT = false; - if(isset($linkedViewIdentifier) && ComponentbuilderHelper::checkArray($linkedViewIdentifier) && in_array($tabCodeName,$linkedViewIdentifier)) + if (isset($linkedViewIdentifier) && ComponentbuilderHelper::checkArray($linkedViewIdentifier) && in_array($tabCodeName, $linkedViewIdentifier)) { // get view name $linkedViewId = array_search($tabCodeName, $linkedViewIdentifier); @@ -6712,9 +6713,9 @@ class Interpretation extends Fields $coreLoadLinked = true; } // check if the item has permissions. - if ($coreLoadLinked && isset($coreLinked['core.access']) && isset($this->permissionBuilder['global'][$coreLinked['core.access']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$coreLinked['core.access']]) && in_array($linkedCodeName,$this->permissionBuilder['global'][$coreLinked['core.access']])) + if ($coreLoadLinked && isset($coreLinked['core.access']) && isset($this->permissionBuilder['global'][$coreLinked['core.access']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$coreLinked['core.access']]) && in_array($linkedCodeName, $this->permissionBuilder['global'][$coreLinked['core.access']])) { - $body .= PHP_EOL.PHP_EOL."\tcanDo->get('".$coreLinked['core.access']."')) : ?>"; + $body .= PHP_EOL . PHP_EOL . "\tcanDo->get('" . $coreLinked['core.access'] . "')) : ?>"; $closeIT = true; } else @@ -6722,35 +6723,35 @@ class Interpretation extends Fields $body .= PHP_EOL; } // insure clear - unset($coreLoadLinked,$coreLinked,$linkedViewData); + unset($coreLoadLinked, $coreLinked, $linkedViewData); } else { $body .= PHP_EOL; } // start tab - $body .= PHP_EOL."\t"; + $body .= PHP_EOL . "\t"; // add the main - $body .= PHP_EOL."\t\t".'
'; + $body .= PHP_EOL . "\t\t" . '
'; $body .= $main; - $body .= PHP_EOL."\t\t
"; + $body .= PHP_EOL . "\t\t
"; if (strlen($mainbottom) > 0) { // add the main bottom - $body .= PHP_EOL."\t\t".'
'; + $body .= PHP_EOL . "\t\t" . '
'; $body .= $mainbottom; - $body .= PHP_EOL."\t\t
"; + $body .= PHP_EOL . "\t\t
"; } - $body .= PHP_EOL."\t"; - if($closeIT) + $body .= PHP_EOL . "\t"; + if ($closeIT) { - $body .= PHP_EOL."\t"; + $body .= PHP_EOL . "\t"; } // set counter $tabCounter++; } // set default publishing tab lang - $tabLangName = $langView.'_PUBLISHING'; + $tabLangName = $langView . '_PUBLISHING'; // add to lang array if (!isset($this->langContent[$this->lang][$tabLangName])) { @@ -6763,9 +6764,9 @@ class Interpretation extends Fields $fieldsAddedRight = false; if (isset($this->newPublishingFields[$viewName_single])) { - foreach($this->newPublishingFields[$viewName_single] as $df_alignment => $df_items) + foreach ($this->newPublishingFields[$viewName_single] as $df_alignment => $df_items) { - foreach($df_items as $df_order => $df_name) + foreach ($df_items as $df_order => $df_name) { if ($df_alignment == 2 || $df_alignment == 1) { @@ -6787,10 +6788,10 @@ class Interpretation extends Fields $loadDefaultFields = array( 'left' => array('created', 'created_by', 'modified', 'modified_by'), 'right' => array('published', 'ordering', 'access', 'version', 'hits', 'id') - ); + ); foreach ($loadDefaultFields as $d_alignment => $defaultFields) { - foreach($defaultFields as $defaultField) + foreach ($defaultFields as $defaultField) { if (!isset($this->movedPublishingFields[$viewName_single][$defaultField])) { @@ -6818,19 +6819,19 @@ class Interpretation extends Fields // load the items into one side if (ComponentbuilderHelper::checkArray($items['left'])) { - $items_one .= "'". implode("',".PHP_EOL."\t'", $items['left'])."'"; + $items_one .= "'" . implode("'," . PHP_EOL . "\t'", $items['left']) . "'"; } if (ComponentbuilderHelper::checkArray($items['right'])) { // there is already fields just add these if (strlen($items_one) > 3) { - $items_one .= ",".PHP_EOL."\t'". implode("',".PHP_EOL."\t'", $items['right'])."'"; + $items_one .= "," . PHP_EOL . "\t'" . implode("'," . PHP_EOL . "\t'", $items['right']) . "'"; } // no fields has been added yet else { - $items_one .= "'". implode("',".PHP_EOL."\t'", $items['right'])."'"; + $items_one .= "'" . implode("'," . PHP_EOL . "\t'", $items['right']) . "'"; } } // only triger the info notice if there were custom fields targeted to the right alignment position. @@ -6844,10 +6845,10 @@ class Interpretation extends Fields } else { - $items_one = false; + $items_one = false; } // set the metadata layout - $this->setLayout($viewName_single, $tabCodeNameRight, false, 'layoutmetadata'); + $this->setLayout($viewName_single, $tabCodeNameRight, false, 'layoutmetadata'); $items_two = true; } else @@ -6862,7 +6863,7 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkArray($items['left'])) { // load all items - $items_one = "'". implode("',".PHP_EOL."\t'", $items['left'])."'"; + $items_one = "'" . implode("'," . PHP_EOL . "\t'", $items['left']) . "'"; // set the publishing layout $this->setLayout($viewName_single, $tabCodeNameLeft, $items_one, 'layoutpublished'); $items_one = true; @@ -6871,7 +6872,7 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkArray($items['right'])) { // load all items - $items_two = "'". implode("',".PHP_EOL."\t'", $items['right'])."'"; + $items_two = "'" . implode("'," . PHP_EOL . "\t'", $items['right']) . "'"; // set the publishing layout $this->setLayout($viewName_single, $tabCodeNameRight, $items_two, 'layoutpublished'); $items_two = true; @@ -6880,7 +6881,7 @@ class Interpretation extends Fields else { $items_one = false; - $items_two = false; + $items_two = false; } } if ($items_one && $items_two) @@ -6896,45 +6897,45 @@ class Interpretation extends Fields { // check if the item has permissions. $publishingPer = array(); - $allToBeChekced = array('core.delete','core.edit.created_by','core.edit.state','core.edit.created'); + $allToBeChekced = array('core.delete', 'core.edit.created_by', 'core.edit.state', 'core.edit.created'); foreach ($allToBeChekced as $core_permission) { - if ($coreLoad && isset($core[$core_permission]) && isset($this->permissionBuilder['global'][$core[$core_permission]]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core[$core_permission]]) && in_array($viewName_single,$this->permissionBuilder['global'][$core[$core_permission]])) + if ($coreLoad && isset($core[$core_permission]) && isset($this->permissionBuilder['global'][$core[$core_permission]]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core[$core_permission]]) && in_array($viewName_single, $this->permissionBuilder['global'][$core[$core_permission]])) { // set permissions. - $publishingPer[] = "\$this->canDo->get('".$core[$core_permission]."')"; + $publishingPer[] = "\$this->canDo->get('" . $core[$core_permission] . "')"; } else { // set permissions. - $publishingPer[] = "\$this->canDo->get('".$core_permission."')"; + $publishingPer[] = "\$this->canDo->get('" . $core_permission . "')"; } } - $body .= PHP_EOL.PHP_EOL."\t"; + $body .= PHP_EOL . PHP_EOL . "\t"; // set the default publishing tab - $body .= PHP_EOL."\t"; - $body .= PHP_EOL."\t\t".'
'; + $body .= PHP_EOL . "\t"; + $body .= PHP_EOL . "\t\t" . '
'; if ($items_one) { - $body .= PHP_EOL."\t\t\t".'
'; - $body .= PHP_EOL."\t\t\t\t"; - $body .= PHP_EOL."\t\t\t
"; + $body .= PHP_EOL . "\t\t\t" . '
'; + $body .= PHP_EOL . "\t\t\t\t"; + $body .= PHP_EOL . "\t\t\t
"; } if ($items_two) { - $body .= PHP_EOL."\t\t\t".'
'; - $body .= PHP_EOL."\t\t\t\t"; - $body .= PHP_EOL."\t\t\t
"; + $body .= PHP_EOL . "\t\t\t" . '
'; + $body .= PHP_EOL . "\t\t\t\t"; + $body .= PHP_EOL . "\t\t\t
"; } - $body .= PHP_EOL."\t\t
"; - $body .= PHP_EOL."\t"; - $body .= PHP_EOL."\t"; + $body .= PHP_EOL . "\t\t
"; + $body .= PHP_EOL . "\t"; + $body .= PHP_EOL . "\t"; } // make sure we dont load it to a view with the name component if ($viewName_single != 'component') { // set permissions tab lang - $tabLangName = $langView.'_PERMISSION'; + $tabLangName = $langView . '_PERMISSION'; // set permissions tab code name $tabCodeName = 'permissions'; // add to lang array @@ -6943,57 +6944,57 @@ class Interpretation extends Fields $this->langContent[$this->lang][$tabLangName] = 'Permissions'; } // set the permissions tab - $body .= PHP_EOL.PHP_EOL."\tcanDo->get('core.admin')) : ?>"; - $body .= PHP_EOL."\t"; - $body .= PHP_EOL."\t\t".'
'; - $body .= PHP_EOL."\t\t\t".'
'; - $body .= PHP_EOL."\t\t\t\t".'
'; - $body .= PHP_EOL."\t\t\t\t\t".'
'; - $body .= PHP_EOL."\t\t\t\t\tform->getFieldset('accesscontrol') as \$field): ?>"; - $body .= PHP_EOL."\t\t\t\t\t\t
"; - $body .= PHP_EOL."\t\t\t\t\t\t\tlabel; echo \$field->input;?>"; - $body .= PHP_EOL."\t\t\t\t\t\t
"; - $body .= PHP_EOL."\t\t\t\t\t\t".'
'; - $body .= PHP_EOL."\t\t\t\t\t"; - $body .= PHP_EOL."\t\t\t\t\t
"; - $body .= PHP_EOL."\t\t\t\t
"; - $body .= PHP_EOL."\t\t\t
"; - $body .= PHP_EOL."\t\t
"; - $body .= PHP_EOL."\t"; - $body .= PHP_EOL."\t"; + $body .= PHP_EOL . PHP_EOL . "\tcanDo->get('core.admin')) : ?>"; + $body .= PHP_EOL . "\t"; + $body .= PHP_EOL . "\t\t" . '
'; + $body .= PHP_EOL . "\t\t\t" . '
'; + $body .= PHP_EOL . "\t\t\t\t" . '
'; + $body .= PHP_EOL . "\t\t\t\t\t" . '
'; + $body .= PHP_EOL . "\t\t\t\t\tform->getFieldset('accesscontrol') as \$field): ?>"; + $body .= PHP_EOL . "\t\t\t\t\t\t
"; + $body .= PHP_EOL . "\t\t\t\t\t\t\tlabel; echo \$field->input;?>"; + $body .= PHP_EOL . "\t\t\t\t\t\t
"; + $body .= PHP_EOL . "\t\t\t\t\t\t" . '
'; + $body .= PHP_EOL . "\t\t\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t\t
"; + $body .= PHP_EOL . "\t\t\t\t
"; + $body .= PHP_EOL . "\t\t\t
"; + $body .= PHP_EOL . "\t\t
"; + $body .= PHP_EOL . "\t"; + $body .= PHP_EOL . "\t"; } // end the tab set - $body .= PHP_EOL.PHP_EOL."\t"; - $body .= PHP_EOL.PHP_EOL."\t
"; - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t"; - $body .= PHP_EOL."\t
"; - $body .= PHP_EOL."\t
"; - $body .= PHP_EOL."
"; + $body .= PHP_EOL . PHP_EOL . "\t"; + $body .= PHP_EOL . PHP_EOL . "\t
"; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t"; + $body .= PHP_EOL . "\t
"; + $body .= PHP_EOL . "\t
"; + $body .= PHP_EOL . "
"; // check if left has been set - if (strlen($leftside) > 0 ) + if (strlen($leftside) > 0) { - $left = '
'.$leftside.PHP_EOL."
"; + $left = '
' . $leftside . PHP_EOL . "
"; } else { $left = ''; } // check if right has been set - if (strlen($rightside) > 0 ) + if (strlen($rightside) > 0) { - $right = '
'.$rightside.PHP_EOL."
"; + $right = '
' . $rightside . PHP_EOL . "
"; } else { $right = ''; } // set active tab and return - return $header.$left.$body.$right.$footer; + return $header . $left . $body . $right . $footer; } return ''; } - + public function setFadeInEfect(&$view) { // check if we should load the fade in affect @@ -7004,7 +7005,7 @@ class Interpretation extends Fields $fadein[] = "\t// waiting spinner"; $fadein[] = "\tvar outerDiv = jQuery('body');"; $fadein[] = "\tjQuery('
')"; - $fadein[] = "\t\t.css(\"background\", \"rgba(255, 255, 255, .8) url('components/com_".$this->fileContentStatic['###component###']."/assets/images/import.gif') 50% 15% no-repeat\")"; + $fadein[] = "\t\t.css(\"background\", \"rgba(255, 255, 255, .8) url('components/com_" . $this->fileContentStatic['###component###'] . "/assets/images/import.gif') 50% 15% no-repeat\")"; $fadein[] = "\t\t.css(\"top\", outerDiv.position().top - jQuery(window).scrollTop())"; $fadein[] = "\t\t.css(\"left\", outerDiv.position().left - jQuery(window).scrollLeft())"; $fadein[] = "\t\t.css(\"width\", outerDiv.width())"; @@ -7018,15 +7019,15 @@ class Interpretation extends Fields $fadein[] = "\tjQuery('#loading').show();"; $fadein[] = "\t// when page is ready remove and show"; $fadein[] = "\tjQuery(window).load(function() {"; - $fadein[] = "\t\tjQuery('#".$this->fileContentStatic['###component###']."_loader').fadeIn('fast');"; + $fadein[] = "\t\tjQuery('#" . $this->fileContentStatic['###component###'] . "_loader').fadeIn('fast');"; $fadein[] = "\t\tjQuery('#loading').hide();"; $fadein[] = "\t});"; $fadein[] = ""; - $fadein[] = "
fileContentStatic['###component###']."_loader\" style=\"display: none;\">"; + $fadein[] = "
fileContentStatic['###component###'] . "_loader\" style=\"display: none;\">"; return implode(PHP_EOL, $fadein); } - return "
fileContentStatic['###component###']."_loader\">"; + return "
fileContentStatic['###component###'] . "_loader\">"; } /** @@ -7034,33 +7035,33 @@ class Interpretation extends Fields * @param $layoutName * @param $items * @param $type - */ + */ public function setLayout($viewName_single, $layoutName, $items, $type) { // first build the layout file $target = array('admin' => $viewName_single); - $this->buildDynamique($target,$type,$layoutName); + $this->buildDynamique($target, $type, $layoutName); // add to front if needed if ($this->lang === 'both') { $target = array('site' => $viewName_single); - $this->buildDynamique($target,$type,$layoutName); + $this->buildDynamique($target, $type, $layoutName); } if (ComponentbuilderHelper::checkString($items)) { // ###LAYOUTITEMS### <<>> - $this->fileContentDynamic[$viewName_single.'_'.$layoutName]['###LAYOUTITEMS###'] = $items; + $this->fileContentDynamic[$viewName_single . '_' . $layoutName]['###LAYOUTITEMS###'] = $items; } else { // ###LAYOUTITEMS### <<>> - $this->fileContentDynamic[$viewName_single.'_'.$layoutName]['###bogus###'] = 'boom'; + $this->fileContentDynamic[$viewName_single . '_' . $layoutName]['###bogus###'] = 'boom'; } } /** * @param $args - */ + */ public function setLinkedView($args) { /** @@ -7074,7 +7075,7 @@ class Interpretation extends Fields */ extract($args, EXTR_PREFIX_SAME, "oops"); $single = ''; - $list = ''; + $list = ''; foreach ($this->componentData->admin_views as $array) { if ($array['adminview'] == $viewId) @@ -7088,52 +7089,52 @@ class Interpretation extends Fields { $head = $this->setListHeadLinked($single, $list, $addNewButon, $viewName_single); $body = $this->setListBodyLinked($single, $list, $viewName_single); - $functionName = ComponentbuilderHelper::safeString($codeName,'F'); + $functionName = ComponentbuilderHelper::safeString($codeName, 'F'); // ###LAYOUTITEMSTABLE### <<>> - $this->fileContentDynamic[$viewName_single.'_'.$layoutCodeName]['###LAYOUTITEMSTABLE###'] = $head.$body; + $this->fileContentDynamic[$viewName_single . '_' . $layoutCodeName]['###LAYOUTITEMSTABLE###'] = $head . $body; // ###LAYOUTITEMSHEADER### <<>> - $headerscript = '$edit = "index.php?option=com_'.$this->fileContentStatic['###component###'].'&view='.$list.'&task='.$single.'.edit";'; + $headerscript = '$edit = "index.php?option=com_' . $this->fileContentStatic['###component###'] . '&view=' . $list . '&task=' . $single . '.edit";'; if ($addNewButon > 0) { // add the link for new if ($addNewButon == 1 || $addNewButon == 2) { - $headerscript .= PHP_EOL.'$ref = ($id) ? "&ref='.$viewName_single.'&refid=".$id : "";'; - $headerscript .= PHP_EOL.'$new = "index.php?option=com_'.$this->fileContentStatic['###component###'].'&view='.$single.'&layout=edit".$ref;'; + $headerscript .= PHP_EOL . '$ref = ($id) ? "&ref=' . $viewName_single . '&refid=".$id : "";'; + $headerscript .= PHP_EOL . '$new = "index.php?option=com_' . $this->fileContentStatic['###component###'] . '&view=' . $single . '&layout=edit".$ref;'; } // and the link for close and new if ($addNewButon == 2 || $addNewButon == 3) { - $headerscript .= PHP_EOL.'$close_new = "index.php?option=com_'.$this->fileContentStatic['###component###'].'&view='.$single.'&layout=edit";'; + $headerscript .= PHP_EOL . '$close_new = "index.php?option=com_' . $this->fileContentStatic['###component###'] . '&view=' . $single . '&layout=edit";'; } - $headerscript .= PHP_EOL.'$can = '.$this->fileContentStatic['###Component###'].'Helper::getActions('."'".$single."'".');'; + $headerscript .= PHP_EOL . '$can = ' . $this->fileContentStatic['###Component###'] . 'Helper::getActions(' . "'" . $single . "'" . ');'; } - $this->fileContentDynamic[$viewName_single.'_'.$layoutCodeName]['###LAYOUTITEMSHEADER###'] = $headerscript; + $this->fileContentDynamic[$viewName_single . '_' . $layoutCodeName]['###LAYOUTITEMSHEADER###'] = $headerscript; // ###LINKEDVIEWITEMS### <<>> - $this->fileContentDynamic[$viewName_single]['###LINKEDVIEWITEMS###'] .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get Linked view data".PHP_EOL."\t\t\$this->".$codeName."\t\t= \$this->get('".$functionName."');"; + $this->fileContentDynamic[$viewName_single]['###LINKEDVIEWITEMS###'] .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get Linked view data" . PHP_EOL . "\t\t\$this->" . $codeName . "\t\t= \$this->get('" . $functionName . "');"; // ###LINKEDVIEWTABLESCRIPTS### <<>> $this->fileContentDynamic[$viewName_single]['###LINKEDVIEWTABLESCRIPTS###'] = $this->setFootableScripts(); - if(strpos($parentKey, '-R>') !== false || strpos($parentKey, '-A>') !== false) + if (strpos($parentKey, '-R>') !== false || strpos($parentKey, '-A>') !== false) { - list($parent_key) = explode('-',$parentKey); + list($parent_key) = explode('-', $parentKey); } - elseif(strpos($parentKey, '-OR>') !== false) + elseif (strpos($parentKey, '-OR>') !== false) { // this is not good... (TODO) - $parent_keys = explode('-OR>',$parentKey); + $parent_keys = explode('-OR>', $parentKey); } else { $parent_key = $parentKey; } - - if(strpos($key, '-R>') !== false || strpos($key, '-A>') !== false) + + if (strpos($key, '-R>') !== false || strpos($key, '-A>') !== false) { - list($_key) = explode('-',$key); + list($_key) = explode('-', $key); } - elseif(strpos($key, '-OR>') !== false) + elseif (strpos($key, '-OR>') !== false) { - $_key = str_replace('-OR>', '',$key); + $_key = str_replace('-OR>', '', $key); } else { @@ -7145,23 +7146,23 @@ class Interpretation extends Fields $globalKey = array(); foreach ($parent_keys as $parent_key) { - $globalKey[$parent_key] = ComponentbuilderHelper::safeString($_key.$this->uniquekey(4)); - $this->fileContentDynamic[$viewName_single]['###LINKEDVIEWGLOBAL###'] .= PHP_EOL."\t\t\$this->".$globalKey[$parent_key]." = \$item->".$parent_key.";"; + $globalKey[$parent_key] = ComponentbuilderHelper::safeString($_key . $this->uniquekey(4)); + $this->fileContentDynamic[$viewName_single]['###LINKEDVIEWGLOBAL###'] .= PHP_EOL . "\t\t\$this->" . $globalKey[$parent_key] . " = \$item->" . $parent_key . ";"; } } else { // set the global key - $globalKey = ComponentbuilderHelper::safeString($_key.$this->uniquekey(4)); - $this->fileContentDynamic[$viewName_single]['###LINKEDVIEWGLOBAL###'] .= PHP_EOL."\t\t\$this->".$globalKey." = \$item->".$parent_key.";"; + $globalKey = ComponentbuilderHelper::safeString($_key . $this->uniquekey(4)); + $this->fileContentDynamic[$viewName_single]['###LINKEDVIEWGLOBAL###'] .= PHP_EOL . "\t\t\$this->" . $globalKey . " = \$item->" . $parent_key . ";"; } // ###LINKEDVIEWMETHODS### <<>> $this->fileContentDynamic[$viewName_single]['###LINKEDVIEWMETHODS###'] .= $this->setListQueryLinked($single, $list, $functionName, $key, $_key, $parentKey, $parent_key, $globalKey); } else { - $this->fileContentDynamic[$viewName_single.'_'.$layoutCodeName]['###LAYOUTITEMSTABLE###'] = 'oops! error.....'; - $this->fileContentDynamic[$viewName_single.'_'.$layoutCodeName]['###LAYOUTITEMSHEADER###'] = ''; + $this->fileContentDynamic[$viewName_single . '_' . $layoutCodeName]['###LAYOUTITEMSTABLE###'] = 'oops! error.....'; + $this->fileContentDynamic[$viewName_single . '_' . $layoutCodeName]['###LAYOUTITEMSHEADER###'] = ''; } } @@ -7173,41 +7174,41 @@ class Interpretation extends Fields { if (!isset($this->footableVersion) || 2 == $this->footableVersion) // loading version 2 { - $foo = PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Add the CSS for Footable."; - $foo .= PHP_EOL."\t\t\$this->document->addStyleSheet(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v2/css/footable.core.min.css');"; - $foo .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Use the Metro Style"; - $foo .= PHP_EOL."\t\tif (!isset(\$this->fooTableStyle) || 0 == \$this->fooTableStyle)"; - $foo .= PHP_EOL."\t\t{"; - $foo .= PHP_EOL."\t\t\t\$this->document->addStyleSheet(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v2/css/footable.metro.min.css');"; - $foo .= PHP_EOL."\t\t}"; - $foo .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Use the Legacy Style."; - $foo .= PHP_EOL."\t\telseif (isset(\$this->fooTableStyle) && 1 == \$this->fooTableStyle)"; - $foo .= PHP_EOL."\t\t{"; - $foo .= PHP_EOL."\t\t\t\$this->document->addStyleSheet(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v2/css/footable.standalone.min.css');"; - $foo .= PHP_EOL."\t\t}"; - $foo .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Add the JavaScript for Footable"; - $foo .= PHP_EOL."\t\t\$this->document->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v2/js/footable.js');"; - $foo .= PHP_EOL."\t\t\$this->document->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v2/js/footable.sort.js');"; - $foo .= PHP_EOL."\t\t\$this->document->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v2/js/footable.filter.js');"; - $foo .= PHP_EOL."\t\t\$this->document->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v2/js/footable.paginate.js');"; + $foo = PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Add the CSS for Footable."; + $foo .= PHP_EOL . "\t\t\$this->document->addStyleSheet(JURI::root() .'media/com_" . $this->fileContentStatic['###component###'] . "/footable-v2/css/footable.core.min.css');"; + $foo .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Use the Metro Style"; + $foo .= PHP_EOL . "\t\tif (!isset(\$this->fooTableStyle) || 0 == \$this->fooTableStyle)"; + $foo .= PHP_EOL . "\t\t{"; + $foo .= PHP_EOL . "\t\t\t\$this->document->addStyleSheet(JURI::root() .'media/com_" . $this->fileContentStatic['###component###'] . "/footable-v2/css/footable.metro.min.css');"; + $foo .= PHP_EOL . "\t\t}"; + $foo .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Use the Legacy Style."; + $foo .= PHP_EOL . "\t\telseif (isset(\$this->fooTableStyle) && 1 == \$this->fooTableStyle)"; + $foo .= PHP_EOL . "\t\t{"; + $foo .= PHP_EOL . "\t\t\t\$this->document->addStyleSheet(JURI::root() .'media/com_" . $this->fileContentStatic['###component###'] . "/footable-v2/css/footable.standalone.min.css');"; + $foo .= PHP_EOL . "\t\t}"; + $foo .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Add the JavaScript for Footable"; + $foo .= PHP_EOL . "\t\t\$this->document->addScript(JURI::root() .'media/com_" . $this->fileContentStatic['###component###'] . "/footable-v2/js/footable.js');"; + $foo .= PHP_EOL . "\t\t\$this->document->addScript(JURI::root() .'media/com_" . $this->fileContentStatic['###component###'] . "/footable-v2/js/footable.sort.js');"; + $foo .= PHP_EOL . "\t\t\$this->document->addScript(JURI::root() .'media/com_" . $this->fileContentStatic['###component###'] . "/footable-v2/js/footable.filter.js');"; + $foo .= PHP_EOL . "\t\t\$this->document->addScript(JURI::root() .'media/com_" . $this->fileContentStatic['###component###'] . "/footable-v2/js/footable.paginate.js');"; if ($init) { - $foo .= PHP_EOL.PHP_EOL."\t\t".'$footable = "jQuery(document).ready(function() { jQuery(function () { jQuery('."'.footable'".').footable(); }); jQuery('."'.nav-tabs'".').on('."'click'".', '."'li'".', function() { setTimeout(tableFix, 10); }); }); function tableFix() { jQuery('."'.footable'".').trigger('."'footable_resize'".'); }";'; - $foo .= PHP_EOL."\t\t\$this->document->addScriptDeclaration(\$footable);".PHP_EOL; + $foo .= PHP_EOL . PHP_EOL . "\t\t" . '$footable = "jQuery(document).ready(function() { jQuery(function () { jQuery(' . "'.footable'" . ').footable(); }); jQuery(' . "'.nav-tabs'" . ').on(' . "'click'" . ', ' . "'li'" . ', function() { setTimeout(tableFix, 10); }); }); function tableFix() { jQuery(' . "'.footable'" . ').trigger(' . "'footable_resize'" . '); }";'; + $foo .= PHP_EOL . "\t\t\$this->document->addScriptDeclaration(\$footable);" . PHP_EOL; } } elseif (3 == $this->footableVersion) // loading version 3 { - - $foo = PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Add the CSS for Footable"; - $foo .= PHP_EOL."\t\t\$this->document->addStyleSheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css');"; - $foo .= PHP_EOL."\t\t\$this->document->addStyleSheet(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v3/css/footable.standalone.min.css');"; - $foo .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Add the JavaScript for Footable (adding all funtions)"; - $foo .= PHP_EOL."\t\t\$this->document->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v3/js/footable.min.js');"; + + $foo = PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Add the CSS for Footable"; + $foo .= PHP_EOL . "\t\t\$this->document->addStyleSheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css');"; + $foo .= PHP_EOL . "\t\t\$this->document->addStyleSheet(JURI::root() .'media/com_" . $this->fileContentStatic['###component###'] . "/footable-v3/css/footable.standalone.min.css');"; + $foo .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Add the JavaScript for Footable (adding all funtions)"; + $foo .= PHP_EOL . "\t\t\$this->document->addScript(JURI::root() .'media/com_" . $this->fileContentStatic['###component###'] . "/footable-v3/js/footable.min.js');"; if ($init) { - $foo .= PHP_EOL.PHP_EOL."\t\t".'$footable = "jQuery(document).ready(function() { jQuery(function () { jQuery('."'.footable'".').footable();});});";'; - $foo .= PHP_EOL."\t\t\$this->document->addScriptDeclaration(\$footable);".PHP_EOL; + $foo .= PHP_EOL . PHP_EOL . "\t\t" . '$footable = "jQuery(document).ready(function() { jQuery(function () { jQuery(' . "'.footable'" . ').footable();});});";'; + $foo .= PHP_EOL . "\t\t\$this->document->addScriptDeclaration(\$footable);" . PHP_EOL; } } return $foo; @@ -7218,13 +7219,13 @@ class Interpretation extends Fields * @param $viewName_list * @param $refview * @return string - */ + */ public function setListBodyLinked($viewName_single, $viewName_list, $refview) { if (isset($this->listBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->listBuilder[$viewName_list])) { // component helper name - $Helper = $this->fileContentStatic['###Component###'].'Helper'; + $Helper = $this->fileContentStatic['###Component###'] . 'Helper'; // make sure the custom links are only added once $firstTimeBeingAdded = true; // setup correct core target @@ -7236,14 +7237,14 @@ class Interpretation extends Fields } $counter = 0; // add the default - $body = PHP_EOL.""; - $body .= PHP_EOL." \$item): ?>"; - $body .= PHP_EOL."\tauthorise('core.manage', 'com_checkin') || \$item->checked_out == \$user->id || \$item->checked_out == 0;"; - $body .= PHP_EOL."\t\t\$userChkOut = JFactory::getUser(\$item->checked_out);"; - $body .= PHP_EOL."\t\t\$canDo = ".$Helper."::getActions('".$viewName_single."',\$item,'".$viewName_list."');"; - $body .= PHP_EOL."\t?>"; - $body .= PHP_EOL."\t".''; + $body = PHP_EOL . ""; + $body .= PHP_EOL . " \$item): ?>"; + $body .= PHP_EOL . "\tauthorise('core.manage', 'com_checkin') || \$item->checked_out == \$user->id || \$item->checked_out == 0;"; + $body .= PHP_EOL . "\t\t\$userChkOut = JFactory::getUser(\$item->checked_out);"; + $body .= PHP_EOL . "\t\t\$canDo = " . $Helper . "::getActions('" . $viewName_single . "',\$item,'" . $viewName_list . "');"; + $body .= PHP_EOL . "\t?>"; + $body .= PHP_EOL . "\t" . ''; // check if this view has fields that should not be escaped $doNotEscape = false; if (isset($this->doNotEscape[$viewName_list])) @@ -7260,33 +7261,32 @@ class Interpretation extends Fields $item['id'] = $item['code']; if (!$item['multiple']) { - $item['code'] = $item['code'].'_'.$item['custom']['text']; + $item['code'] = $item['code'] . '_' . $item['custom']['text']; } } // check if translated vlaue is used - if (isset($this->selectionTranslationFixBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->selectionTranslationFixBuilder[$viewName_list]) - && array_key_exists($item['code'],$this->selectionTranslationFixBuilder[$viewName_list])) + if (isset($this->selectionTranslationFixBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->selectionTranslationFixBuilder[$viewName_list]) && array_key_exists($item['code'], $this->selectionTranslationFixBuilder[$viewName_list])) { - $itemCode = ''.$item['code'].'); ?>'; + $itemCode = '' . $item['code'] . '); ?>'; } elseif ($item['custom']['text'] === 'user') { - $itemCode = ''.$item['code'].')->name; ?>'; + $itemCode = '' . $item['code'] . ')->name; ?>'; } elseif ($doNotEscape) { if (in_array($item['code'], $this->doNotEscape[$viewName_list])) { - $itemCode = ''.$item['code'].'; ?>'; + $itemCode = '' . $item['code'] . '; ?>'; } else { - $itemCode = 'escape($item->'.$item['code'].'); ?>'; + $itemCode = 'escape($item->' . $item['code'] . '); ?>'; } } else { - $itemCode = 'escape($item->'.$item['code'].'); ?>'; + $itemCode = 'escape($item->' . $item['code'] . '); ?>'; } if ($item['link']) @@ -7298,25 +7298,25 @@ class Interpretation extends Fields { $otherViews = $this->catCodeBuilder[$viewName_single]['views']; // category and linked - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\tauthorise('core.edit', 'com_".$this->fileContentStatic['###component###'].".".$otherViews.".category.' . (int)\$item->".$item['code'].")): ?>"; - $body .= PHP_EOL."\t\t\t\t".'escape($item->category_title); ?>'; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t\t\tescape(\$item->category_title); ?>"; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\tauthorise('core.edit', 'com_" . $this->fileContentStatic['###component###'] . "." . $otherViews . ".category.' . (int)\$item->" . $item['code'] . ")): ?>"; + $body .= PHP_EOL . "\t\t\t\t" . 'escape($item->category_title); ?>'; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t\t\tescape(\$item->category_title); ?>"; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t"; } elseif ($item['type'] === 'user' && !$item['title']) { // user and linked - $body .= PHP_EOL."\t\t".$item['code']."); ?>"; - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\tauthorise('core.edit', 'com_users')): ?>"; - $body .= PHP_EOL."\t\t\t\t".'name; ?>'; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t\t\tname; ?>"; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t" . $item['code'] . "); ?>"; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\tauthorise('core.edit', 'com_users')): ?>"; + $body .= PHP_EOL . "\t\t\t\t" . 'name; ?>'; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t\t\tname; ?>"; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t"; } else { @@ -7326,18 +7326,18 @@ class Interpretation extends Fields if ($refview === $item['custom']['view']) { // normal not linked - $body .= PHP_EOL."\t\t"; - $body .= PHP_EOL."\t\t\t".$itemCode; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t"; + $body .= PHP_EOL . "\t\t\t" . $itemCode; + $body .= PHP_EOL . "\t\t"; $add = false; } else { // link to that item instead - $link = 'index.php?option='.$item['custom']['component'].'&view='.$item['custom']['views'].'&task='.$item['custom']['view'].'.edit&id='.$item['id'].'; ?>&ref='.$refview.'&refid='; + $link = 'index.php?option=' . $item['custom']['component'] . '&view=' . $item['custom']['views'] . '&task=' . $item['custom']['view'] . '.edit&id=' . $item['id'] . '; ?>&ref=' . $refview . '&refid='; + - $coreLoadLink = false; if (isset($this->permissionCore[$item['custom']['view']])) { @@ -7345,56 +7345,55 @@ class Interpretation extends Fields $coreLoadLink = true; } // check if the item has permissions. - if ($coreLoadLink && isset($this->permissionBuilder[$coreLink['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder[$coreLink['core.edit']]) && in_array($item['custom']['view'],$this->permissionBuilder[$coreLink['core.edit']])) + if ($coreLoadLink && isset($this->permissionBuilder[$coreLink['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder[$coreLink['core.edit']]) && in_array($item['custom']['view'], $this->permissionBuilder[$coreLink['core.edit']])) { - $accessCheck = "\$user->authorise('".$coreLink['core.edit']."', 'com_".$this->fileContentStatic['###component###'].".".$item['custom']['view'].".' . (int)\$item->".$item['id'].")"; + $accessCheck = "\$user->authorise('" . $coreLink['core.edit'] . "', 'com_" . $this->fileContentStatic['###component###'] . "." . $item['custom']['view'] . ".' . (int)\$item->" . $item['id'] . ")"; } else { - $accessCheck = "\$user->authorise('core.edit', 'com_".$this->fileContentStatic['###component###'].".".$item['custom']['view'].".' . (int)\$item->".$item['id'].")"; + $accessCheck = "\$user->authorise('core.edit', 'com_" . $this->fileContentStatic['###component###'] . "." . $item['custom']['view'] . ".' . (int)\$item->" . $item['id'] . ")"; } } } elseif (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['extends'] === 'user' && !$item['title']) { // user and linked - $body .= PHP_EOL."\t\t".$item['id']."); ?>"; - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\tauthorise('core.edit', 'com_users')): ?>"; - $body .= PHP_EOL."\t\t\t\t".'name; ?>'; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t\t\tname; ?>"; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t" . $item['id'] . "); ?>"; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\tauthorise('core.edit', 'com_users')): ?>"; + $body .= PHP_EOL . "\t\t\t\t" . 'name; ?>'; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t\t\tname; ?>"; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t"; $add = false; } else { - $link = '&id=id; ?>&ref='.$refview.'&refid='; + $link = '&id=id; ?>&ref=' . $refview . '&refid='; // check if custom links should be added to this list views if (isset($this->customAdminViewListLink[$viewName_list]) && ComponentbuilderHelper::checkArray($this->customAdminViewListLink[$viewName_list]) && $firstTimeBeingAdded) { // make sure the custom links are only added once $firstTimeBeingAdded = false; // start building the links - $customAdminView = PHP_EOL."\t\t\t".'
'; + $customAdminView = PHP_EOL . "\t\t\t" . '
'; foreach ($this->customAdminViewListLink[$viewName_list] as $customLinkView) { - $customAdminView .= PHP_EOL."\t\t\tget('".$customLinkView['link'].".access')): ?>"; - $customAdminView .= PHP_EOL."\t\t\t\t".'fileContentStatic['###COMPONENT###'].'_'.$customLinkView['NAME']."'".'); ?>" >'; - $customAdminView .= PHP_EOL."\t\t\t"; - $customAdminView .= PHP_EOL."\t\t\t\t".'fileContentStatic['###COMPONENT###'].'_'.$customLinkView['NAME']."'".'); ?>">'; - $customAdminView .= PHP_EOL."\t\t\t"; + $customAdminView .= PHP_EOL . "\t\t\tget('" . $customLinkView['link'] . ".access')): ?>"; + $customAdminView .= PHP_EOL . "\t\t\t\t" . 'fileContentStatic['###COMPONENT###'] . '_' . $customLinkView['NAME'] . "'" . '); ?>" >'; + $customAdminView .= PHP_EOL . "\t\t\t"; + $customAdminView .= PHP_EOL . "\t\t\t\t" . 'fileContentStatic['###COMPONENT###'] . '_' . $customLinkView['NAME'] . "'" . '); ?>">'; + $customAdminView .= PHP_EOL . "\t\t\t"; } - $customAdminView .= PHP_EOL."\t\t\t".'
'; - + $customAdminView .= PHP_EOL . "\t\t\t" . '
'; } // check if the item has permissions. - if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit']]) && in_array($viewName_single,$this->permissionBuilder['global'][$core['core.edit']])) + if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit']]) && in_array($viewName_single, $this->permissionBuilder['global'][$core['core.edit']])) { // set permissions. - $accessCheck = "\$canDo->get('".$core['core.edit']."')"; + $accessCheck = "\$canDo->get('" . $core['core.edit'] . "')"; } else { @@ -7408,20 +7407,20 @@ class Interpretation extends Fields if ($add) { // set as linked - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t\t\t".''.$itemCode.''; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t" . '' . $itemCode . ''; if ($checkoutTriger) { - $body .= PHP_EOL."\t\t\t\t\tchecked_out): ?>"; - $body .= PHP_EOL."\t\t\t\t\t\tname, \$item->checked_out_time, '".$viewName_list.".', \$canCheckin); ?>"; - $body .= PHP_EOL."\t\t\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t\tchecked_out): ?>"; + $body .= PHP_EOL . "\t\t\t\t\t\tname, \$item->checked_out_time, '" . $viewName_list . ".', \$canCheckin); ?>"; + $body .= PHP_EOL . "\t\t\t\t\t"; } - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t\t\t".'
'.$itemCode.'
'; - $body .= PHP_EOL."\t\t\t"; - $body .= $customAdminView; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t\t\t" . '
' . $itemCode . '
'; + $body .= PHP_EOL . "\t\t\t"; + $body .= $customAdminView; + $body .= PHP_EOL . "\t\t"; } } } @@ -7429,93 +7428,93 @@ class Interpretation extends Fields { if ($item['type'] === 'category') { - $body .= PHP_EOL."\t\t"; - $body .= PHP_EOL."\t\t\tescape(\$item->category_title); ?>"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t"; + $body .= PHP_EOL . "\t\t\tescape(\$item->category_title); ?>"; + $body .= PHP_EOL . "\t\t"; } elseif (ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['extends'] === 'user') { // custom user and linked - $body .= PHP_EOL."\t\t".$item['id']."); ?>"; - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\tauthorise('core.edit', 'com_users')): ?>"; - $body .= PHP_EOL."\t\t\t\t".'name; ?>'; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t\t\tname; ?>"; - $body .= PHP_EOL."\t\t\t"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t" . $item['id'] . "); ?>"; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\tauthorise('core.edit', 'com_users')): ?>"; + $body .= PHP_EOL . "\t\t\t\t" . 'name; ?>'; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t\t\tname; ?>"; + $body .= PHP_EOL . "\t\t\t"; + $body .= PHP_EOL . "\t\t"; } elseif ($item['type'] === 'user') { // user name only - $body .= PHP_EOL."\t\t".$item['code']."); ?>"; - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\tname; ?>"; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t" . $item['code'] . "); ?>"; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\tname; ?>"; + $body .= PHP_EOL . "\t\t"; } else { // normal not linked - $body .= PHP_EOL."\t\t"; - $body .= PHP_EOL."\t\t\t".$itemCode; - $body .= PHP_EOL."\t\t"; + $body .= PHP_EOL . "\t\t"; + $body .= PHP_EOL . "\t\t\t" . $itemCode; + $body .= PHP_EOL . "\t\t"; } } } $counter = $counter + 2; - $data_value = (3 == $this->footableVersion) ? 'data-sort-value':'data-value'; + $data_value = (3 == $this->footableVersion) ? 'data-sort-value' : 'data-value'; // add the defaults - $body .= PHP_EOL."\t\tpublished == 1):?>"; - $body .= PHP_EOL."\t\t\t".''; - $body .= PHP_EOL."\t\t\t\t".'langPrefix."_PUBLISHED'".'); ?>">'; - $body .= PHP_EOL."\t\t\t\t\t".'langPrefix."_PUBLISHED'".'); ?>'; - $body .= PHP_EOL."\t\t\t\t".''; - $body .= PHP_EOL."\t\t\t".''; + $body .= PHP_EOL . "\t\tpublished == 1):?>"; + $body .= PHP_EOL . "\t\t\t" . ''; + $body .= PHP_EOL . "\t\t\t\t" . 'langPrefix . "_PUBLISHED'" . '); ?>">'; + $body .= PHP_EOL . "\t\t\t\t\t" . 'langPrefix . "_PUBLISHED'" . '); ?>'; + $body .= PHP_EOL . "\t\t\t\t" . ''; + $body .= PHP_EOL . "\t\t\t" . ''; - $body .= PHP_EOL."\t\tpublished == 0):?>"; - $body .= PHP_EOL."\t\t\t".''; - $body .= PHP_EOL."\t\t\t\t".'langPrefix."_INACTIVE'".'); ?>">'; - $body .= PHP_EOL."\t\t\t\t\t".'langPrefix."_INACTIVE'".'); ?>'; - $body .= PHP_EOL."\t\t\t\t".''; - $body .= PHP_EOL."\t\t\t".''; + $body .= PHP_EOL . "\t\tpublished == 0):?>"; + $body .= PHP_EOL . "\t\t\t" . ''; + $body .= PHP_EOL . "\t\t\t\t" . 'langPrefix . "_INACTIVE'" . '); ?>">'; + $body .= PHP_EOL . "\t\t\t\t\t" . 'langPrefix . "_INACTIVE'" . '); ?>'; + $body .= PHP_EOL . "\t\t\t\t" . ''; + $body .= PHP_EOL . "\t\t\t" . ''; - $body .= PHP_EOL."\t\tpublished == 2):?>"; - $body .= PHP_EOL."\t\t\t".''; - $body .= PHP_EOL."\t\t\t\t".'langPrefix."_ARCHIVED'".'); ?>">'; - $body .= PHP_EOL."\t\t\t\t\t".'langPrefix."_ARCHIVED'".'); ?>'; - $body .= PHP_EOL."\t\t\t\t".''; - $body .= PHP_EOL."\t\t\t".''; + $body .= PHP_EOL . "\t\tpublished == 2):?>"; + $body .= PHP_EOL . "\t\t\t" . ''; + $body .= PHP_EOL . "\t\t\t\t" . 'langPrefix . "_ARCHIVED'" . '); ?>">'; + $body .= PHP_EOL . "\t\t\t\t\t" . 'langPrefix . "_ARCHIVED'" . '); ?>'; + $body .= PHP_EOL . "\t\t\t\t" . ''; + $body .= PHP_EOL . "\t\t\t" . ''; - $body .= PHP_EOL."\t\tpublished == -2):?>"; - $body .= PHP_EOL."\t\t\t".''; - $body .= PHP_EOL."\t\t\t\t".'langPrefix."_TRASHED'".'); ?>">'; - $body .= PHP_EOL."\t\t\t\t\t".'langPrefix."_TRASHED'".'); ?>'; - $body .= PHP_EOL."\t\t\t\t".''; - $body .= PHP_EOL."\t\t\t".''; - $body .= PHP_EOL."\t\t".''; + $body .= PHP_EOL . "\t\tpublished == -2):?>"; + $body .= PHP_EOL . "\t\t\t" . ''; + $body .= PHP_EOL . "\t\t\t\t" . 'langPrefix . "_TRASHED'" . '); ?>">'; + $body .= PHP_EOL . "\t\t\t\t\t" . 'langPrefix . "_TRASHED'" . '); ?>'; + $body .= PHP_EOL . "\t\t\t\t" . ''; + $body .= PHP_EOL . "\t\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\tid; ?>"; - $body .= PHP_EOL."\t\t"; - $body .= PHP_EOL."\t"; - $body .= PHP_EOL.""; - $body .= PHP_EOL.""; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\tid; ?>"; + $body .= PHP_EOL . "\t\t"; + $body .= PHP_EOL . "\t"; + $body .= PHP_EOL . ""; + $body .= PHP_EOL . ""; if (2 == $this->footableVersion) { - $body .= PHP_EOL.''; - $body .= PHP_EOL."\t".''; - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t\t\t".''; - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t".''; - $body .= PHP_EOL.''; + $body .= PHP_EOL . ''; + $body .= PHP_EOL . "\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t" . ''; + $body .= PHP_EOL . ''; } - $body .= PHP_EOL.''; - $body .= PHP_EOL.''; - $body .= PHP_EOL."\t".'
'; - $body .= PHP_EOL."\t\t".''; - $body .= PHP_EOL."\t".'
'; - $body .= PHP_EOL.''; + $body .= PHP_EOL . ''; + $body .= PHP_EOL . ''; + $body .= PHP_EOL . "\t" . '
'; + $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t" . '
'; + $body .= PHP_EOL . ''; // return the build return $body; } @@ -7527,7 +7526,7 @@ class Interpretation extends Fields if (isset($this->listBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->listBuilder[$viewName_list])) { // component helper name - $Helper = $this->fileContentStatic['###Component###'].'Helper'; + $Helper = $this->fileContentStatic['###Component###'] . 'Helper'; $head = ''; // only add new button if set if ($addNewButon > 0) @@ -7540,10 +7539,10 @@ class Interpretation extends Fields $coreLoad = true; } // check if the item has permissions. - if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.create']]) && in_array($viewName_single,$this->permissionBuilder['global'][$core['core.create']])) + if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.create']]) && in_array($viewName_single, $this->permissionBuilder['global'][$core['core.create']])) { // set permissions. - $accessCheck = "\$can->get('".$core['core.create']."')"; + $accessCheck = "\$can->get('" . $core['core.create'] . "')"; } else { @@ -7551,52 +7550,52 @@ class Interpretation extends Fields $accessCheck = "\$can->get('core.create')"; } // add a button for new - $head = ''; + $head = ''; // make group button if needed $tabB = ""; if ($addNewButon == 2) { - $head .= PHP_EOL."\t".'
'; + $head .= PHP_EOL . "\t" . '
'; $tabB = "\t"; } // add the new buttons if ($addNewButon == 1 || $addNewButon == 2) { - $head .= PHP_EOL.$tabB."\t".' langPrefix."_NEW'".'); ?>'; + $head .= PHP_EOL . $tabB . "\t" . ' langPrefix . "_NEW'" . '); ?>'; } // add the close and new button if ($addNewButon == 2 || $addNewButon == 3) { - $head .= PHP_EOL.$tabB."\t".' langPrefix."_CLOSE_NEW'".'); ?>'; + $head .= PHP_EOL . $tabB . "\t" . ' langPrefix . "_CLOSE_NEW'" . '); ?>'; } // close group button if needed if ($addNewButon == 2) { - $head .= PHP_EOL."\t".'


'; + $head .= PHP_EOL . "\t" . '


'; } else { $head .= '

'; } - $head .= PHP_EOL.''.PHP_EOL; + $head .= PHP_EOL . '' . PHP_EOL; } - $head .= ''; + $head .= ''; // set the style for V2 - $metro_blue = (2 == $this->footableVersion) ? ' metro-blue':''; + $metro_blue = (2 == $this->footableVersion) ? ' metro-blue' : ''; // set the toggle for V3 - $toggle = (3 == $this->footableVersion) ? ' data-show-toggle="true" data-toggle-column="first"':''; + $toggle = (3 == $this->footableVersion) ? ' data-show-toggle="true" data-toggle-column="first"' : ''; // set paging - $paging = (2 == $this->footableVersion) ?' data-page-size="20" data-filter="#filter_'.$viewName_list.'"':' data-sorting="true" data-paging="true" data-paging-size="20" data-filtering="true"'; + $paging = (2 == $this->footableVersion) ? ' data-page-size="20" data-filter="#filter_' . $viewName_list . '"' : ' data-sorting="true" data-paging="true" data-paging-size="20" data-filtering="true"'; // add html fix for V3 - $htmlFix = (3 == $this->footableVersion) ? ' data-type="html" data-sort-use="text"':''; - $head .= PHP_EOL.''; - $head .= PHP_EOL.""; + $htmlFix = (3 == $this->footableVersion) ? ' data-type="html" data-sort-use="text"' : ''; + $head .= PHP_EOL . '
'; + $head .= PHP_EOL . ""; // main lang prefix - $langView = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($viewName_single,'U'); + $langView = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($viewName_single, 'U'); // set status lang - $statusLangName = $langView.'_STATUS'; + $statusLangName = $langView . '_STATUS'; // set id lang - $idLangName = $langView.'_ID'; + $idLangName = $langView . '_ID'; // make sure only first link is used as togeler $firstLink = true; // add to lang array @@ -7605,17 +7604,17 @@ class Interpretation extends Fields $this->langContent[$this->lang][$statusLangName] = 'Status'; } // add to lang array - if (!isset($this->langContent[$this->lang][$idLangName ])) + if (!isset($this->langContent[$this->lang][$idLangName])) { $this->langContent[$this->lang][$idLangName] = 'Id'; } - $head .= PHP_EOL."\t"; + $head .= PHP_EOL . "\t"; // set controller for data hiding options $controller = 1; // build the dynamic fields foreach ($this->listBuilder[$viewName_list] as $item) { - $setin = (2 == $this->footableVersion) ? ' data-hide="phone"':' data-breakpoints="xs sm"'; + $setin = (2 == $this->footableVersion) ? ' data-hide="phone"' : ' data-breakpoints="xs sm"'; if ($controller > 3) { $setin = (2 == $this->footableVersion) ? ' data-hide="phone,tablet"' : ' data-breakpoints="xs sm md"'; @@ -7623,31 +7622,31 @@ class Interpretation extends Fields if ($controller > 6) { - $setin = (2 == $this->footableVersion) ? ' data-hide="all"':' data-breakpoints="all"'; + $setin = (2 == $this->footableVersion) ? ' data-hide="all"' : ' data-breakpoints="all"'; } if ($item['link'] && $firstLink) { - $setin = (2 == $this->footableVersion) ? ' data-toggle="true"':''; + $setin = (2 == $this->footableVersion) ? ' data-toggle="true"' : ''; $firstLink = false; } - $head .= PHP_EOL."\t\t"; - $head .= PHP_EOL."\t\t\t"; - $head .= PHP_EOL."\t\t"; + $head .= PHP_EOL . "\t\t"; + $head .= PHP_EOL . "\t\t\t"; + $head .= PHP_EOL . "\t\t"; $controller++; } // set some V3 attr $data_hide = (2 == $this->footableVersion) ? 'data-hide="phone,tablet"' : 'data-breakpoints="xs sm md"'; - $data_type = (2 == $this->footableVersion) ? 'data-type="numeric"':'data-type="number"'; + $data_type = (2 == $this->footableVersion) ? 'data-type="numeric"' : 'data-type="number"'; // set default - $head .= PHP_EOL."\t\t".'"; - $head .= PHP_EOL."\t\t".'"; - $head .= PHP_EOL."\t"; - $head .= PHP_EOL.""; + $head .= PHP_EOL . "\t\t" . '"; + $head .= PHP_EOL . "\t\t" . '"; + $head .= PHP_EOL . "\t"; + $head .= PHP_EOL . ""; return $head; } @@ -7677,60 +7676,60 @@ class Interpretation extends Fields { $addCategory = false; } - $query = PHP_EOL.PHP_EOL."\t/**"; - $query .= PHP_EOL."\t* Method to get list data."; - $query .= PHP_EOL."\t*"; - $query .= PHP_EOL."\t* @return mixed An array of data items on success, false on failure."; - $query .= PHP_EOL."\t*/"; - $query .= PHP_EOL."\tpublic function get".$functionName."()"; - $query .= PHP_EOL."\t{"; + $query = PHP_EOL . PHP_EOL . "\t/**"; + $query .= PHP_EOL . "\t* Method to get list data."; + $query .= PHP_EOL . "\t*"; + $query .= PHP_EOL . "\t* @return mixed An array of data items on success, false on failure."; + $query .= PHP_EOL . "\t*/"; + $query .= PHP_EOL . "\tpublic function get" . $functionName . "()"; + $query .= PHP_EOL . "\t{"; // setup the query - $query .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the user object."; - $query .= PHP_EOL."\t\t\$user = JFactory::getUser();"; - $query .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Create a new query object."; - $query .= PHP_EOL."\t\t\$db = JFactory::getDBO();"; - $query .= PHP_EOL."\t\t\$query = \$db->getQuery(true);"; - $query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Select some fields"; - $query .= PHP_EOL."\t\t\$query->select('a.*');"; + $query .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the user object."; + $query .= PHP_EOL . "\t\t\$user = JFactory::getUser();"; + $query .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; + $query .= PHP_EOL . "\t\t\$db = JFactory::getDBO();"; + $query .= PHP_EOL . "\t\t\$query = \$db->getQuery(true);"; + $query .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Select some fields"; + $query .= PHP_EOL . "\t\t\$query->select('a.*');"; // add the category if ($addCategory) { - $query .= PHP_EOL."\t\t\$query->select(\$db->quoteName('c.title','category_title'));"; + $query .= PHP_EOL . "\t\t\$query->select(\$db->quoteName('c.title','category_title'));"; } - $query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." From the ".$this->fileContentStatic['###component###']."_".$viewName_single." table"; - $query .= PHP_EOL."\t\t\$query->from(\$db->quoteName('#__".$this->fileContentStatic['###component###']."_".$viewName_single."', 'a'));"; + $query .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " From the " . $this->fileContentStatic['###component###'] . "_" . $viewName_single . " table"; + $query .= PHP_EOL . "\t\t\$query->from(\$db->quoteName('#__" . $this->fileContentStatic['###component###'] . "_" . $viewName_single . "', 'a'));"; // add the category if ($addCategory) { - $query .= PHP_EOL."\t\t\$query->join('LEFT', \$db->quoteName('#__categories', 'c') . ' ON (' . \$db->quoteName('a.".$categoryCodeName."') . ' = ' . \$db->quoteName('c.id') . ')');"; + $query .= PHP_EOL . "\t\t\$query->join('LEFT', \$db->quoteName('#__categories', 'c') . ' ON (' . \$db->quoteName('a." . $categoryCodeName . "') . ' = ' . \$db->quoteName('c.id') . ')');"; } // add custom filtering php - $query .= $this->getCustomScriptBuilder('php_getlistquery', $viewName_single, PHP_EOL.PHP_EOL); + $query .= $this->getCustomScriptBuilder('php_getlistquery', $viewName_single, PHP_EOL . PHP_EOL); // add the custom fields query $query .= $this->setCustomQuery($viewName_list, $viewName_single); if (ComponentbuilderHelper::checkString($globalKey) && - $key && strpos($key,'-R>') === false && strpos($key,'-A>') === false && strpos($key,'-OR>') === false && - $parentKey && strpos($parentKey,'-R>') === false && strpos($parentKey,'-A>') === false && strpos($parentKey,'-OR>') === false) + $key && strpos($key, '-R>') === false && strpos($key, '-A>') === false && strpos($key, '-OR>') === false && + $parentKey && strpos($parentKey, '-R>') === false && strpos($parentKey, '-A>') === false && strpos($parentKey, '-OR>') === false) { - $query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Filter by ".$globalKey." global."; - $query .= PHP_EOL."\t\t\$".$globalKey." = \$this->".$globalKey.";"; - $query .= PHP_EOL."\t\tif (is_numeric(\$".$globalKey." ))"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$query->where('a.".$key." = ' . (int) \$".$globalKey." );"; - $query .= PHP_EOL."\t\t}"; - $query .= PHP_EOL."\t\telseif (is_string(\$".$globalKey."))"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$query->where('a.".$key." = ' . \$db->quote(\$".$globalKey."));"; - $query .= PHP_EOL."\t\t}"; - $query .= PHP_EOL."\t\telse"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$query->where('a.".$key." = -5');"; - $query .= PHP_EOL."\t\t}"; + $query .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Filter by " . $globalKey . " global."; + $query .= PHP_EOL . "\t\t\$" . $globalKey . " = \$this->" . $globalKey . ";"; + $query .= PHP_EOL . "\t\tif (is_numeric(\$" . $globalKey . " ))"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$query->where('a." . $key . " = ' . (int) \$" . $globalKey . " );"; + $query .= PHP_EOL . "\t\t}"; + $query .= PHP_EOL . "\t\telseif (is_string(\$" . $globalKey . "))"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$query->where('a." . $key . " = ' . \$db->quote(\$" . $globalKey . "));"; + $query .= PHP_EOL . "\t\t}"; + $query .= PHP_EOL . "\t\telse"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$query->where('a." . $key . " = -5');"; + $query .= PHP_EOL . "\t\t}"; } - elseif (strpos($parentKey,'-OR>') !== false || strpos($key,'-OR>') !== false) + elseif (strpos($parentKey, '-OR>') !== false || strpos($key, '-OR>') !== false) { // get both strings - if (strpos($key,'-OR>') !== false) + if (strpos($key, '-OR>') !== false) { $ORarray = explode('-OR>', $key); } @@ -7750,214 +7749,213 @@ class Interpretation extends Fields $ORquery = array('s' => array(), 'i' => array()); foreach ($ORarray as $ORkey) { - $ORquery['i'][] = "a.".$ORkey." = ' . (int) \$".$_globalKey; - $ORquery['s'][] = "a.".$ORkey." = ' . \$db->quote(\$".$_globalKey.")"; + $ORquery['i'][] = "a." . $ORkey . " = ' . (int) \$" . $_globalKey; + $ORquery['s'][] = "a." . $ORkey . " = ' . \$db->quote(\$" . $_globalKey . ")"; } - $query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Filter by ".$_globalKey." global."; - $query .= PHP_EOL."\t\t\$".$_globalKey." = \$this->".$_globalKey.";"; - $query .= PHP_EOL."\t\tif (is_numeric(\$".$_globalKey." ))"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$query->where('" . implode(" . ' OR ", $ORquery['i']) . ", ' OR');"; - $query .= PHP_EOL."\t\t}"; - $query .= PHP_EOL."\t\telseif (is_string(\$".$_globalKey."))"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$query->where('" . implode(" . ' OR ", $ORquery['s']) . ", ' OR');"; - $query .= PHP_EOL."\t\t}"; - $query .= PHP_EOL."\t\telse"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$query->where('a.".$ORkey." = -5');"; - $query .= PHP_EOL."\t\t}"; + $query .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Filter by " . $_globalKey . " global."; + $query .= PHP_EOL . "\t\t\$" . $_globalKey . " = \$this->" . $_globalKey . ";"; + $query .= PHP_EOL . "\t\tif (is_numeric(\$" . $_globalKey . " ))"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$query->where('" . implode(" . ' OR ", $ORquery['i']) . ", ' OR');"; + $query .= PHP_EOL . "\t\t}"; + $query .= PHP_EOL . "\t\telseif (is_string(\$" . $_globalKey . "))"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$query->where('" . implode(" . ' OR ", $ORquery['s']) . ", ' OR');"; + $query .= PHP_EOL . "\t\t}"; + $query .= PHP_EOL . "\t\telse"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$query->where('a." . $ORkey . " = -5');"; + $query .= PHP_EOL . "\t\t}"; } } if (isset($this->accessBuilder[$viewName_single]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName_single])) { - $query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Join over the asset groups."; - $query .= PHP_EOL."\t\t\$query->select('ag.title AS access_level');"; - $query .= PHP_EOL."\t\t\$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');"; - $query .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Filter by access level."; - $query .= PHP_EOL."\t\tif (\$access = \$this->getState('filter.access'))"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$query->where('a.access = ' . (int) \$access);"; - $query .= PHP_EOL."\t\t}"; - $query .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Implement View Level Access"; - $query .= PHP_EOL."\t\tif (!\$user->authorise('core.options', 'com_".$this->fileContentStatic['###component###']."'))"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$groups = implode(',', \$user->getAuthorisedViewLevels());"; - $query .= PHP_EOL."\t\t\t\$query->where('a.access IN (' . \$groups . ')');"; - $query .= PHP_EOL."\t\t}"; + $query .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Join over the asset groups."; + $query .= PHP_EOL . "\t\t\$query->select('ag.title AS access_level');"; + $query .= PHP_EOL . "\t\t\$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');"; + $query .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Filter by access level."; + $query .= PHP_EOL . "\t\tif (\$access = \$this->getState('filter.access'))"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$query->where('a.access = ' . (int) \$access);"; + $query .= PHP_EOL . "\t\t}"; + $query .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Implement View Level Access"; + $query .= PHP_EOL . "\t\tif (!\$user->authorise('core.options', 'com_" . $this->fileContentStatic['###component###'] . "'))"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$groups = implode(',', \$user->getAuthorisedViewLevels());"; + $query .= PHP_EOL . "\t\t\t\$query->where('a.access IN (' . \$groups . ')');"; + $query .= PHP_EOL . "\t\t}"; } - $query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Order the results by ordering"; - $query .= PHP_EOL."\t\t\$query->order('a.published ASC');"; - $query .= PHP_EOL."\t\t\$query->order('a.ordering ASC');"; - $query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Load the items"; - $query .= PHP_EOL."\t\t\$db->setQuery(\$query);"; - $query .= PHP_EOL."\t\t\$db->execute();"; - $query .= PHP_EOL."\t\tif (\$db->getNumRows())"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$items = \$db->loadObjectList();"; + $query .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Order the results by ordering"; + $query .= PHP_EOL . "\t\t\$query->order('a.published ASC');"; + $query .= PHP_EOL . "\t\t\$query->order('a.ordering ASC');"; + $query .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Load the items"; + $query .= PHP_EOL . "\t\t\$db->setQuery(\$query);"; + $query .= PHP_EOL . "\t\t\$db->execute();"; + $query .= PHP_EOL . "\t\tif (\$db->getNumRows())"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$items = \$db->loadObjectList();"; // ###STORE_METHOD_FIX### <<>> - $query .= $this->setGetItemsMethodStringFix($viewName_single,$this->fileContentStatic['###Component###'],"\t"); + $query .= $this->setGetItemsMethodStringFix($viewName_single, $this->fileContentStatic['###Component###'], "\t"); // ###SELECTIONTRANSLATIONFIX### <<>> - $query .= $this->setSelectionTranslationFix($viewName_list,$this->fileContentStatic['###Component###'],"\t"); + $query .= $this->setSelectionTranslationFix($viewName_list, $this->fileContentStatic['###Component###'], "\t"); // filter by child repetable field values - if (ComponentbuilderHelper::checkString($globalKey) && $key && strpos($key,'-R>') !== false && strpos($key,'-A>') === false) + if (ComponentbuilderHelper::checkString($globalKey) && $key && strpos($key, '-R>') !== false && strpos($key, '-A>') === false) { - list($field,$target) = explode('-R>',$key); - $query .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Filter by ".$globalKey." in this Repetable Field"; - $query .= PHP_EOL."\t\t\tif (".$this->fileContentStatic['###Component###']."Helper::checkArray(\$items) && isset(\$this->".$globalKey."))"; - $query .= PHP_EOL."\t\t\t{"; - $query .= PHP_EOL."\t\t\t\tforeach (\$items as \$nr => &\$item)"; - $query .= PHP_EOL."\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\tif (isset(\$item->".$field.") && ".$this->fileContentStatic['###Component###']."Helper::checkJson(\$item->".$field."))"; - $query .= PHP_EOL."\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\t\$tmpArray = json_decode(\$item->".$field.",true);"; - $query .= PHP_EOL."\t\t\t\t\t\tif (!isset(\$tmpArray['".$target."']) || !".$this->fileContentStatic['###Component###']."Helper::checkArray(\$tmpArray['".$target."']) || !in_array(\$this->".$globalKey.", \$tmpArray['".$target."']))"; - $query .= PHP_EOL."\t\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\t\tunset(\$items[\$nr]);"; - $query .= PHP_EOL."\t\t\t\t\t\t\tcontinue;"; - $query .= PHP_EOL."\t\t\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t\t\telse"; - $query .= PHP_EOL."\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\tunset(\$items[\$nr]);"; - $query .= PHP_EOL."\t\t\t\t\t\tcontinue;"; - $query .= PHP_EOL."\t\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t}"; - $query .= PHP_EOL."\t\t\telse"; - $query .= PHP_EOL."\t\t\t{"; - $query .= PHP_EOL."\t\t\t\treturn false;"; - $query .= PHP_EOL."\t\t\t}"; + list($field, $target) = explode('-R>', $key); + $query .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Filter by " . $globalKey . " in this Repetable Field"; + $query .= PHP_EOL . "\t\t\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$items) && isset(\$this->" . $globalKey . "))"; + $query .= PHP_EOL . "\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\tforeach (\$items as \$nr => &\$item)"; + $query .= PHP_EOL . "\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\tif (isset(\$item->" . $field . ") && " . $this->fileContentStatic['###Component###'] . "Helper::checkJson(\$item->" . $field . "))"; + $query .= PHP_EOL . "\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\t\$tmpArray = json_decode(\$item->" . $field . ",true);"; + $query .= PHP_EOL . "\t\t\t\t\t\tif (!isset(\$tmpArray['" . $target . "']) || !" . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$tmpArray['" . $target . "']) || !in_array(\$this->" . $globalKey . ", \$tmpArray['" . $target . "']))"; + $query .= PHP_EOL . "\t\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\t\tunset(\$items[\$nr]);"; + $query .= PHP_EOL . "\t\t\t\t\t\t\tcontinue;"; + $query .= PHP_EOL . "\t\t\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t\telse"; + $query .= PHP_EOL . "\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\tunset(\$items[\$nr]);"; + $query .= PHP_EOL . "\t\t\t\t\t\tcontinue;"; + $query .= PHP_EOL . "\t\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t}"; + $query .= PHP_EOL . "\t\t\telse"; + $query .= PHP_EOL . "\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\treturn false;"; + $query .= PHP_EOL . "\t\t\t}"; } // filter by child array field values - if (ComponentbuilderHelper::checkString($globalKey) && $key && strpos($key,'-R>') === false && strpos($key,'-A>') !== false) + if (ComponentbuilderHelper::checkString($globalKey) && $key && strpos($key, '-R>') === false && strpos($key, '-A>') !== false) { - $query .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Filter by ".$globalKey." Array Field"; - $query .= PHP_EOL."\t\t\t\$".$globalKey." = \$this->".$globalKey.";"; - $query .= PHP_EOL."\t\t\tif (".$this->fileContentStatic['###Component###']."Helper::checkArray(\$items) && \$".$globalKey.")"; - $query .= PHP_EOL."\t\t\t{"; - $query .= PHP_EOL."\t\t\t\tforeach (\$items as \$nr => &\$item)"; - $query .= PHP_EOL."\t\t\t\t{"; - list($bin,$target) = explode('-A>',$key); + $query .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Filter by " . $globalKey . " Array Field"; + $query .= PHP_EOL . "\t\t\t\$" . $globalKey . " = \$this->" . $globalKey . ";"; + $query .= PHP_EOL . "\t\t\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$items) && \$" . $globalKey . ")"; + $query .= PHP_EOL . "\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\tforeach (\$items as \$nr => &\$item)"; + $query .= PHP_EOL . "\t\t\t\t{"; + list($bin, $target) = explode('-A>', $key); if (ComponentbuilderHelper::checkString($target)) - { - $query .= PHP_EOL."\t\t\t\t\tif (".$this->fileContentStatic['###Component###']."Helper::checkJson(\$item->".$target."))"; - $query .= PHP_EOL."\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\t\$item->".$target." = json_decode(\$item->".$target.", true);"; - $query .= PHP_EOL."\t\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t\t\telseif (!isset(\$item->".$target.") || !".$this->fileContentStatic['###Component###']."Helper::checkArray(\$item->".$target."))"; - $query .= PHP_EOL."\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\tunset(\$items[\$nr]);"; - $query .= PHP_EOL."\t\t\t\t\t\tcontinue;"; - $query .= PHP_EOL."\t\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t\t\tif (!in_array(\$".$globalKey.",\$item->".$target."))"; + { + $query .= PHP_EOL . "\t\t\t\t\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkJson(\$item->" . $target . "))"; + $query .= PHP_EOL . "\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\t\$item->" . $target . " = json_decode(\$item->" . $target . ", true);"; + $query .= PHP_EOL . "\t\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t\telseif (!isset(\$item->" . $target . ") || !" . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$item->" . $target . "))"; + $query .= PHP_EOL . "\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\tunset(\$items[\$nr]);"; + $query .= PHP_EOL . "\t\t\t\t\t\tcontinue;"; + $query .= PHP_EOL . "\t\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t\tif (!in_array(\$" . $globalKey . ",\$item->" . $target . "))"; } else - { - $query .= PHP_EOL."\t\t\t\t\tif (".$this->fileContentStatic['###Component###']."Helper::checkJson(\$item->".$_key."))"; - $query .= PHP_EOL."\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\t\$item->".$_key." = json_decode(\$item->".$_key.", true);"; - $query .= PHP_EOL."\t\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t\t\telseif (!isset(\$item->".$_key.") || !".$this->fileContentStatic['###Component###']."Helper::checkArray(\$item->".$_key."))"; - $query .= PHP_EOL."\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\tunset(\$items[\$nr]);"; - $query .= PHP_EOL."\t\t\t\t\t\tcontinue;"; - $query .= PHP_EOL."\t\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t\t\tif (!in_array(\$".$globalKey.",\$item->".$_key."))"; + { + $query .= PHP_EOL . "\t\t\t\t\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkJson(\$item->" . $_key . "))"; + $query .= PHP_EOL . "\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\t\$item->" . $_key . " = json_decode(\$item->" . $_key . ", true);"; + $query .= PHP_EOL . "\t\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t\telseif (!isset(\$item->" . $_key . ") || !" . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$item->" . $_key . "))"; + $query .= PHP_EOL . "\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\tunset(\$items[\$nr]);"; + $query .= PHP_EOL . "\t\t\t\t\t\tcontinue;"; + $query .= PHP_EOL . "\t\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t\tif (!in_array(\$" . $globalKey . ",\$item->" . $_key . "))"; } - $query .= PHP_EOL."\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\tunset(\$items[\$nr]);"; - $query .= PHP_EOL."\t\t\t\t\t\tcontinue;"; - $query .= PHP_EOL."\t\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t}"; - $query .= PHP_EOL."\t\t\telse"; - $query .= PHP_EOL."\t\t\t{"; - $query .= PHP_EOL."\t\t\t\treturn false;"; - $query .= PHP_EOL."\t\t\t}"; - + $query .= PHP_EOL . "\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\tunset(\$items[\$nr]);"; + $query .= PHP_EOL . "\t\t\t\t\t\tcontinue;"; + $query .= PHP_EOL . "\t\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t}"; + $query .= PHP_EOL . "\t\t\telse"; + $query .= PHP_EOL . "\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\treturn false;"; + $query .= PHP_EOL . "\t\t\t}"; } // filter by parent repetable field values - if (ComponentbuilderHelper::checkString($globalKey) && $key && strpos($parentKey,'-R>') !== false && strpos($parentKey,'-A>') === false) + if (ComponentbuilderHelper::checkString($globalKey) && $key && strpos($parentKey, '-R>') !== false && strpos($parentKey, '-A>') === false) { - list($bin,$target) = explode('-R>',$parentKey); - $query .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Filter by ".$_key." Repetable Field"; - $query .= PHP_EOL."\t\t\t\$".$globalKey." = json_decode(\$this->".$globalKey.",true);"; - $query .= PHP_EOL."\t\t\tif (".$this->fileContentStatic['###Component###']."Helper::checkArray(\$items) && isset(\$".$globalKey.") && ".$this->fileContentStatic['###Component###']."Helper::checkArray(\$".$globalKey."))"; - $query .= PHP_EOL."\t\t\t{"; - $query .= PHP_EOL."\t\t\t\tforeach (\$items as \$nr => &\$item)"; - $query .= PHP_EOL."\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\tif (\$item->".$_key." && isset(\$".$globalKey."['".$target."']) && ".$this->fileContentStatic['###Component###']."Helper::checkArray(\$".$globalKey."['".$target."']))"; - $query .= PHP_EOL."\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\tif (!in_array(\$item->".$_key.",\$".$globalKey."['".$target."']))"; - $query .= PHP_EOL."\t\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\t\tunset(\$items[\$nr]);"; - $query .= PHP_EOL."\t\t\t\t\t\t\tcontinue;"; - $query .= PHP_EOL."\t\t\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t\t\telse"; - $query .= PHP_EOL."\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\tunset(\$items[\$nr]);"; - $query .= PHP_EOL."\t\t\t\t\t\tcontinue;"; - $query .= PHP_EOL."\t\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t}"; - $query .= PHP_EOL."\t\t\telse"; - $query .= PHP_EOL."\t\t\t{"; - $query .= PHP_EOL."\t\t\t\treturn false;"; - $query .= PHP_EOL."\t\t\t}"; + list($bin, $target) = explode('-R>', $parentKey); + $query .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Filter by " . $_key . " Repetable Field"; + $query .= PHP_EOL . "\t\t\t\$" . $globalKey . " = json_decode(\$this->" . $globalKey . ",true);"; + $query .= PHP_EOL . "\t\t\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$items) && isset(\$" . $globalKey . ") && " . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$" . $globalKey . "))"; + $query .= PHP_EOL . "\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\tforeach (\$items as \$nr => &\$item)"; + $query .= PHP_EOL . "\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\tif (\$item->" . $_key . " && isset(\$" . $globalKey . "['" . $target . "']) && " . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$" . $globalKey . "['" . $target . "']))"; + $query .= PHP_EOL . "\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\tif (!in_array(\$item->" . $_key . ",\$" . $globalKey . "['" . $target . "']))"; + $query .= PHP_EOL . "\t\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\t\tunset(\$items[\$nr]);"; + $query .= PHP_EOL . "\t\t\t\t\t\t\tcontinue;"; + $query .= PHP_EOL . "\t\t\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t\telse"; + $query .= PHP_EOL . "\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\tunset(\$items[\$nr]);"; + $query .= PHP_EOL . "\t\t\t\t\t\tcontinue;"; + $query .= PHP_EOL . "\t\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t}"; + $query .= PHP_EOL . "\t\t\telse"; + $query .= PHP_EOL . "\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\treturn false;"; + $query .= PHP_EOL . "\t\t\t}"; } // filter by parent array field values - if (ComponentbuilderHelper::checkString($globalKey) && $key && strpos($parentKey,'-R>') === false && strpos($parentKey,'-A>') !== false) + if (ComponentbuilderHelper::checkString($globalKey) && $key && strpos($parentKey, '-R>') === false && strpos($parentKey, '-A>') !== false) { - $query .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Filter by ".$globalKey." Array Field"; - $query .= PHP_EOL."\t\t\t\$".$globalKey." = \$this->".$globalKey.";"; - $query .= PHP_EOL."\t\t\tif (".$this->fileContentStatic['###Component###']."Helper::checkArray(\$items) && ".$this->fileContentStatic['###Component###']."Helper::checkArray(\$".$globalKey."))"; - $query .= PHP_EOL."\t\t\t{"; - $query .= PHP_EOL."\t\t\t\tforeach (\$items as \$nr => &\$item)"; - $query .= PHP_EOL."\t\t\t\t{"; - list($bin,$target) = explode('-A>',$parentKey); + $query .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Filter by " . $globalKey . " Array Field"; + $query .= PHP_EOL . "\t\t\t\$" . $globalKey . " = \$this->" . $globalKey . ";"; + $query .= PHP_EOL . "\t\t\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$items) && " . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$" . $globalKey . "))"; + $query .= PHP_EOL . "\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\tforeach (\$items as \$nr => &\$item)"; + $query .= PHP_EOL . "\t\t\t\t{"; + list($bin, $target) = explode('-A>', $parentKey); if (ComponentbuilderHelper::checkString($target)) { - $query .= PHP_EOL."\t\t\t\t\tif (\$item->".$_key." && ".$this->fileContentStatic['###Component###']."Helper::checkArray(\$".$globalKey."['".$target."']))"; - $query .= PHP_EOL."\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\tif (!in_array(\$item->".$_key.",\$".$globalKey."['".$target."']))"; + $query .= PHP_EOL . "\t\t\t\t\tif (\$item->" . $_key . " && " . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$" . $globalKey . "['" . $target . "']))"; + $query .= PHP_EOL . "\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\tif (!in_array(\$item->" . $_key . ",\$" . $globalKey . "['" . $target . "']))"; } else { - $query .= PHP_EOL."\t\t\t\t\tif (\$item->".$_key.")"; - $query .= PHP_EOL."\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\tif (!in_array(\$item->".$_key.",\$".$globalKey."))"; + $query .= PHP_EOL . "\t\t\t\t\tif (\$item->" . $_key . ")"; + $query .= PHP_EOL . "\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\tif (!in_array(\$item->" . $_key . ",\$" . $globalKey . "))"; } - $query .= PHP_EOL."\t\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\t\tunset(\$items[\$nr]);"; - $query .= PHP_EOL."\t\t\t\t\t\t\tcontinue;"; - $query .= PHP_EOL."\t\t\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t\t\telse"; - $query .= PHP_EOL."\t\t\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\t\tunset(\$items[\$nr]);"; - $query .= PHP_EOL."\t\t\t\t\t\tcontinue;"; - $query .= PHP_EOL."\t\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t\t}"; - $query .= PHP_EOL."\t\t\t}"; - $query .= PHP_EOL."\t\t\telse"; - $query .= PHP_EOL."\t\t\t{"; - $query .= PHP_EOL."\t\t\t\treturn false;"; - $query .= PHP_EOL."\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\t\tunset(\$items[\$nr]);"; + $query .= PHP_EOL . "\t\t\t\t\t\t\tcontinue;"; + $query .= PHP_EOL . "\t\t\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t\telse"; + $query .= PHP_EOL . "\t\t\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\t\tunset(\$items[\$nr]);"; + $query .= PHP_EOL . "\t\t\t\t\t\tcontinue;"; + $query .= PHP_EOL . "\t\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t\t}"; + $query .= PHP_EOL . "\t\t\t}"; + $query .= PHP_EOL . "\t\t\telse"; + $query .= PHP_EOL . "\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\treturn false;"; + $query .= PHP_EOL . "\t\t\t}"; } - // add custom php to getitems method after all - $query .= $this->getCustomScriptBuilder('php_getitems_after_all', $viewName_single, PHP_EOL.PHP_EOL."\t"); + // add custom php to getitems method after all + $query .= $this->getCustomScriptBuilder('php_getitems_after_all', $viewName_single, PHP_EOL . PHP_EOL . "\t"); - $query .= PHP_EOL."\t\t\treturn \$items;"; - $query .= PHP_EOL."\t\t}"; - $query .= PHP_EOL."\t\treturn false;"; - $query .= PHP_EOL."\t}"; + $query .= PHP_EOL . "\t\t\treturn \$items;"; + $query .= PHP_EOL . "\t\t}"; + $query .= PHP_EOL . "\t\treturn false;"; + $query .= PHP_EOL . "\t}"; // ###SELECTIONTRANSLATIONFIXFUNC###<<>> - $query .= $this->setSelectionTranslationFixFunc($viewName_list,$this->fileContentStatic['###Component###']); + $query .= $this->setSelectionTranslationFixFunc($viewName_list, $this->fileContentStatic['###Component###']); // fixe mothod name clash - $query = str_replace('selectionTranslation(','selectionTranslation'.$functionName.'(',$query); + $query = str_replace('selectionTranslation(', 'selectionTranslation' . $functionName . '(', $query); return $query; } @@ -7975,18 +7973,18 @@ class Interpretation extends Fields foreach ($this->customAdminDynamicButtons[$viewName_list] as $custom_button) { // Load to lang - $keyLang = $this->langPrefix.'_'.$custom_button['NAME']; - $this->langContent[$this->lang][$keyLang] = ComponentbuilderHelper::safeString($custom_button['name'],'Ww'); + $keyLang = $this->langPrefix . '_' . $custom_button['NAME']; + $this->langContent[$this->lang][$keyLang] = ComponentbuilderHelper::safeString($custom_button['name'], 'Ww'); // add cpanel button - $buttons[] = "\t\tif (\$this->canDo->get('".$custom_button['link'].".access'))"; + $buttons[] = "\t\tif (\$this->canDo->get('" . $custom_button['link'] . ".access'))"; $buttons[] = "\t\t{"; - $buttons[] = "\t\t\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button."; - $buttons[] = "\t\t\tJToolBarHelper::custom('".$viewName_list.".redirectTo".ComponentbuilderHelper::safeString($custom_button['link'],'F')."', '".$custom_button['icon']."', '', '".$keyLang."', true);"; + $buttons[] = "\t\t\t//" . $this->setLine(__LINE__) . " add " . $custom_button['name'] . " button."; + $buttons[] = "\t\t\tJToolBarHelper::custom('" . $viewName_list . ".redirectTo" . ComponentbuilderHelper::safeString($custom_button['link'], 'F') . "', '" . $custom_button['icon'] . "', '', '" . $keyLang . "', true);"; $buttons[] = "\t\t}"; } if (ComponentbuilderHelper::checkArray($buttons)) { - return implode(PHP_EOL,$buttons); + return implode(PHP_EOL, $buttons); } } return $buttons; @@ -8005,38 +8003,38 @@ class Interpretation extends Fields foreach ($this->customAdminDynamicButtons[$viewName_list] as $custom_button) { // add the custom redirect method - $method[] = PHP_EOL.PHP_EOL."\tpublic function redirectTo".ComponentbuilderHelper::safeString($custom_button['link'],'F')."()"; + $method[] = PHP_EOL . PHP_EOL . "\tpublic function redirectTo" . ComponentbuilderHelper::safeString($custom_button['link'], 'F') . "()"; $method[] = "\t{"; - $method[] = "\t\t//".$this->setLine(__LINE__)." Check for request forgeries"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " Check for request forgeries"; $method[] = "\t\tJSession::checkToken() or die(JText::_('JINVALID_TOKEN'));"; - $method[] = "\t\t//".$this->setLine(__LINE__)." check if export is allowed for this user."; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " check if export is allowed for this user."; $method[] = "\t\t\$user = JFactory::getUser();"; - $method[] = "\t\tif (\$user->authorise('".$custom_button['link'].".access', 'com_".$this->fileContentStatic['###component###']."'))"; + $method[] = "\t\tif (\$user->authorise('" . $custom_button['link'] . ".access', 'com_" . $this->fileContentStatic['###component###'] . "'))"; $method[] = "\t\t{"; - $method[] = "\t\t\t//".$this->setLine(__LINE__)." Get the input"; + $method[] = "\t\t\t//" . $this->setLine(__LINE__) . " Get the input"; $method[] = "\t\t\t\$input = JFactory::getApplication()->input;"; $method[] = "\t\t\t\$pks = \$input->post->get('cid', array(), 'array');"; - $method[] = "\t\t\t//".$this->setLine(__LINE__)." Sanitize the input"; + $method[] = "\t\t\t//" . $this->setLine(__LINE__) . " Sanitize the input"; $method[] = "\t\t\tJArrayHelper::toInteger(\$pks);"; - $method[] = "\t\t\t//".$this->setLine(__LINE__)." convert to string"; + $method[] = "\t\t\t//" . $this->setLine(__LINE__) . " convert to string"; $method[] = "\t\t\t\$ids = implode('_', \$pks);"; - $method[] = "\t\t\t\$this->setRedirect(JRoute::_('index.php?option=com_".$this->fileContentStatic['###component###']."&view=".$custom_button['link']."&cid='.\$ids, false));"; + $method[] = "\t\t\t\$this->setRedirect(JRoute::_('index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $custom_button['link'] . "&cid='.\$ids, false));"; $method[] = "\t\t\treturn;"; $method[] = "\t\t}"; - $method[] = "\t\t//".$this->setLine(__LINE__)." Redirect to the list screen with error."; - $method[] = "\t\t\$message = JText::_('".$this->langPrefix."_ACCESS_TO_".$custom_button['NAME']."_FAILED');"; - $method[] = "\t\t\$this->setRedirect(JRoute::_('index.php?option=com_".$this->fileContentStatic['###component###']."&view=".$viewName_list."', false), \$message, 'error');"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " Redirect to the list screen with error."; + $method[] = "\t\t\$message = JText::_('" . $this->langPrefix . "_ACCESS_TO_" . $custom_button['NAME'] . "_FAILED');"; + $method[] = "\t\t\$this->setRedirect(JRoute::_('index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $viewName_list . "', false), \$message, 'error');"; $method[] = "\t\treturn;"; $method[] = "\t}"; // add to lang array - $lankey = $this->langPrefix."_ACCESS_TO_".$custom_button['NAME']."_FAILED"; + $lankey = $this->langPrefix . "_ACCESS_TO_" . $custom_button['NAME'] . "_FAILED"; if (!isset($this->langContent[$this->lang][$lankey])) { - $this->langContent[$this->lang][$lankey] = 'Access to '.$custom_button['link'].' was denied.'; + $this->langContent[$this->lang][$lankey] = 'Access to ' . $custom_button['link'] . ' was denied.'; } } - return implode(PHP_EOL,$method); + return implode(PHP_EOL, $method); } return $method; } @@ -8051,83 +8049,83 @@ class Interpretation extends Fields $query = ''; if ($this->eximportView[$viewName_list]) { - $query = PHP_EOL.PHP_EOL."\t/**"; - $query .= PHP_EOL."\t* Method to get list export data."; - $query .= PHP_EOL."\t*"; - $query .= PHP_EOL."\t* @return mixed An array of data items on success, false on failure."; - $query .= PHP_EOL."\t*/"; - $query .= PHP_EOL."\tpublic function getExportData(\$pks)"; - $query .= PHP_EOL."\t{"; - $query .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." setup the query"; - $query .= PHP_EOL."\t\tif (".$this->fileContentStatic['###Component###']."Helper::checkArray(\$pks))"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Set a value to know this is exporting method."; - $query .= PHP_EOL."\t\t\t\$_export = true;"; - $query .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Get the user object."; - $query .= PHP_EOL."\t\t\t\$user = JFactory::getUser();"; - $query .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Create a new query object."; - $query .= PHP_EOL."\t\t\t\$db = JFactory::getDBO();"; - $query .= PHP_EOL."\t\t\t\$query = \$db->getQuery(true);"; - $query .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Select some fields"; - $query .= PHP_EOL."\t\t\t\$query->select('a.*');"; - $query .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." From the ".$this->fileContentStatic['###component###']."_".$viewName_single." table"; - $query .= PHP_EOL."\t\t\t\$query->from(\$db->quoteName('#__".$this->fileContentStatic['###component###']."_".$viewName_single."', 'a'));"; - $query .= PHP_EOL."\t\t\t\$query->where('a.id IN (' . implode(',',\$pks) . ')');"; + $query = PHP_EOL . PHP_EOL . "\t/**"; + $query .= PHP_EOL . "\t* Method to get list export data."; + $query .= PHP_EOL . "\t*"; + $query .= PHP_EOL . "\t* @return mixed An array of data items on success, false on failure."; + $query .= PHP_EOL . "\t*/"; + $query .= PHP_EOL . "\tpublic function getExportData(\$pks)"; + $query .= PHP_EOL . "\t{"; + $query .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " setup the query"; + $query .= PHP_EOL . "\t\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$pks))"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Set a value to know this is exporting method."; + $query .= PHP_EOL . "\t\t\t\$_export = true;"; + $query .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the user object."; + $query .= PHP_EOL . "\t\t\t\$user = JFactory::getUser();"; + $query .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; + $query .= PHP_EOL . "\t\t\t\$db = JFactory::getDBO();"; + $query .= PHP_EOL . "\t\t\t\$query = \$db->getQuery(true);"; + $query .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Select some fields"; + $query .= PHP_EOL . "\t\t\t\$query->select('a.*');"; + $query .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " From the " . $this->fileContentStatic['###component###'] . "_" . $viewName_single . " table"; + $query .= PHP_EOL . "\t\t\t\$query->from(\$db->quoteName('#__" . $this->fileContentStatic['###component###'] . "_" . $viewName_single . "', 'a'));"; + $query .= PHP_EOL . "\t\t\t\$query->where('a.id IN (' . implode(',',\$pks) . ')');"; // add custom filtering php - $query .= $this->getCustomScriptBuilder('php_getlistquery', $viewName_single, PHP_EOL.PHP_EOL."\t"); - + $query .= $this->getCustomScriptBuilder('php_getlistquery', $viewName_single, PHP_EOL . PHP_EOL . "\t"); + if (isset($this->accessBuilder[$viewName_single]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName_single])) { - $query .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Implement View Level Access"; - $query .= PHP_EOL."\t\t\tif (!\$user->authorise('core.options', 'com_".$this->fileContentStatic['###component###']."'))"; - $query .= PHP_EOL."\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\$groups = implode(',', \$user->getAuthorisedViewLevels());"; - $query .= PHP_EOL."\t\t\t\t\$query->where('a.access IN (' . \$groups . ')');"; - $query .= PHP_EOL."\t\t\t}"; + $query .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Implement View Level Access"; + $query .= PHP_EOL . "\t\t\tif (!\$user->authorise('core.options', 'com_" . $this->fileContentStatic['###component###'] . "'))"; + $query .= PHP_EOL . "\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\$groups = implode(',', \$user->getAuthorisedViewLevels());"; + $query .= PHP_EOL . "\t\t\t\t\$query->where('a.access IN (' . \$groups . ')');"; + $query .= PHP_EOL . "\t\t\t}"; } - $query .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Order the results by ordering"; - $query .= PHP_EOL."\t\t\t\$query->order('a.ordering ASC');"; - $query .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Load the items"; - $query .= PHP_EOL."\t\t\t\$db->setQuery(\$query);"; - $query .= PHP_EOL."\t\t\t\$db->execute();"; - $query .= PHP_EOL."\t\t\tif (\$db->getNumRows())"; - $query .= PHP_EOL."\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\$items = \$db->loadObjectList();"; + $query .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Order the results by ordering"; + $query .= PHP_EOL . "\t\t\t\$query->order('a.ordering ASC');"; + $query .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Load the items"; + $query .= PHP_EOL . "\t\t\t\$db->setQuery(\$query);"; + $query .= PHP_EOL . "\t\t\t\$db->execute();"; + $query .= PHP_EOL . "\t\t\tif (\$db->getNumRows())"; + $query .= PHP_EOL . "\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\$items = \$db->loadObjectList();"; $query .= $this->setGetItemsMethodStringFix($viewName_single, $this->fileContentStatic['###Component###'], "\t\t", true); - // add custom php to getitems method after all - $query .= $this->getCustomScriptBuilder('php_getitems_after_all', $viewName_single, PHP_EOL.PHP_EOL."\t\t"); - $query .= PHP_EOL."\t\t\t\treturn \$items;"; - $query .= PHP_EOL."\t\t\t}"; - $query .= PHP_EOL."\t\t}"; - $query .= PHP_EOL."\t\treturn false;"; - $query .= PHP_EOL."\t}"; + // add custom php to getitems method after all + $query .= $this->getCustomScriptBuilder('php_getitems_after_all', $viewName_single, PHP_EOL . PHP_EOL . "\t\t"); + $query .= PHP_EOL . "\t\t\t\treturn \$items;"; + $query .= PHP_EOL . "\t\t\t}"; + $query .= PHP_EOL . "\t\t}"; + $query .= PHP_EOL . "\t\treturn false;"; + $query .= PHP_EOL . "\t}"; - $query .= PHP_EOL.PHP_EOL."\t/**"; - $query .= PHP_EOL."\t* Method to get header."; - $query .= PHP_EOL."\t*"; - $query .= PHP_EOL."\t* @return mixed An array of data items on success, false on failure."; - $query .= PHP_EOL."\t*/"; - $query .= PHP_EOL."\tpublic function getExImPortHeaders()"; - $query .= PHP_EOL."\t{"; - $query .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get a db connection."; - $query .= PHP_EOL."\t\t\$db = JFactory::getDbo();"; - $query .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." get the columns"; - $query .= PHP_EOL."\t\t\$columns = \$db->getTableColumns(".'"#__'.$this->fileContentStatic['###component###'].'_'.$viewName_single.'");'; - $query .= PHP_EOL."\t\tif (".$this->fileContentStatic['###Component###']."Helper::checkArray(\$columns))"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." remove the headers you don't import/export."; - $query .= PHP_EOL."\t\t\tunset(\$columns['asset_id']);"; - $query .= PHP_EOL."\t\t\tunset(\$columns['checked_out']);"; - $query .= PHP_EOL."\t\t\tunset(\$columns['checked_out_time']);"; - $query .= PHP_EOL."\t\t\t\$headers = new stdClass();"; - $query .= PHP_EOL."\t\t\tforeach (\$columns as \$column => \$type)"; - $query .= PHP_EOL."\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\$headers->{\$column} = \$column;"; - $query .= PHP_EOL."\t\t\t}"; - $query .= PHP_EOL."\t\t\treturn \$headers;"; - $query .= PHP_EOL."\t\t}"; - $query .= PHP_EOL."\t\treturn false;"; - $query .= PHP_EOL."\t}"; + $query .= PHP_EOL . PHP_EOL . "\t/**"; + $query .= PHP_EOL . "\t* Method to get header."; + $query .= PHP_EOL . "\t*"; + $query .= PHP_EOL . "\t* @return mixed An array of data items on success, false on failure."; + $query .= PHP_EOL . "\t*/"; + $query .= PHP_EOL . "\tpublic function getExImPortHeaders()"; + $query .= PHP_EOL . "\t{"; + $query .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get a db connection."; + $query .= PHP_EOL . "\t\t\$db = JFactory::getDbo();"; + $query .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " get the columns"; + $query .= PHP_EOL . "\t\t\$columns = \$db->getTableColumns(" . '"#__' . $this->fileContentStatic['###component###'] . '_' . $viewName_single . '");'; + $query .= PHP_EOL . "\t\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$columns))"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " remove the headers you don't import/export."; + $query .= PHP_EOL . "\t\t\tunset(\$columns['asset_id']);"; + $query .= PHP_EOL . "\t\t\tunset(\$columns['checked_out']);"; + $query .= PHP_EOL . "\t\t\tunset(\$columns['checked_out_time']);"; + $query .= PHP_EOL . "\t\t\t\$headers = new stdClass();"; + $query .= PHP_EOL . "\t\t\tforeach (\$columns as \$column => \$type)"; + $query .= PHP_EOL . "\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\$headers->{\$column} = \$column;"; + $query .= PHP_EOL . "\t\t\t}"; + $query .= PHP_EOL . "\t\t\treturn \$headers;"; + $query .= PHP_EOL . "\t\t}"; + $query .= PHP_EOL . "\t\treturn false;"; + $query .= PHP_EOL . "\t}"; } return $query; } @@ -8140,83 +8138,83 @@ class Interpretation extends Fields $method = array(); // add the export method - $method[] = PHP_EOL.PHP_EOL."\tpublic function exportData()"; + $method[] = PHP_EOL . PHP_EOL . "\tpublic function exportData()"; $method[] = "\t{"; - $method[] = "\t\t//".$this->setLine(__LINE__)." Check for request forgeries"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " Check for request forgeries"; $method[] = "\t\tJSession::checkToken() or die(JText::_('JINVALID_TOKEN'));"; - $method[] = "\t\t//".$this->setLine(__LINE__)." check if export is allowed for this user."; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " check if export is allowed for this user."; $method[] = "\t\t\$user = JFactory::getUser();"; - $method[] = "\t\tif (\$user->authorise('".$viewName_single.".export', 'com_".$this->fileContentStatic['###component###']."') && \$user->authorise('core.export', 'com_".$this->fileContentStatic['###component###']."'))"; + $method[] = "\t\tif (\$user->authorise('" . $viewName_single . ".export', 'com_" . $this->fileContentStatic['###component###'] . "') && \$user->authorise('core.export', 'com_" . $this->fileContentStatic['###component###'] . "'))"; $method[] = "\t\t{"; - $method[] = "\t\t\t//".$this->setLine(__LINE__)." Get the input"; + $method[] = "\t\t\t//" . $this->setLine(__LINE__) . " Get the input"; $method[] = "\t\t\t\$input = JFactory::getApplication()->input;"; $method[] = "\t\t\t\$pks = \$input->post->get('cid', array(), 'array');"; - $method[] = "\t\t\t//".$this->setLine(__LINE__)." Sanitize the input"; + $method[] = "\t\t\t//" . $this->setLine(__LINE__) . " Sanitize the input"; $method[] = "\t\t\tJArrayHelper::toInteger(\$pks);"; - $method[] = "\t\t\t//".$this->setLine(__LINE__)." Get the model"; - $method[] = "\t\t\t\$model = \$this->getModel('".ComponentbuilderHelper::safeString($viewName_list,'F')."');"; - $method[] = "\t\t\t//".$this->setLine(__LINE__)." get the data to export"; + $method[] = "\t\t\t//" . $this->setLine(__LINE__) . " Get the model"; + $method[] = "\t\t\t\$model = \$this->getModel('" . ComponentbuilderHelper::safeString($viewName_list, 'F') . "');"; + $method[] = "\t\t\t//" . $this->setLine(__LINE__) . " get the data to export"; $method[] = "\t\t\t\$data = \$model->getExportData(\$pks);"; - $method[] = "\t\t\tif (".$this->fileContentStatic['###Component###']."Helper::checkArray(\$data))"; + $method[] = "\t\t\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$data))"; $method[] = "\t\t\t{"; - $method[] = "\t\t\t\t//".$this->setLine(__LINE__)." now set the data to the spreadsheet"; + $method[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " now set the data to the spreadsheet"; $method[] = "\t\t\t\t\$date = JFactory::getDate();"; - $method[] = "\t\t\t\t".$this->fileContentStatic['###Component###']."Helper::xls(\$data,'".ComponentbuilderHelper::safeString($viewName_list,'F')."_'.\$date->format('jS_F_Y'),'".ComponentbuilderHelper::safeString($viewName_list,'Ww')." exported ('.\$date->format('jS F, Y').')','".ComponentbuilderHelper::safeString($viewName_list,'w')."');"; + $method[] = "\t\t\t\t" . $this->fileContentStatic['###Component###'] . "Helper::xls(\$data,'" . ComponentbuilderHelper::safeString($viewName_list, 'F') . "_'.\$date->format('jS_F_Y'),'" . ComponentbuilderHelper::safeString($viewName_list, 'Ww') . " exported ('.\$date->format('jS F, Y').')','" . ComponentbuilderHelper::safeString($viewName_list, 'w') . "');"; $method[] = "\t\t\t}"; $method[] = "\t\t}"; - $method[] = "\t\t//".$this->setLine(__LINE__)." Redirect to the list screen with error."; - $method[] = "\t\t\$message = JText::_('".$this->langPrefix."_EXPORT_FAILED');"; - $method[] = "\t\t\$this->setRedirect(JRoute::_('index.php?option=com_".$this->fileContentStatic['###component###']."&view=".$viewName_list."', false), \$message, 'error');"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " Redirect to the list screen with error."; + $method[] = "\t\t\$message = JText::_('" . $this->langPrefix . "_EXPORT_FAILED');"; + $method[] = "\t\t\$this->setRedirect(JRoute::_('index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $viewName_list . "', false), \$message, 'error');"; $method[] = "\t\treturn;"; $method[] = "\t}"; // add the import method - $method[] = PHP_EOL.PHP_EOL."\tpublic function importData()"; + $method[] = PHP_EOL . PHP_EOL . "\tpublic function importData()"; $method[] = "\t{"; - $method[] = "\t\t//".$this->setLine(__LINE__)." Check for request forgeries"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " Check for request forgeries"; $method[] = "\t\tJSession::checkToken() or die(JText::_('JINVALID_TOKEN'));"; - $method[] = "\t\t//".$this->setLine(__LINE__)." check if import is allowed for this user."; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " check if import is allowed for this user."; $method[] = "\t\t\$user = JFactory::getUser();"; - $method[] = "\t\tif (\$user->authorise('".$viewName_single.".import', 'com_".$this->fileContentStatic['###component###']."') && \$user->authorise('core.import', 'com_".$this->fileContentStatic['###component###']."'))"; + $method[] = "\t\tif (\$user->authorise('" . $viewName_single . ".import', 'com_" . $this->fileContentStatic['###component###'] . "') && \$user->authorise('core.import', 'com_" . $this->fileContentStatic['###component###'] . "'))"; $method[] = "\t\t{"; - $method[] = "\t\t\t//".$this->setLine(__LINE__)." Get the import model"; - $method[] = "\t\t\t\$model = \$this->getModel('".ComponentbuilderHelper::safeString($viewName_list,'F')."');"; - $method[] = "\t\t\t//".$this->setLine(__LINE__)." get the headers to import"; + $method[] = "\t\t\t//" . $this->setLine(__LINE__) . " Get the import model"; + $method[] = "\t\t\t\$model = \$this->getModel('" . ComponentbuilderHelper::safeString($viewName_list, 'F') . "');"; + $method[] = "\t\t\t//" . $this->setLine(__LINE__) . " get the headers to import"; $method[] = "\t\t\t\$headers = \$model->getExImPortHeaders();"; - $method[] = "\t\t\tif (".$this->fileContentStatic['###Component###']."Helper::checkObject(\$headers))"; + $method[] = "\t\t\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkObject(\$headers))"; $method[] = "\t\t\t{"; - $method[] = "\t\t\t\t//".$this->setLine(__LINE__)." Load headers to session."; + $method[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " Load headers to session."; $method[] = "\t\t\t\t\$session = JFactory::getSession();"; $method[] = "\t\t\t\t\$headers = json_encode(\$headers);"; - $method[] = "\t\t\t\t\$session->set('".$viewName_single."_VDM_IMPORTHEADERS', \$headers);"; - $method[] = "\t\t\t\t\$session->set('backto_VDM_IMPORT', '".$viewName_list."');"; - $method[] = "\t\t\t\t\$session->set('dataType_VDM_IMPORTINTO', '".$viewName_single."');"; - $method[] = "\t\t\t\t//".$this->setLine(__LINE__)." Redirect to import view."; + $method[] = "\t\t\t\t\$session->set('" . $viewName_single . "_VDM_IMPORTHEADERS', \$headers);"; + $method[] = "\t\t\t\t\$session->set('backto_VDM_IMPORT', '" . $viewName_list . "');"; + $method[] = "\t\t\t\t\$session->set('dataType_VDM_IMPORTINTO', '" . $viewName_single . "');"; + $method[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " Redirect to import view."; // add to lang array - $selectImportFileNote = $this->langPrefix."_IMPORT_SELECT_FILE_FOR_".ComponentbuilderHelper::safeString($viewName_list,'U'); + $selectImportFileNote = $this->langPrefix . "_IMPORT_SELECT_FILE_FOR_" . ComponentbuilderHelper::safeString($viewName_list, 'U'); if (!isset($this->langContent[$this->lang][$selectImportFileNote])) { - $this->langContent[$this->lang][$selectImportFileNote] = 'Select the file to import data to '.$viewName_list.'.'; + $this->langContent[$this->lang][$selectImportFileNote] = 'Select the file to import data to ' . $viewName_list . '.'; } - $method[] = "\t\t\t\t\$message = JText::_('".$selectImportFileNote."');"; + $method[] = "\t\t\t\t\$message = JText::_('" . $selectImportFileNote . "');"; // if this view has custom script it must have as custom import (model, veiw, controller) if (isset($this->importCustomScripts[$viewName_list]) && $this->importCustomScripts[$viewName_list]) { - $method[] = "\t\t\t\t\$this->setRedirect(JRoute::_('index.php?option=com_".$this->fileContentStatic['###component###']."&view=import_".$viewName_list."', false), \$message);"; + $method[] = "\t\t\t\t\$this->setRedirect(JRoute::_('index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=import_" . $viewName_list . "', false), \$message);"; } else { - $method[] = "\t\t\t\t\$this->setRedirect(JRoute::_('index.php?option=com_".$this->fileContentStatic['###component###']."&view=import', false), \$message);"; + $method[] = "\t\t\t\t\$this->setRedirect(JRoute::_('index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=import', false), \$message);"; } $method[] = "\t\t\t\treturn;"; $method[] = "\t\t\t}"; $method[] = "\t\t}"; - $method[] = "\t\t//".$this->setLine(__LINE__)." Redirect to the list screen with error."; - $method[] = "\t\t\$message = JText::_('".$this->langPrefix."_IMPORT_FAILED');"; - $method[] = "\t\t\$this->setRedirect(JRoute::_('index.php?option=com_".$this->fileContentStatic['###component###']."&view=".$viewName_list."', false), \$message, 'error');"; + $method[] = "\t\t//" . $this->setLine(__LINE__) . " Redirect to the list screen with error."; + $method[] = "\t\t\$message = JText::_('" . $this->langPrefix . "_IMPORT_FAILED');"; + $method[] = "\t\t\$this->setRedirect(JRoute::_('index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $viewName_list . "', false), \$message, 'error');"; $method[] = "\t\treturn;"; $method[] = "\t}"; - return implode(PHP_EOL,$method); + return implode(PHP_EOL, $method); } return $method; } @@ -8227,18 +8225,18 @@ class Interpretation extends Fields if (isset($this->eximportView[$viewName_list]) && $this->eximportView[$viewName_list]) { // main lang prefix - $langExport = $this->langPrefix.'_'.ComponentbuilderHelper::safeString('Export Data','U'); + $langExport = $this->langPrefix . '_' . ComponentbuilderHelper::safeString('Export Data', 'U'); // add to lang array if (!isset($this->langContent[$this->lang][$langExport])) { $this->langContent[$this->lang][$langExport] = 'Export Data'; } $button = array(); - $button[] = PHP_EOL.PHP_EOL."\t\t\tif (\$this->canDo->get('core.export') && \$this->canDo->get('".$viewName_single.".export'))"; + $button[] = PHP_EOL . PHP_EOL . "\t\t\tif (\$this->canDo->get('core.export') && \$this->canDo->get('" . $viewName_single . ".export'))"; $button[] = "\t\t\t{"; - $button[] = "\t\t\t\tJToolBarHelper::custom('".$viewName_list.".exportData', 'download', '', '".$langExport."', true);"; + $button[] = "\t\t\t\tJToolBarHelper::custom('" . $viewName_list . ".exportData', 'download', '', '" . $langExport . "', true);"; $button[] = "\t\t\t}"; - return implode(PHP_EOL,$button); + return implode(PHP_EOL, $button); } return $button; } @@ -8249,18 +8247,18 @@ class Interpretation extends Fields if (isset($this->eximportView[$viewName_list]) && $this->eximportView[$viewName_list]) { // main lang prefix - $langImport = $this->langPrefix.'_'.ComponentbuilderHelper::safeString('Import Data','U'); + $langImport = $this->langPrefix . '_' . ComponentbuilderHelper::safeString('Import Data', 'U'); // add to lang array if (!isset($this->langContent[$this->lang][$langImport])) { $this->langContent[$this->lang][$langImport] = 'Import Data'; } $button = array(); - $button[] = PHP_EOL.PHP_EOL."\t\tif (\$this->canDo->get('core.import') && \$this->canDo->get('".$viewName_single.".import'))"; + $button[] = PHP_EOL . PHP_EOL . "\t\tif (\$this->canDo->get('core.import') && \$this->canDo->get('" . $viewName_single . ".import'))"; $button[] = "\t\t{"; - $button[] = "\t\t\tJToolBarHelper::custom('".$viewName_list.".importData', 'upload', '', '".$langImport."', false);"; + $button[] = "\t\t\tJToolBarHelper::custom('" . $viewName_list . ".importData', 'upload', '', '" . $langImport . "', false);"; $button[] = "\t\t}"; - return implode(PHP_EOL,$button); + return implode(PHP_EOL, $button); } return $button; } @@ -8268,31 +8266,31 @@ class Interpretation extends Fields public function setImportCustomScripts($viewName_list) { // setup Ajax files - $target = array('admin' => 'import_'.$viewName_list); + $target = array('admin' => 'import_' . $viewName_list); $this->buildDynamique($target, 'customimport'); // load the custom script to the files // ###IMPORT_EXT_METHOD_CUSTOM### <<>> - $this->fileContentDynamic['import_'.$viewName_list]['###IMPORT_EXT_METHOD_CUSTOM###'] = $this->getCustomScriptBuilder('php_import_ext', 'import_'.$viewName_list, PHP_EOL, null, true); - // ###IMPORT_DISPLAY_METHOD_CUSTOM### <<>> - $this->fileContentDynamic['import_'.$viewName_list]['###IMPORT_DISPLAY_METHOD_CUSTOM###'] = $this->getCustomScriptBuilder('php_import_display', 'import_'.$viewName_list, PHP_EOL, null, true); - // ###IMPORT_SETDATE_METHOD_CUSTOM### <<>> - $this->fileContentDynamic['import_'.$viewName_list]['###IMPORT_SETDATE_METHOD_CUSTOM###'] = $this->getCustomScriptBuilder('php_import_setdata', 'import_'.$viewName_list, PHP_EOL, null, true); - // ###IMPORT_METHOD_CUSTOM### <<>> - $this->fileContentDynamic['import_'.$viewName_list]['###IMPORT_METHOD_CUSTOM###'] = $this->getCustomScriptBuilder('php_import', 'import_'.$viewName_list, PHP_EOL, null, true); - // ###IMPORT_SAVE_METHOD_CUSTOM### <<>> - $this->fileContentDynamic['import_'.$viewName_list]['###IMPORT_SAVE_METHOD_CUSTOM###'] = $this->getCustomScriptBuilder('php_import_save', 'import_'.$viewName_list, PHP_EOL, null, true); - // ###IMPORT_DEFAULT_VIEW_CUSTOM### <<>> - $this->fileContentDynamic['import_'.$viewName_list]['###IMPORT_DEFAULT_VIEW_CUSTOM###'] = $this->getCustomScriptBuilder('html_import_view', 'import_'.$viewName_list, PHP_EOL, null, true); - + $this->fileContentDynamic['import_' . $viewName_list]['###IMPORT_EXT_METHOD_CUSTOM###'] = $this->getCustomScriptBuilder('php_import_ext', 'import_' . $viewName_list, PHP_EOL, null, true); + // ###IMPORT_DISPLAY_METHOD_CUSTOM### <<>> + $this->fileContentDynamic['import_' . $viewName_list]['###IMPORT_DISPLAY_METHOD_CUSTOM###'] = $this->getCustomScriptBuilder('php_import_display', 'import_' . $viewName_list, PHP_EOL, null, true); + // ###IMPORT_SETDATE_METHOD_CUSTOM### <<>> + $this->fileContentDynamic['import_' . $viewName_list]['###IMPORT_SETDATE_METHOD_CUSTOM###'] = $this->getCustomScriptBuilder('php_import_setdata', 'import_' . $viewName_list, PHP_EOL, null, true); + // ###IMPORT_METHOD_CUSTOM### <<>> + $this->fileContentDynamic['import_' . $viewName_list]['###IMPORT_METHOD_CUSTOM###'] = $this->getCustomScriptBuilder('php_import', 'import_' . $viewName_list, PHP_EOL, null, true); + // ###IMPORT_SAVE_METHOD_CUSTOM### <<>> + $this->fileContentDynamic['import_' . $viewName_list]['###IMPORT_SAVE_METHOD_CUSTOM###'] = $this->getCustomScriptBuilder('php_import_save', 'import_' . $viewName_list, PHP_EOL, null, true); + // ###IMPORT_DEFAULT_VIEW_CUSTOM### <<>> + $this->fileContentDynamic['import_' . $viewName_list]['###IMPORT_DEFAULT_VIEW_CUSTOM###'] = $this->getCustomScriptBuilder('html_import_view', 'import_' . $viewName_list, PHP_EOL, null, true); + // insure we have the view placeholders setup - $this->fileContentDynamic['import_'.$viewName_list]['###VIEW###'] = 'IMPORT_'.$this->placeholders['###VIEWS###']; - $this->fileContentDynamic['import_'.$viewName_list]['###View###'] = 'Import_'.$this->placeholders['###views###']; - $this->fileContentDynamic['import_'.$viewName_list]['###view###'] = 'import_'.$this->placeholders['###views###']; - $this->fileContentDynamic['import_'.$viewName_list]['###VIEWS###'] = 'IMPORT_'.$this->placeholders['###VIEWS###']; - $this->fileContentDynamic['import_'.$viewName_list]['###Views###'] = 'Import_'.$this->placeholders['###views###']; - $this->fileContentDynamic['import_'.$viewName_list]['###views###'] = 'import_'.$this->placeholders['###views###']; + $this->fileContentDynamic['import_' . $viewName_list]['###VIEW###'] = 'IMPORT_' . $this->placeholders['###VIEWS###']; + $this->fileContentDynamic['import_' . $viewName_list]['###View###'] = 'Import_' . $this->placeholders['###views###']; + $this->fileContentDynamic['import_' . $viewName_list]['###view###'] = 'import_' . $this->placeholders['###views###']; + $this->fileContentDynamic['import_' . $viewName_list]['###VIEWS###'] = 'IMPORT_' . $this->placeholders['###VIEWS###']; + $this->fileContentDynamic['import_' . $viewName_list]['###Views###'] = 'Import_' . $this->placeholders['###views###']; + $this->fileContentDynamic['import_' . $viewName_list]['###views###'] = 'import_' . $this->placeholders['###views###']; } - + public function setListQuery($viewName_single, $viewName_list) { // check if this view has category added @@ -8306,55 +8304,55 @@ class Interpretation extends Fields $addCategory = false; } // setup the query - $query = "//".$this->setLine(__LINE__)." Get the user object."; - $query .= PHP_EOL."\t\t\$user = JFactory::getUser();"; - $query .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Create a new query object."; - $query .= PHP_EOL."\t\t\$db = JFactory::getDBO();"; - $query .= PHP_EOL."\t\t\$query = \$db->getQuery(true);"; - $query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Select some fields"; - $query .= PHP_EOL."\t\t\$query->select('a.*');"; + $query = "//" . $this->setLine(__LINE__) . " Get the user object."; + $query .= PHP_EOL . "\t\t\$user = JFactory::getUser();"; + $query .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; + $query .= PHP_EOL . "\t\t\$db = JFactory::getDBO();"; + $query .= PHP_EOL . "\t\t\$query = \$db->getQuery(true);"; + $query .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Select some fields"; + $query .= PHP_EOL . "\t\t\$query->select('a.*');"; // add the category if ($addCategory) { - $query .= PHP_EOL."\t\t\$query->select(\$db->quoteName('c.title','category_title'));"; + $query .= PHP_EOL . "\t\t\$query->select(\$db->quoteName('c.title','category_title'));"; } - $query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." From the ".$this->fileContentStatic['###component###']."_item table"; - $query .= PHP_EOL."\t\t\$query->from(\$db->quoteName('#__".$this->fileContentStatic['###component###']."_".$viewName_single."', 'a'));"; + $query .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " From the " . $this->fileContentStatic['###component###'] . "_item table"; + $query .= PHP_EOL . "\t\t\$query->from(\$db->quoteName('#__" . $this->fileContentStatic['###component###'] . "_" . $viewName_single . "', 'a'));"; // add the category if ($addCategory) { - $query .= PHP_EOL."\t\t\$query->join('LEFT', \$db->quoteName('#__categories', 'c') . ' ON (' . \$db->quoteName('a.".$categoryCodeName."') . ' = ' . \$db->quoteName('c.id') . ')');"; + $query .= PHP_EOL . "\t\t\$query->join('LEFT', \$db->quoteName('#__categories', 'c') . ' ON (' . \$db->quoteName('a." . $categoryCodeName . "') . ' = ' . \$db->quoteName('c.id') . ')');"; } // add custom filtering php - $query .= $this->getCustomScriptBuilder('php_getlistquery', $viewName_single, PHP_EOL.PHP_EOL); + $query .= $this->getCustomScriptBuilder('php_getlistquery', $viewName_single, PHP_EOL . PHP_EOL); // add the custom fields query $query .= $this->setCustomQuery($viewName_list, $viewName_single); - $query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Filter by published state"; - $query .= PHP_EOL."\t\t\$published = \$this->getState('filter.published');"; - $query .= PHP_EOL."\t\tif (is_numeric(\$published))"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$query->where('a.published = ' . (int) \$published);"; - $query .= PHP_EOL."\t\t}"; - $query .= PHP_EOL."\t\telseif (\$published === '')"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$query->where('(a.published = 0 OR a.published = 1)');"; - $query .= PHP_EOL."\t\t}"; + $query .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Filter by published state"; + $query .= PHP_EOL . "\t\t\$published = \$this->getState('filter.published');"; + $query .= PHP_EOL . "\t\tif (is_numeric(\$published))"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$query->where('a.published = ' . (int) \$published);"; + $query .= PHP_EOL . "\t\t}"; + $query .= PHP_EOL . "\t\telseif (\$published === '')"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$query->where('(a.published = 0 OR a.published = 1)');"; + $query .= PHP_EOL . "\t\t}"; if (isset($this->accessBuilder[$viewName_single]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName_single])) { - $query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Join over the asset groups."; - $query .= PHP_EOL."\t\t\$query->select('ag.title AS access_level');"; - $query .= PHP_EOL."\t\t\$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');"; - $query .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Filter by access level."; - $query .= PHP_EOL."\t\tif (\$access = \$this->getState('filter.access'))"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$query->where('a.access = ' . (int) \$access);"; - $query .= PHP_EOL."\t\t}"; - $query .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Implement View Level Access"; - $query .= PHP_EOL."\t\tif (!\$user->authorise('core.options', 'com_".$this->fileContentStatic['###component###']."'))"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$groups = implode(',', \$user->getAuthorisedViewLevels());"; - $query .= PHP_EOL."\t\t\t\$query->where('a.access IN (' . \$groups . ')');"; - $query .= PHP_EOL."\t\t}"; + $query .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Join over the asset groups."; + $query .= PHP_EOL . "\t\t\$query->select('ag.title AS access_level');"; + $query .= PHP_EOL . "\t\t\$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');"; + $query .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Filter by access level."; + $query .= PHP_EOL . "\t\tif (\$access = \$this->getState('filter.access'))"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$query->where('a.access = ' . (int) \$access);"; + $query .= PHP_EOL . "\t\t}"; + $query .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Implement View Level Access"; + $query .= PHP_EOL . "\t\tif (!\$user->authorise('core.options', 'com_" . $this->fileContentStatic['###component###'] . "'))"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$groups = implode(',', \$user->getAuthorisedViewLevels());"; + $query .= PHP_EOL . "\t\t\t\$query->where('a.access IN (' . \$groups . ')');"; + $query .= PHP_EOL . "\t\t}"; } // set the search query $query .= $this->setSearchQuery($viewName_list); @@ -8363,37 +8361,37 @@ class Interpretation extends Fields // add the category if ($addCategory) { - $query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Filter by a single or group of categories."; - $query .= PHP_EOL."\t\t\$baselevel = 1;"; - $query .= PHP_EOL."\t\t\$categoryId = \$this->getState('filter.category_id');"; + $query .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Filter by a single or group of categories."; + $query .= PHP_EOL . "\t\t\$baselevel = 1;"; + $query .= PHP_EOL . "\t\t\$categoryId = \$this->getState('filter.category_id');"; $query .= PHP_EOL; - $query .= PHP_EOL."\t\tif (is_numeric(\$categoryId))"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$cat_tbl = JTable::getInstance('Category', 'JTable');"; - $query .= PHP_EOL."\t\t\t\$cat_tbl->load(\$categoryId);"; - $query .= PHP_EOL."\t\t\t\$rgt = \$cat_tbl->rgt;"; - $query .= PHP_EOL."\t\t\t\$lft = \$cat_tbl->lft;"; - $query .= PHP_EOL."\t\t\t\$baselevel = (int) \$cat_tbl->level;"; - $query .= PHP_EOL."\t\t\t\$query->where('c.lft >= ' . (int) \$lft)"; - $query .= PHP_EOL."\t\t\t\t->where('c.rgt <= ' . (int) \$rgt);"; - $query .= PHP_EOL."\t\t}"; - $query .= PHP_EOL."\t\telseif (is_array(\$categoryId))"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\tJArrayHelper::toInteger(\$categoryId);"; - $query .= PHP_EOL."\t\t\t\$categoryId = implode(',', \$categoryId);"; - $query .= PHP_EOL."\t\t\t\$query->where('a.category IN (' . \$categoryId . ')');"; - $query .= PHP_EOL."\t\t}"; + $query .= PHP_EOL . "\t\tif (is_numeric(\$categoryId))"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$cat_tbl = JTable::getInstance('Category', 'JTable');"; + $query .= PHP_EOL . "\t\t\t\$cat_tbl->load(\$categoryId);"; + $query .= PHP_EOL . "\t\t\t\$rgt = \$cat_tbl->rgt;"; + $query .= PHP_EOL . "\t\t\t\$lft = \$cat_tbl->lft;"; + $query .= PHP_EOL . "\t\t\t\$baselevel = (int) \$cat_tbl->level;"; + $query .= PHP_EOL . "\t\t\t\$query->where('c.lft >= ' . (int) \$lft)"; + $query .= PHP_EOL . "\t\t\t\t->where('c.rgt <= ' . (int) \$rgt);"; + $query .= PHP_EOL . "\t\t}"; + $query .= PHP_EOL . "\t\telseif (is_array(\$categoryId))"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\tJArrayHelper::toInteger(\$categoryId);"; + $query .= PHP_EOL . "\t\t\t\$categoryId = implode(',', \$categoryId);"; + $query .= PHP_EOL . "\t\t\t\$query->where('a.category IN (' . \$categoryId . ')');"; + $query .= PHP_EOL . "\t\t}"; $query .= PHP_EOL; } - $query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Add the list ordering clause."; - $query .= PHP_EOL."\t\t\$orderCol = \$this->state->get('list.ordering', 'a.id');"; - $query .= PHP_EOL."\t\t\$orderDirn = \$this->state->get('list.direction', 'asc'); "; - $query .= PHP_EOL."\t\tif (\$orderCol != '')"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\t\$query->order(\$db->escape(\$orderCol . ' ' . \$orderDirn));"; - $query .= PHP_EOL."\t\t}"; + $query .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Add the list ordering clause."; + $query .= PHP_EOL . "\t\t\$orderCol = \$this->state->get('list.ordering', 'a.id');"; + $query .= PHP_EOL . "\t\t\$orderDirn = \$this->state->get('list.direction', 'asc'); "; + $query .= PHP_EOL . "\t\tif (\$orderCol != '')"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\t\$query->order(\$db->escape(\$orderCol . ' ' . \$orderDirn));"; + $query .= PHP_EOL . "\t\t}"; $query .= PHP_EOL; - $query .= PHP_EOL."\t\treturn \$query;"; + $query .= PHP_EOL . "\t\treturn \$query;"; return $query; } @@ -8409,37 +8407,37 @@ class Interpretation extends Fields // array( 'type' => $typeName, 'code' => $name, 'custom' => $custom, 'list' => $field['list']); if ($nr == 0) { - $search .= "a.".$array['code']." LIKE '.\$search.'"; + $search .= "a." . $array['code'] . " LIKE '.\$search.'"; if (ComponentbuilderHelper::checkArray($array['custom']) && 1 == $array['list']) { - $search .= " OR ".$array['custom']['db'].".".$array['custom']['text']." LIKE '.\$search.'"; + $search .= " OR " . $array['custom']['db'] . "." . $array['custom']['text'] . " LIKE '.\$search.'"; } } else { - $search .= " OR a.".$array['code']." LIKE '.\$search.'"; + $search .= " OR a." . $array['code'] . " LIKE '.\$search.'"; if (ComponentbuilderHelper::checkArray($array['custom']) && 1 == $array['list']) { - $search .= " OR ".$array['custom']['db'].".".$array['custom']['text']." LIKE '.\$search.'"; + $search .= " OR " . $array['custom']['db'] . "." . $array['custom']['text'] . " LIKE '.\$search.'"; } } } $search .= ")'"; // now setup query - $query = PHP_EOL."\t\t//".$this->setLine(__LINE__)." Filter by search."; - $query .= PHP_EOL."\t\t\$search = \$this->getState('filter.search');"; - $query .= PHP_EOL."\t\tif (!empty(\$search))"; - $query .= PHP_EOL."\t\t{"; - $query .= PHP_EOL."\t\t\tif (stripos(\$search, 'id:') === 0)"; - $query .= PHP_EOL."\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\$query->where('a.id = ' . (int) substr(\$search, 3));"; - $query .= PHP_EOL."\t\t\t}"; - $query .= PHP_EOL."\t\t\telse"; - $query .= PHP_EOL."\t\t\t{"; - $query .= PHP_EOL."\t\t\t\t\$search = \$db->quote('%' . \$db->escape(\$search) . '%');"; - $query .= PHP_EOL."\t\t\t\t\$query->where(".$search.");"; - $query .= PHP_EOL."\t\t\t}"; - $query .= PHP_EOL."\t\t}"; + $query = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Filter by search."; + $query .= PHP_EOL . "\t\t\$search = \$this->getState('filter.search');"; + $query .= PHP_EOL . "\t\tif (!empty(\$search))"; + $query .= PHP_EOL . "\t\t{"; + $query .= PHP_EOL . "\t\t\tif (stripos(\$search, 'id:') === 0)"; + $query .= PHP_EOL . "\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\$query->where('a.id = ' . (int) substr(\$search, 3));"; + $query .= PHP_EOL . "\t\t\t}"; + $query .= PHP_EOL . "\t\t\telse"; + $query .= PHP_EOL . "\t\t\t{"; + $query .= PHP_EOL . "\t\t\t\t\$search = \$db->quote('%' . \$db->escape(\$search) . '%');"; + $query .= PHP_EOL . "\t\t\t\t\$query->where(" . $search . ");"; + $query .= PHP_EOL . "\t\t\t}"; + $query .= PHP_EOL . "\t\t}"; $query .= PHP_EOL; return $query; @@ -8455,16 +8453,11 @@ class Interpretation extends Fields foreach ($this->customBuilder[$viewName_list] as $filter) { // only load this if table is set - if (isset($this->customBuilderList[$viewName_list]) - && ComponentbuilderHelper::checkArray($this->customBuilderList[$viewName_list]) - && in_array($filter['code'],$this->customBuilderList[$viewName_list]) - && isset($filter['custom']['table']) - && ComponentbuilderHelper::checkString($filter['custom']['table']) - && $filter['method'] == 0) + if (isset($this->customBuilderList[$viewName_list]) && ComponentbuilderHelper::checkArray($this->customBuilderList[$viewName_list]) && in_array($filter['code'], $this->customBuilderList[$viewName_list]) && isset($filter['custom']['table']) && ComponentbuilderHelper::checkString($filter['custom']['table']) && $filter['method'] == 0) { - $query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." From the ".ComponentbuilderHelper::safeString(ComponentbuilderHelper::safeString($filter['custom']['table'],'w'))." table."; - $query .= PHP_EOL."\t\t\$query->select(\$db->quoteName('".$filter['custom']['db'].".".$filter['custom']['text']."','".$filter['code']."_".$filter['custom']['text']."'));"; - $query .= PHP_EOL."\t\t\$query->join('LEFT', \$db->quoteName('".$filter['custom']['table']."', '".$filter['custom']['db']."') . ' ON (' . \$db->quoteName('a.".$filter['code']."') . ' = ' . \$db->quoteName('".$filter['custom']['db'].".".$filter['custom']['id']."') . ')');"; + $query .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " From the " . ComponentbuilderHelper::safeString(ComponentbuilderHelper::safeString($filter['custom']['table'], 'w')) . " table."; + $query .= PHP_EOL . "\t\t\$query->select(\$db->quoteName('" . $filter['custom']['db'] . "." . $filter['custom']['text'] . "','" . $filter['code'] . "_" . $filter['custom']['text'] . "'));"; + $query .= PHP_EOL . "\t\t\$query->join('LEFT', \$db->quoteName('" . $filter['custom']['table'] . "', '" . $filter['custom']['db'] . "') . ' ON (' . \$db->quoteName('a." . $filter['code'] . "') . ' = ' . \$db->quoteName('" . $filter['custom']['db'] . "." . $filter['custom']['id'] . "') . ')');"; } // build the field type file $this->setCustomFieldTypeFile($filter, $viewName_list, $viewName_single); @@ -8473,10 +8466,10 @@ class Interpretation extends Fields } } - public function setAddButttonToListField($targetView,$targetViews) + public function setAddButttonToListField($targetView, $targetViews) { $addButton = array(); - $addButton[] = PHP_EOL."\t/**"; + $addButton[] = PHP_EOL . "\t/**"; $addButton[] = "\t * Override to add new button"; $addButton[] = "\t *"; $addButton[] = "\t * @return string The field input markup."; @@ -8485,35 +8478,35 @@ class Interpretation extends Fields $addButton[] = "\t */"; $addButton[] = "\tprotected function getInput()"; $addButton[] = "\t{"; - $addButton[] = "\t\t//".$this->setLine(__LINE__)." see if we should add buttons"; + $addButton[] = "\t\t//" . $this->setLine(__LINE__) . " see if we should add buttons"; $addButton[] = "\t\t\$setButton = \$this->getAttribute('button');"; - $addButton[] = "\t\t//".$this->setLine(__LINE__)." get html"; + $addButton[] = "\t\t//" . $this->setLine(__LINE__) . " get html"; $addButton[] = "\t\t\$html = parent::getInput();"; - $addButton[] = "\t\t//".$this->setLine(__LINE__)." if true set button"; + $addButton[] = "\t\t//" . $this->setLine(__LINE__) . " if true set button"; $addButton[] = "\t\tif (\$setButton === 'true')"; $addButton[] = "\t\t{"; $addButton[] = "\t\t\t\$button = array();"; $addButton[] = "\t\t\t\$script = array();"; $addButton[] = "\t\t\t\$buttonName = \$this->getAttribute('name');"; - $addButton[] = "\t\t\t//".$this->setLine(__LINE__)." get the input from url"; + $addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " get the input from url"; $addButton[] = "\t\t\t\$app = JFactory::getApplication();"; $addButton[] = "\t\t\t\$jinput = \$app->input;"; - $addButton[] = "\t\t\t//".$this->setLine(__LINE__)." get the view name & id"; + $addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " get the view name & id"; $addButton[] = "\t\t\t\$values = \$jinput->getArray(array("; $addButton[] = "\t\t\t\t'id' => 'int',"; $addButton[] = "\t\t\t\t'view' => 'word'"; $addButton[] = "\t\t\t));"; - $addButton[] = "\t\t\t//".$this->setLine(__LINE__)." check if new item"; + $addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " check if new item"; $addButton[] = "\t\t\t\$ref = '';"; $addButton[] = "\t\t\t\$refJ = '';"; $addButton[] = "\t\t\tif (!is_null(\$values['id']) && strlen(\$values['view']))"; $addButton[] = "\t\t\t{"; - $addButton[] = "\t\t\t\t//".$this->setLine(__LINE__)." only load referal if not new item."; + $addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " only load referal if not new item."; $addButton[] = "\t\t\t\t\$ref = '&ref=' . \$values['view'] . '&refid=' . \$values['id'];"; $addButton[] = "\t\t\t\t\$refJ = '&ref=' . \$values['view'] . '&refid=' . \$values['id'];"; $addButton[] = "\t\t\t}"; $addButton[] = "\t\t\t\$user = JFactory::getUser();"; - $addButton[] = "\t\t\t//".$this->setLine(__LINE__)." only add if user allowed to create " . $targetView; + $addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " only add if user allowed to create " . $targetView; // get core permissions $coreLoad = false; if (isset($this->permissionCore[$targetView])) @@ -8522,52 +8515,52 @@ class Interpretation extends Fields $coreLoad = true; } // check if the item has permissions. - if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.create']]) && in_array($targetView,$this->permissionBuilder['global'][$core['core.create']])) + if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.create']]) && in_array($targetView, $this->permissionBuilder['global'][$core['core.create']])) { - $addButton[] = "\t\t\tif (\$user->authorise('".$core['core.create']."', 'com_".$this->fileContentStatic['###component###']."') && \$app->isAdmin()) // TODO for now only in admin area."; + $addButton[] = "\t\t\tif (\$user->authorise('" . $core['core.create'] . "', 'com_" . $this->fileContentStatic['###component###'] . "') && \$app->isAdmin()) // TODO for now only in admin area."; } else { - $addButton[] = "\t\t\tif (\$user->authorise('core.create', 'com_".$this->fileContentStatic['###component###']."') && \$app->isAdmin()) // TODO for now only in admin area."; + $addButton[] = "\t\t\tif (\$user->authorise('core.create', 'com_" . $this->fileContentStatic['###component###'] . "') && \$app->isAdmin()) // TODO for now only in admin area."; } $addButton[] = "\t\t\t{"; - $addButton[] = "\t\t\t\t//".$this->setLine(__LINE__)." build Create button"; + $addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " build Create button"; $addButton[] = "\t\t\t\t\$buttonNamee = trim(\$buttonName);"; - $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/_+/', ' ', \$buttonNamee);"; - $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/\s+/', ' ', \$buttonNamee);"; - $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace(\"/[^A-Za-z ]/\", '', \$buttonNamee);"; + $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/_+/', ' ', \$buttonNamee);"; + $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/\s+/', ' ', \$buttonNamee);"; + $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace(\"/[^A-Za-z ]/\", '', \$buttonNamee);"; $addButton[] = "\t\t\t\t\$buttonNamee = ucfirst(strtolower(\$buttonNamee));"; - $addButton[] = "\t\t\t\t\$button[] = 'langPrefix."_CREATE_NEW_S', \$buttonNamee).'\" style=\"border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;\""; + $addButton[] = "\t\t\t\t\$button[] = 'langPrefix . "_CREATE_NEW_S', \$buttonNamee).'\" style=\"border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;\""; $addButton[] = "\t\t\t\t\thref=\"index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $targetView . "&layout=edit'.\$ref.'\" >"; $addButton[] = "\t\t\t\t\t';"; $addButton[] = "\t\t\t}"; - $addButton[] = "\t\t\t//".$this->setLine(__LINE__)." only add if user allowed to edit " . $targetView; + $addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " only add if user allowed to edit " . $targetView; // check if the item has permissions. - if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit']]) && in_array($targetView,$this->permissionBuilder['global'][$core['core.edit']])) + if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit']]) && in_array($targetView, $this->permissionBuilder['global'][$core['core.edit']])) { - $addButton[] = "\t\t\tif ((\$buttonName === '".$targetView."' || \$buttonName === '".$targetViews."') && \$user->authorise('".$core['core.edit']."', 'com_".$this->fileContentStatic['###component###']."') && \$app->isAdmin()) // TODO for now only in admin area."; + $addButton[] = "\t\t\tif ((\$buttonName === '" . $targetView . "' || \$buttonName === '" . $targetViews . "') && \$user->authorise('" . $core['core.edit'] . "', 'com_" . $this->fileContentStatic['###component###'] . "') && \$app->isAdmin()) // TODO for now only in admin area."; } else { - $addButton[] = "\t\t\tif ((\$buttonName === '".$targetView."' || \$buttonName === '".$targetViews."') && \$user->authorise('core.edit', 'com_".$this->fileContentStatic['###component###']."') && \$app->isAdmin()) // TODO for now only in admin area."; + $addButton[] = "\t\t\tif ((\$buttonName === '" . $targetView . "' || \$buttonName === '" . $targetViews . "') && \$user->authorise('core.edit', 'com_" . $this->fileContentStatic['###component###'] . "') && \$app->isAdmin()) // TODO for now only in admin area."; } $addButton[] = "\t\t\t{"; - $addButton[] = "\t\t\t\t//".$this->setLine(__LINE__)." build edit button"; + $addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " build edit button"; $addButton[] = "\t\t\t\t\$buttonNamee = trim(\$buttonName);"; - $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/_+/', ' ', \$buttonNamee);"; - $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/\s+/', ' ', \$buttonNamee);"; - $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace(\"/[^A-Za-z ]/\", '', \$buttonNamee);"; + $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/_+/', ' ', \$buttonNamee);"; + $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/\s+/', ' ', \$buttonNamee);"; + $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace(\"/[^A-Za-z ]/\", '', \$buttonNamee);"; $addButton[] = "\t\t\t\t\$buttonNamee = ucfirst(strtolower(\$buttonNamee));"; - $addButton[] = "\t\t\t\t\$button[] = 'langPrefix."_EDIT_S', \$buttonNamee).'\" style=\"display: none; padding: 4px 4px 4px 7px;\" href=\"#\" >"; + $addButton[] = "\t\t\t\t\$button[] = 'langPrefix . "_EDIT_S', \$buttonNamee).'\" style=\"display: none; padding: 4px 4px 4px 7px;\" href=\"#\" >"; $addButton[] = "\t\t\t\t\t';"; - $addButton[] = "\t\t\t\t//".$this->setLine(__LINE__)." build script"; + $addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " build script"; $addButton[] = "\t\t\t\t\$script[] = \""; $addButton[] = "\t\t\t\t\tjQuery(document).ready(function() {"; $addButton[] = "\t\t\t\t\t\tjQuery('#adminForm').on('change', '#jform_\".\$buttonName.\"',function (e) {"; $addButton[] = "\t\t\t\t\t\t\te.preventDefault();"; $addButton[] = "\t\t\t\t\t\t\tvar \".\$buttonName.\"Value = jQuery('#jform_\".\$buttonName.\"').val();"; $addButton[] = "\t\t\t\t\t\t\t\".\$buttonName.\"Button(\".\$buttonName.\"Value);"; - $addButton[] = "\t\t\t\t\t\t});"; + $addButton[] = "\t\t\t\t\t\t});"; $addButton[] = "\t\t\t\t\t\tvar \".\$buttonName.\"Value = jQuery('#jform_\".\$buttonName.\"').val();"; $addButton[] = "\t\t\t\t\t\t\".\$buttonName.\"Button(\".\$buttonName.\"Value);"; $addButton[] = "\t\t\t\t\t});"; @@ -8577,7 +8570,7 @@ class Interpretation extends Fields $addButton[] = "\t\t\t\t\t\t\tjQuery('#\".\$buttonName.\"Create').hide();"; $addButton[] = "\t\t\t\t\t\t\t// show edit button"; $addButton[] = "\t\t\t\t\t\t\tjQuery('#\".\$buttonName.\"Edit').show();"; - $addButton[] = "\t\t\t\t\t\t\tvar url = 'index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=".$targetViews."&task=" . $targetView . ".edit&id='+value+'\".\$refJ.\"';"; // TODO this value may not be the ID + $addButton[] = "\t\t\t\t\t\t\tvar url = 'index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $targetViews . "&task=" . $targetView . ".edit&id='+value+'\".\$refJ.\"';"; // TODO this value may not be the ID $addButton[] = "\t\t\t\t\t\t\tjQuery('#\".\$buttonName.\"Edit').attr('href', url);"; $addButton[] = "\t\t\t\t\t\t} else {"; $addButton[] = "\t\t\t\t\t\t\t// show the create button"; @@ -8587,20 +8580,20 @@ class Interpretation extends Fields $addButton[] = "\t\t\t\t\t\t}"; $addButton[] = "\t\t\t\t\t}\";"; $addButton[] = "\t\t\t}"; - $addButton[] = "\t\t\t//".$this->setLine(__LINE__)." check if button was created for " . $targetView ." field."; + $addButton[] = "\t\t\t//" . $this->setLine(__LINE__) . " check if button was created for " . $targetView . " field."; $addButton[] = "\t\t\tif (is_array(\$button) && count(\$button) > 0)"; $addButton[] = "\t\t\t{"; - $addButton[] = "\t\t\t\t//".$this->setLine(__LINE__)." Load the needed script."; + $addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " Load the needed script."; $addButton[] = "\t\t\t\t\$document = JFactory::getDocument();"; $addButton[] = "\t\t\t\t\$document->addScriptDeclaration(implode(' ',\$script));"; - $addButton[] = "\t\t\t\t//".$this->setLine(__LINE__)." return the button attached to input field."; + $addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " return the button attached to input field."; $addButton[] = "\t\t\t\treturn '
' .\$html . implode('',\$button).'
';"; $addButton[] = "\t\t\t}"; $addButton[] = "\t\t}"; $addButton[] = "\t\treturn \$html;"; $addButton[] = "\t}"; - return implode(PHP_EOL,$addButton); + return implode(PHP_EOL, $addButton); } public function setFilterQuery($viewName_list) @@ -8612,20 +8605,19 @@ class Interpretation extends Fields { if ($filter['type'] != 'category' && ComponentbuilderHelper::checkArray($filter['custom'])) { - $filterQuery .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Filter by ".$filter['code']."."; - $filterQuery .= PHP_EOL."\t\tif (\$".$filter['code']." = \$this->getState('filter.".$filter['code']."'))"; - $filterQuery .= PHP_EOL."\t\t{"; - $filterQuery .= PHP_EOL."\t\t\t\$query->where('a.".$filter['code']." = ' . \$db->quote(\$db->escape(\$".$filter['code'].")));"; - $filterQuery .= PHP_EOL."\t\t}"; - + $filterQuery .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Filter by " . $filter['code'] . "."; + $filterQuery .= PHP_EOL . "\t\tif (\$" . $filter['code'] . " = \$this->getState('filter." . $filter['code'] . "'))"; + $filterQuery .= PHP_EOL . "\t\t{"; + $filterQuery .= PHP_EOL . "\t\t\t\$query->where('a." . $filter['code'] . " = ' . \$db->quote(\$db->escape(\$" . $filter['code'] . ")));"; + $filterQuery .= PHP_EOL . "\t\t}"; } elseif ($filter['type'] != 'category') { - $filterQuery .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Filter by ".ucwords($filter['code'])."."; - $filterQuery .= PHP_EOL."\t\tif (\$".$filter['code']." = \$this->getState('filter.".$filter['code']."'))"; - $filterQuery .= PHP_EOL."\t\t{"; - $filterQuery .= PHP_EOL."\t\t\t\$query->where('a.".$filter['code']." = ' . \$db->quote(\$db->escape(\$".$filter['code'].")));"; - $filterQuery .= PHP_EOL."\t\t}"; + $filterQuery .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Filter by " . ucwords($filter['code']) . "."; + $filterQuery .= PHP_EOL . "\t\tif (\$" . $filter['code'] . " = \$this->getState('filter." . $filter['code'] . "'))"; + $filterQuery .= PHP_EOL . "\t\t{"; + $filterQuery .= PHP_EOL . "\t\t\t\$query->where('a." . $filter['code'] . " = ' . \$db->quote(\$db->escape(\$" . $filter['code'] . ")));"; + $filterQuery .= PHP_EOL . "\t\t}"; } } return $filterQuery; @@ -8641,18 +8633,18 @@ class Interpretation extends Fields if (isset($viewArray['settings']->conditions) && ComponentbuilderHelper::checkArray($viewArray['settings']->conditions)) { // reset defaults - $getValue = array(); - $ifValue = array(); - $targetControls = array(); - $functions = array(); + $getValue = array(); + $ifValue = array(); + $targetControls = array(); + $functions = array(); foreach ($viewArray['settings']->conditions as $condition) { if (isset($condition['match_name']) && ComponentbuilderHelper::checkString($condition['match_name'])) { - $uniqueVar = $this->uniquekey(7); - $matchName = $condition['match_name'].'_'.$uniqueVar; - $targetBehavior = ($condition['target_behavior'] == 1) ? 'show' : 'hide'; - $targetDefault = ($condition['target_behavior'] == 1) ? 'hide' : 'show'; + $uniqueVar = $this->uniquekey(7); + $matchName = $condition['match_name'] . '_' . $uniqueVar; + $targetBehavior = ($condition['target_behavior'] == 1) ? 'show' : 'hide'; + $targetDefault = ($condition['target_behavior'] == 1) ? 'hide' : 'show'; // make sure only one relation is set $firstTime = true; @@ -8660,41 +8652,41 @@ class Interpretation extends Fields if ($condition['target_relation'] && $firstTime) { // chain to other items of the same target - $relations = $this->getTargetRelationScript($viewArray['settings']->conditions,$condition,$viewName); + $relations = $this->getTargetRelationScript($viewArray['settings']->conditions, $condition, $viewName); if (ComponentbuilderHelper::checkArray($relations)) { // set behavior and default array - $behaviors[$matchName] = $targetBehavior; - $defaults[$matchName] = $targetDefault; + $behaviors[$matchName] = $targetBehavior; + $defaults[$matchName] = $targetDefault; // set the type buket - $typeBuket[$matchName] = $condition['match_type']; + $typeBuket[$matchName] = $condition['match_type']; // set function array - $functions[$uniqueVar][0] = $matchName; - $matchNames[$matchName] = $condition['match_name']; + $functions[$uniqueVar][0] = $matchName; + $matchNames[$matchName] = $condition['match_name']; // get the select value - $getValue[$matchName] = $this->getValueScript($condition['match_type'],$condition['match_name'],$condition['match_extends'],$uniqueVar); + $getValue[$matchName] = $this->getValueScript($condition['match_type'], $condition['match_name'], $condition['match_extends'], $uniqueVar); // get the options - $options = $this->getOptionsScript($condition['match_type'],$condition['match_options']); + $options = $this->getOptionsScript($condition['match_type'], $condition['match_options']); // set the if values - $ifValue[$matchName] = $this->ifValueScript($matchName,$condition['match_behavior'],$condition['match_type'],$options); + $ifValue[$matchName] = $this->ifValueScript($matchName, $condition['match_behavior'], $condition['match_type'], $options); // set the target controls - $targetControls[$matchName] = $this->setTargetControlsScript($condition['target_field'],$targetBehavior,$targetDefault,$uniqueVar,$viewName); + $targetControls[$matchName] = $this->setTargetControlsScript($condition['target_field'], $targetBehavior, $targetDefault, $uniqueVar, $viewName); $firstTime = false; - foreach($relations as $relation) + foreach ($relations as $relation) { if (ComponentbuilderHelper::checkString($relation['match_name'])) { - $relationName = $relation['match_name'].'_'.$uniqueVar; + $relationName = $relation['match_name'] . '_' . $uniqueVar; // set the type buket - $typeBuket[$relationName] = $relation['match_type']; + $typeBuket[$relationName] = $relation['match_type']; // set function array - $functions[$uniqueVar][] = $relationName; - $matchNames[$relationName] = $relation['match_name']; + $functions[$uniqueVar][] = $relationName; + $matchNames[$relationName] = $relation['match_name']; // get the relation option - $relationOptions = $this->getOptionsScript($relation['match_type'],$relation['match_options']); - $getValue[$relationName] = $this->getValueScript($relation['match_type'],$relation['match_name'],$condition['match_extends'],$uniqueVar); - $ifValue[$relationName] = $this->ifValueScript($relationName,$relation['match_behavior'],$relation['match_type'],$relationOptions); + $relationOptions = $this->getOptionsScript($relation['match_type'], $relation['match_options']); + $getValue[$relationName] = $this->getValueScript($relation['match_type'], $relation['match_name'], $condition['match_extends'], $uniqueVar); + $ifValue[$relationName] = $this->ifValueScript($relationName, $relation['match_behavior'], $relation['match_type'], $relationOptions); } } } @@ -8702,21 +8694,21 @@ class Interpretation extends Fields else { // set behavior and default array - $behaviors[$matchName] = $targetBehavior; - $defaults[$matchName] = $targetDefault; + $behaviors[$matchName] = $targetBehavior; + $defaults[$matchName] = $targetDefault; // set the type buket - $typeBuket[$matchName] = $condition['match_type']; + $typeBuket[$matchName] = $condition['match_type']; // set function array - $functions[$uniqueVar][0] = $matchName; - $matchNames[$matchName] = $condition['match_name']; + $functions[$uniqueVar][0] = $matchName; + $matchNames[$matchName] = $condition['match_name']; // get the select value - $getValue[$matchName] = $this->getValueScript($condition['match_type'],$condition['match_name'],$condition['match_extends'],$uniqueVar); + $getValue[$matchName] = $this->getValueScript($condition['match_type'], $condition['match_name'], $condition['match_extends'], $uniqueVar); // get the options - $options = $this->getOptionsScript($condition['match_type'],$condition['match_options']); + $options = $this->getOptionsScript($condition['match_type'], $condition['match_options']); // set the if values - $ifValue[$matchName] = $this->ifValueScript($matchName,$condition['match_behavior'],$condition['match_type'],$options); + $ifValue[$matchName] = $this->ifValueScript($matchName, $condition['match_behavior'], $condition['match_type'], $options); // set the target controls - $targetControls[$matchName] = $this->setTargetControlsScript($condition['target_field'],$targetBehavior,$targetDefault,$uniqueVar,$viewName); + $targetControls[$matchName] = $this->setTargetControlsScript($condition['target_field'], $targetBehavior, $targetDefault, $uniqueVar, $viewName); } } } @@ -8729,14 +8721,14 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkArray($functions)) { // now build the initial script - $initial .= "// Initial Script".PHP_EOL."jQuery(document).ready(function()"; - $initial .= PHP_EOL."{"; + $initial .= "// Initial Script" . PHP_EOL . "jQuery(document).ready(function()"; + $initial .= PHP_EOL . "{"; foreach ($functions as $function => $matchKeys) { - $func_call = $this->buildFunctionCall($function,$matchKeys,$getValue); + $func_call = $this->buildFunctionCall($function, $matchKeys, $getValue); $initial .= $func_call['code']; } - $initial .= "});".PHP_EOL; + $initial .= "});" . PHP_EOL; // for modal fields $modal = ''; // now build the listener scripts @@ -8745,41 +8737,41 @@ class Interpretation extends Fields $funcCall = ''; foreach ($l_matchKeys as $l_matchKey) { - $name = $matchNames[$l_matchKey]; - $matchTypeKey = $typeBuket[$l_matchKey]; - $funcCall = $this->buildFunctionCall($l_function,$l_matchKeys,$getValue); - - if(isset($this->setScriptMediaSwitch) && ComponentbuilderHelper::checkArray($this->setScriptMediaSwitch) && in_array($matchTypeKey,$this->setScriptMediaSwitch)) + $name = $matchNames[$l_matchKey]; + $matchTypeKey = $typeBuket[$l_matchKey]; + $funcCall = $this->buildFunctionCall($l_function, $l_matchKeys, $getValue); + + if (isset($this->setScriptMediaSwitch) && ComponentbuilderHelper::checkArray($this->setScriptMediaSwitch) && in_array($matchTypeKey, $this->setScriptMediaSwitch)) { $modal .= $funcCall['code']; } else { - if (isset($this->setScriptUserSwitch) && ComponentbuilderHelper::checkArray($this->setScriptUserSwitch) && in_array($matchTypeKey,$this->setScriptUserSwitch)) + if (isset($this->setScriptUserSwitch) && ComponentbuilderHelper::checkArray($this->setScriptUserSwitch) && in_array($matchTypeKey, $this->setScriptUserSwitch)) { - $name = $name.'_id'; + $name = $name . '_id'; } - $listener .= PHP_EOL."// #jform_".$name." listeners for ".$l_matchKey." function"; - $listener .= PHP_EOL."jQuery('#jform_".$name."').on('keyup',function()"; - $listener .= PHP_EOL."{"; + $listener .= PHP_EOL . "// #jform_" . $name . " listeners for " . $l_matchKey . " function"; + $listener .= PHP_EOL . "jQuery('#jform_" . $name . "').on('keyup',function()"; + $listener .= PHP_EOL . "{"; $listener .= $funcCall['code']; - $listener .= PHP_EOL."});"; - $listener .= PHP_EOL."jQuery('#adminForm').on('change', '#jform_".$name."',function (e)"; - $listener .= PHP_EOL."{"; - $listener .= PHP_EOL."\te.preventDefault();"; + $listener .= PHP_EOL . "});"; + $listener .= PHP_EOL . "jQuery('#adminForm').on('change', '#jform_" . $name . "',function (e)"; + $listener .= PHP_EOL . "{"; + $listener .= PHP_EOL . "\te.preventDefault();"; $listener .= $funcCall['code']; - $listener .= PHP_EOL."});".PHP_EOL; + $listener .= PHP_EOL . "});" . PHP_EOL; } } } if (ComponentbuilderHelper::checkString($modal)) { - $listener .= PHP_EOL."window.SqueezeBox.initialize({"; - $listener .= PHP_EOL."\tonClose:function(){"; + $listener .= PHP_EOL . "window.SqueezeBox.initialize({"; + $listener .= PHP_EOL . "\tonClose:function(){"; $listener .= $modal; - $listener .= PHP_EOL."\t}"; - $listener .= PHP_EOL."});".PHP_EOL; + $listener .= PHP_EOL . "\t}"; + $listener .= PHP_EOL . "});" . PHP_EOL; } // now build the function @@ -8790,14 +8782,14 @@ class Interpretation extends Fields $map = ''; // does this function require an array $addArray = false; - $func_ = $this->buildFunctionCall($f_function,$f_matchKeys,$getValue); + $func_ = $this->buildFunctionCall($f_function, $f_matchKeys, $getValue); // set array switch if ($func_['array']) { $addArray = true; } - $func .= PHP_EOL."// the ".$f_function." function"; - $func .= PHP_EOL."function ".$f_function."("; + $func .= PHP_EOL . "// the " . $f_function . " function"; + $func .= PHP_EOL . "function " . $f_function . "("; $fucounter = 0; foreach ($f_matchKeys as $fu_matchKey) { @@ -8809,43 +8801,43 @@ class Interpretation extends Fields } else { - $func .= ','.$fu_matchKey; + $func .= ',' . $fu_matchKey; } $fucounter++; } } $func .= ")"; - $func .= PHP_EOL."{"; + $func .= PHP_EOL . "{"; if ($addArray) { foreach ($f_matchKeys as $a_matchKey) { $name = $matchNames[$a_matchKey]; - $func .= PHP_EOL."\tif (isSet(".$a_matchKey.") && ".$a_matchKey.".constructor !== Array)".PHP_EOL."\t{".PHP_EOL."\t\tvar temp_".$f_function." = ".$a_matchKey.";".PHP_EOL."\t\tvar ".$a_matchKey." = [];".PHP_EOL."\t\t".$a_matchKey.".push(temp_".$f_function.");".PHP_EOL."\t}"; - $func .= PHP_EOL."\telse if (!isSet(".$a_matchKey."))".PHP_EOL."\t{"; - $func .= PHP_EOL."\t\tvar ".$a_matchKey." = [];"; - $func .= PHP_EOL."\t}"; - $func .= PHP_EOL."\tvar ".$name." = ".$a_matchKey.".some(".$a_matchKey."_SomeFunc);".PHP_EOL; + $func .= PHP_EOL . "\tif (isSet(" . $a_matchKey . ") && " . $a_matchKey . ".constructor !== Array)" . PHP_EOL . "\t{" . PHP_EOL . "\t\tvar temp_" . $f_function . " = " . $a_matchKey . ";" . PHP_EOL . "\t\tvar " . $a_matchKey . " = [];" . PHP_EOL . "\t\t" . $a_matchKey . ".push(temp_" . $f_function . ");" . PHP_EOL . "\t}"; + $func .= PHP_EOL . "\telse if (!isSet(" . $a_matchKey . "))" . PHP_EOL . "\t{"; + $func .= PHP_EOL . "\t\tvar " . $a_matchKey . " = [];"; + $func .= PHP_EOL . "\t}"; + $func .= PHP_EOL . "\tvar " . $name . " = " . $a_matchKey . ".some(" . $a_matchKey . "_SomeFunc);" . PHP_EOL; // setup the map function - $map .= PHP_EOL."// the ".$f_function." Some function"; - $map .= PHP_EOL."function ".$a_matchKey."_SomeFunc(".$a_matchKey.")"; - $map .= PHP_EOL."{"; - $map .= PHP_EOL."\t//".$this->setLine(__LINE__)." set the function logic"; - $map .= PHP_EOL."\tif ("; + $map .= PHP_EOL . "// the " . $f_function . " Some function"; + $map .= PHP_EOL . "function " . $a_matchKey . "_SomeFunc(" . $a_matchKey . ")"; + $map .= PHP_EOL . "{"; + $map .= PHP_EOL . "\t//" . $this->setLine(__LINE__) . " set the function logic"; + $map .= PHP_EOL . "\tif ("; $if = $ifValue[$a_matchKey]; if (ComponentbuilderHelper::checkString($if)) { $map .= $if; } $map .= ")"; - $map .= PHP_EOL."\t{"; - $map .= PHP_EOL."\t\treturn true;"; - $map .= PHP_EOL."\t}".PHP_EOL."\treturn false;"; - $map .= PHP_EOL."}".PHP_EOL; + $map .= PHP_EOL . "\t{"; + $map .= PHP_EOL . "\t\treturn true;"; + $map .= PHP_EOL . "\t}" . PHP_EOL . "\treturn false;"; + $map .= PHP_EOL . "}" . PHP_EOL; } - $func .= PHP_EOL.PHP_EOL."\t//".$this->setLine(__LINE__)." set this function logic"; - $func .= PHP_EOL."\tif ("; + $func .= PHP_EOL . PHP_EOL . "\t//" . $this->setLine(__LINE__) . " set this function logic"; + $func .= PHP_EOL . "\tif ("; // set if counter $aifcounter = 0; foreach ($f_matchKeys as $af_matchKey) @@ -8857,17 +8849,16 @@ class Interpretation extends Fields } else { - $func .= ' && '.$name; + $func .= ' && ' . $name; } $aifcounter++; } - $func .= ")".PHP_EOL."\t{"; - + $func .= ")" . PHP_EOL . "\t{"; } else { - $func .= PHP_EOL."\t//".$this->setLine(__LINE__)." set the function logic"; - $func .= PHP_EOL."\tif ("; + $func .= PHP_EOL . "\t//" . $this->setLine(__LINE__) . " set the function logic"; + $func .= PHP_EOL . "\tif ("; // set if counter $ifcounter = 0; foreach ($f_matchKeys as $f_matchKey) @@ -8881,12 +8872,12 @@ class Interpretation extends Fields } else { - $func .= ' && '.$if; + $func .= ' && ' . $if; } $ifcounter++; } } - $func .= ")".PHP_EOL."\t{"; + $func .= ")" . PHP_EOL . "\t{"; } // get the controles $controls = $targetControls[$f_matchKeys[0]]; @@ -8894,7 +8885,7 @@ class Interpretation extends Fields $targetBehavior = $behaviors[$f_matchKeys[0]]; $targetDefault = $defaults[$f_matchKeys[0]]; // load the target behavior - foreach($controls as $target => $action) + foreach ($controls as $target => $action) { $func .= $action['behavior']; if (ComponentbuilderHelper::checkString($action['hide'])) @@ -8903,8 +8894,8 @@ class Interpretation extends Fields $head .= $action['requiredVar']; } } - $func .= PHP_EOL."\t}".PHP_EOL."\telse".PHP_EOL."\t{"; - foreach($controls as $target => $action) + $func .= PHP_EOL . "\t}" . PHP_EOL . "\telse" . PHP_EOL . "\t{"; + foreach ($controls as $target => $action) { $func .= $action['default']; if (ComponentbuilderHelper::checkString($action['hide'])) @@ -8912,49 +8903,49 @@ class Interpretation extends Fields $func .= $action[$targetDefault]; } } - $func .= PHP_EOL."\t}".PHP_EOL."}".PHP_EOL.$map; + $func .= PHP_EOL . "\t}" . PHP_EOL . "}" . PHP_EOL . $map; } // add the needed validation to file if (isset($this->validationFixBuilder[$viewName]) && ComponentbuilderHelper::checkArray($this->validationFixBuilder[$viewName])) { - $validation .= PHP_EOL."// update required fields"; - $validation .= PHP_EOL."function updateFieldRequired(name,status)"; - $validation .= PHP_EOL."{"; - $validation .= PHP_EOL."\tvar not_required = jQuery('#jform_not_required').val();"; - $validation .= PHP_EOL.PHP_EOL."\tif(status == 1)"; - $validation .= PHP_EOL."\t{"; - $validation .= PHP_EOL."\t\tif (isSet(not_required) && not_required != 0)"; - $validation .= PHP_EOL."\t\t{"; - $validation .= PHP_EOL."\t\t\tnot_required = not_required+','+name;"; - $validation .= PHP_EOL."\t\t}"; - $validation .= PHP_EOL."\t\telse"; - $validation .= PHP_EOL."\t\t{"; - $validation .= PHP_EOL."\t\t\tnot_required = ','+name;"; - $validation .= PHP_EOL."\t\t}"; - $validation .= PHP_EOL."\t}"; - $validation .= PHP_EOL."\telse"; - $validation .= PHP_EOL."\t{"; - $validation .= PHP_EOL."\t\tif (isSet(not_required) && not_required != 0)"; - $validation .= PHP_EOL."\t\t{"; - $validation .= PHP_EOL."\t\t\tnot_required = not_required.replace(','+name,'');"; - $validation .= PHP_EOL."\t\t}"; - $validation .= PHP_EOL."\t}"; - $validation .= PHP_EOL.PHP_EOL."\tjQuery('#jform_not_required').val(not_required);"; - $validation .= PHP_EOL."}".PHP_EOL; + $validation .= PHP_EOL . "// update required fields"; + $validation .= PHP_EOL . "function updateFieldRequired(name,status)"; + $validation .= PHP_EOL . "{"; + $validation .= PHP_EOL . "\tvar not_required = jQuery('#jform_not_required').val();"; + $validation .= PHP_EOL . PHP_EOL . "\tif(status == 1)"; + $validation .= PHP_EOL . "\t{"; + $validation .= PHP_EOL . "\t\tif (isSet(not_required) && not_required != 0)"; + $validation .= PHP_EOL . "\t\t{"; + $validation .= PHP_EOL . "\t\t\tnot_required = not_required+','+name;"; + $validation .= PHP_EOL . "\t\t}"; + $validation .= PHP_EOL . "\t\telse"; + $validation .= PHP_EOL . "\t\t{"; + $validation .= PHP_EOL . "\t\t\tnot_required = ','+name;"; + $validation .= PHP_EOL . "\t\t}"; + $validation .= PHP_EOL . "\t}"; + $validation .= PHP_EOL . "\telse"; + $validation .= PHP_EOL . "\t{"; + $validation .= PHP_EOL . "\t\tif (isSet(not_required) && not_required != 0)"; + $validation .= PHP_EOL . "\t\t{"; + $validation .= PHP_EOL . "\t\t\tnot_required = not_required.replace(','+name,'');"; + $validation .= PHP_EOL . "\t\t}"; + $validation .= PHP_EOL . "\t}"; + $validation .= PHP_EOL . PHP_EOL . "\tjQuery('#jform_not_required').val(not_required);"; + $validation .= PHP_EOL . "}" . PHP_EOL; } // set the isSet function - $isSet = PHP_EOL."// the isSet function"; - $isSet .= PHP_EOL."function isSet(val)"; - $isSet .= PHP_EOL."{"; - $isSet .= PHP_EOL."\tif ((val != undefined) && (val != null) && 0 !== val.length){"; - $isSet .= PHP_EOL."\t\treturn true;"; - $isSet .= PHP_EOL."\t}"; - $isSet .= PHP_EOL."\treturn false;"; - $isSet .= PHP_EOL."}"; + $isSet = PHP_EOL . "// the isSet function"; + $isSet .= PHP_EOL . "function isSet(val)"; + $isSet .= PHP_EOL . "{"; + $isSet .= PHP_EOL . "\tif ((val != undefined) && (val != null) && 0 !== val.length){"; + $isSet .= PHP_EOL . "\t\treturn true;"; + $isSet .= PHP_EOL . "\t}"; + $isSet .= PHP_EOL . "\treturn false;"; + $isSet .= PHP_EOL . "}"; } // load to this buket - $fileScript = $initial.$func.$validation.$isSet; - $footerScript = $listener; + $fileScript = $initial . $func . $validation . $isSet; + $footerScript = $listener; } // add custom script to file if (isset($this->customScriptBuilder['view_file'][$viewName]) && ComponentbuilderHelper::checkString($this->customScriptBuilder['view_file'][$viewName])) @@ -8963,13 +8954,13 @@ class Interpretation extends Fields { $fileScript = ''; } - $fileScript .= PHP_EOL.PHP_EOL.$this->setPlaceholders($this->customScriptBuilder['view_file'][$viewName], $this->placeholders); + $fileScript .= PHP_EOL . PHP_EOL . $this->setPlaceholders($this->customScriptBuilder['view_file'][$viewName], $this->placeholders); } // add custom script to footer if (isset($this->customScriptBuilder['view_footer'][$viewName]) && ComponentbuilderHelper::checkString($this->customScriptBuilder['view_footer'][$viewName])) { - $customFooterScript = PHP_EOL.PHP_EOL.$this->setPlaceholders($this->customScriptBuilder['view_footer'][$viewName], $this->placeholders); - if (strpos($customFooterScript,'setPlaceholders($this->customScriptBuilder['view_footer'][$viewName], $this->placeholders); + if (strpos($customFooterScript, 'params->get('minify') && isset($fileScript) && ComponentbuilderHelper::checkString($fileScript)) @@ -9003,7 +8993,7 @@ class Interpretation extends Fields // add the head script if set if (isset($head) && ComponentbuilderHelper::checkString($head)) { - $fileScript = "// Some Global Values".PHP_EOL.$head.PHP_EOL.$fileScript; + $fileScript = "// Some Global Values" . PHP_EOL . $head . PHP_EOL . $fileScript; } // load the script $this->editBodyViewScriptBuilder[$viewName]['fileScript'] = $fileScript; @@ -9021,28 +9011,28 @@ class Interpretation extends Fields if (isset($footerScript) && ComponentbuilderHelper::checkString($footerScript)) { // add the needed script tags - $footerScript = PHP_EOL.PHP_EOL.'"; + $footerScript = PHP_EOL . PHP_EOL . '"; $this->editBodyViewScriptBuilder[$viewName]['footerScript'] = $footerScript; } } - public function buildFunctionCall($function,$matchKeys,$getValue) + public function buildFunctionCall($function, $matchKeys, $getValue) { - $initial = ''; - $funcsets = array(); - $array = false; + $initial = ''; + $funcsets = array(); + $array = false; foreach ($matchKeys as $matchKey) { $value = $getValue[$matchKey]; if ($value['isArray']) { - $initial .= PHP_EOL."\t".$value['get']; + $initial .= PHP_EOL . "\t" . $value['get']; $funcsets[] = $matchKey; $array = true; } else { - $initial .= PHP_EOL."\t".$value['get']; + $initial .= PHP_EOL . "\t" . $value['get']; $funcsets[] = $matchKey; } } @@ -9050,14 +9040,14 @@ class Interpretation extends Fields // make sure that the function is loaded only once if (ComponentbuilderHelper::checkArray($funcsets)) { - $initial .= PHP_EOL."\t".$function."("; - $initial .= implode(',',$funcsets); - $initial .= ");".PHP_EOL; + $initial .= PHP_EOL . "\t" . $function . "("; + $initial .= implode(',', $funcsets); + $initial .= ");" . PHP_EOL; } return array('code' => $initial, 'array' => $array); } - public function getTargetRelationScript($relations,$con
'; - $head .= PHP_EOL."\t\t\t"; - $head .= PHP_EOL."\t\t'; - $head .= PHP_EOL."\t\t\t"; - $head .= PHP_EOL."\t\t
'; + $head .= PHP_EOL . "\t\t\t"; + $head .= PHP_EOL . "\t\t'; + $head .= PHP_EOL . "\t\t\t"; + $head .= PHP_EOL . "\t\t