Fixed changelog direction so newest changes is listed at top of the file. Finished the init function of super powers. Adds rest function inside super power. Adds super powers to all templates. Updates many helper class methods to now use the utility classes. Adds the method to the component entry file (as-well). Moved most methods from the compiler fields class to powers. #955 Refactored many new builder classes from the registry class. Converted the Content class to two builder classes. Adds option to add additional templates to a module. Resolves #1002 by adding STRING instead of WORD. Ported the FOF encryption class into Powers. https://git.vdm.dev/joomla/fof Changed all CSS and JS to use instead of in compiler code. Adds option to turn jQuery off if UIKIT 3 is added. Adds option to auto write injection boilerplate code in Powers area. Adds option to auto write service provider boilerplate code in the Powers area. Improved the method and all banner locations to fetch from https://git.vdm.dev/joomla/jcb-external/ instead. Major stability improvements all over the new powers complier classes. New [base Registry class](https://git.vdm.dev/joomla/super-powers/src/branch/master/src/7e822c03-1b20-41d1-9427-f5b8d5836af7) has been created specially for JCB. Remember to update all plug-ins with this version update (use the package).

This commit is contained in:
2023-10-18 09:26:30 +02:00
parent a77eac9adf
commit e99899f6f1
632 changed files with 30604 additions and 16888 deletions

View File

@ -120,8 +120,17 @@ class JFormFieldAdminlistvieworderfields extends JFormFieldList
foreach($items as $item)
{
// get the field name (TODO this could slow down the system so we will need to improve on this)
$field_name = ComponentbuilderHelper::safeFieldName(ComponentbuilderHelper::getBetween(json_decode($item->xml),'name="','"'));
$options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]');
if (isset($item->xml) && ComponentbuilderHelper::checkJson($item->xml))
{
$field_xml = json_decode($item->xml);
$field_name = ComponentbuilderHelper::getBetween($field_xml,'name="','"');
$field_name = ComponentbuilderHelper::safeFieldName($field_name);
$options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]');
}
else
{
$options[] = JHtml::_('select.option', $item->id, $item->name . ' [ empty - ' . $item->type . ' ]');
}
}
}
return $options;

View File

