Stable release of v3.2.0-beta1

Move beta to main repo. Fix #1053 so that the right and left tabs display correctly in Joomla 4&5.
This commit is contained in:
2024-03-02 22:10:30 +02:00
parent 3c91a5cdbb
commit d1e1a56671
1786 changed files with 73608 additions and 37437 deletions

View File

@@ -13,6 +13,8 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
use VDM\Joomla\Utilities\StringHelper;
@@ -85,7 +87,7 @@ class Compiler extends Infusion
if (parent::__construct())
{
// set temp directory
$comConfig = JFactory::getConfig();
$comConfig = Factory::getConfig();
$this->tempPath = $comConfig->get('tmp_path');
// set some folder paths in relation to distribution
if (CFactory::_('Config')->backup)
@@ -133,13 +135,12 @@ class Compiler extends Infusion
);
CFactory::_('Utilities.File')->write($xmlPath, $componentXML);
}
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onBeforeUpdateFiles
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeUpdateFiles',
array(&$component_context, &$this)
'jcb_ce_onBeforeUpdateFiles', [$this] // TODO move setGetItemsModelMethod to its own class
);
// now update the files
if (!$this->updateFiles())
{
@@ -147,88 +148,96 @@ class Compiler extends Infusion
}
// Trigger Event: jcb_ce_onBeforeGetCustomCode
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeGetCustomCode',
array(&$component_context, &$this)
'jcb_ce_onBeforeGetCustomCode'
);
// now insert into the new files
if (CFactory::_('Customcode')->get())
{
// Trigger Event: jcb_ce_onBeforeAddCustomCode
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeAddCustomCode',
array(&$component_context, &$this)
'jcb_ce_onBeforeAddCustomCode'
);
$this->addCustomCode();
}
// Trigger Event: jcb_ce_onBeforeSetLangFileData
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeSetLangFileData',
array(&$component_context, &$this)
'jcb_ce_onBeforeSetLangFileData'
);
// set the lang data now
$this->setLangFileData();
// set the language notice if it was set
if (ArrayHelper::check($this->langNot)
|| ArrayHelper::check($this->langSet))
if (CFactory::_('Compiler.Builder.Language.Messages')->isActive())
{
if (ArrayHelper::check($this->langNot))
if (CFactory::_('Compiler.Builder.Language.Messages')->isArray('exclude'))
{
$this->app->enqueueMessage(
JText::_('<hr /><h3>Language Warning</h3>'), 'Warning'
Text::_('<hr /><h3>Language Warning</h3>'), 'Warning'
);
foreach ($this->langNot as $tag => $percentage)
foreach (CFactory::_('Compiler.Builder.Language.Messages')->get('exclude') as $tag => $targets)
{
$this->app->enqueueMessage(
JText::sprintf(
'The <b>%s</b> language has %s&#37; translated, you will need to translate %s&#37; of the language strings before it will be added.',
$tag, $percentage, $this->percentageLanguageAdd
), 'Warning'
);
foreach ($targets as $extention => $files)
{
foreach ($files as $file => $percentage)
{
$this->app->enqueueMessage(
Text::sprintf(
'The [%s].%s <b>%s</b> language has %s&#37; translated, you will need to translate %s&#37; of the language strings before it will be added.',
$extention, $file, $tag, $percentage, CFactory::_('Config')->percentage_language_add
), 'Warning'
);
}
}
}
$this->app->enqueueMessage(
JText::_('<hr /><h3>Language Notice</h3>'), 'Notice'
Text::_('<hr /><h3>Language Notice</h3>'), 'Notice'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'<b>You can change this percentage of translated strings required in the global options of JCB.</b><br />Please watch this <a href=%s>tutorial for more help surrounding the JCB translations manager</a>.',
'"https://youtu.be/zzAcVkn_cWU?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE" target="_blank" title="JCB Tutorial surrounding Translation Manager"'
), 'Notice'
);
}
// set why the strings were added
$whyAddedLang = JText::sprintf(
$whyAddedLang = Text::sprintf(
'because more then %s&#37; of the strings have been translated.',
$this->percentageLanguageAdd
CFactory::_('Config')->percentage_language_add
);
if (CFactory::_('Config')->get('debug_line_nr', false))
{
$whyAddedLang = JText::_(
$whyAddedLang = Text::_(
'because the debugging mode is on. (debug line numbers)'
);
}
// show languages that were added
if (ArrayHelper::check($this->langSet))
if (CFactory::_('Compiler.Builder.Language.Messages')->isArray('include'))
{
$this->app->enqueueMessage(
JText::_('<hr /><h3>Language Notice</h3>'), 'Notice'
Text::_('<hr /><h3>Language Notice</h3>'), 'Notice'
);
foreach ($this->langSet as $tag => $percentage)
foreach (CFactory::_('Compiler.Builder.Language.Messages')->get('include') as $tag => $targets)
{
$this->app->enqueueMessage(
JText::sprintf(
'The <b>%s</b> language has %s&#37; translated. Was added %s',
$tag, $percentage, $whyAddedLang
), 'Notice'
);
foreach ($targets as $extention => $files)
{
foreach ($files as $file => $percentage)
{
$this->app->enqueueMessage(
Text::sprintf(
'The [%s].%s <b>%s</b> language has %s&#37; translated. Was added %s',
$extention, $file, $tag, $percentage, $whyAddedLang
), 'Notice'
);
}
}
}
}
}
// set assets table column fix type messages
$message_fix['intelligent'] = JText::_(
$message_fix['intelligent'] = Text::_(
'The <b>intelligent</b> fix only updates the #__assets table\'s column when it detects that it is too small for the worse case. The intelligent fix also only reverse the #__assets table\'s update on uninstall of the component if it detects that no other component needs the rules column to be larger any longer. This options also shows a notice to the end user of all that it does to the #__assets table on installation and uninstalling of the component.'
);
$message_fix['sql'] = JText::_(
$message_fix['sql'] = Text::_(
'The <b>SQL</b> fix updates the #__assets table\'s column size on installation of the component and reverses it back to the Joomla default on uninstall of the component.'
);
// get the asset table fix switch
@@ -237,12 +246,12 @@ class Compiler extends Infusion
if ($add_assets_table_fix)
{
$this->app->enqueueMessage(
JText::_('<hr /><h3>Assets Table Notice</h3>'), 'Notice'
Text::_('<hr /><h3>Assets Table Notice</h3>'), 'Notice'
);
$asset_table_fix_type = ($add_assets_table_fix == 2)
? 'intelligent' : 'sql';
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'The #__assets table <b>%s</b> fix has been added to this component. %s',
$asset_table_fix_type,
$message_fix[$asset_table_fix_type]
@@ -253,10 +262,10 @@ class Compiler extends Infusion
elseif (CFactory::_('Utilities.Counter')->accessSize >= 30)
{
$this->app->enqueueMessage(
JText::_('<hr /><h3>Assets Table Warning</h3>'), 'Warning'
Text::_('<hr /><h3>Assets Table Warning</h3>'), 'Warning'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'The Joomla #__assets table\'s rules column has to be fixed for this component to work coherently. JCB has detected that in worse case the rules column in the #__assets table may require <b>%s</b> characters, and yet the Joomla default is only <b>varchar(5120)</b>. JCB has three option to resolve this issue, first <b>use less permissions</b> in your component, second use the <b>SQL</b> fix, or the <b>intelligent</b> fix. %s %s',
CFactory::_('Config')->access_worse_case, $message_fix['intelligent'],
$message_fix['sql']
@@ -270,12 +279,12 @@ class Compiler extends Infusion
if (CFactory::_('Utilities.Counter')->accessSize < 30)
{
$this->app->enqueueMessage(
JText::_('<hr /><h3>Assets Table Warning</h3>'),
Text::_('<hr /><h3>Assets Table Warning</h3>'),
'Warning'
);
}
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'The Joomla #__assets table\'s name column has to be fixed for this component to work correctly. JCB has detected that the #__assets table name column will need to be enlarged because this component\'s own naming convention is larger than varchar(50) which is the Joomla default. JCB has three option to resolve this issue, first <b>shorter names</b> for your component and/or its admin views, second use the <b>SQL</b> fix, or the <b>intelligent</b> fix. %s %s',
$message_fix['intelligent'],
$message_fix['sql']
@@ -319,12 +328,12 @@ class Compiler extends Infusion
))
{
$this->app->enqueueMessage(
JText::_('<hr /><h3>Language Warning</h3>'), 'Warning'
Text::_('<hr /><h3>Language Warning</h3>'), 'Warning'
);
if (count((array) $mismatch) > 1)
{
$this->app->enqueueMessage(
JText::_(
Text::_(
'<h3>Please check the following mismatching Joomla.JText language constants.</h3>'
), 'Warning'
);
@@ -332,7 +341,7 @@ class Compiler extends Infusion
else
{
$this->app->enqueueMessage(
JText::_(
Text::_(
'<h3>Please check the following mismatch Joomla.JText language constant.</h3>'
), 'Warning'
);
@@ -343,8 +352,8 @@ class Compiler extends Infusion
$constant = CFactory::_('Config')->lang_prefix . '_'
. StringHelper::safe($string, 'U');
$this->app->enqueueMessage(
JText::sprintf(
'The <b>Joomla.JText._(&apos;%s&apos;)</b> language constant for <b>%s</b> does not have a corresponding <code>JText::script(&apos;%s&apos;)</code> decalaration, please add it.',
Text::sprintf(
'The <b>Joomla.JText._(&apos;%s&apos;)</b> language constant for <b>%s</b> does not have a corresponding <code>Text::script(&apos;%s&apos;)</code> decalaration, please add it.',
$constant, $string, $string
), 'Warning'
);
@@ -357,15 +366,15 @@ class Compiler extends Infusion
// number of external code strings
$externalCount = count($this->externalCodeString);
// the correct string
$externalCodeString = ($externalCount == 1) ? JText::_(
$externalCodeString = ($externalCount == 1) ? Text::_(
'code/string'
) : JText::_('code/strings');
) : Text::_('code/strings');
// the notice
$this->app->enqueueMessage(
JText::_('<hr /><h3>External Code Notice</h3>'), 'Notice'
Text::_('<hr /><h3>External Code Notice</h3>'), 'Notice'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'There has been <b>%s - %s</b> added to this component as EXTERNALCODE. To avoid shipping your component with malicious %s always make sure that the correct <b>code/string values</b> were used.',
$externalCount, $externalCodeString, $externalCodeString
), 'Notice'
@@ -384,7 +393,7 @@ class Compiler extends Infusion
}
/**
* Set the dynamic data to the created fils
* Set the dynamic data to the created files
*
* @return bool true on success
*
@@ -394,6 +403,13 @@ class Compiler extends Infusion
if (CFactory::_('Utilities.Files')->exists('static')
&& CFactory::_('Utilities.Files')->exists('dynamic'))
{
// load any other super powers that was already found
if (($super_powers = CFactory::_('Power.Extractor')->get_()) !== null)
{
CFactory::_('Power')->load($super_powers);
}
// set the autoloader for Powers
CFactory::_('Power.Autoloader')->set();
// get the bom file
$bom = FileHelper::getContent(CFactory::_('Config')->bom_path);
// first we do the static files
@@ -586,6 +602,15 @@ class Compiler extends Infusion
}
}
}
// load any other super powers that was found
if (($super_powers = CFactory::_('Power.Extractor')->get_()) !== null)
{
CFactory::_('Power')->load($super_powers);
}
// load the powers files/folders
CFactory::_('Power.Structure')->build();
// Infuse POWERS
CFactory::_('Power.Infusion')->set();
// do powers if found
if (ArrayHelper::check(CFactory::_('Power')->active))
{
@@ -651,13 +676,9 @@ class Compiler extends Infusion
*/
protected function setFileContent(&$name, &$path, &$bom, $view = null)
{
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onBeforeSetFileContent
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeSetFileContent',
array(&$component_context, &$name, &$path, &$bom, &$view)
'jcb_ce_onBeforeSetFileContent', [&$name, &$path, &$bom, &$view]
);
// set the file name
@@ -675,9 +696,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onGetFileContents
CFactory::_('Event')->trigger(
'jcb_ce_onGetFileContents',
array(&$component_context, &$string, &$name, &$path, &$bom,
&$view)
'jcb_ce_onGetFileContents', [&$string, &$name, &$path, &$bom, &$view]
);
// see if we should add a BOM
@@ -719,9 +738,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onBeforeSetFileContent
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeWriteFileContent',
array(&$component_context, &$answer, &$name, &$path, &$bom,
&$view)
'jcb_ce_onBeforeWriteFileContent', [&$answer, &$name, &$path, &$bom, &$view]
);
// inject any super powers found
@@ -763,7 +780,7 @@ class Compiler extends Infusion
))
{
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Upload of component (%s) update server XML failed.',
CFactory::_('Component')->get('system_name')
), 'Error'
@@ -802,7 +819,7 @@ class Compiler extends Infusion
))
{
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Upload of module (%s) update server XML failed.',
$module->name
), 'Error'
@@ -843,7 +860,7 @@ class Compiler extends Infusion
))
{
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Upload of plugin (%s) update server XML failed.',
$plugin->name
), 'Error'
@@ -903,10 +920,10 @@ class Compiler extends Infusion
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -961,10 +978,10 @@ class Compiler extends Infusion
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -981,7 +998,7 @@ class Compiler extends Infusion
// set the repo path
$repoFullPath = $this->repoPath . '/com_'
. CFactory::_('Component')->get('sales_name') . '__joomla_'
. CFactory::_('Config')->get('version', 3);
. CFactory::_('Config')->get('joomla_version', 3);
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
$component_path = CFactory::_('Utilities.Paths')->component_path;
@@ -998,7 +1015,7 @@ class Compiler extends Infusion
Folder::copy(CFactory::_('Utilities.Paths')->component_path, $repoFullPath, '', true);
} catch (\RuntimeException $e) {
$this->app->enqueueMessage(
JText::_('We where was unable to transfer the component to the git repository:') . ' ' . $e->getMessage()
Text::_('We where was unable to transfer the component to the git repository:') . ' ' . $e->getMessage()
, 'Error'
);
}
@@ -1022,7 +1039,7 @@ class Compiler extends Infusion
// set the repo path
$repoFullPath = $this->repoPath . '/'
. $module->folder_name . '__joomla_'
. CFactory::_('Config')->get('version', 3);
. CFactory::_('Config')->get('joomla_version', 3);
// Trigger Event: jcb_ce_onBeforeUpdateRepo
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeUpdateRepo',
@@ -1040,7 +1057,7 @@ class Compiler extends Infusion
);
} catch (\RuntimeException $e) {
$this->app->enqueueMessage(
JText::sprintf('We where was unable to transfer the (%s) module to the git repository:', $module->name) . ' ' . $e->getMessage()
Text::sprintf('We where was unable to transfer the (%s) module to the git repository:', $module->name) . ' ' . $e->getMessage()
, 'Error'
);
}
@@ -1066,7 +1083,7 @@ class Compiler extends Infusion
// set the repo path
$repoFullPath = $this->repoPath . '/'
. $plugin->folder_name . '__joomla_'
. CFactory::_('Config')->get('version', 3);
. CFactory::_('Config')->get('joomla_version', 3);
// Trigger Event: jcb_ce_onBeforeUpdateRepo
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeUpdateRepo',
@@ -1084,7 +1101,7 @@ class Compiler extends Infusion
);
} catch (\RuntimeException $e) {
$this->app->enqueueMessage(
JText::sprintf('We where was unable to transfer the (%s) plugin to the git repository:', $plugin->name) . ' ' . $e->getMessage()
Text::sprintf('We where was unable to transfer the (%s) plugin to the git repository:', $plugin->name) . ' ' . $e->getMessage()
, 'Error'
);
}
@@ -1114,10 +1131,8 @@ class Compiler extends Infusion
$component_folder_name = CFactory::_('Utilities.Paths')->component_folder_name;
// Trigger Event: jcb_ce_onBeforeZipComponent
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeZipComponent',
array(&$component_context, &$component_path,
&$this->filepath['component'], &$this->tempPath,
&$component_folder_name, &$this->componentData)
'jcb_ce_onBeforeZipComponent', [&$component_path, &$this->filepath['component'],
&$this->tempPath, &$component_folder_name]
);
//create the zip file
if (FileHelper::zip(
@@ -1130,13 +1145,8 @@ class Compiler extends Infusion
{
// Trigger Event: jcb_ce_onBeforeBackupZip
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeBackupZip',[
&$component_context,
&$this->filepath['component'],
&$this->tempPath,
&$this->backupPath,
&$this->componentData
]);
'jcb_ce_onBeforeBackupZip', [&$this->filepath['component'], &$this->tempPath, &$this->backupPath]
);
// copy the zip to backup path
try {
File::copy(
@@ -1146,7 +1156,7 @@ class Compiler extends Infusion
);
} catch (\RuntimeException $e) {
$this->app->enqueueMessage(
JText::_('We where was unable to transfer the component ZIP file to the backup folder:') . ' ' . $e->getMessage()
Text::_('We where was unable to transfer the component ZIP file to the backup folder:') . ' ' . $e->getMessage()
, 'Error'
);
}
@@ -1160,10 +1170,7 @@ class Compiler extends Infusion
{
// Trigger Event: jcb_ce_onBeforeMoveToServer
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeMoveToServer',
array(&$component_context,
&$this->filepath['component'], &$this->tempPath,
&$component_sales_name, &$this->componentData)
'jcb_ce_onBeforeMoveToServer', [&$this->filepath['component'], &$this->tempPath, &$component_sales_name]
);
// move to server
if (!CFactory::_('Server')->legacyMove(
@@ -1174,7 +1181,7 @@ class Compiler extends Infusion
))
{
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Upload of component (%s) zip file failed.',
CFactory::_('Component')->get('system_name')
), 'Error'
@@ -1184,10 +1191,7 @@ class Compiler extends Infusion
}
// Trigger Event: jcb_ce_onAfterZipComponent
CFactory::_('Event')->trigger(
'jcb_ce_onAfterZipComponent',
array(&$component_context, &$this->filepath['component'],
&$this->tempPath, &$component_folder_name,
&$this->componentData)
'jcb_ce_onAfterZipComponent', [&$this->filepath['component'], &$this->tempPath, &$component_folder_name]
);
// remove the component folder since we are done
if (CFactory::_('Utilities.Folder')->remove(CFactory::_('Utilities.Paths')->component_path))
@@ -1255,7 +1259,7 @@ class Compiler extends Infusion
);
} catch (\RuntimeException $e) {
$this->app->enqueueMessage(
JText::sprintf('We where was unable to transfer the (%s) module zip file to the backup folder:', $module->name) . ' ' . $e->getMessage()
Text::sprintf('We where was unable to transfer the (%s) module zip file to the backup folder:', $module->name) . ' ' . $e->getMessage()
, 'Error'
);
}
@@ -1283,7 +1287,7 @@ class Compiler extends Infusion
))
{
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Upload of module (%s) zip file failed.',
$module->name
), 'Error'
@@ -1363,7 +1367,7 @@ class Compiler extends Infusion
);
} catch (\RuntimeException $e) {
$this->app->enqueueMessage(
JText::sprintf('We where was unable to transfer the (%s) plugin zip file to the backup folder:', $plugin->name) . ' ' . $e->getMessage()
Text::sprintf('We where was unable to transfer the (%s) plugin zip file to the backup folder:', $plugin->name) . ' ' . $e->getMessage()
, 'Error'
);
}
@@ -1392,7 +1396,7 @@ class Compiler extends Infusion
))
{
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Upload of plugin (%s) zip file failed.',
$plugin->name
), 'Error'
@@ -1543,12 +1547,12 @@ class Compiler extends Infusion
if ($target['type'] == 2)
{
// found it now add code from the next line
$this->addDataToFile($file, $data, $bites);
CFactory::_('Utilities.FileInjector')->add($file, $data, $bites);
}
elseif ($target['type'] == 1 && $foundEnd)
{
// found it now add code from the next line
$this->addDataToFile(
CFactory::_('Utilities.FileInjector')->add(
$file, $data, $bites, (int) array_sum($replace)
);
}
@@ -1557,11 +1561,11 @@ class Compiler extends Infusion
// Load escaped code since the target endhash has changed
$this->loadEscapedCode($file, $target, $lineBites);
$this->app->enqueueMessage(
JText::_('<hr /><h3>Custom Code Warning</h3>'),
Text::_('<hr /><h3>Custom Code Warning</h3>'),
'Warning'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Custom code %s could not be added to <b>%s</b> please review the file after install at <b>line %s</b> and reposition the code, remove the comments and recompile to fix the issue. The issue could be due to a change to <b>lines below</b> the custom code.',
'<a href="index.php?option=com_componentbuilder&view=custom_codes&task=custom_code.edit&id='
. $target['id'] . '" target="_blank">#'
@@ -1576,11 +1580,11 @@ class Compiler extends Infusion
// Load escaped code since the target hash has changed
$this->loadEscapedCode($file, $target, $lineBites);
$this->app->enqueueMessage(
JText::_('<hr /><h3>Custom Code Warning</h3>'),
Text::_('<hr /><h3>Custom Code Warning</h3>'),
'Warning'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Custom code %s could not be added to <b>%s</b> please review the file after install at <b>line %s</b> and reposition the code, remove the comments and recompile to fix the issue. The issue could be due to a change to <b>lines above</b> the custom code.',
'<a href="index.php?option=com_componentbuilder&view=custom_codes&task=custom_code.edit&id='
. $target['id'] . '" target="_blank">#'
@@ -1594,11 +1598,11 @@ class Compiler extends Infusion
{
// Give developer a notice that file is not found.
$this->app->enqueueMessage(
JText::_('<hr /><h3>Custom Code Warning</h3>'),
Text::_('<hr /><h3>Custom Code Warning</h3>'),
'Warning'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'File <b>%s</b> could not be found, so the custom code for this file could not be addded.',
$target['path']
), 'Warning'
@@ -1642,7 +1646,7 @@ class Compiler extends Infusion
}
}
// add to the file
$this->addDataToFile($file, $data, (int) array_sum($bitBucket));
CFactory::_('Utilities.FileInjector')->add($file, $data, (int) array_sum($bitBucket));
}
/**
@@ -1656,46 +1660,11 @@ class Compiler extends Infusion
*
* @return void
* @throws RuntimeException if unable to open the file
* @deprecated 3.3 Use CFactory::_('Utilities.FileInjector')->add($file, $data, $position, $replace);
*/
protected function addDataToFile(string $file, string $data, int $position, ?int $replace = null)
{
// Open the file and a temporary stream
$actual_file = fopen($file, "rw+");
if ($actual_file === false)
{
throw new RuntimeException("Unable to open the file: {$file}");
}
$temp_file = fopen('php://temp', "rw+");
// Make a copy of the file in the temporary stream
stream_copy_to_stream($actual_file, $temp_file);
// Move to the position where the data should be added
fseek($actual_file, $position);
// Add the data
fwrite($actual_file, $data);
// Truncate the file at the end of the added data if replacing
$data_length = mb_strlen($data, '8bit');
$remove = MathHelper::bc('add', $position, $data_length);
ftruncate($actual_file, $remove);
// check if this was a replacement of data
$position = MathHelper::bc('add', $position, $replace ?: 0);
// Move to the position of the remaining data in the temporary stream
fseek($temp_file, $position);
// Copy the remaining data from the temporary stream to the file
stream_copy_to_stream($temp_file, $actual_file);
// Close both file handles
fclose($actual_file);
fclose($temp_file);
// any help to improve this is welcome...
CFactory::_('Utilities.FileInjector')->add($file, $data, $position, $replace);
}
}

