Added lots more demo data on Github to help demonstrate the ease of use. Adding feature to insert custom scripting during install. Adding easy issue tracking, and member notice board. Many bug fixes, to the compiler and general improvements.
This commit is contained in:
@ -10,8 +10,7 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.8
|
||||
@build 30th January, 2016
|
||||
@version 2.2.0
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage compiler.php
|
||||
@ -634,72 +633,92 @@ class Get
|
||||
if ($component->add_css == 1)
|
||||
{
|
||||
$this->customScriptBuilder['component_css'] = base64_decode($component->css);
|
||||
unset($component->css);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->customScriptBuilder['component_css'] = '';
|
||||
}
|
||||
unset($component->css);
|
||||
// set the lang target
|
||||
$this->lang = 'admin';
|
||||
// add PHP in ADMIN
|
||||
$addScriptMethods = array('php_preflight','php_postflight','php_method');
|
||||
$addScriptTypes = array('install','update','uninstall');
|
||||
foreach ($addScriptMethods as $scriptMethod)
|
||||
{
|
||||
foreach ($addScriptTypes as $scriptType)
|
||||
{
|
||||
if (isset($component->{'add_'.$scriptMethod.'_'.$scriptType}) && $component->{'add_'.$scriptMethod.'_'.$scriptType} == 1)
|
||||
{
|
||||
$this->customScriptBuilder[$scriptMethod][$scriptType] = $this->setCustomContentLang(base64_decode($component->{$scriptMethod.'_'.$scriptType}));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->customScriptBuilder[$scriptMethod][$scriptType] = '';
|
||||
}
|
||||
unset($component->{$scriptMethod.'_'.$scriptType});
|
||||
}
|
||||
}
|
||||
// add_php_helper
|
||||
if ($component->add_php_helper_admin == 1)
|
||||
{
|
||||
$this->lang = 'admin';
|
||||
$this->customScriptBuilder['component_php_helper_admin'] = "\n\n".$this->setCustomContentLang(base64_decode($component->php_helper_admin));
|
||||
unset($component->php_helper);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->customScriptBuilder['component_php_helper_admin'] = '';
|
||||
}
|
||||
unset($component->php_helper);
|
||||
// add_admin_event
|
||||
if ($component->add_admin_event == 1)
|
||||
{
|
||||
$this->lang = 'admin';
|
||||
$this->customScriptBuilder['component_php_admin_event'] = $this->setCustomContentLang(base64_decode($component->php_admin_event));
|
||||
unset($component->php_admin_event);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->customScriptBuilder['component_php_admin_event'] = '';
|
||||
}
|
||||
unset($component->php_admin_event);
|
||||
// add_php_helper_site
|
||||
if ($component->add_php_helper_site == 1)
|
||||
{
|
||||
$this->lang = 'site';
|
||||
$this->customScriptBuilder['component_php_helper_site'] = "\n\n".$this->setCustomContentLang(base64_decode($component->php_helper_site));
|
||||
unset($component->php_helper);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->customScriptBuilder['component_php_helper_site'] = '';
|
||||
}
|
||||
unset($component->php_helper);
|
||||
// add_site_event
|
||||
if ($component->add_site_event == 1)
|
||||
{
|
||||
$this->lang = 'site';
|
||||
$this->customScriptBuilder['component_php_site_event'] = $this->setCustomContentLang(base64_decode($component->php_site_event));
|
||||
unset($component->php_site_event);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->customScriptBuilder['component_php_site_event'] = '';
|
||||
}
|
||||
unset($component->php_site_event);
|
||||
// add_sql
|
||||
if ($component->add_sql == 1)
|
||||
{
|
||||
$this->customScriptBuilder['sql']['component_sql'] = base64_decode($component->sql);
|
||||
unset($component->sql);
|
||||
}
|
||||
unset($component->sql);
|
||||
// bom
|
||||
if (ComponentbuilderHelper::checkString($component->bom))
|
||||
{
|
||||
$this->bomPath = $this->compilerPath.'/'.$component->bom;
|
||||
unset($component->bom);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->bomPath = $this->compilerPath.'/default.txt';
|
||||
}
|
||||
unset($component->bom);
|
||||
// README
|
||||
if ($component->addreadme)
|
||||
{
|
||||
@ -713,15 +732,15 @@ class Get
|
||||
// dashboard methods
|
||||
if ($component->add_php_dashboard_methods)
|
||||
{
|
||||
$nowLang = $this->lang;
|
||||
$this->lang = 'admin';
|
||||
// load the php for the dashboard model
|
||||
$component->php_dashboard_methods = base64_decode($component->php_dashboard_methods);
|
||||
$component->php_dashboard_methods = $this->setCustomContentLang(base64_decode($component->php_dashboard_methods));
|
||||
// check if dashboard_tab is set
|
||||
$dashboard_tab = json_decode($component->dashboard_tab,true);
|
||||
if (ComponentbuilderHelper::checkArray($dashboard_tab))
|
||||
{
|
||||
$component->dashboard_tab = array();
|
||||
$nowLang = $this->lang;
|
||||
$this->lang = 'admin';
|
||||
foreach ($dashboard_tab as $option => $values)
|
||||
{
|
||||
foreach ($values as $nr => $value)
|
||||
@ -733,12 +752,12 @@ class Get
|
||||
$component->dashboard_tab[$nr][$option] = $value;
|
||||
}
|
||||
}
|
||||
$this->lang = $nowLang;
|
||||
}
|
||||
else
|
||||
{
|
||||
$component->dashboard_tab = '';
|
||||
}
|
||||
$this->lang = $nowLang;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -10,8 +10,7 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.8
|
||||
@build 30th January, 2016
|
||||
@version 2.2.0
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage compiler.php
|
||||
@ -387,7 +386,7 @@ class Structure extends Get
|
||||
continue;
|
||||
}
|
||||
// if not needed do not add
|
||||
if ($item == 'README.md' && !$README)
|
||||
if (($item == 'README.md' || $item == 'README.txt') && !$README)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -11,8 +11,7 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.8
|
||||
@build 30th January, 2016
|
||||
@version 2.2.0
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage compiler.php
|
||||
@ -766,7 +765,7 @@ class Fields extends Structure
|
||||
$this->setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple, $custom);
|
||||
}
|
||||
// now add to the field set
|
||||
$fieldSet .= $this->setField('custom', $taber, $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray);
|
||||
$fieldSet .= $this->setField('custom', $taber, $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray, $custom);
|
||||
}
|
||||
}
|
||||
return $fieldSet;
|
||||
@ -787,11 +786,12 @@ class Fields extends Structure
|
||||
* @param string $listViewName The list view name
|
||||
* @param array $placeholders The place holder and replace values
|
||||
* @param string $optionArray The option bucket array used to set the field options if needed.
|
||||
* @param arra $custom Used when field is from config
|
||||
*
|
||||
* @return string The field in xml
|
||||
*
|
||||
*/
|
||||
private function setField($setType, $taber, &$fieldAttributes, &$name, &$typeName, &$langView, &$viewName, &$listViewName, $placeholders, &$optionArray)
|
||||
private function setField($setType, $taber, &$fieldAttributes, &$name, &$typeName, &$langView, &$viewName, &$listViewName, $placeholders, &$optionArray, $custom = null)
|
||||
{
|
||||
$fieldSet = '';
|
||||
if ($setType == 'option')
|
||||
@ -1017,6 +1017,16 @@ class Fields extends Structure
|
||||
}
|
||||
}
|
||||
$fieldSet .= "\n\t\t" . $taber . "/>";
|
||||
// incase the field is in the config and has not been set
|
||||
if ('config' == $viewName && 'configs' == $listViewName)
|
||||
{
|
||||
// set lang (just incase)
|
||||
$listLangName = $langView . '_' . ComponentbuilderHelper::safeString($name, 'U');
|
||||
// set the custom array
|
||||
$data = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'custom' => $custom);
|
||||
// set the custom field file
|
||||
$this->setCustomFieldTypeFile($data, $listViewName, $viewName);
|
||||
}
|
||||
}
|
||||
return $fieldSet;
|
||||
}
|
||||
@ -1635,7 +1645,11 @@ class Fields extends Structure
|
||||
{
|
||||
$this->customFieldLinksBuilder[$viewName] = '';
|
||||
}
|
||||
$this->customFieldLinksBuilder[$viewName] .= ',{"sourceColumn": "' . $name . '","targetTable": "' . $custom['table'] . '","targetColumn": "' . $custom['id'] . '","displayColumn": "' . $custom['text'] . '"}';
|
||||
// only load this if table is set
|
||||
if (isset($custom['table']) && ComponentbuilderHelper::checkString($custom['table']))
|
||||
{
|
||||
$this->customFieldLinksBuilder[$viewName] .= ',{"sourceColumn": "' . $name . '","targetTable": "' . $custom['table'] . '","targetColumn": "' . $custom['id'] . '","displayColumn": "' . $custom['text'] . '"}';
|
||||
}
|
||||
// build script switch for user
|
||||
if ($custom['extends'] == 'user')
|
||||
{
|
||||
|
@ -10,8 +10,7 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.8
|
||||
@build 30th January, 2016
|
||||
@version 2.2.0
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage compiler.php
|
||||
@ -2723,7 +2722,7 @@ class Interpretation extends Fields
|
||||
$keyLang = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($custom_button['name'],'U');
|
||||
$keyCode = ComponentbuilderHelper::safeString($custom_button['name']);
|
||||
$this->langContent[$this->lang][$keyLang] = trim($custom_button['name']);
|
||||
// add cpanel button
|
||||
// add cpanel button TODO does not work well on site with permissions
|
||||
$buttons[] = "\t".$tab."\tif (\$this->canDo->get('".$viewName.".".$keyCode."'))";
|
||||
$buttons[] = "\t".$tab."\t{";
|
||||
$buttons[] = "\t".$tab."\t\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button.";
|
||||
@ -3518,6 +3517,160 @@ class Interpretation extends Fields
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function setComponentToContentTypes($action)
|
||||
{
|
||||
$script = '';
|
||||
if (isset($this->componentData->admin_views) && ComponentbuilderHelper::checkArray($this->componentData->admin_views))
|
||||
{
|
||||
// set component name
|
||||
$component = $this->fileContentStatic['###component###'];
|
||||
// reset
|
||||
$dbStuff = array();
|
||||
// start loading the content type data
|
||||
foreach ($this->componentData->admin_views as $viewData)
|
||||
{
|
||||
// set main keys
|
||||
$view = ComponentbuilderHelper::safeString($viewData['settings']->name_single);
|
||||
// set list view keys
|
||||
$views = ComponentbuilderHelper::safeString($viewData['settings']->name_list);
|
||||
// get this views content type data
|
||||
$dbStuff[$view] = $this->getContentType($view, $component);
|
||||
// get the correct views name
|
||||
$checkViews = (isset($this->catCodeBuilder[$view]['views']) && ComponentbuilderHelper::checkString($this->catCodeBuilder[$view]['views'])) ? $this->catCodeBuilder[$view]['views'] : $views;
|
||||
if (ComponentbuilderHelper::checkArray($dbStuff[$view]) && array_key_exists($view, $this->catCodeBuilder) && ($checkViews == $views))
|
||||
{
|
||||
$dbStuff[$view.' catagory'] = $this->getCategoryContentType($view, $views, $component);
|
||||
}
|
||||
elseif(!isset($dbStuff[$view]) || !ComponentbuilderHelper::checkArray($dbStuff[$view]))
|
||||
{
|
||||
// remove if not array
|
||||
unset($dbStuff[$view]);
|
||||
}
|
||||
|
||||
}
|
||||
// build the db insert query
|
||||
if (ComponentbuilderHelper::checkArray($dbStuff))
|
||||
{
|
||||
$taabb = '';
|
||||
if ($action == 'update')
|
||||
{
|
||||
$taabb = "\t";
|
||||
}
|
||||
$script .= "\n\n\t\t\t//".$this->setLine(__LINE__)." Get The Database object";
|
||||
$script .= "\n\t\t\t\$db = JFactory::getDbo();";
|
||||
foreach ($dbStuff as $name => $tables)
|
||||
{
|
||||
if (ComponentbuilderHelper::checkArray($tables))
|
||||
{
|
||||
$code = ComponentbuilderHelper::safeString($name);
|
||||
$script .= "\n\n\t\t\t//".$this->setLine(__LINE__)." Create the ".$name." content type object.";
|
||||
$script .= "\n\t\t\t\$".$code." = new stdClass();";
|
||||
foreach ($tables as $table => $data)
|
||||
{
|
||||
$script .= "\n\t\t\t\$".$code."->".$table." = '".$data."';";
|
||||
}
|
||||
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.";
|
||||
$script .= "\n\t\t\t\$".$code."_id = null;";
|
||||
$script .= "\n\t\t\t\$query = \$db->getQuery(true);";
|
||||
$script .= "\n\t\t\t\$query->select(\$db->quoteName(array('type_id')));";
|
||||
$script .= "\n\t\t\t\$query->from(\$db->quoteName('#__content_types'));";
|
||||
$script .= "\n\t\t\t\$query->where(\$db->quoteName('type_alias') . ' LIKE '. \$db->quote($".$code."->type_alias));";
|
||||
$script .= "\n\t\t\t\$db->setQuery(\$query);";
|
||||
$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')
|
||||
{
|
||||
$script .= "\n\t\t\tif (\$db->getNumRows())";
|
||||
$script .= "\n\t\t\t{";
|
||||
$script .= "\n\t\t\t\t\$".$code."->type_id = \$db->loadResult();";
|
||||
$script .= "\n\t\t\t\t\$".$code."_Updated = \$db->updateObject('#__content_types', \$".$code.", 'type_id');";
|
||||
$script .= "\n\t\t\t}";
|
||||
$script .= "\n\t\t\telse";
|
||||
$script .= "\n\t\t\t{";
|
||||
}
|
||||
$script .= "\n\t\t\t".$taabb."\$".$code."_Inserted = \$db->insertObject('#__content_types', \$".$code.");";
|
||||
if ($action == 'update')
|
||||
{
|
||||
$script .= "\n\t\t\t}";
|
||||
}
|
||||
}
|
||||
}
|
||||
$script .= "\n\n";
|
||||
}
|
||||
}
|
||||
return $script;
|
||||
}
|
||||
|
||||
public function setPostInstallScript()
|
||||
{
|
||||
// reset script
|
||||
$script = $this->setComponentToContentTypes('install');
|
||||
|
||||
// set the component name
|
||||
$component = $this->fileContentStatic['###component###'];
|
||||
|
||||
if (isset($this->paramsBuilder) && ComponentbuilderHelper::checkString($this->paramsBuilder))
|
||||
{
|
||||
if (ComponentbuilderHelper::checkString($script))
|
||||
{
|
||||
$script .= "\n\t\t\t//".$this->setLine(__LINE__)." Install the global extenstion params.";
|
||||
}
|
||||
else
|
||||
{
|
||||
$script .= "\n\t\t\t//".$this->setLine(__LINE__)." Install the global extenstion params.";
|
||||
$script .= "\n\t\t\t\$db = JFactory::getDbo();";
|
||||
}
|
||||
$script .= "\n\t\t\t\$query = \$db->getQuery(true);";
|
||||
$script .= "\n\n\t\t\t//".$this->setLine(__LINE__)." Field to update.";
|
||||
$script .= "\n\t\t\t\$fields = array(";
|
||||
$script .= "\n\t\t\t\t\$db->quoteName('params') . ' = ' . \$db->quote('{".$this->paramsBuilder."}'),";
|
||||
$script .= "\n\t\t\t);";
|
||||
$script .= "\n\n\t\t\t//".$this->setLine(__LINE__)." Condition.";
|
||||
$script .= "\n\t\t\t\$conditions = array(";
|
||||
$script .= "\n\t\t\t\t\$db->quoteName('element') . ' = ' . \$db->quote('com_".$component."')";
|
||||
$script .= "\n\t\t\t);";
|
||||
$script .= "\n\n\t\t\t\$query->update(\$db->quoteName('#__extensions'))->set(\$fields)->where(\$conditions);";
|
||||
$script .= "\n\t\t\t\$db->setQuery(\$query);";
|
||||
$script .= "\n\t\t\t\$allDone = \$db->execute();";
|
||||
}
|
||||
// add the custom script
|
||||
$script .= $this->getCustomScriptBuilder('php_postflight', 'install', "\n\n", null, true);
|
||||
if (ComponentbuilderHelper::checkString($script))
|
||||
{
|
||||
$script .= "\n\t\t\t".'echo \'<a target="_blank" href="'.$this->fileContentStatic['###AUTHORWEBSITE###'].'" title="'.$this->fileContentStatic['###Component_name###'].'">';
|
||||
$script .= "\n\t\t\t\t".'<img src="components/com_'.$component.'/assets/images/component-300.'.$this->componentImageType.'"/>';
|
||||
$script .= "\n\t\t\t\t".'</a>\';';
|
||||
|
||||
return $script;
|
||||
}
|
||||
return "\n\t\t\t//".$this->setLine(__LINE__)." noting to install.";
|
||||
}
|
||||
|
||||
public function setPostUpdateScript()
|
||||
{
|
||||
// reset script
|
||||
$script = $this->setComponentToContentTypes('update');
|
||||
// add the custom script
|
||||
$script .= $this->getCustomScriptBuilder('php_postflight', 'update', "\n\n", null, true);
|
||||
if (isset($this->componentData->admin_views) && ComponentbuilderHelper::checkArray($this->componentData->admin_views))
|
||||
{
|
||||
$script .= "\n\t\t\t".'echo \'<a target="_blank" href="'.$this->fileContentStatic['###AUTHORWEBSITE###'].'" title="'.$this->fileContentStatic['###Component_name###'].'">';
|
||||
$script .= "\n\t\t\t\t".'<img src="components/com_'.$this->fileContentStatic['###component###'].'/assets/images/component-300.'.$this->componentImageType.'"/>';
|
||||
$script .= "\n\t\t\t\t".'</a>';
|
||||
$script .= "\n\t\t\t\t<h3>Upgrade to Version ".$this->fileContentStatic['###VERSION###']." Was Successful! Let us know if anything is not working as expected.</h3>';";
|
||||
}
|
||||
|
||||
if (ComponentbuilderHelper::checkString($script))
|
||||
{
|
||||
return $script;
|
||||
}
|
||||
return "\n\t\t\t//".$this->setLine(__LINE__)." noting to update.";
|
||||
}
|
||||
|
||||
public function setUninstallScript()
|
||||
{
|
||||
@ -3659,161 +3812,11 @@ class Interpretation extends Fields
|
||||
$script .= "\n\t\t}";
|
||||
// done
|
||||
$script .= "\n";
|
||||
|
||||
}
|
||||
// add the custom uninstall script
|
||||
$script .= $this->getCustomScriptBuilder('php_method', 'uninstall', "", null, true, null, "\n");
|
||||
return $script;
|
||||
}
|
||||
|
||||
public function setComponentToContentTypes($action)
|
||||
{
|
||||
$script = '';
|
||||
if (isset($this->componentData->admin_views) && ComponentbuilderHelper::checkArray($this->componentData->admin_views))
|
||||
{
|
||||
// set component name
|
||||
$component = $this->fileContentStatic['###component###'];
|
||||
// reset
|
||||
$dbStuff = array();
|
||||
// start loading the content type data
|
||||
foreach ($this->componentData->admin_views as $viewData)
|
||||
{
|
||||
// set main keys
|
||||
$view = ComponentbuilderHelper::safeString($viewData['settings']->name_single);
|
||||
// set list view keys
|
||||
$views = ComponentbuilderHelper::safeString($viewData['settings']->name_list);
|
||||
// get this views content type data
|
||||
$dbStuff[$view] = $this->getContentType($view, $component);
|
||||
// get the correct views name
|
||||
$checkViews = (isset($this->catCodeBuilder[$view]['views']) && ComponentbuilderHelper::checkString($this->catCodeBuilder[$view]['views'])) ? $this->catCodeBuilder[$view]['views'] : $views;
|
||||
if (ComponentbuilderHelper::checkArray($dbStuff[$view]) && array_key_exists($view, $this->catCodeBuilder) && ($checkViews == $views))
|
||||
{
|
||||
$dbStuff[$view.' catagory'] = $this->getCategoryContentType($view, $views, $component);
|
||||
}
|
||||
elseif(!isset($dbStuff[$view]) || !ComponentbuilderHelper::checkArray($dbStuff[$view]))
|
||||
{
|
||||
// remove if not array
|
||||
unset($dbStuff[$view]);
|
||||
}
|
||||
|
||||
}
|
||||
// build the db insert query
|
||||
if (ComponentbuilderHelper::checkArray($dbStuff))
|
||||
{
|
||||
$taabb = '';
|
||||
if ($action == 'update')
|
||||
{
|
||||
$taabb = "\t";
|
||||
}
|
||||
$script .= "\n\n\t\t\t//".$this->setLine(__LINE__)." Get The Database object";
|
||||
$script .= "\n\t\t\t\$db = JFactory::getDbo();";
|
||||
foreach ($dbStuff as $name => $tables)
|
||||
{
|
||||
if (ComponentbuilderHelper::checkArray($tables))
|
||||
{
|
||||
$code = ComponentbuilderHelper::safeString($name);
|
||||
$script .= "\n\n\t\t\t//".$this->setLine(__LINE__)." Create the ".$name." content type object.";
|
||||
$script .= "\n\t\t\t\$".$code." = new stdClass();";
|
||||
foreach ($tables as $table => $data)
|
||||
{
|
||||
$script .= "\n\t\t\t\$".$code."->".$table." = '".$data."';";
|
||||
}
|
||||
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.";
|
||||
$script .= "\n\t\t\t\$".$code."_id = null;";
|
||||
$script .= "\n\t\t\t\$query = \$db->getQuery(true);";
|
||||
$script .= "\n\t\t\t\$query->select(\$db->quoteName(array('type_id')));";
|
||||
$script .= "\n\t\t\t\$query->from(\$db->quoteName('#__content_types'));";
|
||||
$script .= "\n\t\t\t\$query->where(\$db->quoteName('type_alias') . ' LIKE '. \$db->quote($".$code."->type_alias));";
|
||||
$script .= "\n\t\t\t\$db->setQuery(\$query);";
|
||||
$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')
|
||||
{
|
||||
$script .= "\n\t\t\tif (\$db->getNumRows())";
|
||||
$script .= "\n\t\t\t{";
|
||||
$script .= "\n\t\t\t\t\$".$code."->type_id = \$db->loadResult();";
|
||||
$script .= "\n\t\t\t\t\$".$code."_Updated = \$db->updateObject('#__content_types', \$".$code.", 'type_id');";
|
||||
$script .= "\n\t\t\t}";
|
||||
$script .= "\n\t\t\telse";
|
||||
$script .= "\n\t\t\t{";
|
||||
}
|
||||
$script .= "\n\t\t\t".$taabb."\$".$code."_Inserted = \$db->insertObject('#__content_types', \$".$code.");";
|
||||
if ($action == 'update')
|
||||
{
|
||||
$script .= "\n\t\t\t}";
|
||||
}
|
||||
}
|
||||
}
|
||||
$script .= "\n\n";
|
||||
}
|
||||
}
|
||||
return $script;
|
||||
}
|
||||
|
||||
public function setInstallScript()
|
||||
{
|
||||
// reset script
|
||||
$script = $this->setComponentToContentTypes('install');
|
||||
|
||||
// set the component name
|
||||
$component = $this->fileContentStatic['###component###'];
|
||||
|
||||
if (isset($this->paramsBuilder) && ComponentbuilderHelper::checkString($this->paramsBuilder))
|
||||
{
|
||||
if (ComponentbuilderHelper::checkString($script))
|
||||
{
|
||||
$script .= "\n\t\t\t//".$this->setLine(__LINE__)." Install the global extenstion params.";
|
||||
}
|
||||
else
|
||||
{
|
||||
$script .= "\n\t\t\t//".$this->setLine(__LINE__)." Install the global extenstion params.";
|
||||
$script .= "\n\t\t\t\$db = JFactory::getDbo();";
|
||||
}
|
||||
$script .= "\n\t\t\t\$query = \$db->getQuery(true);";
|
||||
$script .= "\n\n\t\t\t//".$this->setLine(__LINE__)." Field to update.";
|
||||
$script .= "\n\t\t\t\$fields = array(";
|
||||
$script .= "\n\t\t\t\t\$db->quoteName('params') . ' = ' . \$db->quote('{".$this->paramsBuilder."}'),";
|
||||
$script .= "\n\t\t\t);";
|
||||
$script .= "\n\n\t\t\t//".$this->setLine(__LINE__)." Condition.";
|
||||
$script .= "\n\t\t\t\$conditions = array(";
|
||||
$script .= "\n\t\t\t\t\$db->quoteName('element') . ' = ' . \$db->quote('com_".$component."')";
|
||||
$script .= "\n\t\t\t);";
|
||||
$script .= "\n\n\t\t\t\$query->update(\$db->quoteName('#__extensions'))->set(\$fields)->where(\$conditions);";
|
||||
$script .= "\n\t\t\t\$db->setQuery(\$query);";
|
||||
$script .= "\n\t\t\t\$allDone = \$db->execute();";
|
||||
}
|
||||
|
||||
if (ComponentbuilderHelper::checkString($script))
|
||||
{
|
||||
$script .= "\n\t\t\t".'echo \'<a target="_blank" href="'.$this->fileContentStatic['###AUTHORWEBSITE###'].'" title="'.$this->fileContentStatic['###Component_name###'].'">';
|
||||
$script .= "\n\t\t\t\t".'<img src="components/com_'.$component.'/assets/images/component-300.'.$this->componentImageType.'"/>';
|
||||
$script .= "\n\t\t\t\t".'</a>\';';
|
||||
|
||||
return $script;
|
||||
}
|
||||
return "\n\t\t\t//".$this->setLine(__LINE__)." noting to install.";
|
||||
}
|
||||
|
||||
public function setUpdateScript()
|
||||
{
|
||||
// reset script
|
||||
$script = $this->setComponentToContentTypes('update');
|
||||
if (isset($this->componentData->admin_views) && ComponentbuilderHelper::checkArray($this->componentData->admin_views))
|
||||
{
|
||||
$script .= "\n\t\t\t".'echo \'<a target="_blank" href="'.$this->fileContentStatic['###AUTHORWEBSITE###'].'" title="'.$this->fileContentStatic['###Component_name###'].'">';
|
||||
$script .= "\n\t\t\t\t".'<img src="components/com_'.$this->fileContentStatic['###component###'].'/assets/images/component-300.'.$this->componentImageType.'"/>';
|
||||
$script .= "\n\t\t\t\t".'</a>';
|
||||
$script .= "\n\t\t\t\t<h3>Upgrade to Version ".$this->fileContentStatic['###VERSION###']." Was Successful! Let us know if anything is not working as expected.</h3>';";
|
||||
}
|
||||
|
||||
if (ComponentbuilderHelper::checkString($script))
|
||||
{
|
||||
return $script;
|
||||
}
|
||||
return "\n\t\t\t//".$this->setLine(__LINE__)." noting to update.";
|
||||
}
|
||||
|
||||
public function getContentType($view, $component)
|
||||
{
|
||||
@ -5153,7 +5156,7 @@ class Interpretation extends Fields
|
||||
foreach ($this->listBuilder[$viewName_list] as $item)
|
||||
{
|
||||
$checkoutTriger = false;
|
||||
if (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']))
|
||||
if (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']) && isset($item['custom']['table']) && ComponentbuilderHelper::checkString($item['custom']['table']))
|
||||
{
|
||||
$item['id'] = $item['code'];
|
||||
if (!$item['multiple'])
|
||||
@ -5161,13 +5164,13 @@ class Interpretation extends Fields
|
||||
$item['code'] = $item['code'].'_'.$item['custom']['text'];
|
||||
}
|
||||
}
|
||||
// check if translated vlaue is used
|
||||
// check if translated value is used
|
||||
if (isset($this->selectionTranslationFixBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->selectionTranslationFixBuilder[$viewName_list])
|
||||
&& array_key_exists($item['code'],$this->selectionTranslationFixBuilder[$viewName_list]))
|
||||
{
|
||||
$itemCode = '<?php echo JText::_($item->'.$item['code'].'); ?>';
|
||||
}
|
||||
elseif ($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; ?>';
|
||||
}
|
||||
@ -6245,7 +6248,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
$counter++;
|
||||
$checkoutTriger = false;
|
||||
if (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']))
|
||||
if (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']) && isset($item['custom']['table']) && ComponentbuilderHelper::checkString($item['custom']['table']))
|
||||
{
|
||||
$item['id'] = $item['code'];
|
||||
if (!$item['multiple'])
|
||||
@ -6345,7 +6348,7 @@ class Interpretation extends Fields
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (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']."); ?>";
|
||||
@ -7310,7 +7313,7 @@ class Interpretation extends Fields
|
||||
$query .= "\n\t\t\t}";
|
||||
$query .= "\n\t\t\telse";
|
||||
$query .= "\n\t\t\t{";
|
||||
$query .= "\n\t\t\t\t\$search = \$db->quote('%' . \$db->escape(\$search, true) . '%');";
|
||||
$query .= "\n\t\t\t\t\$search = \$db->quote('%' . \$db->escape(\$search) . '%');";
|
||||
$query .= "\n\t\t\t\t\$query->where(".$search.");";
|
||||
$query .= "\n\t\t\t}";
|
||||
$query .= "\n\t\t}";
|
||||
@ -7328,7 +7331,12 @@ class Interpretation extends Fields
|
||||
$query = "";
|
||||
foreach ($this->customBuilder[$viewName_list] as $filter)
|
||||
{
|
||||
if (isset($this->customBuilderList[$viewName_list]) && ComponentbuilderHelper::checkArray($this->customBuilderList[$viewName_list]) && in_array($filter['code'],$this->customBuilderList[$viewName_list]))
|
||||
// only load this if table is set
|
||||
if (isset($this->customBuilderList[$viewName_list])
|
||||
&& ComponentbuilderHelper::checkArray($this->customBuilderList[$viewName_list])
|
||||
&& in_array($filter['code'],$this->customBuilderList[$viewName_list])
|
||||
&& isset($filter['custom']['table'])
|
||||
&& ComponentbuilderHelper::checkString($filter['custom']['table']))
|
||||
{
|
||||
$query .= "\n\n\t\t//".$this->setLine(__LINE__)." From the ".ComponentbuilderHelper::safeString(ComponentbuilderHelper::safeString($filter['custom']['table'],'w'))." table.";
|
||||
$query .= "\n\t\t\$query->select(\$db->quoteName('".$filter['custom']['db'].".".$filter['custom']['text']."','".$filter['code']."_".$filter['custom']['text']."'));";
|
||||
@ -7482,7 +7490,7 @@ class Interpretation extends Fields
|
||||
$filterQuery .= "\n\t\t//".$this->setLine(__LINE__)." Filter by ".$filter['code'].".";
|
||||
$filterQuery .= "\n\t\tif (\$".$filter['code']." = \$this->getState('filter.".$filter['code']."'))";
|
||||
$filterQuery .= "\n\t\t{";
|
||||
$filterQuery .= "\n\t\t\t\$query->where('a.".$filter['code']." = ' . \$db->quote(\$db->escape(\$".$filter['code'].", true)));";
|
||||
$filterQuery .= "\n\t\t\t\$query->where('a.".$filter['code']." = ' . \$db->quote(\$db->escape(\$".$filter['code'].")));";
|
||||
$filterQuery .= "\n\t\t}";
|
||||
|
||||
}
|
||||
@ -7491,7 +7499,7 @@ class Interpretation extends Fields
|
||||
$filterQuery .= "\n\t\t//".$this->setLine(__LINE__)." Filter by ".ucwords($filter['code']).".";
|
||||
$filterQuery .= "\n\t\tif (\$".$filter['code']." = \$this->getState('filter.".$filter['code']."'))";
|
||||
$filterQuery .= "\n\t\t{";
|
||||
$filterQuery .= "\n\t\t\t\$query->where('a.".$filter['code']." = ' . \$db->quote(\$db->escape(\$".$filter['code'].", true)));";
|
||||
$filterQuery .= "\n\t\t\t\$query->where('a.".$filter['code']." = ' . \$db->quote(\$db->escape(\$".$filter['code'].")));";
|
||||
$filterQuery .= "\n\t\t}";
|
||||
}
|
||||
}
|
||||
@ -11553,6 +11561,7 @@ class Interpretation extends Fields
|
||||
foreach ($this->componentData->config as $field)
|
||||
{
|
||||
$xmlField = $this->setDynamicField($field, $view, $viewType, $lang, $viewName, $listViewName, $spacerCounter, $placeholders, $dbkey, false);
|
||||
|
||||
if (ComponentbuilderHelper::checkString($xmlField))
|
||||
{
|
||||
$this->configFieldSetsCustomField[$field['tabname']][] = $xmlField;
|
||||
|
@ -10,8 +10,7 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.8
|
||||
@build 30th January, 2016
|
||||
@version 2.2.0
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage compiler.php
|
||||
@ -159,6 +158,10 @@ class Infusion extends Interpretation
|
||||
|
||||
// ###ADMIN_GLOBAL_EVENT###
|
||||
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT###'] = '';
|
||||
|
||||
// set incase no extra admin files are loaded
|
||||
$this->fileContentStatic['###EXSTRA_ADMIN_FILES###'] = '';
|
||||
|
||||
// now load the data for the global event if needed
|
||||
if ($this->componentData->add_admin_event == 1)
|
||||
{
|
||||
@ -175,6 +178,12 @@ class Infusion extends Interpretation
|
||||
$this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= "\n\t".'}';
|
||||
}
|
||||
|
||||
// now load the readme file if needed
|
||||
if ($this->componentData->addreadme == 1)
|
||||
{
|
||||
$this->fileContentStatic['###EXSTRA_ADMIN_FILES###'] .= "\n\t\t\t<filename>README.txt</filename>";
|
||||
}
|
||||
|
||||
// ###HELPER_CREATEUSER###
|
||||
$this->fileContentStatic['###HELPER_CREATEUSER###'] = $this->setCreateUserHelperMethod($this->componentData->creatuserhelper);
|
||||
|
||||
@ -1001,11 +1010,17 @@ class Infusion extends Interpretation
|
||||
// ###LANG_SITE_SYS###
|
||||
$this->fileContentStatic['###LANG_SITE_SYS###'] = $this->setLangSiteSys();
|
||||
|
||||
// ###INSTALLSCRIPT###
|
||||
$this->fileContentStatic['###INSTALLSCRIPT###'] = $this->setInstallScript();
|
||||
// ###PREINSTALLSCRIPT###
|
||||
$this->fileContentStatic['###PREINSTALLSCRIPT###'] = $this->getCustomScriptBuilder('php_preflight', 'install', "\n", null, true);
|
||||
|
||||
// ###UPDATESCRIPT###
|
||||
$this->fileContentStatic['###UPDATESCRIPT###'] = $this->setUpdateScript();
|
||||
// ###PREUPDATESCRIPT###
|
||||
$this->fileContentStatic['###PREUPDATESCRIPT###'] = $this->getCustomScriptBuilder('php_preflight', 'update', "\n", null, true);
|
||||
|
||||
// ###POSTINSTALLSCRIPT###
|
||||
$this->fileContentStatic['###POSTINSTALLSCRIPT###'] = $this->setPostInstallScript();
|
||||
|
||||
// ###POSTUPDATESCRIPT###
|
||||
$this->fileContentStatic['###POSTUPDATESCRIPT###'] = $this->setPostUpdateScript();
|
||||
|
||||
// ###UNINSTALLSCRIPT###
|
||||
$this->fileContentStatic['###UNINSTALLSCRIPT###'] = $this->setUninstallScript();
|
||||
|
Reference in New Issue
Block a user