From 08d529aba970a882e096393b34bf3eb53ad1536f Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Tue, 9 Mar 2021 00:36:30 +0200 Subject: [PATCH] Continued to add the namespacing for the file and folder classes across the system. gh-682 --- README.md | 2 +- admin/README.txt | 2 +- .../compiler/joomla_3/JModelLegacy_import.php | 8 ++- .../joomla_3/JModelLegacy_import_custom.php | 9 +-- .../joomla_3/JViewLegacy_custom_admin.php | 2 +- admin/compiler/joomla_3/JViewLegacy_edit.php | 2 +- .../joomla_3/JViewLegacy_edit_site.php | 2 +- admin/compiler/joomla_3/JViewLegacy_list.php | 2 +- .../JViewLegacy_list_custom_admin.php | 2 +- .../joomla_3/JViewLegacy_list_site.php | 2 +- admin/compiler/joomla_3/JViewLegacy_site.php | 2 +- admin/compiler/joomla_3/script.php | 14 ++-- admin/helpers/compiler.php | 34 ++++----- admin/helpers/compiler/e_Interpretation.php | 70 ++++++++++++------- admin/helpers/compiler/f_Infusion.php | 43 ++++++++++++ admin/helpers/componentbuilder.php | 6 -- admin/models/import.php | 8 ++- admin/models/import_joomla_components.php | 9 +-- admin/models/import_language_translations.php | 9 +-- admin/views/compiler/view.html.php | 6 +- admin/views/get_snippets/view.html.php | 6 +- script.php | 18 ++--- site/helpers/componentbuilder.php | 6 -- 23 files changed, 164 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index 8591c96d4..f644ce2b6 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ TODO + *Version*: 2.12.8 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **292190** ++ *Line count*: **292188** + *Field count*: **1629** + *File count*: **1935** + *Folder count*: **322** diff --git a/admin/README.txt b/admin/README.txt index 8591c96d4..f644ce2b6 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -147,7 +147,7 @@ TODO + *Version*: 2.12.8 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **292190** ++ *Line count*: **292188** + *Field count*: **1629** + *File count*: **1935** + *Folder count*: **322** diff --git a/admin/compiler/joomla_3/JModelLegacy_import.php b/admin/compiler/joomla_3/JModelLegacy_import.php index 03d0eedb3..5dd8344f1 100644 --- a/admin/compiler/joomla_3/JModelLegacy_import.php +++ b/admin/compiler/joomla_3/JModelLegacy_import.php @@ -17,6 +17,8 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; use Joomla\Utilities\ArrayHelper; use PhpOffice\PhpSpreadsheet\IOFactory; @@ -227,7 +229,7 @@ class ###Component###ModelImport extends JModelLegacy // Move uploaded file jimport('joomla.filesystem.file'); - $p_file = JFile::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); + $p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); // Was the package downloaded? if (!$p_file) @@ -383,12 +385,12 @@ class ###Component###ModelImport extends JModelLegacy // Is the package file a valid file? if (is_file($package)) { - JFile::delete($package); + File::delete($package); } elseif (is_file(JPath::clean($package))) { // It might also be just a base filename - JFile::delete(JPath::clean($package)); + File::delete(JPath::clean($package)); } }###IMPORT_SETDATA_METHOD######IMPORT_SAVE_METHOD### diff --git a/admin/compiler/joomla_3/JModelLegacy_import_custom.php b/admin/compiler/joomla_3/JModelLegacy_import_custom.php index 891b0f3f4..713738d48 100644 --- a/admin/compiler/joomla_3/JModelLegacy_import_custom.php +++ b/admin/compiler/joomla_3/JModelLegacy_import_custom.php @@ -17,6 +17,8 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; use Joomla\Utilities\ArrayHelper; use PhpOffice\PhpSpreadsheet\IOFactory; @@ -116,8 +118,7 @@ class ###Component###Model###View### extends JModelLegacy $tmp_src = $userfile['tmp_name']; // Move uploaded file - jimport('joomla.filesystem.file'); - $p_file = JFile::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); + $p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); // Was the package downloaded? if (!$p_file) @@ -274,12 +275,12 @@ class ###Component###Model###View### extends JModelLegacy // Is the package file a valid file? if (is_file($package)) { - JFile::delete($package); + File::delete($package); } elseif (is_file(JPath::clean($package))) { // It might also be just a base filename - JFile::delete(JPath::clean($package)); + File::delete(JPath::clean($package)); } } ###IMPORT_SETDATA_METHOD### diff --git a/admin/compiler/joomla_3/JViewLegacy_custom_admin.php b/admin/compiler/joomla_3/JViewLegacy_custom_admin.php index bcf81be8f..d0fe52b18 100644 --- a/admin/compiler/joomla_3/JViewLegacy_custom_admin.php +++ b/admin/compiler/joomla_3/JViewLegacy_custom_admin.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access'); ###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_GET_MODULE_JIMPORT### - +###CUSTOM_ADMIN_VIEW_HTML_HEADER### /** * ###Component### View class for the ###SView### */ diff --git a/admin/compiler/joomla_3/JViewLegacy_edit.php b/admin/compiler/joomla_3/JViewLegacy_edit.php index 55678dff9..dc2c3fe4e 100644 --- a/admin/compiler/joomla_3/JViewLegacy_edit.php +++ b/admin/compiler/joomla_3/JViewLegacy_edit.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### - +###ADMIN_VIEW_HTML_HEADER### /** * ###View### View class */ diff --git a/admin/compiler/joomla_3/JViewLegacy_edit_site.php b/admin/compiler/joomla_3/JViewLegacy_edit_site.php index d164e9cee..73753da8b 100644 --- a/admin/compiler/joomla_3/JViewLegacy_edit_site.php +++ b/admin/compiler/joomla_3/JViewLegacy_edit_site.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### - +###SITE_ADMIN_VIEW_HTML_HEADER### /** * ###View### View class */ diff --git a/admin/compiler/joomla_3/JViewLegacy_list.php b/admin/compiler/joomla_3/JViewLegacy_list.php index 2816c8382..2f2718e14 100644 --- a/admin/compiler/joomla_3/JViewLegacy_list.php +++ b/admin/compiler/joomla_3/JViewLegacy_list.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### - +###ADMIN_VIEWS_HTML_HEADER### /** * ###Component### View class for the ###Views### */ diff --git a/admin/compiler/joomla_3/JViewLegacy_list_custom_admin.php b/admin/compiler/joomla_3/JViewLegacy_list_custom_admin.php index 1edd259aa..f128fab13 100644 --- a/admin/compiler/joomla_3/JViewLegacy_list_custom_admin.php +++ b/admin/compiler/joomla_3/JViewLegacy_list_custom_admin.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_GET_MODULE_JIMPORT### - +###CUSTOM_ADMIN_VIEWS_HTML_HEADER### /** * ###Component### View class for the ###SViews### */ diff --git a/admin/compiler/joomla_3/JViewLegacy_list_site.php b/admin/compiler/joomla_3/JViewLegacy_list_site.php index 348f400fc..db213620c 100644 --- a/admin/compiler/joomla_3/JViewLegacy_list_site.php +++ b/admin/compiler/joomla_3/JViewLegacy_list_site.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######SITE_GET_MODULE_JIMPORT### - +###SITE_VIEWS_HTML_HEADER### /** * ###Component### View class for the ###SViews### */ diff --git a/admin/compiler/joomla_3/JViewLegacy_site.php b/admin/compiler/joomla_3/JViewLegacy_site.php index 54b442e09..27473368a 100644 --- a/admin/compiler/joomla_3/JViewLegacy_site.php +++ b/admin/compiler/joomla_3/JViewLegacy_site.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######SITE_GET_MODULE_JIMPORT### - +###SITE_VIEW_HTML_HEADER### /** * ###Component### View class for the ###SView### */ diff --git a/admin/compiler/joomla_3/script.php b/admin/compiler/joomla_3/script.php index d527e5b5a..ccdc18ebf 100644 --- a/admin/compiler/joomla_3/script.php +++ b/admin/compiler/joomla_3/script.php @@ -17,6 +17,8 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; JHTML::_('behavior.modal'); /** @@ -97,12 +99,12 @@ class com_###component###InstallerScript {###PREINSTALLSCRIPT### } // check if the PHPExcel stuff is still around - if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_###component###/helpers/PHPExcel.php')) + if (File::exists(JPATH_ADMINISTRATOR . '/components/com_###component###/helpers/PHPExcel.php')) { // We need to remove this old PHPExcel folder $this->removeFolder(JPATH_ADMINISTRATOR . '/components/com_###component###/helpers/PHPExcel'); // We need to remove this old PHPExcel file - JFile::delete(JPATH_ADMINISTRATOR . '/components/com_###component###/helpers/PHPExcel.php'); + File::delete(JPATH_ADMINISTRATOR . '/components/com_###component###/helpers/PHPExcel.php'); } return true; } @@ -141,7 +143,7 @@ class com_###component###InstallerScript */ protected function removeFolder($dir, $ignore = false) { - if (JFolder::exists($dir)) + if (Folder::exists($dir)) { $it = new RecursiveDirectoryIterator($dir); $it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); @@ -171,7 +173,7 @@ class com_###component###InstallerScript { continue; } - JFolder::delete($file_dir); + Folder::delete($file_dir); } else { @@ -190,13 +192,13 @@ class com_###component###InstallerScript { continue; } - JFile::delete($file_dir); + File::delete($file_dir); } } // delete the root folder if not ignore found if (!$this->checkArray($ignore)) { - return JFolder::delete($dir); + return Folder::delete($dir); } return true; } diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php index e55bc3b1e..24821dd50 100644 --- a/admin/helpers/compiler.php +++ b/admin/helpers/compiler.php @@ -12,6 +12,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; // Use the component builder autoloader ComponentbuilderHelper::autoLoader(); @@ -391,7 +393,7 @@ class Compiler extends Infusion // first we do the static files foreach ($this->newFiles['static'] as $static) { - if (JFile::exists($static['path'])) + if (File::exists($static['path'])) { $this->setFileContent( $static['name'], $static['path'], $bom @@ -410,7 +412,7 @@ class Compiler extends Infusion { if ($file['view'] == $view) { - if (JFile::exists($file['path'])) + if (File::exists($file['path'])) { $this->setFileContent( $file['name'], $file['path'], $bom, @@ -492,7 +494,7 @@ class Compiler extends Infusion // update the module files foreach ($this->newFiles[$module->key] as $module_file) { - if (JFile::exists($module_file['path'])) + if (File::exists($module_file['path'])) { $this->setFileContent( $module_file['name'], $module_file['path'], @@ -573,7 +575,7 @@ class Compiler extends Infusion // update the plugin files foreach ($this->newFiles[$plugin->key] as $plugin_file) { - if (JFile::exists($plugin_file['path'])) + if (File::exists($plugin_file['path'])) { $this->setFileContent( $plugin_file['name'], $plugin_file['path'], @@ -674,7 +676,7 @@ class Compiler extends Infusion $update_server_xml_path = $this->componentPath . '/' . $this->updateServerFileName . '.xml'; // make sure we have the correct file - if (JFile::exists($update_server_xml_path) + if (File::exists($update_server_xml_path) && isset($this->componentData->update_server)) { // move to server @@ -685,7 +687,7 @@ class Compiler extends Infusion $this->componentData->update_server_protocol ); // remove the local file - JFile::delete($update_server_xml_path); + File::delete($update_server_xml_path); } } // move the plugins update server to host @@ -702,7 +704,7 @@ class Compiler extends Infusion && is_numeric($plugin->update_server) && $plugin->update_server > 0 && isset($plugin->update_server_xml_path) - && JFile::exists($plugin->update_server_xml_path) + && File::exists($plugin->update_server_xml_path) && isset($plugin->update_server_xml_file_name) && ComponentbuilderHelper::checkString( $plugin->update_server_xml_file_name @@ -716,7 +718,7 @@ class Compiler extends Infusion $plugin->update_server_protocol ); // remove the local file - JFile::delete($plugin->update_server_xml_path); + File::delete($plugin->update_server_xml_path); } } } @@ -810,7 +812,7 @@ class Compiler extends Infusion if (('README.md' === $static['name'] || 'README.txt' === $static['name']) && $this->componentData->addreadme - && JFile::exists($static['path'])) + && File::exists($static['path'])) { $this->setReadMe($static['path']); $two++; @@ -934,7 +936,7 @@ class Compiler extends Infusion // remove old data $this->removeFolder($repoFullPath, $this->componentData->toignore); // set the new data - JFolder::copy($this->componentPath, $repoFullPath, '', true); + Folder::copy($this->componentPath, $repoFullPath, '', true); // Trigger Event: jcb_ce_onAfterUpdateRepo $this->triggerEvent( 'jcb_ce_onAfterUpdateRepo', @@ -967,7 +969,7 @@ class Compiler extends Infusion $repoFullPath, $this->componentData->toignore ); // set the new data - JFolder::copy( + Folder::copy( $module->folder_path, $repoFullPath, '', true ); // Trigger Event: jcb_ce_onAfterUpdateRepo @@ -1004,7 +1006,7 @@ class Compiler extends Infusion $repoFullPath, $this->componentData->toignore ); // set the new data - JFolder::copy( + Folder::copy( $plugin->folder_path, $repoFullPath, '', true ); // Trigger Event: jcb_ce_onAfterUpdateRepo @@ -1050,7 +1052,7 @@ class Compiler extends Infusion &$this->componentData) ); // copy the zip to backup path - JFile::copy( + File::copy( $this->filepath['component'], $this->backupPath . '/' . $this->componentBackupName . '.zip' @@ -1144,7 +1146,7 @@ class Compiler extends Infusion &$module) ); // copy the zip to backup path - JFile::copy( + File::copy( $this->filepath['modules'][$module->id], $this->backupPath . '/' . $module->zip_name . '.zip' @@ -1238,7 +1240,7 @@ class Compiler extends Infusion &$plugin) ); // copy the zip to backup path - JFile::copy( + File::copy( $this->filepath['plugins'][$plugin->id], $this->backupPath . '/' . $plugin->zip_name . '.zip' @@ -1324,7 +1326,7 @@ class Compiler extends Infusion } $counter = 0; // check if file exist - if (JFile::exists($file)) + if (File::exists($file)) { foreach ( new SplFileObject($file) as $lineNumber => $lineContent diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 22bc9b7cc..f3ec1423b 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -12,6 +12,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; + /** * Compiler class */ @@ -1010,11 +1013,9 @@ class Interpretation extends Fields . " Prep the path a little"; $function[] = $this->_t(2) . "\$path = '/'. trim(str_replace('//', '/', \$path), '/');"; - $function[] = $this->_t(2) - . "jimport('joomla.filesystem.folder');"; - $function[] = $this->_t(2) . "///" . $this->setLine(__LINE__) + $function[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Check if folder exist"; - $function[] = $this->_t(2) . "if (!JFolder::exists(\$path))"; + $function[] = $this->_t(2) . "if (!Folder::exists(\$path))"; $function[] = $this->_t(2) . "{"; $function[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Lock key."; @@ -6660,7 +6661,7 @@ class Interpretation extends Fields __LINE__ ) . " check if the CSS file exists."; $setter .= PHP_EOL . $tabV . $this->_t(5) - . "if (JFile::exists(JPATH_ROOT.'/media/com_" + . "if (File::exists(JPATH_ROOT.'/media/com_" . $this->componentCodeName . "/uikit-v2/css/components/'.\$name.\$style.\$size.'.css'))"; $setter .= PHP_EOL . $tabV . $this->_t(5) . "{"; @@ -6679,7 +6680,7 @@ class Interpretation extends Fields __LINE__ ) . " check if the JavaScript file exists."; $setter .= PHP_EOL . $tabV . $this->_t(5) - . "if (JFile::exists(JPATH_ROOT.'/media/com_" + . "if (File::exists(JPATH_ROOT.'/media/com_" . $this->componentCodeName . "/uikit-v2/js/components/'.\$name.\$size.'.js'))"; $setter .= PHP_EOL . $tabV . $this->_t(5) . "{"; @@ -6717,11 +6718,6 @@ class Interpretation extends Fields . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . "Helper::checkArray(\$uikitComp))"; $setter .= PHP_EOL . $tabV . $this->_t(2) . "{"; - $setter .= PHP_EOL . $tabV . $this->_t(3) . "//" . $this->setLine( - __LINE__ - ) . " load just in case."; - $setter .= PHP_EOL . $tabV . $this->_t(3) - . "jimport('joomla.filesystem.file');"; $setter .= PHP_EOL . $tabV . $this->_t(3) . "//" . $this->setLine( __LINE__ ) . " loading..."; @@ -6736,7 +6732,7 @@ class Interpretation extends Fields __LINE__ ) . " check if the CSS file exists."; $setter .= PHP_EOL . $tabV . $this->_t(5) - . "if (JFile::exists(JPATH_ROOT.'/media/com_" + . "if (File::exists(JPATH_ROOT.'/media/com_" . $this->componentCodeName . "/uikit-v2/css/components/'.\$name.\$style.\$size.'.css'))"; $setter .= PHP_EOL . $tabV . $this->_t(5) . "{"; @@ -6755,7 +6751,7 @@ class Interpretation extends Fields __LINE__ ) . " check if the JavaScript file exists."; $setter .= PHP_EOL . $tabV . $this->_t(5) - . "if (JFile::exists(JPATH_ROOT.'/media/com_" + . "if (File::exists(JPATH_ROOT.'/media/com_" . $this->componentCodeName . "/uikit-v2/js/components/'.\$name.\$size.'.js'))"; $setter .= PHP_EOL . $tabV . $this->_t(5) . "{"; @@ -7225,7 +7221,7 @@ class Interpretation extends Fields $file )) { - if (JFile::exists($file['path'])) + if (File::exists($file['path'])) { $string = ComponentbuilderHelper::getFileContents( $file['path'] @@ -7241,7 +7237,7 @@ class Interpretation extends Fields { if (ComponentbuilderHelper::checkArray($doc)) { - if (JFile::exists($doc['path'])) + if (File::exists($doc['path'])) { $string = ComponentbuilderHelper::getFileContents( @@ -8675,7 +8671,7 @@ class Interpretation extends Fields $script[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " get all the folders"; $script[] = $this->_t(2) - . "\$folders = JFolder::folders(\$installPath);"; + . "\$folders = Folder::folders(\$installPath);"; $script[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " check if we have folders we may want to copy"; $script[] = $this->_t(2) @@ -8697,7 +8693,7 @@ class Interpretation extends Fields $script[] = $this->_t(5) . "//" . $this->setLine(__LINE__) . " now try to copy the folder"; $script[] = $this->_t(5) - . "if (!JFolder::copy(\$src, \$dest, '', true))"; + . "if (!Folder::copy(\$src, \$dest, '', true))"; $script[] = $this->_t(5) . "{"; $script[] = $this->_t(6) . "\$app->enqueueMessage('Could not copy '.\$folder.' folder into place, please make sure destination is writable!', 'error');"; @@ -22388,6 +22384,26 @@ class Interpretation extends Fields case 'site.views': $headers = array(); break; + case 'admin.view.html': + case 'admin.views.html': + case 'site.admin.view.html': + case 'site.view.html': + case 'site.views.html': + case 'custom.admin.view.html': + case 'custom.admin.views.html': + // add a space + $headers = array(''); + // load the file class if uikit is being loaded + if ((2 == $this->uikit || 1 == $this->uikit) + && isset($this->uikitComp[$viewsCodeName]) + && ComponentbuilderHelper::checkArray( + $this->uikitComp[$viewsCodeName] + )) + { + $headers[] = 'use Joomla\CMS\Filesystem\File;'; + $headers[] = ''; + } + break; default: $headers[] = 'use Joomla\Utilities\ArrayHelper;'; break; @@ -22735,7 +22751,7 @@ class Interpretation extends Fields { $imagePath = $this->componentPath . '/admin/assets/images'; // move the image to its place - JFile::copy( + File::copy( JPATH_SITE . '/' . $path, $imagePath . '/vdm-component.' . $type ); @@ -22984,7 +23000,7 @@ class Interpretation extends Fields $imageName = $name . '.' . $type; } // move the image to its place - JFile::copy( + File::copy( JPATH_SITE . '/' . $path, $imagePath . '/' . $imageName ); } @@ -28187,9 +28203,9 @@ function vdm_dkim() { $path = $module->folder_path . '/language/' . $tag . '/'; // create path if not exist - if (!JFolder::exists($path)) + if (!Folder::exists($path)) { - JFolder::create($path); + Folder::create($path); // count the folder created $this->folderCount++; } @@ -28216,8 +28232,8 @@ function vdm_dkim() { } } // get all files and folders in module folder - $files = JFolder::files($module->folder_path); - $folders = JFolder::folders($module->folder_path); + $files = Folder::files($module->folder_path); + $folders = Folder::folders($module->folder_path); // the files/folders to ignore $ignore = array('sql', 'language', 'script.php', $module->file_name . '.xml', @@ -28545,9 +28561,9 @@ function vdm_dkim() { $path = $plugin->folder_path . '/language/' . $tag . '/'; // create path if not exist - if (!JFolder::exists($path)) + if (!Folder::exists($path)) { - JFolder::create($path); + Folder::create($path); // count the folder created $this->folderCount++; } @@ -28577,8 +28593,8 @@ function vdm_dkim() { } } // get all files and folders in plugin folder - $files = JFolder::files($plugin->folder_path); - $folders = JFolder::folders($plugin->folder_path); + $files = Folder::files($plugin->folder_path); + $folders = Folder::folders($plugin->folder_path); // the files/folders to ignore $ignore = array('sql', 'language', 'script.php', $plugin->file_name . '.xml', diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php index 44d78d887..0564bdbf8 100644 --- a/admin/helpers/compiler/f_Infusion.php +++ b/admin/helpers/compiler/f_Infusion.php @@ -648,6 +648,13 @@ class Infusion extends Interpretation 'site.admin.view.model', $nameSingleCode ); + // SITE_ADMIN_VIEW_HTML_HEADER <<>> add the header details for the view + $this->fileContentDynamic[$nameSingleCode][$this->hhh + . 'SITE_ADMIN_VIEW_HTML_HEADER' . $this->hhh] + = $this->setFileHeader( + 'site.admin.view.html', + $nameSingleCode + ); // SITE_ADMIN_VIEW_HEADER <<>> add the header details for the view $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'SITE_ADMIN_VIEW_HEADER' . $this->hhh] @@ -677,6 +684,12 @@ class Infusion extends Interpretation = $this->setFileHeader( 'admin.view.model', $nameSingleCode ); + // ADMIN_VIEW_HTML_HEADER <<>> add the header details for the view + $this->fileContentDynamic[$nameSingleCode][$this->hhh + . 'ADMIN_VIEW_HTML_HEADER' . $this->hhh] + = $this->setFileHeader( + 'admin.view.html', $nameSingleCode + ); // ADMIN_VIEW_HEADER <<>> add the header details for the view $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'ADMIN_VIEW_HEADER' . $this->hhh] @@ -1049,6 +1062,12 @@ class Infusion extends Interpretation = $this->setFileHeader( 'admin.views.model', $nameListCode ); + // ADMIN_VIEWS_HTML_HEADER <<>> add the header details for the views + $this->fileContentDynamic[$nameListCode][$this->hhh + . 'ADMIN_VIEWS_HTML_HEADER' . $this->hhh] + = $this->setFileHeader( + 'admin.views.html', $nameListCode + ); // ADMIN_VIEWS_HEADER <<>> add the header details for the views $this->fileContentDynamic[$nameListCode][$this->hhh . 'ADMIN_VIEWS_HEADER' . $this->hhh] @@ -1510,6 +1529,12 @@ class Infusion extends Interpretation = $this->setFileHeader( 'custom.admin.view.model', $view['settings']->code ); + // CUSTOM_ADMIN_VIEW_HTML_HEADER <<>> add the header details for the view + $this->fileContentDynamic[$view['settings']->code][$this->hhh + . 'CUSTOM_ADMIN_VIEW_HTML_HEADER' . $this->hhh] + = $this->setFileHeader( + 'custom.admin.view.html', $view['settings']->code + ); // CUSTOM_ADMIN_VIEW_HEADER <<>> add the header details for the view $this->fileContentDynamic[$view['settings']->code][$this->hhh . 'CUSTOM_ADMIN_VIEW_HEADER' . $this->hhh] @@ -1532,6 +1557,12 @@ class Infusion extends Interpretation = $this->setFileHeader( 'custom.admin.views.model', $view['settings']->code ); + // CUSTOM_ADMIN_VIEWS_HTML_HEADER <<>> add the header details for the view + $this->fileContentDynamic[$view['settings']->code][$this->hhh + . 'CUSTOM_ADMIN_VIEWS_HTML_HEADER' . $this->hhh] + = $this->setFileHeader( + 'custom.admin.views.html', $view['settings']->code + ); // CUSTOM_ADMIN_VIEWS_HEADER <<>> add the header details for the view $this->fileContentDynamic[$view['settings']->code][$this->hhh . 'CUSTOM_ADMIN_VIEWS_HEADER' . $this->hhh] @@ -2026,6 +2057,12 @@ class Infusion extends Interpretation = $this->setFileHeader( 'site.view.model', $view['settings']->code ); + // SITE_VIEW_HTML_HEADER <<>> add the header details for the view + $this->fileContentDynamic[$view['settings']->code][$this->hhh + . 'SITE_VIEW_HTML_HEADER' . $this->hhh] + = $this->setFileHeader( + 'site.view.html', $view['settings']->code + ); // SITE_VIEW_HEADER <<>> add the header details for the view $this->fileContentDynamic[$view['settings']->code][$this->hhh . 'SITE_VIEW_HEADER' . $this->hhh] @@ -2054,6 +2091,12 @@ class Infusion extends Interpretation = $this->setFileHeader( 'site.views.model', $view['settings']->code ); + // SITE_VIEWS_HTML_HEADER <<>> add the header details for the view + $this->fileContentDynamic[$view['settings']->code][$this->hhh + . 'SITE_VIEWS_HTML_HEADER' . $this->hhh] + = $this->setFileHeader( + 'site.views.html', $view['settings']->code + ); // SITE_VIEWS_HEADER <<>> add the header details for the view $this->fileContentDynamic[$view['settings']->code][$this->hhh . 'SITE_VIEWS_HEADER' . $this->hhh] diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index e05ce28a5..f53899dbf 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -1184,9 +1184,6 @@ abstract class ComponentbuilderHelper if ('compiler' === $type) { // import the Joomla librarys - jimport('joomla.filesystem.file'); - jimport('joomla.filesystem.folder'); - jimport('joomla.filesystem.archive'); jimport('joomla.application.component.modellist'); // include class to minify js require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/js.php'; @@ -1195,9 +1192,6 @@ abstract class ComponentbuilderHelper if ('smart' === $type) { // import the Joomla libraries - jimport('joomla.filesystem.file'); - jimport('joomla.filesystem.folder'); - jimport('joomla.filesystem.archive'); jimport('joomla.application.component.modellist'); } // load this for all diff --git a/admin/models/import.php b/admin/models/import.php index 9bdf37abd..b7a912d95 100644 --- a/admin/models/import.php +++ b/admin/models/import.php @@ -12,6 +12,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; use Joomla\Utilities\ArrayHelper; use PhpOffice\PhpSpreadsheet\IOFactory; @@ -222,7 +224,7 @@ class ComponentbuilderModelImport extends JModelLegacy // Move uploaded file jimport('joomla.filesystem.file'); - $p_file = JFile::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); + $p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); // Was the package downloaded? if (!$p_file) @@ -400,12 +402,12 @@ class ComponentbuilderModelImport extends JModelLegacy // Is the package file a valid file? if (is_file($package)) { - JFile::delete($package); + File::delete($package); } elseif (is_file(JPath::clean($package))) { // It might also be just a base filename - JFile::delete(JPath::clean($package)); + File::delete(JPath::clean($package)); } } diff --git a/admin/models/import_joomla_components.php b/admin/models/import_joomla_components.php index c9cb08db3..5e2a000ac 100644 --- a/admin/models/import_joomla_components.php +++ b/admin/models/import_joomla_components.php @@ -12,6 +12,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; use Joomla\Utilities\ArrayHelper; use PhpOffice\PhpSpreadsheet\IOFactory; @@ -390,8 +392,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy $tmp_src = $userfile['tmp_name']; // Move uploaded file - jimport('joomla.filesystem.file'); - $p_file = JFile::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); + $p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); // Was the package downloaded? if (!$p_file) @@ -570,12 +571,12 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy // Is the package file a valid file? if (is_file($package)) { - JFile::delete($package); + File::delete($package); } elseif (is_file(JPath::clean($package))) { // It might also be just a base filename - JFile::delete(JPath::clean($package)); + File::delete(JPath::clean($package)); } } diff --git a/admin/models/import_language_translations.php b/admin/models/import_language_translations.php index 63a42a0ab..f53b5fb71 100644 --- a/admin/models/import_language_translations.php +++ b/admin/models/import_language_translations.php @@ -12,6 +12,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; use Joomla\Utilities\ArrayHelper; use PhpOffice\PhpSpreadsheet\IOFactory; @@ -219,8 +221,7 @@ class ComponentbuilderModelImport_language_translations extends JModelLegacy $tmp_src = $userfile['tmp_name']; // Move uploaded file - jimport('joomla.filesystem.file'); - $p_file = JFile::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); + $p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); // Was the package downloaded? if (!$p_file) @@ -398,12 +399,12 @@ class ComponentbuilderModelImport_language_translations extends JModelLegacy // Is the package file a valid file? if (is_file($package)) { - JFile::delete($package); + File::delete($package); } elseif (is_file(JPath::clean($package))) { // It might also be just a base filename - JFile::delete(JPath::clean($package)); + File::delete(JPath::clean($package)); } } diff --git a/admin/views/compiler/view.html.php b/admin/views/compiler/view.html.php index ead33c6db..d9b0fa706 100644 --- a/admin/views/compiler/view.html.php +++ b/admin/views/compiler/view.html.php @@ -12,6 +12,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\File; + /** * Componentbuilder View class for the Compiler */ @@ -260,13 +262,13 @@ class ComponentbuilderViewCompiler extends JViewLegacy foreach (ComponentbuilderHelper::$uk_components[$class] as $name) { // check if the CSS file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css')) + if (File::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. $this->document->addStyleSheet(JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); } // check if the JavaScript file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js')) + if (File::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. $this->document->addScript(JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); diff --git a/admin/views/get_snippets/view.html.php b/admin/views/get_snippets/view.html.php index 586f626de..b5745ec9d 100644 --- a/admin/views/get_snippets/view.html.php +++ b/admin/views/get_snippets/view.html.php @@ -12,6 +12,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\File; + /** * Componentbuilder View class for the Get_snippets */ @@ -104,13 +106,13 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy foreach (ComponentbuilderHelper::$uk_components[$class] as $name) { // check if the CSS file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css')) + if (File::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. $this->document->addStyleSheet(JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); } // check if the JavaScript file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js')) + if (File::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. $this->document->addScript(JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); diff --git a/script.php b/script.php index db534ddd2..5eab94412 100644 --- a/script.php +++ b/script.php @@ -12,6 +12,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; JHTML::_('behavior.modal'); /** @@ -5988,12 +5990,12 @@ class com_componentbuilderInstallerScript { } // check if the PHPExcel stuff is still around - if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/PHPExcel.php')) + if (File::exists(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/PHPExcel.php')) { // We need to remove this old PHPExcel folder $this->removeFolder(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/PHPExcel'); // We need to remove this old PHPExcel file - JFile::delete(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/PHPExcel.php'); + File::delete(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/PHPExcel.php'); } return true; } @@ -10887,7 +10889,7 @@ class com_componentbuilderInstallerScript */ protected function removeFolder($dir, $ignore = false) { - if (JFolder::exists($dir)) + if (Folder::exists($dir)) { $it = new RecursiveDirectoryIterator($dir); $it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); @@ -10917,7 +10919,7 @@ class com_componentbuilderInstallerScript { continue; } - JFolder::delete($file_dir); + Folder::delete($file_dir); } else { @@ -10936,13 +10938,13 @@ class com_componentbuilderInstallerScript { continue; } - JFile::delete($file_dir); + File::delete($file_dir); } } // delete the root folder if not ignore found if (!$this->checkArray($ignore)) { - return JFolder::delete($dir); + return Folder::delete($dir); } return true; } @@ -10988,7 +10990,7 @@ class com_componentbuilderInstallerScript $installer = $parent->getParent(); $installPath = $installer->getPath('source'); // get all the folders - $folders = JFolder::folders($installPath); + $folders = Folder::folders($installPath); // check if we have folders we may want to copy $doNotCopy = array('media','admin','site'); // Joomla already deals with these if (count((array) $folders) > 1) @@ -11003,7 +11005,7 @@ class com_componentbuilderInstallerScript // set the destination path $dest = JPATH_ROOT.'/'.$folder; // now try to copy the folder - if (!JFolder::copy($src, $dest, '', true)) + if (!Folder::copy($src, $dest, '', true)) { $app->enqueueMessage('Could not copy '.$folder.' folder into place, please make sure destination is writable!', 'error'); } diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index 80558bf24..1c54be7cb 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -1181,9 +1181,6 @@ abstract class ComponentbuilderHelper if ('compiler' === $type) { // import the Joomla librarys - jimport('joomla.filesystem.file'); - jimport('joomla.filesystem.folder'); - jimport('joomla.filesystem.archive'); jimport('joomla.application.component.modellist'); // include class to minify js require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/js.php'; @@ -1192,9 +1189,6 @@ abstract class ComponentbuilderHelper if ('smart' === $type) { // import the Joomla libraries - jimport('joomla.filesystem.file'); - jimport('joomla.filesystem.folder'); - jimport('joomla.filesystem.archive'); jimport('joomla.application.component.modellist'); } // load this for all