@ -49,21 +49,21 @@ class JFormFieldAdminviewsfilteraddcustombutton extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_CUSTOM_BUTTONS') . ' -');
if ($results)
if ($_results)
{
// get admin_viewsmodel
$model = ComponentbuilderHelper::getModel('admin_views');
$results = array_unique($results);
foreach ($results as $add_custom_button)
$_model = ComponentbuilderHelper::getModel('admin_views');
$_results = array_unique($_results);
foreach ($_results as $add_custom_button)
{
// Translate the add_custom_button selection
$text = $model->selectionTranslation($add_custom_button,'add_custom_button');
$_text = $_model->selectionTranslation($add_custom_button,'add_custom_button');
// Now add the add_custom_button and its text to the options array
$_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($text));
$_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldAdminviewsfilteraddcustomimport extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_CUSTOM_IMPORT') . ' -');
if ($results)
if ($_results)
{
// get admin_viewsmodel
$model = ComponentbuilderHelper::getModel('admin_views');
$results = array_unique($results);
foreach ($results as $add_custom_import)
$_model = ComponentbuilderHelper::getModel('admin_views');
$_results = array_unique($_results);
foreach ($_results as $add_custom_import)
{
// Translate the add_custom_import selection
$text = $model->selectionTranslation($add_custom_import,'add_custom_import');
$_text = $_model->selectionTranslation($add_custom_import,'add_custom_import');
// Now add the add_custom_import and its text to the options array
$_filter[] = JHtml::_('select.option', $add_custom_import, JText::_($text));
$_filter[] = JHtml::_('select.option', $add_custom_import, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldAdminviewsfilteraddfadein extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_FADE_IN_AFFECT') . ' -');
if ($results)
if ($_results)
{
// get admin_viewsmodel
$model = ComponentbuilderHelper::getModel('admin_views');
$results = array_unique($results);
foreach ($results as $add_fadein)
$_model = ComponentbuilderHelper::getModel('admin_views');
$_results = array_unique($_results);
foreach ($_results as $add_fadein)
{
// Translate the add_fadein selection
$text = $model->selectionTranslation($add_fadein,'add_fadein');
$_text = $_model->selectionTranslation($add_fadein,'add_fadein');
// Now add the add_fadein and its text to the options array
$_filter[] = JHtml::_('select.option', $add_fadein, JText::_($text));
$_filter[] = JHtml::_('select.option', $add_fadein, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldAdminviewsfilteraddphpajax extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_AJAX') . ' -');
if ($results)
if ($_results)
{
// get admin_viewsmodel
$model = ComponentbuilderHelper::getModel('admin_views');
$results = array_unique($results);
foreach ($results as $add_php_ajax)
$_model = ComponentbuilderHelper::getModel('admin_views');
$_results = array_unique($_results);
foreach ($_results as $add_php_ajax)
{
// Translate the add_php_ajax selection
$text = $model->selectionTranslation($add_php_ajax,'add_php_ajax');
$_text = $_model->selectionTranslation($add_php_ajax,'add_php_ajax');
// Now add the add_php_ajax and its text to the options array
$_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($text));
$_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($_text));
}
}
return $_filter;

View File

@ -49,20 +49,20 @@ class JFormFieldAdminviewsfiltertype extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
if ($results)
if ($_results)
{
// get admin_viewsmodel
$model = ComponentbuilderHelper::getModel('admin_views');
$results = array_unique($results);
foreach ($results as $type)
$_model = ComponentbuilderHelper::getModel('admin_views');
$_results = array_unique($_results);
foreach ($_results as $type)
{
// Translate the type selection
$text = $model->selectionTranslation($type,'type');
$_text = $_model->selectionTranslation($type,'type');
// Now add the type and its text to the options array
$_filter[] = JHtml::_('select.option', $type, JText::_($text));
$_filter[] = JHtml::_('select.option', $type, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldClassextendingsfilterextensiontype extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TYPE') . ' -');
if ($results)
if ($_results)
{
// get class_extendingsmodel
$model = ComponentbuilderHelper::getModel('class_extendings');
$results = array_unique($results);
foreach ($results as $extension_type)
$_model = ComponentbuilderHelper::getModel('class_extendings');
$_results = array_unique($_results);
foreach ($_results as $extension_type)
{
// Translate the extension_type selection
$text = $model->selectionTranslation($extension_type,'extension_type');
$_text = $_model->selectionTranslation($extension_type,'extension_type');
// Now add the extension_type and its text to the options array
$_filter[] = JHtml::_('select.option', $extension_type, JText::_($text));
$_filter[] = JHtml::_('select.option', $extension_type, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldClassmethodsfilterextensiontype extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TYPE') . ' -');
if ($results)
if ($_results)
{
// get class_methodsmodel
$model = ComponentbuilderHelper::getModel('class_methods');
$results = array_unique($results);
foreach ($results as $extension_type)
$_model = ComponentbuilderHelper::getModel('class_methods');
$_results = array_unique($_results);
foreach ($_results as $extension_type)
{
// Translate the extension_type selection
$text = $model->selectionTranslation($extension_type,'extension_type');
$_text = $_model->selectionTranslation($extension_type,'extension_type');
// Now add the extension_type and its text to the options array
$_filter[] = JHtml::_('select.option', $extension_type, JText::_($text));
$_filter[] = JHtml::_('select.option', $extension_type, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldClassmethodsfiltervisibility extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_VISIBILITY') . ' -');
if ($results)
if ($_results)
{
// get class_methodsmodel
$model = ComponentbuilderHelper::getModel('class_methods');
$results = array_unique($results);
foreach ($results as $visibility)
$_model = ComponentbuilderHelper::getModel('class_methods');
$_results = array_unique($_results);
foreach ($_results as $visibility)
{
// Translate the visibility selection
$text = $model->selectionTranslation($visibility,'visibility');
$_text = $_model->selectionTranslation($visibility,'visibility');
// Now add the visibility and its text to the options array
$_filter[] = JHtml::_('select.option', $visibility, JText::_($text));
$_filter[] = JHtml::_('select.option', $visibility, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldClasspropertiesfilterextensiontype extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TYPE') . ' -');
if ($results)
if ($_results)
{
// get class_propertiesmodel
$model = ComponentbuilderHelper::getModel('class_properties');
$results = array_unique($results);
foreach ($results as $extension_type)
$_model = ComponentbuilderHelper::getModel('class_properties');
$_results = array_unique($_results);
foreach ($_results as $extension_type)
{
// Translate the extension_type selection
$text = $model->selectionTranslation($extension_type,'extension_type');
$_text = $_model->selectionTranslation($extension_type,'extension_type');
// Now add the extension_type and its text to the options array
$_filter[] = JHtml::_('select.option', $extension_type, JText::_($text));
$_filter[] = JHtml::_('select.option', $extension_type, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldClasspropertiesfiltervisibility extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_VISIBILITY') . ' -');
if ($results)
if ($_results)
{
// get class_propertiesmodel
$model = ComponentbuilderHelper::getModel('class_properties');
$results = array_unique($results);
foreach ($results as $visibility)
$_model = ComponentbuilderHelper::getModel('class_properties');
$_results = array_unique($_results);
foreach ($_results as $visibility)
{
// Translate the visibility selection
$text = $model->selectionTranslation($visibility,'visibility');
$_text = $_model->selectionTranslation($visibility,'visibility');
// Now add the visibility and its text to the options array
$_filter[] = JHtml::_('select.option', $visibility, JText::_($text));
$_filter[] = JHtml::_('select.option', $visibility, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldCustomadminviewsfilteraddcustombutton extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_CUSTOM_BUTTONS') . ' -');
if ($results)
if ($_results)
{
// get custom_admin_viewsmodel
$model = ComponentbuilderHelper::getModel('custom_admin_views');
$results = array_unique($results);
foreach ($results as $add_custom_button)
$_model = ComponentbuilderHelper::getModel('custom_admin_views');
$_results = array_unique($_results);
foreach ($_results as $add_custom_button)
{
// Translate the add_custom_button selection
$text = $model->selectionTranslation($add_custom_button,'add_custom_button');
$_text = $_model->selectionTranslation($add_custom_button,'add_custom_button');
// Now add the add_custom_button and its text to the options array
$_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($text));
$_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldCustomadminviewsfilteraddphpajax extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_AJAX') . ' -');
if ($results)
if ($_results)
{
// get custom_admin_viewsmodel
$model = ComponentbuilderHelper::getModel('custom_admin_views');
$results = array_unique($results);
foreach ($results as $add_php_ajax)
$_model = ComponentbuilderHelper::getModel('custom_admin_views');
$_results = array_unique($_results);
foreach ($_results as $add_php_ajax)
{
// Translate the add_php_ajax selection
$text = $model->selectionTranslation($add_php_ajax,'add_php_ajax');
$_text = $_model->selectionTranslation($add_php_ajax,'add_php_ajax');
// Now add the add_php_ajax and its text to the options array
$_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($text));
$_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldCustomcodesfiltercommenttype extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_COMMENT_TYPE_USED_IN_PLACEHOLDER') . ' -');
if ($results)
if ($_results)
{
// get custom_codesmodel
$model = ComponentbuilderHelper::getModel('custom_codes');
$results = array_unique($results);
foreach ($results as $comment_type)
$_model = ComponentbuilderHelper::getModel('custom_codes');
$_results = array_unique($_results);
foreach ($_results as $comment_type)
{
// Translate the comment_type selection
$text = $model->selectionTranslation($comment_type,'comment_type');
$_text = $_model->selectionTranslation($comment_type,'comment_type');
// Now add the comment_type and its text to the options array
$_filter[] = JHtml::_('select.option', $comment_type, JText::_($text));
$_filter[] = JHtml::_('select.option', $comment_type, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldCustomcodesfiltertarget extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TARGET') . ' -');
if ($results)
if ($_results)
{
// get custom_codesmodel
$model = ComponentbuilderHelper::getModel('custom_codes');
$results = array_unique($results);
foreach ($results as $target)
$_model = ComponentbuilderHelper::getModel('custom_codes');
$_results = array_unique($_results);
foreach ($_results as $target)
{
// Translate the target selection
$text = $model->selectionTranslation($target,'target');
$_text = $_model->selectionTranslation($target,'target');
// Now add the target and its text to the options array
$_filter[] = JHtml::_('select.option', $target, JText::_($text));
$_filter[] = JHtml::_('select.option', $target, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldCustomcodesfiltertype extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_TYPE') . ' -');
if ($results)
if ($_results)
{
// get custom_codesmodel
$model = ComponentbuilderHelper::getModel('custom_codes');
$results = array_unique($results);
foreach ($results as $type)
$_model = ComponentbuilderHelper::getModel('custom_codes');
$_results = array_unique($_results);
foreach ($_results as $type)
{
// Translate the type selection
$text = $model->selectionTranslation($type,'type');
$_text = $_model->selectionTranslation($type,'type');
// Now add the type and its text to the options array
$_filter[] = JHtml::_('select.option', $type, JText::_($text));
$_filter[] = JHtml::_('select.option', $type, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldDynamicgetsfiltergettype extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_GETTYPE') . ' -');
if ($results)
if ($_results)
{
// get dynamic_getsmodel
$model = ComponentbuilderHelper::getModel('dynamic_gets');
$results = array_unique($results);
foreach ($results as $gettype)
$_model = ComponentbuilderHelper::getModel('dynamic_gets');
$_results = array_unique($_results);
foreach ($_results as $gettype)
{
// Translate the gettype selection
$text = $model->selectionTranslation($gettype,'gettype');
$_text = $_model->selectionTranslation($gettype,'gettype');
// Now add the gettype and its text to the options array
$_filter[] = JHtml::_('select.option', $gettype, JText::_($text));
$_filter[] = JHtml::_('select.option', $gettype, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldDynamicgetsfiltermainsource extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_MAIN_SOURCE') . ' -');
if ($results)
if ($_results)
{
// get dynamic_getsmodel
$model = ComponentbuilderHelper::getModel('dynamic_gets');
$results = array_unique($results);
foreach ($results as $main_source)
$_model = ComponentbuilderHelper::getModel('dynamic_gets');
$_results = array_unique($_results);
foreach ($_results as $main_source)
{
// Translate the main_source selection
$text = $model->selectionTranslation($main_source,'main_source');
$_text = $_model->selectionTranslation($main_source,'main_source');
// Now add the main_source and its text to the options array
$_filter[] = JHtml::_('select.option', $main_source, JText::_($text));
$_filter[] = JHtml::_('select.option', $main_source, JText::_($_text));
}
}
return $_filter;

View File

@ -51,8 +51,17 @@ class JFormFieldFields extends JFormFieldList
foreach($items as $item)
{
// get the field name (TODO this could slow down the system so we will need to improve on this)
$field_name = ComponentbuilderHelper::safeFieldName(ComponentbuilderHelper::getBetween(json_decode($item->xml),'name="','"'));
$options[] = JHtml::_('select.option', $item->id, $item->field_name . ' [ ' . $field_name . ' - ' . $item->type . ' ]');
if (isset($item->xml) && ComponentbuilderHelper::checkJson($item->xml))
{
$field_xml = json_decode($item->xml);
$field_name = ComponentbuilderHelper::getBetween($field_xml,'name="','"');
$field_name = ComponentbuilderHelper::safeFieldName($field_name);
$options[] = JHtml::_('select.option', $item->id, $item->field_name . ' [ ' . $field_name . ' - ' . $item->type . ' ]');
}
else
{
$options[] = JHtml::_('select.option', $item->id, $item->field_name . ' [ empty - ' . $item->type . ' ]');
}
}
}

View File

@ -49,21 +49,21 @@ class JFormFieldFieldsfilterdatatype extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_DATA_TYPE') . ' -');
if ($results)
if ($_results)
{
// get fieldsmodel
$model = ComponentbuilderHelper::getModel('fields');
$results = array_unique($results);
foreach ($results as $datatype)
$_model = ComponentbuilderHelper::getModel('fields');
$_results = array_unique($_results);
foreach ($_results as $datatype)
{
// Translate the datatype selection
$text = $model->selectionTranslation($datatype,'datatype');
$_text = $_model->selectionTranslation($datatype,'datatype');
// Now add the datatype and its text to the options array
$_filter[] = JHtml::_('select.option', $datatype, JText::_($text));
$_filter[] = JHtml::_('select.option', $datatype, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldFieldsfilterindexes extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_INDEXES_TYPE') . ' -');
if ($results)
if ($_results)
{
// get fieldsmodel
$model = ComponentbuilderHelper::getModel('fields');
$results = array_unique($results);
foreach ($results as $indexes)
$_model = ComponentbuilderHelper::getModel('fields');
$_results = array_unique($_results);
foreach ($_results as $indexes)
{
// Translate the indexes selection
$text = $model->selectionTranslation($indexes,'indexes');
$_text = $_model->selectionTranslation($indexes,'indexes');
// Now add the indexes and its text to the options array
$_filter[] = JHtml::_('select.option', $indexes, JText::_($text));
$_filter[] = JHtml::_('select.option', $indexes, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldFieldsfilternullswitch extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_NULL_SWITCH') . ' -');
if ($results)
if ($_results)
{
// get fieldsmodel
$model = ComponentbuilderHelper::getModel('fields');
$results = array_unique($results);
foreach ($results as $null_switch)
$_model = ComponentbuilderHelper::getModel('fields');
$_results = array_unique($_results);
foreach ($_results as $null_switch)
{
// Translate the null_switch selection
$text = $model->selectionTranslation($null_switch,'null_switch');
$_text = $_model->selectionTranslation($null_switch,'null_switch');
// Now add the null_switch and its text to the options array
$_filter[] = JHtml::_('select.option', $null_switch, JText::_($text));
$_filter[] = JHtml::_('select.option', $null_switch, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldFieldsfilterstore extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_MODELING_METHOD') . ' -');
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_MODELLING_METHOD') . ' -');
if ($results)
if ($_results)
{
// get fieldsmodel
$model = ComponentbuilderHelper::getModel('fields');
$results = array_unique($results);
foreach ($results as $store)
$_model = ComponentbuilderHelper::getModel('fields');
$_results = array_unique($_results);
foreach ($_results as $store)
{
// Translate the store selection
$text = $model->selectionTranslation($store,'store');
$_text = $_model->selectionTranslation($store,'store');
// Now add the store and its text to the options array
$_filter[] = JHtml::_('select.option', $store, JText::_($text));
$_filter[] = JHtml::_('select.option', $store, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldHelpdocumentsfilterlocation extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_LOCATION') . ' -');
if ($results)
if ($_results)
{
// get help_documentsmodel
$model = ComponentbuilderHelper::getModel('help_documents');
$results = array_unique($results);
foreach ($results as $location)
$_model = ComponentbuilderHelper::getModel('help_documents');
$_results = array_unique($_results);
foreach ($_results as $location)
{
// Translate the location selection
$text = $model->selectionTranslation($location,'location');
$_text = $_model->selectionTranslation($location,'location');
// Now add the location and its text to the options array
$_filter[] = JHtml::_('select.option', $location, JText::_($text));
$_filter[] = JHtml::_('select.option', $location, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldHelpdocumentsfiltertype extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TYPE') . ' -');
if ($results)
if ($_results)
{
// get help_documentsmodel
$model = ComponentbuilderHelper::getModel('help_documents');
$results = array_unique($results);
foreach ($results as $type)
$_model = ComponentbuilderHelper::getModel('help_documents');
$_results = array_unique($_results);
foreach ($_results as $type)
{
// Translate the type selection
$text = $model->selectionTranslation($type,'type');
$_text = $_model->selectionTranslation($type,'type');
// Now add the type and its text to the options array
$_filter[] = JHtml::_('select.option', $type, JText::_($text));
$_filter[] = JHtml::_('select.option', $type, JText::_($_text));
}
}
return $_filter;

View File

@ -49,13 +49,13 @@ class JFormFieldJoomlacomponentsfilterauthor extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
if ($results)
if ($_results)
{
$results = array_unique($results);
foreach ($results as $author)
$_results = array_unique($_results);
foreach ($_results as $author)
{
// Now add the author and its text to the options array
$_filter[] = JHtml::_('select.option', $author, $author);

View File

@ -49,13 +49,13 @@ class JFormFieldJoomlacomponentsfiltercompanyname extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
if ($results)
if ($_results)
{
$results = array_unique($results);
foreach ($results as $companyname)
$_results = array_unique($_results);
foreach ($_results as $companyname)
{
// Now add the companyname and its text to the options array
$_filter[] = JHtml::_('select.option', $companyname, $companyname);

View File

@ -49,21 +49,21 @@ class JFormFieldJoomlamodulesfiltertarget extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TARGET_AREA') . ' -');
if ($results)
if ($_results)
{
// get joomla_modulesmodel
$model = ComponentbuilderHelper::getModel('joomla_modules');
$results = array_unique($results);
foreach ($results as $target)
$_model = ComponentbuilderHelper::getModel('joomla_modules');
$_results = array_unique($_results);
foreach ($_results as $target)
{
// Translate the target selection
$text = $model->selectionTranslation($target,'target');
$_text = $_model->selectionTranslation($target,'target');
// Now add the target and its text to the options array
$_filter[] = JHtml::_('select.option', $target, JText::_($text));
$_filter[] = JHtml::_('select.option', $target, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldLayoutsfilteraddphpview extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_CUSTOM_VIEW_SCRIPT') . ' -');
if ($results)
if ($_results)
{
// get layoutsmodel
$model = ComponentbuilderHelper::getModel('layouts');
$results = array_unique($results);
foreach ($results as $add_php_view)
$_model = ComponentbuilderHelper::getModel('layouts');
$_results = array_unique($_results);
foreach ($_results as $add_php_view)
{
// Translate the add_php_view selection
$text = $model->selectionTranslation($add_php_view,'add_php_view');
$_text = $_model->selectionTranslation($add_php_view,'add_php_view');
// Now add the add_php_view and its text to the options array
$_filter[] = JHtml::_('select.option', $add_php_view, JText::_($text));
$_filter[] = JHtml::_('select.option', $add_php_view, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldLibrariesfiltertarget extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TARGET_FOLDER') . ' -');
if ($results)
if ($_results)
{
// get librariesmodel
$model = ComponentbuilderHelper::getModel('libraries');
$results = array_unique($results);
foreach ($results as $target)
$_model = ComponentbuilderHelper::getModel('libraries');
$_results = array_unique($_results);
foreach ($_results as $target)
{
// Translate the target selection
$text = $model->selectionTranslation($target,'target');
$_text = $_model->selectionTranslation($target,'target');
// Now add the target and its text to the options array
$_filter[] = JHtml::_('select.option', $target, JText::_($text));
$_filter[] = JHtml::_('select.option', $target, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldLibrariesfiltertype extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TYPE_BEHAVIOR') . ' -');
if ($results)
if ($_results)
{
// get librariesmodel
$model = ComponentbuilderHelper::getModel('libraries');
$results = array_unique($results);
foreach ($results as $type)
$_model = ComponentbuilderHelper::getModel('libraries');
$_results = array_unique($_results);
foreach ($_results as $type)
{
// Translate the type selection
$text = $model->selectionTranslation($type,'type');
$_text = $_model->selectionTranslation($type,'type');
// Now add the type and its text to the options array
$_filter[] = JHtml::_('select.option', $type, JText::_($text));
$_filter[] = JHtml::_('select.option', $type, JText::_($_text));
}
}
return $_filter;

View File

@ -87,8 +87,17 @@ class JFormFieldLinkedviewsorderfields extends JFormFieldList
foreach($items as $item)
{
// get the field name (TODO this could slow down the system so we will need to improve on this)
$field_name = ComponentbuilderHelper::safeFieldName(ComponentbuilderHelper::getBetween(json_decode($item->xml),'name="','"'));
$options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]');
if (isset($item->xml) && ComponentbuilderHelper::checkJson($item->xml))
{
$field_xml = json_decode($item->xml);
$field_name = ComponentbuilderHelper::getBetween($field_xml,'name="','"');
$field_name = ComponentbuilderHelper::safeFieldName($field_name);
$options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]');
}
else
{
$options[] = JHtml::_('select.option', $item->id, $item->name . ' [ empty - ' . $item->type . ' ]');
}
}
}
return $options;

View File

@ -94,8 +94,17 @@ class JFormFieldListfields extends JFormFieldList
foreach($items as $item)
{
// get the field name (TODO this could slow down the system so we will need to improve on this)
$field_name = ComponentbuilderHelper::safeFieldName(ComponentbuilderHelper::getBetween(json_decode($item->xml),'name="','"'));
$options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]');
if (isset($item->xml) && ComponentbuilderHelper::checkJson($item->xml))
{
$field_xml = json_decode($item->xml);
$field_name = ComponentbuilderHelper::getBetween($field_xml,'name="','"');
$field_name = ComponentbuilderHelper::safeFieldName($field_name);
$options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]');
}
else
{
$options[] = JHtml::_('select.option', $item->id, $item->name . ' [ empty - ' . $item->type . ' ]');
}
}
}
return $options;

View File

@ -0,0 +1,81 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Powersclassmethods Form Field class for the Componentbuilder component
*/
class JFormFieldPowersclassmethods extends JFormFieldList
{
/**
* The powersclassmethods field type.
*
* @var string
*/
public $type = 'powersclassmethods';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get the user object.
$user = JFactory::getUser();
// Get the databse object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name','a.visibility'),array('id','method_name','visibility')));
$query->from($db->quoteName('#__componentbuilder_class_method', 'a'));
$query->where($db->quoteName('a.published') . ' >= 1');
$query->where($db->quoteName('a.extension_type') . ' = ' . $db->quote('powers'));
$query->order('a.name ASC');
// Implement View Level Access (if set in table)
if (!$user->authorise('core.options', 'com_componentbuilder'))
{
$columns = $db->getTableColumns('#__componentbuilder_class_method');
if(isset($columns['access']))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
}
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = JHtml::_('select.option', '', 'Select a method');
foreach($items as $item)
{
// we are using this code in more then one field JCB custom_code
if ('method' === 'method')
{
$select = $item->visibility . ' function ' . $item->method_name . '()';
}
else
{
$select = $item->visibility . ' $' . $item->method_name;
}
$options[] = JHtml::_('select.option', $item->id, $select);
}
}
return $options;
}
}

View File

@ -0,0 +1,81 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Powersclassproperties Form Field class for the Componentbuilder component
*/
class JFormFieldPowersclassproperties extends JFormFieldList
{
/**
* The powersclassproperties field type.
*
* @var string
*/
public $type = 'powersclassproperties';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get the user object.
$user = JFactory::getUser();
// Get the databse object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name','a.visibility'),array('id','property_name','visibility')));
$query->from($db->quoteName('#__componentbuilder_class_property', 'a'));
$query->where($db->quoteName('a.published') . ' >= 1');
$query->where($db->quoteName('a.extension_type') . ' = ' . $db->quote('powers'));
$query->order('a.name ASC');
// Implement View Level Access (if set in table)
if (!$user->authorise('core.options', 'com_componentbuilder'))
{
$columns = $db->getTableColumns('#__componentbuilder_class_property');
if(isset($columns['access']))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
}
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = JHtml::_('select.option', '', 'Select a property');
foreach($items as $item)
{
// we are using this code in more then one field JCB custom_code
if ('method' === 'property')
{
$select = $item->visibility . ' function ' . $item->property_name . '()';
}
else
{
$select = $item->visibility . ' $' . $item->property_name;
}
$options[] = JHtml::_('select.option', $item->id, $select);
}
}
return $options;
}
}

View File

@ -49,21 +49,21 @@ class JFormFieldPowersfilterapproved extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_SUPER_POWER') . ' -');
if ($results)
if ($_results)
{
// get powersmodel
$model = ComponentbuilderHelper::getModel('powers');
$results = array_unique($results);
foreach ($results as $approved)
$_model = ComponentbuilderHelper::getModel('powers');
$_results = array_unique($_results);
foreach ($_results as $approved)
{
// Translate the approved selection
$text = $model->selectionTranslation($approved,'approved');
$_text = $_model->selectionTranslation($approved,'approved');
// Now add the approved and its text to the options array
$_filter[] = JHtml::_('select.option', $approved, JText::_($text));
$_filter[] = JHtml::_('select.option', $approved, JText::_($_text));
}
}
return $_filter;

View File

@ -49,20 +49,20 @@ class JFormFieldPowersfiltertype extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
if ($results)
if ($_results)
{
// get powersmodel
$model = ComponentbuilderHelper::getModel('powers');
$results = array_unique($results);
foreach ($results as $type)
$_model = ComponentbuilderHelper::getModel('powers');
$_results = array_unique($_results);
foreach ($_results as $type)
{
// Translate the type selection
$text = $model->selectionTranslation($type,'type');
$_text = $_model->selectionTranslation($type,'type');
// Now add the type and its text to the options array
$_filter[] = JHtml::_('select.option', $type, JText::_($text));
$_filter[] = JHtml::_('select.option', $type, JText::_($_text));
}
}
return $_filter;

View File

@ -49,14 +49,14 @@ class JFormFieldServersfiltername extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_NAME') . ' -');
if ($results)
if ($_results)
{
$results = array_unique($results);
foreach ($results as $name)
$_results = array_unique($_results);
foreach ($_results as $name)
{
// Now add the name and its text to the options array
$_filter[] = JHtml::_('select.option', $name, $name);

View File

@ -49,21 +49,21 @@ class JFormFieldServersfilterprotocol extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_PROTOCOL') . ' -');
if ($results)
if ($_results)
{
// get serversmodel
$model = ComponentbuilderHelper::getModel('servers');
$results = array_unique($results);
foreach ($results as $protocol)
$_model = ComponentbuilderHelper::getModel('servers');
$_results = array_unique($_results);
foreach ($_results as $protocol)
{
// Translate the protocol selection
$text = $model->selectionTranslation($protocol,'protocol');
$_text = $_model->selectionTranslation($protocol,'protocol');
// Now add the protocol and its text to the options array
$_filter[] = JHtml::_('select.option', $protocol, JText::_($text));
$_filter[] = JHtml::_('select.option', $protocol, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldSiteviewsfilteraddcustombutton extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_CUSTOM_BUTTONS') . ' -');
if ($results)
if ($_results)
{
// get site_viewsmodel
$model = ComponentbuilderHelper::getModel('site_views');
$results = array_unique($results);
foreach ($results as $add_custom_button)
$_model = ComponentbuilderHelper::getModel('site_views');
$_results = array_unique($_results);
foreach ($_results as $add_custom_button)
{
// Translate the add_custom_button selection
$text = $model->selectionTranslation($add_custom_button,'add_custom_button');
$_text = $_model->selectionTranslation($add_custom_button,'add_custom_button');
// Now add the add_custom_button and its text to the options array
$_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($text));
$_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldSiteviewsfilteraddphpajax extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_AJAX') . ' -');
if ($results)
if ($_results)
{
// get site_viewsmodel
$model = ComponentbuilderHelper::getModel('site_views');
$results = array_unique($results);
foreach ($results as $add_php_ajax)
$_model = ComponentbuilderHelper::getModel('site_views');
$_results = array_unique($_results);
foreach ($_results as $add_php_ajax)
{
// Translate the add_php_ajax selection
$text = $model->selectionTranslation($add_php_ajax,'add_php_ajax');
$_text = $_model->selectionTranslation($add_php_ajax,'add_php_ajax');
// Now add the add_php_ajax and its text to the options array
$_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($text));
$_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($_text));
}
}
return $_filter;

View File

@ -49,21 +49,21 @@ class JFormFieldTemplatesfilteraddphpview extends JFormFieldList
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_CUSTOM_VIEW_SCRIPT') . ' -');
if ($results)
if ($_results)
{
// get templatesmodel
$model = ComponentbuilderHelper::getModel('templates');
$results = array_unique($results);
foreach ($results as $add_php_view)
$_model = ComponentbuilderHelper::getModel('templates');
$_results = array_unique($_results);
foreach ($_results as $add_php_view)
{
// Translate the add_php_view selection
$text = $model->selectionTranslation($add_php_view,'add_php_view');
$_text = $_model->selectionTranslation($add_php_view,'add_php_view');
// Now add the add_php_view and its text to the options array
$_filter[] = JHtml::_('select.option', $add_php_view, JText::_($text));
$_filter[] = JHtml::_('select.option', $add_php_view, JText::_($_text));
}
}
return $_filter;