Move the Power, Plugin and Module builders into the container. Many more PHP 8 improvments.

This commit is contained in:
2023-01-29 22:12:42 +02:00
parent e6c02a29f6
commit 7edbe20c33
68 changed files with 3443 additions and 1681 deletions

View File

@ -80,7 +80,7 @@ class Compiler extends Infusion
{
// to check the compiler speed
$this->time_start = microtime(true);
CFactory::_('Counter')->start();
CFactory::_('Utilities.Counter')->start();
// first we run the parent constructors
if (parent::__construct())
{
@ -104,9 +104,9 @@ class Compiler extends Infusion
if (CFactory::_('Config')->remove_site_folder && CFactory::_('Config')->remove_site_edit_folder)
{
// first remove the files and folders
$this->removeFolder($this->componentPath . '/site');
CFactory::_('Utilities.Folder')->remove(CFactory::_('Utilities.Paths')->component_path . '/site');
// clear form component xml
$xmlPath = $this->componentPath . '/'
$xmlPath = CFactory::_('Utilities.Paths')->component_path . '/'
. CFactory::_('Content')->get('component') . '.xml';
$componentXML = FileHelper::getContent($xmlPath);
$textToSite = GetHelper::between(
@ -120,7 +120,7 @@ class Compiler extends Infusion
'<languages folder="site">' . $textToSiteLang
. "</languages>"), array('', ''), (string) $componentXML
);
$this->writeFile($xmlPath, $componentXML);
CFactory::_('Utilities.File')->write($xmlPath, $componentXML);
}
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
@ -363,7 +363,7 @@ class Compiler extends Infusion
// end the timer here
$this->time_end = microtime(true);
$this->secondsCompiled = $this->time_end - $this->time_start;
CFactory::_('Counter')->end();
CFactory::_('Utilities.Counter')->end();
// completed the compilation
return true;
@ -380,15 +380,13 @@ class Compiler extends Infusion
*/
protected function updateFiles()
{
if (isset($this->newFiles['static'])
&& ArrayHelper::check($this->newFiles['static'])
&& isset($this->newFiles['dynamic'])
&& ArrayHelper::check($this->newFiles['dynamic']))
if (CFactory::_('Utilities.Files')->exists('static')
&& CFactory::_('Utilities.Files')->exists('dynamic'))
{
// get the bom file
$bom = FileHelper::getContent(CFactory::_('Config')->bom_path);
// first we do the static files
foreach ($this->newFiles['static'] as $static)
foreach (CFactory::_('Utilities.Files')->get('static') as $static)
{
if (File::exists($static['path']))
{
@ -398,7 +396,7 @@ class Compiler extends Infusion
}
}
// now we do the dynamic files
foreach ($this->newFiles['dynamic'] as $view => $files)
foreach (CFactory::_('Utilities.Files')->get('dynamic') as $view => $files)
{
if (CFactory::_('Content')->exist_($view)
&& ArrayHelper::check(
@ -423,17 +421,14 @@ class Compiler extends Infusion
CFactory::_('Content')->remove_($view);
}
// free up some memory
unset($this->newFiles['dynamic']);
CFactory::_('Utilities.Files')->remove('dynamic');
// do modules if found
if (CFactory::_('Joomlamodule.Data')->exists())
{
foreach (CFactory::_('Joomlamodule.Data')->get() as $module)
{
if (ObjectHelper::check($module)
&& isset($this->newFiles[$module->key])
&& ArrayHelper::check(
$this->newFiles[$module->key]
))
&& CFactory::_('Utilities.Files')->exists($module->key))
{
// move field or rule if needed
if (isset($module->fields_rules_paths)
@ -489,7 +484,7 @@ class Compiler extends Infusion
}
}
// update the module files
foreach ($this->newFiles[$module->key] as $module_file)
foreach (CFactory::_('Utilities.Files')->get($module->key) as $module_file)
{
if (File::exists($module_file['path']))
{
@ -500,7 +495,7 @@ class Compiler extends Infusion
}
}
// free up some memory
unset($this->newFiles[$module->key]);
CFactory::_('Utilities.Files')->remove($module->key);
CFactory::_('Content')->remove_($module->key);
}
}
@ -511,10 +506,7 @@ class Compiler extends Infusion
foreach (CFactory::_('Joomlaplugin.Data')->get() as $plugin)
{
if (ObjectHelper::check($plugin)
&& isset($this->newFiles[$plugin->key])
&& ArrayHelper::check(
$this->newFiles[$plugin->key]
))
&& CFactory::_('Utilities.Files')->exists($plugin->key))
{
// move field or rule if needed
if (isset($plugin->fields_rules_paths)
@ -570,7 +562,7 @@ class Compiler extends Infusion
}
}
// update the plugin files
foreach ($this->newFiles[$plugin->key] as $plugin_file)
foreach (CFactory::_('Utilities.Files')->get($plugin->key) as $plugin_file)
{
if (File::exists($plugin_file['path']))
{
@ -581,7 +573,7 @@ class Compiler extends Infusion
}
}
// free up some memory
unset($this->newFiles[$plugin->key]);
CFactory::_('Utilities.Files')->remove($plugin->key);
CFactory::_('Content')->remove_($plugin->key);
}
}
@ -592,13 +584,10 @@ class Compiler extends Infusion
foreach (CFactory::_('Power')->active as $power)
{
if (ObjectHelper::check($power)
&& isset($this->newFiles[$power->key])
&& ArrayHelper::check(
$this->newFiles[$power->key]
))
&& CFactory::_('Utilities.Files')->exists($power->key))
{
// update the power files
foreach ($this->newFiles[$power->key] as $power_file)
foreach (CFactory::_('Utilities.Files')->get($power->key) as $power_file)
{
if (File::exists($power_file['path']))
{
@ -609,7 +598,7 @@ class Compiler extends Infusion
}
}
// free up some memory
unset($this->newFiles[$power->key]);
CFactory::_('Utilities.Files')->remove($power->key);
CFactory::_('Content')->remove_($power->key);
}
}
@ -681,9 +670,9 @@ class Compiler extends Infusion
&$view)
);
// add answer back to file
$this->writeFile($path, $answer);
CFactory::_('Utilities.File')->write($path, $answer);
// count the file lines
CFactory::_('Counter')->line += substr_count((string) $answer, PHP_EOL);
CFactory::_('Utilities.Counter')->line += substr_count((string) $answer, PHP_EOL);
}
/**
@ -699,7 +688,7 @@ class Compiler extends Infusion
&& isset($this->updateServerFileName)
&& $this->dynamicIntegration)
{
$update_server_xml_path = $this->componentPath . '/'
$update_server_xml_path = CFactory::_('Utilities.Paths')->component_path . '/'
. $this->updateServerFileName . '.xml';
// make sure we have the correct file
if (File::exists($update_server_xml_path)
@ -843,7 +832,7 @@ class Compiler extends Infusion
{
// do a final run to update the readme file
$two = 0;
foreach ($this->newFiles['static'] as $static)
foreach (CFactory::_('Utilities.Files')->get('static') as $static)
{
if (('README.md' === $static['name']
|| 'README.txt' === $static['name'])
@ -858,23 +847,23 @@ class Compiler extends Infusion
break;
}
}
unset($this->newFiles['static']);
CFactory::_('Utilities.Files')->remove('static');
}
private function setReadMe($path)
{
// set readme data if not set already
if (!CFactory::_('Content')->exist('LINE_COUNT')
|| CFactory::_('Content')->get('LINE_COUNT') != CFactory::_('Counter')->line)
|| CFactory::_('Content')->get('LINE_COUNT') != CFactory::_('Utilities.Counter')->line)
{
CFactory::_('Counter')->set();
CFactory::_('Utilities.Counter')->set();
}
// get the file
$string = FileHelper::getContent($path);
// update the file
$answer = CFactory::_('Placeholder')->update($string, CFactory::_('Content')->active);
// add to zip array
$this->writeFile($path, $answer);
CFactory::_('Utilities.File')->write($path, $answer);
}
/**
@ -910,20 +899,21 @@ class Compiler extends Infusion
. CFactory::_('Config')->get('version', 3);
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
$component_path = CFactory::_('Utilities.Paths')->component_path;
// Trigger Event: jcb_ce_onBeforeUpdateRepo
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeUpdateRepo',
array(&$component_context, &$this->componentPath,
array(&$component_context, &$component_path,
&$repoFullPath, &$this->componentData)
);
// remove old data
$this->removeFolder($repoFullPath, CFactory::_('Component')->get('toignore'));
CFactory::_('Utilities.Folder')->remove($repoFullPath, CFactory::_('Component')->get('toignore'));
// set the new data
Folder::copy($this->componentPath, $repoFullPath, '', true);
Folder::copy(CFactory::_('Utilities.Paths')->component_path, $repoFullPath, '', true);
// Trigger Event: jcb_ce_onAfterUpdateRepo
CFactory::_('Event')->trigger(
'jcb_ce_onAfterUpdateRepo',
array(&$component_context, &$this->componentPath,
array(&$component_context, &$component_path,
&$repoFullPath, &$this->componentData)
);
@ -948,7 +938,7 @@ class Compiler extends Infusion
&$repoFullPath, &$module)
);
// remove old data
$this->removeFolder(
CFactory::_('Utilities.Folder')->remove(
$repoFullPath, CFactory::_('Component')->get('toignore')
);
// set the new data
@ -985,7 +975,7 @@ class Compiler extends Infusion
&$repoFullPath, &$plugin)
);
// remove old data
$this->removeFolder(
CFactory::_('Utilities.Folder')->remove(
$repoFullPath, CFactory::_('Component')->get('toignore')
);
// set the new data
@ -1007,22 +997,25 @@ class Compiler extends Infusion
private function zipComponent()
{
// Component Folder Name
$this->filepath['component-folder'] = $this->componentFolderName;
$this->filepath['component-folder'] = CFactory::_('Utilities.Paths')->component_folder_name;
// the name of the zip file to create
$this->filepath['component'] = $this->tempPath . '/'
. $this->filepath['component-folder'] . '.zip';
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
$component_path = CFactory::_('Utilities.Paths')->component_path;
$component_sales_name = CFactory::_('Utilities.Paths')->component_sales_name;
$component_folder_name = CFactory::_('Utilities.Paths')->component_folder_name;
// Trigger Event: jcb_ce_onBeforeZipComponent
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeZipComponent',
array(&$component_context, &$this->componentPath,
array(&$component_context, &$component_path,
&$this->filepath['component'], &$this->tempPath,
&$this->componentFolderName, &$this->componentData)
&$component_folder_name, &$this->componentData)
);
//create the zip file
if (FileHelper::zip(
$this->componentPath, $this->filepath['component']
CFactory::_('Utilities.Paths')->component_path, $this->filepath['component']
))
{
// now move to backup if zip was made and backup is required
@ -1039,7 +1032,7 @@ class Compiler extends Infusion
// copy the zip to backup path
File::copy(
$this->filepath['component'],
$this->backupPath . '/' . $this->componentBackupName
$this->backupPath . '/' . CFactory::_('Utilities.Paths')->component_backup_name
. '.zip'
);
}
@ -1055,12 +1048,12 @@ class Compiler extends Infusion
'jcb_ce_onBeforeMoveToServer',
array(&$component_context,
&$this->filepath['component'], &$this->tempPath,
&$this->componentSalesName, &$this->componentData)
&$component_sales_name, &$this->componentData)
);
// move to server
ComponentbuilderHelper::moveToServer(
$this->filepath['component'],
$this->componentSalesName . '.zip',
$component_sales_name . '.zip',
(int) CFactory::_('Component')->get('sales_server'),
CFactory::_('Component')->get('sales_server_protocol')
);
@ -1070,11 +1063,11 @@ class Compiler extends Infusion
CFactory::_('Event')->trigger(
'jcb_ce_onAfterZipComponent',
array(&$component_context, &$this->filepath['component'],
&$this->tempPath, &$this->componentFolderName,
&$this->tempPath, &$component_folder_name,
&$this->componentData)
);
// remove the component folder since we are done
if ($this->removeFolder($this->componentPath))
if (CFactory::_('Utilities.Folder')->remove(CFactory::_('Utilities.Paths')->component_path))
{
return true;
}
@ -1170,7 +1163,7 @@ class Compiler extends Infusion
&$module)
);
// remove the module folder since we are done
$this->removeFolder($module->folder_path);
CFactory::_('Utilities.Folder')->remove($module->folder_path);
}
}
}
@ -1264,7 +1257,7 @@ class Compiler extends Infusion
&$plugin)
);
// remove the plugin folder since we are done
$this->removeFolder($plugin->folder_path);
CFactory::_('Utilities.Folder')->remove($plugin->folder_path);
}
}
}
@ -1288,7 +1281,7 @@ class Compiler extends Infusion
$target['hashtarget'][1]
))
{
$file = $this->componentPath . '/' . $target['path'];
$file = CFactory::_('Utilities.Paths')->component_path . '/' . $target['path'];
$size = (int) $target['hashtarget'][0];
$hash = $target['hashtarget'][1];
$cut = $size - 1;

View File

@ -2681,70 +2681,38 @@ class Get
* get the module xml template
*
* @return string
*
* @deprecated 3.3
*/
public function getModuleXMLTemplate(&$module)
{
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<extension type="module" version="'
. $this->joomlaVersions[CFactory::_('Config')->joomla_version]['xml_version'] . '" client="'
. $module->target_client . '" method="upgrade">';
$xml .= PHP_EOL . Indent::_(1) . '<name>' . $module->lang_prefix
. '</name>';
$xml .= PHP_EOL . Indent::_(1) . '<creationDate>' . Placefix::_h('BUILDDATE') . '</creationDate>';
$xml .= PHP_EOL . Indent::_(1) . '<author>' . Placefix::_h('AUTHOR') . '</author>';
$xml .= PHP_EOL . Indent::_(1) . '<authorEmail>' . Placefix::_h('AUTHOREMAIL') . '</authorEmail>';
$xml .= PHP_EOL . Indent::_(1) . '<authorUrl>' . Placefix::_h('AUTHORWEBSITE') . '</authorUrl>';
$xml .= PHP_EOL . Indent::_(1) . '<copyright>' . Placefix::_h('COPYRIGHT') . '</copyright>';
$xml .= PHP_EOL . Indent::_(1) . '<license>' . Placefix::_h('LICENSE') . '</license>';
$xml .= PHP_EOL . Indent::_(1) . '<version>' . $module->module_version
. '</version>';
$xml .= PHP_EOL . Indent::_(1) . '<description>' . $module->lang_prefix
. '_XML_DESCRIPTION</description>';
$xml .= Placefix::_h('MAINXML');
$xml .= PHP_EOL . '</extension>';
return $xml;
// set notice that we could not get a valid string from the target
$this->app->enqueueMessage(
JText::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
}
/**
* get the module admin custom script field
*
* @return string
*
* @deprecated 3.3
*/
public function getModAdminVvvvvvvdm($fieldScriptBucket)
{
$form_field_class = array();
$form_field_class[] = Placefix::_h('BOM') . PHP_EOL;
$form_field_class[] = "//" . Line::_(__Line__, __Class__)
. " No direct access to this file";
$form_field_class[] = "defined('_JEXEC') or die('Restricted access');";
$form_field_class[] = PHP_EOL . "use Joomla\CMS\Form\FormField;";
$form_field_class[] = "use Joomla\CMS\Factory;";
$form_field_class[] = PHP_EOL
. "class JFormFieldModadminvvvvvvvdm extends FormField";
$form_field_class[] = "{";
$form_field_class[] = Indent::_(1)
. "protected \$type = 'modadminvvvvvvvdm';";
$form_field_class[] = PHP_EOL . Indent::_(1)
. "protected function getLabel()";
$form_field_class[] = Indent::_(1) . "{";
$form_field_class[] = Indent::_(2) . "return;";
$form_field_class[] = Indent::_(1) . "}";
$form_field_class[] = PHP_EOL . Indent::_(1)
. "protected function getInput()";
$form_field_class[] = Indent::_(1) . "{";
$form_field_class[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
. " Get the document";
$form_field_class[] = Indent::_(2)
. "\$document = Factory::getDocument();";
$form_field_class[] = implode(PHP_EOL, $fieldScriptBucket);
$form_field_class[] = Indent::_(2) . "return; // noting for now :)";
$form_field_class[] = Indent::_(1) . "}";
$form_field_class[] = "}";
return implode(PHP_EOL, $form_field_class);
// set notice that we could not get a valid string from the target
$this->app->enqueueMessage(
JText::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
}
/**
@ -2810,7 +2778,7 @@ class Get
{
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<extension type="plugin" version="'
. $this->joomlaVersions[CFactory::_('Config')->joomla_version]['xml_version'] . '" group="'
. CFactory::_('Config')->joomla_versions[CFactory::_('Config')->joomla_version]['xml_version'] . '" group="'
. strtolower((string) $plugin->group) . '" method="upgrade">';
$xml .= PHP_EOL . Indent::_(1) . '<name>' . $plugin->lang_prefix
. '</name>';

File diff suppressed because it is too large Load Diff

View File

@ -658,7 +658,7 @@ class Fields extends Structure
$fieldSet[] = Indent::_(3) . 'readonly="true"';
$fieldSet[] = Indent::_(2) . "/>";
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// if created is not set
if (!isset($this->fieldsNames[$nameSingleCode]['created']))
@ -681,7 +681,7 @@ class Fields extends Structure
$fieldSet[] = Indent::_(3) . "filter=" . '"user_utc"';
$fieldSet[] = Indent::_(2) . "/>";
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// if created_by is not set
if (!isset($this->fieldsNames[$nameSingleCode]['created_by']))
@ -701,7 +701,7 @@ class Fields extends Structure
. '_CREATED_BY_DESC"';
$fieldSet[] = Indent::_(2) . "/>";
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// if published is not set
if (!isset($this->fieldsNames[$nameSingleCode]['published']))
@ -728,7 +728,7 @@ class Fields extends Structure
$fieldSet[] = Indent::_(4) . "JTRASHED</option>";
$fieldSet[] = Indent::_(2) . "</field>";
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// if modified is not set
if (!isset($this->fieldsNames[$nameSingleCode]['modified']))
@ -743,7 +743,7 @@ class Fields extends Structure
$fieldSet[] = Indent::_(3)
. 'size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />';
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// if modified_by is not set
if (!isset($this->fieldsNames[$nameSingleCode]['modified_by']))
@ -761,7 +761,7 @@ class Fields extends Structure
$fieldSet[] = Indent::_(3) . 'filter="unset"';
$fieldSet[] = Indent::_(2) . "/>";
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// check if view has access
if (isset($this->accessBuilder[$nameSingleCode])
@ -784,7 +784,7 @@ class Fields extends Structure
$fieldSet[] = Indent::_(3) . 'required="false"';
$fieldSet[] = Indent::_(2) . "/>";
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// if ordering is not set
if (!isset($this->fieldsNames[$nameSingleCode]['ordering']))
@ -807,7 +807,7 @@ class Fields extends Structure
$fieldSet[] = Indent::_(3) . 'required="false"';
$fieldSet[] = Indent::_(2) . "/>";
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// if version is not set
if (!isset($this->fieldsNames[$nameSingleCode]['version']))
@ -827,7 +827,7 @@ class Fields extends Structure
$fieldSet[] = Indent::_(3) . 'filter="unset"';
$fieldSet[] = Indent::_(2) . "/>";
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// check if metadata is added to this view
if (isset($this->metadataBuilder[$nameSingleCode])
@ -851,7 +851,7 @@ class Fields extends Structure
$fieldSet[] = Indent::_(3) . 'cols="30"';
$fieldSet[] = Indent::_(2) . "/>";
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// metadesc
if (!isset($this->fieldsNames[$nameSingleCode]['metadesc']))
@ -869,7 +869,7 @@ class Fields extends Structure
$fieldSet[] = Indent::_(3) . 'cols="30"';
$fieldSet[] = Indent::_(2) . "/>";
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
}
// fix the permissions field "title" issue gh-629
@ -896,7 +896,7 @@ class Fields extends Structure
. $nameSingleCode . '"';
$fieldSet[] = Indent::_(2) . "/>";
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
// setup needed field values for layout
$field_array = array();
$field_array['order_edit'] = 0;
@ -957,7 +957,7 @@ class Fields extends Structure
. '<option value="noindex, nofollow">JGLOBAL_NOINDEX_NOFOLLOW</option>';
$fieldSet[] = Indent::_(3) . '</field>';
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// author
if (!isset($this->fieldsNames[$nameSingleCode]['author']))
@ -972,7 +972,7 @@ class Fields extends Structure
$fieldSet[] = Indent::_(4) . 'size="20"';
$fieldSet[] = Indent::_(3) . "/>";
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// rights
if (!isset($this->fieldsNames[$nameSingleCode]['rights']))
@ -987,7 +987,7 @@ class Fields extends Structure
$fieldSet[] = Indent::_(4) . 'cols="30" rows="2"';
$fieldSet[] = Indent::_(3) . "/>";
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
$fieldSet[] = Indent::_(2) . "</fieldset>";
$fieldSet[] = Indent::_(1) . "</fields>";
@ -1084,7 +1084,7 @@ class Fields extends Structure
$fieldXML = $fieldSetXML->addChild('field');
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// if created is not set
if (!isset($this->fieldsNames[$nameSingleCode]['created']))
@ -1106,7 +1106,7 @@ class Fields extends Structure
$fieldXML = $fieldSetXML->addChild('field');
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// if created_by is not set
if (!isset($this->fieldsNames[$nameSingleCode]['created_by']))
@ -1125,7 +1125,7 @@ class Fields extends Structure
$fieldXML = $fieldSetXML->addChild('field');
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// if published is not set
if (!isset($this->fieldsNames[$nameSingleCode]['published']))
@ -1143,7 +1143,7 @@ class Fields extends Structure
$fieldXML = $fieldSetXML->addChild('field');
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
foreach (
array('JPUBLISHED' => 1, 'JUNPUBLISHED' => 0, 'JARCHIVED' => 2,
'JTRASHED' => -2) as $text => $value
@ -1175,7 +1175,7 @@ class Fields extends Structure
$fieldXML = $fieldSetXML->addChild('field');
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// if modified_by is not set
if (!isset($this->fieldsNames[$nameSingleCode]['modified_by']))
@ -1196,7 +1196,7 @@ class Fields extends Structure
$fieldXML = $fieldSetXML->addChild('field');
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// check if view has access
if (isset($this->accessBuilder[$nameSingleCode])
@ -1221,7 +1221,7 @@ class Fields extends Structure
$fieldXML = $fieldSetXML->addChild('field');
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// if ordering is not set
if (!isset($this->fieldsNames[$nameSingleCode]['ordering']))
@ -1244,7 +1244,7 @@ class Fields extends Structure
$fieldXML = $fieldSetXML->addChild('field');
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// if version is not set
if (!isset($this->fieldsNames[$nameSingleCode]['version']))
@ -1266,7 +1266,7 @@ class Fields extends Structure
$fieldXML = $fieldSetXML->addChild('field');
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// check if metadata is added to this view
if (isset($this->metadataBuilder[$nameSingleCode])
@ -1294,7 +1294,7 @@ class Fields extends Structure
$fieldXML, $attributes
);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// metadesc
if (!isset($this->fieldsNames[$nameSingleCode]['metadesc']))
@ -1311,7 +1311,7 @@ class Fields extends Structure
$fieldXML, $attributes
);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
}
// fix the permissions field "title" issue gh-629
@ -1346,7 +1346,7 @@ class Fields extends Structure
$fieldXML = $fieldSetXML->addChild('field');
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
// setup needed field values for layout
$field_array = array();
$field_array['order_edit'] = 0;
@ -1409,7 +1409,7 @@ class Fields extends Structure
$robots, $attributes
);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
$options = array(
'JGLOBAL_USE_GLOBAL' => '',
'JGLOBAL_INDEX_FOLLOW' => 'index, follow',
@ -1443,7 +1443,7 @@ class Fields extends Structure
$author, $attributes
);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
// rights
if (!isset($this->fieldsNames[$nameSingleCode]['rights']))
@ -1467,7 +1467,7 @@ class Fields extends Structure
$rights, $attributes
);
// count the static field created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
}
}
}
@ -1891,7 +1891,7 @@ class Fields extends Structure
&$optionArray, $custom = null, $taber = ''
) {
// count the dynamic fields created
CFactory::_('Counter')->field++;
CFactory::_('Utilities.Counter')->field++;
// check what type of field builder to use
if (CFactory::_('Config')->get('field_builder_type', 2) == 1)
{

View File

@ -1234,9 +1234,10 @@ class Interpretation extends Fields
}
// stop it from being added double
$addDynamicSQL = false;
CFactory::_('Component')->appendArray('version_update', $update_);
// add dynamic SQL
$this->setUpdateXMLSQL($update_, $updateXML, $addDynamicSQL);
CFactory::_('Component')->appendArray('version_update', $update_);
}
/**
@ -1249,7 +1250,7 @@ class Interpretation extends Fields
public function setUpdateXMLSQL(&$update, &$updateXML, &$addDynamicSQL)
{
// ensure version naming is correct
$update['version'] = preg_replace('/[^0-9.]+/', '', (string) $update['version']);
$update['version'] = preg_replace('/[^0-9\.]+/', '', (string) $update['version']);
// setup SQL
if (StringHelper::check($update['mysql']))
{
@ -1284,7 +1285,8 @@ class Interpretation extends Fields
$name = StringHelper::safe($update['version']);
$target = array('admin' => $name);
$this->buildDynamique($target, 'sql_update', $update['version']);
CFactory::_('Content')->set_($name . '_' . $update['version'], 'UPDATE_VERSION_MYSQL',
$_name = preg_replace('/[\.]+/', '_', (string) $update['version']);
CFactory::_('Content')->set_($name . '_' . $_name, 'UPDATE_VERSION_MYSQL',
$update['mysql']
);
}
@ -6294,7 +6296,7 @@ class Interpretation extends Fields
if (isset($folder['rename']) && 1 == $folder['rename'])
{
if ($_paths = FileHelper::getPaths(
$this->componentPath . $path
CFactory::_('Utilities.Paths')->component_path . $path
))
{
$files[$path] = $_paths;
@ -6304,7 +6306,7 @@ class Interpretation extends Fields
{
$path = $path . '/' . trim((string)$folder['folder'], '/');
if ($_paths = FileHelper::getPaths(
$this->componentPath . $path
CFactory::_('Utilities.Paths')->component_path . $path
))
{
$files[$path] = $_paths;
@ -7087,7 +7089,7 @@ class Interpretation extends Fields
public function getReplacementNames()
{
foreach ($this->newFiles as $type => $files)
foreach (CFactory::_('Utilities.Files')->toArray() as $type => $files)
{
foreach ($files as $view => $file)
{
@ -8512,7 +8514,7 @@ class Interpretation extends Fields
public function setMoveFolderScript()
{
if ($this->setMoveFolders)
if (CFactory::_('Registry')->get('set_move_folders_install_script'))
{
// reset script
$script = array();
@ -8530,7 +8532,7 @@ class Interpretation extends Fields
public function setMoveFolderMethod()
{
if ($this->setMoveFolders)
if (CFactory::_('Registry')->get('set_move_folders_install_script'))
{
// reset script
$script = array();
@ -22535,7 +22537,7 @@ class Interpretation extends Fields
$type = ComponentbuilderHelper::imageInfo($path);
if ($type)
{
$imagePath = $this->componentPath . '/admin/assets/images';
$imagePath = CFactory::_('Utilities.Paths')->component_path . '/admin/assets/images';
// move the image to its place
File::copy(
JPATH_SITE . '/' . $path,
@ -22757,7 +22759,7 @@ class Interpretation extends Fields
$this->iconBuilder
))
{
$imagePath = $this->componentPath
$imagePath = CFactory::_('Utilities.Paths')->component_path
. '/admin/assets/images/icons';
foreach ($this->iconBuilder as $icon => $path)
{
@ -27924,20 +27926,20 @@ function vdm_dkim() {
{
Folder::create($path);
// count the folder created
CFactory::_('Counter')->folder++;
CFactory::_('Utilities.Counter')->folder++;
}
// add to language files (for now we add all to both TODO)
$this->writeFile(
CFactory::_('Utilities.File')->write(
$path . $file_name,
implode(PHP_EOL, $lang)
);
$this->writeFile(
CFactory::_('Utilities.File')->write(
$path . $tag . '.' . $module->file_name
. '.sys.ini',
implode(PHP_EOL, $lang)
);
// set the line counter
CFactory::_('Counter')->line += count(
CFactory::_('Utilities.Counter')->line += count(
(array) $lang
);
unset($lang);
@ -28316,14 +28318,14 @@ function vdm_dkim() {
{
Folder::create($path);
// count the folder created
CFactory::_('Counter')->folder++;
CFactory::_('Utilities.Counter')->folder++;
}
// add to language file
$this->writeFile(
CFactory::_('Utilities.File')->write(
$path . $file_name,
implode(PHP_EOL, $lang)
);
$this->writeFile(
CFactory::_('Utilities.File')->write(
$path . $tag . '.plg_' . strtolower(
(string) $plugin->group
)
@ -28332,7 +28334,7 @@ function vdm_dkim() {
implode(PHP_EOL, $lang)
);
// set the line counter
CFactory::_('Counter')->line += count(
CFactory::_('Utilities.Counter')->line += count(
(array) $lang
);
unset($lang);

View File

@ -172,7 +172,7 @@ class Infusion extends Interpretation
CFactory::_('Content')->set('GLOBALVERSION', CFactory::_('Content')->get('VERSION'));
// set the joomla target xml version
CFactory::_('Content')->set('XMLVERSION', $this->joomlaVersions[CFactory::_('Config')->joomla_version]['xml_version']);
CFactory::_('Content')->set('XMLVERSION', CFactory::_('Config')->joomla_versions[CFactory::_('Config')->joomla_version]['xml_version']);
// Component_name
$name = CFactory::_('Component')->get('name');
@ -2095,7 +2095,7 @@ class Infusion extends Interpretation
// remove old unused language strings
$this->purgeLanuageStrings($values, CFactory::_('Config')->component_id);
// path to INI file
$getPAth = $this->templatePath . '/en-GB.com_admin.ini';
$getPAth = CFactory::_('Utilities.Paths')->template_path . '/en-GB.com_admin.ini';
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onBeforeBuildAllLangFiles
@ -2143,18 +2143,18 @@ class Infusion extends Interpretation
))
{
// build the path to place the lang file
$path = $this->componentPath . '/' . $p . '/language/'
$path = CFactory::_('Utilities.Paths')->component_path . '/' . $p . '/language/'
. $tag . '/';
if (!Folder::exists($path))
{
Folder::create($path);
// count the folder created
CFactory::_('Counter')->folder++;
CFactory::_('Utilities.Counter')->folder++;
}
// move the file to its place
File::copy($getPAth, $path . $file_name);
// count the file created
CFactory::_('Counter')->file++;
CFactory::_('Utilities.Counter')->file++;
// add content to it
$lang = array_map(
fn($langstring, $placeholder) => $placeholder . '="' . $langstring . '"',
@ -2162,11 +2162,11 @@ class Infusion extends Interpretation
array_keys($languageStrings)
);
// add to language file
$this->writeFile(
CFactory::_('Utilities.File')->write(
$path . $file_name, implode(PHP_EOL, $lang)
);
// set the line counter
CFactory::_('Counter')->line += count(
CFactory::_('Utilities.Counter')->line += count(
(array) $lang
);
unset($lang);
@ -2199,7 +2199,7 @@ class Infusion extends Interpretation
= implode(PHP_EOL . Indent::_(2), $langXML['site']);
}
// build xml path
$xmlPath = $this->componentPath . '/' . CFactory::_('Config')->component_code_name
$xmlPath = CFactory::_('Utilities.Paths')->component_path . '/' . CFactory::_('Config')->component_code_name
. '.xml';
// get the content in xml
$componentXML = FileHelper::getContent(
@ -2208,7 +2208,7 @@ class Infusion extends Interpretation
// update the xml content
$componentXML = CFactory::_('Placeholder')->update($componentXML, $replace);
// store the values back to xml
$this->writeFile($xmlPath, $componentXML);
CFactory::_('Utilities.File')->write($xmlPath, $componentXML);
}
}
}