Major code formate to try and set a standared. Added four new fields for JavaScript files
This commit is contained in:
@ -1,27 +1,28 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.6.0
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage compiler.php
|
||||
@author Llewellyn van der Merwe <http://www.vdm.io>
|
||||
@my wife Roline van der Merwe <http://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* --------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.6.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage compiler.php
|
||||
@author Llewellyn van der Merwe <http://www.vdm.io>
|
||||
@my wife Roline van der Merwe <http://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/----------------------------------------------------------------------------------------------------------------------------- */
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
@ -39,8 +40,9 @@ class Compiler extends Infusion
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
||||
private $tempPath;
|
||||
|
||||
|
||||
/*
|
||||
* The timer
|
||||
*
|
||||
@ -48,19 +50,18 @@ class Compiler extends Infusion
|
||||
*/
|
||||
private $time_start;
|
||||
private $time_end;
|
||||
public $secondsCompiled;
|
||||
|
||||
public $filepath = '';
|
||||
public $secondsCompiled;
|
||||
public $filepath = '';
|
||||
// fixed pathes
|
||||
protected $dynamicIntegration = false;
|
||||
protected $backupPath = false;
|
||||
protected $repoPath = false;
|
||||
protected $addCustomCodeAt = array();
|
||||
protected $dynamicIntegration = false;
|
||||
protected $backupPath = false;
|
||||
protected $repoPath = false;
|
||||
protected $addCustomCodeAt = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct($config = array ())
|
||||
public function __construct($config = array())
|
||||
{
|
||||
// to check the compiler speed
|
||||
$this->time_start = microtime(true);
|
||||
@ -68,17 +69,17 @@ class Compiler extends Infusion
|
||||
if (parent::__construct($config))
|
||||
{
|
||||
// set temp directory
|
||||
$comConfig = JFactory::getConfig();
|
||||
$this->tempPath = $comConfig->get('tmp_path');
|
||||
$comConfig = JFactory::getConfig();
|
||||
$this->tempPath = $comConfig->get('tmp_path');
|
||||
// set some folder paths in relation to distribution
|
||||
if ($config['addBackup'])
|
||||
{
|
||||
$this->backupPath = $this->params->get('backup_folder_path', $this->tempPath).'/'.$this->componentBackupName.'.zip';
|
||||
$this->dynamicIntegration = true;
|
||||
$this->backupPath = $this->params->get('backup_folder_path', $this->tempPath) . '/' . $this->componentBackupName . '.zip';
|
||||
$this->dynamicIntegration = true;
|
||||
}
|
||||
if ($config['addRepo'])
|
||||
{
|
||||
$this->repoPath = $this->params->get('git_folder_path', null);
|
||||
$this->repoPath = $this->params->get('git_folder_path', null);
|
||||
}
|
||||
// remove site folder if not needed (TODO add check if custom script was moved to site folder then we must do a more complex cleanup here)
|
||||
if ($this->removeSiteFolder)
|
||||
@ -86,12 +87,12 @@ class Compiler extends Infusion
|
||||
// first remove the files and folders
|
||||
$this->removeFolder($this->componentPath . '/site');
|
||||
// clear form component xml
|
||||
$xmlPath = $this->componentPath . '/'. $this->fileContentStatic['###component###']. '.xml';
|
||||
$xmlPath = $this->componentPath . '/' . $this->fileContentStatic['###component###'] . '.xml';
|
||||
$componentXML = ComponentbuilderHelper::getFileContents($xmlPath);
|
||||
$textToSite = ComponentbuilderHelper::getBetween($componentXML,'<files folder="site">','</files>');
|
||||
$textToSiteLang = ComponentbuilderHelper::getBetween($componentXML,'<languages folder="site">','</languages>');
|
||||
$componentXML = str_replace(array('<files folder="site">'.$textToSite."</files>", '<languages folder="site">'.$textToSiteLang."</languages>"), array('',''), $componentXML);
|
||||
$this->writeFile($xmlPath,$componentXML);
|
||||
$textToSite = ComponentbuilderHelper::getBetween($componentXML, '<files folder="site">', '</files>');
|
||||
$textToSiteLang = ComponentbuilderHelper::getBetween($componentXML, '<languages folder="site">', '</languages>');
|
||||
$componentXML = str_replace(array('<files folder="site">' . $textToSite . "</files>", '<languages folder="site">' . $textToSiteLang . "</languages>"), array('', ''), $componentXML);
|
||||
$this->writeFile($xmlPath, $componentXML);
|
||||
}
|
||||
// now update the files
|
||||
if (!$this->updateFiles())
|
||||
@ -100,7 +101,7 @@ class Compiler extends Infusion
|
||||
}
|
||||
// now insert into the new files
|
||||
if ($this->getCustomCode())
|
||||
{
|
||||
{
|
||||
$this->addCustomCode();
|
||||
}
|
||||
// set the lang data now
|
||||
@ -112,11 +113,9 @@ class Compiler extends Infusion
|
||||
{
|
||||
foreach ($this->langNot as $tag => $percentage)
|
||||
{
|
||||
$this->app->enqueueMessage(JText::sprintf('The <b>%s</b> language has %s% translated, you will need to translate %s% of the language strings before it will be added.',
|
||||
$tag, $percentage, $this->percentageLanguageAdd), 'Warning');
|
||||
$this->app->enqueueMessage(JText::sprintf('The <b>%s</b> language has %s% translated, you will need to translate %s% of the language strings before it will be added.', $tag, $percentage, $this->percentageLanguageAdd), 'Warning');
|
||||
}
|
||||
$this->app->enqueueMessage(JText::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');
|
||||
$this->app->enqueueMessage(JText::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('because more then %s% of the strings have been translated.', $this->percentageLanguageAdd);
|
||||
@ -129,8 +128,7 @@ class Compiler extends Infusion
|
||||
{
|
||||
foreach ($this->langSet as $tag => $percentage)
|
||||
{
|
||||
$this->app->enqueueMessage(JText::sprintf('The <b>%s</b> language has %s% translated. Was addeded %s',
|
||||
$tag, $percentage, $whyAddedLang), 'Notice');
|
||||
$this->app->enqueueMessage(JText::sprintf('The <b>%s</b> language has %s% translated. Was addeded %s', $tag, $percentage, $whyAddedLang), 'Notice');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -158,7 +156,7 @@ class Compiler extends Infusion
|
||||
$mismatch = array_unique($this->langMismatch);
|
||||
}
|
||||
// set a notice if we have a mismatch
|
||||
if (ComponentbuilderHelper::checkArray($mismatch))
|
||||
if (isset($mismatch) && ComponentbuilderHelper::checkArray($mismatch))
|
||||
{
|
||||
if (count($mismatch) > 1)
|
||||
{
|
||||
@ -171,9 +169,8 @@ class Compiler extends Infusion
|
||||
// add the mismatching issues
|
||||
foreach ($mismatch as $string)
|
||||
{
|
||||
$constant = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($string,'U');
|
||||
$this->app->enqueueMessage(JText::sprintf('The <b>Joomla.JText._(\'%s\')</b> language constant for (%s) does not have a corresponding JText::Script() decalaration.',
|
||||
$constant, $string), 'Warning');
|
||||
$constant = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($string, 'U');
|
||||
$this->app->enqueueMessage(JText::sprintf('The <b>Joomla.JText._(\'%s\')</b> language constant for (%s) does not have a corresponding JText::Script() decalaration.', $constant, $string), 'Warning');
|
||||
}
|
||||
$this->app->enqueueMessage('<hr />', 'Warning');
|
||||
}
|
||||
@ -186,7 +183,7 @@ class Compiler extends Infusion
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the line number in comments
|
||||
*
|
||||
@ -199,11 +196,11 @@ class Compiler extends Infusion
|
||||
{
|
||||
if ($this->debugLinenr)
|
||||
{
|
||||
return ' [Compiler '.$nr.']';
|
||||
return ' [Compiler ' . $nr . ']';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the dynamic data to the created fils
|
||||
*
|
||||
@ -223,26 +220,26 @@ class Compiler extends Infusion
|
||||
{
|
||||
$this->fileContentStatic['###FILENAME###'] = $static['name'];
|
||||
$php = '';
|
||||
if (ComponentbuilderHelper::checkFileType($static['name'],'php'))
|
||||
if (ComponentbuilderHelper::checkFileType($static['name'], 'php'))
|
||||
{
|
||||
$php = "<?php\n";
|
||||
}
|
||||
$string = ComponentbuilderHelper::getFileContents($static['path']);
|
||||
if (strpos($string,'###BOM###') !== false)
|
||||
if (strpos($string, '###BOM###') !== false)
|
||||
{
|
||||
list($wast,$code) = explode('###BOM###',$string);
|
||||
$string = $php.$bom.$code;
|
||||
list($wast, $code) = explode('###BOM###', $string);
|
||||
$string = $php . $bom . $code;
|
||||
$answer = $this->setPlaceholders($string, $this->fileContentStatic, 3);
|
||||
// add to zip array
|
||||
$this->writeFile($static['path'],$answer);
|
||||
$this->writeFile($static['path'], $answer);
|
||||
}
|
||||
else
|
||||
{
|
||||
$answer = $this->setPlaceholders($string, $this->fileContentStatic, 3);
|
||||
// add to zip array
|
||||
$this->writeFile($static['path'],$answer);
|
||||
$this->writeFile($static['path'], $answer);
|
||||
}
|
||||
$this->lineCount = $this->lineCount + substr_count($answer, PHP_EOL );
|
||||
$this->lineCount = $this->lineCount + substr_count($answer, PHP_EOL);
|
||||
}
|
||||
}
|
||||
// now we do the dynamic files
|
||||
@ -260,28 +257,28 @@ class Compiler extends Infusion
|
||||
// do some weird stuff to improve the verion and dates being added to the license
|
||||
$this->fixLicenseValues($file);
|
||||
$php = '';
|
||||
if (ComponentbuilderHelper::checkFileType($file['name'],'php'))
|
||||
if (ComponentbuilderHelper::checkFileType($file['name'], 'php'))
|
||||
{
|
||||
$php = "<?php\n";
|
||||
}
|
||||
$string = ComponentbuilderHelper::getFileContents($file['path']);
|
||||
if (strpos($string,'###BOM###') !== false)
|
||||
if (strpos($string, '###BOM###') !== false)
|
||||
{
|
||||
list($bin,$code) = explode('###BOM###',$string);
|
||||
$string = $php.$bom.$code;
|
||||
list($bin, $code) = explode('###BOM###', $string);
|
||||
$string = $php . $bom . $code;
|
||||
$answer = $this->setPlaceholders($string, $this->fileContentStatic, 3);
|
||||
$answer = $this->setPlaceholders($answer, $this->fileContentDynamic[$view], 3);
|
||||
// add to zip array
|
||||
$this->writeFile($file['path'],$answer);
|
||||
$this->writeFile($file['path'], $answer);
|
||||
}
|
||||
else
|
||||
{
|
||||
$answer = $this->setPlaceholders($string, $this->fileContentStatic, 3);
|
||||
$answer = $this->setPlaceholders($answer, $this->fileContentDynamic[$view], 3);
|
||||
// add to zip array
|
||||
$this->writeFile($file['path'],$answer);
|
||||
$this->writeFile($file['path'], $answer);
|
||||
}
|
||||
$this->lineCount = $this->lineCount + substr_count($answer, PHP_EOL );
|
||||
$this->lineCount = $this->lineCount + substr_count($answer, PHP_EOL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -295,7 +292,7 @@ class Compiler extends Infusion
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* move the local update server xml file to a remote ftp server
|
||||
*
|
||||
@ -307,7 +304,7 @@ class Compiler extends Infusion
|
||||
// move the update server to host
|
||||
if ($this->componentData->add_update_server == 1 && $this->componentData->update_server_target == 1 && isset($this->updateServerFileName) && $this->dynamicIntegration)
|
||||
{
|
||||
$xml_update_server_path = $this->componentPath.'/'.$this->updateServerFileName.'.xml';
|
||||
$xml_update_server_path = $this->componentPath . '/' . $this->updateServerFileName . '.xml';
|
||||
// make sure we have the correct file
|
||||
if (JFile::exists($xml_update_server_path) && isset($this->componentData->update_server_ftp))
|
||||
{
|
||||
@ -321,7 +318,7 @@ class Compiler extends Infusion
|
||||
$this->componentData->update_server_ftp = rtrim($basic->decryptString($this->componentData->update_server_ftp), "\0");
|
||||
}
|
||||
// now move the file
|
||||
$this->moveFileToFtpServer($xml_update_server_path,$this->componentData->update_server_ftp);
|
||||
$this->moveFileToFtpServer($xml_update_server_path, $this->componentData->update_server_ftp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -345,7 +342,7 @@ class Compiler extends Infusion
|
||||
}
|
||||
else
|
||||
{
|
||||
$value = '@update number '.$value.' of this MVC';
|
||||
$value = '@update number ' . $value . ' of this MVC';
|
||||
}
|
||||
}
|
||||
$this->fileContentStatic[$key] = $value;
|
||||
@ -362,34 +359,34 @@ class Compiler extends Infusion
|
||||
protected function setCountingStuff()
|
||||
{
|
||||
// what is the size in terms of an A4 book
|
||||
$this->pageCount = round($this->lineCount / 56);
|
||||
$this->pageCount = round($this->lineCount / 56);
|
||||
// setup the unrealistic numbers
|
||||
$this->folderSeconds = $this->folderCount * 5;
|
||||
$this->fileSeconds = $this->fileCount * 5;
|
||||
$this->lineSeconds = $this->lineCount * 10;
|
||||
$this->seconds = $this->folderSeconds + $this->fileSeconds + $this->lineSeconds;
|
||||
$this->totalHours = round($this->seconds / 3600);
|
||||
$this->totalDays = round($this->totalHours / 8);
|
||||
$this->folderSeconds = $this->folderCount * 5;
|
||||
$this->fileSeconds = $this->fileCount * 5;
|
||||
$this->lineSeconds = $this->lineCount * 10;
|
||||
$this->seconds = $this->folderSeconds + $this->fileSeconds + $this->lineSeconds;
|
||||
$this->totalHours = round($this->seconds / 3600);
|
||||
$this->totalDays = round($this->totalHours / 8);
|
||||
// setup the more realistic numbers
|
||||
$this->secondsDebugging = $this->seconds / 4;
|
||||
$this->secondsPlanning = $this->seconds / 7;
|
||||
$this->secondsMapping = $this->seconds / 10;
|
||||
$this->secondsOffice = $this->seconds / 6;
|
||||
$this->actualSeconds = $this->folderSeconds + $this->fileSeconds + $this->lineSeconds + $this->secondsDebugging + $this->secondsPlanning + $this->secondsMapping + $this->secondsOffice;
|
||||
$this->actualTotalHours = round($this->actualSeconds / 3600);
|
||||
$this->actualTotalDays = round($this->actualTotalHours / 8);
|
||||
$this->debuggingHours = round($this->secondsDebugging / 3600);
|
||||
$this->planningHours = round($this->secondsPlanning / 3600);
|
||||
$this->mappingHours = round($this->secondsMapping / 3600);
|
||||
$this->officeHours = round($this->secondsOffice / 3600);
|
||||
$this->secondsDebugging = $this->seconds / 4;
|
||||
$this->secondsPlanning = $this->seconds / 7;
|
||||
$this->secondsMapping = $this->seconds / 10;
|
||||
$this->secondsOffice = $this->seconds / 6;
|
||||
$this->actualSeconds = $this->folderSeconds + $this->fileSeconds + $this->lineSeconds + $this->secondsDebugging + $this->secondsPlanning + $this->secondsMapping + $this->secondsOffice;
|
||||
$this->actualTotalHours = round($this->actualSeconds / 3600);
|
||||
$this->actualTotalDays = round($this->actualTotalHours / 8);
|
||||
$this->debuggingHours = round($this->secondsDebugging / 3600);
|
||||
$this->planningHours = round($this->secondsPlanning / 3600);
|
||||
$this->mappingHours = round($this->secondsMapping / 3600);
|
||||
$this->officeHours = round($this->secondsOffice / 3600);
|
||||
// the actual time spent
|
||||
$this->actualHoursSpent = $this->actualTotalHours - $this->totalHours;
|
||||
$this->actualDaysSpent = $this->actualTotalDays - $this->totalDays;
|
||||
$this->actualHoursSpent = $this->actualTotalHours - $this->totalHours;
|
||||
$this->actualDaysSpent = $this->actualTotalDays - $this->totalDays;
|
||||
// calculate the projects actual time frame of completion
|
||||
$this->projectWeekTime = round($this->actualTotalDays / 5,1);
|
||||
$this->projectMonthTime = round($this->actualTotalDays / 24,1);
|
||||
$this->projectWeekTime = round($this->actualTotalDays / 5, 1);
|
||||
$this->projectMonthTime = round($this->actualTotalDays / 24, 1);
|
||||
}
|
||||
|
||||
|
||||
private function buildReadMe()
|
||||
{
|
||||
// do a final run to update the readme file
|
||||
@ -408,7 +405,7 @@ class Compiler extends Infusion
|
||||
}
|
||||
unset($this->newFiles['static']);
|
||||
}
|
||||
|
||||
|
||||
private function setReadMe($path)
|
||||
{
|
||||
// set readme data if not set already
|
||||
@ -421,45 +418,45 @@ class Compiler extends Infusion
|
||||
// update the file
|
||||
$answer = $this->setPlaceholders($string, $this->fileContentStatic);
|
||||
// add to zip array
|
||||
$this->writeFile($path,$answer);
|
||||
}
|
||||
|
||||
$this->writeFile($path, $answer);
|
||||
}
|
||||
|
||||
private function buildReadMeData()
|
||||
{
|
||||
// set some defaults
|
||||
$this->fileContentStatic['###LINE_COUNT###'] = $this->lineCount;
|
||||
$this->fileContentStatic['###FIELD_COUNT###'] = $this->fieldCount;
|
||||
$this->fileContentStatic['###FILE_COUNT###'] = $this->fileCount;
|
||||
$this->fileContentStatic['###FOLDER_COUNT###'] = $this->folderCount;
|
||||
$this->fileContentStatic['###PAGE_COUNT###'] = $this->pageCount;
|
||||
$this->fileContentStatic['###folders###'] = $this->folderSeconds;
|
||||
$this->fileContentStatic['###foldersSeconds###'] = $this->folderSeconds;
|
||||
$this->fileContentStatic['###files###'] = $this->fileSeconds;
|
||||
$this->fileContentStatic['###filesSeconds###'] = $this->fileSeconds;
|
||||
$this->fileContentStatic['###lines###'] = $this->lineSeconds;
|
||||
$this->fileContentStatic['###linesSeconds###'] = $this->lineSeconds;
|
||||
$this->fileContentStatic['###seconds###'] = $this->actualSeconds;
|
||||
$this->fileContentStatic['###actualSeconds###'] = $this->actualSeconds;
|
||||
$this->fileContentStatic['###totalHours###'] = $this->totalHours;
|
||||
$this->fileContentStatic['###totalDays###'] = $this->totalDays;
|
||||
$this->fileContentStatic['###debugging###'] = $this->secondsDebugging;
|
||||
$this->fileContentStatic['###secondsDebugging###'] = $this->secondsDebugging;
|
||||
$this->fileContentStatic['###planning###'] = $this->secondsPlanning;
|
||||
$this->fileContentStatic['###secondsPlanning###'] = $this->secondsPlanning;
|
||||
$this->fileContentStatic['###mapping###'] = $this->secondsMapping;
|
||||
$this->fileContentStatic['###secondsMapping###'] = $this->secondsMapping;
|
||||
$this->fileContentStatic['###office###'] = $this->secondsOffice;
|
||||
$this->fileContentStatic['###secondsOffice###'] = $this->secondsOffice;
|
||||
$this->fileContentStatic['###actualTotalHours###'] = $this->actualTotalHours;
|
||||
$this->fileContentStatic['###actualTotalDays###'] = $this->actualTotalDays;
|
||||
$this->fileContentStatic['###debuggingHours###'] = $this->debuggingHours;
|
||||
$this->fileContentStatic['###planningHours###'] = $this->planningHours;
|
||||
$this->fileContentStatic['###mappingHours###'] = $this->mappingHours;
|
||||
$this->fileContentStatic['###officeHours###'] = $this->officeHours;
|
||||
$this->fileContentStatic['###actualHoursSpent###'] = $this->actualHoursSpent;
|
||||
$this->fileContentStatic['###actualDaysSpent###'] = $this->actualDaysSpent;
|
||||
$this->fileContentStatic['###projectWeekTime###'] = $this->projectWeekTime;
|
||||
$this->fileContentStatic['###projectMonthTime###'] = $this->projectMonthTime;
|
||||
$this->fileContentStatic['###LINE_COUNT###'] = $this->lineCount;
|
||||
$this->fileContentStatic['###FIELD_COUNT###'] = $this->fieldCount;
|
||||
$this->fileContentStatic['###FILE_COUNT###'] = $this->fileCount;
|
||||
$this->fileContentStatic['###FOLDER_COUNT###'] = $this->folderCount;
|
||||
$this->fileContentStatic['###PAGE_COUNT###'] = $this->pageCount;
|
||||
$this->fileContentStatic['###folders###'] = $this->folderSeconds;
|
||||
$this->fileContentStatic['###foldersSeconds###'] = $this->folderSeconds;
|
||||
$this->fileContentStatic['###files###'] = $this->fileSeconds;
|
||||
$this->fileContentStatic['###filesSeconds###'] = $this->fileSeconds;
|
||||
$this->fileContentStatic['###lines###'] = $this->lineSeconds;
|
||||
$this->fileContentStatic['###linesSeconds###'] = $this->lineSeconds;
|
||||
$this->fileContentStatic['###seconds###'] = $this->actualSeconds;
|
||||
$this->fileContentStatic['###actualSeconds###'] = $this->actualSeconds;
|
||||
$this->fileContentStatic['###totalHours###'] = $this->totalHours;
|
||||
$this->fileContentStatic['###totalDays###'] = $this->totalDays;
|
||||
$this->fileContentStatic['###debugging###'] = $this->secondsDebugging;
|
||||
$this->fileContentStatic['###secondsDebugging###'] = $this->secondsDebugging;
|
||||
$this->fileContentStatic['###planning###'] = $this->secondsPlanning;
|
||||
$this->fileContentStatic['###secondsPlanning###'] = $this->secondsPlanning;
|
||||
$this->fileContentStatic['###mapping###'] = $this->secondsMapping;
|
||||
$this->fileContentStatic['###secondsMapping###'] = $this->secondsMapping;
|
||||
$this->fileContentStatic['###office###'] = $this->secondsOffice;
|
||||
$this->fileContentStatic['###secondsOffice###'] = $this->secondsOffice;
|
||||
$this->fileContentStatic['###actualTotalHours###'] = $this->actualTotalHours;
|
||||
$this->fileContentStatic['###actualTotalDays###'] = $this->actualTotalDays;
|
||||
$this->fileContentStatic['###debuggingHours###'] = $this->debuggingHours;
|
||||
$this->fileContentStatic['###planningHours###'] = $this->planningHours;
|
||||
$this->fileContentStatic['###mappingHours###'] = $this->mappingHours;
|
||||
$this->fileContentStatic['###officeHours###'] = $this->officeHours;
|
||||
$this->fileContentStatic['###actualHoursSpent###'] = $this->actualHoursSpent;
|
||||
$this->fileContentStatic['###actualDaysSpent###'] = $this->actualDaysSpent;
|
||||
$this->fileContentStatic['###projectWeekTime###'] = $this->projectWeekTime;
|
||||
$this->fileContentStatic['###projectMonthTime###'] = $this->projectMonthTime;
|
||||
}
|
||||
|
||||
private function zipComponent()
|
||||
@ -468,15 +465,15 @@ class Compiler extends Infusion
|
||||
if (ComponentbuilderHelper::checkString($this->repoPath))
|
||||
{
|
||||
// set the repo path
|
||||
$repoFullPath = $this->repoPath.'/com_'.$this->componentData->sales_name.'__joomla_'.$this->joomlaVersion;
|
||||
$repoFullPath = $this->repoPath . '/com_' . $this->componentData->sales_name . '__joomla_' . $this->joomlaVersion;
|
||||
// remove old data
|
||||
$this->removeFolder($repoFullPath, $this->componentData->toignore);
|
||||
// set the new data
|
||||
JFolder::copy($this->componentPath, $repoFullPath, '', true);
|
||||
}
|
||||
// the name of the zip file to create
|
||||
$this->filepath = $this->tempPath.'/'.$this->componentFolderName.'.zip';
|
||||
|
||||
$this->filepath = $this->tempPath . '/' . $this->componentFolderName . '.zip';
|
||||
|
||||
//create the zip file
|
||||
if (ComponentbuilderHelper::zip($this->componentPath, $this->filepath))
|
||||
{
|
||||
@ -485,7 +482,7 @@ class Compiler extends Infusion
|
||||
{
|
||||
JFile::copy($this->filepath, $this->backupPath);
|
||||
}
|
||||
|
||||
|
||||
// move to sales server host
|
||||
if ($this->componentData->add_sales_server == 1 && $this->dynamicIntegration)
|
||||
{
|
||||
@ -502,7 +499,7 @@ class Compiler extends Infusion
|
||||
$this->componentData->sales_server_ftp = rtrim($basic->decryptString($this->componentData->sales_server_ftp), "\0");
|
||||
}
|
||||
// now move the file
|
||||
$this->moveFileToFtpServer($this->filepath, $this->componentData->sales_server_ftp, $this->componentSalesName.'.zip',false);
|
||||
$this->moveFileToFtpServer($this->filepath, $this->componentData->sales_server_ftp, $this->componentSalesName . '.zip', false);
|
||||
}
|
||||
}
|
||||
// remove the component folder since we are done
|
||||
@ -513,7 +510,7 @@ class Compiler extends Infusion
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private function moveFileToFtpServer($localPath, $clientInput, $remote = null, $removeLocal = true)
|
||||
{
|
||||
// get the ftp opbject
|
||||
@ -522,7 +519,7 @@ class Compiler extends Infusion
|
||||
if ($ftp instanceof JClientFtp && $ftp->isConnected())
|
||||
{
|
||||
// move the file
|
||||
if ($ftp->store($localPath,$remote))
|
||||
if ($ftp->store($localPath, $remote))
|
||||
{
|
||||
// if moved then remove the file from repository
|
||||
if ($removeLocal)
|
||||
@ -534,7 +531,7 @@ class Compiler extends Infusion
|
||||
$ftp->quit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function getFTP($clientInput)
|
||||
{
|
||||
$s1GnAtnr3 = md5($clientInput);
|
||||
@ -581,41 +578,39 @@ class Compiler extends Infusion
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
protected function addCustomCode()
|
||||
{
|
||||
// reset all these
|
||||
$this->clearFromPlaceHolders('view');
|
||||
$this->clearFromPlaceHolders('arg');
|
||||
foreach($this->customCode as $nr => $target)
|
||||
foreach ($this->customCode as $nr => $target)
|
||||
{
|
||||
// reset each time per custom code
|
||||
$fingerPrint = array();
|
||||
if (isset($target['hashtarget'][0]) && $target['hashtarget'][0] > 3
|
||||
&& isset($target['path']) && ComponentbuilderHelper::checkString($target['path'])
|
||||
&& isset($target['hashtarget'][1]) && ComponentbuilderHelper::checkString($target['hashtarget'][1]))
|
||||
if (isset($target['hashtarget'][0]) && $target['hashtarget'][0] > 3 && isset($target['path']) && ComponentbuilderHelper::checkString($target['path']) && isset($target['hashtarget'][1]) && ComponentbuilderHelper::checkString($target['hashtarget'][1]))
|
||||
{
|
||||
$file = $this->componentPath . '/'. $target['path'];
|
||||
$size = (int) $target['hashtarget'][0];
|
||||
$hash = $target['hashtarget'][1];
|
||||
$cut = $size - 1;
|
||||
$found = false;
|
||||
$bites = 0;
|
||||
$lineBites = array();
|
||||
$replace = array();
|
||||
$file = $this->componentPath . '/' . $target['path'];
|
||||
$size = (int) $target['hashtarget'][0];
|
||||
$hash = $target['hashtarget'][1];
|
||||
$cut = $size - 1;
|
||||
$found = false;
|
||||
$bites = 0;
|
||||
$lineBites = array();
|
||||
$replace = array();
|
||||
if ($target['type'] == 1 && isset($target['hashendtarget'][0]) && $target['hashendtarget'][0] > 0)
|
||||
{
|
||||
$foundEnd = false;
|
||||
$sizeEnd = (int) $target['hashendtarget'][0];
|
||||
$hashEnd = $target['hashendtarget'][1];
|
||||
$cutEnd = $sizeEnd - 1;
|
||||
$foundEnd = false;
|
||||
$sizeEnd = (int) $target['hashendtarget'][0];
|
||||
$hashEnd = $target['hashendtarget'][1];
|
||||
$cutEnd = $sizeEnd - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// replace to the end of the file
|
||||
$foundEnd = true;
|
||||
$foundEnd = true;
|
||||
}
|
||||
$counter = 0;
|
||||
$counter = 0;
|
||||
// check if file exist
|
||||
if (JFile::exists($file))
|
||||
{
|
||||
@ -635,12 +630,12 @@ class Compiler extends Infusion
|
||||
// check lines each time if it fits our target
|
||||
if (count($fingerPrint) === $sizeEnd && !$foundEnd)
|
||||
{
|
||||
$fingerTest = md5(implode('',$fingerPrint));
|
||||
$fingerTest = md5(implode('', $fingerPrint));
|
||||
if ($fingerTest === $hashEnd)
|
||||
{
|
||||
// we are done here
|
||||
$foundEnd = true;
|
||||
$replace = array_slice($replace, 0, count($replace)-$sizeEnd);
|
||||
$replace = array_slice($replace, 0, count($replace) - $sizeEnd);
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -659,7 +654,7 @@ class Compiler extends Infusion
|
||||
// check lines each time if it fits our target
|
||||
if (count($fingerPrint) === $size && !$found)
|
||||
{
|
||||
$fingerTest = md5(implode('',$fingerPrint));
|
||||
$fingerTest = md5(implode('', $fingerPrint));
|
||||
if ($fingerTest === $hash)
|
||||
{
|
||||
// we are done here
|
||||
@ -680,8 +675,8 @@ class Compiler extends Infusion
|
||||
}
|
||||
if ($found)
|
||||
{
|
||||
$placeholder = $this->getPlaceHolder((int) $target['comment_type'].$target['type'], $target['id']);
|
||||
$data = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($target['code'], $this->placeholders). $placeholder['end'] . PHP_EOL;
|
||||
$placeholder = $this->getPlaceHolder((int) $target['comment_type'] . $target['type'], $target['id']);
|
||||
$data = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($target['code'], $this->placeholders) . $placeholder['end'] . PHP_EOL;
|
||||
if ($target['type'] == 2)
|
||||
{
|
||||
// found it now add code from the next line
|
||||
@ -732,12 +727,12 @@ class Compiler extends Infusion
|
||||
$code = explode(PHP_EOL, $target['code']);
|
||||
$code = PHP_EOL . $commentType . implode($_commentType . PHP_EOL . $commentType, $code) . $_commentType . PHP_EOL;
|
||||
// get place holders
|
||||
$placeholder = $this->getPlaceHolder((int) $target['comment_type'].$target['type'], $target['id']);
|
||||
$placeholder = $this->getPlaceHolder((int) $target['comment_type'] . $target['type'], $target['id']);
|
||||
// build the data
|
||||
$data = $placeholder['start'] . $code . $placeholder['end']. PHP_EOL;
|
||||
$data = $placeholder['start'] . $code . $placeholder['end'] . PHP_EOL;
|
||||
// get the bites before insertion
|
||||
$bitBucket = array();
|
||||
foreach($lineBites as $line => $value)
|
||||
$bitBucket = array();
|
||||
foreach ($lineBites as $line => $value)
|
||||
{
|
||||
if ($line < $target['from_line'])
|
||||
{
|
||||
@ -775,7 +770,8 @@ class Compiler extends Infusion
|
||||
// done close both files
|
||||
fclose($fpFile);
|
||||
fclose($fpTemp);
|
||||
|
||||
|
||||
// any help to improve this is welcome...
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,27 +1,28 @@
|
||||
<?php
|
||||
/**--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.6.0
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage compiler.php
|
||||
@author Llewellyn van der Merwe <http://www.vdm.io>
|
||||
@my wife Roline van der Merwe <http://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* --------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.6.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage compiler.php
|
||||
@author Llewellyn van der Merwe <http://www.vdm.io>
|
||||
@my wife Roline van der Merwe <http://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/----------------------------------------------------------------------------------------------------------------------------- */
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
@ -31,12 +32,12 @@ defined('_JEXEC') or die('Restricted access');
|
||||
*/
|
||||
class Fields extends Structure
|
||||
{
|
||||
|
||||
/**
|
||||
* Metadate Switch
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
||||
public $metadataBuilder = array();
|
||||
|
||||
/**
|
||||
@ -45,315 +46,315 @@ class Fields extends Structure
|
||||
* @var array
|
||||
*/
|
||||
public $accessBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* edit view tabs counter
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $tabCounter = array();
|
||||
|
||||
|
||||
/**
|
||||
* layout builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $layoutBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* used to fix the zero order
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $zeroOrderFix = array();
|
||||
|
||||
|
||||
/**
|
||||
* Site field data
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $siteFieldData = array();
|
||||
|
||||
|
||||
/**
|
||||
* Category other name bucket
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $catOtherName = array();
|
||||
|
||||
|
||||
/**
|
||||
* list of fields that are not being escaped
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $doNotEscape = array();
|
||||
|
||||
|
||||
/**
|
||||
* tags builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $tagsBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* query builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $queryBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* unique keys for database field
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $dbUniqueKeys = array();
|
||||
|
||||
|
||||
/**
|
||||
* keys for database field
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $dbKeys = array();
|
||||
|
||||
|
||||
/**
|
||||
* history builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $historyBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* alias builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $aliasBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* title builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $titleBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* list builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $listBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* custom Builder List
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $customBuilderList = array();
|
||||
|
||||
|
||||
/**
|
||||
* Hidden Fields Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $hiddenFieldsBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* INT Field Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $intFieldsBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Dynamic Fields Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $dynamicfieldsBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Main text Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $maintextBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Custom Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $customBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Custom Field Links Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $customFieldLinksBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Set Script for User Switch
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $setScriptUserSwitch = array();
|
||||
|
||||
|
||||
/**
|
||||
* Set Script for Media Switch
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $setScriptMediaSwitch = array();
|
||||
|
||||
|
||||
/**
|
||||
* Category builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $categoryBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Category Code builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $catCodeBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Check Box builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $checkboxBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Json String Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $jsonStringBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Json String Builder for return values to array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $jsonItemBuilderArray = array();
|
||||
|
||||
|
||||
/**
|
||||
* Json Item Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $jsonItemBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Base 64 Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $base64Builder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Basic Encryption Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $basicEncryptionBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Advnaced Encryption Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $advancedEncryptionBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Get Items Method List String Fix Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $getItemsMethodListStringFixBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Get Items Method Eximport String Fix Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $getItemsMethodEximportStringFixBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Selection Translation Fix Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $selectionTranslationFixBuilder = array();
|
||||
|
||||
public $selectionTranslationFixBuilder = array();
|
||||
|
||||
/**
|
||||
* Sort Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $sortBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Search Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $searchBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Filter Builder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $filterBuilder = array();
|
||||
|
||||
|
||||
/**
|
||||
* Set Group Control
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $setGroupControl = array();
|
||||
|
||||
|
||||
/**
|
||||
* Set Field Names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $fieldsNames = array();
|
||||
|
||||
public $fieldsNames = array();
|
||||
|
||||
/**
|
||||
* Set unique Names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $uniqueNames = array();
|
||||
|
||||
|
||||
/**
|
||||
* Default Fields
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $defaultFields = array('created', 'created_by', 'modified', 'modified_by', 'published', 'ordering', 'access', 'version', 'hits', 'id');
|
||||
|
||||
|
||||
/**
|
||||
* Default Fields set to publishing
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $newPublishingFields = array();
|
||||
|
||||
|
||||
/**
|
||||
* Default Fields set to publishing
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $movedPublishingFields = array();
|
||||
|
||||
|
||||
/**
|
||||
* Set the line number in comments
|
||||
*
|
||||
@ -366,7 +367,7 @@ class Fields extends Structure
|
||||
{
|
||||
if ($this->debugLinenr)
|
||||
{
|
||||
return ' [Fields '.$nr.']';
|
||||
return ' [Fields ' . $nr . ']';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
@ -487,13 +488,13 @@ class Fields extends Structure
|
||||
if (!isset($this->fieldsNames[$viewName]['id']))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'id',
|
||||
'type' => 'text',
|
||||
'class' => 'readonly',
|
||||
'label' => 'JGLOBAL_FIELD_ID_LABEL',
|
||||
'description' => 'JGLOBAL_FIELD_ID_DESC',
|
||||
'size' => 10,
|
||||
'default' => 0
|
||||
'name' => 'id',
|
||||
'type' => 'text',
|
||||
'class' => 'readonly',
|
||||
'label' => 'JGLOBAL_FIELD_ID_LABEL',
|
||||
'description' => 'JGLOBAL_FIELD_ID_DESC',
|
||||
'size' => 10,
|
||||
'default' => 0
|
||||
);
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||
@ -504,13 +505,13 @@ class Fields extends Structure
|
||||
if (!isset($this->fieldsNames[$viewName]['created']))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'created',
|
||||
'type' => 'calendar',
|
||||
'label' => $langView . '_CREATED_DATE_LABEL',
|
||||
'description' => $langView . '_CREATED_DATE_DESC',
|
||||
'size' => 22,
|
||||
'format' => '%Y-%m-%d %H:%M:%S',
|
||||
'filter' => 'user_utc'
|
||||
'name' => 'created',
|
||||
'type' => 'calendar',
|
||||
'label' => $langView . '_CREATED_DATE_LABEL',
|
||||
'description' => $langView . '_CREATED_DATE_DESC',
|
||||
'size' => 22,
|
||||
'format' => '%Y-%m-%d %H:%M:%S',
|
||||
'filter' => 'user_utc'
|
||||
);
|
||||
$attributes = array_merge($attributes, $readOnlyXML);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Created Field. Type: Calendar (joomla)");
|
||||
@ -523,10 +524,10 @@ class Fields extends Structure
|
||||
if (!isset($this->fieldsNames[$viewName]['created_by']))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'created_by',
|
||||
'type' => 'user',
|
||||
'label' => $langView . '_CREATED_BY_LABEL',
|
||||
'description' => $langView . '_CREATED_BY_DESC',
|
||||
'name' => 'created_by',
|
||||
'type' => 'user',
|
||||
'label' => $langView . '_CREATED_BY_LABEL',
|
||||
'description' => $langView . '_CREATED_BY_DESC',
|
||||
);
|
||||
$attributes = array_merge($attributes, $readOnlyXML);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Created Field. Type: User (joomla)");
|
||||
@ -539,9 +540,9 @@ class Fields extends Structure
|
||||
if (!isset($this->fieldsNames[$viewName]['published']))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'published',
|
||||
'type' => 'list',
|
||||
'label' => 'JSTATUS'
|
||||
'name' => 'published',
|
||||
'type' => 'list',
|
||||
'label' => 'JSTATUS'
|
||||
);
|
||||
$attributes = array_merge($attributes, $readOnlyXML);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Published Field. Type: List (joomla)");
|
||||
@ -560,15 +561,15 @@ class Fields extends Structure
|
||||
if (!isset($this->fieldsNames[$viewName]['modified']))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'modified',
|
||||
'type' => 'calendar',
|
||||
'class' => 'readonly',
|
||||
'label' => $langView . '_MODIFIED_DATE_LABEL',
|
||||
'description' => $langView . '_MODIFIED_DATE_DESC',
|
||||
'size' => 22,
|
||||
'readonly' => "true",
|
||||
'format' => '%Y-%m-%d %H:%M:%S',
|
||||
'filter' => 'user_utc'
|
||||
'name' => 'modified',
|
||||
'type' => 'calendar',
|
||||
'class' => 'readonly',
|
||||
'label' => $langView . '_MODIFIED_DATE_LABEL',
|
||||
'description' => $langView . '_MODIFIED_DATE_DESC',
|
||||
'size' => 22,
|
||||
'readonly' => "true",
|
||||
'format' => '%Y-%m-%d %H:%M:%S',
|
||||
'filter' => 'user_utc'
|
||||
);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Modified Field. Type: Calendar (joomla)");
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
@ -580,13 +581,13 @@ class Fields extends Structure
|
||||
if (!isset($this->fieldsNames[$viewName]['modified_by']))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'modified_by',
|
||||
'type' => 'user',
|
||||
'label' => $langView . '_MODIFIED_BY_LABEL',
|
||||
'description' => $langView . '_MODIFIED_BY_DESC',
|
||||
'class' => 'readonly',
|
||||
'readonly' => 'true',
|
||||
'filter' => 'unset'
|
||||
'name' => 'modified_by',
|
||||
'type' => 'user',
|
||||
'label' => $langView . '_MODIFIED_BY_LABEL',
|
||||
'description' => $langView . '_MODIFIED_BY_DESC',
|
||||
'class' => 'readonly',
|
||||
'readonly' => 'true',
|
||||
'filter' => 'unset'
|
||||
);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Modified Field. Type: User (joomla)");
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
@ -598,12 +599,12 @@ class Fields extends Structure
|
||||
if (isset($this->accessBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName]) && !isset($this->fieldsNames[$viewName]['access']))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'access',
|
||||
'type' => 'accesslevel',
|
||||
'label' => 'JFIELD_ACCESS_LABEL',
|
||||
'description' => 'JFIELD_ACCESS_DESC',
|
||||
'default' => 1,
|
||||
'required' => "false"
|
||||
'name' => 'access',
|
||||
'type' => 'accesslevel',
|
||||
'label' => 'JFIELD_ACCESS_LABEL',
|
||||
'description' => 'JFIELD_ACCESS_DESC',
|
||||
'default' => 1,
|
||||
'required' => "false"
|
||||
);
|
||||
$attributes = array_merge($attributes, $readOnlyXML);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Access Field. Type: Accesslevel (joomla)");
|
||||
@ -616,14 +617,14 @@ class Fields extends Structure
|
||||
if (!isset($this->fieldsNames[$viewName]['ordering']))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'ordering',
|
||||
'type' => 'number',
|
||||
'class' => 'inputbox validate-ordering',
|
||||
'label' => $langView . '_ORDERING_LABEL',
|
||||
'description' => '',
|
||||
'default' => 0,
|
||||
'size' => 6,
|
||||
'required' => "false"
|
||||
'name' => 'ordering',
|
||||
'type' => 'number',
|
||||
'class' => 'inputbox validate-ordering',
|
||||
'label' => $langView . '_ORDERING_LABEL',
|
||||
'description' => '',
|
||||
'default' => 0,
|
||||
'size' => 6,
|
||||
'required' => "false"
|
||||
);
|
||||
$attributes = array_merge($attributes, $readOnlyXML);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Ordering Field. Type: Numbers (joomla)");
|
||||
@ -636,14 +637,14 @@ class Fields extends Structure
|
||||
if (!isset($this->fieldsNames[$viewName]['version']))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'version',
|
||||
'type' => 'text',
|
||||
'class' => 'readonly',
|
||||
'label' => $langView . '_VERSION_LABEL',
|
||||
'description' => $langView . '_VERSION_DESC',
|
||||
'size' => 6,
|
||||
'readonly' => "true",
|
||||
'filter' => 'unset'
|
||||
'name' => 'version',
|
||||
'type' => 'text',
|
||||
'class' => 'readonly',
|
||||
'label' => $langView . '_VERSION_LABEL',
|
||||
'description' => $langView . '_VERSION_DESC',
|
||||
'size' => 6,
|
||||
'readonly' => "true",
|
||||
'filter' => 'unset'
|
||||
);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Version Field. Type: Text (joomla)");
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
@ -656,12 +657,12 @@ class Fields extends Structure
|
||||
{
|
||||
// metakey
|
||||
$attributes = array(
|
||||
'name' => 'metakey',
|
||||
'type' => 'textarea',
|
||||
'label' => 'JFIELD_META_KEYWORDS_LABEL',
|
||||
'description' => 'JFIELD_META_KEYWORDS_DESC',
|
||||
'rows' => 3,
|
||||
'cols' => 30
|
||||
'name' => 'metakey',
|
||||
'type' => 'textarea',
|
||||
'label' => 'JFIELD_META_KEYWORDS_LABEL',
|
||||
'description' => 'JFIELD_META_KEYWORDS_DESC',
|
||||
'rows' => 3,
|
||||
'cols' => 30
|
||||
);
|
||||
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metakey Field. Type: Textarea (joomla)");
|
||||
$fieldXML = $fieldSetXML->addChild('field');
|
||||
@ -701,20 +702,20 @@ class Fields extends Structure
|
||||
$this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Robots Field. Type: List (joomla)");
|
||||
$robots = $fieldsFieldSetXML->addChild('field');
|
||||
$attributes = array(
|
||||
'name' => 'robots',
|
||||
'type' => 'list',
|
||||
'label' => 'JFIELD_METADATA_ROBOTS_LABEL',
|
||||
'description' => 'JFIELD_METADATA_ROBOTS_DESC'
|
||||
'name' => 'robots',
|
||||
'type' => 'list',
|
||||
'label' => 'JFIELD_METADATA_ROBOTS_LABEL',
|
||||
'description' => 'JFIELD_METADATA_ROBOTS_DESC'
|
||||
);
|
||||
$this->xmlAddAttributes($robots, $attributes);
|
||||
// count the static field created
|
||||
$this->fieldCount++;
|
||||
$options = array(
|
||||
'JGLOBAL_USE_GLOBAL' => '',
|
||||
'JGLOBAL_INDEX_FOLLOW' => 'index, follow',
|
||||
'JGLOBAL_NOINDEX_FOLLOW' => 'noindex, follow',
|
||||
'JGLOBAL_INDEX_NOFOLLOW' => 'index, nofollow',
|
||||
'JGLOBAL_NOINDEX_NOFOLLOW' => 'noindex, nofollow',
|
||||
'JGLOBAL_USE_GLOBAL' => '',
|
||||
'JGLOBAL_INDEX_FOLLOW' => 'index, follow',
|
||||
'JGLOBAL_NOINDEX_FOLLOW' => 'noindex, follow',
|
||||
'JGLOBAL_INDEX_NOFOLLOW' => 'index, nofollow',
|
||||
'JGLOBAL_NOINDEX_NOFOLLOW' => 'noindex, nofollow',
|
||||
);
|
||||
foreach ($options as $text => $value)
|
||||
{
|
||||
@ -726,11 +727,11 @@ class Fields extends Structure
|
||||
$this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Author Field. Type: Text (joomla)");
|
||||
$author = $fieldsFieldSetXML->addChild('field');
|
||||
$attributes = array(
|
||||
'name' => 'author',
|
||||
'type' => 'text',
|
||||
'label' => 'JAUTHOR',
|
||||
'description' => 'JFIELD_METADATA_AUTHOR_DESC',
|
||||
'size' => 20
|
||||
'name' => 'author',
|
||||
'type' => 'text',
|
||||
'label' => 'JAUTHOR',
|
||||
'description' => 'JFIELD_METADATA_AUTHOR_DESC',
|
||||
'size' => 20
|
||||
);
|
||||
$this->xmlAddAttributes($author, $attributes);
|
||||
// count the static field created
|
||||
@ -739,14 +740,14 @@ class Fields extends Structure
|
||||
$this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Rights Field. Type: Textarea (joomla)");
|
||||
$rights = $fieldsFieldSetXML->addChild('field');
|
||||
$attributes = array(
|
||||
'name' => 'rights',
|
||||
'type' => 'textarea',
|
||||
'label' => 'JFIELD_META_RIGHTS_LABEL',
|
||||
'description' => 'JFIELD_META_RIGHTS_DESC',
|
||||
'required' => 'false',
|
||||
'filter' => 'string',
|
||||
'cols' => 30,
|
||||
'rows' => 2
|
||||
'name' => 'rights',
|
||||
'type' => 'textarea',
|
||||
'label' => 'JFIELD_META_RIGHTS_LABEL',
|
||||
'description' => 'JFIELD_META_RIGHTS_DESC',
|
||||
'required' => 'false',
|
||||
'filter' => 'string',
|
||||
'cols' => 30,
|
||||
'rows' => 2
|
||||
);
|
||||
$this->xmlAddAttributes($rights, $attributes);
|
||||
// count the static field created
|
||||
@ -807,8 +808,8 @@ class Fields extends Structure
|
||||
if (ComponentbuilderHelper::checkArray($fieldAttributes))
|
||||
{
|
||||
// set the array of field names
|
||||
$this->setFieldsNames($viewName,$fieldAttributes['name']);
|
||||
|
||||
$this->setFieldsNames($viewName, $fieldAttributes['name']);
|
||||
|
||||
if ($this->defaultField($typeName, 'option'))
|
||||
{
|
||||
//reset options array
|
||||
@ -1136,9 +1137,9 @@ class Fields extends Structure
|
||||
{
|
||||
$form = $field->fieldXML->addChild('form');
|
||||
$attributes = array(
|
||||
'hidden' => 'true',
|
||||
'name' => 'list_' . $fieldAttributes['name'] . '_modal',
|
||||
'repeat' => 'true'
|
||||
'hidden' => 'true',
|
||||
'name' => 'list_' . $fieldAttributes['name'] . '_modal',
|
||||
'repeat' => 'true'
|
||||
);
|
||||
$this->xmlAddAttributes($form, $attributes);
|
||||
|
||||
@ -1248,7 +1249,7 @@ class Fields extends Structure
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public function setLayoutBuilder(&$viewName,&$tabName,&$name,&$field)
|
||||
public function setLayoutBuilder(&$viewName, &$tabName, &$name, &$field)
|
||||
{
|
||||
// first fix the zero order
|
||||
// to insure it lands before all the other fields
|
||||
@ -1338,14 +1339,14 @@ class Fields extends Structure
|
||||
*/
|
||||
public function buildSiteFieldData($view, $field, $set, $type)
|
||||
{
|
||||
$decode = array('json','base64','basic_encryption','advance_encryption');
|
||||
$textareas = array('textarea','editor');
|
||||
$decode = array('json', 'base64', 'basic_encryption', 'advance_encryption');
|
||||
$textareas = array('textarea', 'editor');
|
||||
if (isset($this->siteFields[$view][$field]) && ComponentbuilderHelper::checkArray($this->siteFields[$view][$field]))
|
||||
{
|
||||
foreach ($this->siteFields[$view][$field] as $code => $array)
|
||||
{
|
||||
// set the decoding methods
|
||||
if (in_array($set,$decode))
|
||||
if (in_array($set, $decode))
|
||||
{
|
||||
$this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']] = array('decode' => $set, 'type' => $type);
|
||||
}
|
||||
@ -1466,9 +1467,9 @@ class Fields extends Structure
|
||||
if (ComponentbuilderHelper::checkString($otherName) && ComponentbuilderHelper::checkString($otherViews) && ComponentbuilderHelper::checkString($otherView))
|
||||
{
|
||||
$this->catOtherName[$listViewName] = array(
|
||||
'name' => ComponentbuilderHelper::safeString($otherName),
|
||||
'views' => ComponentbuilderHelper::safeString($otherViews),
|
||||
'view' => ComponentbuilderHelper::safeString($otherView)
|
||||
'name' => ComponentbuilderHelper::safeString($otherName),
|
||||
'views' => ComponentbuilderHelper::safeString($otherViews),
|
||||
'view' => ComponentbuilderHelper::safeString($otherView)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1793,7 +1794,7 @@ class Fields extends Structure
|
||||
return;
|
||||
}
|
||||
// count how many times the field is used
|
||||
$this->uniqueNames[$view]['counter'][$name]++;
|
||||
$this->uniqueNames[$view]['counter'][$name] ++;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1825,7 +1826,6 @@ class Fields extends Structure
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set Builders
|
||||
*
|
||||
@ -1947,16 +1947,16 @@ class Fields extends Structure
|
||||
{
|
||||
// load to list builder
|
||||
$this->listBuilder[$listViewName][] = array(
|
||||
'type' => $typeName,
|
||||
'code' => $name,
|
||||
'lang' => $listLangName,
|
||||
'title' => (isset($field['title']) && $field['title']) ? true : false,
|
||||
'alias' => (isset($field['alias']) && $field['alias']) ? true : false,
|
||||
'link' => (isset($field['link']) && $field['link']) ? true : false,
|
||||
'sort' => (isset($field['sort']) && $field['sort']) ? true : false,
|
||||
'custom' => $custom,
|
||||
'multiple' => $multiple,
|
||||
'options' => $options);
|
||||
'type' => $typeName,
|
||||
'code' => $name,
|
||||
'lang' => $listLangName,
|
||||
'title' => (isset($field['title']) && $field['title']) ? true : false,
|
||||
'alias' => (isset($field['alias']) && $field['alias']) ? true : false,
|
||||
'link' => (isset($field['link']) && $field['link']) ? true : false,
|
||||
'sort' => (isset($field['sort']) && $field['sort']) ? true : false,
|
||||
'custom' => $custom,
|
||||
'multiple' => $multiple,
|
||||
'options' => $options);
|
||||
|
||||
$this->customBuilderList[$listViewName][] = $name;
|
||||
}
|
||||
@ -2156,26 +2156,26 @@ class Fields extends Structure
|
||||
public function setCustomFieldTypeFile($data, $viewName_list, $viewName_single)
|
||||
{
|
||||
// make sure it is not already been build
|
||||
if (!isset($this->fileContentDynamic['customfield_'.$data['type']]) || !ComponentbuilderHelper::checkArray($this->fileContentDynamic['customfield_'.$data['type']]))
|
||||
if (!isset($this->fileContentDynamic['customfield_' . $data['type']]) || !ComponentbuilderHelper::checkArray($this->fileContentDynamic['customfield_' . $data['type']]))
|
||||
{
|
||||
// first build the custom field type file
|
||||
$target = array('admin' => 'customfield');
|
||||
$this->buildDynamique($target,'field'.$data['custom']['extends'], $data['custom']['type']);
|
||||
$this->buildDynamique($target, 'field' . $data['custom']['extends'], $data['custom']['type']);
|
||||
// set tab and break replacements
|
||||
$tabBreak = array(
|
||||
'\t' => "\t",
|
||||
'\n' => PHP_EOL
|
||||
'\t' => "\t",
|
||||
'\n' => PHP_EOL
|
||||
);
|
||||
// make field dynamic
|
||||
$replace = array(
|
||||
'###TABLE###' => $data['custom']['table'],
|
||||
'###ID###' => $data['custom']['id'],
|
||||
'###TEXT###' => $data['custom']['text'],
|
||||
'###CODE_TEXT###' => $data['code'].'_'.$data['custom']['text'],
|
||||
'###CODE_TEXT###' => $data['code'] . '_' . $data['custom']['text'],
|
||||
'###CODE###' => $data['code'],
|
||||
'###component###' => $this->fileContentStatic['###component###'],
|
||||
'###Component###' => $this->fileContentStatic['###Component###'],
|
||||
'###view_type###' => $viewName_single.'_'.$data['type'],
|
||||
'###view_type###' => $viewName_single . '_' . $data['type'],
|
||||
'###type###' => $data['type'],
|
||||
'###view###' => $viewName_single,
|
||||
'###views###' => $viewName_list
|
||||
@ -2195,7 +2195,7 @@ class Fields extends Structure
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpCode .= PHP_EOL."\t\t".$this->setPlaceholders($code, $tabBreak);
|
||||
$phpCode .= PHP_EOL . "\t\t" . $this->setPlaceholders($code, $tabBreak);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2244,30 +2244,30 @@ class Fields extends Structure
|
||||
$phpxCode = 'return null;';
|
||||
}
|
||||
// temp holder for name
|
||||
$tempName = $data['custom']['label'].' Group';
|
||||
$tempName = $data['custom']['label'] . ' Group';
|
||||
// set lang
|
||||
$groupLangName = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($tempName,'U');
|
||||
$groupLangName = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($tempName, 'U');
|
||||
// add to lang array
|
||||
$this->langContent[$this->lang][$groupLangName] = ComponentbuilderHelper::safeString($tempName,'W');
|
||||
$this->langContent[$this->lang][$groupLangName] = ComponentbuilderHelper::safeString($tempName, 'W');
|
||||
// build the Group Control
|
||||
$this->setGroupControl[$data['type']] = $groupLangName;
|
||||
// ###JFORM_GETGROUPS_PHP### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_'.$data['type']]['###JFORM_GETGROUPS_PHP###'] = $phpCode;
|
||||
$this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETGROUPS_PHP###'] = $phpCode;
|
||||
|
||||
// ###JFORM_GETEXCLUDED_PHP### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_'.$data['type']]['###JFORM_GETEXCLUDED_PHP###'] = $phpxCode;
|
||||
$this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETEXCLUDED_PHP###'] = $phpxCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ###JFORM_GETOPTIONS_PHP### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_'.$data['type']]['###JFORM_GETOPTIONS_PHP###'] = $phpCode;
|
||||
$this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETOPTIONS_PHP###'] = $phpCode;
|
||||
}
|
||||
// ###Type### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_'.$data['type']]['###Type###'] = ComponentbuilderHelper::safeString($data['custom']['type'],'F');
|
||||
$this->fileContentDynamic['customfield_' . $data['type']]['###Type###'] = ComponentbuilderHelper::safeString($data['custom']['type'], 'F');
|
||||
// ###type### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_'.$data['type']]['###type###'] = $data['custom']['type'];
|
||||
$this->fileContentDynamic['customfield_' . $data['type']]['###type###'] = $data['custom']['type'];
|
||||
// ###type### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_'.$data['type']]['###ADD_BUTTON###'] = $this->setAddButttonToListField($data['custom']['view'],$data['custom']['views']);
|
||||
$this->fileContentDynamic['customfield_' . $data['type']]['###ADD_BUTTON###'] = $this->setAddButttonToListField($data['custom']['view'], $data['custom']['views']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2281,39 +2281,39 @@ class Fields extends Structure
|
||||
*
|
||||
*/
|
||||
public function defaultField($type, $option = 'default')
|
||||
{
|
||||
{
|
||||
// list of default fields
|
||||
// https://docs.joomla.org/Form_field
|
||||
$defaults = array(
|
||||
'default' => array(
|
||||
'accesslevel', 'cachehandler', 'calendar', 'captcha', 'category', 'checkbox',
|
||||
'checkboxes', 'color', 'combo', 'componentlayout', 'contentlanguage', 'editor',
|
||||
'chromestyle', 'contenttype', 'databaseconnection', 'editors', 'email', 'file',
|
||||
'filelist', 'folderlist', 'groupedlist', 'hidden', 'file', 'headertag', 'helpsite',
|
||||
'imagelist', 'integer', 'language', 'list', 'media', 'menu', 'note', 'number', 'password',
|
||||
'plugins', 'radio', 'repeatable', 'range', 'rules', 'subform', 'sessionhandler', 'spacer', 'sql', 'tag',
|
||||
'tel', 'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduleposition', 'moduletag',
|
||||
'templatestyle', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup'
|
||||
),
|
||||
'plain' => array(
|
||||
'accesslevel', 'checkbox', 'cachehandler', 'calendar', 'category', 'chromestyle', 'color',
|
||||
'contenttype', 'combo', 'componentlayout', 'databaseconnection', 'editor', 'editors',
|
||||
'email', 'file', 'filelist', 'folderlist', 'headertag', 'helpsite',
|
||||
'hidden', 'imagelist', 'integer', 'language', 'media', 'menu',
|
||||
'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduletag', 'number', 'password', 'range', 'rules',
|
||||
'sessionhandler', 'tag', 'tel', 'text', 'textarea',
|
||||
'timezone', 'url', 'user', 'usergroup'
|
||||
),
|
||||
'spacer' => array(
|
||||
'note', 'spacer'
|
||||
),
|
||||
'option' => array(
|
||||
'plugins', 'checkboxes', 'contentlanguage', 'list', 'radio', 'sql'
|
||||
),
|
||||
'special' => array(
|
||||
'contentlanguage', 'groupedlist', 'moduleposition', 'plugin',
|
||||
'repeatable', 'templatestyle', 'subform'
|
||||
)
|
||||
'default' => array(
|
||||
'accesslevel', 'cachehandler', 'calendar', 'captcha', 'category', 'checkbox',
|
||||
'checkboxes', 'color', 'combo', 'componentlayout', 'contentlanguage', 'editor',
|
||||
'chromestyle', 'contenttype', 'databaseconnection', 'editors', 'email', 'file',
|
||||
'filelist', 'folderlist', 'groupedlist', 'hidden', 'file', 'headertag', 'helpsite',
|
||||
'imagelist', 'integer', 'language', 'list', 'media', 'menu', 'note', 'number', 'password',
|
||||
'plugins', 'radio', 'repeatable', 'range', 'rules', 'subform', 'sessionhandler', 'spacer', 'sql', 'tag',
|
||||
'tel', 'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduleposition', 'moduletag',
|
||||
'templatestyle', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup'
|
||||
),
|
||||
'plain' => array(
|
||||
'accesslevel', 'checkbox', 'cachehandler', 'calendar', 'category', 'chromestyle', 'color',
|
||||
'contenttype', 'combo', 'componentlayout', 'databaseconnection', 'editor', 'editors',
|
||||
'email', 'file', 'filelist', 'folderlist', 'headertag', 'helpsite',
|
||||
'hidden', 'imagelist', 'integer', 'language', 'media', 'menu',
|
||||
'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduletag', 'number', 'password', 'range', 'rules',
|
||||
'sessionhandler', 'tag', 'tel', 'text', 'textarea',
|
||||
'timezone', 'url', 'user', 'usergroup'
|
||||
),
|
||||
'spacer' => array(
|
||||
'note', 'spacer'
|
||||
),
|
||||
'option' => array(
|
||||
'plugins', 'checkboxes', 'contentlanguage', 'list', 'radio', 'sql'
|
||||
),
|
||||
'special' => array(
|
||||
'contentlanguage', 'groupedlist', 'moduleposition', 'plugin',
|
||||
'repeatable', 'templatestyle', 'subform'
|
||||
)
|
||||
);
|
||||
|
||||
if (in_array($type, $defaults[$option]))
|
||||
@ -2415,9 +2415,9 @@ class Fields extends Structure
|
||||
if ($this->tidy)
|
||||
{
|
||||
$tidy = new Tidy();
|
||||
$tidy->parseString($xmlString,array('indent'=>true,'indent-spaces'=>8,'input-xml'=>true,'output-xml'=>true,'indent-attributes'=>true,'wrap-attributes'=>true,'wrap'=>false));
|
||||
$tidy->parseString($xmlString, array('indent' => true, 'indent-spaces' => 8, 'input-xml' => true, 'output-xml' => true, 'indent-attributes' => true, 'wrap-attributes' => true, 'wrap' => false));
|
||||
$tidy->cleanRepair();
|
||||
return $this->xmlIndent((string)$tidy,' ',8,true,false);
|
||||
return $this->xmlIndent((string) $tidy, ' ', 8, true, false);
|
||||
}
|
||||
// set tidy waring atleast once
|
||||
elseif (!$this->setTidyWarning)
|
||||
@ -2429,7 +2429,7 @@ class Fields extends Structure
|
||||
}
|
||||
return $xmlString;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIndent
|
||||
*
|
||||
@ -2442,18 +2442,18 @@ class Fields extends Structure
|
||||
* @return string XML output
|
||||
*
|
||||
*/
|
||||
public function xmlIndent($string,$char=' ',$depth=0,$skipfirst=false,$skiplast=false)
|
||||
public function xmlIndent($string, $char = ' ', $depth = 0, $skipfirst = false, $skiplast = false)
|
||||
{
|
||||
$output = array();
|
||||
$lines = explode("\n",$string);
|
||||
$lines = explode("\n", $string);
|
||||
$first = true;
|
||||
$last = count($lines)-1;
|
||||
foreach($lines as $i=>$line)
|
||||
$last = count($lines) - 1;
|
||||
foreach ($lines as $i => $line)
|
||||
{
|
||||
$output[] = (($first&&$skipfirst)||$i===$last&&$skiplast)?$line:str_repeat($char,$depth).$line;
|
||||
$output[] = (($first && $skipfirst) || $i === $last && $skiplast) ? $line : str_repeat($char, $depth) . $line;
|
||||
$first = false;
|
||||
}
|
||||
return implode("\n",$output);
|
||||
return implode("\n", $output);
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user