forked from joomla/Component-Builder
Added the namespacing for the file and folder classes to the compiler. gh-682
This commit is contained in:
parent
552a2664ba
commit
1279a5d2f9
@ -143,11 +143,11 @@ TODO
|
|||||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||||
+ *First Build*: 30th April, 2015
|
+ *First Build*: 30th April, 2015
|
||||||
+ *Last Build*: 7th March, 2021
|
+ *Last Build*: 8th March, 2021
|
||||||
+ *Version*: 2.12.8
|
+ *Version*: 2.12.8
|
||||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
+ *Line count*: **292184**
|
+ *Line count*: **292190**
|
||||||
+ *Field count*: **1629**
|
+ *Field count*: **1629**
|
||||||
+ *File count*: **1935**
|
+ *File count*: **1935**
|
||||||
+ *Folder count*: **322**
|
+ *Folder count*: **322**
|
||||||
|
@ -143,11 +143,11 @@ TODO
|
|||||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||||
+ *First Build*: 30th April, 2015
|
+ *First Build*: 30th April, 2015
|
||||||
+ *Last Build*: 7th March, 2021
|
+ *Last Build*: 8th March, 2021
|
||||||
+ *Version*: 2.12.8
|
+ *Version*: 2.12.8
|
||||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
+ *Line count*: **292184**
|
+ *Line count*: **292190**
|
||||||
+ *Field count*: **1629**
|
+ *Field count*: **1629**
|
||||||
+ *File count*: **1935**
|
+ *File count*: **1935**
|
||||||
+ *Folder count*: **322**
|
+ *Folder count*: **322**
|
||||||
|
@ -569,12 +569,12 @@ abstract class ###Component###Helper
|
|||||||
$filePath = $path . '/' . $name . '.php';
|
$filePath = $path . '/' . $name . '.php';
|
||||||
$fullPathModel = $fullPathModels . '/' . $name . '.php';
|
$fullPathModel = $fullPathModels . '/' . $name . '.php';
|
||||||
// check if it exists
|
// check if it exists
|
||||||
if (JFile::exists($filePath))
|
if (File::exists($filePath))
|
||||||
{
|
{
|
||||||
// get the file
|
// get the file
|
||||||
require_once $filePath;
|
require_once $filePath;
|
||||||
}
|
}
|
||||||
elseif (JFile::exists($fullPathModel))
|
elseif (File::exists($fullPathModel))
|
||||||
{
|
{
|
||||||
// get the file
|
// get the file
|
||||||
require_once $fullPathModel;
|
require_once $fullPathModel;
|
||||||
|
@ -201,12 +201,12 @@ abstract class ###Component###Helper
|
|||||||
$filePath = $path . '/' . $name . '.php';
|
$filePath = $path . '/' . $name . '.php';
|
||||||
$fullPathModel = $fullPathModels . '/' . $name . '.php';
|
$fullPathModel = $fullPathModels . '/' . $name . '.php';
|
||||||
// check if it exists
|
// check if it exists
|
||||||
if (JFile::exists($filePath))
|
if (File::exists($filePath))
|
||||||
{
|
{
|
||||||
// get the file
|
// get the file
|
||||||
require_once $filePath;
|
require_once $filePath;
|
||||||
}
|
}
|
||||||
elseif (JFile::exists($fullPathModel))
|
elseif (File::exists($fullPathModel))
|
||||||
{
|
{
|
||||||
// get the file
|
// get the file
|
||||||
require_once $fullPathModel;
|
require_once $fullPathModel;
|
||||||
|
@ -22346,6 +22346,7 @@ class Interpretation extends Fields
|
|||||||
break;
|
break;
|
||||||
case 'admin.helper':
|
case 'admin.helper':
|
||||||
case 'site.helper':
|
case 'site.helper':
|
||||||
|
$headers[] = 'use Joomla\CMS\Filesystem\File;';
|
||||||
$headers[] = 'use Joomla\CMS\Language\Language;';
|
$headers[] = 'use Joomla\CMS\Language\Language;';
|
||||||
$headers[] = 'use Joomla\Registry\Registry;';
|
$headers[] = 'use Joomla\Registry\Registry;';
|
||||||
$headers[] = 'use Joomla\String\StringHelper;';
|
$headers[] = 'use Joomla\String\StringHelper;';
|
||||||
|
@ -19,6 +19,10 @@ use Joomla\Utilities\ArrayHelper;
|
|||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
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.
|
* Componentbuilder component helper.
|
||||||
@ -796,7 +800,7 @@ abstract class ComponentbuilderHelper
|
|||||||
// set the path to the form validation rules
|
// set the path to the form validation rules
|
||||||
$path = JPATH_LIBRARIES . '/src/Form/Rule';
|
$path = JPATH_LIBRARIES . '/src/Form/Rule';
|
||||||
// check if the path exist
|
// check if the path exist
|
||||||
if (!JFolder::exists($path))
|
if (!Folder::exists($path))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -805,7 +809,7 @@ abstract class ComponentbuilderHelper
|
|||||||
// go to that folder
|
// go to that folder
|
||||||
chdir($path);
|
chdir($path);
|
||||||
// load all the files in this 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
|
// change back to Joomla working directory
|
||||||
chdir($joomla);
|
chdir($joomla);
|
||||||
// make sure we have an array
|
// 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)
|
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
|
// we must first store the current woking directory
|
||||||
$joomla = getcwd();
|
$joomla = getcwd();
|
||||||
@ -1121,18 +1125,18 @@ abstract class ComponentbuilderHelper
|
|||||||
foreach ($fileTypes as $type)
|
foreach ($fileTypes as $type)
|
||||||
{
|
{
|
||||||
// get a list of files in the current directory tree
|
// 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))
|
elseif (self::checkString($fileTypes))
|
||||||
{
|
{
|
||||||
// get a list of files in the current directory tree
|
// get a list of files in the current directory tree
|
||||||
$files[] = JFolder::files('.', $fileTypes, $recurse, $full);
|
$files[] = Folder::files('.', $fileTypes, $recurse, $full);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// get a list of files in the current directory tree
|
// 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
|
// change back to Joomla working directory
|
||||||
chdir($joomla);
|
chdir($joomla);
|
||||||
@ -2191,9 +2195,9 @@ abstract class ComponentbuilderHelper
|
|||||||
md5($image_data) === $target['hash'])
|
md5($image_data) === $target['hash'])
|
||||||
{
|
{
|
||||||
// create the JCB type path if it does not exist
|
// 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
|
// only set the image if the data match the hash
|
||||||
self::writeFile($path, $image_data);
|
self::writeFile($path, $image_data);
|
||||||
@ -2697,29 +2701,30 @@ abstract class ComponentbuilderHelper
|
|||||||
chdir($workingDIR);
|
chdir($workingDIR);
|
||||||
|
|
||||||
// the full file path of the zip file
|
// 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()
|
// delete an existing zip file (or use an exclusion parameter in Folder::files()
|
||||||
JFile::delete($filepath);
|
File::delete($filepath);
|
||||||
|
|
||||||
// get a list of files in the current directory tree
|
// get a list of files in the current directory tree
|
||||||
$files = JFolder::files('.', '', true, true);
|
$files = Folder::files('.', '', true, true);
|
||||||
$zipArray = array();
|
$zipArray = array();
|
||||||
// setup the zip array
|
// setup the zip array
|
||||||
foreach ($files as $file)
|
foreach ($files as $file)
|
||||||
{
|
{
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
$tmp['name'] = str_replace('./', '', $file);
|
$tmp['name'] = str_replace('./', '', $file);
|
||||||
$tmp['data'] = JFile::read($file);
|
$tmp['data'] = self::getFileContents($file);
|
||||||
$tmp['time'] = filemtime($file);
|
$tmp['time'] = filemtime($file);
|
||||||
$zipArray[] = $tmp;
|
$zipArray[] = $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// change back to joomla working directory
|
// change back to joomla working directory
|
||||||
chdir($joomla);
|
chdir($joomla);
|
||||||
|
|
||||||
// get the zip adapter
|
// get the zip adapter
|
||||||
$zip = JArchive::getAdapter('zip');
|
$adapter = new Archive();
|
||||||
|
$zip = $adapter->getAdapter('zip');
|
||||||
|
|
||||||
//create the zip file
|
//create the zip file
|
||||||
if ($zip->create($filepath, $zipArray))
|
if ($zip->create($filepath, $zipArray))
|
||||||
@ -2774,7 +2779,7 @@ abstract class ComponentbuilderHelper
|
|||||||
*/
|
*/
|
||||||
public static function removeFolder($dir, $ignore = false)
|
public static function removeFolder($dir, $ignore = false)
|
||||||
{
|
{
|
||||||
if (JFolder::exists($dir))
|
if (Folder::exists($dir))
|
||||||
{
|
{
|
||||||
$it = new RecursiveDirectoryIterator($dir);
|
$it = new RecursiveDirectoryIterator($dir);
|
||||||
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
||||||
@ -2804,7 +2809,7 @@ abstract class ComponentbuilderHelper
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
JFolder::delete($file_dir);
|
Folder::delete($file_dir);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2823,13 +2828,13 @@ abstract class ComponentbuilderHelper
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
JFile::delete($file_dir);
|
File::delete($file_dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// delete the root folder if not ignore found
|
// delete the root folder if not ignore found
|
||||||
if (!self::checkArray($ignore))
|
if (!self::checkArray($ignore))
|
||||||
{
|
{
|
||||||
return JFolder::delete($dir);
|
return Folder::delete($dir);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -4118,11 +4123,10 @@ abstract class ComponentbuilderHelper
|
|||||||
{
|
{
|
||||||
$filePath = $default;
|
$filePath = $default;
|
||||||
}
|
}
|
||||||
jimport('joomla.filesystem.folder');
|
|
||||||
// create the folder if it does not exist
|
// 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
|
// setup the file name
|
||||||
$fileName = '';
|
$fileName = '';
|
||||||
@ -4187,11 +4191,10 @@ abstract class ComponentbuilderHelper
|
|||||||
self::$params = JComponentHelper::getParams('com_componentbuilder');
|
self::$params = JComponentHelper::getParams('com_componentbuilder');
|
||||||
}
|
}
|
||||||
$folderPath = self::$params->get($target, $default);
|
$folderPath = self::$params->get($target, $default);
|
||||||
jimport('joomla.filesystem.folder');
|
|
||||||
// create the folder if it does not exist
|
// 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
|
// return the url
|
||||||
if ('url' === $type)
|
if ('url' === $type)
|
||||||
@ -7680,12 +7683,12 @@ abstract class ComponentbuilderHelper
|
|||||||
$filePath = $path . '/' . $name . '.php';
|
$filePath = $path . '/' . $name . '.php';
|
||||||
$fullPathModel = $fullPathModels . '/' . $name . '.php';
|
$fullPathModel = $fullPathModels . '/' . $name . '.php';
|
||||||
// check if it exists
|
// check if it exists
|
||||||
if (JFile::exists($filePath))
|
if (File::exists($filePath))
|
||||||
{
|
{
|
||||||
// get the file
|
// get the file
|
||||||
require_once $filePath;
|
require_once $filePath;
|
||||||
}
|
}
|
||||||
elseif (JFile::exists($fullPathModel))
|
elseif (File::exists($fullPathModel))
|
||||||
{
|
{
|
||||||
// get the file
|
// get the file
|
||||||
require_once $fullPathModel;
|
require_once $fullPathModel;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<extension type="component" version="3.2" method="upgrade">
|
<extension type="component" version="3.2" method="upgrade">
|
||||||
<name>COM_COMPONENTBUILDER</name>
|
<name>COM_COMPONENTBUILDER</name>
|
||||||
<creationDate>7th March, 2021</creationDate>
|
<creationDate>8th March, 2021</creationDate>
|
||||||
<author>Llewellyn van der Merwe</author>
|
<author>Llewellyn van der Merwe</author>
|
||||||
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
||||||
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
||||||
|
@ -16,6 +16,10 @@ use Joomla\CMS\Language\Language;
|
|||||||
use Joomla\Registry\Registry;
|
use Joomla\Registry\Registry;
|
||||||
use Joomla\String\StringHelper;
|
use Joomla\String\StringHelper;
|
||||||
use Joomla\Utilities\ArrayHelper;
|
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
|
* Componentbuilder component helper
|
||||||
@ -793,7 +797,7 @@ abstract class ComponentbuilderHelper
|
|||||||
// set the path to the form validation rules
|
// set the path to the form validation rules
|
||||||
$path = JPATH_LIBRARIES . '/src/Form/Rule';
|
$path = JPATH_LIBRARIES . '/src/Form/Rule';
|
||||||
// check if the path exist
|
// check if the path exist
|
||||||
if (!JFolder::exists($path))
|
if (!Folder::exists($path))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -802,7 +806,7 @@ abstract class ComponentbuilderHelper
|
|||||||
// go to that folder
|
// go to that folder
|
||||||
chdir($path);
|
chdir($path);
|
||||||
// load all the files in this 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
|
// change back to Joomla working directory
|
||||||
chdir($joomla);
|
chdir($joomla);
|
||||||
// make sure we have an array
|
// 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)
|
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
|
// we must first store the current woking directory
|
||||||
$joomla = getcwd();
|
$joomla = getcwd();
|
||||||
@ -1118,18 +1122,18 @@ abstract class ComponentbuilderHelper
|
|||||||
foreach ($fileTypes as $type)
|
foreach ($fileTypes as $type)
|
||||||
{
|
{
|
||||||
// get a list of files in the current directory tree
|
// 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))
|
elseif (self::checkString($fileTypes))
|
||||||
{
|
{
|
||||||
// get a list of files in the current directory tree
|
// get a list of files in the current directory tree
|
||||||
$files[] = JFolder::files('.', $fileTypes, $recurse, $full);
|
$files[] = Folder::files('.', $fileTypes, $recurse, $full);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// get a list of files in the current directory tree
|
// 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
|
// change back to Joomla working directory
|
||||||
chdir($joomla);
|
chdir($joomla);
|
||||||
@ -2188,9 +2192,9 @@ abstract class ComponentbuilderHelper
|
|||||||
md5($image_data) === $target['hash'])
|
md5($image_data) === $target['hash'])
|
||||||
{
|
{
|
||||||
// create the JCB type path if it does not exist
|
// 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
|
// only set the image if the data match the hash
|
||||||
self::writeFile($path, $image_data);
|
self::writeFile($path, $image_data);
|
||||||
@ -2694,29 +2698,30 @@ abstract class ComponentbuilderHelper
|
|||||||
chdir($workingDIR);
|
chdir($workingDIR);
|
||||||
|
|
||||||
// the full file path of the zip file
|
// 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()
|
// delete an existing zip file (or use an exclusion parameter in Folder::files()
|
||||||
JFile::delete($filepath);
|
File::delete($filepath);
|
||||||
|
|
||||||
// get a list of files in the current directory tree
|
// get a list of files in the current directory tree
|
||||||
$files = JFolder::files('.', '', true, true);
|
$files = Folder::files('.', '', true, true);
|
||||||
$zipArray = array();
|
$zipArray = array();
|
||||||
// setup the zip array
|
// setup the zip array
|
||||||
foreach ($files as $file)
|
foreach ($files as $file)
|
||||||
{
|
{
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
$tmp['name'] = str_replace('./', '', $file);
|
$tmp['name'] = str_replace('./', '', $file);
|
||||||
$tmp['data'] = JFile::read($file);
|
$tmp['data'] = self::getFileContents($file);
|
||||||
$tmp['time'] = filemtime($file);
|
$tmp['time'] = filemtime($file);
|
||||||
$zipArray[] = $tmp;
|
$zipArray[] = $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// change back to joomla working directory
|
// change back to joomla working directory
|
||||||
chdir($joomla);
|
chdir($joomla);
|
||||||
|
|
||||||
// get the zip adapter
|
// get the zip adapter
|
||||||
$zip = JArchive::getAdapter('zip');
|
$adapter = new Archive();
|
||||||
|
$zip = $adapter->getAdapter('zip');
|
||||||
|
|
||||||
//create the zip file
|
//create the zip file
|
||||||
if ($zip->create($filepath, $zipArray))
|
if ($zip->create($filepath, $zipArray))
|
||||||
@ -2771,7 +2776,7 @@ abstract class ComponentbuilderHelper
|
|||||||
*/
|
*/
|
||||||
public static function removeFolder($dir, $ignore = false)
|
public static function removeFolder($dir, $ignore = false)
|
||||||
{
|
{
|
||||||
if (JFolder::exists($dir))
|
if (Folder::exists($dir))
|
||||||
{
|
{
|
||||||
$it = new RecursiveDirectoryIterator($dir);
|
$it = new RecursiveDirectoryIterator($dir);
|
||||||
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
||||||
@ -2801,7 +2806,7 @@ abstract class ComponentbuilderHelper
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
JFolder::delete($file_dir);
|
Folder::delete($file_dir);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2820,13 +2825,13 @@ abstract class ComponentbuilderHelper
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
JFile::delete($file_dir);
|
File::delete($file_dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// delete the root folder if not ignore found
|
// delete the root folder if not ignore found
|
||||||
if (!self::checkArray($ignore))
|
if (!self::checkArray($ignore))
|
||||||
{
|
{
|
||||||
return JFolder::delete($dir);
|
return Folder::delete($dir);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -4115,11 +4120,10 @@ abstract class ComponentbuilderHelper
|
|||||||
{
|
{
|
||||||
$filePath = $default;
|
$filePath = $default;
|
||||||
}
|
}
|
||||||
jimport('joomla.filesystem.folder');
|
|
||||||
// create the folder if it does not exist
|
// 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
|
// setup the file name
|
||||||
$fileName = '';
|
$fileName = '';
|
||||||
@ -4184,11 +4188,10 @@ abstract class ComponentbuilderHelper
|
|||||||
self::$params = JComponentHelper::getParams('com_componentbuilder');
|
self::$params = JComponentHelper::getParams('com_componentbuilder');
|
||||||
}
|
}
|
||||||
$folderPath = self::$params->get($target, $default);
|
$folderPath = self::$params->get($target, $default);
|
||||||
jimport('joomla.filesystem.folder');
|
|
||||||
// create the folder if it does not exist
|
// 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
|
// return the url
|
||||||
if ('url' === $type)
|
if ('url' === $type)
|
||||||
@ -6896,12 +6899,12 @@ abstract class ComponentbuilderHelper
|
|||||||
$filePath = $path . '/' . $name . '.php';
|
$filePath = $path . '/' . $name . '.php';
|
||||||
$fullPathModel = $fullPathModels . '/' . $name . '.php';
|
$fullPathModel = $fullPathModels . '/' . $name . '.php';
|
||||||
// check if it exists
|
// check if it exists
|
||||||
if (JFile::exists($filePath))
|
if (File::exists($filePath))
|
||||||
{
|
{
|
||||||
// get the file
|
// get the file
|
||||||
require_once $filePath;
|
require_once $filePath;
|
||||||
}
|
}
|
||||||
elseif (JFile::exists($fullPathModel))
|
elseif (File::exists($fullPathModel))
|
||||||
{
|
{
|
||||||
// get the file
|
// get the file
|
||||||
require_once $fullPathModel;
|
require_once $fullPathModel;
|
||||||
|
Loading…
Reference in New Issue
Block a user