Added #39 a new feature the imports custom code during compilation. We also improved the compiler.
This commit is contained in:
@ -68,7 +68,7 @@ class Compiler extends Infusion
|
||||
{
|
||||
$this->gitPath = $this->params->get('git_folder_path', null);
|
||||
}
|
||||
// remove site folder
|
||||
// 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)
|
||||
{
|
||||
// first remove the files and folders
|
||||
@ -82,15 +82,39 @@ class Compiler extends Infusion
|
||||
$this->writeFile($xmlPath,$componentXML);
|
||||
}
|
||||
// now update the files
|
||||
if ($this->updateFiles())
|
||||
if (!$this->updateFiles())
|
||||
{
|
||||
// zip the component
|
||||
if ($this->zipComponent())
|
||||
{
|
||||
// done
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// we can remove all undeeded data
|
||||
$this->freeMemory();
|
||||
// check if this component is install on the current website
|
||||
if ($paths = $this->getLocalInstallPaths())
|
||||
{
|
||||
// start Automatic import of custom code
|
||||
$userId = JFactory::getUser()->id;
|
||||
$today = JFactory::getDate()->toSql();
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// get the custom code from installed files
|
||||
$this->customCodeFactory($paths, $db, $userId, $today);
|
||||
}
|
||||
// check if we have custom code to add
|
||||
$this->getCustomCode();
|
||||
// now insert into the new files
|
||||
if (ComponentbuilderHelper::checkArray($this->customCode))
|
||||
{
|
||||
$this->addCustomCode();
|
||||
}
|
||||
// move the update server into place
|
||||
$this->setUpdateServer();
|
||||
// zip the component
|
||||
if (!$this->zipComponent())
|
||||
{
|
||||
// done
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -111,7 +135,13 @@ class Compiler extends Infusion
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the dynamic data to the created fils
|
||||
*
|
||||
* @return bool true on success
|
||||
*
|
||||
*/
|
||||
protected function updateFiles()
|
||||
{
|
||||
if (isset($this->newFiles['static']) && ComponentbuilderHelper::checkArray($this->newFiles['static']) && isset($this->newFiles['dynamic']) && ComponentbuilderHelper::checkArray($this->newFiles['dynamic']))
|
||||
@ -158,6 +188,8 @@ class Compiler extends Infusion
|
||||
if (JFile::exists($file['path']))
|
||||
{
|
||||
$this->fileContentStatic['###FILENAME###'] = $file['name'];
|
||||
// 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'))
|
||||
{
|
||||
@ -184,7 +216,11 @@ class Compiler extends Infusion
|
||||
}
|
||||
}
|
||||
}
|
||||
// free up some memory
|
||||
unset($this->fileContentDynamic[$view]);
|
||||
}
|
||||
// free up some memory
|
||||
unset($this->newFiles['dynamic']);
|
||||
// do a final run to update the readme file
|
||||
$two = 0;
|
||||
foreach ($this->newFiles['static'] as $static)
|
||||
@ -199,31 +235,145 @@ class Compiler extends Infusion
|
||||
break;
|
||||
}
|
||||
}
|
||||
// move the update server to host
|
||||
if ($this->componentData->add_update_server && $this->componentData->update_server_target == 1 && isset($this->updateServerFileName) && $this->dynamicIntegration)
|
||||
{
|
||||
$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))
|
||||
{
|
||||
// Get the basic encription.
|
||||
$basickey = ComponentbuilderHelper::getCryptKey('basic');
|
||||
// Get the encription object.
|
||||
$basic = new FOFEncryptAes($basickey, 128);
|
||||
if (!empty($this->componentData->update_server_ftp) && $basickey && !is_numeric($this->componentData->update_server_ftp) && $this->componentData->update_server_ftp === base64_encode(base64_decode($this->componentData->update_server_ftp, true)))
|
||||
{
|
||||
// basic decript data update_server_ftp.
|
||||
$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);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function freeMemory()
|
||||
{
|
||||
// free up some memory
|
||||
unset($this->newFiles['static']);
|
||||
unset($this->customScriptBuilder);
|
||||
unset($this->permissionCore);
|
||||
unset($this->permissionDashboard);
|
||||
unset($this->componentData->admin_views);
|
||||
unset($this->componentData->site_views);
|
||||
unset($this->componentData->custom_admin_views);
|
||||
unset($this->componentData->config);
|
||||
unset($this->joomlaVersionData);
|
||||
unset($this->langContent);
|
||||
unset($this->dbKeys);
|
||||
unset($this->permissionBuilder);
|
||||
unset($this->layoutBuilder);
|
||||
unset($this->historyBuilder);
|
||||
unset($this->aliasBuilder);
|
||||
unset($this->titleBuilder);
|
||||
unset($this->customBuilderList);
|
||||
unset($this->hiddenFieldsBuilder);
|
||||
unset($this->intFieldsBuilder);
|
||||
unset($this->dynamicfieldsBuilder);
|
||||
unset($this->maintextBuilder);
|
||||
unset($this->customFieldLinksBuilder);
|
||||
unset($this->setScriptUserSwitch);
|
||||
unset($this->categoryBuilder);
|
||||
unset($this->catCodeBuilder);
|
||||
unset($this->checkboxBuilder);
|
||||
unset($this->jsonItemBuilder);
|
||||
unset($this->base64Builder);
|
||||
unset($this->basicEncryptionBuilder);
|
||||
unset($this->advancedEncryptionBuilder);
|
||||
unset($this->getItemsMethodListStringFixBuilder);
|
||||
unset($this->getItemsMethodEximportStringFixBuilder);
|
||||
unset($this->selectionTranslationFixBuilder);
|
||||
unset($this->listBuilder);
|
||||
unset($this->customBuilder);
|
||||
unset($this->editBodyViewScriptBuilder);
|
||||
unset($this->queryBuilder);
|
||||
unset($this->sortBuilder);
|
||||
unset($this->searchBuilder);
|
||||
unset($this->filterBuilder);
|
||||
unset($this->fieldsNames);
|
||||
unset($this->siteFields);
|
||||
unset($this->siteFieldData);
|
||||
unset($this->customFieldScript);
|
||||
unset($this->configFieldSets);
|
||||
unset($this->jsonStringBuilder);
|
||||
unset($this->importCustomScripts);
|
||||
unset($this->eximportView);
|
||||
unset($this->uninstallBuilder);
|
||||
unset($this->listColnrBuilder);
|
||||
unset($this->customFieldBuilder);
|
||||
unset($this->permissionFields);
|
||||
unset($this->getAsLookup);
|
||||
unset($this->secondRunAdmin);
|
||||
unset($this->uninstallScriptBuilder);
|
||||
unset($this->buildCategories);
|
||||
unset($this->iconBuilder);
|
||||
unset($this->validationFixBuilder);
|
||||
unset($this->targetRelationControl);
|
||||
unset($this->targetControlsScriptChecker);
|
||||
unset($this->accessBuilder);
|
||||
unset($this->tabCounter);
|
||||
unset($this->linkedAdminViews);
|
||||
unset($this->uniquekeys);
|
||||
unset($this->uniquecodes);
|
||||
$this->unsetNow('_adminViewData');
|
||||
$this->unsetNow('_fieldData');
|
||||
}
|
||||
|
||||
/**
|
||||
* move the local update server xml file to a remote ftp server
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function setUpdateServer()
|
||||
{
|
||||
// move the update server to host
|
||||
if ($this->componentData->add_update_server && $this->componentData->update_server_target == 1 && isset($this->updateServerFileName) && $this->dynamicIntegration)
|
||||
{
|
||||
$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))
|
||||
{
|
||||
// Get the basic encription.
|
||||
$basickey = ComponentbuilderHelper::getCryptKey('basic');
|
||||
// Get the encription object.
|
||||
$basic = new FOFEncryptAes($basickey, 128);
|
||||
if (!empty($this->componentData->update_server_ftp) && $basickey && !is_numeric($this->componentData->update_server_ftp) && $this->componentData->update_server_ftp === base64_encode(base64_decode($this->componentData->update_server_ftp, true)))
|
||||
{
|
||||
// basic decript data update_server_ftp.
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// link canges made to views into the file license
|
||||
protected function fixLicenseValues($data)
|
||||
{
|
||||
// check if these files have its own config data
|
||||
if (isset($data['config']) && ComponentbuilderHelper::checkArray($data['config']))
|
||||
{
|
||||
foreach ($data['config'] as $key => $value)
|
||||
{
|
||||
if ('###VERSION###' == $key)
|
||||
{
|
||||
// hmm we sould in some way make it known that this version number
|
||||
// is not in relation the the project but to the file only... any ideas?
|
||||
// this is the best for now...
|
||||
if (1 == $value)
|
||||
{
|
||||
$value = '@first version of this MVC';
|
||||
}
|
||||
else
|
||||
{
|
||||
$value = '@update number '.$value.' of this MVC';
|
||||
}
|
||||
}
|
||||
$this->fileContentStatic[$key] = $value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// else insure to reset to global
|
||||
$this->fileContentStatic['###CREATIONDATE###'] = $this->fileContentStatic['###CREATIONDATE###GLOBAL'];
|
||||
$this->fileContentStatic['###BUILDDATE###'] = $this->fileContentStatic['###BUILDDATE###GLOBAL'];
|
||||
$this->fileContentStatic['###VERSION###'] = $this->fileContentStatic['###VERSION###GLOBAL'];
|
||||
}
|
||||
|
||||
private function buildReadMe($path)
|
||||
{
|
||||
// set readme data if not set already
|
||||
@ -237,8 +387,7 @@ class Compiler extends Infusion
|
||||
$answer = str_replace(array_keys($this->fileContentStatic),array_values($this->fileContentStatic),$string);
|
||||
// add to zip array
|
||||
$this->writeFile($path,$answer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function buildReadMeData()
|
||||
{
|
||||
@ -439,4 +588,148 @@ class Compiler extends Infusion
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function addCustomCode()
|
||||
{
|
||||
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]))
|
||||
{
|
||||
$file = $this->componentPath . '/'. $target['path'];
|
||||
$size = (int) $target['hashtarget'][0];
|
||||
$hash = $target['hashtarget'][1];
|
||||
$cut = $size - 1;
|
||||
$found = false;
|
||||
$bites = 0;
|
||||
$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;
|
||||
}
|
||||
else
|
||||
{
|
||||
// replace to the end of the file
|
||||
$foundEnd = true;
|
||||
}
|
||||
$counter = 0;
|
||||
// check if file is new structure
|
||||
if (JFile::exists($file))
|
||||
{
|
||||
foreach (new SplFileObject($file) as $lineNumber => $lineContent)
|
||||
{
|
||||
if (!$found)
|
||||
{
|
||||
$bites = (int) bcadd(mb_strlen($lineContent, '8bit'), $bites);
|
||||
}
|
||||
if ($found && !$foundEnd)
|
||||
{
|
||||
$replace[] = (int) mb_strlen($lineContent, '8bit');
|
||||
// we musk keep last three lines to dynamic find target entry
|
||||
$fingerPrint[$lineNumber] = trim($lineContent);
|
||||
// check lines each time if it fits our target
|
||||
if (count($fingerPrint) === $sizeEnd && !$foundEnd)
|
||||
{
|
||||
$fingerTest = md5(implode('',$fingerPrint));
|
||||
if ($fingerTest === $hashEnd)
|
||||
{
|
||||
// we are done here
|
||||
$foundEnd = true;
|
||||
$replace = array_slice($replace, 0, count($replace)-$sizeEnd);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
$fingerPrint = array_slice($fingerPrint, -$cutEnd, $cutEnd, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($found && $foundEnd)
|
||||
{
|
||||
$replace[] = (int) mb_strlen($lineContent, '8bit');
|
||||
}
|
||||
// we musk keep last three lines to dynamic find target entry
|
||||
$fingerPrint[$lineNumber] = trim($lineContent);
|
||||
// check lines each time if it fits our target
|
||||
if (count($fingerPrint) === $size && !$found)
|
||||
{
|
||||
$fingerTest = md5(implode('',$fingerPrint));
|
||||
if ($fingerTest === $hash)
|
||||
{
|
||||
// we are done here
|
||||
$found = true;
|
||||
// reset in case
|
||||
$fingerPrint = array();
|
||||
// break if it is insertion
|
||||
if ($target['type'] == 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$fingerPrint = array_slice($fingerPrint, -$cut, $cut, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($found)
|
||||
{
|
||||
$placeholder = $this->getPlaceHolder($target['type'], $target['id']);
|
||||
$data = $placeholder['start'] . "\n" . $target['code'] . $placeholder['end'] . "\n";
|
||||
if ($target['type'] == 2)
|
||||
{
|
||||
// found it now add code from the next line
|
||||
$this->addDataToFile($file, $data, $bites);
|
||||
}
|
||||
elseif ($target['type'] == 1 && $foundEnd)
|
||||
{
|
||||
// found it now add code from the next line
|
||||
$this->addDataToFile($file, $data, $bites, (int) array_sum($replace));
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO give developer a notice that the code could not be added and needs his attention.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO give developer a notice that the code could not be added and needs his attention.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO give developer a notice that the code could not be added and needs his attention.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Thanks to http://stackoverflow.com/a/16813550/1429677
|
||||
protected function addDataToFile($file, $data, $position, $replace = null)
|
||||
{
|
||||
$fpFile = fopen($file, "rw+");
|
||||
$fpTemp = fopen('php://temp', "rw+");
|
||||
|
||||
$len = stream_copy_to_stream($fpFile, $fpTemp); // make a copy
|
||||
|
||||
fseek($fpFile, $position); // move to the position
|
||||
if ($replace)
|
||||
{
|
||||
$position = bcadd($position, $replace);
|
||||
}
|
||||
fseek($fpTemp, $position); // move to the position
|
||||
|
||||
fwrite($fpFile, $data); // Add the data
|
||||
|
||||
stream_copy_to_stream($fpTemp, $fpFile); // @Jack
|
||||
|
||||
fclose($fpFile); // close file
|
||||
fclose($fpTemp); // close tmp
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,49 @@ class Get
|
||||
*/
|
||||
public $componentData;
|
||||
|
||||
/* The custom script placeholders - we use the (xxx) to avoid detection it should be (***)
|
||||
*
|
||||
* New Insert Code = /xxx[INSERT<>$$$$]xxx/ /xxx[/INSERT<>$$$$]xxx/
|
||||
* New Replace Code = /xxx[REPLACE<>$$$$]xxx/ /xxx[/REPLACE<>$$$$]xxx/
|
||||
*
|
||||
* //////////////////////////// when JCB adds it back ///////////////////////////////
|
||||
* JCB Add Inserted Code = /xxx[INSERTED$$$$]xxx/ //23 /xxx[/INSERTED$$$$]xxx/
|
||||
* JCB Add Replaced Code = /xxx[REPLACED$$$$]xxx/ //25 /xxx[/REPLACED$$$$]xxx/
|
||||
*
|
||||
* ///////////////////////// changeing existing custom code /////////////////////////
|
||||
* Update Inserted Code = /xxx[INSERTED<>$$$$]xxx///23 /xxx[/INSERTED<>$$$$]xxx/
|
||||
* Update Replaced Code = /xxx[REPLACED<>$$$$]xxx///25 /xxx[/REPLACED<>$$$$]xxx/
|
||||
*
|
||||
* //23 is the ID of the code in the system don't change it!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*
|
||||
* @var array
|
||||
******************************************************************************************/
|
||||
protected $customCodePlaceholders = array(1 => 'REPLACE<>$$$$]',
|
||||
2 => 'INSERT<>$$$$]',
|
||||
3 => 'REPLACED<>$$$$]',
|
||||
4 => 'INSERTED<>$$$$]');
|
||||
|
||||
/**
|
||||
* The custom code to be added
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $customCode;
|
||||
|
||||
/**
|
||||
* The custom code in local files that aready exist in system
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $existingCustomCode = array();
|
||||
|
||||
/**
|
||||
* The custom code in local files this are new
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $newCustomCode = array();
|
||||
|
||||
/**
|
||||
* The Language prefix
|
||||
*
|
||||
@ -586,7 +629,7 @@ class Get
|
||||
{
|
||||
$component->config[$nr]['alias'] = 0;
|
||||
$component->config[$nr]['title'] = 0;
|
||||
if ($option == 'field')
|
||||
if ($option === 'field')
|
||||
{
|
||||
// load the field data
|
||||
$component->config[$nr]['settings'] = $this->getFieldData($value);
|
||||
@ -890,7 +933,7 @@ class Get
|
||||
$this->customScriptBuilder['token'][$name_single] = false;
|
||||
$this->customScriptBuilder['token'][$name_list] = false;
|
||||
// load the values form params
|
||||
$permissions = json_decode($view->addpermissions,true);
|
||||
$permissions = json_decode($view->addpermissions,true);
|
||||
unset($view->addpermissions);
|
||||
$tabs = json_decode($view->addtabs,true);
|
||||
unset($view->addtabs);
|
||||
@ -898,9 +941,9 @@ class Get
|
||||
unset($view->addfields);
|
||||
$conditions = json_decode($view->addconditions,true);
|
||||
unset($view->addconditions);
|
||||
$linked_views = json_decode($view->addlinked_views,true);
|
||||
$linked_views = json_decode($view->addlinked_views,true);
|
||||
unset($view->addlinked_views);
|
||||
$tables = json_decode($view->addtables,true);
|
||||
$tables = json_decode($view->addtables,true);
|
||||
unset($view->addtables);
|
||||
// sort the values
|
||||
if (ComponentbuilderHelper::checkArray($tables))
|
||||
@ -972,7 +1015,7 @@ class Get
|
||||
{
|
||||
foreach ($conditionValues as $nr => $conditionValue)
|
||||
{
|
||||
if ($condition == 'target_field')
|
||||
if ($condition === 'target_field')
|
||||
{
|
||||
if (ComponentbuilderHelper::checkArray($conditionValue) && ComponentbuilderHelper::checkArray($view->fields))
|
||||
{
|
||||
@ -1006,7 +1049,7 @@ class Get
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($condition == 'match_field')
|
||||
if ($condition === 'match_field')
|
||||
{
|
||||
foreach ($view->fields as $fieldValue)
|
||||
{
|
||||
@ -1240,7 +1283,7 @@ class Get
|
||||
|
||||
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
|
||||
$view = $db->loadObject();
|
||||
if ($table == 'site_view')
|
||||
if ($table === 'site_view')
|
||||
{
|
||||
$this->lang = 'site';
|
||||
}
|
||||
@ -1409,7 +1452,7 @@ class Get
|
||||
*/
|
||||
public function getFieldData($id,$name_single = null,$name_list = null)
|
||||
{
|
||||
if (!isset($this->_fieldData[$id]))
|
||||
if (!isset($this->_fieldData[$id]) && $id > 0)
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
@ -1462,90 +1505,7 @@ class Get
|
||||
{
|
||||
$this->basicEncryption = true;
|
||||
}
|
||||
|
||||
// check if we should load scripts for single view
|
||||
if (ComponentbuilderHelper::checkString($name_single) && !isset($this->customFieldScript[$name_single][$id]))
|
||||
{
|
||||
// add_javascript_view_footer
|
||||
if ($field->add_javascript_view_footer == 1)
|
||||
{
|
||||
if (!isset($this->customScriptBuilder['view_footer'][$name_single]))
|
||||
{
|
||||
if(!isset($this->customScriptBuilder['view_footer']))
|
||||
{
|
||||
$this->customScriptBuilder['view_footer'] = array();
|
||||
}
|
||||
$this->customScriptBuilder['view_footer'][$name_single] = '';
|
||||
}
|
||||
$this->customScriptBuilder['view_footer'][$name_single] .= "\n".$this->setCustomContentLang(base64_decode($field->javascript_view_footer));
|
||||
if (strpos($field->javascript_view_footer,"token") !== false && strpos($field->javascript_view_footer,"task=ajax") !== false)
|
||||
{
|
||||
if (!isset($this->customScriptBuilder['token'][$name_single]) || !$this->customScriptBuilder['token'][$name_single])
|
||||
{
|
||||
if(!isset($this->customScriptBuilder['token']))
|
||||
{
|
||||
$this->customScriptBuilder['token'] = array();
|
||||
}
|
||||
$this->customScriptBuilder['token'][$name_single] = true;
|
||||
}
|
||||
}
|
||||
unset($field->javascript_view_footer);
|
||||
}
|
||||
|
||||
// add_css_view
|
||||
if ($field->add_css_view == 1)
|
||||
{
|
||||
if (!isset($this->customScriptBuilder['css_view'][$name_single]))
|
||||
{
|
||||
$this->customScriptBuilder['css_view'][$name_single] = '';
|
||||
}
|
||||
$this->customScriptBuilder['css_view'][$name_single] .= "\n".base64_decode($field->css_view);
|
||||
unset($field->css_view);
|
||||
}
|
||||
|
||||
// add this only once to view.
|
||||
$this->customFieldScript[$name_single][$id] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// unset if not needed
|
||||
unset($field->javascript_view_footer);
|
||||
unset($field->css_view);
|
||||
}
|
||||
// check if we should load scripts for list views
|
||||
if (ComponentbuilderHelper::checkString($name_list))
|
||||
{
|
||||
// add_javascript_views_footer
|
||||
if ($field->add_javascript_views_footer == 1)
|
||||
{
|
||||
$this->customScriptBuilder['views_footer'][$name_list] .= $this->setCustomContentLang(base64_decode($field->javascript_views_footer));
|
||||
if (strpos($field->javascript_views_footer,"token") !== false && strpos($field->javascript_views_footer,"task=ajax") !== false)
|
||||
{
|
||||
if (!$this->customScriptBuilder['token'][$name_list])
|
||||
{
|
||||
$this->customScriptBuilder['token'][$name_list] = true;
|
||||
}
|
||||
}
|
||||
unset($field->javascript_views_footer);
|
||||
}
|
||||
// add_css_views
|
||||
if ($field->add_css_views == 1)
|
||||
{
|
||||
if (!isset($this->customScriptBuilder['css_views'][$name_list]))
|
||||
{
|
||||
$this->customScriptBuilder['css_views'][$name_list] = '';
|
||||
}
|
||||
$this->customScriptBuilder['css_views'][$name_list] .= base64_decode($field->css_views);
|
||||
unset($field->css_views);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// unset if not needed
|
||||
unset($field->javascript_views_footer);
|
||||
unset($field->css_views);
|
||||
|
||||
}
|
||||
|
||||
$this->_fieldData[$id] = $field;
|
||||
}
|
||||
else
|
||||
@ -1553,8 +1513,121 @@ class Get
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// return the found field data
|
||||
return $this->_fieldData[$id];
|
||||
// check if the script should be added to the view each time this field is called
|
||||
if (isset($this->_fieldData[$id]) && $id > 0)
|
||||
{
|
||||
// check if we should load scripts for single view
|
||||
if (ComponentbuilderHelper::checkString($name_single) && !isset($this->customFieldScript[$name_single][$id]))
|
||||
{
|
||||
// add_javascript_view_footer
|
||||
if ($this->_fieldData[$id]->add_javascript_view_footer == 1)
|
||||
{
|
||||
if(!isset($this->customScriptBuilder['view_footer']))
|
||||
{
|
||||
$this->customScriptBuilder['view_footer'] = array();
|
||||
}
|
||||
if (!isset($this->customScriptBuilder['view_footer'][$name_single]))
|
||||
{
|
||||
$this->customScriptBuilder['view_footer'][$name_single] = '';
|
||||
}
|
||||
if (!isset($this->_fieldData[$id]->javascript_view_footer_decoded))
|
||||
{
|
||||
$this->_fieldData[$id]->javascript_view_footer = $this->setCustomContentLang(base64_decode($this->_fieldData[$id]->javascript_view_footer));
|
||||
$this->_fieldData[$id]->javascript_view_footer_decoded = true;
|
||||
}
|
||||
$this->customScriptBuilder['view_footer'][$name_single] .= "\n".$this->_fieldData[$id]->javascript_view_footer;
|
||||
if (strpos($this->_fieldData[$id]->javascript_view_footer,"token") !== false && strpos($this->_fieldData[$id]->javascript_view_footer,"task=ajax") !== false)
|
||||
{
|
||||
if (!isset($this->customScriptBuilder['token'][$name_single]) || !$this->customScriptBuilder['token'][$name_single])
|
||||
{
|
||||
if(!isset($this->customScriptBuilder['token']))
|
||||
{
|
||||
$this->customScriptBuilder['token'] = array();
|
||||
}
|
||||
$this->customScriptBuilder['token'][$name_single] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add_css_view
|
||||
if ($this->_fieldData[$id]->add_css_view == 1)
|
||||
{
|
||||
if (!isset($this->customScriptBuilder['css_view']))
|
||||
{
|
||||
$this->customScriptBuilder['css_view'] = array();
|
||||
}
|
||||
if (!isset($this->customScriptBuilder['css_view'][$name_single]))
|
||||
{
|
||||
$this->customScriptBuilder['css_view'][$name_single] = '';
|
||||
}
|
||||
if (!isset($this->_fieldData[$id]->css_view_decoded))
|
||||
{
|
||||
$this->_fieldData[$id]->css_view = base64_decode($this->_fieldData[$id]->css_view);
|
||||
$this->_fieldData[$id]->css_view_decoded = true;
|
||||
}
|
||||
$this->customScriptBuilder['css_view'][$name_single] .= "\n".$this->_fieldData[$id]->css_view;
|
||||
}
|
||||
|
||||
// add this only once to view.
|
||||
$this->customFieldScript[$name_single][$id] = true;
|
||||
}
|
||||
// check if we should load scripts for list views
|
||||
if (ComponentbuilderHelper::checkString($name_list) && !isset($this->customFieldScript[$name_list][$id]))
|
||||
{
|
||||
// add_javascript_views_footer
|
||||
if ($this->_fieldData[$id]->add_javascript_views_footer == 1)
|
||||
{
|
||||
if(!isset($this->customScriptBuilder['views_footer']))
|
||||
{
|
||||
$this->customScriptBuilder['views_footer'] = array();
|
||||
}
|
||||
if (!isset($this->customScriptBuilder['views_footer'][$name_list]))
|
||||
{
|
||||
$this->customScriptBuilder['views_footer'][$name_list] = '';
|
||||
}
|
||||
if (!isset($this->_fieldData[$id]->javascript_views_footer_decoded))
|
||||
{
|
||||
$this->_fieldData[$id]->javascript_views_footer = $this->setCustomContentLang(base64_decode($this->_fieldData[$id]->javascript_views_footer));
|
||||
$this->_fieldData[$id]->javascript_views_footer_decoded = true;
|
||||
}
|
||||
$this->customScriptBuilder['views_footer'][$name_list] .= $this->_fieldData[$id]->javascript_views_footer;
|
||||
if (strpos($this->_fieldData[$id]->javascript_views_footer,"token") !== false && strpos($this->_fieldData[$id]->javascript_views_footer,"task=ajax") !== false)
|
||||
{
|
||||
if (!$this->customScriptBuilder['token'][$name_list])
|
||||
{
|
||||
$this->customScriptBuilder['token'][$name_list] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// add_css_views
|
||||
if ($this->_fieldData[$id]->add_css_views == 1)
|
||||
{
|
||||
if (!isset($this->customScriptBuilder['css_views']))
|
||||
{
|
||||
$this->customScriptBuilder['css_views'] = array();
|
||||
}
|
||||
if (!isset($this->customScriptBuilder['css_views'][$name_list]))
|
||||
{
|
||||
$this->customScriptBuilder['css_views'][$name_list] = '';
|
||||
}
|
||||
if (!isset($this->_fieldData[$id]->css_views_decoded))
|
||||
{
|
||||
$this->_fieldData[$id]->css_views = base64_decode($this->_fieldData[$id]->css_views);
|
||||
$this->_fieldData[$id]->css_views_decoded = true;
|
||||
}
|
||||
$this->customScriptBuilder['css_views'][$name_list] .= $this->_fieldData[$id]->css_views;
|
||||
}
|
||||
|
||||
// add this only once to view.
|
||||
$this->customFieldScript[$name_list][$id] = true;
|
||||
}
|
||||
}
|
||||
if (isset($this->_fieldData[$id]) && $id > 0)
|
||||
{
|
||||
// return the found field data
|
||||
return $this->_fieldData[$id];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1685,7 +1758,7 @@ class Get
|
||||
{
|
||||
if (ComponentbuilderHelper::checkString($value))
|
||||
{
|
||||
if ($option == 'selection')
|
||||
if ($option === 'selection')
|
||||
{
|
||||
$on_field_as = '';
|
||||
$on_field = '';
|
||||
@ -1699,7 +1772,7 @@ class Get
|
||||
if ($result->join_view_table[$nr]['row_type'] == 1)
|
||||
{
|
||||
$result->main_get[] = $result->join_view_table[$nr];
|
||||
if ($on_field_as == 'a')
|
||||
if ($on_field_as === 'a')
|
||||
{
|
||||
$this->siteMainGet[$this->target][$view_code][$result->join_view_table[$nr]['as']] = $result->join_view_table[$nr]['as'];
|
||||
}
|
||||
@ -1720,11 +1793,11 @@ class Get
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($option == 'type')
|
||||
if ($option === 'type')
|
||||
{
|
||||
$value = $typeArray[$value];
|
||||
}
|
||||
if ($option == 'operator')
|
||||
if ($option === 'operator')
|
||||
{
|
||||
$value = $operatorArray[$value];
|
||||
}
|
||||
@ -1747,7 +1820,7 @@ class Get
|
||||
{
|
||||
if (ComponentbuilderHelper::checkString($value))
|
||||
{
|
||||
if ($option == 'selection')
|
||||
if ($option === 'selection')
|
||||
{
|
||||
$on_field_as = '';
|
||||
$on_field = '';
|
||||
@ -1761,7 +1834,7 @@ class Get
|
||||
if ($result->join_db_table[$nr]['row_type'] == 1)
|
||||
{
|
||||
$result->main_get[] = $result->join_db_table[$nr];
|
||||
if ($on_field_as == 'a')
|
||||
if ($on_field_as === 'a')
|
||||
{
|
||||
$this->siteMainGet[$this->target][$view_code][$result->join_db_table[$nr]['as']] = $result->join_db_table[$nr]['as'];
|
||||
}
|
||||
@ -1782,11 +1855,11 @@ class Get
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($option == 'type')
|
||||
if ($option === 'type')
|
||||
{
|
||||
$value = $typeArray[$value];
|
||||
}
|
||||
if ($option == 'operator')
|
||||
if ($option === 'operator')
|
||||
{
|
||||
$value = $operatorArray[$value];
|
||||
}
|
||||
@ -1809,7 +1882,7 @@ class Get
|
||||
{
|
||||
if (ComponentbuilderHelper::checkString($value))
|
||||
{
|
||||
if ($option == 'operator')
|
||||
if ($option === 'operator')
|
||||
{
|
||||
$value = $operatorArray[$value];
|
||||
$result->filter[$nr]['key'] = $result->key;
|
||||
@ -1865,7 +1938,7 @@ class Get
|
||||
{
|
||||
if (ComponentbuilderHelper::checkString($value))
|
||||
{
|
||||
if ($option == 'operator')
|
||||
if ($option === 'operator')
|
||||
{
|
||||
$value = $operatorArray[$value];
|
||||
}
|
||||
@ -2237,7 +2310,7 @@ class Get
|
||||
$query = $db->getQuery(true);
|
||||
foreach ($tables as $table)
|
||||
{
|
||||
if ($counter == 'a')
|
||||
if ($counter === 'a')
|
||||
{
|
||||
// the main table fields
|
||||
if (strpos($table['sourcemap'],PHP_EOL) !== false)
|
||||
@ -2507,4 +2580,413 @@ class Get
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* to unset stuff that are private or protected
|
||||
*
|
||||
*/
|
||||
public function unsetNow($remove)
|
||||
{
|
||||
unset($this->$remove);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the custom code from the system
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public function getCustomCode()
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.id','a.code','a.component','a.from_line','a.hashtarget','a.hashendtarget','a.path','a.to_line','a.type')));
|
||||
$query->from($db->quoteName('#__componentbuilder_custom_code','a'));
|
||||
$query->where($db->quoteName('a.component') . ' = '. (int) $this->componentData->id);
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->order($db->quoteName('a.from_line') . ' ASC'); // <--- insrue we always add code from top of file
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
$this->customCode = $db->loadAssocList();
|
||||
// open the code
|
||||
foreach($this->customCode as $nr => &$customCode)
|
||||
{
|
||||
$customCode['code'] = base64_decode($customCode['code']);
|
||||
$customCode['hashtarget'] = explode("__", $customCode['hashtarget']);
|
||||
if ($customCode['type'] == 1 && strpos($customCode['hashendtarget'], '__') !== false)
|
||||
{
|
||||
$customCode['hashendtarget'] = explode("__", $customCode['hashendtarget']);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* store the code
|
||||
*
|
||||
* @param object $db The database object
|
||||
* @param int $when To set when to update
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function setNewCustomCode($db, $when = 1)
|
||||
{
|
||||
if (count($this->newCustomCode) >= $when)
|
||||
{
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
// Insert columns.
|
||||
$columns = array('path','type','component','published','created','created_by','version','access','hashtarget','from_line','to_line','code','hashendtarget');
|
||||
// Prepare the insert query.
|
||||
$query->insert($db->quoteName('#__componentbuilder_custom_code'));
|
||||
$query->columns($db->quoteName($columns));
|
||||
foreach($this->newCustomCode as $values){
|
||||
$query->values(implode(',', $values));
|
||||
}
|
||||
// clear the values array
|
||||
$this->newCustomCode = array();
|
||||
// Set the query using our newly populated query object and execute it.
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* store the code
|
||||
*
|
||||
* @param object $db The database object
|
||||
* @param int $when To set when to update
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function setExistingCustomCode($db, $when = 1)
|
||||
{
|
||||
if (count($this->existingCustomCode) >= $when)
|
||||
{
|
||||
foreach($this->existingCustomCode as $code)
|
||||
{
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
// Prepare the update query.
|
||||
$query->update($db->quoteName('#__componentbuilder_custom_code'))->set($code['fields'])->where($code['conditions']);
|
||||
// Set the query using our newly populated query object and execute it.
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
// clear the values array
|
||||
$this->existingCustomCode = array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the custom code from the local files
|
||||
*
|
||||
* @param array $paths The local paths to parse
|
||||
* @param object $db The database object
|
||||
* @param int $userId The user id
|
||||
* @param string $today The date for today
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function customCodeFactory(&$paths, &$db, &$userId, &$today)
|
||||
{
|
||||
// we must first store the current woking directory
|
||||
$joomla = getcwd();
|
||||
$counter = array(1 => 0, 2 => 0);
|
||||
foreach ($paths as $target => $path)
|
||||
{
|
||||
// we are changing the working directory to the componet path
|
||||
chdir($path);
|
||||
// get a list of files in the current directory tree (only PHP for now)
|
||||
$files = JFolder::files('.', '\.php', true, true);
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$this->searchFileContent($counter, $file, $target, $this->customCodePlaceholders, $db, $userId, $today);
|
||||
// insert new code
|
||||
if (ComponentbuilderHelper::checkArray($this->newCustomCode))
|
||||
{
|
||||
$this->setNewCustomCode($db, 100);
|
||||
}
|
||||
// update existing custom code
|
||||
if (ComponentbuilderHelper::checkArray($this->existingCustomCode))
|
||||
{
|
||||
$this->setExistingCustomCode($db, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
// change back to Joomla working directory
|
||||
chdir($joomla);
|
||||
// make sure all code is stored
|
||||
if (ComponentbuilderHelper::checkArray($this->newCustomCode))
|
||||
{
|
||||
$this->setNewCustomCode($db);
|
||||
}
|
||||
// update existing custom code
|
||||
if (ComponentbuilderHelper::checkArray($this->existingCustomCode))
|
||||
{
|
||||
$this->setExistingCustomCode($db);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* search a file for placeholders and store result
|
||||
*
|
||||
* @param array $counter The counter for the arrays
|
||||
* @param string $file The file path to search
|
||||
* @param array $placeholders The values to search for
|
||||
* @param object $db The database object
|
||||
* @param int $userId The user id
|
||||
* @param string $today The date for today
|
||||
*
|
||||
* @return array on success
|
||||
*
|
||||
*/
|
||||
protected function searchFileContent(&$counter, &$file, &$target, &$placeholders, &$db, &$userId, &$today)
|
||||
{
|
||||
// reset each time per file
|
||||
$loadEndFingerPrint = false;
|
||||
$endFingerPrint = array();
|
||||
$fingerPrint = array();
|
||||
$codeBucket = array();
|
||||
$pointer = array();
|
||||
$reading = array();
|
||||
$reader = 0;
|
||||
$path = $target . '/' . str_replace('./', '', $file);
|
||||
foreach (new SplFileObject($file) as $lineNumber => $lineContent)
|
||||
{
|
||||
// we musk keep last few lines to dynamic find target entry later
|
||||
$fingerPrint[$lineNumber] = trim($lineContent);
|
||||
// load the end fingerprint
|
||||
if ($loadEndFingerPrint)
|
||||
{
|
||||
$endFingerPrint[$lineNumber] = trim($lineContent);
|
||||
}
|
||||
foreach ($placeholders as $type => $placeholder)
|
||||
{
|
||||
$i = (int) ($type === 3 ||$type === 4) ? 2 : 1;
|
||||
$_type = (int) ($type === 1 || $type === 3) ? 1 : 2;
|
||||
if ($reader === 0 || $reader === $i)
|
||||
{
|
||||
$targetKey = $type;
|
||||
$start = '/***['.$placeholder.'***/';
|
||||
$end = '/***[/'.$placeholder.'***/';
|
||||
// check if the ending place holder was found
|
||||
if(isset($reading[$targetKey]) && $reading[$targetKey] && (trim($lineContent) === $end || strpos($lineContent, $end) !== false))
|
||||
{
|
||||
// deactivate the reader
|
||||
$reading[$targetKey] = false;
|
||||
if ($_type == 2)
|
||||
{
|
||||
// deactivate search
|
||||
$reader = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// activate fingerPrint for replacement end target
|
||||
$loadEndFingerPrint = true;
|
||||
$backupTargetKey = $targetKey;
|
||||
}
|
||||
// all new records we can do a bulk insert
|
||||
if ($i === 1)
|
||||
{
|
||||
// end the bucket info for this code block
|
||||
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote((int) $lineNumber); // 'toline'
|
||||
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote(base64_encode(implode('', $codeBucket[$pointer[$targetKey]]))); // 'code'
|
||||
if ($_type == 2)
|
||||
{
|
||||
// load the last value
|
||||
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote(0); // 'hashendtarget'
|
||||
}
|
||||
}
|
||||
// the record already exist so we must use module to update
|
||||
elseif ($i === 2)
|
||||
{
|
||||
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('to_line') . ' = ' . $db->quote($lineNumber);
|
||||
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('code') . ' = ' . $db->quote(base64_encode(implode('', $codeBucket[$pointer[$targetKey]])));
|
||||
if ($_type == 2)
|
||||
{
|
||||
// load the last value
|
||||
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('hashendtarget') . ' = ' . $db->quote(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
// check if the endfingerprint is ready to save
|
||||
if (count($endFingerPrint) === 3)
|
||||
{
|
||||
$hashendtarget = '3__'.md5(implode('',$endFingerPrint));
|
||||
// all new records we can do a bulk insert
|
||||
if ($i === 1)
|
||||
{
|
||||
// load the last value
|
||||
$this->newCustomCode[$pointer[$backupTargetKey]][] = $db->quote($hashendtarget); // 'hashendtarget'
|
||||
}
|
||||
// the record already exist so we must use module to update
|
||||
elseif ($i === 2)
|
||||
{
|
||||
$this->existingCustomCode[$pointer[$backupTargetKey]]['fields'][] = $db->quoteName('hashendtarget') . ' = ' . $db->quote($hashendtarget);
|
||||
}
|
||||
// reset the needed values
|
||||
$endFingerPrint = array();
|
||||
$loadEndFingerPrint = false;
|
||||
// deactivate reader (to allow other search)
|
||||
$reader = 0;
|
||||
}
|
||||
// then read in the code
|
||||
if (isset($reading[$targetKey]) && $reading[$targetKey])
|
||||
{
|
||||
$codeBucket[$pointer[$targetKey]][] = $lineContent;
|
||||
}
|
||||
// check if the starting place holder was found
|
||||
if((!isset($reading[$targetKey]) || !$reading[$targetKey]) && (($i === 1 && trim($lineContent) === $start) || strpos($lineContent, $start) !== false))
|
||||
{
|
||||
// set active reader (to lock out other search)
|
||||
$reader = $i;
|
||||
// set pointer
|
||||
$pointer[$targetKey] = $counter[$i];
|
||||
// activate the reader
|
||||
$reading[$targetKey] = true;
|
||||
// start code bucket
|
||||
$codeBucket[$pointer[$targetKey]] = array();
|
||||
// get the finger print around the custom code
|
||||
$inFinger = count($fingerPrint);
|
||||
$getFinger = $inFinger - 1;
|
||||
$hasharray = array_slice($fingerPrint, -$inFinger, $getFinger, true);
|
||||
$hasleng = count($hasharray);
|
||||
$hashtarget = $hasleng.'__'.md5(implode('',$hasharray));
|
||||
// do a quick check to insure we have an id
|
||||
$id = false;
|
||||
if ($i === 2)
|
||||
{
|
||||
$id = $this->getSystemID($lineContent, $start);
|
||||
}
|
||||
// all new records we can do a buldk insert
|
||||
if ($i === 1 || !$id)
|
||||
{
|
||||
// start the bucket for this code
|
||||
$this->newCustomCode[$pointer[$targetKey]] = array();
|
||||
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote($path); // 'path'
|
||||
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote((int) $_type); // 'type'
|
||||
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote((int) $this->componentData->id); // 'component'
|
||||
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote(1); // 'published'
|
||||
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote($today); // 'created'
|
||||
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote((int) $userId); // 'created_by'
|
||||
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote(1); // 'version'
|
||||
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote(1); // 'access'
|
||||
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote($hashtarget); // 'hashtarget'
|
||||
$this->newCustomCode[$pointer[$targetKey]][] = $db->quote((int) $lineNumber); // 'fromline'
|
||||
}
|
||||
// the record already exist so we must update instead
|
||||
elseif ($i === 2 && $id > 0)
|
||||
{
|
||||
// start the bucket for this code
|
||||
$this->existingCustomCode[$pointer[$targetKey]] = array();
|
||||
$this->existingCustomCode[$pointer[$targetKey]]['id'] = (int) $id;
|
||||
$this->existingCustomCode[$pointer[$targetKey]]['conditions'] = array();
|
||||
$this->existingCustomCode[$pointer[$targetKey]]['conditions'][] = $db->quoteName('id') . ' = ' . $db->quote($id);
|
||||
$this->existingCustomCode[$pointer[$targetKey]]['fields'] = array();
|
||||
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('path') . ' = ' . $db->quote($path);
|
||||
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('type') . ' = ' . $db->quote($_type);
|
||||
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('component') . ' = ' . $db->quote($this->componentData->id);
|
||||
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('from_line') . ' = ' . $db->quote($lineNumber);
|
||||
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('modified') . ' = ' . $db->quote($today);
|
||||
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('modified_by') . ' = ' . $db->quote($userId);
|
||||
$this->existingCustomCode[$pointer[$targetKey]]['fields'][] = $db->quoteName('hashtarget') . ' = ' . $db->quote($hashtarget);
|
||||
}
|
||||
// update the counter
|
||||
$counter[$i]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// make sure only a few lines is kept at a time
|
||||
if (count($fingerPrint) > 10)
|
||||
{
|
||||
$fingerPrint = array_slice($fingerPrint, -6, 6, true);
|
||||
}
|
||||
}
|
||||
// if the code is at the end of the page and there were not three more lines
|
||||
if (count($endFingerPrint) > 0 || $loadEndFingerPrint)
|
||||
{
|
||||
if (count($endFingerPrint) > 0)
|
||||
{
|
||||
$leng = count($endFingerPrint);
|
||||
$hashendtarget = $leng . '__' . md5(implode('',$endFingerPrint));
|
||||
}
|
||||
else
|
||||
{
|
||||
$hashendtarget = 0;
|
||||
}
|
||||
// all new records we can do a buldk insert
|
||||
if ($i === 1)
|
||||
{
|
||||
// load the last value
|
||||
$this->newCustomCode[$pointer[$backupTargetKey]][] = $db->quote($hashendtarget); // 'hashendtarget'
|
||||
}
|
||||
// the record already exist so we must use module to update
|
||||
elseif ($i === 2)
|
||||
{
|
||||
$this->existingCustomCode[$pointer[$backupTargetKey]]['fields'][] = $db->quoteName('hashendtarget') . ' = ' . $db->quote($hashendtarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* search for the system id in the line given
|
||||
*
|
||||
* @param string $lineContent The file path to search
|
||||
* @param string $placeholders The values to search for
|
||||
*
|
||||
* @return array on success
|
||||
*
|
||||
*/
|
||||
protected function getSystemID(&$lineContent, $placeholder)
|
||||
{
|
||||
// remove place holder from content
|
||||
$string = trim(str_replace($placeholder.'//', '', $lineContent));
|
||||
// now get all numbers
|
||||
$numbers = array();
|
||||
preg_match_all('!\d+!', $string, $numbers);
|
||||
// return the first number
|
||||
if (isset($numbers[0]) && ComponentbuilderHelper::checkArray($numbers[0]))
|
||||
{
|
||||
return reset($numbers[0]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* return the placeholders for insered and replaced code
|
||||
*
|
||||
* @param int $type The type of placement
|
||||
* @param int $id The code id in the system
|
||||
*
|
||||
* @return array on success
|
||||
*
|
||||
*/
|
||||
public function getPlaceHolder(&$type, &$id)
|
||||
{
|
||||
switch ($type)
|
||||
{
|
||||
case 1:
|
||||
//xxx[REPLACED$$$$]xxx///1
|
||||
return array(
|
||||
'start' => '/***[REPLACED$$$$]***///'.$id,
|
||||
'end' => '/***[/REPLACED$$$$]***/');
|
||||
break;
|
||||
case 2:
|
||||
//xxx[INSERTED$$$$]xxx///1
|
||||
return array(
|
||||
'start' => '/***[INSERTED$$$$]***///'.$id,
|
||||
'end' => '/***[/INSERTED$$$$]***/');
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -143,6 +143,13 @@ class Structure extends Get
|
||||
*/
|
||||
public $addCheckin = false;
|
||||
|
||||
/**
|
||||
* The array of last modified dates
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $lastModifiedDate = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@ -367,7 +374,7 @@ class Structure extends Get
|
||||
// do the file renaming
|
||||
if ($details->rename)
|
||||
{
|
||||
if ($details->rename == 'new')
|
||||
if ($details->rename === 'new')
|
||||
{
|
||||
$new = $details->newName;
|
||||
}
|
||||
@ -381,12 +388,12 @@ class Structure extends Get
|
||||
$new = $item;
|
||||
}
|
||||
// if not gnu/gpl license dont add the LICENSE.txt file
|
||||
if ($item == 'LICENSE.txt' && !$LICENSE)
|
||||
if ($item === 'LICENSE.txt' && !$LICENSE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// if not needed do not add
|
||||
if (($item == 'README.md' || $item == 'README.txt') && !$README)
|
||||
if (($item === 'README.md' || $item === 'README.txt') && !$README)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -396,7 +403,7 @@ class Structure extends Get
|
||||
// set the template folder path
|
||||
$templatePath = (isset($details->custom) && $details->custom) ? $this->templatePathCustom : $this->templatePath;
|
||||
// now mov the file
|
||||
if ($details->type == 'file')
|
||||
if ($details->type === 'file')
|
||||
{
|
||||
// move the file to its place
|
||||
JFile::copy($templatePath.'/'.$item, $path.'/'.$new);
|
||||
@ -408,7 +415,7 @@ class Structure extends Get
|
||||
$this->newFiles['static'][] = array( 'path' => $path.'/'.$new, 'name' => $new, 'zip' => $zipPath.'/'.$new );
|
||||
}
|
||||
}
|
||||
elseif ($details->type == 'folder')
|
||||
elseif ($details->type === 'folder')
|
||||
{
|
||||
// move the folder to its place
|
||||
JFolder::copy($templatePath.'/'.$item, $path.'/'.$new);
|
||||
@ -441,21 +448,25 @@ class Structure extends Get
|
||||
{
|
||||
if (ComponentbuilderHelper::checkObject($view['settings']))
|
||||
{
|
||||
$modified = $this->getLastModifiedDate($view);
|
||||
if ($view['settings']->name_list != 'null')
|
||||
{
|
||||
$target = array('admin' => $view['settings']->name_list);
|
||||
$this->buildDynamique($target,'list');
|
||||
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
|
||||
$this->buildDynamique($target,'list', false, $config);
|
||||
}
|
||||
if ($view['settings']->name_single != 'null')
|
||||
{
|
||||
$target = array('admin' => $view['settings']->name_single);
|
||||
$this->buildDynamique($target,'single');
|
||||
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
|
||||
$this->buildDynamique($target,'single', false, $config);
|
||||
}
|
||||
if($view['edit_create_site_view'])
|
||||
{
|
||||
// setup the front site edit-view files
|
||||
$target = array('site' => $view['settings']->name_single);
|
||||
$this->buildDynamique($target,'edit');
|
||||
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
|
||||
$this->buildDynamique($target,'edit', false, $config);
|
||||
}
|
||||
}
|
||||
// quick set of checkin once
|
||||
@ -472,17 +483,20 @@ class Structure extends Get
|
||||
|
||||
foreach ($this->componentData->site_views as $nr => $view)
|
||||
{
|
||||
$modified = $this->getLastModifiedDate($view);
|
||||
if ($view['settings']->main_get->gettype == 2)
|
||||
{
|
||||
// set list view
|
||||
$target = array('site' => $view['settings']->code);
|
||||
$this->buildDynamique($target,'list');
|
||||
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
|
||||
$this->buildDynamique($target,'list', false, $config);
|
||||
}
|
||||
elseif ($view['settings']->main_get->gettype == 1)
|
||||
{
|
||||
// set single view
|
||||
$target = array('site' => $view['settings']->code);
|
||||
$this->buildDynamique($target,'single');
|
||||
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
|
||||
$this->buildDynamique($target,'single', false, $config);
|
||||
}
|
||||
}
|
||||
$front = true;
|
||||
@ -491,17 +505,20 @@ class Structure extends Get
|
||||
{
|
||||
foreach ($this->componentData->custom_admin_views as $nr => $view)
|
||||
{
|
||||
$modified = $this->getLastModifiedDate($view);
|
||||
if ($view['settings']->main_get->gettype == 2)
|
||||
{
|
||||
// set list view
|
||||
$target = array('custom_admin' => $view['settings']->code);
|
||||
$this->buildDynamique($target,'list');
|
||||
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => JFactory::getDate($view['settings']->modified)->format('jS F, Y'),'###VERSION###' => $view['settings']->version);
|
||||
$this->buildDynamique($target,'list', false, $config);
|
||||
}
|
||||
elseif ($view['settings']->main_get->gettype == 1)
|
||||
{
|
||||
// set single view
|
||||
$target = array('custom_admin' => $view['settings']->code);
|
||||
$this->buildDynamique($target,'single');
|
||||
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => JFactory::getDate($view['settings']->modified)->format('jS F, Y'),'###VERSION###' => $view['settings']->version);
|
||||
$this->buildDynamique($target, 'single', false, $config);
|
||||
}
|
||||
}
|
||||
$back = true;
|
||||
@ -514,17 +531,98 @@ class Structure extends Get
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the last modified date of a MVC (view)
|
||||
*
|
||||
* @param array $view The view values
|
||||
*
|
||||
* @return string Last Modified Date
|
||||
*
|
||||
*/
|
||||
public function getLastModifiedDate($view)
|
||||
{
|
||||
// first set the main date
|
||||
$date = strtotime($view['settings']->modified);
|
||||
if (isset($view['adminview']))
|
||||
{
|
||||
$id = $view['adminview'].'admin';
|
||||
// now check if value has been set
|
||||
if (!isset($this->lastModifiedDate[$id]))
|
||||
{
|
||||
if (isset($view['settings']->fields) && ComponentbuilderHelper::checkArray($view['settings']->fields))
|
||||
{
|
||||
foreach ($view['settings']->fields as $field)
|
||||
{
|
||||
if (isset($field['settings']) && ComponentbuilderHelper::checkObject($field['settings']) && isset($field['settings']->modified))
|
||||
{
|
||||
$anotherDate = strtotime($field['settings']->modified);
|
||||
if ($anotherDate > $date)
|
||||
{
|
||||
$date = $anotherDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (isset($view['siteview']))
|
||||
{
|
||||
$id = $view['siteview'].'site';
|
||||
// now check if value has been set
|
||||
if (!isset($this->lastModifiedDate[$id]))
|
||||
{
|
||||
if (isset($view['settings']->main_get->modified))
|
||||
{
|
||||
$anotherDate = strtotime($view['settings']->main_get->modified);
|
||||
if ($anotherDate > $date)
|
||||
{
|
||||
$date = $anotherDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (isset($view['customadminview']))
|
||||
{
|
||||
$id = $view['customadminview'].'customadmin';
|
||||
// now check if value has been set
|
||||
if (!isset($this->lastModifiedDate[$id]))
|
||||
{
|
||||
if (isset($view['settings']->main_get->modified))
|
||||
{
|
||||
$anotherDate = strtotime($view['settings']->main_get->modified);
|
||||
if ($anotherDate > $date)
|
||||
{
|
||||
$date = $anotherDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check if ID was found
|
||||
if (!isset($id))
|
||||
{
|
||||
$id = md5($date);
|
||||
}
|
||||
// now load the date
|
||||
if (!isset($this->lastModifiedDate[$id]))
|
||||
{
|
||||
$this->lastModifiedDate[$id] = $date;
|
||||
}
|
||||
|
||||
return JFactory::getDate($this->lastModifiedDate[$id])->format('jS F, Y');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Static File & Folder
|
||||
*
|
||||
* @param array $target The main target and name
|
||||
* @param string $type The type in the target
|
||||
* @param string $fileName The custom file name
|
||||
* @param array $cofig to add more data to the files info
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
*/
|
||||
public function buildDynamique($target,$type,$fileName = false)
|
||||
public function buildDynamique($target, $type, $fileName = false, $config = false)
|
||||
{
|
||||
if (ComponentbuilderHelper::checkArray($target))
|
||||
{
|
||||
@ -566,7 +664,7 @@ class Structure extends Get
|
||||
$new = str_replace($details->rename, $fileName, $item);
|
||||
$name = $name.'_'.$fileName;
|
||||
}
|
||||
elseif ($details->rename == 'new')
|
||||
elseif ($details->rename === 'new')
|
||||
{
|
||||
$new = $details->newName;
|
||||
}
|
||||
@ -586,8 +684,14 @@ class Structure extends Get
|
||||
// count the file created
|
||||
$this->fileCount++;
|
||||
}
|
||||
// setup array for new file
|
||||
$newFIle = array( 'path' => $path.'/'.$new, 'name' => $new , 'view' => $name, 'zip' => $zipPath.'/'.$new);
|
||||
if (ComponentbuilderHelper::checkArray($config))
|
||||
{
|
||||
$newFIle['config'] = $config;
|
||||
}
|
||||
// store the new files
|
||||
$this->newFiles['dynamic'][$name][] = array( 'path' => $path.'/'.$new, 'name' => $new , 'view' => $name, 'zip' => $zipPath.'/'.$new);
|
||||
$this->newFiles['dynamic'][$name][] = $newFIle;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -671,7 +775,7 @@ class Structure extends Get
|
||||
{
|
||||
$this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] = '';
|
||||
}
|
||||
if (count($pathArray) == 1 && $firstFolder == 'media')
|
||||
if (count($pathArray) == 1 && $firstFolder === 'media')
|
||||
{
|
||||
$this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] .= "\n\t\t<folder>".$lastFolder."</folder>";
|
||||
}
|
||||
@ -680,7 +784,7 @@ class Structure extends Get
|
||||
{
|
||||
$this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'] = '';
|
||||
}
|
||||
if (count($pathArray) == 1 && $firstFolder == 'site')
|
||||
if (count($pathArray) == 1 && $firstFolder === 'site')
|
||||
{
|
||||
$this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'] .= "\n\t\t<folder>".$lastFolder."</folder>";
|
||||
}
|
||||
@ -689,7 +793,7 @@ class Structure extends Get
|
||||
{
|
||||
$this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'] = '';
|
||||
}
|
||||
if (count($pathArray) == 1 && $firstFolder == 'admin')
|
||||
if (count($pathArray) == 1 && $firstFolder === 'admin')
|
||||
{
|
||||
$this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'] .= "\n\t\t\t<folder>".$lastFolder."</folder>";
|
||||
}
|
||||
@ -831,4 +935,38 @@ class Structure extends Get
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the local installed path of this component
|
||||
*
|
||||
* @return array of paths on success
|
||||
*
|
||||
*/
|
||||
public function getLocalInstallPaths()
|
||||
{
|
||||
// set the local paths to search
|
||||
$localPaths = array();
|
||||
// the admin path
|
||||
$localPaths['admin'] = JPATH_ADMINISTRATOR . '/components/com_'. $this->componentCodeName;
|
||||
// only check for site path if the component has a site area!
|
||||
if (!$this->removeSiteFolder)
|
||||
{
|
||||
$localPaths['site'] = JPATH_ROOT . '/components/com_'. $this->componentCodeName;
|
||||
}
|
||||
// TODO later to include the JS and CSS
|
||||
// $localPaths['media'] = JPATH_ROOT . '/media/com_'. $this->fileContentStatic['###component###'];
|
||||
// check if the local install is found
|
||||
foreach ($localPaths as $key => $localPath)
|
||||
{
|
||||
if (!JFolder::exists($localPath))
|
||||
{
|
||||
unset($localPaths[$key]);
|
||||
}
|
||||
}
|
||||
if (ComponentbuilderHelper::checkArray($localPaths))
|
||||
{
|
||||
return $localPaths;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ class Fields extends Structure
|
||||
// now add to the field set
|
||||
$fieldSet .= $this->setField('spacer', $taber, $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray);
|
||||
// increment spacer counter
|
||||
if ($typeName == 'spacer')
|
||||
if ($typeName === 'spacer')
|
||||
{
|
||||
$spacerCounter++;
|
||||
}
|
||||
@ -739,7 +739,7 @@ class Fields extends Structure
|
||||
elseif ($this->defaultField($typeName, 'special'))
|
||||
{
|
||||
// set the repeatable field
|
||||
if ($typeName == 'repeatable')
|
||||
if ($typeName === 'repeatable')
|
||||
{
|
||||
if ($build)
|
||||
{
|
||||
@ -794,7 +794,7 @@ class Fields extends Structure
|
||||
private function setField($setType, $taber, &$fieldAttributes, &$name, &$typeName, &$langView, &$viewName, &$listViewName, $placeholders, &$optionArray, $custom = null)
|
||||
{
|
||||
$fieldSet = '';
|
||||
if ($setType == 'option')
|
||||
if ($setType === 'option')
|
||||
{
|
||||
// now add to the field set
|
||||
$fieldSet .= "\n\t" . $taber . "\t<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->";
|
||||
@ -806,7 +806,7 @@ class Fields extends Structure
|
||||
{
|
||||
$fieldSet .= "\n\t\t" . $taber . "\t" . $property . '="' . $value . '"';
|
||||
}
|
||||
elseif ($property == 'option')
|
||||
elseif ($property === 'option')
|
||||
{
|
||||
$optionSet = '';
|
||||
if (strpos($value, ',') !== false)
|
||||
@ -872,7 +872,7 @@ class Fields extends Structure
|
||||
$fieldSet .= $optionSet;
|
||||
$fieldSet .= "\n\t\t" . $taber . "</field>";
|
||||
}
|
||||
elseif ($typeName == 'sql')
|
||||
elseif ($typeName === 'sql')
|
||||
{
|
||||
$optionArray = false;
|
||||
$fieldSet .= "\n\t\t" . $taber . "/>";
|
||||
@ -884,7 +884,7 @@ class Fields extends Structure
|
||||
$fieldSet .= "\n\t\t" . $taber . "/>";
|
||||
}
|
||||
}
|
||||
elseif ($setType == 'plain')
|
||||
elseif ($setType === 'plain')
|
||||
{
|
||||
// now add to the field set
|
||||
$fieldSet .= "\n\t\t" . $taber . "<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->";
|
||||
@ -898,7 +898,7 @@ class Fields extends Structure
|
||||
}
|
||||
$fieldSet .= "\n\t\t" . $taber . "/>";
|
||||
}
|
||||
elseif ($setType == 'spacer')
|
||||
elseif ($setType === 'spacer')
|
||||
{
|
||||
// now add to the field set
|
||||
$fieldSet .= "\n\t\t<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". A None Database Field. (joomla) -->";
|
||||
@ -912,10 +912,10 @@ class Fields extends Structure
|
||||
}
|
||||
$fieldSet .= " />";
|
||||
}
|
||||
elseif ($setType == 'special')
|
||||
elseif ($setType === 'special')
|
||||
{
|
||||
// set the repeatable field
|
||||
if ($typeName == 'repeatable')
|
||||
if ($typeName === 'repeatable')
|
||||
{
|
||||
// now add to the field set
|
||||
$fieldSet .= "\n\t\t<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->";
|
||||
@ -1004,7 +1004,7 @@ class Fields extends Structure
|
||||
$fieldSet .= "\n\t\t</field>";
|
||||
}
|
||||
}
|
||||
elseif ($setType == 'custom')
|
||||
elseif ($setType === 'custom')
|
||||
{
|
||||
// now add to the field set
|
||||
$fieldSet .= "\n\t\t" . $taber . "<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (custom) -->";
|
||||
@ -1063,7 +1063,7 @@ class Fields extends Structure
|
||||
$this->movedPublishingFields[$viewName][$name] = $name;
|
||||
}
|
||||
}
|
||||
elseif ($tabName == 'publishing')
|
||||
elseif ($tabName === 'publishing')
|
||||
{
|
||||
if (!in_array($name, $this->defaultFields))
|
||||
{
|
||||
@ -1170,9 +1170,9 @@ class Fields extends Structure
|
||||
// reset
|
||||
$xmlValue = '';
|
||||
$langValue = '';
|
||||
if ($property['name'] == 'type')
|
||||
if ($property['name'] === 'type')
|
||||
{
|
||||
if ($typeName == 'custom' || $typeName == 'customuser')
|
||||
if ($typeName === 'custom' || $typeName === 'customuser')
|
||||
{
|
||||
$xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"'));
|
||||
}
|
||||
@ -1212,10 +1212,10 @@ class Fields extends Structure
|
||||
$fieldAttributes['custom']['type'] = $typeName;
|
||||
}
|
||||
}
|
||||
elseif ($property['name'] == 'name')
|
||||
elseif ($property['name'] === 'name')
|
||||
{
|
||||
// if category then name must be catid (only one per view)
|
||||
if ($typeName == 'category')
|
||||
if ($typeName === 'category')
|
||||
{
|
||||
// quick check if this is a category linked to view page
|
||||
$requeSt_id = ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"');
|
||||
@ -1242,7 +1242,7 @@ class Fields extends Structure
|
||||
}
|
||||
}
|
||||
// if tag is set then enable all tag options for this view (only one per view)
|
||||
elseif ($typeName == 'tag')
|
||||
elseif ($typeName === 'tag')
|
||||
{
|
||||
$xmlValue = 'tags';
|
||||
}
|
||||
@ -1251,7 +1251,7 @@ class Fields extends Structure
|
||||
{
|
||||
$xmlValue = 'alias';
|
||||
}
|
||||
elseif ($typeName == 'spacer')
|
||||
elseif ($typeName === 'spacer')
|
||||
{
|
||||
// make sure the name is unique
|
||||
$xmlValue = $name . '_' . $spacerCounter;
|
||||
@ -1272,7 +1272,7 @@ class Fields extends Structure
|
||||
$name = $xmlValue;
|
||||
}
|
||||
}
|
||||
elseif ($property['name'] == 'extension' || $property['name'] == 'directory')
|
||||
elseif ($property['name'] === 'extension' || $property['name'] === 'directory')
|
||||
{
|
||||
$xmlValue = ComponentbuilderHelper::getBetween($field['settings']->xml, $property['name'] . '="', '"');
|
||||
// replace the placeholders
|
||||
@ -1292,61 +1292,61 @@ class Fields extends Structure
|
||||
// load the php for the custom field file
|
||||
$fieldAttributes['custom']['phpx'][$phpLine] = ComponentbuilderHelper::getBetween($field['settings']->xml, $property['name'] . '="', '"');
|
||||
}
|
||||
elseif ($property['name'] == 'extends' && $setCustom)
|
||||
elseif ($property['name'] === 'extends' && $setCustom)
|
||||
{
|
||||
// load the class that is being extended
|
||||
$fieldAttributes['custom']['extends'] = ComponentbuilderHelper::getBetween($field['settings']->xml, 'extends="', '"');
|
||||
}
|
||||
elseif ($property['name'] == 'view' && $setCustom)
|
||||
elseif ($property['name'] === 'view' && $setCustom)
|
||||
{
|
||||
// load the view name
|
||||
$fieldAttributes['custom']['view'] = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'view="', '"'));
|
||||
}
|
||||
elseif ($property['name'] == 'views' && $setCustom)
|
||||
elseif ($property['name'] === 'views' && $setCustom)
|
||||
{
|
||||
// load the views name
|
||||
$fieldAttributes['custom']['views'] = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'views="', '"'));
|
||||
}
|
||||
elseif ($property['name'] == 'component' && $setCustom)
|
||||
elseif ($property['name'] === 'component' && $setCustom)
|
||||
{
|
||||
// load the component name
|
||||
$fieldAttributes['custom']['component'] = ComponentbuilderHelper::getBetween($field['settings']->xml, 'component="', '"');
|
||||
// replace the placeholders
|
||||
$fieldAttributes['custom']['component'] = str_replace(array_keys($placeholders), array_values($placeholders), $fieldAttributes['custom']['component']);
|
||||
}
|
||||
elseif ($property['name'] == 'table' && $setCustom)
|
||||
elseif ($property['name'] === 'table' && $setCustom)
|
||||
{
|
||||
// load the main table that is queried
|
||||
$fieldAttributes['custom']['table'] = ComponentbuilderHelper::getBetween($field['settings']->xml, 'table="', '"');
|
||||
// replace the placeholders
|
||||
$fieldAttributes['custom']['table'] = str_replace(array_keys($placeholders), array_values($placeholders), $fieldAttributes['custom']['table']);
|
||||
}
|
||||
elseif ($property['name'] == 'value_field' && $setCustom)
|
||||
elseif ($property['name'] === 'value_field' && $setCustom)
|
||||
{
|
||||
// load the text key
|
||||
$fieldAttributes['custom']['text'] = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'value_field="', '"'));
|
||||
}
|
||||
elseif ($property['name'] == 'key_field' && $setCustom)
|
||||
elseif ($property['name'] === 'key_field' && $setCustom)
|
||||
{
|
||||
// load the id key
|
||||
$fieldAttributes['custom']['id'] = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'key_field="', '"'));
|
||||
}
|
||||
elseif ($property['name'] == 'button' && $repeatable && $setCustom)
|
||||
elseif ($property['name'] === 'button' && $repeatable && $setCustom)
|
||||
{
|
||||
// dont load the button to repeatable
|
||||
$xmlValue = 'false';
|
||||
}
|
||||
elseif ($property['name'] == 'required' && $repeatable)
|
||||
elseif ($property['name'] === 'required' && $repeatable)
|
||||
{
|
||||
// dont load the required to repeatable
|
||||
$xmlValue = 'false';
|
||||
}
|
||||
elseif ($viewType == 2 && ($property['name'] == 'readonly' || $property['name'] == 'disabled'))
|
||||
elseif ($viewType == 2 && ($property['name'] === 'readonly' || $property['name'] === 'disabled'))
|
||||
{
|
||||
// set read only
|
||||
$xmlValue = 'true';
|
||||
}
|
||||
elseif ($property['name'] == 'multiple')
|
||||
elseif ($property['name'] === 'multiple')
|
||||
{
|
||||
$xmlValue = (string) ComponentbuilderHelper::getBetween($field['settings']->xml, $property['name'] . '="', '"');
|
||||
// add the multipal
|
||||
@ -1356,7 +1356,7 @@ class Fields extends Structure
|
||||
}
|
||||
}
|
||||
// make sure the name is added as a cless name for use in javascript
|
||||
elseif ($property['name'] == 'class' && ($typeName == 'note' || $typeName == 'spacer'))
|
||||
elseif ($property['name'] === 'class' && ($typeName === 'note' || $typeName === 'spacer'))
|
||||
{
|
||||
$xmlValue = ComponentbuilderHelper::getBetween($field['settings']->xml, 'class="', '"');
|
||||
// add the type class
|
||||
@ -1397,26 +1397,26 @@ class Fields extends Structure
|
||||
}
|
||||
elseif (isset($field['alias']) && $field['alias'] && $property['translatable'] == 1)
|
||||
{
|
||||
if ($property['name'] == 'label')
|
||||
if ($property['name'] === 'label')
|
||||
{
|
||||
$xmlValue = 'JFIELD_ALIAS_LABEL';
|
||||
}
|
||||
elseif ($property['name'] == 'description')
|
||||
elseif ($property['name'] === 'description')
|
||||
{
|
||||
$xmlValue = 'JFIELD_ALIAS_DESC';
|
||||
}
|
||||
elseif ($property['name'] == 'hint')
|
||||
elseif ($property['name'] === 'hint')
|
||||
{
|
||||
$xmlValue = 'JFIELD_ALIAS_PLACEHOLDER';
|
||||
}
|
||||
}
|
||||
elseif (isset($field['title']) && $field['title'] && $property['translatable'] == 1)
|
||||
{
|
||||
if ($property['name'] == 'label')
|
||||
if ($property['name'] === 'label')
|
||||
{
|
||||
$xmlValue = 'JGLOBAL_TITLE';
|
||||
}
|
||||
elseif ($property['name'] == 'description')
|
||||
elseif ($property['name'] === 'description')
|
||||
{
|
||||
$xmlValue = 'JFIELD_TITLE_DESC';
|
||||
}
|
||||
@ -1436,7 +1436,7 @@ class Fields extends Structure
|
||||
$fieldAttributes[$property['name']] = $xmlValue;
|
||||
|
||||
// load to langBuilder down the line
|
||||
if ($property['name'] == 'label')
|
||||
if ($property['name'] === 'label')
|
||||
{
|
||||
$langLabel = $xmlValue;
|
||||
if ($setCustom)
|
||||
@ -1481,7 +1481,7 @@ class Fields extends Structure
|
||||
*/
|
||||
public function setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple, $custom = false, $options = false)
|
||||
{
|
||||
if ($typeName == 'tag')
|
||||
if ($typeName === 'tag')
|
||||
{
|
||||
// set tags for this view but don't load to DB
|
||||
$this->tagsBuilder[$viewName] = $viewName;
|
||||
@ -1492,7 +1492,7 @@ class Fields extends Structure
|
||||
$intKeys = array('INT', 'TINYINT', 'BIGINT', 'FLOAT', 'DECIMAL', 'DOUBLE');
|
||||
if (in_array($field['settings']->datatype, $intKeys))
|
||||
{
|
||||
if ($field['settings']->datadefault == 'Other')
|
||||
if ($field['settings']->datadefault === 'Other')
|
||||
{
|
||||
if (!is_numeric($field['settings']->datadefault_other) || $field['settings']->datadefault_other !== '0000-00-00 00:00:00')
|
||||
{
|
||||
@ -1526,7 +1526,7 @@ class Fields extends Structure
|
||||
// build unique keys of this view for db
|
||||
$this->dbUniqueKeys[$viewName][] = $name;
|
||||
}
|
||||
elseif (($field['settings']->indexes == 2 || $field['alias'] || $field['title'] || $typeName == 'category') && !in_array($field['settings']->datatype, $textKeys))
|
||||
elseif (($field['settings']->indexes == 2 || $field['alias'] || $field['title'] || $typeName === 'category') && !in_array($field['settings']->datatype, $textKeys))
|
||||
{
|
||||
// build keys of this view for db
|
||||
$this->dbKeys[$viewName][] = $name;
|
||||
@ -1548,7 +1548,7 @@ class Fields extends Structure
|
||||
$this->titleBuilder[$viewName] = $name;
|
||||
}
|
||||
// category name fix
|
||||
if ($typeName == 'category')
|
||||
if ($typeName === 'category')
|
||||
{
|
||||
if (isset($this->catOtherName[$listViewName]) && ComponentbuilderHelper::checkArray($this->catOtherName[$listViewName]))
|
||||
{
|
||||
@ -1594,7 +1594,7 @@ class Fields extends Structure
|
||||
$this->customBuilderList[$listViewName][] = $name;
|
||||
}
|
||||
// set the hidden field of this view
|
||||
if ($typeName == 'hidden')
|
||||
if ($typeName === 'hidden')
|
||||
{
|
||||
if (!isset($this->hiddenFieldsBuilder[$viewName]))
|
||||
{
|
||||
@ -1603,7 +1603,7 @@ class Fields extends Structure
|
||||
$this->hiddenFieldsBuilder[$viewName] .= ',"' . $name . '"';
|
||||
}
|
||||
// set all int fields of this view
|
||||
if ($field['settings']->datatype == 'INT' || $field['settings']->datatype == 'TINYINT' || $field['settings']->datatype == 'BIGINT')
|
||||
if ($field['settings']->datatype === 'INT' || $field['settings']->datatype === 'TINYINT' || $field['settings']->datatype === 'BIGINT')
|
||||
{
|
||||
if (!isset($this->intFieldsBuilder[$viewName]))
|
||||
{
|
||||
@ -1629,7 +1629,7 @@ class Fields extends Structure
|
||||
}
|
||||
// TODO we may need to add a switch instead (since now it uses the first editor field)
|
||||
// set the main(biggest) text field of this view
|
||||
if ($typeName == 'editor')
|
||||
if ($typeName === 'editor')
|
||||
{
|
||||
if (!isset($this->maintextBuilder[$viewName]) || !ComponentbuilderHelper::checkString($this->maintextBuilder[$viewName]))
|
||||
{
|
||||
@ -1651,17 +1651,17 @@ class Fields extends Structure
|
||||
$this->customFieldLinksBuilder[$viewName] .= ',{"sourceColumn": "' . $name . '","targetTable": "' . $custom['table'] . '","targetColumn": "' . $custom['id'] . '","displayColumn": "' . $custom['text'] . '"}';
|
||||
}
|
||||
// build script switch for user
|
||||
if ($custom['extends'] == 'user')
|
||||
if ($custom['extends'] === 'user')
|
||||
{
|
||||
$this->setScriptUserSwitch[$typeName] = $typeName;
|
||||
}
|
||||
}
|
||||
if ($typeName == 'media')
|
||||
if ($typeName === 'media')
|
||||
{
|
||||
$this->setScriptMediaSwitch[$typeName] = $typeName;
|
||||
}
|
||||
// setup gategory for this view
|
||||
if ($typeName == 'category')
|
||||
if ($typeName === 'category')
|
||||
{
|
||||
if (isset($this->catOtherName[$listViewName]) && ComponentbuilderHelper::checkArray($this->catOtherName[$listViewName]))
|
||||
{
|
||||
@ -1678,12 +1678,12 @@ class Fields extends Structure
|
||||
$this->catCodeBuilder[$viewName] = array('code' => $name, 'views' => $otherViews, 'view' => $otherView);
|
||||
}
|
||||
// setup checkbox for this view
|
||||
if ($typeName == 'checkbox' || (ComponentbuilderHelper::checkArray($custom) && isset($custom['extends']) && $custom['extends'] == 'checkboxes'))
|
||||
if ($typeName === 'checkbox' || (ComponentbuilderHelper::checkArray($custom) && isset($custom['extends']) && $custom['extends'] === 'checkboxes'))
|
||||
{
|
||||
$this->checkboxBuilder[$viewName][] = $name;
|
||||
}
|
||||
// setup checkboxes and other json items for this view
|
||||
if (($typeName == 'checkboxes' || $multiple || $field['settings']->store != 0) && $typeName != 'tag')
|
||||
if (($typeName === 'checkboxes' || $multiple || $field['settings']->store != 0) && $typeName != 'tag')
|
||||
{
|
||||
switch ($field['settings']->store)
|
||||
{
|
||||
@ -1719,7 +1719,7 @@ class Fields extends Structure
|
||||
break;
|
||||
}
|
||||
// just a heads-up for usergroups set to multiple
|
||||
if ($typeName == 'usergroup')
|
||||
if ($typeName === 'usergroup')
|
||||
{
|
||||
$this->buildSiteFieldData($viewName, $name, 'json', $typeName);
|
||||
}
|
||||
@ -1737,8 +1737,8 @@ class Fields extends Structure
|
||||
}
|
||||
}
|
||||
}
|
||||
// build the data for the export & import methods $typeName == 'repeatable' ||
|
||||
if (($typeName == 'checkboxes' || $multiple || $field['settings']->store != 0) && !ComponentbuilderHelper::checkArray($options))
|
||||
// build the data for the export & import methods $typeName === 'repeatable' ||
|
||||
if (($typeName === 'checkboxes' || $multiple || $field['settings']->store != 0) && !ComponentbuilderHelper::checkArray($options))
|
||||
{
|
||||
$this->getItemsMethodEximportStringFixBuilder[$viewName][] = array('name' => $name, 'type' => $typeName, 'translation' => false, 'custom' => $custom, 'method' => $field['settings']->store);
|
||||
}
|
||||
@ -1838,7 +1838,7 @@ class Fields extends Structure
|
||||
$phpCode = 'return null;';
|
||||
}
|
||||
|
||||
if ($data['custom']['extends'] == 'user')
|
||||
if ($data['custom']['extends'] === 'user')
|
||||
{
|
||||
// now load the php xclude script
|
||||
if (ComponentbuilderHelper::checkArray($data['custom']['phpx']))
|
||||
|
@ -826,7 +826,7 @@ class Interpretation extends Fields
|
||||
$exel[] = "\t\t\t\t\t\t\$objPHPExcel->getActiveSheet()->getColumnDimension(\$a)->setAutoSize(true);";
|
||||
$exel[] = "\t\t\t\t\t\t\$objPHPExcel->getActiveSheet()->getStyle(\$a.\$i)->applyFromArray(\$headerStyles);";
|
||||
$exel[] = "\t\t\t\t\t\t\$objPHPExcel->getActiveSheet()->getStyle(\$a.\$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);";
|
||||
$exel[] = "\t\t\t\t\t} elseif (\$a == 'A'){";
|
||||
$exel[] = "\t\t\t\t\t} elseif (\$a === 'A'){";
|
||||
$exel[] = "\t\t\t\t\t\t\$objPHPExcel->getActiveSheet()->getStyle(\$a.\$i)->applyFromArray(\$sideStyles);";
|
||||
$exel[] = "\t\t\t\t\t} else {";
|
||||
$exel[] = "\t\t\t\t\t\t\$objPHPExcel->getActiveSheet()->getStyle(\$a.\$i)->applyFromArray(\$normalStyles);";
|
||||
@ -1170,7 +1170,7 @@ class Interpretation extends Fields
|
||||
// set the selection
|
||||
$getItem .= "\n\t".$tab."\t".$the_get['selection']['select'];
|
||||
if (($nr == 0 && (!isset($the_get['join_field']) || !ComponentbuilderHelper::checkString($the_get['join_field'])) && (isset($the_get['selection']['type']) && ComponentbuilderHelper::checkString($the_get['selection']['type']))) ||
|
||||
($type == 'custom' && (isset($the_get['selection']['type']) && ComponentbuilderHelper::checkString($the_get['selection']['type']))))
|
||||
($type === 'custom' && (isset($the_get['selection']['type']) && ComponentbuilderHelper::checkString($the_get['selection']['type']))))
|
||||
{
|
||||
$getItem .= "\n\t".$tab."\t".'$query->from('.$the_get['selection']['from'].');';
|
||||
}
|
||||
@ -1333,28 +1333,28 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (strpos($get['selection']['select'], $field) !== false)
|
||||
{
|
||||
if ($array['decode'] == 'json')
|
||||
if ($array['decode'] === 'json')
|
||||
{
|
||||
$if = "\n\t".$tab."\tif (".$this->fileContentStatic['###Component###']."Helper::checkJson(".$string."->".$field."))\n\t".$tab."\t{";
|
||||
// json_decode
|
||||
$decoder = $string."->".$field." = json_decode(".$string."->".$field.", true);";
|
||||
// TODO Use the type of field to prepare it even more for use in the view
|
||||
}
|
||||
elseif ($array['decode'] == 'base64')
|
||||
elseif ($array['decode'] === 'base64')
|
||||
{
|
||||
$if = "\n\t".$tab."\tif (!empty(".$string."->".$field.") && ".$string."->".$field." === base64_encode(base64_decode(".$string."->".$field.")))\n\t".$tab."\t{";
|
||||
// base64_decode
|
||||
$decoder = $string."->".$field." = base64_decode(".$string."->".$field.");";
|
||||
// TODO Use the type of field to prepare it even more for use in the view
|
||||
}
|
||||
elseif ($array['decode'] == 'basic_encryption')
|
||||
elseif ($array['decode'] === 'basic_encryption')
|
||||
{
|
||||
$if = "\n\t".$tab."\tif (!empty(".$string."->".$field.") && \$basickey && !is_numeric(".$string."->".$field.") && ".$string."->".$field." === base64_encode(base64_decode(".$string."->".$field.", true)))\n\t".$tab."\t{";
|
||||
// basic decryption
|
||||
$decoder = $string."->".$field." = rtrim(\$basic->decryptString(".$string."->".$field."), ".'"\0"'.");";
|
||||
$this->siteDecrypt['basic'][$code] = true;
|
||||
}
|
||||
elseif ($array['decode'] == 'advance_encryption')
|
||||
elseif ($array['decode'] === 'advance_encryption')
|
||||
{
|
||||
$if = "\n\t".$tab."\tif (!empty(".$string."->".$field.") && \$advancedkey && !is_numeric(".$string."->".$field.") && ".$string."->".$field." === base64_encode(base64_decode(".$string."->".$field.", true)))\n\t".$tab."\t{";
|
||||
// advanced decryption
|
||||
@ -1467,7 +1467,7 @@ class Interpretation extends Fields
|
||||
case 4:
|
||||
// COM_COMPONENTBUILDER_DYNAMIC_GET_USER_GROUPS
|
||||
$decodeChecker = $this->siteFieldData['decode'][$code][$ter['key']][$as][$field];
|
||||
if (ComponentbuilderHelper::checkArray($decodeChecker) || $ter['state_key'] == 'array')
|
||||
if (ComponentbuilderHelper::checkArray($decodeChecker) || $ter['state_key'] === 'array')
|
||||
{
|
||||
// set needed fields to filter after query
|
||||
$this->siteFieldDecodeFilter[$this->target][$code][$ter['key']][$as][$field] = $ter;
|
||||
@ -1491,7 +1491,7 @@ class Interpretation extends Fields
|
||||
break;
|
||||
case 8:
|
||||
// COM_COMPONENTBUILDER_DYNAMIC_GET_FUNCTIONVAR
|
||||
if ($ter['operator'] == 'IN' || $ter['operator'] == 'NOT IN')
|
||||
if ($ter['operator'] === 'IN' || $ter['operator'] === 'NOT IN')
|
||||
{
|
||||
$string = "\n\t\t".$tab."//".$this->setLine(__LINE__)." Check if " . $ter['state_key'] . " is an array with values.";
|
||||
$string .= "\n\t\t".$tab."\$array = " . $ter['state_key'].";";
|
||||
@ -1549,11 +1549,11 @@ class Interpretation extends Fields
|
||||
if (ComponentbuilderHelper::checkString($string))
|
||||
{
|
||||
// sort where
|
||||
if ($as == 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as])))
|
||||
if ($as === 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as])))
|
||||
{
|
||||
$filters .= $string;
|
||||
}
|
||||
elseif($as != 'a')
|
||||
elseif($as !== 'a')
|
||||
{
|
||||
$this->otherFilter[$this->target][$code][$as][$field] = $string;
|
||||
}
|
||||
@ -1575,7 +1575,7 @@ class Interpretation extends Fields
|
||||
// set the string
|
||||
$string = "\$query->order('".$or['table_key']." ".$or['direction']."');";
|
||||
// sort where
|
||||
if ($as == 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as])))
|
||||
if ($as === 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as])))
|
||||
{
|
||||
$ordering .= "\n\t".$tab."\t".$string;
|
||||
}
|
||||
@ -1606,7 +1606,7 @@ class Interpretation extends Fields
|
||||
}
|
||||
elseif (strpos($whe['value_key'],'$this->') !== false)
|
||||
{
|
||||
if ($whe['operator'] == 'IN' || $whe['operator'] == 'NOT IN')
|
||||
if ($whe['operator'] === 'IN' || $whe['operator'] === 'NOT IN')
|
||||
{
|
||||
$value = " (' . implode(',', " . $whe['value_key'] . ") . ')');";
|
||||
}
|
||||
@ -1623,10 +1623,10 @@ class Interpretation extends Fields
|
||||
if (ComponentbuilderHelper::checkString($value))
|
||||
{
|
||||
// set the string
|
||||
if ($whe['operator'] == 'IN' || $whe['operator'] == 'NOT IN')
|
||||
if ($whe['operator'] === 'IN' || $whe['operator'] === 'NOT IN')
|
||||
{
|
||||
$tabe = '';
|
||||
if ($as == 'a')
|
||||
if ($as === 'a')
|
||||
{
|
||||
$tabe = $tab;
|
||||
}
|
||||
@ -1645,11 +1645,11 @@ class Interpretation extends Fields
|
||||
$string = "\$query->where('".$whe['table_key']." ".$whe['operator'].$value;
|
||||
}
|
||||
// sort where
|
||||
if ($as == 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as])))
|
||||
if ($as === 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as])))
|
||||
{
|
||||
$wheres .= "\n\t".$tab."\t".$string;
|
||||
}
|
||||
elseif ($as != 'a')
|
||||
elseif ($as !== 'a')
|
||||
{
|
||||
$this->otherWhere[$this->target][$code][$as][$field] = "\n\t\t".$string;
|
||||
}
|
||||
@ -1792,7 +1792,7 @@ class Interpretation extends Fields
|
||||
$getItem .= "\n\t".$tab."\t\$data = \$db->loadObject();";
|
||||
$getItem .= "\n\n".$tab."\t\tif (empty(\$data))";
|
||||
$getItem .= "\n\t".$tab."\t{";
|
||||
if ($type == 'main')
|
||||
if ($type === 'main')
|
||||
{
|
||||
$getItem .= "\n\t".$tab."\t\t\$app = JFactory::getApplication();";
|
||||
$langKeyWord = $this->langPrefix.'_'.ComponentbuilderHelper::safeString('Not found or access denied','U');
|
||||
@ -1894,7 +1894,7 @@ class Interpretation extends Fields
|
||||
$get->php_calculation = (array) explode("\n",$get->php_calculation);
|
||||
$getItem .= "\n\t".$tab."\t".implode("\n\t".$tab."\t",$get->php_calculation);
|
||||
}
|
||||
if ($type == 'custom')
|
||||
if ($type === 'custom')
|
||||
{
|
||||
// return the object
|
||||
$getItem .= "\n\n\t".$tab."\t//".$this->setLine(__LINE__)." return data object.";
|
||||
@ -2171,7 +2171,7 @@ class Interpretation extends Fields
|
||||
$methods .= "\n\t\t".$get['selection']['select'];
|
||||
$methods .= "\n\t\t".'$query->from('.$get['selection']['from'].');';
|
||||
// set the string
|
||||
if ($get['operator'] == 'IN' || $get['operator'] == 'NOT IN')
|
||||
if ($get['operator'] === 'IN' || $get['operator'] === 'NOT IN')
|
||||
{
|
||||
$methods .= "\n\n\t\t//".$this->setLine(__LINE__)." Check if \$" . $default['on_field'] . " is an array with values.";
|
||||
$methods .= "\n\t\t\$array = \$" . $default['on_field'] . ";";
|
||||
@ -2750,7 +2750,7 @@ class Interpretation extends Fields
|
||||
// set the custom buttons ###CUSTOM_BUTTONS_METHOD###
|
||||
$this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD###'] = '';
|
||||
// if site add buttons to view
|
||||
if ($this->target == 'site')
|
||||
if ($this->target === 'site')
|
||||
{
|
||||
// set the custom buttons ###SITE_TOP_BUTTON###
|
||||
$this->fileContentDynamic[$viewName]['###SITE_TOP_BUTTON###'] = '';
|
||||
@ -2811,7 +2811,7 @@ class Interpretation extends Fields
|
||||
$buttons = array();
|
||||
foreach ($view['settings']->custom_buttons as $custom_button)
|
||||
{
|
||||
if ($custom_button['target'] != 2 || $this->target == 'site')
|
||||
if ($custom_button['target'] != 2 || $this->target === 'site')
|
||||
{
|
||||
// Load to lang
|
||||
$keyLang = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($custom_button['name'],'U');
|
||||
@ -3201,7 +3201,7 @@ class Interpretation extends Fields
|
||||
$script = array();
|
||||
$script[] = "\n<script type=\"text/javascript\">";
|
||||
$script[] = "\tJoomla.submitbutton = function(task) {";
|
||||
$script[] = "\t\tif (task == '".$view['settings']->code.".back') {";
|
||||
$script[] = "\t\tif (task === '".$view['settings']->code.".back') {";
|
||||
$script[] = "\t\t\tparent.history.back();";
|
||||
$script[] = "\t\t\treturn false;";
|
||||
$script[] = "\t\t} else {";
|
||||
@ -3236,11 +3236,13 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (isset($this->templateData[$this->target][$view['settings']->code]) && ComponentbuilderHelper::checkArray($this->templateData[$this->target][$view['settings']->code]))
|
||||
{
|
||||
$modified = $this->getLastModifiedDate($view);
|
||||
foreach ($this->templateData[$this->target][$view['settings']->code] as $template => $data)
|
||||
{
|
||||
// build the file
|
||||
$target = array($this->target => $view['settings']->code);
|
||||
$this->buildDynamique($target,'template',$template);
|
||||
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
|
||||
$this->buildDynamique($target,'template', $template, $config);
|
||||
// set the file data
|
||||
$TARGET = ComponentbuilderHelper::safeString($this->target,'U');
|
||||
// ###SITE_TEMPLATE_BODY### <<<DYNAMIC>>>
|
||||
@ -3331,12 +3333,12 @@ class Interpretation extends Fields
|
||||
$replacments = array_unique($replacments);
|
||||
foreach ($replacments as $replacment)
|
||||
{
|
||||
if ($type != 'static')
|
||||
if ($type !== 'static')
|
||||
{
|
||||
//var_dump($replacment); echo "\n";
|
||||
$echos[$replacment] = "###".$replacment."###<br />";
|
||||
}
|
||||
elseif ($type == 'static')
|
||||
elseif ($type === 'static')
|
||||
{
|
||||
//var_dump($replacment); echo "\n";
|
||||
$echos[$replacment] = "###".$replacment."###<br />";
|
||||
@ -3627,7 +3629,7 @@ class Interpretation extends Fields
|
||||
if (ComponentbuilderHelper::checkArray($dbStuff))
|
||||
{
|
||||
$taabb = '';
|
||||
if ($action == 'update')
|
||||
if ($action === 'update')
|
||||
{
|
||||
$taabb = "\t";
|
||||
}
|
||||
@ -3644,7 +3646,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
$script .= "\n\t\t\t\$".$code."->".$table." = '".$data."';";
|
||||
}
|
||||
if ($action == 'update')
|
||||
if ($action === 'update')
|
||||
{
|
||||
// we first load script to check if data exist
|
||||
$script .= "\n\n\t\t\t//".$this->setLine(__LINE__)." Check if ".$name." type is already in content_type DB.";
|
||||
@ -3657,7 +3659,7 @@ class Interpretation extends Fields
|
||||
$script .= "\n\t\t\t\$db->execute();";
|
||||
}
|
||||
$script .= "\n\n\t\t\t//".$this->setLine(__LINE__)." Set the object into the content types table.";
|
||||
if ($action == 'update')
|
||||
if ($action === 'update')
|
||||
{
|
||||
$script .= "\n\t\t\tif (\$db->getNumRows())";
|
||||
$script .= "\n\t\t\t{";
|
||||
@ -3668,7 +3670,7 @@ class Interpretation extends Fields
|
||||
$script .= "\n\t\t\t{";
|
||||
}
|
||||
$script .= "\n\t\t\t".$taabb."\$".$code."_Inserted = \$db->insertObject('#__content_types', \$".$code.");";
|
||||
if ($action == 'update')
|
||||
if ($action === 'update')
|
||||
{
|
||||
$script .= "\n\t\t\t}";
|
||||
}
|
||||
@ -4055,7 +4057,7 @@ class Interpretation extends Fields
|
||||
$isCategory = '';
|
||||
if ($viewArray && ComponentbuilderHelper::checkArray($viewArray))
|
||||
{
|
||||
if (isset($viewArray['settings']->main_get->db_table_main) && $viewArray['settings']->main_get->db_table_main == 'categories')
|
||||
if (isset($viewArray['settings']->main_get->db_table_main) && $viewArray['settings']->main_get->db_table_main === 'categories')
|
||||
{
|
||||
$isCategory = ', true'; // TODO we will keep an eye on this....
|
||||
}
|
||||
@ -4102,11 +4104,11 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (isset($this->fileContentStatic['###ROUTER_BUILD_VIEWS###']) && ComponentbuilderHelper::checkString($this->fileContentStatic['###ROUTER_BUILD_VIEWS###']))
|
||||
{
|
||||
return " || \$view == '".$view."'";
|
||||
return " || \$view === '".$view."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "\$view == '".$view."'";
|
||||
return "\$view === '".$view."'";
|
||||
}
|
||||
}
|
||||
|
||||
@ -4453,7 +4455,7 @@ class Interpretation extends Fields
|
||||
$batchcopy[] = "\t\t\t\t\tcontinue;";
|
||||
$batchcopy[] = "\t\t\t\t}";
|
||||
$batchcopy[] = "\t\t\t}";
|
||||
if ($category && $alias == 'alias' && $title == 'title')
|
||||
if ($category && $alias === 'alias' && $title === 'title')
|
||||
{
|
||||
$batchcopy[] = "\n\t\t\tif (isset(\$values['".$category."']))";
|
||||
$batchcopy[] = "\t\t\t{";
|
||||
@ -4566,7 +4568,7 @@ class Interpretation extends Fields
|
||||
}
|
||||
// start building the fix
|
||||
$fixUniqe[] = "\n\t\t//".$this->setLine(__LINE__)." Alter the ".$title." for save as copy";
|
||||
$fixUniqe[] = "\t\tif (\$input->get('task') == 'save2copy')";
|
||||
$fixUniqe[] = "\t\tif (\$input->get('task') === 'save2copy')";
|
||||
$fixUniqe[] = "\t\t{";
|
||||
$fixUniqe[] = "\t\t\t\$origTable = clone \$this->getTable();";
|
||||
$fixUniqe[] = "\t\t\t\$origTable->load(\$input->getInt('id'));";
|
||||
@ -4632,7 +4634,7 @@ class Interpretation extends Fields
|
||||
}
|
||||
// handel other uniqe fields
|
||||
$fixUniqe[] = "\n\t\t//".$this->setLine(__LINE__)." Alter the uniqe field for save as copy";
|
||||
$fixUniqe[] = "\t\tif (\$input->get('task') == 'save2copy')";
|
||||
$fixUniqe[] = "\t\tif (\$input->get('task') === 'save2copy')";
|
||||
$fixUniqe[] = "\t\t{";
|
||||
$fixUniqe[] = "\t\t\t//".$this->setLine(__LINE__)." Automatic handling of other uniqe fields";
|
||||
$fixUniqe[] = "\t\t\t\$uniqeFields = \$this->getUniqeFields();";
|
||||
@ -4729,15 +4731,15 @@ class Interpretation extends Fields
|
||||
{
|
||||
// set default
|
||||
$default = $data['default'];
|
||||
if ( $default == 'Other' )
|
||||
if ( $default === 'Other' )
|
||||
{
|
||||
$default = $data['other'];
|
||||
}
|
||||
if ($default == 'EMPTY')
|
||||
if ($default === 'EMPTY')
|
||||
{
|
||||
$default = $data['null_switch'];
|
||||
}
|
||||
elseif ($default == 'DATETIME' || $default == 'CURRENT_TIMESTAMP')
|
||||
elseif ($default === 'DATETIME' || $default === 'CURRENT_TIMESTAMP')
|
||||
{
|
||||
$default = $default.' '.$data['null_switch'];
|
||||
}
|
||||
@ -4745,7 +4747,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
$default = $data['null_switch']." DEFAULT '".$default."'";
|
||||
}
|
||||
elseif ($data['null_switch'] == 'NULL')
|
||||
elseif ($data['null_switch'] === 'NULL')
|
||||
{
|
||||
$default = "DEFAULT NULL";
|
||||
}
|
||||
@ -4755,7 +4757,7 @@ class Interpretation extends Fields
|
||||
}
|
||||
// set the lenght
|
||||
$lenght = '';
|
||||
if (isset($data['lenght']) && $data['lenght'] == 'Other' && isset($data['lenght_other']) && $data['lenght_other'] > 0)
|
||||
if (isset($data['lenght']) && $data['lenght'] === 'Other' && isset($data['lenght_other']) && $data['lenght_other'] > 0)
|
||||
{
|
||||
$lenght = '('.$data['lenght_other'].')';
|
||||
}
|
||||
@ -5252,7 +5254,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
$itemCode = '<?php echo JText::_($item->'.$item['code'].'); ?>';
|
||||
}
|
||||
elseif (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['text'] == 'user')
|
||||
elseif (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['text'] === 'user')
|
||||
{
|
||||
$itemCode = '<?php echo JFactory::getUser((int)$item->'.$item['code'].')->name; ?>';
|
||||
}
|
||||
@ -5276,7 +5278,7 @@ class Interpretation extends Fields
|
||||
// allways rest custom links
|
||||
$customAdminView = '';
|
||||
// if to be linked
|
||||
if ($item['type'] == 'category' && !$item['title'])
|
||||
if ($item['type'] === 'category' && !$item['title'])
|
||||
{
|
||||
$otherViews = $this->catCodeBuilder[$viewName_single]['views'];
|
||||
// category and linked
|
||||
@ -5288,7 +5290,7 @@ class Interpretation extends Fields
|
||||
$body .= "\n\t\t\t<?php endif; ?>";
|
||||
$body .= "\n\t\t</td>";
|
||||
}
|
||||
elseif ($item['type'] == 'user' && !$item['title'])
|
||||
elseif ($item['type'] === 'user' && !$item['title'])
|
||||
{
|
||||
// user and linked
|
||||
$body .= "\n\t\t<?php \$".$item['code']."User = JFactory::getUser(\$item->".$item['code']."); ?>";
|
||||
@ -5324,7 +5326,7 @@ class Interpretation extends Fields
|
||||
$accessCheck = "\$this->user->authorise('core.edit', 'com_".$this->fileContentStatic['###component###'].".".$item['custom']['view'].".' . (int)\$item->".$item['id'].")";
|
||||
}
|
||||
}
|
||||
elseif (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['extends'] == 'user' && !$item['title'])
|
||||
elseif (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['extends'] === 'user' && !$item['title'])
|
||||
{
|
||||
// user and linked
|
||||
$body .= "\n\t\t<?php \$".$item['id']." = JFactory::getUser(\$item->".$item['id']."); ?>";
|
||||
@ -5398,13 +5400,13 @@ class Interpretation extends Fields
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($item['type'] == 'category')
|
||||
if ($item['type'] === 'category')
|
||||
{
|
||||
$body .= "\n\t\t<td class=\"hidden-phone\">";
|
||||
$body .= "\n\t\t\t<?php echo \$this->escape(\$item->category_title); ?>";
|
||||
$body .= "\n\t\t</td>";
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['extends'] == 'user')
|
||||
elseif (ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['extends'] === 'user')
|
||||
{
|
||||
// custom user and linked
|
||||
$body .= "\n\t\t<?php \$".$item['code']." = JFactory::getUser(\$item->".$item['id']."); ?>";
|
||||
@ -5416,7 +5418,7 @@ class Interpretation extends Fields
|
||||
$body .= "\n\t\t\t<?php endif; ?>";
|
||||
$body .= "\n\t\t</td>";
|
||||
}
|
||||
elseif ($item['type'] == 'user')
|
||||
elseif ($item['type'] === 'user')
|
||||
{
|
||||
// user name only
|
||||
$body .= "\n\t\t<?php \$".$item['code']."User = JFactory::getUser(\$item->".$item['code']."); ?>";
|
||||
@ -5909,7 +5911,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
$items[] = $defaultField;
|
||||
}
|
||||
elseif ($defaultField == 'access' && isset($this->accessBuilder[$viewName_single]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName_single]))
|
||||
elseif ($defaultField === 'access' && isset($this->accessBuilder[$viewName_single]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName_single]))
|
||||
{
|
||||
$items[] = $defaultField;
|
||||
}
|
||||
@ -6146,7 +6148,7 @@ class Interpretation extends Fields
|
||||
$target = array('admin' => $viewName_single);
|
||||
$this->buildDynamique($target,$type,$layoutName);
|
||||
// add to front if needed
|
||||
if ($this->lang == 'both')
|
||||
if ($this->lang === 'both')
|
||||
{
|
||||
$target = array('site' => $viewName_single);
|
||||
$this->buildDynamique($target,$type,$layoutName);
|
||||
@ -6344,7 +6346,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
$itemCode = '<?php echo JText::_($item->'.$item['code'].'); ?>';
|
||||
}
|
||||
elseif ($item['custom']['text'] == 'user')
|
||||
elseif ($item['custom']['text'] === 'user')
|
||||
{
|
||||
$itemCode = '<?php echo JFactory::getUser((int)$item->'.$item['code'].')->name; ?>';
|
||||
}
|
||||
@ -6369,7 +6371,7 @@ class Interpretation extends Fields
|
||||
// allways rest custom links
|
||||
$customAdminView = '';
|
||||
// if to be linked
|
||||
if ($item['type'] == 'category' && !$item['title'])
|
||||
if ($item['type'] === 'category' && !$item['title'])
|
||||
{
|
||||
$otherViews = $this->catCodeBuilder[$viewName_single]['views'];
|
||||
// category and linked
|
||||
@ -6381,7 +6383,7 @@ class Interpretation extends Fields
|
||||
$body .= "\n\t\t\t<?php endif; ?>";
|
||||
$body .= "\n\t\t</td>";
|
||||
}
|
||||
elseif ($item['type'] == 'user' && !$item['title'])
|
||||
elseif ($item['type'] === 'user' && !$item['title'])
|
||||
{
|
||||
// user and linked
|
||||
$body .= "\n\t\t<?php \$".$item['code']."User = JFactory::getUser(\$item->".$item['code']."); ?>";
|
||||
@ -6398,7 +6400,7 @@ class Interpretation extends Fields
|
||||
$add = true;
|
||||
if (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['extends'] != 'user' && !$item['title'])
|
||||
{
|
||||
if ($refview == $item['custom']['view'])
|
||||
if ($refview === $item['custom']['view'])
|
||||
{
|
||||
// normal not linked
|
||||
$body .= "\n\t\t<td>";
|
||||
@ -6430,7 +6432,7 @@ class Interpretation extends Fields
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['extends'] == 'user' && !$item['title'])
|
||||
elseif (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['extends'] === 'user' && !$item['title'])
|
||||
{
|
||||
// user and linked
|
||||
$body .= "\n\t\t<?php \$_".$item['id']." = JFactory::getUser(\$item->".$item['id']."); ?>";
|
||||
@ -6502,13 +6504,13 @@ class Interpretation extends Fields
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($item['type'] == 'category')
|
||||
if ($item['type'] === 'category')
|
||||
{
|
||||
$body .= "\n\t\t<td>";
|
||||
$body .= "\n\t\t\t<?php echo \$displayData->escape(\$item->category_title); ?>";
|
||||
$body .= "\n\t\t</td>";
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['extends'] == 'user')
|
||||
elseif (ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['extends'] === 'user')
|
||||
{
|
||||
// custom user and linked
|
||||
$body .= "\n\t\t<?php \$_".$item['code']." = JFactory::getUser(\$item->".$item['id']."); ?>";
|
||||
@ -6520,7 +6522,7 @@ class Interpretation extends Fields
|
||||
$body .= "\n\t\t\t<?php endif; ?>";
|
||||
$body .= "\n\t\t</td>";
|
||||
}
|
||||
elseif ($item['type'] == 'user')
|
||||
elseif ($item['type'] === 'user')
|
||||
{
|
||||
// user name only
|
||||
$body .= "\n\t\t<?php \$".$item['code']."User = JFactory::getUser(\$item->".$item['code']."); ?>";
|
||||
@ -7547,11 +7549,11 @@ class Interpretation extends Fields
|
||||
// check if the item has permissions.
|
||||
if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.edit']]) && in_array($targetView,$this->permissionBuilder['global'][$core['core.edit']]))
|
||||
{
|
||||
$addButton[] = "\t\t\tif ((\$buttonName == '".$targetView."' || \$buttonName == '".$targetViews."') && \$user->authorise('".$core['core.edit']."', 'com_".$this->fileContentStatic['###component###']."') && \$app->isAdmin()) // TODO for now only in admin area.";
|
||||
$addButton[] = "\t\t\tif ((\$buttonName === '".$targetView."' || \$buttonName === '".$targetViews."') && \$user->authorise('".$core['core.edit']."', 'com_".$this->fileContentStatic['###component###']."') && \$app->isAdmin()) // TODO for now only in admin area.";
|
||||
}
|
||||
else
|
||||
{
|
||||
$addButton[] = "\t\t\tif ((\$buttonName == '".$targetView."' || \$buttonName == '".$targetViews."') && \$user->authorise('core.edit', 'com_".$this->fileContentStatic['###component###']."') && \$app->isAdmin()) // TODO for now only in admin area.";
|
||||
$addButton[] = "\t\t\tif ((\$buttonName === '".$targetView."' || \$buttonName === '".$targetViews."') && \$user->authorise('core.edit', 'com_".$this->fileContentStatic['###component###']."') && \$app->isAdmin()) // TODO for now only in admin area.";
|
||||
}
|
||||
$addButton[] = "\t\t\t{";
|
||||
$addButton[] = "\t\t\t\t//".$this->setLine(__LINE__)." build edit button";
|
||||
@ -8135,7 +8137,7 @@ class Interpretation extends Fields
|
||||
if (ComponentbuilderHelper::checkArray($target))
|
||||
{
|
||||
// set the required var
|
||||
if($target['required'] == 'yes')
|
||||
if($target['required'] === 'yes')
|
||||
{
|
||||
$unique = $uniqueVar.$this->uniquekey(3);
|
||||
$bucket[$target['name']]['requiredVar'] = "jform_".$unique."_required = false;\n";
|
||||
@ -8151,7 +8153,7 @@ class Interpretation extends Fields
|
||||
// target a class if this is a note or spacer
|
||||
$targetType = ".";
|
||||
}
|
||||
elseif ($target['type'] == 'editor')
|
||||
elseif ($target['type'] === 'editor')
|
||||
{
|
||||
// target the label if editor field
|
||||
$targetType = "#jform_";
|
||||
@ -8168,7 +8170,7 @@ class Interpretation extends Fields
|
||||
// set the target default
|
||||
$bucket[$target['name']]['default'] = "\n\t\tjQuery('".$targetType.$target['name'].$targetTypeSufix."').closest('.control-group').".$targetDefault."();";
|
||||
// the hide required function
|
||||
if($target['required'] == 'yes')
|
||||
if($target['required'] === 'yes')
|
||||
{
|
||||
$hide = "\n\t\tif (!jform_".$unique."_required)";
|
||||
$hide .= "\n\t\t{";
|
||||
@ -8547,16 +8549,16 @@ class Interpretation extends Fields
|
||||
$select = '';
|
||||
$isArray = false;
|
||||
$keyName = $name.'_'.$unique;
|
||||
if ($type == 'checkboxes' || $extends == 'checkboxes')
|
||||
if ($type === 'checkboxes' || $extends === 'checkboxes')
|
||||
{
|
||||
$select = "var ".$keyName." = [];\n\tjQuery('#jform_".$name." input[type=checkbox]').each(function()\n\t{\n\t\tif (jQuery(this).is(':checked'))\n\t\t{\n\t\t\t".$keyName.".push(jQuery(this).prop('value'));\n\t\t}\n\t});";
|
||||
$isArray = true;
|
||||
}
|
||||
elseif($type == 'checkbox')
|
||||
elseif($type === 'checkbox')
|
||||
{
|
||||
$select = 'var '.$keyName.' = jQuery("#jform_'.$name.'").prop(\'checked\');';
|
||||
}
|
||||
elseif ($type == 'radio')
|
||||
elseif ($type === 'radio')
|
||||
{
|
||||
$select = 'var '.$keyName.' = jQuery("#jform_'.$name.' input[type=\'radio\']:checked").val();';
|
||||
}
|
||||
@ -8565,7 +8567,7 @@ class Interpretation extends Fields
|
||||
// this is only since 3.3.4
|
||||
$select = 'var '.$keyName.' = jQuery("#jform_'.$name.'_id").val();';
|
||||
}
|
||||
elseif ($type == 'list' || ComponentbuilderHelper::typeField($type, 'dynamic') || !ComponentbuilderHelper::typeField($type))
|
||||
elseif ($type === 'list' || ComponentbuilderHelper::typeField($type, 'dynamic') || !ComponentbuilderHelper::typeField($type))
|
||||
{
|
||||
$select = 'var '.$keyName.' = jQuery("#jform_'.$name.'").val();';
|
||||
$isArray = true;
|
||||
@ -8582,15 +8584,15 @@ class Interpretation extends Fields
|
||||
$clear = '';
|
||||
$isArray = false;
|
||||
$keyName = $name.'_'.$unique;
|
||||
if($type == 'text' || $type == 'password' || $type == 'textarea')
|
||||
if($type === 'text' || $type === 'password' || $type === 'textarea')
|
||||
{
|
||||
$clear = "jQuery('#jform_".$name."').value = '';";
|
||||
}
|
||||
elseif($type == 'radio')
|
||||
elseif($type === 'radio')
|
||||
{
|
||||
$clear = "jQuery('#jform_".$name."').checked = false;";
|
||||
}
|
||||
elseif($type == 'checkboxes' || $type == 'checkbox' || $type == 'checkbox')
|
||||
elseif($type === 'checkboxes' || $type === 'checkbox' || $type === 'checkbox')
|
||||
{
|
||||
$clear = "jQuery('#jform_".$name."').selectedIndex = -1;";
|
||||
}
|
||||
@ -8803,7 +8805,7 @@ class Interpretation extends Fields
|
||||
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
|
||||
foreach ($this->filterBuilder[$viewName_list] as $filter)
|
||||
{
|
||||
if ($filter['type'] != 'category' && ComponentbuilderHelper::checkArray($filter['custom']) && $filter['custom']['extends'] == 'user')
|
||||
if ($filter['type'] != 'category' && ComponentbuilderHelper::checkArray($filter['custom']) && $filter['custom']['extends'] === 'user')
|
||||
{
|
||||
$function[] = "\n\tprotected function getThe".$filter['function'].ComponentbuilderHelper::safeString($filter['custom']['text'],'F')."Selections()";
|
||||
$function[] = "\t{";
|
||||
@ -8860,7 +8862,7 @@ class Interpretation extends Fields
|
||||
$function[] = "\t\t\t\$batch = array();";
|
||||
$function[] = "\t\t\tforeach (\$results as \$result)";
|
||||
$function[] = "\t\t\t{";
|
||||
if ($filter['custom']['text'] == 'user')
|
||||
if ($filter['custom']['text'] === 'user')
|
||||
{
|
||||
$function[] = "\t\t\t\t\$filter[] = JHtml::_('select.option', \$result->".$filter['custom']['text'].", JFactory::getUser(\$result->".$filter['custom']['text'].")->name);";
|
||||
$function[] = "\t\t\t\t\$batch[] = JHtml::_('select.option', \$result->".$filter['custom']['id'].", JFactory::getUser(\$result->".$filter['custom']['text'].")->name);";
|
||||
@ -8919,7 +8921,7 @@ class Interpretation extends Fields
|
||||
$function[] = "\t\t\t\t//".$this->setLine(__LINE__)." Now add the ".$filter['code']." and its text to the options array";
|
||||
$function[] = "\t\t\t\t\$filter[] = JHtml::_('select.option', \$".$filter['code'].", JText::_(\$text));";
|
||||
}
|
||||
elseif ($filter['type'] == 'user')
|
||||
elseif ($filter['type'] === 'user')
|
||||
{
|
||||
$function[] = "\t\t\t\t//".$this->setLine(__LINE__)." Now add the ".$filter['code']." and its text to the options array";
|
||||
$function[] = "\t\t\t\t\$filter[] = JHtml::_('select.option', \$".$filter['code'].", JFactory::getUser(\$".$filter['code'].")->name);";
|
||||
@ -9990,7 +9992,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (!in_array($filter['code'],$donelist))
|
||||
{
|
||||
if ($filter['type'] == 'category')
|
||||
if ($filter['type'] === 'category')
|
||||
{
|
||||
$fields .= ",\n\t\t\t\t'c.title','category_title'";
|
||||
$fields .= ",\n\t\t\t\t'c.id', 'category_id'";
|
||||
@ -10019,7 +10021,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (!in_array($filter['code'],$donelist))
|
||||
{
|
||||
if ($filter['type'] == 'category')
|
||||
if ($filter['type'] === 'category')
|
||||
{
|
||||
$fields .= ",\n\t\t\t\t'c.title','category_title'";
|
||||
$fields .= ",\n\t\t\t\t'c.id', 'category_id'";
|
||||
@ -10067,7 +10069,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (!in_array($filter['code'],$donelist))
|
||||
{
|
||||
if ($filter['type'] == 'category')
|
||||
if ($filter['type'] === 'category')
|
||||
{
|
||||
$stored .= "\n\t\t\$id .= ':' . \$this->getState('filter.category');";
|
||||
$stored .= "\n\t\t\$id .= ':' . \$this->getState('filter.category_id');";
|
||||
@ -10096,7 +10098,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (!in_array($filter['code'],$donelist))
|
||||
{
|
||||
if ($filter['type'] == 'category')
|
||||
if ($filter['type'] === 'category')
|
||||
{
|
||||
$stored .= "\n\t\t\$id .= ':' . \$this->getState('filter.category');";
|
||||
$stored .= "\n\t\t\$id .= ':' . \$this->getState('filter.category_id');";
|
||||
@ -10308,7 +10310,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (!in_array($filter['code'],$donelist))
|
||||
{
|
||||
if ($filter['type'] == 'category')
|
||||
if ($filter['type'] === 'category')
|
||||
{
|
||||
if (strlen($state) == 0)
|
||||
{
|
||||
@ -10359,7 +10361,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (!in_array($filter['code'],$donelist))
|
||||
{
|
||||
if ($filter['type'] == 'category')
|
||||
if ($filter['type'] === 'category')
|
||||
{
|
||||
if (strlen($state) == 0)
|
||||
{
|
||||
@ -10424,7 +10426,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (!in_array($filter['code'], $donelist))
|
||||
{
|
||||
if ($filter['type'] == 'category')
|
||||
if ($filter['type'] === 'category')
|
||||
{
|
||||
$fields .= ",\n\t\t\t'c.category_title' => JText::_('".$filter['lang']."')";
|
||||
}
|
||||
@ -10591,7 +10593,7 @@ class Interpretation extends Fields
|
||||
break;
|
||||
}
|
||||
|
||||
if ($item['type'] == 'usergroup' && !$export)
|
||||
if ($item['type'] === 'usergroup' && !$export)
|
||||
{
|
||||
$fix .= "\n\t".$tab."\t\t\t//".$this->setLine(__LINE__)." decode ".$item['name'];
|
||||
$fix .= "\n\t".$tab."\t\t\t\$".$item['name']."Array = ".$decode."(\$item->".$item['name'].$suffix_decode.");";
|
||||
@ -10614,7 +10616,7 @@ class Interpretation extends Fields
|
||||
$fix .= "\n\t".$tab."\t\t\t\t\$item->".$item['name']." = \$".$item['name']."Names;";
|
||||
$fix .= "\n\t".$tab."\t\t\t}";
|
||||
}
|
||||
/*elseif ($item['type'] == 'usergroup' && $export)
|
||||
/*elseif ($item['type'] === 'usergroup' && $export)
|
||||
{
|
||||
$fix .= "\n\t".$tab."\t\t\t//".$this->setLine(__LINE__)." decode ".$item['name'];
|
||||
$fix .= "\n\t".$tab."\t\t\t\$".$item['name']."Array = ".$decode."(\$item->".$item['name'].$suffix_decode.");";
|
||||
@ -10680,7 +10682,7 @@ class Interpretation extends Fields
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($export && $item['type'] == 'repeatable')
|
||||
if ($export && $item['type'] === 'repeatable')
|
||||
{
|
||||
$fix .= "\n\t".$tab."\t\t\t//".$this->setLine(__LINE__)." decode repeatable ".$item['name'];
|
||||
$fix .= "\n\t".$tab."\t\t\t\$".$item['name']."Array = ".$decode."(\$item->".$item['name'].$suffix_decode.");";
|
||||
@ -10825,7 +10827,7 @@ class Interpretation extends Fields
|
||||
if (ComponentbuilderHelper::checkArray($values))
|
||||
{
|
||||
$fix .= "\n\t\t//".$this->setLine(__LINE__)." Array of ".$name." language strings";
|
||||
$fix .= "\n\t\tif (\$name == '".$name."')";
|
||||
$fix .= "\n\t\tif (\$name === '".$name."')";
|
||||
$fix .= "\n\t\t{";
|
||||
$fix .= "\n\t\t\t\$".$name."Array = array(";
|
||||
$counter = 0;
|
||||
@ -11348,7 +11350,7 @@ class Interpretation extends Fields
|
||||
// set the code name
|
||||
$codeName = ComponentbuilderHelper::safeString($this->componentData->name_code);
|
||||
// set dashboard
|
||||
$menus .= "JHtmlSidebar::addEntry(JText::_('".$lang."_DASHBOARD'), 'index.php?option=com_".$codeName."&view=".$codeName."', \$submenu == '".$codeName."');";
|
||||
$menus .= "JHtmlSidebar::addEntry(JText::_('".$lang."_DASHBOARD'), 'index.php?option=com_".$codeName."&view=".$codeName."', \$submenu === '".$codeName."');";
|
||||
$this->langContent[$this->lang][$lang.'_DASHBOARD'] = 'Dashboard';
|
||||
$catArray = array();
|
||||
foreach ($this->componentData->admin_views as $view)
|
||||
@ -11376,7 +11378,7 @@ class Interpretation extends Fields
|
||||
}
|
||||
$nameList = ComponentbuilderHelper::safeString($view['settings']->name_list);
|
||||
$nameUpper = ComponentbuilderHelper::safeString($view['settings']->name_list, 'U');
|
||||
$menus .= "\n\t\t".$tab."JHtmlSidebar::addEntry(JText::_('".$lang."_".$nameUpper."'), 'index.php?option=com_".$codeName."&view=".$nameList."', \$submenu == '".$nameList."');";
|
||||
$menus .= "\n\t\t".$tab."JHtmlSidebar::addEntry(JText::_('".$lang."_".$nameUpper."'), 'index.php?option=com_".$codeName."&view=".$nameList."', \$submenu === '".$nameList."');";
|
||||
$this->langContent[$this->lang][$lang."_".$nameUpper] = $view['settings']->name_list;
|
||||
// check if category has another name
|
||||
if (isset($this->catOtherName[$nameList]) && ComponentbuilderHelper::checkArray($this->catOtherName[$nameList]))
|
||||
@ -11389,7 +11391,7 @@ class Interpretation extends Fields
|
||||
}
|
||||
if (isset($this->categoryBuilder[$nameList]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$nameList]) && !in_array($otherViews,$catArray))
|
||||
{
|
||||
$menus .= "\n\t\t".$tab."JHtmlSidebar::addEntry(JText::_('".$this->categoryBuilder[$nameList]['name']."'), 'index.php?option=com_categories&view=categories&extension=com_".$codeName.".".$otherViews."', \$submenu == 'categories.".$otherViews."');";
|
||||
$menus .= "\n\t\t".$tab."JHtmlSidebar::addEntry(JText::_('".$this->categoryBuilder[$nameList]['name']."'), 'index.php?option=com_categories&view=categories&extension=com_".$codeName.".".$otherViews."', \$submenu === 'categories.".$otherViews."');";
|
||||
// make sure we add a category only once
|
||||
$catArray[] = $otherViews;
|
||||
}
|
||||
@ -11447,14 +11449,14 @@ class Interpretation extends Fields
|
||||
|
||||
public function setCustomAdminSubMenu(&$view,&$codeName,&$lang,&$nr,&$menu,$type)
|
||||
{
|
||||
if ($type == 'customMenu')
|
||||
if ($type === 'customMenu')
|
||||
{
|
||||
$name = $menu['name'];
|
||||
$nameSingle = ComponentbuilderHelper::safeString($menu['name']);
|
||||
$nameList = ComponentbuilderHelper::safeString($menu['name']);
|
||||
$nameUpper = ComponentbuilderHelper::safeString($menu['name'], 'U');
|
||||
}
|
||||
elseif ($type == 'customView')
|
||||
elseif ($type === 'customView')
|
||||
{
|
||||
$name = $menu['settings']->name;
|
||||
$nameSingle = $menu['settings']->code;
|
||||
@ -11496,13 +11498,13 @@ class Interpretation extends Fields
|
||||
|
||||
$this->langContent[$this->lang][$lang.'_'.$nameUpper] = $name;
|
||||
// add custom menu
|
||||
$custom .= "\n\t\t".$tab."JHtmlSidebar::addEntry(JText::_('".$lang."_".$nameUpper."'), '".$menu['link']."', \$submenu == '".$nameList."');";
|
||||
$custom .= "\n\t\t".$tab."JHtmlSidebar::addEntry(JText::_('".$lang."_".$nameUpper."'), '".$menu['link']."', \$submenu === '".$nameList."');";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->langContent[$this->lang][$lang.'_'.$nameUpper] = $name;
|
||||
// add custom menu
|
||||
$custom .= "\n\t\t".$tab."JHtmlSidebar::addEntry(JText::_('".$lang."_".$nameUpper."'), 'index.php?option=com_".$codeName."&view=".$nameList."', \$submenu == '".$nameList."');";
|
||||
$custom .= "\n\t\t".$tab."JHtmlSidebar::addEntry(JText::_('".$lang."_".$nameUpper."'), 'index.php?option=com_".$codeName."&view=".$nameList."', \$submenu === '".$nameList."');";
|
||||
}
|
||||
// check if the item has permissions.
|
||||
$custom .= "\n\t\t}";
|
||||
@ -11540,13 +11542,13 @@ class Interpretation extends Fields
|
||||
{
|
||||
$this->langContent[$this->lang][$lang.'_'.$nameUpper] = $name;
|
||||
// add custom menu
|
||||
$this->lastCustomSubMenu[$nr] .= "\n\t\t".$tab."JHtmlSidebar::addEntry(JText::_('".$lang."_".$nameUpper."'), '".$menu['link']."', \$submenu == '".$nameList."');";
|
||||
$this->lastCustomSubMenu[$nr] .= "\n\t\t".$tab."JHtmlSidebar::addEntry(JText::_('".$lang."_".$nameUpper."'), '".$menu['link']."', \$submenu === '".$nameList."');";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->langContent[$this->lang][$lang.'_'.$nameUpper] = $name;
|
||||
// add custom menu
|
||||
$this->lastCustomSubMenu[$nr] .= "\n\t\t".$tab."JHtmlSidebar::addEntry(JText::_('".$lang."_".$nameUpper."'), 'index.php?option=com_".$codeName."&view=".$nameList."', \$submenu == '".$nameList."');";
|
||||
$this->lastCustomSubMenu[$nr] .= "\n\t\t".$tab."JHtmlSidebar::addEntry(JText::_('".$lang."_".$nameUpper."'), 'index.php?option=com_".$codeName."&view=".$nameList."', \$submenu === '".$nameList."');";
|
||||
}
|
||||
// check if the item has permissions.
|
||||
$this->lastCustomSubMenu[$nr] .= "\n\t\t}";
|
||||
@ -13224,7 +13226,7 @@ function vdm_dkim() {
|
||||
if (isset($custom_admin_view[$menuController]) && $custom_admin_view[$menuController])
|
||||
{
|
||||
$targetView_ = 'views.';
|
||||
if ($menuController == 'dashboard_add')
|
||||
if ($menuController === 'dashboard_add')
|
||||
{
|
||||
$targetView_ = 'view.';
|
||||
}
|
||||
@ -13308,7 +13310,7 @@ function vdm_dkim() {
|
||||
if ($view[$menuController])
|
||||
{
|
||||
$targetView_ = 'views.';
|
||||
if ($menuController == 'dashboard_add')
|
||||
if ($menuController === 'dashboard_add')
|
||||
{
|
||||
$targetView_ = 'view.';
|
||||
}
|
||||
@ -13340,7 +13342,7 @@ function vdm_dkim() {
|
||||
{
|
||||
foreach ($field['settings']->properties as $property)
|
||||
{
|
||||
if ($property['name'] == 'type')
|
||||
if ($property['name'] === 'type')
|
||||
{
|
||||
$propertyType = $property;
|
||||
}
|
||||
@ -13471,7 +13473,7 @@ function vdm_dkim() {
|
||||
$view['settings']->permissions[] = $versionView;
|
||||
}
|
||||
}
|
||||
if ($type == 'admin')
|
||||
if ($type === 'admin')
|
||||
{
|
||||
// set batch control
|
||||
$batchView['action'] = 'view.batch';
|
||||
@ -13490,7 +13492,7 @@ function vdm_dkim() {
|
||||
{
|
||||
// set acction name
|
||||
$arr = explode('.',trim($permission['action']));
|
||||
if ($arr[0] != 'core' || $arr[0] == 'view')
|
||||
if ($arr[0] != 'core' || $arr[0] === 'view')
|
||||
{
|
||||
array_shift($arr);
|
||||
$actionMain = implode('.',$arr);
|
||||
@ -13498,7 +13500,7 @@ function vdm_dkim() {
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($arr[0] == 'core')
|
||||
if ($arr[0] === 'core')
|
||||
{
|
||||
// core is already set in global access
|
||||
$permission['implementation'] = 1;
|
||||
@ -13510,13 +13512,13 @@ function vdm_dkim() {
|
||||
array_shift($actionNameBuilder);
|
||||
$nameBuilder = trim(implode('___',$actionNameBuilder));
|
||||
$customName = trim(implode(' ',$actionNameBuilder));
|
||||
if ($type == 'admin')
|
||||
if ($type === 'admin')
|
||||
{
|
||||
$W_NameList = ComponentbuilderHelper::safeString($view['settings']->name_list, 'W');
|
||||
$w_NameList = ComponentbuilderHelper::safeString($customName.' '.$view['settings']->name_list, 'w');
|
||||
$w_NameSingle = ComponentbuilderHelper::safeString($view['settings']->name_single, 'w');
|
||||
}
|
||||
elseif ($type == 'customAdmin')
|
||||
elseif ($type === 'customAdmin')
|
||||
{
|
||||
$W_NameList = ComponentbuilderHelper::safeString($view['settings']->name, 'W');
|
||||
$w_NameList = $view['settings']->name;
|
||||
@ -13627,21 +13629,21 @@ function vdm_dkim() {
|
||||
// build permission switch
|
||||
$this->permissionBuilder['global'][$action][$nameView] = $nameView;
|
||||
// dashboard icon checker
|
||||
if ($coreTarget == 'core.access')
|
||||
if ($coreTarget === 'core.access')
|
||||
{
|
||||
$this->permissionDashboard[] = "'" . $nameViews . ".access' => '" . $action . "'";
|
||||
$this->permissionDashboard[] = "'" . $nameView . ".access' => '" . $action . "'";
|
||||
}
|
||||
if ($coreTarget == 'core.create')
|
||||
if ($coreTarget === 'core.create')
|
||||
{
|
||||
$this->permissionDashboard[] = "'" . $nameView . ".create' => '" . $action . "'";
|
||||
}
|
||||
// add menu controll view that has menus options
|
||||
foreach ($menuControllers as $menuController)
|
||||
{
|
||||
if ($coreTarget == 'core.'.$menuController)
|
||||
if ($coreTarget === 'core.'.$menuController)
|
||||
{
|
||||
if ($menuController == 'dashboard_add')
|
||||
if ($menuController === 'dashboard_add')
|
||||
{
|
||||
$this->permissionDashboard[] = "'" . $nameView . ".".$menuController."' => '" . $action . "'";
|
||||
}
|
||||
@ -13663,21 +13665,21 @@ function vdm_dkim() {
|
||||
// build permission switch
|
||||
$this->permissionBuilder['global'][$action][$nameView] = $nameView;
|
||||
// dashboard icon checker
|
||||
if ($coreTarget == 'core.access')
|
||||
if ($coreTarget === 'core.access')
|
||||
{
|
||||
$this->permissionDashboard[] = "'" . $nameViews . ".access' => '" . $action . "'";
|
||||
$this->permissionDashboard[] = "'" . $nameView . ".access' => '" . $action . "'";
|
||||
}
|
||||
if ($coreTarget == 'core.create')
|
||||
if ($coreTarget === 'core.create')
|
||||
{
|
||||
$this->permissionDashboard[] = "'" . $nameView . ".create' => '" . $action . "'";
|
||||
}
|
||||
// add menu controll view that has menus options
|
||||
foreach ($menuControllers as $menuController)
|
||||
{
|
||||
if ($coreTarget == 'core.'.$menuController)
|
||||
if ($coreTarget === 'core.'.$menuController)
|
||||
{
|
||||
if ($menuController == 'dashboard_add')
|
||||
if ($menuController === 'dashboard_add')
|
||||
{
|
||||
$this->permissionDashboard[] = "'" . $nameView . ".".$menuController."' => '" . $action . "'";
|
||||
}
|
||||
@ -13698,13 +13700,13 @@ function vdm_dkim() {
|
||||
public function getFieldName($typeName,$xml,$alias)
|
||||
{
|
||||
// if category then name must be catid (only one per view)
|
||||
if ($typeName == 'category')
|
||||
if ($typeName === 'category')
|
||||
{
|
||||
return 'catid';
|
||||
|
||||
}
|
||||
// if tag is set then enable all tag options for this view (only one per view)
|
||||
elseif ($typeName == 'tag')
|
||||
elseif ($typeName === 'tag')
|
||||
{
|
||||
return 'tags';
|
||||
}
|
||||
@ -13713,7 +13715,7 @@ function vdm_dkim() {
|
||||
{
|
||||
return 'alias';
|
||||
}
|
||||
elseif ($typeName == 'spacer')
|
||||
elseif ($typeName === 'spacer')
|
||||
{
|
||||
// make sure the name is unique
|
||||
return false;
|
||||
@ -13729,7 +13731,7 @@ function vdm_dkim() {
|
||||
// make sure its lower case
|
||||
$typeName = ComponentbuilderHelper::safeString($typeName);
|
||||
|
||||
if ($typeName == 'custom' || $typeName == 'customuser')
|
||||
if ($typeName === 'custom' || $typeName === 'customuser')
|
||||
{
|
||||
$xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml,'type="','"'));
|
||||
}
|
||||
|
@ -92,9 +92,11 @@ class Infusion extends Interpretation
|
||||
|
||||
// ###CREATIONDATE###
|
||||
$this->fileContentStatic['###CREATIONDATE###'] = JFactory::getDate($this->componentData->created)->format('jS F, Y');
|
||||
$this->fileContentStatic['###CREATIONDATE###GLOBAL'] = $this->fileContentStatic['###CREATIONDATE###'];
|
||||
|
||||
// ###BUILDDATE###
|
||||
$this->fileContentStatic['###BUILDDATE###'] = JFactory::getDate()->format('jS F, Y');
|
||||
$this->fileContentStatic['###BUILDDATE###GLOBAL'] = $this->fileContentStatic['###BUILDDATE###'];
|
||||
|
||||
// ###AUTHOR###
|
||||
$this->fileContentStatic['###AUTHOR###'] = trim(JFilterOutput::cleanText($this->componentData->author));
|
||||
@ -113,9 +115,10 @@ class Infusion extends Interpretation
|
||||
|
||||
// ###VERSION###
|
||||
$this->fileContentStatic['###VERSION###'] = trim($this->componentData->component_version);
|
||||
$this->fileContentStatic['###VERSION###GLOBAL'] = $this->fileContentStatic['###VERSION###'];
|
||||
|
||||
// ###Component_name###
|
||||
$this->fileContentStatic['###Component_name###'] = JFilterOutput::cleanText($this->componentData->name);;
|
||||
$this->fileContentStatic['###Component_name###'] = JFilterOutput::cleanText($this->componentData->name);
|
||||
|
||||
// ###SHORT_DISCRIPTION###
|
||||
$this->fileContentStatic['###SHORT_DESCRIPTION###'] = trim(JFilterOutput::cleanText($this->componentData->short_description));
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage componentbuilder.php
|
||||
@ -406,54 +406,58 @@ abstract class ComponentbuilderHelper
|
||||
// load user for access menus
|
||||
$user = JFactory::getUser();
|
||||
// load the submenus to sidebar
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_DASHBOARD'), 'index.php?option=com_componentbuilder&view=componentbuilder', $submenu == 'componentbuilder');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_DASHBOARD'), 'index.php?option=com_componentbuilder&view=componentbuilder', $submenu === 'componentbuilder');
|
||||
// Access control (compiler.submenu).
|
||||
if ($user->authorise('compiler.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_COMPILER'), 'index.php?option=com_componentbuilder&view=compiler', $submenu == 'compiler');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_COMPILER'), 'index.php?option=com_componentbuilder&view=compiler', $submenu === 'compiler');
|
||||
}
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_COMPONENTS'), 'index.php?option=com_componentbuilder&view=components', $submenu == 'components');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_COMPONENTS'), 'index.php?option=com_componentbuilder&view=components', $submenu === 'components');
|
||||
if ($user->authorise('admin_view.access', 'com_componentbuilder') && $user->authorise('admin_view.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_ADMIN_VIEWS'), 'index.php?option=com_componentbuilder&view=admin_views', $submenu == 'admin_views');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_ADMIN_VIEWS'), 'index.php?option=com_componentbuilder&view=admin_views', $submenu === 'admin_views');
|
||||
}
|
||||
if ($user->authorise('custom_admin_view.access', 'com_componentbuilder') && $user->authorise('custom_admin_view.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_CUSTOM_ADMIN_VIEWS'), 'index.php?option=com_componentbuilder&view=custom_admin_views', $submenu == 'custom_admin_views');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_CUSTOM_ADMIN_VIEWS'), 'index.php?option=com_componentbuilder&view=custom_admin_views', $submenu === 'custom_admin_views');
|
||||
}
|
||||
if ($user->authorise('site_view.access', 'com_componentbuilder') && $user->authorise('site_view.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_SITE_VIEWS'), 'index.php?option=com_componentbuilder&view=site_views', $submenu == 'site_views');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_SITE_VIEWS'), 'index.php?option=com_componentbuilder&view=site_views', $submenu === 'site_views');
|
||||
}
|
||||
if ($user->authorise('template.access', 'com_componentbuilder') && $user->authorise('template.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_TEMPLATES'), 'index.php?option=com_componentbuilder&view=templates', $submenu == 'templates');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_TEMPLATES'), 'index.php?option=com_componentbuilder&view=templates', $submenu === 'templates');
|
||||
}
|
||||
if ($user->authorise('layout.access', 'com_componentbuilder') && $user->authorise('layout.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_LAYOUTS'), 'index.php?option=com_componentbuilder&view=layouts', $submenu == 'layouts');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_LAYOUTS'), 'index.php?option=com_componentbuilder&view=layouts', $submenu === 'layouts');
|
||||
}
|
||||
if ($user->authorise('dynamic_get.access', 'com_componentbuilder') && $user->authorise('dynamic_get.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_DYNAMIC_GETS'), 'index.php?option=com_componentbuilder&view=dynamic_gets', $submenu == 'dynamic_gets');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_DYNAMIC_GETS'), 'index.php?option=com_componentbuilder&view=dynamic_gets', $submenu === 'dynamic_gets');
|
||||
}
|
||||
if ($user->authorise('custom_code.access', 'com_componentbuilder') && $user->authorise('custom_code.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_CUSTOM_CODES'), 'index.php?option=com_componentbuilder&view=custom_codes', $submenu === 'custom_codes');
|
||||
}
|
||||
if ($user->authorise('snippet.access', 'com_componentbuilder') && $user->authorise('snippet.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_SNIPPETS'), 'index.php?option=com_componentbuilder&view=snippets', $submenu == 'snippets');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_SNIPPETS'), 'index.php?option=com_componentbuilder&view=snippets', $submenu === 'snippets');
|
||||
}
|
||||
if ($user->authorise('field.access', 'com_componentbuilder') && $user->authorise('field.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_FIELDS'), 'index.php?option=com_componentbuilder&view=fields', $submenu == 'fields');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_FIELD_FIELD_CATEGORY'), 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.fields', $submenu == 'categories.fields');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_FIELDS'), 'index.php?option=com_componentbuilder&view=fields', $submenu === 'fields');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_FIELD_FIELD_CATEGORY'), 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.fields', $submenu === 'categories.fields');
|
||||
}
|
||||
if ($user->authorise('fieldtype.access', 'com_componentbuilder') && $user->authorise('fieldtype.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_FIELDTYPES'), 'index.php?option=com_componentbuilder&view=fieldtypes', $submenu == 'fieldtypes');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_FIELDTYPE_FIELDTYPE_CATEGORY'), 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.fieldtypes', $submenu == 'categories.fieldtypes');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_FIELDTYPES'), 'index.php?option=com_componentbuilder&view=fieldtypes', $submenu === 'fieldtypes');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_FIELDTYPE_FIELDTYPE_CATEGORY'), 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.fieldtypes', $submenu === 'categories.fieldtypes');
|
||||
}
|
||||
if ($user->authorise('help_document.access', 'com_componentbuilder') && $user->authorise('help_document.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_componentbuilder&view=help_documents', $submenu == 'help_documents');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_componentbuilder&view=help_documents', $submenu === 'help_documents');
|
||||
}
|
||||
}
|
||||
|
||||
@ -647,7 +651,7 @@ abstract class ComponentbuilderHelper
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension($a)->setAutoSize(true);
|
||||
$objPHPExcel->getActiveSheet()->getStyle($a.$i)->applyFromArray($headerStyles);
|
||||
$objPHPExcel->getActiveSheet()->getStyle($a.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
} elseif ($a == 'A'){
|
||||
} elseif ($a === 'A'){
|
||||
$objPHPExcel->getActiveSheet()->getStyle($a.$i)->applyFromArray($sideStyles);
|
||||
} else {
|
||||
$objPHPExcel->getActiveSheet()->getStyle($a.$i)->applyFromArray($normalStyles);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage batch_.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage indenter.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage js.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage minify.php
|
||||
|
Reference in New Issue
Block a user