forked from joomla/Component-Builder
Adds new helper classes.
This commit is contained in:
parent
ec827b7369
commit
c5be4ff5fa
@ -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.15) 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.16) 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*: 12th March, 2022
|
||||
+ *Version*: 2.12.15
|
||||
+ *Last Build*: 4th April, 2022
|
||||
+ *Version*: 2.12.16
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **286346**
|
||||
+ *Line count*: **286290**
|
||||
+ *Field count*: **1580**
|
||||
+ *File count*: **1850**
|
||||
+ *Folder count*: **260**
|
||||
|
@ -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.15) 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.16) 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*: 12th March, 2022
|
||||
+ *Version*: 2.12.15
|
||||
+ *Last Build*: 4th April, 2022
|
||||
+ *Version*: 2.12.16
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **286346**
|
||||
+ *Line count*: **286290**
|
||||
+ *Field count*: **1580**
|
||||
+ *File count*: **1850**
|
||||
+ *Folder count*: **260**
|
||||
|
@ -18,6 +18,7 @@ use Joomla\CMS\Filesystem\Folder;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\FileHelper;
|
||||
use VDM\Joomla\Utilities\MathHelper;
|
||||
|
||||
// Use the component builder autoloader
|
||||
@ -1103,7 +1104,7 @@ class Compiler extends Infusion
|
||||
&$this->componentFolderName, &$this->componentData)
|
||||
);
|
||||
//create the zip file
|
||||
if (ComponentbuilderHelper::zip(
|
||||
if (FileHelper::zip(
|
||||
$this->componentPath, $this->filepath['component']
|
||||
))
|
||||
{
|
||||
@ -1195,7 +1196,7 @@ class Compiler extends Infusion
|
||||
&$this->tempPath, &$module->zip_name, &$module)
|
||||
);
|
||||
//create the zip file
|
||||
if (ComponentbuilderHelper::zip(
|
||||
if (FileHelper::zip(
|
||||
$module->folder_path,
|
||||
$this->filepath['modules'][$module->id]
|
||||
))
|
||||
@ -1289,7 +1290,7 @@ class Compiler extends Infusion
|
||||
&$this->tempPath, &$plugin->zip_name, &$plugin)
|
||||
);
|
||||
//create the zip file
|
||||
if (ComponentbuilderHelper::zip(
|
||||
if (FileHelper::zip(
|
||||
$plugin->folder_path,
|
||||
$this->filepath['plugins'][$plugin->id]
|
||||
))
|
||||
|
@ -20,6 +20,7 @@ use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\FileHelper;
|
||||
use VDM\Joomla\Utilities\String\FieldHelper;
|
||||
use VDM\Joomla\Utilities\String\TypeHelper;
|
||||
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
|
||||
@ -182,6 +183,13 @@ class Get
|
||||
*/
|
||||
public $componentData;
|
||||
|
||||
/**
|
||||
* The Switch to add Powers data
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $addPower;
|
||||
|
||||
/**
|
||||
* The Powers data
|
||||
*
|
||||
@ -1044,6 +1052,10 @@ class Get
|
||||
) == 1) ? true : false;
|
||||
$this->debugLinenr = ((int) $config['debuglinenr'] == 0) ? false
|
||||
: (((int) $config['debuglinenr'] == 1) ? true : $global);
|
||||
// set if powers should be added to component (default is true)
|
||||
$global = true;
|
||||
$this->addPower = (isset($config['powers']) && (int) $config['powers'] == 0)
|
||||
? false : ((isset($config['powers']) && (int) $config['powers'] == 1) ? true : $global);
|
||||
// set the current user
|
||||
$this->user = JFactory::getUser();
|
||||
// Get a db connection.
|
||||
@ -2853,14 +2865,14 @@ class Get
|
||||
{
|
||||
// load the field details
|
||||
$required
|
||||
= ComponentbuilderHelper::getBetween(
|
||||
= GetHelper::between(
|
||||
$fieldValues['settings']->xml,
|
||||
'required="', '"'
|
||||
);
|
||||
$required = ($required === 'true'
|
||||
|| $required === '1') ? 'yes' : 'no';
|
||||
$filter
|
||||
= ComponentbuilderHelper::getBetween(
|
||||
= GetHelper::between(
|
||||
$fieldValues['settings']->xml,
|
||||
'filter="', '"'
|
||||
);
|
||||
@ -2909,7 +2921,7 @@ class Get
|
||||
if (!ComponentbuilderHelper::fieldCheck($type))
|
||||
{
|
||||
$conditionValue['match_extends']
|
||||
= ComponentbuilderHelper::getBetween(
|
||||
= GetHelper::between(
|
||||
$fieldValue['settings']->xml,
|
||||
'extends="', '"'
|
||||
);
|
||||
@ -3850,7 +3862,7 @@ class Get
|
||||
$field->xml = $this->setDynamicValues(json_decode($field->xml));
|
||||
|
||||
// check if we have validate (validation rule set)
|
||||
$validationRule = ComponentbuilderHelper::getBetween(
|
||||
$validationRule = GetHelper::between(
|
||||
$field->xml, 'validate="', '"'
|
||||
);
|
||||
if (StringHelper::check($validationRule))
|
||||
@ -4403,7 +4415,7 @@ class Get
|
||||
|| strtolower($type_name) === 'customuser')
|
||||
{
|
||||
$type = TypeHelper::safe(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'type="', '"'
|
||||
)
|
||||
);
|
||||
@ -4430,7 +4442,7 @@ class Get
|
||||
else
|
||||
{
|
||||
$type = TypeHelper::safe(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'type="', '"'
|
||||
)
|
||||
);
|
||||
@ -4502,7 +4514,7 @@ class Get
|
||||
if ($type_name === 'category')
|
||||
{
|
||||
// quick check if this is a category linked to view page
|
||||
$requeSt_id = ComponentbuilderHelper::getBetween(
|
||||
$requeSt_id = GetHelper::between(
|
||||
$field['settings']->xml, 'name="', '"'
|
||||
);
|
||||
if (strpos($requeSt_id, '_request_id') !== false
|
||||
@ -4522,17 +4534,17 @@ class Get
|
||||
{
|
||||
// check if we should use another Text Name as this views name
|
||||
$otherName = $this->setPlaceholders(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'othername="', '"'
|
||||
), $this->placeholders
|
||||
);
|
||||
$otherViews = $this->setPlaceholders(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'views="', '"'
|
||||
), $this->placeholders
|
||||
);
|
||||
$otherView = $this->setPlaceholders(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'view="', '"'
|
||||
), $this->placeholders
|
||||
);
|
||||
@ -4575,7 +4587,7 @@ class Get
|
||||
// get value from xml
|
||||
$xml = FieldHelper::safe(
|
||||
$this->setPlaceholders(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'name="', '"'
|
||||
), $this->placeholders
|
||||
)
|
||||
@ -4880,7 +4892,7 @@ class Get
|
||||
);
|
||||
// get the table name
|
||||
$_searchQuery
|
||||
= ComponentbuilderHelper::getBetween(
|
||||
= GetHelper::between(
|
||||
$customQueryString, '$query->from(', ')'
|
||||
);
|
||||
if (StringHelper::check(
|
||||
@ -4889,7 +4901,7 @@ class Get
|
||||
&& strpos($_searchQuery, '#__') !== false)
|
||||
{
|
||||
$_queryName
|
||||
= ComponentbuilderHelper::getBetween(
|
||||
= GetHelper::between(
|
||||
$_searchQuery, '#__', "'"
|
||||
);
|
||||
if (!StringHelper::check(
|
||||
@ -4897,7 +4909,7 @@ class Get
|
||||
))
|
||||
{
|
||||
$_queryName
|
||||
= ComponentbuilderHelper::getBetween(
|
||||
= GetHelper::between(
|
||||
$_searchQuery, '#__', '"'
|
||||
);
|
||||
}
|
||||
@ -5898,10 +5910,10 @@ class Get
|
||||
if (!ArrayHelper::check($templates))
|
||||
{
|
||||
// set the Template data
|
||||
$temp1 = ComponentbuilderHelper::getAllBetween(
|
||||
$temp1 = GetHelper::allBetween(
|
||||
$default, "\$this->loadTemplate('", "')"
|
||||
);
|
||||
$temp2 = ComponentbuilderHelper::getAllBetween(
|
||||
$temp2 = GetHelper::allBetween(
|
||||
$default, '$this->loadTemplate("', '")'
|
||||
);
|
||||
if (ArrayHelper::check($temp1)
|
||||
@ -5957,10 +5969,10 @@ class Get
|
||||
if (!ArrayHelper::check($layouts))
|
||||
{
|
||||
// set the Layout data
|
||||
$lay1 = ComponentbuilderHelper::getAllBetween(
|
||||
$lay1 = GetHelper::allBetween(
|
||||
$default, "JLayoutHelper::render('", "',"
|
||||
);
|
||||
$lay2 = ComponentbuilderHelper::getAllBetween(
|
||||
$lay2 = GetHelper::allBetween(
|
||||
$default, 'JLayoutHelper::render("', '",'
|
||||
);
|
||||
if (ArrayHelper::check($lay1)
|
||||
@ -6557,10 +6569,10 @@ class Get
|
||||
// first get the Joomla .JText._()
|
||||
if (in_array('Joomla' . '.JText._(', $langStringTargets))
|
||||
{
|
||||
$jsTEXT[] = ComponentbuilderHelper::getAllBetween(
|
||||
$jsTEXT[] = GetHelper::allBetween(
|
||||
$content, "Joomla" . ".JText._('", "'"
|
||||
);
|
||||
$jsTEXT[] = ComponentbuilderHelper::getAllBetween(
|
||||
$jsTEXT[] = GetHelper::allBetween(
|
||||
$content, 'Joomla' . '.JText._("', '"'
|
||||
);
|
||||
// combine into one array
|
||||
@ -6580,10 +6592,10 @@ class Get
|
||||
// now get the JText: :script()
|
||||
if (in_array('JText:' . ':script(', $langStringTargets))
|
||||
{
|
||||
$scTEXT[] = ComponentbuilderHelper::getAllBetween(
|
||||
$scTEXT[] = GetHelper::allBetween(
|
||||
$content, "JText:" . ":script('", "'"
|
||||
);
|
||||
$scTEXT[] = ComponentbuilderHelper::getAllBetween(
|
||||
$scTEXT[] = GetHelper::allBetween(
|
||||
$content, 'JText:' . ':script("', '"'
|
||||
);
|
||||
// combine into one array
|
||||
@ -6601,10 +6613,10 @@ class Get
|
||||
// now do the little trick for JustTEXT: :_('Just uppercase text');
|
||||
if (in_array('JustTEXT:' . ':_(', $langStringTargets))
|
||||
{
|
||||
$langOnly[] = ComponentbuilderHelper::getAllBetween(
|
||||
$langOnly[] = GetHelper::allBetween(
|
||||
$content, "JustTEXT:" . ":_('", "')"
|
||||
);
|
||||
$langOnly[] = ComponentbuilderHelper::getAllBetween(
|
||||
$langOnly[] = GetHelper::allBetween(
|
||||
$content, 'JustTEXT:' . ':_("', '")'
|
||||
);
|
||||
// merge lang only
|
||||
@ -6620,10 +6632,10 @@ class Get
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$langCheck[] = ComponentbuilderHelper::getAllBetween(
|
||||
$langCheck[] = GetHelper::allBetween(
|
||||
$content, $langStringTarget . "'", "'"
|
||||
);
|
||||
$langCheck[] = ComponentbuilderHelper::getAllBetween(
|
||||
$langCheck[] = GetHelper::allBetween(
|
||||
$content, $langStringTarget . '"', '"'
|
||||
);
|
||||
}
|
||||
@ -7316,7 +7328,7 @@ class Get
|
||||
}
|
||||
// target content
|
||||
$bucket = array();
|
||||
$found = ComponentbuilderHelper::getAllBetween(
|
||||
$found = GetHelper::allBetween(
|
||||
$string, '[EXTERNA' . 'LCODE=', ']'
|
||||
);
|
||||
if (ArrayHelper::check($found))
|
||||
@ -7421,7 +7433,7 @@ class Get
|
||||
{
|
||||
// get the data string (code)
|
||||
$this->externalCodeString[$target_key]
|
||||
= ComponentbuilderHelper::getFileContents($target_url);
|
||||
= FileHelper::getContent($target_url);
|
||||
// check if we must cut this
|
||||
if (isset($this->externalCodeCutter[$target_key]) &&
|
||||
$this->externalCodeCutter[$target_key])
|
||||
@ -7628,7 +7640,7 @@ class Get
|
||||
}
|
||||
// the ids found in this content
|
||||
$bucket = array();
|
||||
$found = ComponentbuilderHelper::getAllBetween(
|
||||
$found = GetHelper::allBetween(
|
||||
$string, '[CUSTO' . 'MCODE=', ']'
|
||||
);
|
||||
if (ArrayHelper::check($found))
|
||||
@ -8620,7 +8632,7 @@ class Get
|
||||
*/
|
||||
public function getPower($id)
|
||||
{
|
||||
if ($this->setPower($id))
|
||||
if ($this->addPower && $this->setPower($id))
|
||||
{
|
||||
return $this->powers[$id];
|
||||
}
|
||||
@ -8934,12 +8946,16 @@ class Get
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// we failed to get the power
|
||||
// we failed to get the power,
|
||||
// so we raise an error message
|
||||
$this->app->enqueueMessage(
|
||||
JText::sprintf('<p>Power <b>id:%s</b> not found!</p>', $id),
|
||||
'Error'
|
||||
);
|
||||
// only if id exist
|
||||
if ($id > 0)
|
||||
{
|
||||
$this->app->enqueueMessage(
|
||||
JText::sprintf('<p>Power <b>id:%s</b> not found!</p>', $id),
|
||||
'Error'
|
||||
);
|
||||
}
|
||||
// let's not try again
|
||||
$this->statePowers[$id] = false;
|
||||
|
||||
@ -9525,7 +9541,7 @@ class Get
|
||||
&& isset($field['settings']))
|
||||
{
|
||||
if (($old_default
|
||||
= ComponentbuilderHelper::getBetween(
|
||||
= GetHelper::between(
|
||||
$field['settings']->xml,
|
||||
'default="', '"', false
|
||||
)) !== false)
|
||||
@ -10470,7 +10486,7 @@ class Get
|
||||
&& isset($field['settings']))
|
||||
{
|
||||
if (($old_default
|
||||
= ComponentbuilderHelper::getBetween(
|
||||
= GetHelper::between(
|
||||
$field['settings']->xml,
|
||||
'default="', '"', false
|
||||
)) !== false)
|
||||
@ -11427,7 +11443,7 @@ class Get
|
||||
if (strpos($script, 'HASHSTRING((((') !== false)
|
||||
{
|
||||
// get the strings
|
||||
$values = ComponentbuilderHelper::getAllBetween(
|
||||
$values = GetHelper::allBetween(
|
||||
$script, 'HASHSTRING((((', '))))'
|
||||
);
|
||||
$locker = array();
|
||||
@ -11445,7 +11461,7 @@ class Get
|
||||
if (strpos($script, 'HASHFILE((((') !== false)
|
||||
{
|
||||
// get the strings
|
||||
$values = ComponentbuilderHelper::getAllBetween(
|
||||
$values = GetHelper::allBetween(
|
||||
$script, 'HASHFILE((((', '))))'
|
||||
);
|
||||
$locker = array();
|
||||
@ -11453,7 +11469,7 @@ class Get
|
||||
foreach ($values as $path)
|
||||
{
|
||||
// we first get the file if it exist
|
||||
if ($value = ComponentbuilderHelper::getFileContents($path))
|
||||
if ($value = FileHelper::getContent($path))
|
||||
{
|
||||
// now we hash the file content
|
||||
$locker['HASHFILE((((' . $path . '))))']
|
||||
@ -11487,7 +11503,7 @@ class Get
|
||||
if (strpos($script, 'LOCKBASE64((((') !== false)
|
||||
{
|
||||
// get the strings
|
||||
$values = ComponentbuilderHelper::getAllBetween(
|
||||
$values = GetHelper::allBetween(
|
||||
$script, 'LOCKBASE64((((', '))))'
|
||||
);
|
||||
$locker = array();
|
||||
@ -11642,14 +11658,14 @@ class Get
|
||||
protected function guiCodeSearch(&$file, &$placeholders, &$today, &$target)
|
||||
{
|
||||
// get file content
|
||||
$file_conent = ComponentbuilderHelper::getFileContents($file);
|
||||
$file_conent = FileHelper::getContent($file);
|
||||
|
||||
$guiCode = array();
|
||||
// we add a new search for the GUI CODE Blocks
|
||||
$guiCode[] = ComponentbuilderHelper::getAllBetween(
|
||||
$guiCode[] = GetHelper::allBetween(
|
||||
$file_conent, '/***[JCB' . 'GUI<>', '/***[/JCBGUI' . '$$$$]***/'
|
||||
);
|
||||
$guiCode[] = ComponentbuilderHelper::getAllBetween(
|
||||
$guiCode[] = GetHelper::allBetween(
|
||||
$file_conent, '<!--[JCB' . 'GUI<>', '<!--[/JCBGUI' . '$$$$]-->'
|
||||
);
|
||||
|
||||
@ -11899,10 +11915,10 @@ class Get
|
||||
// set language data
|
||||
foreach ($langStringTargets as $langStringTarget)
|
||||
{
|
||||
$langCheck[] = ComponentbuilderHelper::getAllBetween(
|
||||
$langCheck[] = GetHelper::allBetween(
|
||||
$string, $langStringTarget . "'", "'"
|
||||
);
|
||||
$langCheck[] = ComponentbuilderHelper::getAllBetween(
|
||||
$langCheck[] = GetHelper::allBetween(
|
||||
$string, $langStringTarget . "'", "'"
|
||||
);
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ use Joomla\CMS\Filesystem\Folder;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\FileHelper;
|
||||
|
||||
|
||||
/**
|
||||
@ -1136,7 +1138,7 @@ class Structure extends Get
|
||||
// set file name
|
||||
$fileName = basename($url['url']);
|
||||
// get the file contents
|
||||
$data = ComponentbuilderHelper::getFileContents(
|
||||
$data = FileHelper::getContent(
|
||||
$url['url']
|
||||
);
|
||||
// build sub path
|
||||
@ -1527,7 +1529,7 @@ class Structure extends Get
|
||||
// set file name
|
||||
$fileName = basename($url['url']);
|
||||
// get the file contents
|
||||
$data = ComponentbuilderHelper::getFileContents(
|
||||
$data = FileHelper::getContent(
|
||||
$url['url']
|
||||
);
|
||||
// build sub path
|
||||
@ -1672,7 +1674,7 @@ class Structure extends Get
|
||||
// set file name
|
||||
$fileName = basename($url['url']);
|
||||
// get the file contents
|
||||
$data = ComponentbuilderHelper::getFileContents(
|
||||
$data = FileHelper::getContent(
|
||||
$url['url']
|
||||
);
|
||||
// build sub path
|
||||
@ -1887,7 +1889,7 @@ class Structure extends Get
|
||||
*/
|
||||
public function writeFile($path, $data)
|
||||
{
|
||||
return ComponentbuilderHelper::writeFile($path, $data);
|
||||
return FileHelper::write($path, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2591,7 +2593,7 @@ class Structure extends Get
|
||||
'trim',
|
||||
explode(
|
||||
',',
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$multi_field['settings']->xml, 'fields="', '"'
|
||||
)
|
||||
)
|
||||
@ -2895,7 +2897,7 @@ class Structure extends Get
|
||||
if (File::exists($custom_settings))
|
||||
{
|
||||
$version_data = json_decode(
|
||||
ComponentbuilderHelper::getFileContents(
|
||||
FileHelper::getContent(
|
||||
$custom_settings
|
||||
)
|
||||
);
|
||||
@ -2903,7 +2905,7 @@ class Structure extends Get
|
||||
else
|
||||
{
|
||||
$version_data = json_decode(
|
||||
ComponentbuilderHelper::getFileContents(
|
||||
FileHelper::getContent(
|
||||
$this->templatePath . '/settings.json'
|
||||
)
|
||||
);
|
||||
|
@ -16,6 +16,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\String\FieldHelper;
|
||||
|
||||
/**
|
||||
@ -4167,7 +4168,7 @@ class Fields extends Structure
|
||||
elseif ($property['name'] === 'validate')
|
||||
{
|
||||
// check if we have validate (validation rule set)
|
||||
$xmlValue = ComponentbuilderHelper::getBetween(
|
||||
$xmlValue = GetHelper::between(
|
||||
$field['settings']->xml, 'validate="', '"'
|
||||
);
|
||||
if (StringHelper::check($xmlValue))
|
||||
@ -4183,7 +4184,7 @@ class Fields extends Structure
|
||||
{
|
||||
// get value & replace the placeholders
|
||||
$xmlValue = $this->setPlaceholders(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, $property['name'] . '="',
|
||||
'"'
|
||||
), $placeholders
|
||||
@ -4208,7 +4209,7 @@ class Fields extends Structure
|
||||
$fieldAttributes['custom'][$phpKey][$phpLine]
|
||||
= $this->setDynamicValues(
|
||||
ComponentbuilderHelper::openValidBase64(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml,
|
||||
$property['name'] . '="', '"'
|
||||
)
|
||||
@ -4221,7 +4222,7 @@ class Fields extends Structure
|
||||
{
|
||||
// load the php for the custom field file
|
||||
$fieldAttributes['custom']['prime_php']
|
||||
= (int) ComponentbuilderHelper::getBetween(
|
||||
= (int) GetHelper::between(
|
||||
$field['settings']->xml, $property['name'] . '="', '"'
|
||||
);
|
||||
}
|
||||
@ -4229,7 +4230,7 @@ class Fields extends Structure
|
||||
{
|
||||
// load the class that is being extended
|
||||
$fieldAttributes['custom']['extends']
|
||||
= ComponentbuilderHelper::getBetween(
|
||||
= GetHelper::between(
|
||||
$field['settings']->xml, 'extends="', '"'
|
||||
);
|
||||
}
|
||||
@ -4239,7 +4240,7 @@ class Fields extends Structure
|
||||
$fieldAttributes['custom']['view']
|
||||
= StringHelper::safe(
|
||||
$this->setPlaceholders(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'view="', '"'
|
||||
), $placeholders
|
||||
)
|
||||
@ -4251,7 +4252,7 @@ class Fields extends Structure
|
||||
$fieldAttributes['custom']['views']
|
||||
= StringHelper::safe(
|
||||
$this->setPlaceholders(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'views="', '"'
|
||||
), $placeholders
|
||||
)
|
||||
@ -4262,7 +4263,7 @@ class Fields extends Structure
|
||||
// load the component name & replace the placeholders
|
||||
$fieldAttributes['custom']['component']
|
||||
= $this->setPlaceholders(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'component="', '"'
|
||||
), $placeholders
|
||||
);
|
||||
@ -4272,7 +4273,7 @@ class Fields extends Structure
|
||||
// load the main table that is queried & replace the placeholders
|
||||
$fieldAttributes['custom']['table']
|
||||
= $this->setPlaceholders(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'table="', '"'
|
||||
), $placeholders
|
||||
);
|
||||
@ -4282,7 +4283,7 @@ class Fields extends Structure
|
||||
// load the text key
|
||||
$fieldAttributes['custom']['text']
|
||||
= StringHelper::safe(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'value_field="', '"'
|
||||
)
|
||||
);
|
||||
@ -4292,7 +4293,7 @@ class Fields extends Structure
|
||||
// load the id key
|
||||
$fieldAttributes['custom']['id']
|
||||
= StringHelper::safe(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'key_field="', '"'
|
||||
)
|
||||
);
|
||||
@ -4309,7 +4310,7 @@ class Fields extends Structure
|
||||
{
|
||||
// load the button string value if found
|
||||
$xmlValue = (string) StringHelper::safe(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'button="', '"'
|
||||
)
|
||||
);
|
||||
@ -4338,7 +4339,7 @@ class Fields extends Structure
|
||||
}
|
||||
elseif ($property['name'] === 'multiple')
|
||||
{
|
||||
$xmlValue = (string) ComponentbuilderHelper::getBetween(
|
||||
$xmlValue = (string) GetHelper::between(
|
||||
$field['settings']->xml, $property['name'] . '="', '"'
|
||||
);
|
||||
// add the multipal
|
||||
@ -4352,7 +4353,7 @@ class Fields extends Structure
|
||||
&& ($typeName === 'note'
|
||||
|| $typeName === 'spacer'))
|
||||
{
|
||||
$xmlValue = ComponentbuilderHelper::getBetween(
|
||||
$xmlValue = GetHelper::between(
|
||||
$field['settings']->xml, 'class="', '"'
|
||||
);
|
||||
// add the type class
|
||||
@ -4372,7 +4373,7 @@ class Fields extends Structure
|
||||
{
|
||||
// set the rest of the fields
|
||||
$xmlValue = (string) $this->setPlaceholders(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, $property['name'] . '="',
|
||||
'"'
|
||||
), $placeholders
|
||||
@ -4473,7 +4474,7 @@ class Fields extends Structure
|
||||
// validate that the default field is set
|
||||
elseif ($property['name'] === 'default'
|
||||
&& ($xmlValidateValue
|
||||
= ComponentbuilderHelper::getBetween(
|
||||
= GetHelper::between(
|
||||
$field['settings']->xml, 'default="', '"', 'none-set'
|
||||
)) !== 'none-set')
|
||||
{
|
||||
@ -4511,7 +4512,7 @@ class Fields extends Structure
|
||||
if (isset($fieldAttributes['name']))
|
||||
{
|
||||
// check if we have class value for the list view of this field
|
||||
$listclass = ComponentbuilderHelper::getBetween(
|
||||
$listclass = GetHelper::between(
|
||||
$field['settings']->xml, 'listclass="', '"'
|
||||
);
|
||||
if (StringHelper::check($listclass))
|
||||
@ -4520,7 +4521,7 @@ class Fields extends Structure
|
||||
= $listclass;
|
||||
}
|
||||
// check if we find reason to remove this field from being escaped
|
||||
$escaped = ComponentbuilderHelper::getBetween(
|
||||
$escaped = GetHelper::between(
|
||||
$field['settings']->xml, 'escape="', '"'
|
||||
);
|
||||
if (StringHelper::check($escaped))
|
||||
@ -4529,7 +4530,7 @@ class Fields extends Structure
|
||||
= $fieldAttributes['name'];
|
||||
}
|
||||
// check if we have display switch for dynamic placement
|
||||
$display = ComponentbuilderHelper::getBetween(
|
||||
$display = GetHelper::between(
|
||||
$field['settings']->xml, 'display="', '"'
|
||||
);
|
||||
if (StringHelper::check($display))
|
||||
@ -4540,7 +4541,7 @@ class Fields extends Structure
|
||||
if (!isset($fieldAttributes['validate']))
|
||||
{
|
||||
// check if we have validate (validation rule set)
|
||||
$validationRule = ComponentbuilderHelper::getBetween(
|
||||
$validationRule = GetHelper::between(
|
||||
$field['settings']->xml, 'validate="', '"'
|
||||
);
|
||||
if (StringHelper::check($validationRule))
|
||||
@ -4753,7 +4754,7 @@ class Fields extends Structure
|
||||
{
|
||||
// get it from the field xml string
|
||||
$listFieldName = (string) $this->setPlaceholders(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'label="',
|
||||
'"'
|
||||
), $this->placeholders
|
||||
@ -4954,7 +4955,7 @@ class Fields extends Structure
|
||||
}
|
||||
// get the xml extension name
|
||||
$_extension = $this->setPlaceholders(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$field['settings']->xml, 'extension="', '"'
|
||||
), $this->placeholders
|
||||
);
|
||||
|
@ -18,6 +18,8 @@ use Joomla\CMS\Filesystem\Folder;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\FileHelper;
|
||||
use VDM\Joomla\Utilities\MathHelper;
|
||||
|
||||
/**
|
||||
@ -2389,7 +2391,7 @@ class Interpretation extends Fields
|
||||
foreach ($params as $field)
|
||||
{
|
||||
// some switch to see if it should be added to front end params
|
||||
$target = ComponentbuilderHelper::getBetween(
|
||||
$target = GetHelper::between(
|
||||
$field, 'display="', '"'
|
||||
);
|
||||
if (!StringHelper::check($target)
|
||||
@ -5548,12 +5550,10 @@ class Interpretation extends Fields
|
||||
}
|
||||
// set the custom buttons CUSTOM_BUTTONS_CONTROLLER
|
||||
$this->fileContentDynamic[$viewCodeName][$this->hhh . $TARGET
|
||||
. '_CUSTOM_BUTTONS_CONTROLLER' . $this->hhh]
|
||||
= '';
|
||||
. '_CUSTOM_BUTTONS_CONTROLLER' . $this->hhh] = '';
|
||||
// set the custom buttons CUSTOM_BUTTONS_METHOD
|
||||
$this->fileContentDynamic[$viewCodeName][$this->hhh . $TARGET
|
||||
. '_CUSTOM_BUTTONS_METHOD' . $this->hhh]
|
||||
= '';
|
||||
. '_CUSTOM_BUTTONS_METHOD' . $this->hhh] = '';
|
||||
}
|
||||
elseif (3 == $type)
|
||||
{
|
||||
@ -6456,7 +6456,7 @@ class Interpretation extends Fields
|
||||
$path = '/' . trim($folder['path'], '/');
|
||||
if (isset($folder['rename']) && 1 == $folder['rename'])
|
||||
{
|
||||
if ($_paths = ComponentbuilderHelper::getAllFilePaths(
|
||||
if ($_paths = FileHelper::getPaths(
|
||||
$this->componentPath . $path
|
||||
))
|
||||
{
|
||||
@ -6466,7 +6466,7 @@ class Interpretation extends Fields
|
||||
else
|
||||
{
|
||||
$path = $path . '/' . trim($folder['folder'], '/');
|
||||
if ($_paths = ComponentbuilderHelper::getAllFilePaths(
|
||||
if ($_paths = FileHelper::getPaths(
|
||||
$this->componentPath . $path
|
||||
))
|
||||
{
|
||||
@ -7309,7 +7309,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (File::exists($file['path']))
|
||||
{
|
||||
$string = ComponentbuilderHelper::getFileContents(
|
||||
$string = FileHelper::getContent(
|
||||
$file['path']
|
||||
);
|
||||
$buket['static'][] = $this->getInbetweenStrings(
|
||||
@ -7326,7 +7326,7 @@ class Interpretation extends Fields
|
||||
if (File::exists($doc['path']))
|
||||
{
|
||||
$string
|
||||
= ComponentbuilderHelper::getFileContents(
|
||||
= FileHelper::getContent(
|
||||
$doc['path']
|
||||
);
|
||||
$buket[$view][] = $this->getInbetweenStrings(
|
||||
@ -17709,7 +17709,7 @@ class Interpretation extends Fields
|
||||
elseif (ComponentbuilderHelper::fieldCheck($type, 'text'))
|
||||
{
|
||||
// check to get the key words if set
|
||||
$keywords = ComponentbuilderHelper::getBetween(
|
||||
$keywords = GetHelper::between(
|
||||
$options, 'keywords="', '"'
|
||||
);
|
||||
if (StringHelper::check($keywords))
|
||||
@ -17730,7 +17730,7 @@ class Interpretation extends Fields
|
||||
}
|
||||
}
|
||||
// check to ket string length if set
|
||||
$length = ComponentbuilderHelper::getBetween(
|
||||
$length = GetHelper::between(
|
||||
$options, 'length="', '"'
|
||||
);
|
||||
if (StringHelper::check($length))
|
||||
@ -23212,7 +23212,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
// get all the mothods that should load date to the view
|
||||
$this->DashboardGetCustomData
|
||||
= ComponentbuilderHelper::getAllBetween(
|
||||
= GetHelper::allBetween(
|
||||
$this->componentData->php_dashboard_methods,
|
||||
'public function get', '()'
|
||||
);
|
||||
@ -24274,10 +24274,10 @@ class Interpretation extends Fields
|
||||
if (1 == $timer) // this is before the admin views are build
|
||||
{
|
||||
// start loading Global params
|
||||
$autorName = ComponentbuilderHelper::htmlEscape(
|
||||
$autorName = StringHelper::html(
|
||||
$this->componentData->author
|
||||
);
|
||||
$autorEmail = ComponentbuilderHelper::htmlEscape(
|
||||
$autorEmail = StringHelper::html(
|
||||
$this->componentData->email
|
||||
);
|
||||
$this->extensionsParams[] = '"autorName":"' . $autorName
|
||||
@ -24366,13 +24366,13 @@ class Interpretation extends Fields
|
||||
// set global params to db on install
|
||||
$fieldName = StringHelper::safe(
|
||||
$this->setPlaceholders(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$xmlField, 'name="', '"'
|
||||
), $placeholders
|
||||
)
|
||||
);
|
||||
$fieldDefault = $this->setPlaceholders(
|
||||
ComponentbuilderHelper::getBetween(
|
||||
GetHelper::between(
|
||||
$xmlField, 'default="', '"'
|
||||
), $placeholders
|
||||
);
|
||||
@ -24486,7 +24486,7 @@ class Interpretation extends Fields
|
||||
elseif (strpos($id_field, '_request_id') !== false)
|
||||
{
|
||||
// not loaded to a tab "view" name
|
||||
$_viewRequest = ComponentbuilderHelper::getBetween(
|
||||
$_viewRequest = GetHelper::between(
|
||||
$id_field, 'name="', '_request_id'
|
||||
);
|
||||
$searchIdKe = 'name="' . $_viewRequest
|
||||
@ -24514,7 +24514,7 @@ class Interpretation extends Fields
|
||||
elseif (strpos($catid_field, '_request_catid') !== false)
|
||||
{
|
||||
// not loaded to a tab "view" name
|
||||
$_viewRequestC = ComponentbuilderHelper::getBetween(
|
||||
$_viewRequestC = GetHelper::between(
|
||||
$catid_field, 'name="', '_request_catid'
|
||||
);
|
||||
$searchCatidKe = 'name="' . $_viewRequestC
|
||||
@ -24539,7 +24539,7 @@ class Interpretation extends Fields
|
||||
elseif (strpos($field, '_menu"') !== false)
|
||||
{
|
||||
// not loaded to a tab "view" name
|
||||
$_tabLower = ComponentbuilderHelper::getBetween(
|
||||
$_tabLower = GetHelper::between(
|
||||
$field, 'name="', '_menu"'
|
||||
);
|
||||
// set the values needed to insure route is done correclty
|
||||
@ -24561,7 +24561,7 @@ class Interpretation extends Fields
|
||||
|
||||
protected function setRequestValues($view, $field, $search, $target, $store)
|
||||
{
|
||||
$key = ComponentbuilderHelper::getBetween($field, $search, '"');
|
||||
$key = GetHelper::between($field, $search, '"');
|
||||
if (!StringHelper::check($key))
|
||||
{
|
||||
// is not having special var
|
||||
@ -24602,7 +24602,7 @@ class Interpretation extends Fields
|
||||
$bucket = array();
|
||||
foreach ($tabFields as $tabField)
|
||||
{
|
||||
$display = ComponentbuilderHelper::getBetween(
|
||||
$display = GetHelper::between(
|
||||
$tabField, 'display="', '"'
|
||||
);
|
||||
if (!StringHelper::check($display)
|
||||
@ -24908,7 +24908,7 @@ class Interpretation extends Fields
|
||||
);
|
||||
$cbWebsite = htmlspecialchars(
|
||||
$contributor['website'], ENT_XML1, 'UTF-8'
|
||||
); // ComponentbuilderHelper::htmlEscape($contributor['website']);
|
||||
); // StringHelper::html($contributor['website']);
|
||||
// load to the $fieldsets
|
||||
$this->configFieldSets[] = $this->_t(2)
|
||||
. '<field type="spacer" name="spacerContributor' . $counter
|
||||
|
@ -18,6 +18,7 @@ use Joomla\CMS\Filesystem\Folder;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\FileHelper;
|
||||
|
||||
/**
|
||||
* Infusion class
|
||||
@ -2796,7 +2797,7 @@ class Infusion extends Interpretation
|
||||
$xmlPath = $this->componentPath . '/' . $this->componentCodeName
|
||||
. '.xml';
|
||||
// get the content in xml
|
||||
$componentXML = ComponentbuilderHelper::getFileContents(
|
||||
$componentXML = FileHelper::getContent(
|
||||
$xmlPath
|
||||
);
|
||||
// update the xml content
|
||||
|
@ -1028,51 +1028,6 @@ abstract class ComponentbuilderHelper
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get all the file paths in folder and sub folders
|
||||
*
|
||||
* @param string $folder The local path to parse
|
||||
* @param array $fileTypes The type of files to get
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true)
|
||||
{
|
||||
if (Folder::exists($folder))
|
||||
{
|
||||
// we must first store the current woking directory
|
||||
$joomla = getcwd();
|
||||
// we are changing the working directory to the component path
|
||||
chdir($folder);
|
||||
// make sure we have file type filter
|
||||
if (self::checkArray($fileTypes))
|
||||
{
|
||||
// get the files
|
||||
foreach ($fileTypes as $type)
|
||||
{
|
||||
// get a list of files in the current directory tree
|
||||
$files[] = Folder::files('.', $type, $recurse, $full);
|
||||
}
|
||||
}
|
||||
elseif (self::checkString($fileTypes))
|
||||
{
|
||||
// get a list of files in the current directory tree
|
||||
$files[] = Folder::files('.', $fileTypes, $recurse, $full);
|
||||
}
|
||||
else
|
||||
{
|
||||
// get a list of files in the current directory tree
|
||||
$files[] = Folder::files('.', '.', $recurse, $full);
|
||||
}
|
||||
// change back to Joomla working directory
|
||||
chdir($joomla);
|
||||
// return array of files
|
||||
return array_map( function($file) { return str_replace('./', '/', $file); }, (array) self::mergeArrays($files));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get all component IDs
|
||||
*/
|
||||
@ -3788,81 +3743,6 @@ abstract class ComponentbuilderHelper
|
||||
return $exists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file path or url
|
||||
*
|
||||
* @param string $type The (url/path) type to return
|
||||
* @param string $target The Params Target name (if set)
|
||||
* @param string $fileType The kind of filename to generate (if not set no file name is generated)
|
||||
* @param string $key The key to adjust the filename (if not set ignored)
|
||||
* @param string $default The default path if not set in Params (fallback path)
|
||||
* @param bool $createIfNotSet The switch to create the folder if not found
|
||||
*
|
||||
* @return string On success the path or url is returned based on the type requested
|
||||
*
|
||||
*/
|
||||
public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true)
|
||||
{
|
||||
// make sure to always have a string/path
|
||||
if(!self::checkString($default))
|
||||
{
|
||||
$default = JPATH_SITE . '/images/';
|
||||
}
|
||||
// get the global settings
|
||||
if (!self::checkObject(self::$params))
|
||||
{
|
||||
self::$params = JComponentHelper::getParams('com_componentbuilder');
|
||||
}
|
||||
$filePath = self::$params->get($target, $default);
|
||||
// check the file path (revert to default only of not a hidden file path)
|
||||
if ('hiddenfilepath' !== $target && strpos($filePath, JPATH_SITE) === false)
|
||||
{
|
||||
$filePath = $default;
|
||||
}
|
||||
// create the folder if it does not exist
|
||||
if ($createIfNotSet && !Folder::exists($filePath))
|
||||
{
|
||||
Folder::create($filePath);
|
||||
}
|
||||
// setup the file name
|
||||
$fileName = '';
|
||||
// Get basic key
|
||||
$basickey = 'Th!s_iS_n0t_sAfe_buT_b3tter_then_n0thiug';
|
||||
if (method_exists(get_called_class(), "getCryptKey"))
|
||||
{
|
||||
$basickey = self::getCryptKey('basic', $basickey);
|
||||
}
|
||||
// check the key
|
||||
if (!self::checkString($key))
|
||||
{
|
||||
$key = 'vDm';
|
||||
}
|
||||
// set the file name
|
||||
if (self::checkString($fileType))
|
||||
{
|
||||
// set the name
|
||||
$fileName = trim(md5($type.$target.$basickey.$key) . '.' . trim($fileType, '.'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$fileName = trim(md5($type.$target.$basickey.$key)) . '.txt';
|
||||
}
|
||||
// return the url
|
||||
if ('url' === $type)
|
||||
{
|
||||
if (strpos($filePath, JPATH_SITE) !== false)
|
||||
{
|
||||
$filePath = trim( str_replace( JPATH_SITE, '', $filePath), '/');
|
||||
return JURI::root() . $filePath . '/' . $fileName;
|
||||
}
|
||||
// since the path is behind the root folder of the site, return only the root url (may be used to build the link)
|
||||
return JURI::root();
|
||||
}
|
||||
// sanitize the path
|
||||
return '/' . trim( $filePath, '/' ) . '/' . $fileName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the file path or url
|
||||
*
|
||||
|
@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="4" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>12th March, 2022</creationDate>
|
||||
<creationDate>4th April, 2022</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.15</version>
|
||||
<version>2.12.16</version>
|
||||
<description><![CDATA[
|
||||
<h1>Component Builder (v.2.12.15)</h1>
|
||||
<h1>Component Builder (v.2.12.16)</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.
|
||||
|
||||
|
@ -1041,10 +1041,10 @@
|
||||
<description>Builds Complex Joomla Components</description>
|
||||
<element>com_componentbuilder</element>
|
||||
<type>component</type>
|
||||
<version>2.12.15</version>
|
||||
<version>2.12.16</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.15/JCB_v2.12.15.zip</downloadurl>
|
||||
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.12.16/JCB_v2.12.16.zip</downloadurl>
|
||||
</downloads>
|
||||
<tags>
|
||||
<tag>stable</tag>
|
||||
|
@ -556,5 +556,43 @@ trait Utilities
|
||||
return FileHelper::write($path, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* get all the file paths in folder and sub folders
|
||||
*
|
||||
* @param string $folder The local path to parse
|
||||
* @param array $fileTypes The type of files to get
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use FileHelper::getPaths($folder, $fileTypes , $recurse, $full);
|
||||
*/
|
||||
public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true)
|
||||
{
|
||||
return FileHelper::getPaths($folder, $fileTypes , $recurse, $full);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file path or url
|
||||
*
|
||||
* @param string $type The (url/path) type to return
|
||||
* @param string $target The Params Target name (if set)
|
||||
* @param string $fileType The kind of filename to generate (if not set no file name is generated)
|
||||
* @param string $key The key to adjust the filename (if not set ignored)
|
||||
* @param string $default The default path if not set in Params (fallback path)
|
||||
* @param bool $createIfNotSet The switch to create the folder if not found
|
||||
*
|
||||
* @return string On success the path or url is returned based on the type requested
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use FileHelper::getPath($type, $target, $fileType, $key, $default, $createIfNotSet);
|
||||
*/
|
||||
public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true)
|
||||
{
|
||||
return FileHelper::getPath($type, $target, $fileType, $key, $default, $createIfNotSet);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,11 +13,13 @@
|
||||
namespace VDM\Joomla\Utilities;
|
||||
|
||||
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Filesystem\Path;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\Archive\Archive;
|
||||
|
||||
|
||||
@ -37,6 +39,15 @@ abstract class FileHelper
|
||||
*/
|
||||
protected static $curlError = false;
|
||||
|
||||
/**
|
||||
* The component params
|
||||
*
|
||||
* @var object
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
protected static $params = false;
|
||||
|
||||
/**
|
||||
* The zipper method
|
||||
*
|
||||
@ -177,5 +188,140 @@ abstract class FileHelper
|
||||
return $klaar;
|
||||
}
|
||||
|
||||
/**
|
||||
* get all the file paths in folder and sub folders
|
||||
*
|
||||
* @param string $folder The local path to parse
|
||||
* @param array $fileTypes The type of files to get
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function getPaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true)
|
||||
{
|
||||
if (Folder::exists($folder))
|
||||
{
|
||||
// we must first store the current woking directory
|
||||
$joomla = getcwd();
|
||||
// we are changing the working directory to the component path
|
||||
chdir($folder);
|
||||
|
||||
// make sure we have file type filter
|
||||
if (ArrayHelper::check($fileTypes))
|
||||
{
|
||||
// get the files
|
||||
foreach ($fileTypes as $type)
|
||||
{
|
||||
// get a list of files in the current directory tree
|
||||
$files[] = Folder::files('.', $type, $recurse, $full);
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($fileTypes))
|
||||
{
|
||||
// get a list of files in the current directory tree
|
||||
$files[] = Folder::files('.', $fileTypes, $recurse, $full);
|
||||
}
|
||||
else
|
||||
{
|
||||
// get a list of files in the current directory tree
|
||||
$files[] = Folder::files('.', '.', $recurse, $full);
|
||||
}
|
||||
|
||||
// change back to Joomla working directory
|
||||
chdir($joomla);
|
||||
|
||||
// return array of files
|
||||
return array_map( function($file) { return str_replace('./', '/', $file); }, (array) ArrayHelper::merge($files));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file path or url
|
||||
*
|
||||
* @param string $type The (url/path) type to return
|
||||
* @param string $target The Params Target name (if set)
|
||||
* @param string $fileType The kind of filename to generate (if not set no file name is generated)
|
||||
* @param string $key The key to adjust the filename (if not set ignored)
|
||||
* @param string $default The default path if not set in Params (fallback path)
|
||||
* @param bool $createIfNotSet The switch to create the folder if not found
|
||||
*
|
||||
* @return string On success the path or url is returned based on the type requested
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function getPath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true)
|
||||
{
|
||||
// make sure to always have a string/path
|
||||
if(!StringHelper::check($default))
|
||||
{
|
||||
$default = JPATH_SITE . '/images/';
|
||||
}
|
||||
|
||||
// get the global settings
|
||||
if (!ObjectHelper::check(self::$params))
|
||||
{
|
||||
self::$params = ComponentHelper::getParams('com_componentbuilder');
|
||||
}
|
||||
$filePath = self::$params->get($target, $default);
|
||||
|
||||
// check the file path (revert to default only of not a hidden file path)
|
||||
if ('hiddenfilepath' !== $target && strpos($filePath, JPATH_SITE) === false)
|
||||
{
|
||||
$filePath = $default;
|
||||
}
|
||||
|
||||
// create the folder if it does not exist
|
||||
if ($createIfNotSet && !Folder::exists($filePath))
|
||||
{
|
||||
Folder::create($filePath);
|
||||
}
|
||||
|
||||
// setup the file name
|
||||
$fileName = '';
|
||||
|
||||
// Get basic key
|
||||
$basickey = 'Th!s_iS_n0t_sAfe_buT_b3tter_then_n0thiug';
|
||||
if (method_exists('ComponentbuilderHelper', "getCryptKey"))
|
||||
{
|
||||
$basickey = ComponentbuilderHelper::getCryptKey('basic', $basickey);
|
||||
}
|
||||
|
||||
// check the key
|
||||
if (!StringHelper::check($key))
|
||||
{
|
||||
$key = 'vDm';
|
||||
}
|
||||
|
||||
// set the file name
|
||||
if (StringHelper::check($fileType))
|
||||
{
|
||||
// set the name
|
||||
$fileName = trim(md5($type . $target . $basickey . $key) . '.' . trim($fileType, '.'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$fileName = trim(md5($type . $target . $basickey . $key)) . '.txt';
|
||||
}
|
||||
|
||||
// return the url
|
||||
if ('url' === $type)
|
||||
{
|
||||
if (strpos($filePath, JPATH_SITE) !== false)
|
||||
{
|
||||
$filePath = trim( str_replace( JPATH_SITE, '', $filePath), '/');
|
||||
|
||||
return Uri::root() . $filePath . '/' . $fileName;
|
||||
}
|
||||
|
||||
// since the path is behind the root folder of the site, return only the root url (may be used to build the link)
|
||||
return Uri::root();
|
||||
}
|
||||
|
||||
// sanitize the path
|
||||
return '/' . trim( $filePath, '/' ) . '/' . $fileName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -9254,7 +9254,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.15 Was Successful! Let us know if anything is not working as expected.</h3>';
|
||||
<h3>Upgrade to Version 2.12.16 Was Successful! Let us know if anything is not working as expected.</h3>';
|
||||
|
||||
// Set db if not set already.
|
||||
if (!isset($db))
|
||||
|
@ -1025,51 +1025,6 @@ abstract class ComponentbuilderHelper
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get all the file paths in folder and sub folders
|
||||
*
|
||||
* @param string $folder The local path to parse
|
||||
* @param array $fileTypes The type of files to get
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true)
|
||||
{
|
||||
if (Folder::exists($folder))
|
||||
{
|
||||
// we must first store the current woking directory
|
||||
$joomla = getcwd();
|
||||
// we are changing the working directory to the component path
|
||||
chdir($folder);
|
||||
// make sure we have file type filter
|
||||
if (self::checkArray($fileTypes))
|
||||
{
|
||||
// get the files
|
||||
foreach ($fileTypes as $type)
|
||||
{
|
||||
// get a list of files in the current directory tree
|
||||
$files[] = Folder::files('.', $type, $recurse, $full);
|
||||
}
|
||||
}
|
||||
elseif (self::checkString($fileTypes))
|
||||
{
|
||||
// get a list of files in the current directory tree
|
||||
$files[] = Folder::files('.', $fileTypes, $recurse, $full);
|
||||
}
|
||||
else
|
||||
{
|
||||
// get a list of files in the current directory tree
|
||||
$files[] = Folder::files('.', '.', $recurse, $full);
|
||||
}
|
||||
// change back to Joomla working directory
|
||||
chdir($joomla);
|
||||
// return array of files
|
||||
return array_map( function($file) { return str_replace('./', '/', $file); }, (array) self::mergeArrays($files));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get all component IDs
|
||||
*/
|
||||
@ -3785,81 +3740,6 @@ abstract class ComponentbuilderHelper
|
||||
return $exists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file path or url
|
||||
*
|
||||
* @param string $type The (url/path) type to return
|
||||
* @param string $target The Params Target name (if set)
|
||||
* @param string $fileType The kind of filename to generate (if not set no file name is generated)
|
||||
* @param string $key The key to adjust the filename (if not set ignored)
|
||||
* @param string $default The default path if not set in Params (fallback path)
|
||||
* @param bool $createIfNotSet The switch to create the folder if not found
|
||||
*
|
||||
* @return string On success the path or url is returned based on the type requested
|
||||
*
|
||||
*/
|
||||
public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true)
|
||||
{
|
||||
// make sure to always have a string/path
|
||||
if(!self::checkString($default))
|
||||
{
|
||||
$default = JPATH_SITE . '/images/';
|
||||
}
|
||||
// get the global settings
|
||||
if (!self::checkObject(self::$params))
|
||||
{
|
||||
self::$params = JComponentHelper::getParams('com_componentbuilder');
|
||||
}
|
||||
$filePath = self::$params->get($target, $default);
|
||||
// check the file path (revert to default only of not a hidden file path)
|
||||
if ('hiddenfilepath' !== $target && strpos($filePath, JPATH_SITE) === false)
|
||||
{
|
||||
$filePath = $default;
|
||||
}
|
||||
// create the folder if it does not exist
|
||||
if ($createIfNotSet && !Folder::exists($filePath))
|
||||
{
|
||||
Folder::create($filePath);
|
||||
}
|
||||
// setup the file name
|
||||
$fileName = '';
|
||||
// Get basic key
|
||||
$basickey = 'Th!s_iS_n0t_sAfe_buT_b3tter_then_n0thiug';
|
||||
if (method_exists(get_called_class(), "getCryptKey"))
|
||||
{
|
||||
$basickey = self::getCryptKey('basic', $basickey);
|
||||
}
|
||||
// check the key
|
||||
if (!self::checkString($key))
|
||||
{
|
||||
$key = 'vDm';
|
||||
}
|
||||
// set the file name
|
||||
if (self::checkString($fileType))
|
||||
{
|
||||
// set the name
|
||||
$fileName = trim(md5($type.$target.$basickey.$key) . '.' . trim($fileType, '.'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$fileName = trim(md5($type.$target.$basickey.$key)) . '.txt';
|
||||
}
|
||||
// return the url
|
||||
if ('url' === $type)
|
||||
{
|
||||
if (strpos($filePath, JPATH_SITE) !== false)
|
||||
{
|
||||
$filePath = trim( str_replace( JPATH_SITE, '', $filePath), '/');
|
||||
return JURI::root() . $filePath . '/' . $fileName;
|
||||
}
|
||||
// since the path is behind the root folder of the site, return only the root url (may be used to build the link)
|
||||
return JURI::root();
|
||||
}
|
||||
// sanitize the path
|
||||
return '/' . trim( $filePath, '/' ) . '/' . $fileName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the file path or url
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user