File and folder path fix for Joomla 3.9.25 #692

Merged
Llewellyn merged 6 commits from staging into master 2021-03-11 03:04:50 +00:00
1649 changed files with 116040 additions and 115957 deletions

View File

@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.12.8) 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.12.9) 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)
@ -143,11 +143,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 5th March, 2021
+ *Version*: 2.12.8
+ *Last Build*: 10th March, 2021
+ *Version*: 2.12.9
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **292184**
+ *Line count*: **292188**
+ *Field count*: **1629**
+ *File count*: **1935**
+ *Folder count*: **322**

View File

@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.12.8) 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.12.9) 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)
@ -143,11 +143,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 5th March, 2021
+ *Version*: 2.12.8
+ *Last Build*: 10th March, 2021
+ *Version*: 2.12.9
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **292184**
+ *Line count*: **292188**
+ *Field count*: **1629**
+ *File count*: **1935**
+ *Folder count*: **322**

View File

@ -569,12 +569,12 @@ abstract class ###Component###Helper
$filePath = $path . '/' . $name . '.php';
$fullPathModel = $fullPathModels . '/' . $name . '.php';
// check if it exists
if (JFile::exists($filePath))
if (File::exists($filePath))
{
// get the file
require_once $filePath;
}
elseif (JFile::exists($fullPathModel))
elseif (File::exists($fullPathModel))
{
// get the file
require_once $fullPathModel;

View File

@ -201,12 +201,12 @@ abstract class ###Component###Helper
$filePath = $path . '/' . $name . '.php';
$fullPathModel = $fullPathModels . '/' . $name . '.php';
// check if it exists
if (JFile::exists($filePath))
if (File::exists($filePath))
{
// get the file
require_once $filePath;
}
elseif (JFile::exists($fullPathModel))
elseif (File::exists($fullPathModel))
{
// get the file
require_once $fullPathModel;

View File

@ -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###

View File

@ -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###

View File

@ -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###
*/

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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###
*/

View File

@ -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###
*/

View File

@ -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###
*/

View File

@ -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###
*/

View File

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

View File

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

View File

@ -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;
/**
* Get class as the main compilers class
*/
@ -7248,7 +7251,7 @@ class Get
if ((!filter_var($target, FILTER_VALIDATE_URL) === false
&& ComponentbuilderHelper::urlExists($target))
|| (JPath::clean($target) === $target
&& JFile::exists($target)))
&& File::exists($target)))
{
$this->getExternalCodeString($target, $bucket);
}
@ -10344,7 +10347,7 @@ class Get
foreach ($fileTypes as $type)
{
// get a list of files in the current directory tree (only PHP, JS and XML for now)
$files = JFolder::files('.', $type, true, true);
$files = Folder::files('.', $type, true, true);
// check if files found
if (ComponentbuilderHelper::checkArray($files))
{
@ -11540,7 +11543,7 @@ class Get
// check if the local install is found
foreach ($localPaths as $key => $localPath)
{
if (!JFolder::exists($localPath))
if (!Folder::exists($localPath))
{
unset($localPaths[$key]);
}

View File

@ -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;
/**
* Structure class
*/
@ -1403,12 +1406,12 @@ class Structure extends Get
private function createFolder($path)
{
// check if the path exist
if (!JFolder::exists(
if (!Folder::exists(
$path
))
{
// create the path
JFolder::create(
Folder::create(
$path
);
// count the folder created
@ -1436,9 +1439,9 @@ class Structure extends Get
array(&$this->componentContext, &$this->libraries)
);
// creat the main component folder
if (!JFolder::exists($this->componentPath))
if (!Folder::exists($this->componentPath))
{
JFolder::create($this->componentPath);
Folder::create($this->componentPath);
// count the folder created
$this->folderCount++;
$this->indexHTML('');
@ -1736,9 +1739,9 @@ class Structure extends Get
))
{
// creat the main component folder
if (!JFolder::exists($this->componentPath))
if (!Folder::exists($this->componentPath))
{
JFolder::create($this->componentPath);
Folder::create($this->componentPath);
// count the folder created
$this->folderCount++;
$this->indexHTML('');
@ -1995,7 +1998,7 @@ class Structure extends Get
// now move the file
if ($details->type === 'file')
{
if (!JFile::exists($currentFullPath))
if (!File::exists($currentFullPath))
{
$this->app->enqueueMessage(
JText::_('<hr /><h3>File Path Error</h3>'), 'Error'
@ -2014,12 +2017,12 @@ class Structure extends Get
basename($packageFullPath), '', $packageFullPath
);
// check if path exist, if not creat it
if (!JFolder::exists($packageFullPath0nly))
if (!Folder::exists($packageFullPath0nly))
{
JFolder::create($packageFullPath0nly);
Folder::create($packageFullPath0nly);
}
// move the file to its place
JFile::copy($currentFullPath, $packageFullPath);
File::copy($currentFullPath, $packageFullPath);
// count the file created
$this->fileCount++;
// store the new files
@ -2054,7 +2057,7 @@ class Structure extends Get
}
elseif ($details->type === 'folder')
{
if (!JFolder::exists($currentFullPath))
if (!Folder::exists($currentFullPath))
{
$this->app->enqueueMessage(
JText::_('<hr /><h3>Folder Path Error</h3>'),
@ -2070,7 +2073,7 @@ class Structure extends Get
else
{
// move the folder to its place
JFolder::copy(
Folder::copy(
$currentFullPath, $packageFullPath, '', true
);
// count the folder created
@ -2359,13 +2362,13 @@ class Structure extends Get
if (!isset($this->extentionTrackingFilesMoved[$check]))
{
// check files exist
if (JFile::exists(
if (File::exists(
$this->componentPath . '/admin/models/fields/'
. $field['type_name'] . '.php'
))
{
// copy the custom field
JFile::copy(
File::copy(
$this->componentPath . '/admin/models/fields/'
. $field['type_name'] . '.php',
$path . '/fields/' . $field['type_name'] . '.php'
@ -2386,14 +2389,14 @@ class Structure extends Get
if (!isset($this->extentionTrackingFilesMoved[$check]))
{
// check files exist
if (JFile::exists(
if (File::exists(
$this->componentPath . '/admin/models/rules/'
. $this->validationLinkedFields[$field['field']]
. '.php'
))
{
// copy the custom field
JFile::copy(
File::copy(
$this->componentPath . '/admin/models/rules/'
. $this->validationLinkedFields[$field['field']]
. '.php', $path . '/rules/'
@ -2651,9 +2654,9 @@ class Structure extends Get
}
// setup the folder
if (!JFolder::exists($path))
if (!Folder::exists($path))
{
JFolder::create($path);
Folder::create($path);
$this->indexHTML($zipPath);
// count the folder created
$this->folderCount++;
@ -2683,10 +2686,10 @@ class Structure extends Get
{
$new = $item;
}
if (!JFile::exists($path . '/' . $new))
if (!File::exists($path . '/' . $new))
{
// move the file to its place
JFile::copy(
File::copy(
$this->templatePath . '/' . $item,
$path . '/' . $new
);
@ -3043,7 +3046,7 @@ class Structure extends Get
// use path if exist
if (strlen($path) > 0)
{
JFile::copy(
File::copy(
$this->templatePath . '/index.html',
$root . $path . '/index.html'
);
@ -3052,7 +3055,7 @@ class Structure extends Get
}
else
{
JFile::copy(
File::copy(
$this->templatePath . '/index.html', $root . '/index.html'
);
// count the file created

View File

@ -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.";
@ -1565,12 +1566,15 @@ class Interpretation extends Fields
{
if ($this->addEximport)
{
// we use the company name set in the GUI
$company_name = $this->fileContentStatic[$this->hhh . 'COMPANYNAME' . $this->hhh];
// start building the xml function
$exel = array();
$exel[] = PHP_EOL . PHP_EOL . $this->_t(1) . "/**";
$exel[] = $this->_t(1) . "* Prepares the xml document";
$exel[] = $this->_t(1) . "*/";
$exel[] = $this->_t(1)
. "public static function xls(\$rows, \$fileName = null, \$title = null, \$subjectTab = null, \$creator = 'Joomla Component Builder', \$description = null, \$category = null,\$keywords = null, \$modified = null)";
. "public static function xls(\$rows, \$fileName = null, \$title = null, \$subjectTab = null, \$creator = '$company_name', \$description = null, \$category = null,\$keywords = null, \$modified = null)";
$exel[] = $this->_t(1) . "{";
$exel[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
. " set the user";
@ -1611,7 +1615,7 @@ class Interpretation extends Fields
. " Set document properties";
$exel[] = $this->_t(2) . "\$spreadsheet->getProperties()";
$exel[] = $this->_t(3) . "->setCreator(\$creator)";
$exel[] = $this->_t(3) . "->setCompany('Joomla Component Builder')";
$exel[] = $this->_t(3) . "->setCompany('$company_name')";
$exel[] = $this->_t(3) . "->setLastModifiedBy(\$modified)";
$exel[] = $this->_t(3) . "->setTitle(\$title)";
$exel[] = $this->_t(3) . "->setSubject(\$subjectTab);";
@ -6660,7 +6664,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 +6683,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 +6721,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 +6735,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 +6754,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 +7224,7 @@ class Interpretation extends Fields
$file
))
{
if (JFile::exists($file['path']))
if (File::exists($file['path']))
{
$string = ComponentbuilderHelper::getFileContents(
$file['path']
@ -7241,7 +7240,7 @@ class Interpretation extends Fields
{
if (ComponentbuilderHelper::checkArray($doc))
{
if (JFile::exists($doc['path']))
if (File::exists($doc['path']))
{
$string
= ComponentbuilderHelper::getFileContents(
@ -8675,7 +8674,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 +8696,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');";
@ -22346,6 +22345,7 @@ class Interpretation extends Fields
break;
case 'admin.helper':
case 'site.helper':
$headers[] = 'use Joomla\CMS\Filesystem\File;';
$headers[] = 'use Joomla\CMS\Language\Language;';
$headers[] = 'use Joomla\Registry\Registry;';
$headers[] = 'use Joomla\String\StringHelper;';
@ -22387,6 +22387,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;
@ -22734,7 +22754,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
);
@ -22983,7 +23003,7 @@ class Interpretation extends Fields
$imageName = $name . '.' . $type;
}
// move the image to its place
JFile::copy(
File::copy(
JPATH_SITE . '/' . $path, $imagePath . '/' . $imageName
);
}
@ -28186,9 +28206,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++;
}
@ -28215,8 +28235,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',
@ -28544,9 +28564,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++;
}
@ -28576,8 +28596,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',

View File

@ -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;
/**
* Infusion class
*/
@ -645,6 +648,13 @@ class Infusion extends Interpretation
'site.admin.view.model',
$nameSingleCode
);
// SITE_ADMIN_VIEW_HTML_HEADER <<<DYNAMIC>>> 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 <<<DYNAMIC>>> add the header details for the view
$this->fileContentDynamic[$nameSingleCode][$this->hhh
. 'SITE_ADMIN_VIEW_HEADER' . $this->hhh]
@ -674,6 +684,12 @@ class Infusion extends Interpretation
= $this->setFileHeader(
'admin.view.model', $nameSingleCode
);
// ADMIN_VIEW_HTML_HEADER <<<DYNAMIC>>> 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 <<<DYNAMIC>>> add the header details for the view
$this->fileContentDynamic[$nameSingleCode][$this->hhh
. 'ADMIN_VIEW_HEADER' . $this->hhh]
@ -1046,6 +1062,12 @@ class Infusion extends Interpretation
= $this->setFileHeader(
'admin.views.model', $nameListCode
);
// ADMIN_VIEWS_HTML_HEADER <<<DYNAMIC>>> 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 <<<DYNAMIC>>> add the header details for the views
$this->fileContentDynamic[$nameListCode][$this->hhh
. 'ADMIN_VIEWS_HEADER' . $this->hhh]
@ -1507,6 +1529,12 @@ class Infusion extends Interpretation
= $this->setFileHeader(
'custom.admin.view.model', $view['settings']->code
);
// CUSTOM_ADMIN_VIEW_HTML_HEADER <<<DYNAMIC>>> 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 <<<DYNAMIC>>> add the header details for the view
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'CUSTOM_ADMIN_VIEW_HEADER' . $this->hhh]
@ -1529,6 +1557,12 @@ class Infusion extends Interpretation
= $this->setFileHeader(
'custom.admin.views.model', $view['settings']->code
);
// CUSTOM_ADMIN_VIEWS_HTML_HEADER <<<DYNAMIC>>> 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 <<<DYNAMIC>>> add the header details for the view
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'CUSTOM_ADMIN_VIEWS_HEADER' . $this->hhh]
@ -2023,6 +2057,12 @@ class Infusion extends Interpretation
= $this->setFileHeader(
'site.view.model', $view['settings']->code
);
// SITE_VIEW_HTML_HEADER <<<DYNAMIC>>> 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 <<<DYNAMIC>>> add the header details for the view
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'SITE_VIEW_HEADER' . $this->hhh]
@ -2051,6 +2091,12 @@ class Infusion extends Interpretation
= $this->setFileHeader(
'site.views.model', $view['settings']->code
);
// SITE_VIEWS_HTML_HEADER <<<DYNAMIC>>> 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 <<<DYNAMIC>>> add the header details for the view
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'SITE_VIEWS_HEADER' . $this->hhh]
@ -2620,14 +2666,14 @@ class Infusion extends Interpretation
// build the path to place the lang file
$path = $this->componentPath . '/' . $p . '/language/'
. $tag . '/';
if (!JFolder::exists($path))
if (!Folder::exists($path))
{
JFolder::create($path);
Folder::create($path);
// count the folder created
$this->folderCount++;
}
// move the file to its place
JFile::copy($getPAth, $path . $file_name);
File::copy($getPAth, $path . $file_name);
// count the file created
$this->fileCount++;
// add content to it

View File

@ -19,6 +19,10 @@ use Joomla\Utilities\ArrayHelper;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use Joomla\Archive\Archive;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Filesystem\Path;
/**
* Componentbuilder component helper.
@ -796,7 +800,7 @@ abstract class ComponentbuilderHelper
// set the path to the form validation rules
$path = JPATH_LIBRARIES . '/src/Form/Rule';
// check if the path exist
if (!JFolder::exists($path))
if (!Folder::exists($path))
{
return false;
}
@ -805,7 +809,7 @@ abstract class ComponentbuilderHelper
// go to that folder
chdir($path);
// load all the files in this path
$items = JFolder::files('.', '\.php', true, true);
$items = Folder::files('.', '\.php', true, true);
// change back to Joomla working directory
chdir($joomla);
// make sure we have an array
@ -1108,7 +1112,7 @@ abstract class ComponentbuilderHelper
*/
public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true)
{
if (JFolder::exists($folder))
if (Folder::exists($folder))
{
// we must first store the current woking directory
$joomla = getcwd();
@ -1121,18 +1125,18 @@ abstract class ComponentbuilderHelper
foreach ($fileTypes as $type)
{
// get a list of files in the current directory tree
$files[] = JFolder::files('.', $type, $recurse, $full);
$files[] = Folder::files('.', $type, $recurse, $full);
}
}
elseif (self::checkString($fileTypes))
{
// get a list of files in the current directory tree
$files[] = JFolder::files('.', $fileTypes, $recurse, $full);
$files[] = Folder::files('.', $fileTypes, $recurse, $full);
}
else
{
// get a list of files in the current directory tree
$files[] = JFolder::files('.', '.', $recurse, $full);
$files[] = Folder::files('.', '.', $recurse, $full);
}
// change back to Joomla working directory
chdir($joomla);
@ -1180,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';
@ -1191,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
@ -2191,9 +2189,9 @@ abstract class ComponentbuilderHelper
md5($image_data) === $target['hash'])
{
// create the JCB type path if it does not exist
if (!JFolder::exists(JPATH_ROOT . "/administrator/components/com_componentbuilder/assets/images/$type"))
if (!Folder::exists(JPATH_ROOT . "/administrator/components/com_componentbuilder/assets/images/$type"))
{
JFolder::create(JPATH_ROOT . "/administrator/components/com_componentbuilder/assets/images/$type");
Folder::create(JPATH_ROOT . "/administrator/components/com_componentbuilder/assets/images/$type");
}
// only set the image if the data match the hash
self::writeFile($path, $image_data);
@ -2697,20 +2695,20 @@ abstract class ComponentbuilderHelper
chdir($workingDIR);
// the full file path of the zip file
$filepath = JPath::clean($filepath);
$filepath = Path::clean($filepath);
// delete an existing zip file (or use an exclusion parameter in JFolder::files()
JFile::delete($filepath);
// delete an existing zip file (or use an exclusion parameter in Folder::files()
File::delete($filepath);
// get a list of files in the current directory tree
$files = JFolder::files('.', '', true, true);
$files = Folder::files('.', '', true, true);
$zipArray = array();
// setup the zip array
foreach ($files as $file)
{
$tmp = array();
$tmp['name'] = str_replace('./', '', $file);
$tmp['data'] = JFile::read($file);
$tmp['data'] = self::getFileContents($file);
$tmp['time'] = filemtime($file);
$zipArray[] = $tmp;
}
@ -2719,7 +2717,8 @@ abstract class ComponentbuilderHelper
chdir($joomla);
// get the zip adapter
$zip = JArchive::getAdapter('zip');
$adapter = new Archive();
$zip = $adapter->getAdapter('zip');
//create the zip file
if ($zip->create($filepath, $zipArray))
@ -2774,7 +2773,7 @@ abstract class ComponentbuilderHelper
*/
public static function removeFolder($dir, $ignore = false)
{
if (JFolder::exists($dir))
if (Folder::exists($dir))
{
$it = new RecursiveDirectoryIterator($dir);
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
@ -2804,7 +2803,7 @@ abstract class ComponentbuilderHelper
{
continue;
}
JFolder::delete($file_dir);
Folder::delete($file_dir);
}
else
{
@ -2823,13 +2822,13 @@ abstract class ComponentbuilderHelper
{
continue;
}
JFile::delete($file_dir);
File::delete($file_dir);
}
}
// delete the root folder if not ignore found
if (!self::checkArray($ignore))
{
return JFolder::delete($dir);
return Folder::delete($dir);
}
return true;
}
@ -4118,11 +4117,10 @@ abstract class ComponentbuilderHelper
{
$filePath = $default;
}
jimport('joomla.filesystem.folder');
// create the folder if it does not exist
if ($createIfNotSet && !JFolder::exists($filePath))
if ($createIfNotSet && !Folder::exists($filePath))
{
JFolder::create($filePath);
Folder::create($filePath);
}
// setup the file name
$fileName = '';
@ -4187,11 +4185,10 @@ abstract class ComponentbuilderHelper
self::$params = JComponentHelper::getParams('com_componentbuilder');
}
$folderPath = self::$params->get($target, $default);
jimport('joomla.filesystem.folder');
// create the folder if it does not exist
if ($createIfNotSet && !JFolder::exists($folderPath))
if ($createIfNotSet && !Folder::exists($folderPath))
{
JFolder::create($folderPath);
Folder::create($folderPath);
}
// return the url
if ('url' === $type)
@ -7680,12 +7677,12 @@ abstract class ComponentbuilderHelper
$filePath = $path . '/' . $name . '.php';
$fullPathModel = $fullPathModels . '/' . $name . '.php';
// check if it exists
if (JFile::exists($filePath))
if (File::exists($filePath))
{
// get the file
require_once $filePath;
}
elseif (JFile::exists($fullPathModel))
elseif (File::exists($fullPathModel))
{
// get the file
require_once $fullPathModel;

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

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

View File

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

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>5th March, 2021</creationDate>
<creationDate>10th March, 2021</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>2.12.8</version>
<version>2.12.9</version>
<description><![CDATA[
<h1>Component Builder (v.2.12.8)</h1>
<h1>Component Builder (v.2.12.9)</h1>
<div style="clear: both;"></div>
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.

View File

@ -1024,10 +1024,10 @@
<description>Builds Complex Joomla Components</description>
<element>com_componentbuilder</element>
<type>component</type>
<version>2.12.8</version>
<version>2.12.9</version>
<infourl title="Component Builder!">http://www.joomlacomponentbuilder.com</infourl>
<downloads>
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.12.8/JCB_v2.12.8.zip</downloadurl>
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.12.9/JCB_v2.12.9.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>

View File

@ -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;
}
@ -9250,7 +9252,7 @@ class com_componentbuilderInstallerScript
echo '<a target="_blank" href="http://www.joomlacomponentbuilder.com" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 2.12.8 Was Successful! Let us know if anything is not working as expected.</h3>';
<h3>Upgrade to Version 2.12.9 Was Successful! Let us know if anything is not working as expected.</h3>';
// Set db if not set already.
if (!isset($db))
@ -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');
}

View File

@ -16,6 +16,10 @@ use Joomla\CMS\Language\Language;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\Archive\Archive;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Filesystem\Path;
/**
* Componentbuilder component helper
@ -793,7 +797,7 @@ abstract class ComponentbuilderHelper
// set the path to the form validation rules
$path = JPATH_LIBRARIES . '/src/Form/Rule';
// check if the path exist
if (!JFolder::exists($path))
if (!Folder::exists($path))
{
return false;
}
@ -802,7 +806,7 @@ abstract class ComponentbuilderHelper
// go to that folder
chdir($path);
// load all the files in this path
$items = JFolder::files('.', '\.php', true, true);
$items = Folder::files('.', '\.php', true, true);
// change back to Joomla working directory
chdir($joomla);
// make sure we have an array
@ -1105,7 +1109,7 @@ abstract class ComponentbuilderHelper
*/
public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true)
{
if (JFolder::exists($folder))
if (Folder::exists($folder))
{
// we must first store the current woking directory
$joomla = getcwd();
@ -1118,18 +1122,18 @@ abstract class ComponentbuilderHelper
foreach ($fileTypes as $type)
{
// get a list of files in the current directory tree
$files[] = JFolder::files('.', $type, $recurse, $full);
$files[] = Folder::files('.', $type, $recurse, $full);
}
}
elseif (self::checkString($fileTypes))
{
// get a list of files in the current directory tree
$files[] = JFolder::files('.', $fileTypes, $recurse, $full);
$files[] = Folder::files('.', $fileTypes, $recurse, $full);
}
else
{
// get a list of files in the current directory tree
$files[] = JFolder::files('.', '.', $recurse, $full);
$files[] = Folder::files('.', '.', $recurse, $full);
}
// change back to Joomla working directory
chdir($joomla);
@ -1177,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';
@ -1188,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
@ -2188,9 +2186,9 @@ abstract class ComponentbuilderHelper
md5($image_data) === $target['hash'])
{
// create the JCB type path if it does not exist
if (!JFolder::exists(JPATH_ROOT . "/administrator/components/com_componentbuilder/assets/images/$type"))
if (!Folder::exists(JPATH_ROOT . "/administrator/components/com_componentbuilder/assets/images/$type"))
{
JFolder::create(JPATH_ROOT . "/administrator/components/com_componentbuilder/assets/images/$type");
Folder::create(JPATH_ROOT . "/administrator/components/com_componentbuilder/assets/images/$type");
}
// only set the image if the data match the hash
self::writeFile($path, $image_data);
@ -2694,20 +2692,20 @@ abstract class ComponentbuilderHelper
chdir($workingDIR);
// the full file path of the zip file
$filepath = JPath::clean($filepath);
$filepath = Path::clean($filepath);
// delete an existing zip file (or use an exclusion parameter in JFolder::files()
JFile::delete($filepath);
// delete an existing zip file (or use an exclusion parameter in Folder::files()
File::delete($filepath);
// get a list of files in the current directory tree
$files = JFolder::files('.', '', true, true);
$files = Folder::files('.', '', true, true);
$zipArray = array();
// setup the zip array
foreach ($files as $file)
{
$tmp = array();
$tmp['name'] = str_replace('./', '', $file);
$tmp['data'] = JFile::read($file);
$tmp['data'] = self::getFileContents($file);
$tmp['time'] = filemtime($file);
$zipArray[] = $tmp;
}
@ -2716,7 +2714,8 @@ abstract class ComponentbuilderHelper
chdir($joomla);
// get the zip adapter
$zip = JArchive::getAdapter('zip');
$adapter = new Archive();
$zip = $adapter->getAdapter('zip');
//create the zip file
if ($zip->create($filepath, $zipArray))
@ -2771,7 +2770,7 @@ abstract class ComponentbuilderHelper
*/
public static function removeFolder($dir, $ignore = false)
{
if (JFolder::exists($dir))
if (Folder::exists($dir))
{
$it = new RecursiveDirectoryIterator($dir);
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
@ -2801,7 +2800,7 @@ abstract class ComponentbuilderHelper
{
continue;
}
JFolder::delete($file_dir);
Folder::delete($file_dir);
}
else
{
@ -2820,13 +2819,13 @@ abstract class ComponentbuilderHelper
{
continue;
}
JFile::delete($file_dir);
File::delete($file_dir);
}
}
// delete the root folder if not ignore found
if (!self::checkArray($ignore))
{
return JFolder::delete($dir);
return Folder::delete($dir);
}
return true;
}
@ -4115,11 +4114,10 @@ abstract class ComponentbuilderHelper
{
$filePath = $default;
}
jimport('joomla.filesystem.folder');
// create the folder if it does not exist
if ($createIfNotSet && !JFolder::exists($filePath))
if ($createIfNotSet && !Folder::exists($filePath))
{
JFolder::create($filePath);
Folder::create($filePath);
}
// setup the file name
$fileName = '';
@ -4184,11 +4182,10 @@ abstract class ComponentbuilderHelper
self::$params = JComponentHelper::getParams('com_componentbuilder');
}
$folderPath = self::$params->get($target, $default);
jimport('joomla.filesystem.folder');
// create the folder if it does not exist
if ($createIfNotSet && !JFolder::exists($folderPath))
if ($createIfNotSet && !Folder::exists($folderPath))
{
JFolder::create($folderPath);
Folder::create($folderPath);
}
// return the url
if ('url' === $type)
@ -6896,12 +6893,12 @@ abstract class ComponentbuilderHelper
$filePath = $path . '/' . $name . '.php';
$fullPathModel = $fullPathModels . '/' . $name . '.php';
// check if it exists
if (JFile::exists($filePath))
if (File::exists($filePath))
{
// get the file
require_once $filePath;
}
elseif (JFile::exists($fullPathModel))
elseif (File::exists($fullPathModel))
{
// get the file
require_once $fullPathModel;