forked from joomla/Component-Builder
Update master #1
@ -140,14 +140,14 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 10th September, 2022
|
||||
+ *Last Build*: 14th September, 2022
|
||||
+ *Version*: 3.1.5
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **324186**
|
||||
+ *Line count*: **330282**
|
||||
+ *Field count*: **2002**
|
||||
+ *File count*: **2125**
|
||||
+ *Folder count*: **366**
|
||||
+ *File count*: **2161**
|
||||
+ *Folder count*: **374**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
|
@ -140,14 +140,14 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 10th September, 2022
|
||||
+ *Last Build*: 14th September, 2022
|
||||
+ *Version*: 3.1.5
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **324186**
|
||||
+ *Line count*: **330282**
|
||||
+ *Field count*: **2002**
|
||||
+ *File count*: **2125**
|
||||
+ *Folder count*: **366**
|
||||
+ *File count*: **2161**
|
||||
+ *Folder count*: **374**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
|
@ -498,6 +498,9 @@
|
||||
<action name="power.edit.state" title="COM_COMPONENTBUILDER_POWERS_EDIT_STATE" description="COM_COMPONENTBUILDER_POWERS_EDIT_STATE_DESC" />
|
||||
<action name="power.version" title="COM_COMPONENTBUILDER_POWERS_EDIT_VERSION" description="COM_COMPONENTBUILDER_POWERS_EDIT_VERSION_DESC" />
|
||||
<action name="power.submenu" title="COM_COMPONENTBUILDER_POWERS_SUBMENU" description="COM_COMPONENTBUILDER_POWERS_SUBMENU_DESC" />
|
||||
<action name="search.access" title="COM_COMPONENTBUILDER_SEARCH_ACCESS" description="COM_COMPONENTBUILDER_SEARCH_ACCESS_DESC" />
|
||||
<action name="search.compiler" title="COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS_DESC" />
|
||||
<action name="search.submenu" title="COM_COMPONENTBUILDER_SEARCH_SUBMENU" description="COM_COMPONENTBUILDER_SEARCH_SUBMENU_DESC" />
|
||||
<action name="server.access" title="COM_COMPONENTBUILDER_SERVERS_ACCESS" description="COM_COMPONENTBUILDER_SERVERS_ACCESS_DESC" />
|
||||
<action name="server.batch" title="COM_COMPONENTBUILDER_SERVERS_BATCH_USE" description="COM_COMPONENTBUILDER_SERVERS_BATCH_USE_DESC" />
|
||||
<action name="server.create" title="COM_COMPONENTBUILDER_SERVERS_CREATE" description="COM_COMPONENTBUILDER_SERVERS_CREATE_DESC" />
|
||||
|
13
admin/assets/css/search.css
Normal file
13
admin/assets/css/search.css
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
@ -67,6 +67,8 @@ class ComponentbuilderControllerAjax extends BaseController
|
||||
$this->registerTask('fieldTypeProperties', 'ajax');
|
||||
$this->registerTask('getFieldPropertyDesc', 'ajax');
|
||||
$this->registerTask('getCodeGlueOptions', 'ajax');
|
||||
$this->registerTask('searchTable', 'ajax');
|
||||
$this->registerTask('updateTable', 'ajax');
|
||||
$this->registerTask('snippetDetails', 'ajax');
|
||||
$this->registerTask('setSnippetGithub', 'ajax');
|
||||
$this->registerTask('getSnippets', 'ajax');
|
||||
@ -1631,6 +1633,99 @@ class ComponentbuilderControllerAjax extends BaseController
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'searchTable':
|
||||
try
|
||||
{
|
||||
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
|
||||
$search_valueValue = $jinput->get('search_value', NULL, 'RAW');
|
||||
$match_caseValue = $jinput->get('match_case', 0, 'INT');
|
||||
$whole_wordValue = $jinput->get('whole_word', 0, 'INT');
|
||||
$regex_searchValue = $jinput->get('regex_search', 0, 'INT');
|
||||
$component_idValue = $jinput->get('component_id', 0, 'INT');
|
||||
if($table_nameValue && $user->id != 0 && $search_valueValue)
|
||||
{
|
||||
$result = $this->getModel('ajax')->searchTable($table_nameValue, $search_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback)
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback)
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($e);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'updateTable':
|
||||
try
|
||||
{
|
||||
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
|
||||
$search_valueValue = $jinput->get('search_value', NULL, 'RAW');
|
||||
$replace_valueValue = $jinput->get('replace_value', NULL, 'RAW');
|
||||
$match_caseValue = $jinput->get('match_case', 0, 'INT');
|
||||
$whole_wordValue = $jinput->get('whole_word', 0, 'INT');
|
||||
$regex_searchValue = $jinput->get('regex_search', 0, 'INT');
|
||||
$component_idValue = $jinput->get('component_id', 0, 'INT');
|
||||
if($table_nameValue && $user->id != 0 && $search_valueValue)
|
||||
{
|
||||
$result = $this->getModel('ajax')->updateTable($table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback)
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback)
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($e);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'snippetDetails':
|
||||
try
|
||||
{
|
||||
|
42
admin/controllers/search.php
Normal file
42
admin/controllers/search.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?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');
|
||||
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Componentbuilder Search Base Controller
|
||||
*/
|
||||
class ComponentbuilderControllerSearch extends BaseController
|
||||
{
|
||||
public function __construct($config)
|
||||
{
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
{
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder', false));
|
||||
return;
|
||||
}
|
||||
|
||||
public function openCompiler()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// redirect to the libraries
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=compiler', false));
|
||||
return;
|
||||
}
|
||||
}
|
@ -1307,10 +1307,7 @@ class Get
|
||||
);
|
||||
|
||||
// load the global placeholders
|
||||
if (ArrayHelper::check($this->globalPlaceholders))
|
||||
{
|
||||
CFactory::_('Placeholder')->active = $this->globalPlaceholders;
|
||||
}
|
||||
CFactory::_('Placeholder')->active = CFactory::_('Component.Placeholder')->get();
|
||||
|
||||
// set component sales name
|
||||
$component->sales_name = StringHelper::safe(
|
||||
@ -7567,7 +7564,7 @@ class Get
|
||||
CFactory::_('Config')->build_target = $_backup_target;
|
||||
CFactory::_('Config')->lang_target = $_backup_lang;
|
||||
$this->langPrefix = $_backup_langPrefix;
|
||||
CFactory::_('Config')->set('lang_prefix', $_backup_langPrefix);
|
||||
CFactory::_('Config')->lang_prefix = $_backup_langPrefix;
|
||||
|
||||
unset(
|
||||
CFactory::_('Placeholder')->active[Placefix::_('Module_name')]
|
||||
@ -7816,15 +7813,14 @@ class Get
|
||||
$plugin->official_name = ucwords(
|
||||
$plugin->group . ' - ' . $plugin->name
|
||||
);
|
||||
// set langPrefix
|
||||
$this->langPrefix
|
||||
= PluginHelper::safeLangPrefix(
|
||||
// set lang prefix
|
||||
$plugin->lang_prefix = PluginHelper::safeLangPrefix(
|
||||
$plugin->code_name,
|
||||
$plugin->group
|
||||
);
|
||||
CFactory::_('Config')->set('lang_prefix', $this->langPrefix);
|
||||
// set lang prefix
|
||||
$plugin->lang_prefix = CFactory::_('Config')->lang_prefix;
|
||||
// set langPrefix
|
||||
CFactory::_('Config')->lang_prefix = $plugin->lang_prefix;
|
||||
$this->langPrefix = $plugin->lang_prefix;
|
||||
// set plugin class name
|
||||
$plugin->class_name
|
||||
= PluginHelper::safeClassName(
|
||||
|
@ -3954,7 +3954,7 @@ class Fields extends Structure
|
||||
}
|
||||
// now build the layout
|
||||
if (StringHelper::check($tabName)
|
||||
&& $tabName != 'publishing')
|
||||
&& strtolower($tabName) != 'publishing')
|
||||
{
|
||||
$this->tabCounter[$nameSingleCode][(int) $field['tab']]
|
||||
= $tabName;
|
||||
@ -5032,6 +5032,8 @@ class Fields extends Structure
|
||||
$this->buildSiteFieldData(
|
||||
$nameSingleCode, $name, 'json', $typeName
|
||||
);
|
||||
// add open close method to field data
|
||||
$field['store'] = 'json';
|
||||
break;
|
||||
case 2:
|
||||
// BASE_SIXTY_FOUR
|
||||
@ -5040,6 +5042,8 @@ class Fields extends Structure
|
||||
$this->buildSiteFieldData(
|
||||
$nameSingleCode, $name, 'base64', $typeName
|
||||
);
|
||||
// add open close method to field data
|
||||
$field['store'] = 'base64';
|
||||
break;
|
||||
case 3:
|
||||
// BASIC_ENCRYPTION_LOCALKEY
|
||||
@ -5048,6 +5052,8 @@ class Fields extends Structure
|
||||
$this->buildSiteFieldData(
|
||||
$nameSingleCode, $name, 'basic_encryption', $typeName
|
||||
);
|
||||
// add open close method to field data
|
||||
$field['store'] = 'basic_encryption';
|
||||
break;
|
||||
case 4:
|
||||
// WHMCS_ENCRYPTION_VDMKEY (DUE REMOVAL)
|
||||
@ -5056,6 +5062,8 @@ class Fields extends Structure
|
||||
$this->buildSiteFieldData(
|
||||
$nameSingleCode, $name, 'whmcs_encryption', $typeName
|
||||
);
|
||||
// add open close method to field data
|
||||
$field['store'] = 'whmcs_encryption';
|
||||
break;
|
||||
case 5:
|
||||
// MEDIUM_ENCRYPTION_LOCALFILE
|
||||
@ -5064,6 +5072,8 @@ class Fields extends Structure
|
||||
$this->buildSiteFieldData(
|
||||
$nameSingleCode, $name, 'medium_encryption', $typeName
|
||||
);
|
||||
// add open close method to field data
|
||||
$field['store'] = 'medium_encryption';
|
||||
break;
|
||||
case 6:
|
||||
// EXPERT_MODE
|
||||
@ -5096,6 +5106,8 @@ class Fields extends Structure
|
||||
);
|
||||
// no londer add the json again (already added)
|
||||
$subformJsonSwitch = false;
|
||||
// add open close method to field data
|
||||
$field['store'] = 'json';
|
||||
break;
|
||||
}
|
||||
// just a heads-up for usergroups set to multiple
|
||||
@ -5286,6 +5298,22 @@ class Fields extends Structure
|
||||
$tabName = 'publishing';
|
||||
}
|
||||
$this->setLayoutBuilder($nameSingleCode, $tabName, $name, $field);
|
||||
|
||||
// only load fields we want to search
|
||||
if ($dbSwitch && ComponentbuilderHelper::fieldCheck($typeName, 'search'))
|
||||
{
|
||||
// load a search array of view, field, and [encryption, type, tab]
|
||||
CFactory::_('Registry')->set('all_search_fields.' . $nameSingleCode . '.' . $name,
|
||||
[
|
||||
'name' => $name,
|
||||
'type' => $typeName,
|
||||
'title' => (isset($this->titleBuilder[$nameSingleCode]) && $name === $this->titleBuilder[$nameSingleCode]) ? true : false,
|
||||
'list' => $nameListCode,
|
||||
'store' => (isset($field['store'])) ? $field['store'] : null,
|
||||
'tab_name' => $tabName
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -5384,16 +5412,10 @@ class Fields extends Structure
|
||||
$replace[$replacekey] = $replacevalue;
|
||||
}
|
||||
// load the global placeholders
|
||||
if (ArrayHelper::check($this->globalPlaceholders))
|
||||
{
|
||||
foreach (
|
||||
$this->globalPlaceholders as $globalPlaceholder =>
|
||||
$gloabalValue
|
||||
)
|
||||
foreach (CFactory::_('Component.Placeholder')->get() as $globalPlaceholder => $gloabalValue)
|
||||
{
|
||||
$replace[$globalPlaceholder] = $gloabalValue;
|
||||
}
|
||||
}
|
||||
// start loading the field type
|
||||
$this->fileContentDynamic['customfield_' . $data['type']] = array();
|
||||
// JPREFIX <<<DYNAMIC>>>
|
||||
|
@ -24106,18 +24106,10 @@ class Interpretation extends Fields
|
||||
$placeholders[Placefix::_('views')]
|
||||
= $nameListCode;
|
||||
// load the global placeholders
|
||||
if (ArrayHelper::check(
|
||||
$this->globalPlaceholders
|
||||
))
|
||||
{
|
||||
foreach (
|
||||
$this->globalPlaceholders as $globalPlaceholder =>
|
||||
$gloabalValue
|
||||
)
|
||||
foreach (CFactory::_('Component.Placeholder')->get() as $globalPlaceholder => $gloabalValue)
|
||||
{
|
||||
$placeholders[$globalPlaceholder] = $gloabalValue;
|
||||
}
|
||||
}
|
||||
$view = '';
|
||||
$viewType = 0;
|
||||
// set the custom table key
|
||||
@ -29015,10 +29007,12 @@ function vdm_dkim() {
|
||||
public function getExtensionFieldsetXML(&$extension, &$fields, $dbkey = 'zz'
|
||||
)
|
||||
{
|
||||
// get global placeholders
|
||||
$placeholder = CFactory::_('Component.Placeholder')->get();
|
||||
// build the fieldset
|
||||
return $this->getFieldsetXML(
|
||||
$fields, $extension->lang_prefix, $extension->key, $extension->key,
|
||||
$this->globalPlaceholders, $dbkey
|
||||
$placeholder, $dbkey
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -324,17 +324,13 @@ class Infusion extends Interpretation
|
||||
= $this->addEmailHelper();
|
||||
|
||||
// load the global placeholders
|
||||
if (ArrayHelper::check($this->globalPlaceholders))
|
||||
{
|
||||
foreach (
|
||||
$this->globalPlaceholders as $globalPlaceholder =>
|
||||
foreach (CFactory::_('Component.Placeholder')->get() as $globalPlaceholder =>
|
||||
$gloabalValue
|
||||
)
|
||||
{
|
||||
$this->fileContentStatic[$globalPlaceholder]
|
||||
= $gloabalValue;
|
||||
}
|
||||
$this->fileContentStatic[$globalPlaceholder] = $gloabalValue;
|
||||
}
|
||||
|
||||
// reset view array
|
||||
$viewarray = array();
|
||||
$site_edit_view_array = array();
|
||||
@ -1169,6 +1165,10 @@ class Infusion extends Interpretation
|
||||
CFactory::_('Placeholder')->active = $this->placeholders;
|
||||
}
|
||||
|
||||
// all fields stored in database
|
||||
$this->fileContentStatic[Placefix::_h('ARRAY_ALL_SEARCH_FIELDS')] =
|
||||
CFactory::_('Registry')->varExport('all_search_fields', 1);
|
||||
|
||||
// setup the layouts
|
||||
$this->setCustomViewLayouts();
|
||||
|
||||
|
@ -3550,6 +3550,9 @@ abstract class ComponentbuilderHelper
|
||||
),
|
||||
'special' => array(
|
||||
'contentlanguage', 'moduleposition', 'plugin', 'repeatable', 'subform'
|
||||
),
|
||||
'search' => array(
|
||||
'editor', 'email', 'tel', 'text', 'textarea', 'url', 'subform'
|
||||
)
|
||||
);
|
||||
|
||||
@ -6318,6 +6321,11 @@ abstract class ComponentbuilderHelper
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_COMPILER'), 'index.php?option=com_componentbuilder&view=compiler', $submenu === 'compiler');
|
||||
}
|
||||
// Access control (search.submenu).
|
||||
if ($user->authorise('search.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_SEARCH'), 'index.php?option=com_componentbuilder&view=search', $submenu === 'search');
|
||||
}
|
||||
if ($user->authorise('joomla_component.access', 'com_componentbuilder') && $user->authorise('joomla_component.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_COMPONENTS'), 'index.php?option=com_componentbuilder&view=joomla_components', $submenu === 'joomla_components');
|
||||
|
@ -1292,6 +1292,7 @@ COM_COMPONENTBUILDER_AJAX="Ajax"
|
||||
COM_COMPONENTBUILDER_ALIAS="Alias"
|
||||
COM_COMPONENTBUILDER_ALIGNMENT="Alignment"
|
||||
COM_COMPONENTBUILDER_ALL="All"
|
||||
COM_COMPONENTBUILDER_ALL_FOUND_INSTANCES_IN_S_WHERE_REPLACED="All found instances in %s where replaced"
|
||||
COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER="All is good, please check again latter."
|
||||
COM_COMPONENTBUILDER_ALL_IS_GOOD_THERE_IS_NO_NOTICE_AT_THIS_TIME="All is good, there is no notice at this time."
|
||||
COM_COMPONENTBUILDER_ALL_OF_THESE_PACKAGES_ARE_A_FULLY_DEVELOPEDMAPPED_COMPONENTS_FOR_JCB_THEY_CAN_BE_SEEN_AS_DEMO_CONTENT_OR_BASE_IMAGES_FROM_WHICH_TO_START_YOUR_PROJECTBR_ALWAYS_MAKE_SURE_YOU_ARE_ON_THE_LATEST_VERSION_OF_JCB_BEFORE_IMPORTING_ANY_OF_THESE_PACKAGES_SHOULD_ANY_OF_THEM_FAIL_TO_IMPORT_A_S_PLEASE_LET_US_KNOWA="All of these packages are a fully developed/mapped components for JCB. They can be seen as demo content, or base images from which to start your project.<br />Always make sure you are on the latest version of JCB before importing any of these packages, should any of them fail to import <a %s >please let us know</a>."
|
||||
@ -7759,6 +7760,7 @@ COM_COMPONENTBUILDER_MODEL_AFTER_MODELLING="Model (after modelling)"
|
||||
COM_COMPONENTBUILDER_MODEL_BEFORE_MODELLING="Model (before modelling)"
|
||||
COM_COMPONENTBUILDER_MODULE="Module"
|
||||
COM_COMPONENTBUILDER_MODULES="Modules"
|
||||
COM_COMPONENTBUILDER_MORE_SOON="More soon"
|
||||
COM_COMPONENTBUILDER_MOVE="Move"
|
||||
COM_COMPONENTBUILDER_NAME="Name"
|
||||
COM_COMPONENTBUILDER_NAME_ASC="Name (Asc)"
|
||||
@ -7789,6 +7791,7 @@ COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_SINCE_INCORRECT_TYPE_REQUESTED="No cr
|
||||
COM_COMPONENTBUILDER_NO_DESCRIPTION_FOUND="No description found."
|
||||
COM_COMPONENTBUILDER_NO_FILES_LINKED="No Files Linked"
|
||||
COM_COMPONENTBUILDER_NO_FOUND="No Found"
|
||||
COM_COMPONENTBUILDER_NO_INSTANCES_WHERE_FOUND_S="No instances where found %s"
|
||||
COM_COMPONENTBUILDER_NO_ITEM_FOUND="No Item Found"
|
||||
COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY="No keys were found. To add an export key simply open the component, go to the tab called settings, bottom right there is a field called Export Key."
|
||||
COM_COMPONENTBUILDER_NO_LANGUAGES_FOUND="No Languages Found"
|
||||
@ -8138,7 +8141,15 @@ COM_COMPONENTBUILDER_RUN_EXPANSION="Run Expansion"
|
||||
COM_COMPONENTBUILDER_SAVE_SUCCESS="Great! Item successfully saved."
|
||||
COM_COMPONENTBUILDER_SAVE_WARNING="The value already existed so please select another."
|
||||
COM_COMPONENTBUILDER_SBR_YOU_CAN_ADD_A_BGITHUB_ACCESS_TOKENB_TO_COMPONENTBUILDER_GLOBAL_OPTIONS_TO_MAKE_AUTHENTICATED_REQUESTS_TO_GITHUB_AN_ACCESS_TOKEN_WITH_ONLY_PUBLIC_ACCESS_WILL_DO_TO_RETRIEVE_S="%s<br />You can add a <b>gitHub Access Token</b> to Componentbuilder global options to make authenticated requests to gitHub. An access token with only public access will do to retrieve %s."
|
||||
COM_COMPONENTBUILDER_SEARCH="Search"
|
||||
COM_COMPONENTBUILDER_SEARCHABLE="Searchable"
|
||||
COM_COMPONENTBUILDER_SEARCH_ACCESS="Search Access"
|
||||
COM_COMPONENTBUILDER_SEARCH_ACCESS_DESC="Allows the users in this group to access search."
|
||||
COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS="Search Compiler Button Access"
|
||||
COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS_DESC="Allows the users in this group to access the compiler button."
|
||||
COM_COMPONENTBUILDER_SEARCH_DESC="JCB Search"
|
||||
COM_COMPONENTBUILDER_SEARCH_SUBMENU="Search Submenu"
|
||||
COM_COMPONENTBUILDER_SEARCH_SUBMENU_DESC="Allows the users in this group to submenu of Search"
|
||||
COM_COMPONENTBUILDER_SEE_ALL_IMPORT_INFO="See All Import Info"
|
||||
COM_COMPONENTBUILDER_SELECTION="selection"
|
||||
COM_COMPONENTBUILDER_SELECT_ADMIN_VIEW="Select Admin View"
|
||||
@ -8957,6 +8968,7 @@ COM_COMPONENTBUILDER_SUBMENU_LAYOUTS="Layouts"
|
||||
COM_COMPONENTBUILDER_SUBMENU_LIBRARIES="Libraries"
|
||||
COM_COMPONENTBUILDER_SUBMENU_PLACEHOLDERS="Placeholders"
|
||||
COM_COMPONENTBUILDER_SUBMENU_POWERS="Powers"
|
||||
COM_COMPONENTBUILDER_SUBMENU_SEARCH="Search"
|
||||
COM_COMPONENTBUILDER_SUBMENU_SERVERS="Servers"
|
||||
COM_COMPONENTBUILDER_SUBMENU_SITE_VIEWS="Site Views"
|
||||
COM_COMPONENTBUILDER_SUBMENU_SNIPPETS="Snippets"
|
||||
@ -9100,6 +9112,7 @@ COM_COMPONENTBUILDER_THERE_ARE_NO_NEW_SNIPPETS_AT_THIS_TIME="There are no new sn
|
||||
COM_COMPONENTBUILDER_THERE_ARE_NO_OUT_OF_DATE_SNIPPETS_AT_THIS_TIME="There are no out of date snippets at this time"
|
||||
COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME="There are no snippets to update at this time"
|
||||
COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_IF_THIS_CONTINUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR_OF_A_TYPE_ERROR_IN_THE_FIELDS_DISPLAY_REQUEST="There has been an error, if this continues please inform your system administrator of a type error in the fields display request!"
|
||||
COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN="There has been an error please try again"
|
||||
COM_COMPONENTBUILDER_THERE_WAS_AN_ERROR_GETTING_THE_PACKAGE_INFO="There was an error getting the package info."
|
||||
COM_COMPONENTBUILDER_THERE_WAS_A_PROBLEM_BNO_VIEW_OR_ID_FOUND_IN_SESSION_OR_VIEW_NOT_ALLOWED_TO_ACCESS_AREAB_WE_COULD_NOT_LOAD_ANY_LINKED_TO_VALUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR="There was a problem, <b>no view or id found in session or view not allowed to access area</b>, we could not load any linked to values. Please inform your system administrator!"
|
||||
COM_COMPONENTBUILDER_THESE_ARE_THE_SAME_PACKAGES_FOUND_ON_A_S_GITHUBA_AND_CAN_BE_IMPORTED_BY_SIMPLY_MAKING_A_SELECTION_AND_THEN_CLICKING_THE_BGET_PACKAGEB_BUTTONBR_SOME_OF_THESE_PACKAGES_WOULD_REQUIRE_A_KEY_SINCE_THEY_ARE_NOT_FREE="These are the same packages found on <a %s >gitHub</a> and can be imported by simply making a selection and then clicking the <b>[Get Package]</b> button.<br />Some of these packages would require a key, since they are not free."
|
||||
@ -9358,6 +9371,7 @@ COM_COMPONENTBUILDER_WEBSITE_S="Website: %s"
|
||||
COM_COMPONENTBUILDER_WE_DID_NOT_CHECK_THE_SNIPPET_IT_SELF_TO_SEE_IF_IT_CHANGED_WE_ONLY_WORK_ON_DATES="We did not check the snippet it self, to see if it changed. We only work on dates."
|
||||
COM_COMPONENTBUILDER_WE_FAILED_TO_MOVE_BSB="We failed to move <b>%s</b>!"
|
||||
COM_COMPONENTBUILDER_WE_FOUND_DYNAMIC_CODE_BALL_IN_ONE_LINEB_AND_IGNORED_IT_PLEASE_REVIEW_S_FOR_MORE_DETAILS="We found dynamic code <b>all in one line</b>, and ignored it! Please review (%s) for more details!"
|
||||
COM_COMPONENTBUILDER_WE_FOUND_SOME_INSTANCES_IN_S="We found some instances in %s"
|
||||
COM_COMPONENTBUILDER_WE_SUCCESSFULLY_MOVED_BSB="We successfully moved <b>%s</b>!"
|
||||
COM_COMPONENTBUILDER_WHILE_WE_DOWNLOAD_ALL_TWENTY_SIX_COMPILER_GIF_ANIMATIONS_RANDOMLY_USED_IN_THE_COMPILER_GUI_DURING_COMPILATION="While we download all 26 compiler GIF animations randomly used in the compiler GUI during compilation"
|
||||
COM_COMPONENTBUILDER_WIKI="Wiki"
|
||||
|
@ -963,6 +963,7 @@ COM_COMPONENTBUILDER_MENU_LAYOUTS="Layouts"
|
||||
COM_COMPONENTBUILDER_MENU_LIBRARIES="Libraries"
|
||||
COM_COMPONENTBUILDER_MENU_PLACEHOLDERS="Placeholders"
|
||||
COM_COMPONENTBUILDER_MENU_POWERS="Powers"
|
||||
COM_COMPONENTBUILDER_MENU_SEARCH="Search"
|
||||
COM_COMPONENTBUILDER_MENU_SITE_VIEWS="Site Views"
|
||||
COM_COMPONENTBUILDER_MENU_SNIPPETS="Snippets"
|
||||
COM_COMPONENTBUILDER_MENU_TEMPLATES="Templates"
|
||||
@ -1017,6 +1018,12 @@ COM_COMPONENTBUILDER_POWERS_SUBMENU="Powers Submenu"
|
||||
COM_COMPONENTBUILDER_POWERS_SUBMENU_DESC="Allows the users in this group to submenu of power"
|
||||
COM_COMPONENTBUILDER_POWER_RUN_EXPANSION_BUTTON_ACCESS="Power Run Expansion Button Access"
|
||||
COM_COMPONENTBUILDER_POWER_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button."
|
||||
COM_COMPONENTBUILDER_SEARCH_ACCESS="Search Access"
|
||||
COM_COMPONENTBUILDER_SEARCH_ACCESS_DESC="Allows the users in this group to access search."
|
||||
COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS="Search Compiler Button Access"
|
||||
COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS_DESC="Allows the users in this group to access the compiler button."
|
||||
COM_COMPONENTBUILDER_SEARCH_SUBMENU="Search Submenu"
|
||||
COM_COMPONENTBUILDER_SEARCH_SUBMENU_DESC="Allows the users in this group to submenu of Search"
|
||||
COM_COMPONENTBUILDER_SERVERS_ACCESS="Servers Access"
|
||||
COM_COMPONENTBUILDER_SERVERS_ACCESS_DESC="Allows the users in this group to access access servers"
|
||||
COM_COMPONENTBUILDER_SERVERS_BATCH_USE="Servers Batch Use"
|
||||
|
@ -14,8 +14,8 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\Registry\Registry;
|
||||
use VDM\Gitea\Gitea;
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory;
|
||||
|
||||
/**
|
||||
* Componentbuilder Ajax List Model
|
||||
@ -3604,6 +3604,82 @@ class ComponentbuilderModelAjax extends ListModel
|
||||
return false;
|
||||
}
|
||||
|
||||
// Used in search
|
||||
/**
|
||||
* Search for value in a table
|
||||
*
|
||||
* @param string $tableName The main table to search
|
||||
* @param string $searchValue The value to search for
|
||||
* @param int $matchCase The switch to control match case
|
||||
* @param int $wholeWord The switch to control whole word
|
||||
* @param int $regexSearch The switch to control regex search
|
||||
* @param int $componentId The option to filter by component
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function searchTable(string $tableName, string $searchValue,
|
||||
int $matchCase, int $wholeWord, int $regexSearch, int $componentId): ?array
|
||||
{
|
||||
// check if this is a valid table
|
||||
if (SearchFactory('Table')->exist($tableName))
|
||||
{
|
||||
// load the configurations
|
||||
SearchFactory('Config')->table_name = $tableName;
|
||||
SearchFactory('Config')->search_value = $searchValue;
|
||||
SearchFactory('Config')->match_case = $matchCase;
|
||||
SearchFactory('Config')->whole_word = $wholeWord;
|
||||
SearchFactory('Config')->regex_search = $regexSearch;
|
||||
SearchFactory('Config')->component_id = $componentId;
|
||||
|
||||
if (($items = SearchFactory('Agent')->find()) !== null)
|
||||
{
|
||||
return ['success' => JText::sprintf('COM_COMPONENTBUILDER_WE_FOUND_SOME_INSTANCES_IN_S', $tableName), 'items' => $items];
|
||||
}
|
||||
|
||||
return ['success' => JText::sprintf('COM_COMPONENTBUILDER_NO_INSTANCES_WHERE_FOUND_S', $tableName)];
|
||||
}
|
||||
|
||||
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
|
||||
}
|
||||
|
||||
/**
|
||||
* Search and replace value in a table
|
||||
*
|
||||
* @param string $tableName The main table to search
|
||||
* @param string $searchValue The value to search for
|
||||
* @param string|null $replaceValue The value to replace search value
|
||||
* @param int $matchCase The switch to control match case
|
||||
* @param int $wholeWord The switch to control whole word
|
||||
* @param int $regexSearch The switch to control regex search
|
||||
* @param int $componentId The option to filter by component
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function updateTable(string $tableName, string $searchValue, ?string $replaceValue = null,
|
||||
int $matchCase, int $wholeWord, int $regexSearch, int $componentId): ?array
|
||||
{
|
||||
// check if this is a valid table
|
||||
if (SearchFactory('Table')->exist($tableName))
|
||||
{
|
||||
// load the configurations
|
||||
SearchFactory('Config')->table_name = $tableName;
|
||||
SearchFactory('Config')->search_value = $searchValue;
|
||||
SearchFactory('Config')->replace_value = $replaceValue;
|
||||
SearchFactory('Config')->match_case = $matchCase;
|
||||
SearchFactory('Config')->whole_word = $wholeWord;
|
||||
SearchFactory('Config')->regex_search = $regexSearch;
|
||||
SearchFactory('Config')->component_id = $componentId;
|
||||
|
||||
SearchFactory('Agent')->replace();
|
||||
|
||||
return ['success' => JText::sprintf('COM_COMPONENTBUILDER_ALL_FOUND_INSTANCES_IN_S_WHERE_REPLACED', $tableName)];
|
||||
}
|
||||
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
|
||||
}
|
||||
|
||||
|
||||
// Used in get_snippets
|
||||
|
||||
public function getSnippets($libraries)
|
||||
|
@ -36,6 +36,7 @@ class ComponentbuilderModelComponentbuilder extends ListModel
|
||||
$viewAccess = array(
|
||||
'compiler.submenu' => 'compiler.submenu',
|
||||
'compiler.dashboard_list' => 'compiler.dashboard_list',
|
||||
'search.submenu' => 'search.submenu',
|
||||
'get_snippets.submenu' => 'get_snippets.submenu',
|
||||
'get_snippets.dashboard_list' => 'get_snippets.dashboard_list',
|
||||
'joomla_component.create' => 'joomla_component.create',
|
||||
|
165
admin/models/search.php
Normal file
165
admin/models/search.php
Normal file
@ -0,0 +1,165 @@
|
||||
<?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');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ItemModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory;
|
||||
|
||||
/**
|
||||
* Componentbuilder Search Item Model
|
||||
*/
|
||||
class ComponentbuilderModelSearch extends ItemModel
|
||||
{
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_context = 'com_componentbuilder.search';
|
||||
|
||||
/**
|
||||
* Model user data.
|
||||
*
|
||||
* @var strings
|
||||
*/
|
||||
protected $user;
|
||||
protected $userId;
|
||||
protected $guest;
|
||||
protected $groups;
|
||||
protected $levels;
|
||||
protected $app;
|
||||
protected $input;
|
||||
protected $uikitComp;
|
||||
|
||||
/**
|
||||
* @var object item
|
||||
*/
|
||||
protected $item;
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
$this->app = JFactory::getApplication();
|
||||
$this->input = $this->app->input;
|
||||
// Get the item main id
|
||||
$id = $this->input->getInt('id', null);
|
||||
$this->setState('search.id', $id);
|
||||
|
||||
// Load the parameters.
|
||||
parent::populateState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get article data.
|
||||
*
|
||||
* @param integer $pk The id of the article.
|
||||
*
|
||||
* @return mixed Menu item data object on success, false on failure.
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
$this->user = JFactory::getUser();
|
||||
// check if this user has permission to access item
|
||||
if (!$this->user->authorise('search.access', 'com_componentbuilder'))
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$app->enqueueMessage(JText::_('Not authorised!'), 'error');
|
||||
// redirect away if not a correct to cPanel/default view
|
||||
$app->redirect('index.php?option=com_componentbuilder');
|
||||
return false;
|
||||
}
|
||||
$this->userId = $this->user->get('id');
|
||||
$this->guest = $this->user->get('guest');
|
||||
$this->groups = $this->user->get('groups');
|
||||
$this->authorisedGroups = $this->user->getAuthorisedGroups();
|
||||
$this->levels = $this->user->getAuthorisedViewLevels();
|
||||
$this->initSet = true;
|
||||
|
||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('search.id');
|
||||
|
||||
$pk = $this->userId;
|
||||
|
||||
if ($this->_item === null)
|
||||
{
|
||||
$this->_item = array();
|
||||
}
|
||||
|
||||
if (!isset($this->_item[$pk]))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Get data
|
||||
// load the tables and components (soon)
|
||||
$data = ['tables' => SearchFactory::_('Table')->tables(), 'components' => null];
|
||||
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
// If no data is found redirect to default page and show warning.
|
||||
$app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_NOT_FOUND_OR_ACCESS_DENIED'), 'warning');
|
||||
$app->redirect('index.php?option=com_componentbuilder');
|
||||
return false;
|
||||
}
|
||||
|
||||
// set data object to item.
|
||||
$this->_item[$pk] = $data;
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
if ($e->getCode() == 404)
|
||||
{
|
||||
// Need to go thru the error handler to allow Redirect to work.
|
||||
JError::raiseWarning(404, $e->getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($e);
|
||||
$this->_item[$pk] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_item[$pk];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uikit needed components
|
||||
*
|
||||
* @return mixed An array of objects on success.
|
||||
*
|
||||
*/
|
||||
public function getUikitComp()
|
||||
{
|
||||
if (isset($this->uikitComp) && ComponentbuilderHelper::checkArray($this->uikitComp))
|
||||
{
|
||||
return $this->uikitComp;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
1
admin/views/search/index.html
Normal file
1
admin/views/search/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
52
admin/views/search/tmpl/default.php
Normal file
52
admin/views/search/tmpl/default.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?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');
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
JHtml::_('behavior.formvalidator');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
JHtml::_('behavior.keepalive');
|
||||
?>
|
||||
<?php if ($this->canDo->get('search.access')): ?>
|
||||
<script type="text/javascript">
|
||||
Joomla.submitbutton = function(task) {
|
||||
if (task === 'search.back') {
|
||||
parent.history.back();
|
||||
return false;
|
||||
} else {
|
||||
var form = document.getElementById('adminForm');
|
||||
form.task.value = task;
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php $urlId = (isset($this->item->id)) ? '&id='. (int) $this->item->id : ''; ?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=search' . $urlId); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
|
||||
<?php if(!empty( $this->sidebar)): ?>
|
||||
<div id="j-sidebar-container" class="span2">
|
||||
<?php echo $this->sidebar; ?>
|
||||
</div>
|
||||
<div id="j-main-container" class="span10">
|
||||
<?php else : ?>
|
||||
<div id="j-main-container">
|
||||
<?php endif; ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_MORE_SOON'); ?>
|
||||
</div>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<h1><?php echo JText::_('COM_COMPONENTBUILDER_NO_ACCESS_GRANTED'); ?></h1>
|
||||
<?php endif; ?>
|
||||
|
1
admin/views/search/tmpl/index.html
Normal file
1
admin/views/search/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
150
admin/views/search/view.html.php
Normal file
150
admin/views/search/view.html.php
Normal file
@ -0,0 +1,150 @@
|
||||
<?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');
|
||||
|
||||
use Joomla\CMS\MVC\View\HtmlView;
|
||||
|
||||
/**
|
||||
* Componentbuilder Html View class for the Search
|
||||
*/
|
||||
class ComponentbuilderViewSearch extends HtmlView
|
||||
{
|
||||
// Overwriting JView display method
|
||||
function display($tpl = null)
|
||||
{
|
||||
// get component params
|
||||
$this->params = JComponentHelper::getParams('com_componentbuilder');
|
||||
// get the application
|
||||
$this->app = JFactory::getApplication();
|
||||
// get the user object
|
||||
$this->user = JFactory::getUser();
|
||||
// get global action permissions
|
||||
$this->canDo = ComponentbuilderHelper::getActions('search');
|
||||
// Initialise variables.
|
||||
$this->item = $this->get('Item');
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
// Include helper submenu
|
||||
ComponentbuilderHelper::addSubmenu('search');
|
||||
JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=search');
|
||||
$this->sidebar = JHtmlSidebar::render();
|
||||
}
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
// add the tool bar
|
||||
$this->addToolBar();
|
||||
}
|
||||
|
||||
// set the document
|
||||
$this->setDocument();
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new Exception(implode(PHP_EOL, $errors), 500);
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the document
|
||||
*/
|
||||
protected function setDocument()
|
||||
{
|
||||
|
||||
// always make sure jquery is loaded.
|
||||
JHtml::_('jquery.framework');
|
||||
// Load the header checker class.
|
||||
require_once( JPATH_COMPONENT_ADMINISTRATOR.'/helpers/headercheck.php' );
|
||||
// Initialize the header checker.
|
||||
$HeaderCheck = new componentbuilderHeaderCheck;
|
||||
|
||||
// Load uikit options.
|
||||
$uikit = $this->params->get('uikit_load');
|
||||
// Set script size.
|
||||
$size = $this->params->get('uikit_min');
|
||||
// Set css style.
|
||||
$style = $this->params->get('uikit_style');
|
||||
|
||||
// The uikit css.
|
||||
if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
||||
{
|
||||
JHtml::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']);
|
||||
}
|
||||
// The uikit js.
|
||||
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
||||
{
|
||||
JHtml::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']);
|
||||
}
|
||||
// add the document default css file
|
||||
$this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_componentbuilder/assets/css/search.css', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
*/
|
||||
protected function addToolBar()
|
||||
{
|
||||
// hide the main menu
|
||||
$this->app->input->set('hidemainmenu', true);
|
||||
// set the title
|
||||
if (isset($this->item->name) && $this->item->name)
|
||||
{
|
||||
$title = $this->item->name;
|
||||
}
|
||||
// Check for empty title and add view name if param is set
|
||||
if (empty($title))
|
||||
{
|
||||
$title = JText::_('COM_COMPONENTBUILDER_SEARCH');
|
||||
}
|
||||
// add title to the page
|
||||
JToolbarHelper::title($title,'search');
|
||||
// add cpanel button
|
||||
JToolBarHelper::custom('search.dashboard', 'grid-2', '', 'COM_COMPONENTBUILDER_DASH', false);
|
||||
if ($this->canDo->get('search.compiler'))
|
||||
{
|
||||
// add Compiler button.
|
||||
JToolBarHelper::custom('search.openCompiler', 'cogs custom-button-opencompiler', '', 'COM_COMPONENTBUILDER_COMPILER', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('search');
|
||||
if (ComponentbuilderHelper::checkString($this->help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
JToolBarHelper::preferences('com_componentbuilder');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
*/
|
||||
public function escape($var)
|
||||
{
|
||||
// use the helper htmlEscape method instead.
|
||||
return ComponentbuilderHelper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="4" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>10th September, 2022</creationDate>
|
||||
<creationDate>14th September, 2022</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>joomla@vdm.io</authorEmail>
|
||||
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||
@ -74,6 +74,7 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo
|
||||
<submenu>
|
||||
<!-- Instead of link you can specify individual link attributes -->
|
||||
<menu option="com_componentbuilder" view="compiler">COM_COMPONENTBUILDER_MENU_COMPILER</menu>
|
||||
<menu option="com_componentbuilder" view="search">COM_COMPONENTBUILDER_MENU_SEARCH</menu>
|
||||
<menu option="com_componentbuilder" view="joomla_components">COM_COMPONENTBUILDER_MENU_JOOMLA_COMPONENTS</menu>
|
||||
<menu option="com_componentbuilder" view="joomla_modules">COM_COMPONENTBUILDER_MENU_JOOMLA_MODULES</menu>
|
||||
<menu option="com_componentbuilder" view="joomla_plugins">COM_COMPONENTBUILDER_MENU_JOOMLA_PLUGINS</menu>
|
||||
|
@ -0,0 +1,131 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder;
|
||||
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\Input\Input;
|
||||
use VDM\Joomla\Utilities\Component\Helper;
|
||||
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Configurations
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
abstract class BaseConfig extends Registry
|
||||
{
|
||||
/**
|
||||
* Hold a JInput object for easier access to the input variables.
|
||||
*
|
||||
* @var Input
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected $input;
|
||||
|
||||
/**
|
||||
* The Params
|
||||
*
|
||||
* @var Registry
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Registry $params;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Input|null $input Input
|
||||
* @param Registry|null $params The component parameters
|
||||
*
|
||||
* @throws \Exception
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Input $input = null, ?Registry $params = null)
|
||||
{
|
||||
$this->input = $input ?: Factory::getApplication()->input;
|
||||
$this->params = $params ?: Helper::getParams('com_componentbuilder');
|
||||
|
||||
// use underscore as the separator
|
||||
$this->separator = '_';
|
||||
|
||||
// Instantiate the internal data object.
|
||||
$this->data = new \stdClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* setting any config value
|
||||
*
|
||||
* @param String $key The value's key/path name
|
||||
* @param mixed $value Optional default value, returned if the internal value is null.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __set($key, $value)
|
||||
{
|
||||
$this->set($key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* getting any valid value
|
||||
*
|
||||
* @param String $key The value's key/path name
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @throws \InvalidArgumentException If $key is not a valid function name.
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
// check if it has been set
|
||||
if (($value = $this->get($key, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_')
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException(sprintf('Argument %s could not be found as function [%s], or path.', $key, $method));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a config value.
|
||||
*
|
||||
* @param string $path Registry path (e.g. joomla.content.showauthor)
|
||||
* @param mixed $default Optional default value, returned if the internal value is null.
|
||||
*
|
||||
* @return mixed Value of entry or null
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get($path, $default = null)
|
||||
{
|
||||
// function name with no underscores
|
||||
$method = 'get' . ucfirst(ClassfunctionHelper::safe(str_replace('_', '', $path)));
|
||||
|
||||
// check if it has been set
|
||||
if (($value = parent::get($path, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_')
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
elseif (method_exists($this, $method))
|
||||
{
|
||||
$value = $this->{$method}();
|
||||
|
||||
$this->set($path, $value);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class Placeholder implements PlaceholderInterface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get()
|
||||
public function get(): array
|
||||
{
|
||||
// set only once
|
||||
if (is_array($this->placeholders))
|
||||
|
@ -12,13 +12,9 @@
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler;
|
||||
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\Input\Input;
|
||||
use VDM\Joomla\Utilities\Component\Helper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
|
||||
use VDM\Joomla\Componentbuilder\BaseConfig;
|
||||
|
||||
|
||||
/**
|
||||
@ -26,119 +22,8 @@ use VDM\Joomla\Utilities\String\ClassfunctionHelper;
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Config extends Registry implements \JsonSerializable, \ArrayAccess, \IteratorAggregate, \Countable
|
||||
class Config extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* Hold a JInput object for easier access to the input variables.
|
||||
*
|
||||
* @var Input
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected $input;
|
||||
|
||||
/**
|
||||
* The Params
|
||||
*
|
||||
* @var Registry
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Registry $params;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Input|null $input Input
|
||||
* @param Registry|null $params The component parameters
|
||||
*
|
||||
* @throws \Exception
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Input $input = null, ?Registry $params = null)
|
||||
{
|
||||
$this->input = $input ?: Factory::getApplication()->input;
|
||||
$this->params = $params ?: Helper::getParams('com_componentbuilder');
|
||||
|
||||
// use underscore as the separator
|
||||
$this->separator = '_';
|
||||
|
||||
// Instantiate the internal data object.
|
||||
$this->data = new \stdClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* setting any config value
|
||||
*
|
||||
* @param String $key The value's key/path name
|
||||
* @param mixed $value Optional default value, returned if the internal value is null.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __set($key, $value)
|
||||
{
|
||||
$this->set($key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* getting any valid value
|
||||
*
|
||||
* @param String $key The value's key/path name
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @throws \InvalidArgumentException If $key is not a valid function name.
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
// function name with no underscores
|
||||
$method = 'get' . ucfirst(ClassfunctionHelper::safe(str_replace('_', '', $key)));
|
||||
|
||||
if (($value = $this->get($key, '__N0T_S3T_')) !== '__N0T_S3T_')
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
elseif (method_exists($this, $method))
|
||||
{
|
||||
$value = $this->{$method}();
|
||||
|
||||
$this->set($key, $value);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException(sprintf('Argument %s could not be found as function [%s], or path.', $key, $method));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a registry value.
|
||||
*
|
||||
* @param string $path Registry path (e.g. joomla.content.showauthor)
|
||||
* @param mixed $default Optional default value, returned if the internal value is null.
|
||||
*
|
||||
* @return mixed Value of entry or null
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get($path, $default = null)
|
||||
{
|
||||
// function name with no underscores
|
||||
$method = 'get' . ucfirst(ClassfunctionHelper::safe(str_replace('_', '', $path)));
|
||||
|
||||
// check if it has been set
|
||||
if (($value = parent::get($path, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_')
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
elseif (method_exists($this, $method))
|
||||
{
|
||||
$value = $this->{$method}();
|
||||
|
||||
$this->set($path, $value);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted component id
|
||||
*
|
||||
|
@ -26,6 +26,6 @@ interface PlaceholderInterface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get();
|
||||
public function get(): array;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ namespace VDM\Joomla\Componentbuilder\Compiler;
|
||||
|
||||
|
||||
use Joomla\Registry\Registry as JoomlaRegistry;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
|
||||
|
||||
/**
|
||||
@ -24,6 +25,14 @@ use Joomla\Registry\Registry as JoomlaRegistry;
|
||||
*/
|
||||
class Registry extends JoomlaRegistry implements \JsonSerializable, \ArrayAccess, \IteratorAggregate, \Countable
|
||||
{
|
||||
/**
|
||||
* Default indentation value
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $indent = 2;
|
||||
|
||||
/**
|
||||
* Method to iterate over any part of the registry
|
||||
*
|
||||
@ -44,5 +53,72 @@ class Registry extends JoomlaRegistry implements \JsonSerializable, \ArrayAccess
|
||||
|
||||
return $data->getIterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to export a set of values to a PHP array
|
||||
*
|
||||
* @param string $path Registry path (e.g. joomla.content.showauthor)
|
||||
* @param int $default The default indentation
|
||||
*
|
||||
* @return ?string The var set being exported as a PHP array
|
||||
*
|
||||
* @since 3.4.0
|
||||
*/
|
||||
public function varExport(string $path, int $default = 2): ?string
|
||||
{
|
||||
// check if we have data
|
||||
if (($data = $this->extract($path)) !== null)
|
||||
{
|
||||
// set the default indentation value
|
||||
$this->indent = $default;
|
||||
|
||||
// convert to array
|
||||
$data = $data->toArray();
|
||||
|
||||
// convert to string
|
||||
$data = var_export($data, true);
|
||||
|
||||
// replace all space with system indentation
|
||||
$data = preg_replace_callback("/^(\s{2})(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(.*)/m", [$this, 'convertIndent'], $data);
|
||||
|
||||
// convert all array to []
|
||||
$array = preg_split("/\r\n|\n|\r/", $data);
|
||||
$array = preg_replace(["/\s*array\s\($/", "/\)(,)?$/", "/\s=>\s$/"], [NULL, ']$1', ' => ['], $array);
|
||||
$data = join(PHP_EOL, array_filter(["["] + $array));
|
||||
|
||||
// add needed indentation to the last ]
|
||||
$data = preg_replace("/^(\])/m", Indent::_($default) . '$1', $data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to convert found of grouped spaces to system indentation
|
||||
*
|
||||
* @param array $matches The regex array of matching values
|
||||
*
|
||||
* @return string The resulting string.
|
||||
*
|
||||
* @since 3.4.0
|
||||
*/
|
||||
protected function convertIndent(array $matches): string
|
||||
{
|
||||
// set number to indent by default
|
||||
$indent = Indent::_($this->indent);
|
||||
|
||||
// update each found space (group) with one indentation
|
||||
foreach (range(1, 11) as $space)
|
||||
{
|
||||
if (strlen($matches[$space]) > 0)
|
||||
{
|
||||
$indent .= Indent::_(1);
|
||||
}
|
||||
}
|
||||
|
||||
return $indent . $matches[12];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -44,9 +44,9 @@ abstract class Path
|
||||
{
|
||||
foreach ($targets as $target)
|
||||
{
|
||||
if (isset($values[$target]) && strpos($values[$target], '\\') !== false)
|
||||
if (isset($values[$target]))
|
||||
{
|
||||
$values[$target] = str_replace('\\', '/', $values[$target]);
|
||||
self::fix($values[$target], $targets);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,170 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Database\Get;
|
||||
use VDM\Joomla\Componentbuilder\Search\Database\Set;
|
||||
use VDM\Joomla\Componentbuilder\Search\Agent\Find;
|
||||
use VDM\Joomla\Componentbuilder\Search\Agent\Replace;
|
||||
use VDM\Joomla\Componentbuilder\Search\Agent\Search;
|
||||
|
||||
|
||||
/**
|
||||
* Search Agent
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Agent
|
||||
{
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Search Get Database
|
||||
*
|
||||
* @var Get
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Get $get;
|
||||
|
||||
/**
|
||||
* Search Set Database
|
||||
*
|
||||
* @var Set
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Set $set;
|
||||
|
||||
/**
|
||||
* Search Find
|
||||
*
|
||||
* @var Find
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Find $find;
|
||||
|
||||
/**
|
||||
* Search Replace
|
||||
*
|
||||
* @var Replace
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Replace $replace;
|
||||
|
||||
/**
|
||||
* Search
|
||||
*
|
||||
* @var Search
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Search $search;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
* @param Get|null $get The search get database object.
|
||||
* @param Set|null $set The search get database object.
|
||||
* @param Find|null $find The search find object.
|
||||
* @param Replace|null $replace The search replace object.
|
||||
* @param Search|null $search The search object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Get $get = null,
|
||||
?Set$set = null, ?Find $find = null, ?Replace $replace = null,
|
||||
?Search $search = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
$this->get = $get ?: Factory::_('Get.Database');
|
||||
$this->set = $set ?: Factory::_('Set.Database');
|
||||
$this->find = $find ?: Factory::_('Agent.Find');
|
||||
$this->replace = $replace ?: Factory::_('Agent.Replace');
|
||||
$this->search = $search ?: Factory::_('Agent.Search');
|
||||
}
|
||||
|
||||
/**
|
||||
* Search the posted table for the search value and return all
|
||||
*
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function find(?string $table = null): ?array
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
$set = 1;
|
||||
|
||||
// continue loading items until all are searched
|
||||
while(($items = $this->get->items($table, $set)) !== null)
|
||||
{
|
||||
$this->find->items($items, $table);
|
||||
$set++;
|
||||
}
|
||||
|
||||
return $this->search->found($table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search the posted table for the search value, and replace all
|
||||
*
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function replace(?string $table = null)
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
$set = 1;
|
||||
|
||||
// continue loading items until all was loaded
|
||||
while(($items = $this->get->items($table, $set)) !== null)
|
||||
{
|
||||
// search for items
|
||||
$this->find->items($items, $table);
|
||||
|
||||
// update those found
|
||||
$this->replace->items($this->find->get($table), $table);
|
||||
|
||||
// update the database
|
||||
$this->set->items($this->replace->get($table), $table);
|
||||
|
||||
// reset found items
|
||||
$this->find->reset($table);
|
||||
$this->replace->reset($table);
|
||||
|
||||
$set++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,180 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Agent;
|
||||
|
||||
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Agent\Search;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\FindInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Search Agent Find
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Find implements FindInterface
|
||||
{
|
||||
/**
|
||||
* Found Values
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $found = [];
|
||||
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Search
|
||||
*
|
||||
* @var Search
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Search $search;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
* @param Search|null $search The search object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Search $search = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
$this->search = $search ?: Factory::_('Agent.Search');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get found values
|
||||
*
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(?string $table = null): ?array
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
if (isset($this->found[$table]))
|
||||
{
|
||||
return $this->found[$table];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search over an item fields
|
||||
*
|
||||
* @param object $item The item object of fields to search through
|
||||
* @param int|null $id The item id
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function item(object $item, ?int $id =null, ?string $table = null)
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// set the item id
|
||||
if (empty($id))
|
||||
{
|
||||
$id = $item->id;
|
||||
}
|
||||
|
||||
if (ObjectHelper::check($item))
|
||||
{
|
||||
foreach ($item as $field => $value)
|
||||
{
|
||||
if ($field !== 'id' && $this->search->value($value, $id, $field, $table))
|
||||
{
|
||||
if (empty($this->found[$table][$id]))
|
||||
{
|
||||
$this->found[$table][$id] = new \stdClass();
|
||||
$this->found[$table][$id]->id = $id;
|
||||
}
|
||||
$this->found[$table][$id]->{$field} = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search over an array of items
|
||||
*
|
||||
* @param array|null $items The array of items to search through
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function items(?array $items = null, ?string $table = null)
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
if (ArrayHelper::check($items))
|
||||
{
|
||||
foreach ($items as $id => $item)
|
||||
{
|
||||
$this->item($item, $id, $table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all found values of a table
|
||||
*
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function reset(?string $table = null)
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// empty or unset the table active values
|
||||
unset($this->found[$table]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,181 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Agent;
|
||||
|
||||
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Agent\Update;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\ReplaceInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Search Agent Replace
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Replace implements ReplaceInterface
|
||||
{
|
||||
/**
|
||||
* Updated Values
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $updated = [];
|
||||
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Update
|
||||
*
|
||||
* @var Update
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Update $update;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
* @param Update|null $update The update object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Update $update = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
$this->update = $update ?: Factory::_('Agent.Update');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updated values
|
||||
*
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(?string $table = null): ?array
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
if (isset($this->updated[$table]))
|
||||
{
|
||||
return $this->updated[$table];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search over an item fields
|
||||
*
|
||||
* @param object $item The item object of fields to search through
|
||||
* @param int|null $id The item id
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function item(object $item, ?int $id =null, ?string $table = null)
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// set the item id
|
||||
if (empty($id))
|
||||
{
|
||||
$id = $item->id;
|
||||
}
|
||||
|
||||
if (ObjectHelper::check($item))
|
||||
{
|
||||
foreach ($item as $field => $value)
|
||||
{
|
||||
if ($field !== 'id' && ($_value = $this->update->value($value, $id, $field, $table)) !== null)
|
||||
{
|
||||
if (empty($this->updated[$table][$id]))
|
||||
{
|
||||
$this->updated[$table][$id] = new \stdClass();
|
||||
$this->updated[$table][$id]->id = $id;
|
||||
}
|
||||
// add updated value
|
||||
$this->updated[$table][$id]->{$field} = $_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search over an array of items
|
||||
*
|
||||
* @param array|null $items The array of items to search through
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function items(?array $items = null, ?string $table = null)
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
if (ArrayHelper::check($items))
|
||||
{
|
||||
foreach ($items as $id => $item)
|
||||
{
|
||||
$this->item($item, $id, $table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all updated values of a table
|
||||
*
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function reset(?string $table = null)
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// empty or unset the table active values
|
||||
unset($this->updated[$table]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Agent;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Table;
|
||||
|
||||
|
||||
/**
|
||||
* Search Agent Search
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Search
|
||||
{
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Table
|
||||
*
|
||||
* @var Table
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Table $table;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
* @param Table|null $table The search table object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Table $table = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
$this->table = $table ?: Factory::_('Table');
|
||||
}
|
||||
|
||||
/**
|
||||
* Search inside a value
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param int $id The item ID
|
||||
* @param string $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value($value, int $id, string $field, ?string $table = null): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Agent;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Table;
|
||||
|
||||
|
||||
/**
|
||||
* Search Agent Update
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Update
|
||||
{
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Table
|
||||
*
|
||||
* @var Table
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Table $table;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
* @param Table|null $table The search table object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Table $table = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
$this->table = $table ?: Factory::_('Table');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update value
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param int $id The item ID
|
||||
* @param string $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value($value, int $id, string $field, ?string $table = null)
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
@ -0,0 +1,125 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\BaseConfig;
|
||||
|
||||
|
||||
/**
|
||||
* Search Configurations
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Config extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* get posted search value
|
||||
*
|
||||
* @return string Raw search value
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getSearchvalue(): string
|
||||
{
|
||||
return $this->input->post->get('search_value', null, 'RAW');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted replace value
|
||||
*
|
||||
* @return string Raw replace value
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getReplacevalue(): string
|
||||
{
|
||||
return $this->input->post->get('replace_value', null, 'RAW');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted search match case
|
||||
*
|
||||
* @return int Match case
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getMatchcase(): int
|
||||
{
|
||||
return $this->input->post->get('match_case', 0, 'INT');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted search whole word
|
||||
*
|
||||
* @return int Whole word
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getWholeword(): int
|
||||
{
|
||||
return $this->input->post->get('whole_word', 0, 'INT');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted search regex
|
||||
*
|
||||
* @return int Regex
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getRegex(): int
|
||||
{
|
||||
return $this->input->post->get('regex_search', 0, 'INT');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted component
|
||||
*
|
||||
* @return int Component ID
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getComponentid(): int
|
||||
{
|
||||
return $this->input->post->get('component_id', 0, 'INT');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted area/table
|
||||
*
|
||||
* @return string Table name
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getTablename(): string
|
||||
{
|
||||
return $this->input->post->get('table_name', null, 'word');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted field
|
||||
*
|
||||
* @return string Field name
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getFieldname(): string
|
||||
{
|
||||
return $this->input->post->get('field_name', null, 'word');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted item id
|
||||
*
|
||||
* @return int Item id
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getItemid(): int
|
||||
{
|
||||
return $this->input->post->get('item_id', 0, 'INT');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,295 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Database;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory as JoomlaFactory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Table;
|
||||
use VDM\Joomla\Componentbuilder\Search\Model\Get as Model;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\GetInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Search Database Get
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Get implements GetInterface
|
||||
{
|
||||
/**
|
||||
* Bundle Size
|
||||
*
|
||||
* @var int
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected int $bundle = 300;
|
||||
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Search Table
|
||||
*
|
||||
* @var Table
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Table $table;
|
||||
|
||||
/**
|
||||
* Search Model
|
||||
*
|
||||
* @var Model
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Model $model;
|
||||
|
||||
/**
|
||||
* Database object to query local DB
|
||||
*
|
||||
* @var \JDatabaseDriver
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected \JDatabaseDriver $db;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
* @param Table|null $table The search table object.
|
||||
* @param Model|null $model The search get model object.
|
||||
* @param \JDatabaseDriver|null $db The database object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Table $table = null,
|
||||
?Model $model = null, ?\JDatabaseDriver $db = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
$this->table = $table ?: Factory::_('Table');
|
||||
$this->model = $model ?: Factory::_('Get.Model');
|
||||
$this->db = $db ?: JoomlaFactory::getDbo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get values from a given table
|
||||
* Example: $this->value(23, 'value_key', 'table_name');
|
||||
*
|
||||
* @param string $field The field key
|
||||
* @param int $id The item ID
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value(string $field, int $id, string $table = null)
|
||||
{
|
||||
// load the table
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// check if this is a valid field and table
|
||||
if ($id > 0 && ($name = $this->table->get($table, $field, 'name')) !== null)
|
||||
{
|
||||
// Create a new query object.
|
||||
$query = $this->db->getQuery(true);
|
||||
|
||||
// Order it by the ordering field.
|
||||
$query->select($name);
|
||||
$query->from($this->db->quoteName('#__componentbuilder_' . $table));
|
||||
|
||||
// get by id
|
||||
$query->where($this->db->quoteName('id') . " = " . $id);
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
|
||||
// check if we have any values
|
||||
if ($this->db->getNumRows())
|
||||
{
|
||||
// return found values
|
||||
return $this->model->value($this->db->loadResult(), $name, $table);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get values from a given table
|
||||
* Example: $this->item(23, 'table_name');
|
||||
*
|
||||
* @param int $id The item ID
|
||||
* @param string| null $table The table
|
||||
*
|
||||
* @return object|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function item(int $id, string $table = null): ?object
|
||||
{
|
||||
// load the table
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// check if this is a valid table
|
||||
if ($id > 0 && ($fields = $this->table->fields($table)) !== null)
|
||||
{
|
||||
// add the ID
|
||||
array_unshift($fields , 'id');
|
||||
|
||||
// Create a new query object.
|
||||
$query = $this->db->getQuery(true);
|
||||
|
||||
// Order it by the ordering field.
|
||||
$query->select($this->db->quoteName($fields));
|
||||
$query->from($this->db->quoteName('#__componentbuilder_' . $table));
|
||||
|
||||
// get by id
|
||||
$query->where($this->db->quoteName('id') . " = " . $id);
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
|
||||
// check if we have any values
|
||||
if ($this->db->getNumRows())
|
||||
{
|
||||
// return found values
|
||||
return $this->model->item($this->db->loadObject(), $table);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get values from a given table
|
||||
* Example: $this->items('table_name');
|
||||
*
|
||||
* @param string|null $table The table
|
||||
* @param int $bundle The bundle to return (0 = all)
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function items(string $table = null, int $bundle = 0): ?array
|
||||
{
|
||||
// load the table
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// check if this is a valid table
|
||||
if (($fields = $this->table->fields($table)) !== null)
|
||||
{
|
||||
// add the ID
|
||||
array_unshift($fields , 'id');
|
||||
|
||||
// get the title value
|
||||
$title = $this->table->titleName($table);
|
||||
|
||||
// Create a new query object.
|
||||
$query = $this->db->getQuery(true);
|
||||
|
||||
// Order it by the ordering field.
|
||||
$query->select($this->db->quoteName($fields));
|
||||
$query->from($this->db->quoteName('#__componentbuilder_' . $table));
|
||||
$query->order($title .' ASC');
|
||||
|
||||
// add limitation and pagination
|
||||
if ($bundle > 0)
|
||||
{
|
||||
// get the incremental number
|
||||
$query->where($this->db->quoteName('id') . " >= " . $this->next($table, $bundle));
|
||||
|
||||
// only return a limited number
|
||||
$query->setLimit($this->bundle);
|
||||
}
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$this->db->setQuery($query);
|
||||
$this->db->execute();
|
||||
|
||||
// check if we have any values
|
||||
if ($this->db->getNumRows())
|
||||
{
|
||||
// return found values
|
||||
return $this->model->items($this->db->loadObjectList('id'), $table);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get next id to call
|
||||
*
|
||||
* @param string $table The table
|
||||
* @param int $bundle The bundle to return
|
||||
*
|
||||
* @return int
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function next(string $table, int $bundle): int
|
||||
{
|
||||
if ($bundle == 1 || $bundle == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (($number = $this->model->last($table)) !== null)
|
||||
{
|
||||
return $number + 1;
|
||||
}
|
||||
|
||||
return $this->incremental($bundle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Incremental number where the set starts
|
||||
*
|
||||
* @param int $bundle The bundle to return
|
||||
*
|
||||
* @return int
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function incremental(int $bundle): int
|
||||
{
|
||||
// just in case
|
||||
if ($bundle == 1 || $bundle == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Number two set starts at 301
|
||||
* 2 x 300 = 600
|
||||
* 600 - 300 = 300
|
||||
* 300 + 1 = 301 <--
|
||||
* Number five set starts at 1201
|
||||
* 5 x 300 = 1500
|
||||
* 1500 - 300 = 1200
|
||||
* 1200 + 1 = 1201 <--
|
||||
**/
|
||||
return (($bundle * $this->bundle) - $this->bundle) + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,187 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Database;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory as JoomlaFactory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Table;
|
||||
use VDM\Joomla\Componentbuilder\Search\Model\Set as Model;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\SetInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Search Database Set
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Set implements SetInterface
|
||||
{
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Search Table
|
||||
*
|
||||
* @var Table
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Table $table;
|
||||
|
||||
/**
|
||||
* Search Model
|
||||
*
|
||||
* @var Model
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Model $model;
|
||||
|
||||
/**
|
||||
* Database object to query local DB
|
||||
*
|
||||
* @var \JDatabaseDriver
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected \JDatabaseDriver $db;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
* @param Table|null $table The search table object.
|
||||
* @param Model|null $model The search get model object.
|
||||
* @param \JDatabaseDriver|null $db The database object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Table $table = null,
|
||||
?Model $model = null, ?\JDatabaseDriver $db = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
$this->table = $table ?: Factory::_('Table');
|
||||
$this->model = $model ?: Factory::_('Set.Model');
|
||||
$this->db = $db ?: JoomlaFactory::getDbo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set values to a given table
|
||||
* Example: $this->value(Value, 23, 'value_key', 'table_name');
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param int $id The item ID
|
||||
* @param string $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value($value, int $id, string $field, ?string $table = null): bool
|
||||
{
|
||||
// load the table
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// check if this is a valid field and table
|
||||
if ($id > 0 && ($name = $this->table->get($table, $field, 'name')) !== null)
|
||||
{
|
||||
// build the object
|
||||
$item = new \stdClass();
|
||||
$item->id = $id;
|
||||
$item->{$name} = $this->model->value($value, $name, $table);
|
||||
|
||||
// Update the column of this table using id as the primary key.
|
||||
return $this->db->updateObject('#__componentbuilder_' . $table, $item, 'id');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set values to a given table
|
||||
* Example: $this->item(Object, 23, 'table_name');
|
||||
*
|
||||
* @param object $item The item to save
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function item(object $item, ?string $table = null): bool
|
||||
{
|
||||
// load the table
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// check if this is a valid table
|
||||
if (($fields = $this->table->fields($table)) !== null)
|
||||
{
|
||||
// model the item values
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
if (isset($item->{$field}))
|
||||
{
|
||||
$item->{$field} = $this->model->value($item->{$field}, $field, $table);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the column of this table using id as the primary key.
|
||||
return $this->db->updateObject('#__componentbuilder_' . $table, $item, 'id');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set values to a given table
|
||||
* Example: $this->items(Array, 'table_name');
|
||||
*
|
||||
* @param array $items The items being saved
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function items(array $items, string $table = null): bool
|
||||
{
|
||||
// load the table
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// check if this is a valid table
|
||||
if (ArrayHelper::check($items))
|
||||
{
|
||||
$success = true;
|
||||
foreach ($items as $item)
|
||||
{
|
||||
if ($this->item($item, $table) !== true)
|
||||
{
|
||||
$success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $success;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
@ -0,0 +1,80 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
|
||||
|
||||
/**
|
||||
* Search Factory
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
abstract class Factory
|
||||
{
|
||||
/**
|
||||
* Global Compiler Container
|
||||
*
|
||||
* @var Container
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected static $container = null;
|
||||
|
||||
/**
|
||||
* Get any class from the compiler container
|
||||
*
|
||||
* @param string $key The container class key
|
||||
*
|
||||
* @return Mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public static function _($key)
|
||||
{
|
||||
return self::getContainer()->get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a the global compiler container
|
||||
*
|
||||
* @return Container
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public static function getContainer(): Container
|
||||
{
|
||||
if (!self::$container)
|
||||
{
|
||||
self::$container = self::createContainer();
|
||||
}
|
||||
|
||||
return self::$container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a container object
|
||||
*
|
||||
* @return Container
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected static function createContainer(): Container
|
||||
{
|
||||
$container = (new Container())
|
||||
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Search\Service\Search())
|
||||
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Search\Service\Model())
|
||||
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Search\Service\Database())
|
||||
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Search\Service\Agent());
|
||||
|
||||
return $container;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,65 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Search Find Interface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface FindInterface
|
||||
{
|
||||
/**
|
||||
* Get found values
|
||||
*
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(?string $table = null): ?array;
|
||||
|
||||
/**
|
||||
* Search over an item fields
|
||||
*
|
||||
* @param object $item The item object of fields to search through
|
||||
* @param int|null $id The item id
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function item(object $item, ?int $id =null, ?string $table = null);
|
||||
|
||||
/**
|
||||
* Search over an array of items
|
||||
*
|
||||
* @param array|null $items The array of items to search through
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function items(?array $items = null, ?string $table = null);
|
||||
|
||||
/**
|
||||
* Reset all found values of a table
|
||||
*
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function reset(?string $table = null);
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Search Database Get Interface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface GetInterface
|
||||
{
|
||||
/**
|
||||
* Get values from a given table
|
||||
* Example: $this->value(23, 'value_key', 'table_name');
|
||||
*
|
||||
* @param string $field The field key
|
||||
* @param int $id The item ID
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value(string $field, int $id, string $table = null);
|
||||
|
||||
/**
|
||||
* Get values from a given table
|
||||
* Example: $this->item(23, 'table_name');
|
||||
*
|
||||
* @param int $id The item ID
|
||||
* @param string| null $table The table
|
||||
*
|
||||
* @return object|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function item(int $id, string $table = null): ?object;
|
||||
|
||||
/**
|
||||
* Get values from a given table
|
||||
* Example: $this->items('table_name');
|
||||
*
|
||||
* @param string|null $table The table
|
||||
* @param int $bundle The bundle to return (0 = all)
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function items(string $table = null, int $bundle = 0): ?array;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,71 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Search Model Interface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface ModelInterface
|
||||
{
|
||||
/**
|
||||
* Model the value
|
||||
* Example: $this->value(value, 'value_key', 'table_name');
|
||||
*
|
||||
* @param mixed $value The value to model
|
||||
* @param string $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value($value, string $field, ?string $table = null);
|
||||
|
||||
/**
|
||||
* Model the values of an item
|
||||
* Example: $this->item('table_name', Object);
|
||||
*
|
||||
* @param string $table The table
|
||||
* @param object $item The item object
|
||||
*
|
||||
* @return object
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function item(object $item, ?string $table = null): object;
|
||||
|
||||
/**
|
||||
* Model the values of multiple items
|
||||
* Example: $this->items(Array, 'table_name');
|
||||
*
|
||||
* @param array|null $items The array of item objects
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function items(?array $items = null, ?string $table = null): ?array;
|
||||
|
||||
/**
|
||||
* Get last modeled ID
|
||||
* Example: $this->last('table_name');
|
||||
*
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return int|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function last(?string $table = null): ?int;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,66 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Search Replace Interface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface ReplaceInterface
|
||||
{
|
||||
/**
|
||||
* Get updated values
|
||||
*
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(?string $table = null): ?array;
|
||||
|
||||
/**
|
||||
* Search over an item fields
|
||||
*
|
||||
* @param object $item The item object of fields to search through
|
||||
* @param int|null $id The item id
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function item(object $item, ?int $id =null, ?string $table = null);
|
||||
|
||||
/**
|
||||
* Search over an array of items
|
||||
*
|
||||
* @param array|null $items The array of items to search through
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function items(?array $items = null, ?string $table = null);
|
||||
|
||||
/**
|
||||
* Reset all updated values of a table
|
||||
*
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function reset(?string $table = null);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Search Database Set Interface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface SetInterface
|
||||
{
|
||||
/**
|
||||
* Set values to a given table
|
||||
* Example: $this->value(Value, 23, 'value_key', 'table_name');
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param int $id The item ID
|
||||
* @param string $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value($value, int $id, string $field, ?string $table = null): bool;
|
||||
|
||||
/**
|
||||
* Set values to a given table
|
||||
* Example: $this->item(Object, 23, 'table_name');
|
||||
*
|
||||
* @param object $item The item to save
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function item(object $item, ?string $table = null): bool;
|
||||
|
||||
/**
|
||||
* Set values to a given table
|
||||
* Example: $this->items(Array, 'table_name');
|
||||
*
|
||||
* @param array $items The items being saved
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function items(array $items, string $table = null): bool;
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
@ -0,0 +1,160 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Table;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Search Model
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
abstract class Model
|
||||
{
|
||||
/**
|
||||
* Last ID
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $last;
|
||||
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Search Table
|
||||
*
|
||||
* @var Table
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Table $table;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
* @param Table|null $table The search table object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Table $table = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
$this->table = $table ?: Factory::_('Table');
|
||||
}
|
||||
|
||||
/**
|
||||
* Model the values of an item
|
||||
* Example: $this->item(Object, 'table_name');
|
||||
*
|
||||
* @param object $item The item object
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return object
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function item(object $item, ?string $table = null): object
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// check if this is a valid table
|
||||
if (($fields = $this->table->fields($table)) !== null)
|
||||
{
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
if(isset($item->{$field}))
|
||||
{
|
||||
$item->{$field} = $this->value($item->{$field}, $field, $table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Model the values of multiple items
|
||||
* Example: $this->items(Array, 'table_name');
|
||||
*
|
||||
* @param array|null $items The array of item objects
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function items(?array $items = null, ?string $table = null): ?array
|
||||
{
|
||||
// check if this is a valid table
|
||||
if (ArrayHelper::check($items))
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
foreach ($items as $id => &$item)
|
||||
{
|
||||
// model the item
|
||||
$item = $this->item($item, $table);
|
||||
|
||||
// add the last ID
|
||||
$this->last[$table] = $item->id;
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get last modeled ID
|
||||
* Example: $this->last('table_name');
|
||||
*
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return int|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function last(?string $table = null): ?int
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// check if this is a valid table
|
||||
if ($table && isset($this->last[$table]))
|
||||
{
|
||||
return $this->last[$table];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Model;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\ModelInterface;
|
||||
use VDM\Joomla\Componentbuilder\Search\Model;
|
||||
|
||||
|
||||
/**
|
||||
* Search Get Model
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Get extends Model implements ModelInterface
|
||||
{
|
||||
/**
|
||||
* Model the value
|
||||
* Example: $this->value(value, 'value_key', 'table_name');
|
||||
*
|
||||
* @param mixed $value The value to model
|
||||
* @param string $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value($value, string $field, ?string $table = null)
|
||||
{
|
||||
// load the table
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// check if this is a valid table
|
||||
if (($store = $this->table->get($table, $field, 'store')) !== null)
|
||||
{
|
||||
// open the value based on the store method
|
||||
switch($store)
|
||||
{
|
||||
case 'base64':
|
||||
$value = \base64_decode($value);
|
||||
break;
|
||||
case 'json':
|
||||
$value = \json_decode($value, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Model;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\ModelInterface;
|
||||
use VDM\Joomla\Componentbuilder\Search\Model;
|
||||
|
||||
|
||||
/**
|
||||
* Search Set Model
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Set extends Model implements ModelInterface
|
||||
{
|
||||
/**
|
||||
* Model the value
|
||||
* Example: $this->value(value, 'field_key', 'table_name');
|
||||
*
|
||||
* @param mixed $value The value to model
|
||||
* @param string $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value($value, string $field, ?string $table = null)
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// check if this is a valid table
|
||||
if (($store = $this->table->get($table, $field, 'store')) !== null)
|
||||
{
|
||||
// open the value based on the store method
|
||||
switch($store)
|
||||
{
|
||||
case 'base64':
|
||||
$value = \base64_encode($value);
|
||||
break;
|
||||
case 'json':
|
||||
$value = \json_encode($value, JSON_FORCE_OBJECT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
@ -0,0 +1,142 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Search\Agent as SearchAgent;
|
||||
use VDM\Joomla\Componentbuilder\Search\Agent\Find;
|
||||
use VDM\Joomla\Componentbuilder\Search\Agent\Replace;
|
||||
use VDM\Joomla\Componentbuilder\Search\Agent\Search;
|
||||
use VDM\Joomla\Componentbuilder\Search\Agent\Update;
|
||||
|
||||
|
||||
/**
|
||||
* Agent Service Provider
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Agent implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(SearchAgent::class, 'Agent')
|
||||
->share('Agent', [$this, 'getAgent'], true);
|
||||
|
||||
$container->alias(Find::class, 'Agent.Find')
|
||||
->share('Agent.Find', [$this, 'getFind'], true);
|
||||
|
||||
$container->alias(Replace::class, 'Agent.Replace')
|
||||
->share('Agent.Replace', [$this, 'getReplace'], true);
|
||||
|
||||
$container->alias(Search::class, 'Agent.Search')
|
||||
->share('Agent.Search', [$this, 'getSearch'], true);
|
||||
|
||||
$container->alias(Update::class, 'Agent.Update')
|
||||
->share('Agent.Update', [$this, 'getUpdate'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Search Agent
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return SearchAgent
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getAgent(Container $container): SearchAgent
|
||||
{
|
||||
return new SearchAgent(
|
||||
$container->get('Config'),
|
||||
$container->get('Get.Database'),
|
||||
$container->get('Set.Database'),
|
||||
$container->get('Agent.Find'),
|
||||
$container->get('Agent.Replace'),
|
||||
$container->get('Agent.Search')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Search Agent Find
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Find
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getFind(Container $container): Find
|
||||
{
|
||||
return new Find(
|
||||
$container->get('Config'),
|
||||
$container->get('Agent.Search')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Search Agent Replace
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Replace
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getReplace(Container $container): Replace
|
||||
{
|
||||
return new Replace(
|
||||
$container->get('Config'),
|
||||
$container->get('Agent.Update')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Search Agent Search
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Search
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getSearch(Container $container): Search
|
||||
{
|
||||
return new Search(
|
||||
$container->get('Config'),
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Search Agent Update
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Update
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getUpdate(Container $container): Update
|
||||
{
|
||||
return new Update(
|
||||
$container->get('Config'),
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,80 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Search\Database\Get as GetDatabase;
|
||||
use VDM\Joomla\Componentbuilder\Search\Database\Set as SetDatabase;
|
||||
|
||||
|
||||
/**
|
||||
* Database Service Provider
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Database implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(GetDatabase::class, 'Get.Database')
|
||||
->share('Get.Database', [$this, 'getDatabaseGet'], true);
|
||||
|
||||
$container->alias(SetDatabase::class, 'Set.Database')
|
||||
->share('Set.Database', [$this, 'getDatabaseSet'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Get Database
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return GetDatabase
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getDatabaseGet(Container $container): GetDatabase
|
||||
{
|
||||
return new GetDatabase(
|
||||
$container->get('Config'),
|
||||
$container->get('Table'),
|
||||
$container->get('Get.Model')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Set Database
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return SetDatabase
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getDatabaseSet(Container $container): SetDatabase
|
||||
{
|
||||
return new SetDatabase(
|
||||
$container->get('Config'),
|
||||
$container->get('Table'),
|
||||
$container->get('Set.Model')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,78 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Search\Model\Get;
|
||||
use VDM\Joomla\Componentbuilder\Search\Model\Set;
|
||||
|
||||
|
||||
/**
|
||||
* Model Service Provider
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Model implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(Get::class, 'Get.Model')
|
||||
->share('Get.Model', [$this, 'getModelGet'], true);
|
||||
|
||||
$container->alias(Set::class, 'Set.Model')
|
||||
->share('Set.Model', [$this, 'getModelSet'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Get Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Get
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelGet(Container $container): Get
|
||||
{
|
||||
return new Get(
|
||||
$container->get('Config'),
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Set Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Set
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelSet(Container $container): Set
|
||||
{
|
||||
return new Set(
|
||||
$container->get('Config'),
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Table;
|
||||
|
||||
|
||||
/**
|
||||
* Search Service Provider
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Search implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(Config::class, 'Config')
|
||||
->share('Config', [$this, 'getConfig'], true);
|
||||
|
||||
$container->alias(Table::class, 'Table')
|
||||
->share('Table', [$this, 'getTable'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Config
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getConfig(Container $container): Config
|
||||
{
|
||||
return new Config();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Table
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Table
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getTable(Container $container): Table
|
||||
{
|
||||
return new Table(
|
||||
$container->get('Config')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
@ -6755,7 +6755,7 @@ class com_componentbuilderInstallerScript
|
||||
{
|
||||
$rule_length = $db->loadResult();
|
||||
// Check the size of the rules column
|
||||
if ($rule_length <= 96960)
|
||||
if ($rule_length <= 97440)
|
||||
{
|
||||
// Fix the assets table rules column size
|
||||
$fix_rules_size = "ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to MEDIUMTEXT by JCB';";
|
||||
|
@ -3547,6 +3547,9 @@ abstract class ComponentbuilderHelper
|
||||
),
|
||||
'special' => array(
|
||||
'contentlanguage', 'moduleposition', 'plugin', 'repeatable', 'subform'
|
||||
),
|
||||
'search' => array(
|
||||
'editor', 'email', 'tel', 'text', 'textarea', 'url', 'subform'
|
||||
)
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user