View File

@@ -13,6 +13,9 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Component\ComponentHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\ArrayHelper;
@@ -105,7 +108,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Component.Placeholder')->get();
*/
public $globalPlaceholders = array();
public $globalPlaceholders = [];
/**
* The placeholders
@@ -113,7 +116,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Placeholder')->active[];
*/
public $placeholders = array();
public $placeholders = [];
/**
* The Compiler Path
@@ -208,7 +211,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Power')->active;
*/
public $powers = array();
public $powers = [];
/**
* The state of all Powers
@@ -216,14 +219,14 @@ class Get
* @var array
* @deprecated 3.3
*/
public $statePowers = array();
public $statePowers = [];
/**
* The linked Powers
*
* @var array
*/
public $linkedPowers = array();
public $linkedPowers = [];
/**
* The Plugins data
@@ -231,7 +234,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Joomlaplugin.Data')->get();
*/
public $joomlaPlugins = array();
public $joomlaPlugins = [];
/**
* The Modules data
@@ -239,7 +242,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Joomlamodule.Data')->get();
*/
public $joomlaModules = array();
public $joomlaModules = [];
/**
* The custom script placeholders - we use the (xxx) to avoid detection it should be (***)
@@ -297,7 +300,7 @@ class Get
* @var array
* @deprecated 3.3
*/
protected $customCodeData = array();
protected $customCodeData = [];
/**
* The function name memory ids
@@ -305,7 +308,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Customcode')->functionNameMemory
*/
public $functionNameMemory = array();
public $functionNameMemory = [];
/**
* The custom code for local memory
@@ -313,7 +316,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Customcode')->memory
*/
public $customCodeMemory = array();
public $customCodeMemory = [];
/**
* The custom code in local files that already exist in system
@@ -321,7 +324,7 @@ class Get
* @var array
* @deprecated 3.3
*/
protected $existingCustomCode = array();
protected $existingCustomCode = [];
/**
* The custom code in local files this are new
@@ -329,7 +332,7 @@ class Get
* @var array
* @deprecated 3.3
*/
protected $newCustomCode = array();
protected $newCustomCode = [];
/**
* The index of code already loaded
@@ -337,7 +340,7 @@ class Get
* @var array
* @deprecated 3.3
*/
protected $codeAreadyDone = array();
protected $codeAreadyDone = [];
/**
* The external code/string to be added
@@ -345,7 +348,7 @@ class Get
* @var array
* @deprecated 3.3
*/
protected $externalCodeString = array();
protected $externalCodeString = [];
/**
* The external code/string cutter
@@ -353,7 +356,7 @@ class Get
* @var array
* @deprecated 3.3
*/
protected $externalCodeCutter = array();
protected $externalCodeCutter = [];
/*
* The line numbers Switch
@@ -366,7 +369,8 @@ class Get
/*
* The percentage when a language should be added
*
* @var boolean
* @var int
* @deprecated 3.3 Use CFactory::_('Config')->percentage_language_add
*/
public $percentageLanguageAdd = 0;
@@ -384,7 +388,7 @@ class Get
* @var array
* @deprecated 3.3
*/
public $langContent = array();
public $langContent = [];
/**
* The Languages bucket
@@ -408,21 +412,21 @@ class Get
*
* @var array
*/
public $multiLangString = array();
public $multiLangString = [];
/**
* The new lang to add
*
* @var array
*/
protected $newLangStrings = array();
protected $newLangStrings = [];
/**
* The existing lang to update
*
* @var array
*/
protected $existingLangStrings = array();
protected $existingLangStrings = [];
/**
* The Language JS matching check
@@ -430,7 +434,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Language.Extractor')->langMismatch;
*/
public $langMismatch = array();
public $langMismatch = [];
/**
* The Language SC matching check
@@ -438,7 +442,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Language.Extractor')->langMatch;
*/
public $langMatch = array();
public $langMatch = [];
/**
* The Language string targets
@@ -523,7 +527,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Uikit.Comp')->get($key);
*/
public $uikitComp = array();
public $uikitComp = [];
/**
* The FOOTABLE Switch
@@ -570,14 +574,14 @@ class Get
*
* @var array
*/
public $eximportView = array();
public $eximportView = [];
/**
* The Import & Export Custom Script
*
* @var array
*/
public $importCustomScripts = array();
public $importCustomScripts = [];
/**
* The Tag & History Switch
@@ -609,7 +613,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Admin.Filter.Type')->get($key);
*/
public $adminFilterType = array();
public $adminFilterType = [];
/**
* The Language target
@@ -625,7 +629,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Language.Extractor')->langKeys;
*/
public $langKeys = array();
public $langKeys = [];
/**
* The Build target Switch
@@ -641,7 +645,7 @@ class Get
* @var array
* @deprecated 3.3
*/
public $uniquecodes = array();
public $uniquecodes = [];
/**
* The unique keys
@@ -649,7 +653,7 @@ class Get
* @var array
* @deprecated 3.3
*/
public $uniquekeys = array();
public $uniquekeys = [];
/**
* The Add contributors Switch
@@ -665,7 +669,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Customcode.Dispenser')->hub;
*/
public $customScriptBuilder = array();
public $customScriptBuilder = [];
/**
* The Footable Script Builder
@@ -697,7 +701,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Registry')->get('validation.rules');
*/
public $validationRules = array();
public $validationRules = [];
/**
* The validation linked to fields
@@ -705,7 +709,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Registry')->get('validation.linked');
*/
public $validationLinkedFields = array();
public $validationLinkedFields = [];
/**
* The admin views data array
@@ -713,7 +717,7 @@ class Get
* @var array
* @deprecated 3.3
*/
private $_adminViewData = array();
private $_adminViewData = [];
/**
* The field data array
@@ -721,7 +725,7 @@ class Get
* @var array
* @deprecated 3.3
*/
private $_fieldData = array();
private $_fieldData = [];
/**
* The custom alias builder
@@ -748,7 +752,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Registry')->get('unique.names');
*/
public $uniqueNames = array();
public $uniqueNames = [];
/**
* Set unique Names
@@ -756,7 +760,7 @@ class Get
* @var array
* @deprecated
*/
protected $uniqueFieldNames = array();
protected $uniqueFieldNames = [];
/**
* Category other name bucket
@@ -764,7 +768,7 @@ class Get
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Category.Other.Name')->get($key);
*/
public $catOtherName = array();
public $catOtherName = [];
/**
* The field relations values
@@ -772,14 +776,15 @@ class Get
* @var array
* @deprecate 3.3 Use CFactory::_('Compiler.Builder.Field.Relations')->get($key);
*/
public $fieldRelations = array();
public $fieldRelations = [];
/**
* The views default ordering
*
* @var array
* @deprecate 3.3 Use CFactory::_('Compiler.Builder.Views.Default.Ordering')->get($key);
*/
public $viewsDefaultOrdering = array();
public $viewsDefaultOrdering = [];
/**
* Default Fields
@@ -797,7 +802,7 @@ class Get
* @var array
* @deprecate 3.3 Use CFactory::_('Compiler.Builder.List.Join')->get($key);
*/
public $listJoinBuilder = array();
public $listJoinBuilder = [];
/**
* The list head over ride
@@ -805,7 +810,7 @@ class Get
* @var array
* @deprecate 3.3 Use CFactory::_('Compiler.Builder.List.Head.Override')->get($key);
*/
public $listHeadOverRide = array();
public $listHeadOverRide = [];
/**
* The linked admin view tabs
@@ -813,7 +818,7 @@ class Get
* @var array
* @deprecate 3.3 Use CFactory::_('Registry')->get('builder.linked_admin_views');
*/
public $linkedAdminViews = array();
public $linkedAdminViews = [];
/**
* The custom admin view tabs
@@ -821,7 +826,7 @@ class Get
* @var array
* @deprecate 3.3 Use CFactory::_('Compiler.Builder.Custom.Tabs')->get($key);
*/
public $customTabs = array();
public $customTabs = [];
/**
* The Add Ajax Switch
@@ -901,7 +906,7 @@ class Get
* @var array
* @deprecated 3.3
*/
public $customFieldScript = array();
public $customFieldScript = [];
/**
* The site main get
@@ -1030,9 +1035,9 @@ class Get
$config['remove_line_breaks']
= 2; // 2 is global (use the components value)
// load application
$this->app = JFactory::getApplication();
$this->app = Factory::getApplication();
// Set the params
$this->params = JComponentHelper::getParams('com_componentbuilder');
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Trigger Event: jcb_ce_onBeforeGet
CFactory::_('Event')->trigger('jcb_ce_onBeforeGet', array(&$config, &$this));
// set the Joomla version @deprecated
@@ -1044,7 +1049,7 @@ class Get
// also set the helper class langTag (for safeStrings)
ComponentbuilderHelper::$langTag = CFactory::_('Config')->get('lang_tag', 'en-GB');
// setup the main language array
$this->languages['components'][CFactory::_('Config')->get('lang_tag', 'en-GB')] = array();
$this->languages['components'][CFactory::_('Config')->get('lang_tag', 'en-GB')] = [];
// check if we have Tidy enabled @deprecated
$this->tidy = CFactory::_('Config')->get('tidy', false);
// set the field type builder @deprecated
@@ -1056,10 +1061,10 @@ class Get
$this->fieldBuilderType = 1;
// load the sugestion to use string manipulation
$this->app->enqueueMessage(
JText::_('<hr /><h3>Field Notice</h3>'), 'Notice'
Text::_('<hr /><h3>Field Notice</h3>'), 'Notice'
);
$this->app->enqueueMessage(
JText::_(
Text::_(
'Since you do not have <b>Tidy</b> extentsion setup on your system, we could not use the SimpleXMLElement class. We instead used <b>string manipulation</b> to build all your fields, this is a faster method, you must inspect the xml files in your component package to see if you are satisfied with the result.<br />You can make this method your default by opening the global options of JCB and under the <b>Global</b> tab set the <b>Field Builder Type</b> to string manipulation.'
), 'Notice'
);
@@ -1079,8 +1084,6 @@ class Get
$this->componentContext = CFactory::_('Config')->component_context;
// set the component name length @deprecated
$this->componentCodeNameLength = CFactory::_('Config')->component_code_name_length;
// add assets table fix @deprecated
$this->addAssetsTableFix = CFactory::_('Config')->add_assets_table_fix;
// set if language strings line breaks should be removed @deprecated
$this->removeLineBreaks = CFactory::_('Config')->remove_line_breaks;
// set if placeholders should be added to customcode @deprecated
@@ -1090,21 +1093,18 @@ class Get
// set if powers should be added to component (default is true) @deprecated
$this->addPower = CFactory::_('Config')->get('add_power', true);
// set the current user
$this->user = JFactory::getUser();
$this->user = Factory::getUser();
// Get a db connection.
$this->db = JFactory::getDbo();
$this->db = Factory::getDbo();
// get global placeholders @deprecated
$this->globalPlaceholders = CFactory::_('Component.Placeholder')->get();
// get the custom code from installed files
CFactory::_('Customcode.Extractor')->run();
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onBeforeGetComponentData
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeGetComponentData',
array(&$component_context, &$this)
'jcb_ce_onBeforeGetComponentData'
);
// get the component data @deprecated
@@ -1112,8 +1112,7 @@ class Get
// Trigger Event: jcb_ce_onAfterGetComponentData
CFactory::_('Event')->trigger(
'jcb_ce_onAfterGetComponentData',
array(&$component_context, &$this)
'jcb_ce_onAfterGetComponentData'
);
// make sure we have a version
@@ -1162,19 +1161,12 @@ class Get
// load powers *+*+*+*+*+*+*+*
CFactory::_('Power')->load($this->linkedPowers);
// load any other super powers that was found
if (($super_powers = CFactory::_('Power.Extractor')->get_()) !== null)
{
CFactory::_('Power')->load($super_powers);
}
// set the percentage when a language can be added
$this->percentageLanguageAdd = (int) $this->params->get(
'percentagelanguageadd', 50
);
$this->percentageLanguageAdd = (int) CFactory::_('Config')->get('percentage_language_add', 50);
// Trigger Event: jcb_ce_onBeforeGet
CFactory::_('Event')->trigger(
'jcb_ce_onAfterGet', array(&$component_context, &$this)
'jcb_ce_onAfterGet'
);
return true;
@@ -1203,7 +1195,7 @@ class Get
* @return void
* @deprecated 3.3 Use CFactory::_('Event')->trigger($event, $data);
*/
public function triggerEvent($event, $data)
public function triggerEvent($event, $data = null)
{
return CFactory::_('Event')->trigger($event, $data);
}
@@ -1332,14 +1324,11 @@ class Get
*/
public function getListViewDefaultOrdering(&$nameListCode)
{
if (isset($this->viewsDefaultOrdering[$nameListCode])
&& $this->viewsDefaultOrdering[$nameListCode]['add_admin_ordering']
== 1)
if (CFactory::_('Compiler.Builder.Views.Default.Ordering')->
get("$nameListCode.add_admin_ordering", 0) == 1)
{
foreach (
$this->viewsDefaultOrdering[$nameListCode]['admin_ordering_fields']
as $order_field
)
foreach (CFactory::_('Compiler.Builder.Views.Default.Ordering')->
get("$nameListCode.admin_ordering_fields", []) as $order_field)
{
if (($order_field_name = CFactory::_('Field.Database.Name')->get(
$nameListCode, $order_field['field']
@@ -1431,10 +1420,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -1520,10 +1509,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -1611,10 +1600,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -1666,10 +1655,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -1786,10 +1775,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -1920,10 +1909,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -1943,10 +1932,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -1981,10 +1970,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -2005,10 +1994,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -2111,7 +2100,7 @@ class Get
{
$counterInsert = 0;
$counterUpdate = 0;
$today = JFactory::getDate()->toSql();
$today = Factory::getDate()->toSql();
foreach (
$this->languages[$target][CFactory::_('Config')->get('lang_tag', 'en-GB')] as $area => $placeholders
)
@@ -2154,15 +2143,15 @@ class Get
if (!isset($this->languages[$target][$translations['language']]))
{
$this->languages[$target][$translations['language']]
= array();
= [];
}
if (!isset($this->languages[$target][$translations['language']][$area]))
{
$this->languages[$target][$translations['language']][$area]
= array();
= [];
}
$this->languages[$target][$translations['language']][$area][$placeholder]
= $translations['translation'];
= CFactory::_('Language')->fix($translations['translation']);
}
}
}
@@ -2226,10 +2215,10 @@ class Get
// add the new lang placeholder to the db
if (!isset($this->newLangStrings[$target]))
{
$this->newLangStrings[$target] = array();
$this->newLangStrings[$target] = [];
}
$this->newLangStrings[$target][$counterInsert]
= array();
= [];
$this->newLangStrings[$target][$counterInsert][]
= $this->db->quote(
json_encode(array($target_id))
@@ -2314,7 +2303,7 @@ class Get
}
}
// clear the values array
$this->newLangStrings[$target] = array();
$this->newLangStrings[$target] = [];
if (!$continue)
{
return false; // insure we dont continue if no values were loaded
@@ -2352,7 +2341,7 @@ class Get
$this->db->execute();
}
// clear the values array
$this->existingLangStrings = array();
$this->existingLangStrings = [];
}
}
@@ -2432,7 +2421,7 @@ class Get
{
$counterUpdate = 0;
$otherStrings = $this->db->loadAssocList();
$today = JFactory::getDate()->toSql();
$today = Factory::getDate()->toSql();
foreach ($otherStrings as $item)
{
if (JsonHelper::check($item[$target]))
@@ -2539,14 +2528,14 @@ class Get
)
{
// start the bucket for this lang
$this->existingLangStrings[$counterUpdate] = array();
$this->existingLangStrings[$counterUpdate] = [];
$this->existingLangStrings[$counterUpdate]['id'] = (int) $id;
$this->existingLangStrings[$counterUpdate]['conditions'] = array();
$this->existingLangStrings[$counterUpdate]['conditions'] = [];
$this->existingLangStrings[$counterUpdate]['conditions'][]
= $this->db->quoteName(
'id'
) . ' = ' . $this->db->quote($id);
$this->existingLangStrings[$counterUpdate]['fields'] = array();
$this->existingLangStrings[$counterUpdate]['fields'] = [];
$this->existingLangStrings[$counterUpdate]['fields'][]
= $this->db->quoteName(
$target
@@ -2590,10 +2579,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -2631,10 +2620,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -2652,10 +2641,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -2673,10 +2662,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -2705,10 +2694,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -2724,10 +2713,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -2743,10 +2732,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -2764,10 +2753,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -2828,10 +2817,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -2849,10 +2838,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -2891,10 +2880,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -2955,10 +2944,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -2997,10 +2986,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -3023,10 +3012,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -3049,10 +3038,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -3097,10 +3086,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -3153,10 +3142,10 @@ class Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);

View File

@@ -14,6 +14,7 @@
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Language\Text;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\FileHelper;
@@ -264,7 +265,7 @@ class Structure extends Get
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Content.One')->allActive()
*/
public $fileContentStatic = array();
public $fileContentStatic = [];
/**
* Extention Custom Fields
@@ -272,14 +273,14 @@ class Structure extends Get
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Extension.Custom.Fields')->get($key)
*/
public $extentionCustomfields = array();
public $extentionCustomfields = [];
/**
* Extention Tracking Files Moved
*
* @var array
*/
public $extentionTrackingFilesMoved = array();
public $extentionTrackingFilesMoved = [];
/**
* The standard folders
@@ -304,7 +305,7 @@ class Structure extends Get
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Content.Multi')->allActive()
*/
public $fileContentDynamic = array();
public $fileContentDynamic = [];
/**
* The Component Sales name
@@ -344,7 +345,7 @@ class Structure extends Get
* @var array
* @deprecated 3.3 Use CFactory::_('Registry')->get('dynamic_paths');
*/
public $dynamicPaths = array();
public $dynamicPaths = [];
/**
* The not new static items
@@ -352,7 +353,7 @@ class Structure extends Get
* @var array
* @deprecated 3.3 Use CFactory::_('Registry')->get('files.not.new', []);
*/
public $notNew = array();
public $notNew = [];
/**
* Update the file content
@@ -360,7 +361,7 @@ class Structure extends Get
* @var array
* @deprecated 3.3 Use CFactory::_('Registry')->get('update.file.content');
*/
public $updateFileContent = array();
public $updateFileContent = [];
/**
* The new files
@@ -368,7 +369,7 @@ class Structure extends Get
* @var array
* @deprecated 3.3 Use CFactory::_('Utilities.Files');
*/
public $newFiles = array();
public $newFiles = [];
/**
* The Checkin Switch
@@ -390,7 +391,7 @@ class Structure extends Get
* @var array
* @deprecated 3.3
*/
protected $lastModifiedDate = array();
protected $lastModifiedDate = [];
/**
* The default view switch
@@ -474,10 +475,10 @@ class Structure extends Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -493,10 +494,10 @@ class Structure extends Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -512,10 +513,10 @@ class Structure extends Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -531,10 +532,10 @@ class Structure extends Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -550,10 +551,10 @@ class Structure extends Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -569,10 +570,10 @@ class Structure extends Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -599,10 +600,10 @@ class Structure extends Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -618,10 +619,10 @@ class Structure extends Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -637,10 +638,10 @@ class Structure extends Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -673,7 +674,8 @@ class Structure extends Get
{
$check = md5($path . 'type' . $field['type_name']);
// lets check if we already moved this
if (!isset($this->extentionTrackingFilesMoved[$check]))
if (CFactory::_('Config')->get('joomla_version', 3) == 3 &&
!isset($this->extentionTrackingFilesMoved[$check]))
{
// check files exist
if (File::exists(
@@ -700,7 +702,8 @@ class Structure extends Get
. CFactory::_('Registry')->get('validation.linked.' . $field['field'])
);
// lets check if we already moved this
if (!isset($this->extentionTrackingFilesMoved[$check]))
if (CFactory::_('Config')->get('joomla_version', 3) == 3 &&
!isset($this->extentionTrackingFilesMoved[$check]))
{
// check files exist
if (File::exists(
@@ -751,7 +754,7 @@ class Structure extends Get
foreach ($ids as $id)
{
// setup the field
$field = array();
$field = [];
$field['field'] = $id;
CFactory::_('Field')->set($field);
// move field and rules if needed
@@ -812,10 +815,10 @@ class Structure extends Get
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -833,13 +836,21 @@ class Structure extends Get
CFactory::_('Registry')->set('set_move_folders_install_script', true);
// set message that this was done (will still add a tutorial link later)
$this->app->enqueueMessage(
JText::_(
Text::_(
'<hr /><h3>Dynamic folder(s) were detected.</h3>'
), 'Notice'
);
$_function = 'setDynamicF0ld3rs';
$_script = 'script.php';
if (CFactory::_('Config')->get('joomla_version', 3) != 3)
{
$_function = 'moveFolders';
$_script = 'ComponentnameInstallerScript.php';
}
$this->app->enqueueMessage(
JText::sprintf(
'A method (setDynamicF0ld3rs) was added to the install <b>script.php</b> of this package to insure that the folder(s) are copied into the correct place when this component is installed!'
Text::sprintf(
'A method (%s) was added to the install <b>%s</b> of this package to insure that the folder(s) are copied into the correct place when this component is installed!',
$_function, $_script
), 'Notice'
);
}

View File

@@ -13,6 +13,7 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Text;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
@@ -31,7 +32,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Meta.Data')->get($key);
*/
public $metadataBuilder = array();
public $metadataBuilder = [];
/**
* View access Switch
@@ -39,7 +40,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Access.Switch')->get($key);
*/
public $accessBuilder = array();
public $accessBuilder = [];
/**
* edit view tabs counter
@@ -47,7 +48,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Tab.Counter')->get($key);
*/
public $tabCounter = array();
public $tabCounter = [];
/**
* layout builder
@@ -55,7 +56,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Layout')->get($key);
*/
public $layoutBuilder = array();
public $layoutBuilder = [];
/**
* permissions builder
@@ -63,7 +64,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Has.Permissions')->get($key);
*/
public $hasPermissions = array();
public $hasPermissions = [];
/**
* used to fix the zero order
@@ -71,7 +72,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Order.Zero')->get($key);
*/
private $zeroOrderFix = array();
private $zeroOrderFix = [];
/**
* Site field data
@@ -79,7 +80,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Site.Field.Data')->get($key);
*/
public $siteFieldData = array();
public $siteFieldData = [];
/**
* list of fields that are not being escaped
@@ -87,7 +88,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Do.Not.Escape')->get($key);
*/
public $doNotEscape = array();
public $doNotEscape = [];
/**
* list of classes used in the list view for the fields
@@ -95,7 +96,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.List.Field.Class')->set($key, true);
*/
public $listFieldClass = array();
public $listFieldClass = [];
/**
* tags builder
@@ -103,7 +104,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Tags')->get($key);
*/
public $tagsBuilder = array();
public $tagsBuilder = [];
/**
* query builder
@@ -111,7 +112,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Database.Tables')->get($key);
*/
public $queryBuilder = array();
public $queryBuilder = [];
/**
* unique keys for database field
@@ -119,7 +120,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Database.Unique.Keys')->get($key);
*/
public $dbUniqueKeys = array();
public $dbUniqueKeys = [];
/**
* unique guid swtich
@@ -127,7 +128,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Database.Unique.Guid')->get($key);
*/
public $dbUniqueGuid = array();
public $dbUniqueGuid = [];
/**
* keys for database field
@@ -135,7 +136,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Database.Keys')->get($key);
*/
public $dbKeys = array();
public $dbKeys = [];
/**
* history builder
@@ -143,7 +144,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.History')->get($key);
*/
public $historyBuilder = array();
public $historyBuilder = [];
/**
* alias builder
@@ -151,7 +152,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 CFactory::_('Compiler.Builder.Alias')->get($key);
*/
public $aliasBuilder = array();
public $aliasBuilder = [];
/**
* title builder
@@ -159,7 +160,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 CFactory::_('Compiler.Builder.Title')->get($key);
*/
public $titleBuilder = array();
public $titleBuilder = [];
/**
* list builder
@@ -167,7 +168,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Lists')->get($key);
*/
public $listBuilder = array();
public $listBuilder = [];
/**
* custom Builder List
@@ -175,7 +176,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Custom.List')->get($key);
*/
public $customBuilderList = array();
public $customBuilderList = [];
/**
* Hidden Fields Builder
@@ -183,7 +184,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Hidden.Fields')->get($key);
*/
public $hiddenFieldsBuilder = array();
public $hiddenFieldsBuilder = [];
/**
* INT Field Builder
@@ -191,7 +192,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Integer.Fields')->get($key);
*/
public $intFieldsBuilder = array();
public $intFieldsBuilder = [];
/**
* Dynamic Fields Builder
@@ -199,7 +200,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Dynamic.Fields')->get($key);
*/
public $dynamicfieldsBuilder = array();
public $dynamicfieldsBuilder = [];
/**
* Main text Builder
@@ -207,7 +208,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Main.Text.Field')->get($key);
*/
public $maintextBuilder = array();
public $maintextBuilder = [];
/**
* Custom Builder
@@ -215,7 +216,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Custom.Field')->get($key);
*/
public $customBuilder = array();
public $customBuilder = [];
/**
* Custom Field Links Builder
@@ -223,7 +224,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Custom.Field.Links')->get($key);
*/
public $customFieldLinksBuilder = array();
public $customFieldLinksBuilder = [];
/**
* Set Script for User Switch
@@ -231,7 +232,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Script.User.Switch')->get($key);
*/
public $setScriptUserSwitch = array();
public $setScriptUserSwitch = [];
/**
* Set Script for Media Switch
@@ -239,7 +240,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Script.Media.Switch')->get($key);
*/
public $setScriptMediaSwitch = array();
public $setScriptMediaSwitch = [];
/**
* Category builder
@@ -247,7 +248,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Category')->get($key);
*/
public $categoryBuilder = array();
public $categoryBuilder = [];
/**
* Category Code builder
@@ -255,7 +256,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Category.Code')->get($key);
*/
public $catCodeBuilder = array();
public $catCodeBuilder = [];
/**
* Check Box builder
@@ -263,7 +264,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Check.Box')->get($key);
*/
public $checkboxBuilder = array();
public $checkboxBuilder = [];
/**
* Json String Builder
@@ -271,7 +272,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Json.String')->get($key);
*/
public $jsonStringBuilder = array();
public $jsonStringBuilder = [];
/**
* Json String Builder for return values to array
@@ -279,7 +280,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Json.Item.Array')->get($key);
*/
public $jsonItemBuilderArray = array();
public $jsonItemBuilderArray = [];
/**
* Json Item Builder
@@ -287,7 +288,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Json.Item')->get($key);
*/
public $jsonItemBuilder = array();
public $jsonItemBuilder = [];
/**
* Base 64 Builder
@@ -295,7 +296,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Base.Six.Four')->get($key);
*/
public $base64Builder = array();
public $base64Builder = [];
/**
* Basic Encryption Field Modeling
@@ -303,7 +304,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Model.Basic.Field')->get($key);
*/
public $basicFieldModeling = array();
public $basicFieldModeling = [];
/**
* WHMCS Encryption Field Modeling
@@ -311,7 +312,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Model.Whmcs.Field')->get($key);
*/
public $whmcsFieldModeling = array();
public $whmcsFieldModeling = [];
/**
* Medium Encryption Field Modeling
@@ -319,7 +320,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Model.Medium.Field')->get($key);
*/
public $mediumFieldModeling = array();
public $mediumFieldModeling = [];
/**
* Expert Field Modeling
@@ -327,7 +328,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Model.Expert.Field')->get($key);
*/
public $expertFieldModeling = array();
public $expertFieldModeling = [];
/**
* Expert Mode Initiator
@@ -335,7 +336,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Model.Expert.Field.Initiator')->get($key);
*/
public $expertFieldModelInitiator = array();
public $expertFieldModelInitiator = [];
/**
* Get Items Method List String Fix Builder
@@ -343,7 +344,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Items.Method.List.String')->get($key);
*/
public $getItemsMethodListStringFixBuilder = array();
public $getItemsMethodListStringFixBuilder = [];
/**
* Get Items Method Eximport String Fix Builder
@@ -351,7 +352,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Items.Method.Eximport.String')->get($key);
*/
public $getItemsMethodEximportStringFixBuilder = array();
public $getItemsMethodEximportStringFixBuilder = [];
/**
* Selection Translation Fix Builder
@@ -359,7 +360,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Selection.Translation')->get($key);
*/
public $selectionTranslationFixBuilder = array();
public $selectionTranslationFixBuilder = [];
/**
* Sort Builder
@@ -367,7 +368,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Sort')->get($key);
*/
public $sortBuilder = array();
public $sortBuilder = [];
/**
* Search Builder
@@ -375,7 +376,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Search')->get($key);
*/
public $searchBuilder = array();
public $searchBuilder = [];
/**
* Filter Builder
@@ -383,7 +384,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Filter')->get($key);
*/
public $filterBuilder = array();
public $filterBuilder = [];
/**
* Set Group Control
@@ -391,7 +392,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Field.Group.Control')->get($key);
*/
public $setGroupControl = array();
public $setGroupControl = [];
/**
* Set Field Names
@@ -399,7 +400,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Field.Names')->get($key);
*/
public $fieldsNames = array();
public $fieldsNames = [];
/**
* Default Fields set to publishing
@@ -407,7 +408,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.New.Publishing.Fields')->set($key);
*/
public $newPublishingFields = array();
public $newPublishingFields = [];
/**
* Default Fields set to publishing
@@ -415,7 +416,7 @@ class Fields extends Structure
* @var array
* @deprecated 3.3 Use CFactory::_('Compiler.Builder.Moved.Publishing.Fields')->set($key);
*/
public $movedPublishingFields = array();
public $movedPublishingFields = [];
/**
* set the Field set of a view
@@ -731,10 +732,10 @@ class Fields extends Structure
{
// 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'
Text::sprintf('<hr /><h3>%s Warning</h3>', __CLASS__), 'Error'
);
$this->app->enqueueMessage(
JText::sprintf(
Text::sprintf(
'Use of a deprecated method (%s)!', __METHOD__
), 'Error'
);
@@ -853,6 +854,42 @@ class Fields extends Structure
*
*/
public function setFieldFilterSet(&$nameSingleCode, &$nameListCode)
{
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
return $this->setFieldFilterSetJ3($nameSingleCode, $nameListCode);
}
return $this->setFieldFilterSetJ4($nameSingleCode, $nameListCode);
}
/**
* set the Filter List set of a view
*
* @param string $nameSingleCode The single view name
* @param string $nameListCode The list view name
*
* @return string The fields set in xml
*
*/
public function setFieldFilterListSet(&$nameSingleCode, &$nameListCode)
{
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
return $this->setFieldFilterListSetJ3($nameSingleCode, $nameListCode);
}
return $this->setFieldFilterListSetJ4($nameSingleCode, $nameListCode);
}
/**
* set the Filter Field set of a view
*
* @param string $nameSingleCode The single view name
* @param string $nameListCode The list view name
*
* @return string The fields set in xml
*
*/
public function setFieldFilterSetJ3(&$nameSingleCode, &$nameListCode)
{
// check if this is the above/new filter option
if (CFactory::_('Compiler.Builder.Admin.Filter.Type')->get($nameListCode, 1) == 2)
@@ -879,7 +916,7 @@ class Fields extends Structure
. ' items. Prefix with ID: to search for an item by ID.'
);
// now build the XML
$field_filter_sets = array();
$field_filter_sets = [];
$field_filter_sets[] = Indent::_(1) . '<fields name="filter">';
// we first add the search
$field_filter_sets[] = Indent::_(2) . '<field';
@@ -1035,7 +1072,7 @@ class Fields extends Structure
* @return string The fields set in xml
*
*/
public function setFieldFilterListSet(&$nameSingleCode, &$nameListCode)
public function setFieldFilterListSetJ3(&$nameSingleCode, &$nameListCode)
{
// check if this is the above/new filter option
if (CFactory::_('Compiler.Builder.Admin.Filter.Type')->get($nameListCode, 1) == 2)
@@ -1043,7 +1080,7 @@ class Fields extends Structure
// keep track of all fields already added
$donelist = array('ordering' => true, 'id' => true);
// now build the XML
$list_sets = array();
$list_sets = [];
$list_sets[] = Indent::_(1) . '<fields name="list">';
$list_sets[] = Indent::_(2) . '<field';
$list_sets[] = Indent::_(3) . 'name="fullordering"';
@@ -1149,6 +1186,309 @@ class Fields extends Structure
return '';
}
/**
* set the Filter Field set of a view
*
* @param string $nameSingleCode The single view name
* @param string $nameListCode The list view name
*
* @return string The fields set in xml
*
*/
public function setFieldFilterSetJ4(&$nameSingleCode, &$nameListCode)
{
// check if this is the above/new filter option
if (CFactory::_('Compiler.Builder.Admin.Filter.Type')->get($nameListCode, 1) == 2)
{
// we first create the file
$target = ['admin' => 'filter_' . $nameListCode];
CFactory::_('Utilities.Structure')->build(
$target, 'filter'
);
// the search language string
$lang_search = CFactory::_('Config')->lang_prefix . '_FILTER_SEARCH';
// and to translation
CFactory::_('Language')->set(
CFactory::_('Config')->lang_target, $lang_search, 'Search'
. StringHelper::safe($nameListCode, 'w')
);
// the search description language string
$lang_search_desc = CFactory::_('Config')->lang_prefix . '_FILTER_SEARCH_'
. strtoupper($nameListCode);
// and to translation
CFactory::_('Language')->set(
CFactory::_('Config')->lang_target, $lang_search_desc, 'Search the '
. StringHelper::safe($nameSingleCode, 'w')
. ' items. Prefix with ID: to search for an item by ID.'
);
// now build the XML
$field_filter_sets = [];
$field_filter_sets[] = Indent::_(1) . '<fields name="filter">';
// we first add the search
$field_filter_sets[] = Indent::_(2) . '<field';
$field_filter_sets[] = Indent::_(3) . 'type="text"';
$field_filter_sets[] = Indent::_(3) . 'name="search"';
$field_filter_sets[] = Indent::_(3) . 'inputmode="search"';
$field_filter_sets[] = Indent::_(3)
. 'label="' . $lang_search . '"';
$field_filter_sets[] = Indent::_(3)
. 'description="' . $lang_search_desc . '"';
$field_filter_sets[] = Indent::_(3) . 'hint="JSEARCH_FILTER"';
$field_filter_sets[] = Indent::_(2) . '/>';
// add the published filter if published is not set
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($nameSingleCode . '.published'))
{
// the published language string
$lang_published = CFactory::_('Config')->lang_prefix . '_FILTER_PUBLISHED';
// and to translation
CFactory::_('Language')->set(
CFactory::_('Config')->lang_target, $lang_published, 'Status'
);
// the published description language string
$lang_published_desc = CFactory::_('Config')->lang_prefix . '_FILTER_PUBLISHED_'
. strtoupper($nameListCode);
// and to translation
CFactory::_('Language')->set(
CFactory::_('Config')->lang_target, $lang_published_desc, 'Status options for '
. StringHelper::safe($nameListCode, 'w')
);
$field_filter_sets[] = Indent::_(2) . '<field';
$field_filter_sets[] = Indent::_(3) . 'type="status"';
$field_filter_sets[] = Indent::_(3) . 'name="published"';
$field_filter_sets[] = Indent::_(3)
. 'label="' . $lang_published . '"';
$field_filter_sets[] = Indent::_(3)
. 'description="' . $lang_published_desc . '"';
$field_filter_sets[] = Indent::_(3)
. 'class="js-select-submit-on-change"';
$field_filter_sets[] = Indent::_(2) . '>';
$field_filter_sets[] = Indent::_(3)
. '<option value="">JOPTION_SELECT_PUBLISHED</option>';
$field_filter_sets[] = Indent::_(2) . '</field>';
}
// add the category if found
if (CFactory::_('Compiler.Builder.Category')->exists("{$nameListCode}.extension")
&& CFactory::_('Compiler.Builder.Category')->get("{$nameListCode}.filter", 0) >= 1)
{
$field_filter_sets[] = Indent::_(2) . '<field';
$field_filter_sets[] = Indent::_(3) . 'type="category"';
$field_filter_sets[] = Indent::_(3) . 'name="category_id"';
$field_filter_sets[] = Indent::_(3)
. 'label="' . CFactory::_('Compiler.Builder.Category')->get("{$nameListCode}.name", 'error')
. '"';
$field_filter_sets[] = Indent::_(3)
. 'description="JOPTION_FILTER_CATEGORY_DESC"';
$field_filter_sets[] = Indent::_(3) . 'multiple="true"';
$field_filter_sets[] = Indent::_(3)
. 'class="js-select-submit-on-change"';
$field_filter_sets[] = Indent::_(3) . 'extension="'
. CFactory::_('Compiler.Builder.Category')->get("{$nameListCode}.extension") . '"';
$field_filter_sets[] = Indent::_(3)
. 'layout="joomla.form.field.list-fancy-select"';
// TODO NOT SURE IF THIS SHOULD BE STATIC
$field_filter_sets[] = Indent::_(3) . 'published="0,1,2"';
$field_filter_sets[] = Indent::_(2) . '/>';
}
// add the access filter if this view has access
// and if access manually is not set
if (CFactory::_('Compiler.Builder.Access.Switch')->exists($nameSingleCode)
&& !CFactory::_('Compiler.Builder.Field.Names')->isString($nameSingleCode . '.access'))
{
$field_filter_sets[] = Indent::_(2) . '<field';
$field_filter_sets[] = Indent::_(3) . 'type="accesslevel"';
$field_filter_sets[] = Indent::_(3) . 'name="access"';
$field_filter_sets[] = Indent::_(3)
. 'label="JGRID_HEADING_ACCESS"';
$field_filter_sets[] = Indent::_(3)
. 'hint="JOPTION_SELECT_ACCESS"';
$field_filter_sets[] = Indent::_(3) . 'multiple="true"';
$field_filter_sets[] = Indent::_(3)
. 'class="js-select-submit-on-change"';
$field_filter_sets[] = Indent::_(3)
. 'layout="joomla.form.field.list-fancy-select"';
$field_filter_sets[] = Indent::_(2) . '/>';
}
// now add the dynamic fields
if (CFactory::_('Compiler.Builder.Filter')->exists($nameListCode))
{
foreach (CFactory::_('Compiler.Builder.Filter')->get($nameListCode) as $n => $filter)
{
if ($filter['type'] != 'category')
{
$field_filter_sets[] = Indent::_(2) . '<field';
// if this is a custom field
if (ArrayHelper::check($filter['custom']))
{
// we use the field type from the custom field
$field_filter_sets[] = Indent::_(3) . 'type="'
. $filter['type'] . '"';
// set css classname of this field
$filter_class = ucfirst((string) $filter['type']);
}
else
{
// we use the filter field type that was build
$field_filter_sets[] = Indent::_(3) . 'type="'
. $filter['filter_type'] . '"';
// set css classname of this field
$filter_class = ucfirst((string) $filter['filter_type']);
}
$field_filter_sets[] = Indent::_(3) . 'name="'
. $filter['code'] . '"';
$field_filter_sets[] = Indent::_(3) . 'label="'
. $filter['label'] . '"';
// if this is a multi field
if ($filter['multi'] == 2)
{
$field_filter_sets[] = Indent::_(3) . 'layout="joomla.form.field.list-fancy-select"';
$field_filter_sets[] = Indent::_(3) . 'multiple="true"';
if (isset($filter['lang_select']))
{
$field_filter_sets[] = Indent::_(3) . 'hint="' . $filter['lang_select'] . '"';
}
}
else
{
$field_filter_sets[] = Indent::_(3) . 'multiple="false"';
}
// we add the on change css class
$field_filter_sets[] = Indent::_(3) . 'class="js-select-submit-on-change"';
$field_filter_sets[] = Indent::_(2) . '/>';
}
}
}
$field_filter_sets[] = Indent::_(2)
. '<input type="hidden" name="form_submited" value="1"/>';
$field_filter_sets[] = Indent::_(1) . '</fields>';
// now update the file
return implode(PHP_EOL, $field_filter_sets);
}
return '';
}
/**
* set the Filter List set of a view
*
* @param string $nameSingleCode The single view name
* @param string $nameListCode The list view name
*
* @return string The fields set in xml
*
*/
public function setFieldFilterListSetJ4(&$nameSingleCode, &$nameListCode)
{
// check if this is the above/new filter option
if (CFactory::_('Compiler.Builder.Admin.Filter.Type')->get($nameListCode, 1) == 2)
{
// keep track of all fields already added
$donelist = ['ordering' => true, 'id' => true];
// now build the XML
$list_sets = [];
$list_sets[] = Indent::_(1) . '<fields name="list">';
$list_sets[] = Indent::_(2) . '<field';
$list_sets[] = Indent::_(3) . 'name="fullordering"';
$list_sets[] = Indent::_(3) . 'type="list"';
$list_sets[] = Indent::_(3)
. 'label="JGLOBAL_SORT_BY"';
$list_sets[] = Indent::_(3) . 'class="js-select-submit-on-change"';
// add dynamic ordering (Admin view)
$default_ordering = $this->getListViewDefaultOrdering(
$nameListCode
);
// set the default ordering
$list_sets[] = Indent::_(3) . 'default="'
. $default_ordering['name'] . ' '
. $default_ordering['direction'] . '"';
$list_sets[] = Indent::_(3) . 'validate="options"';
$list_sets[] = Indent::_(2) . '>';
$list_sets[] = Indent::_(3)
. '<option value="">JGLOBAL_SORT_BY</option>';
$list_sets[] = Indent::_(3)
. '<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>';
$list_sets[] = Indent::_(3)
. '<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>';
// add the published filter if published is not set
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($nameSingleCode . '.published'))
{
// add to done list
$donelist['published'] = true;
// add to xml :)
$list_sets[] = Indent::_(3)
. '<option value="a.published ASC">JSTATUS_ASC</option>';
$list_sets[] = Indent::_(3)
. '<option value="a.published DESC">JSTATUS_DESC</option>';
}
// add the rest of the set filters
if (CFactory::_('Compiler.Builder.Sort')->exists($nameListCode))
{
foreach (CFactory::_('Compiler.Builder.Sort')->get($nameListCode) as $filter)
{
if (!isset($donelist[$filter['code']]))
{
if ($filter['type'] === 'category')
{
$list_sets[] = Indent::_(3)
. '<option value="category_title ASC">'
. $filter['lang_asc'] . '</option>';
$list_sets[] = Indent::_(3)
. '<option value="category_title DESC">'
. $filter['lang_desc'] . '</option>';
}
elseif (ArrayHelper::check(
$filter['custom']
))
{
$list_sets[] = Indent::_(3) . '<option value="'
. $filter['custom']['db'] . '.'
. $filter['custom']['text'] . ' ASC">'
. $filter['lang_asc'] . '</option>';
$list_sets[] = Indent::_(3) . '<option value="'
. $filter['custom']['db'] . '.'
. $filter['custom']['text'] . ' DESC">'
. $filter['lang_desc'] . '</option>';
}
else
{
$list_sets[] = Indent::_(3) . '<option value="a.'
. $filter['code'] . ' ASC">'
. $filter['lang_asc'] . '</option>';
$list_sets[] = Indent::_(3) . '<option value="a.'
. $filter['code'] . ' DESC">'
. $filter['lang_desc'] . '</option>';
}
// do not add again
$donelist[$filter['code']] = true;
}
}
}
$list_sets[] = Indent::_(3)
. '<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>';
$list_sets[] = Indent::_(3)
. '<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>';
$list_sets[] = Indent::_(2) . '</field>' . PHP_EOL;
$list_sets[] = Indent::_(2) . '<field';
$list_sets[] = Indent::_(3) . 'name="limit"';
$list_sets[] = Indent::_(3) . 'type="limitbox"';
$list_sets[] = Indent::_(3) . 'label="JGLOBAL_LIST_LIMIT"';
$list_sets[] = Indent::_(3) . 'default="25"';
$list_sets[] = Indent::_(3) . 'class="js-select-submit-on-change"';
$list_sets[] = Indent::_(2) . '/>';
$list_sets[] = Indent::_(1) . '</fields>';
return implode(PHP_EOL, $list_sets);
}
return '';
}
/**
* set Custom Field for Filter
*
@@ -1167,7 +1507,7 @@ class Fields extends Structure
// start loading the field type
// $this->fileContentDynamic['customfilterfield_'
// . $filter['filter_type']]
// = array();
// = [];
// JPREFIX <<DYNAMIC>>>
CFactory::_('Compiler.Builder.Content.Multi')->set('customfilterfield_' . $filter['filter_type'] . '|JPREFIX', 'J');
// Type <<<DYNAMIC>>>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -12,6 +12,12 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Mail\Mail;
use Joomla\Registry\Registry;
use VDM\Joomla\Utilities\ArrayHelper;
/**
* Componentbuilder component email helper
*/
@@ -22,28 +28,28 @@ abstract class ComponentbuilderEmail
*
* @var activeRecipient (array)
*/
public static $active = array();
public static $active = [];
/**
* Configuraiton object
*
* @var JConfig
* @var Registry
*/
public static $config = null;
public static ?Registry $config = null;
/**
* Mailer object
*
* @var JMail
* @var Mail
*/
public static $mailer = null;
public static ?Mail $mailer = null;
/**
* Custom Headers
*
* @var array
*/
protected static $header = array();
protected static array $header = [];
/**
* Get a configuration object
@@ -53,7 +59,7 @@ abstract class ComponentbuilderEmail
{
if (!self::$config)
{
self::$config = JComponentHelper::getParams('com_componentbuilder');
self::$config = ComponentHelper::getParams('com_componentbuilder');
}
return self::$config;
@@ -92,7 +98,7 @@ abstract class ComponentbuilderEmail
* @static
* @access public
*/
public static function validateAddress($address, $patternselect = null)
public static function validateAddress($address, $patternselect = null): bool
{
return self::getMailerInstance()->validateAddress($address, $patternselect);
}
@@ -100,13 +106,13 @@ abstract class ComponentbuilderEmail
/**
* Get a mailer object.
*
* Returns the global {@link JMail} object, only creating it if it doesn't already exist.
* Returns the global {@link Mail} object, only creating it if it doesn't already exist.
*
* @return JMail object
* @return Mail object
*
* @see JMail
* @see Mail
*/
public static function getMailer()
public static function getMailer(): Mail
{
if (!self::$mailer)
{
@@ -121,58 +127,58 @@ abstract class ComponentbuilderEmail
/**
* Create a mailer object
*
* @return JMail object
* @return Mail object
*
* @see JMail
* @see Mail
*/
protected static function createMailer()
protected static function createMailer(): Mail
{
// set component params
$conf = self::getConfig();
// now load the mailer
$mailer = $conf->get('mailer', 'global');
// Create a JMail object
$mail = JMail::getInstance();
// Create a Mail object
$mail = Mail::getInstance();
// check if set to global
if ('global' == $mailer)
{
// get the global details
$globalConf = JFactory::getConfig();
$mailer = $globalConf->get('mailer');
$smtpauth = ($globalConf->get('smtpauth') == 0) ? null : 1;
$smtpuser = $globalConf->get('smtpuser');
$smtppass = $globalConf->get('smtppass');
$smtphost = $globalConf->get('smtphost');
$smtpsecure = $globalConf->get('smtpsecure');
$smtpport = $globalConf->get('smtpport');
$sendmail = $globalConf->get('sendmail');
$mailfrom = $globalConf->get('mailfrom');
$fromname = $globalConf->get('fromname');
$replyto = $globalConf->get('replyto');
$replytoname = $globalConf->get('replytoname');
$globalConf = Factory::getConfig();
$mailer = $globalConf->get('mailer');
$smtpauth = ($globalConf->get('smtpauth') == 0) ? null : 1;
$smtpuser = $globalConf->get('smtpuser');
$smtppass = $globalConf->get('smtppass');
$smtphost = $globalConf->get('smtphost');
$smtpsecure = $globalConf->get('smtpsecure');
$smtpport = $globalConf->get('smtpport');
$sendmail = $globalConf->get('sendmail');
$mailfrom = $globalConf->get('mailfrom');
$fromname = $globalConf->get('fromname');
$replyto = $globalConf->get('replyto');
$replytoname = $globalConf->get('replytoname');
}
else
{
$smtpauth = ($conf->get('smtpauth') == 0) ? null : 1;
$smtpuser = $conf->get('smtpuser');
$smtppass = $conf->get('smtppass');
$smtphost = $conf->get('smtphost');
$smtpsecure = $conf->get('smtpsecure');
$smtpport = $conf->get('smtpport');
$sendmail = $conf->get('sendmail');
$mailfrom = $conf->get('emailfrom');
$fromname = $conf->get('fromname');
$replyto = $conf->get('replyto');
$replytoname = $conf->get('replytoname');
$smtpauth = ($conf->get('smtpauth') == 0) ? null : 1;
$smtpuser = $conf->get('smtpuser');
$smtppass = $conf->get('smtppass');
$smtphost = $conf->get('smtphost');
$smtpsecure = $conf->get('smtpsecure');
$smtpport = $conf->get('smtpport');
$sendmail = $conf->get('sendmail');
$mailfrom = $conf->get('emailfrom');
$fromname = $conf->get('fromname');
$replyto = $conf->get('replyto');
$replytoname = $conf->get('replytoname');
}
// Set global sender
$mail->setSender(array($mailfrom, $fromname));
// set the global reply-to if found
if ($replyto && $replytoname)
{
@@ -221,25 +227,25 @@ abstract class ComponentbuilderEmail
*/
public static function send($recipient, $subject, $body, $textonly, $mode = 0, $bounce_email = null, $idsession = null, $mailreply = null, $replyname = null , $mailfrom = null, $fromname = null, $cc = null, $bcc = null, $attachment = null, $embeded = null , $embeds = null)
{
// Get a JMail instance
// Get a Mail instance
$mail = self::getMailer();
// set component params
$conf = self::getConfig();
// set if we have override
if ($mailfrom && $fromname)
{
$mail->setSender(array($mailfrom, $fromname));
}
// load the bounce email as sender if set
if (!is_null($bounce_email))
{
{
$mail->Sender = $bounce_email;
}
// Add tag to email to identify it
// Add tag to email to identify it
if (!is_null($idsession))
{
$mail->addCustomHeader('X-VDMmethodID:'.$idsession);
@@ -257,7 +263,7 @@ abstract class ComponentbuilderEmail
// set the subject & Body
$mail->setSubject($subject);
$mail->setBody($body);
// Are we sending the email as HTML?
if ($mode)
{
@@ -268,7 +274,7 @@ abstract class ComponentbuilderEmail
//embed images
if ($embeded)
{
if(ComponentbuilderHelper::checkArray($embeds))
if(ArrayHelper::check($embeds))
{
foreach($embeds as $embed)
{
@@ -303,21 +309,21 @@ abstract class ComponentbuilderEmail
{
if (!empty($conf->get('dkim_domain')) && !empty($conf->get('dkim_selector')) && !empty($conf->get('dkim_private')) && !empty($conf->get('dkim_public')))
{
$mail->DKIM_domain = $conf->get('dkim_domain');
$mail->DKIM_selector = $conf->get('dkim_selector');
$mail->DKIM_identity = $conf->get('dkim_identity');
$mail->DKIM_passphrase = $conf->get('dkim_passphrase');
$tmp = tempnam(sys_get_temp_dir(), 'VDM');
$h = fopen($tmp, 'w');
$mail->DKIM_domain = $conf->get('dkim_domain');
$mail->DKIM_selector = $conf->get('dkim_selector');
$mail->DKIM_identity = $conf->get('dkim_identity');
$mail->DKIM_passphrase = $conf->get('dkim_passphrase');
$tmp = tempnam(sys_get_temp_dir(), 'VDM');
$h = fopen($tmp, 'w');
fwrite($h, $conf->get('dkim_private'));
fclose($h);
$mail->DKIM_private = $tmp;
$mail->DKIM_private = $tmp;
}
}
$sendmail = $mail->Send();
if ($conf->get('enable_dkim') && !empty($conf->get('dkim_domain')) && !empty($conf->get('dkim_selector')) && !empty($conf->get('dkim_private')) && !empty($conf->get('dkim_public')))
{
@unlink($tmp);
@@ -346,7 +352,7 @@ abstract class ComponentbuilderEmail
/**
* Set html text (in a row) and subject (as title) to a email table.
* do not use <p> instead use <br />
* in your html that you pass to this method
* in your html that you pass to this method
* since it is a table row it does not
* work well with paragraphs
*
@@ -355,7 +361,7 @@ abstract class ComponentbuilderEmail
*/
public static function setBasicBody($html, $subject)
{
$body = array();
$body = [];
$body[] = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
$body[] = "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
$body[] = "<head>";
@@ -392,7 +398,7 @@ abstract class ComponentbuilderEmail
/**
* Set html text (in a row) and subject (as title) to a email table.
* do not use <p> instead use <br />
* in your html that you pass to this method
* in your html that you pass to this method
* since it is a table row it does not
* work well with paragraphs
*
@@ -401,7 +407,7 @@ abstract class ComponentbuilderEmail
*/
public static function setTableBody($html, $subject)
{
$body = array();
$body = [];
$body[] = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
$body[] = "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
$body[] = "<head>";

View File

@@ -26,6 +26,7 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\GetHelper;
@@ -105,7 +106,7 @@ class Mapping
public function __construct($data = false)
{
// set the app to insure messages can be set
$this->app = JFactory::getApplication();
$this->app = Factory::getApplication();
// check that we have data
if (ArrayHelper::check($data))
{

View File

@@ -26,6 +26,7 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\GetHelper;
@@ -67,9 +68,9 @@ class Builder extends Mapping
$data['buildcomp'] = 0;
$data['buildcompsql'] = '';
// set some globals
$this->db = JFactory::getDbo();
$this->user = JFactory::getUser();
$this->today = JFactory::getDate()->toSql();
$this->db = Factory::getDbo();
$this->user = Factory::getUser();
$this->today = Factory::getDate()->toSql();
// no start the building of the views and fields
if ($this->setBuild())

View File

@@ -12,24 +12,36 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
class componentbuilderHeaderCheck
{
protected $document = null;
protected $app = null;
function js_loaded($script_name)
{
// UIkit check point
if (strpos($script_name,'uikit') !== false)
{
$app = JFactory::getApplication();
$getTemplateName = $app->getTemplate('template')->template;
if (!$this->app)
{
$this->app = Factory::getApplication();
}
$getTemplateName = $this->app->getTemplate('template')->template;
if (strpos($getTemplateName,'yoo') !== false)
{
return true;
}
}
$document = JFactory::getDocument();
$head_data = $document->getHeadData();
if (!$this->document)
{
$this->document = Factory::getDocument();
}
$head_data = $this->document->getHeadData();
foreach (array_keys($head_data['scripts']) as $script)
{
if (stristr($script, $script_name))
@@ -40,24 +52,30 @@ class componentbuilderHeaderCheck
return false;
}
function css_loaded($script_name)
{
// UIkit check point
if (strpos($script_name,'uikit') !== false)
{
$app = JFactory::getApplication();
$getTemplateName = $app->getTemplate('template')->template;
if (!$this->app)
{
$this->app = Factory::getApplication();
}
$getTemplateName = $this->app->getTemplate('template')->template;
if (strpos($getTemplateName,'yoo') !== false)
{
return true;
}
}
$document = JFactory::getDocument();
$head_data = $document->getHeadData();
if (!$this->document)
{
$this->document = Factory::getDocument();
}
$head_data = $this->document->getHeadData();
foreach (array_keys($head_data['styleSheets']) as $script)
{
if (stristr($script, $script_name))
@@ -68,4 +86,4 @@ class componentbuilderHeaderCheck
return false;
}
}
}

View File

@@ -25,7 +25,7 @@ abstract class JHtmlBatch_
* @var array
* @since 3.0
*/
protected static $ListSelection = array();
protected static $ListSelection = [];
/**
* Render the batch selection options.