first commit
This commit is contained in:
commit
52a59e002f
435
README.md
Normal file
435
README.md
Normal file
@ -0,0 +1,435 @@
|
||||
```
|
||||
███████╗██╗ ██╗██████╗ ███████╗██████╗
|
||||
██╔════╝██║ ██║██╔══██╗██╔════╝██╔══██╗
|
||||
███████╗██║ ██║██████╔╝█████╗ ██████╔╝
|
||||
╚════██║██║ ██║██╔═══╝ ██╔══╝ ██╔══██╗
|
||||
███████║╚██████╔╝██║ ███████╗██║ ██║
|
||||
╚══════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗ ███████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗██╔════╝
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝███████╗
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗╚════██║
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║███████║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝╚══════╝
|
||||
```
|
||||
|
||||
### What is JCB Super Powers?
|
||||
The Joomla Component Builder (JCB) Super Power features are designed to enhance JCB's functionality and streamline the development process. These Super Powers enable developers to efficiently manage and share their custom powers across multiple JCB instances through repositories hosted on [https://git.vdm.dev/[username]/[repository-name]](https://git.vdm.dev). JCB Super Powers are managed using a combination of layers, events, tasks, methods, switches, and algorithms, which work together to provide powerful customization and extensibility options. More details on JCB Super Powers can be found in the [Super Powers Documentation](https://git.vdm.dev/joomla/super-powers/wiki).
|
||||
|
||||
In summary, JCB Super Powers offer a flexible and efficient way to manage and share functionalities between JCB instances. By utilizing a sophisticated system of layers, events, tasks, methods, switches, and algorithms, developers can seamlessly integrate JCB core powers and their custom powers. For more information on how to work with JCB Super Powers, refer to the [Super Powers User Guide](https://git.vdm.dev/joomla/super-powers/wiki).
|
||||
|
||||
### What can I find here?
|
||||
This repository contains an index (see below) of all the approved powers within the JCB GUI. During the compilation of a component, these powers are automatically added to the repository, ensuring a well-organized and accessible collection of functionalities.
|
||||
|
||||
# Index of powers
|
||||
|
||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Search](#vdm-joomla-componentbuilder-search)
|
||||
|
||||
- **abstract class Factory** | [Details](src/01a89ba8-f8bb-435c-93de-0a8f3fa9432a) | [Code](src/01a89ba8-f8bb-435c-93de-0a8f3fa9432a/code.php) | [Settings](src/01a89ba8-f8bb-435c-93de-0a8f3fa9432a/settings.json) | [01a89ba8-f8bb-435c-93de-0a8f3fa9432a](src/01a89ba8-f8bb-435c-93de-0a8f3fa9432a)
|
||||
- **class Agent** | [Details](src/0b658434-3767-401e-addc-eabfd1d0e94a) | [Code](src/0b658434-3767-401e-addc-eabfd1d0e94a/code.php) | [Settings](src/0b658434-3767-401e-addc-eabfd1d0e94a/settings.json) | [0b658434-3767-401e-addc-eabfd1d0e94a](src/0b658434-3767-401e-addc-eabfd1d0e94a)
|
||||
- **class Config** | [Details](src/6e2ca779-f70e-4871-a138-0ee5eaec6a97) | [Code](src/6e2ca779-f70e-4871-a138-0ee5eaec6a97/code.php) | [Settings](src/6e2ca779-f70e-4871-a138-0ee5eaec6a97/settings.json) | [6e2ca779-f70e-4871-a138-0ee5eaec6a97](src/6e2ca779-f70e-4871-a138-0ee5eaec6a97)
|
||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Search\Abstraction](#vdm-joomla-componentbuilder-search-abstraction)
|
||||
|
||||
- **abstract class Engine** | [Details](src/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf) | [Code](src/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf/code.php) | [Settings](src/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf/settings.json) | [8f9449fc-bfbc-49a5-b146-d58c8c17dfdf](src/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf)
|
||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Search\Agent](#vdm-joomla-componentbuilder-search-agent)
|
||||
|
||||
- **class Find** | [Details](src/15d9e1a9-3364-4d69-9d9f-9b87db820e5c) | [Code](src/15d9e1a9-3364-4d69-9d9f-9b87db820e5c/code.php) | [Settings](src/15d9e1a9-3364-4d69-9d9f-9b87db820e5c/settings.json) | [15d9e1a9-3364-4d69-9d9f-9b87db820e5c](src/15d9e1a9-3364-4d69-9d9f-9b87db820e5c)
|
||||
- **class Replace** | [Details](src/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7) | [Code](src/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7/code.php) | [Settings](src/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7/settings.json) | [abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7](src/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7)
|
||||
- **class Search** | [Details](src/e544a248-4b6a-46cb-9926-a3ac9937807c) | [Code](src/e544a248-4b6a-46cb-9926-a3ac9937807c/code.php) | [Settings](src/e544a248-4b6a-46cb-9926-a3ac9937807c/settings.json) | [e544a248-4b6a-46cb-9926-a3ac9937807c](src/e544a248-4b6a-46cb-9926-a3ac9937807c)
|
||||
- **class Update** | [Details](src/3ac29912-0681-4ca9-8197-d5a8f6a49ac7) | [Code](src/3ac29912-0681-4ca9-8197-d5a8f6a49ac7/code.php) | [Settings](src/3ac29912-0681-4ca9-8197-d5a8f6a49ac7/settings.json) | [3ac29912-0681-4ca9-8197-d5a8f6a49ac7](src/3ac29912-0681-4ca9-8197-d5a8f6a49ac7)
|
||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Search\Database](#vdm-joomla-componentbuilder-search-database)
|
||||
|
||||
- **class Insert** | [Details](src/6caf9473-133c-49a9-afa0-9f84151b5155) | [Code](src/6caf9473-133c-49a9-afa0-9f84151b5155/code.php) | [Settings](src/6caf9473-133c-49a9-afa0-9f84151b5155/settings.json) | [6caf9473-133c-49a9-afa0-9f84151b5155](src/6caf9473-133c-49a9-afa0-9f84151b5155)
|
||||
- **class Load** | [Details](src/2dabfb4a-64cd-4c04-9772-4a75f9f3b710) | [Code](src/2dabfb4a-64cd-4c04-9772-4a75f9f3b710/code.php) | [Settings](src/2dabfb4a-64cd-4c04-9772-4a75f9f3b710/settings.json) | [2dabfb4a-64cd-4c04-9772-4a75f9f3b710](src/2dabfb4a-64cd-4c04-9772-4a75f9f3b710)
|
||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Search\Engine](#vdm-joomla-componentbuilder-search-engine)
|
||||
|
||||
- **class Basic** | [Details](src/db093eca-63b3-4d6c-9232-3ceb058121c0) | [Code](src/db093eca-63b3-4d6c-9232-3ceb058121c0/code.php) | [Settings](src/db093eca-63b3-4d6c-9232-3ceb058121c0/settings.json) | [db093eca-63b3-4d6c-9232-3ceb058121c0](src/db093eca-63b3-4d6c-9232-3ceb058121c0)
|
||||
- **class Regex** | [Details](src/83efa9a0-4aec-41f8-9c05-b1ac9617746e) | [Code](src/83efa9a0-4aec-41f8-9c05-b1ac9617746e/code.php) | [Settings](src/83efa9a0-4aec-41f8-9c05-b1ac9617746e/settings.json) | [83efa9a0-4aec-41f8-9c05-b1ac9617746e](src/83efa9a0-4aec-41f8-9c05-b1ac9617746e)
|
||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Search\Interfaces](#vdm-joomla-componentbuilder-search-interfaces)
|
||||
|
||||
- **interface FindInterface** | [Details](src/55280ec7-e48d-431b-af25-10308dd30636) | [Code](src/55280ec7-e48d-431b-af25-10308dd30636/code.php) | [Settings](src/55280ec7-e48d-431b-af25-10308dd30636/settings.json) | [55280ec7-e48d-431b-af25-10308dd30636](src/55280ec7-e48d-431b-af25-10308dd30636)
|
||||
- **interface InsertInterface** | [Details](src/4c44e5d3-750c-4609-88c8-aa441838b8fe) | [Code](src/4c44e5d3-750c-4609-88c8-aa441838b8fe/code.php) | [Settings](src/4c44e5d3-750c-4609-88c8-aa441838b8fe/settings.json) | [4c44e5d3-750c-4609-88c8-aa441838b8fe](src/4c44e5d3-750c-4609-88c8-aa441838b8fe)
|
||||
- **interface LoadInterface** | [Details](src/2bd1a32c-3d90-4646-9314-28d44d164f76) | [Code](src/2bd1a32c-3d90-4646-9314-28d44d164f76/code.php) | [Settings](src/2bd1a32c-3d90-4646-9314-28d44d164f76/settings.json) | [2bd1a32c-3d90-4646-9314-28d44d164f76](src/2bd1a32c-3d90-4646-9314-28d44d164f76)
|
||||
- **interface ReplaceInterface** | [Details](src/afdae35d-fe7f-4055-99ea-afd8ff8349b6) | [Code](src/afdae35d-fe7f-4055-99ea-afd8ff8349b6/code.php) | [Settings](src/afdae35d-fe7f-4055-99ea-afd8ff8349b6/settings.json) | [afdae35d-fe7f-4055-99ea-afd8ff8349b6](src/afdae35d-fe7f-4055-99ea-afd8ff8349b6)
|
||||
- **interface SearchInterface** | [Details](src/0d9442ab-54d9-4947-a219-244cfaea3084) | [Code](src/0d9442ab-54d9-4947-a219-244cfaea3084/code.php) | [Settings](src/0d9442ab-54d9-4947-a219-244cfaea3084/settings.json) | [0d9442ab-54d9-4947-a219-244cfaea3084](src/0d9442ab-54d9-4947-a219-244cfaea3084)
|
||||
- **interface SearchTypeInterface** | [Details](src/117d8c9e-3f8d-40ae-b375-1efa2fe5538a) | [Code](src/117d8c9e-3f8d-40ae-b375-1efa2fe5538a/code.php) | [Settings](src/117d8c9e-3f8d-40ae-b375-1efa2fe5538a/settings.json) | [117d8c9e-3f8d-40ae-b375-1efa2fe5538a](src/117d8c9e-3f8d-40ae-b375-1efa2fe5538a)
|
||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Search\Model](#vdm-joomla-componentbuilder-search-model)
|
||||
|
||||
- **class Insert** | [Details](src/02efe40a-7792-4c82-9444-7d0377243483) | [Code](src/02efe40a-7792-4c82-9444-7d0377243483/code.php) | [Settings](src/02efe40a-7792-4c82-9444-7d0377243483/settings.json) | [02efe40a-7792-4c82-9444-7d0377243483](src/02efe40a-7792-4c82-9444-7d0377243483)
|
||||
- **class Load** | [Details](src/f523ab49-907a-4356-b064-51c85a187fbd) | [Code](src/f523ab49-907a-4356-b064-51c85a187fbd/code.php) | [Settings](src/f523ab49-907a-4356-b064-51c85a187fbd/settings.json) | [f523ab49-907a-4356-b064-51c85a187fbd](src/f523ab49-907a-4356-b064-51c85a187fbd)
|
||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Search\Service](#vdm-joomla-componentbuilder-search-service)
|
||||
|
||||
- **class Agent** | [Details](src/cc6972a7-1574-4ae0-92a8-7f1012aac6f7) | [Code](src/cc6972a7-1574-4ae0-92a8-7f1012aac6f7/code.php) | [Settings](src/cc6972a7-1574-4ae0-92a8-7f1012aac6f7/settings.json) | [cc6972a7-1574-4ae0-92a8-7f1012aac6f7](src/cc6972a7-1574-4ae0-92a8-7f1012aac6f7)
|
||||
- **class Database** | [Details](src/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3) | [Code](src/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3/code.php) | [Settings](src/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3/settings.json) | [d5de47ce-9a9e-4e76-a5c6-61ed74842ea3](src/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3)
|
||||
- **class Model** | [Details](src/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a) | [Code](src/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a/code.php) | [Settings](src/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a/settings.json) | [7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a](src/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a)
|
||||
- **class Search** | [Details](src/da714ea5-96bb-4eb1-959b-39b457be9cd1) | [Code](src/da714ea5-96bb-4eb1-959b-39b457be9cd1/code.php) | [Settings](src/da714ea5-96bb-4eb1-959b-39b457be9cd1/settings.json) | [da714ea5-96bb-4eb1-959b-39b457be9cd1](src/da714ea5-96bb-4eb1-959b-39b457be9cd1)
|
||||
|
||||
# Class Diagrams
|
||||
|
||||
## VDM Joomla Componentbuilder Search
|
||||
> namespace VDM\Joomla\Componentbuilder\Search
|
||||
```uml
|
||||
@startuml
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search #Olive {
|
||||
|
||||
|
||||
abstract Factory #Orange {
|
||||
# static $container
|
||||
+ {static} _() : Mixed
|
||||
+ {static} getContainer() : Container
|
||||
# {static} createContainer() : Container
|
||||
}
|
||||
|
||||
class Agent #Gold {
|
||||
# Config $config
|
||||
# Load $load
|
||||
# Insert $insert
|
||||
# Find $find
|
||||
# Replace $replace
|
||||
# Search $search
|
||||
# Update $update
|
||||
# Table $table
|
||||
# string $return
|
||||
# array $marker
|
||||
# array $markerHtml
|
||||
+ __construct()
|
||||
+ getValue() : ?string
|
||||
+ setValue() : bool
|
||||
+ table() : ?array
|
||||
+ find() : ?array
|
||||
+ replace() : int
|
||||
# getRow() : array
|
||||
# getRowCode() : string
|
||||
# getRowEditButton() : string
|
||||
# setReturnValue() : void
|
||||
# setMarkers() : void
|
||||
}
|
||||
|
||||
class Config #Gold {
|
||||
# getTypesearch() : ?int
|
||||
# getSearchvalue() : ?string
|
||||
# getReplacevalue() : string
|
||||
# getMatchcase() : int
|
||||
# getWholeword() : int
|
||||
# getRegexsearch() : int
|
||||
# getComponentid() : int
|
||||
# getTablename() : ?string
|
||||
# getFieldname() : ?string
|
||||
# getItemid() : int
|
||||
# getFieldcounter() : int
|
||||
# getLinecounter() : int
|
||||
# getMarkerstart() : string
|
||||
# getMarkerend() : string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
## VDM Joomla Componentbuilder Search Abstraction
|
||||
> namespace VDM\Joomla\Componentbuilder\Search\Abstraction
|
||||
```uml
|
||||
@startuml
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Abstraction #LightGreen {
|
||||
|
||||
|
||||
abstract Engine #Orange {
|
||||
# Config $config
|
||||
# ?string $searchValue
|
||||
# string $replaceValue
|
||||
# int $matchCase
|
||||
# int $wholeWord
|
||||
# string $start
|
||||
# string $end
|
||||
+ __construct()
|
||||
# lineCounter()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
## VDM Joomla Componentbuilder Search Agent
|
||||
> namespace VDM\Joomla\Componentbuilder\Search\Agent
|
||||
```uml
|
||||
@startuml
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Agent #LightGreen {
|
||||
|
||||
|
||||
class Find #Gold {
|
||||
# array $found
|
||||
# Config $config
|
||||
# Search $search
|
||||
+ __construct()
|
||||
+ get() : ?array
|
||||
+ item() : void
|
||||
+ items() : void
|
||||
+ reset() : void
|
||||
}
|
||||
|
||||
class Replace #Gold {
|
||||
# array $updated
|
||||
# Config $config
|
||||
# Update $update
|
||||
+ __construct()
|
||||
+ get() : ?array
|
||||
+ item() : void
|
||||
+ items() : void
|
||||
+ reset() : void
|
||||
}
|
||||
|
||||
class Search #Gold {
|
||||
# array $found
|
||||
# Config $config
|
||||
# SearchEngine $search
|
||||
+ __construct()
|
||||
+ get() : ?array
|
||||
+ value() : bool
|
||||
+ reset() : void
|
||||
# searchValue() : ?array
|
||||
# string() : ?array
|
||||
# prep() : void
|
||||
# fieldCounter()
|
||||
}
|
||||
|
||||
class Update #Gold {
|
||||
# SearchEngine $search
|
||||
+ __construct()
|
||||
+ value() : mixed
|
||||
# updateValue() : mixed
|
||||
# validateUpdateKey() : bool
|
||||
# string() : string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
## VDM Joomla Componentbuilder Search Database
|
||||
> namespace VDM\Joomla\Componentbuilder\Search\Database
|
||||
```uml
|
||||
@startuml
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Database #LightGreen {
|
||||
|
||||
|
||||
class Insert #Gold {
|
||||
# Config $config
|
||||
# Table $table
|
||||
# Model $model
|
||||
# \JDatabaseDriver $db
|
||||
+ __construct()
|
||||
+ value() : bool
|
||||
+ item() : bool
|
||||
+ items() : bool
|
||||
}
|
||||
|
||||
class Load #Gold {
|
||||
# int $bundle
|
||||
# Config $config
|
||||
# Table $table
|
||||
# Model $model
|
||||
# Database $load
|
||||
+ __construct()
|
||||
+ value() : mixed
|
||||
+ item() : ?object
|
||||
+ items() : ?array
|
||||
# next() : int
|
||||
# incremental() : int
|
||||
# setDatabaseFields() : ?array
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
## VDM Joomla Componentbuilder Search Engine
|
||||
> namespace VDM\Joomla\Componentbuilder\Search\Engine
|
||||
```uml
|
||||
@startuml
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Engine #LightGreen {
|
||||
|
||||
|
||||
class Basic #Gold {
|
||||
# string $regexValue
|
||||
+ __construct()
|
||||
+ string() : ?string
|
||||
+ replace() : string
|
||||
# replaceWhole() : string
|
||||
# searchWhole() : ?string
|
||||
+ match() : bool
|
||||
# searchAll() : ?string
|
||||
# replaceAll() : string
|
||||
}
|
||||
|
||||
class Regex #Gold {
|
||||
# string $regexValue
|
||||
+ __construct()
|
||||
+ string() : ?string
|
||||
+ replace() : string
|
||||
+ match() : bool
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
## VDM Joomla Componentbuilder Search Interfaces
|
||||
> namespace VDM\Joomla\Componentbuilder\Search\Interfaces
|
||||
```uml
|
||||
@startuml
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Interfaces #LightGreen {
|
||||
|
||||
|
||||
interface FindInterface #Lavender {
|
||||
+ get() : ?array
|
||||
+ item() : void
|
||||
+ items() : void
|
||||
+ reset() : void
|
||||
}
|
||||
|
||||
interface InsertInterface #Lavender {
|
||||
+ value() : bool
|
||||
+ item() : bool
|
||||
+ items() : bool
|
||||
}
|
||||
|
||||
interface LoadInterface #Lavender {
|
||||
+ value() : mixed
|
||||
+ item() : ?object
|
||||
+ items() : ?array
|
||||
}
|
||||
|
||||
interface ReplaceInterface #Lavender {
|
||||
+ get() : ?array
|
||||
+ item() : void
|
||||
+ items() : void
|
||||
+ reset() : void
|
||||
}
|
||||
|
||||
interface SearchInterface #Lavender {
|
||||
+ get() : ?array
|
||||
+ value() : bool
|
||||
+ reset() : void
|
||||
}
|
||||
|
||||
interface SearchTypeInterface #Lavender {
|
||||
+ string() : ?string
|
||||
+ replace() : string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
## VDM Joomla Componentbuilder Search Model
|
||||
> namespace VDM\Joomla\Componentbuilder\Search\Model
|
||||
```uml
|
||||
@startuml
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Model #LightGreen {
|
||||
|
||||
|
||||
class Insert #Gold {
|
||||
# Config $config
|
||||
+ __construct()
|
||||
+ value() : mixed
|
||||
# validateBefore() : bool
|
||||
# validateAfter() : bool
|
||||
# getTable() : string
|
||||
}
|
||||
|
||||
class Load #Gold {
|
||||
# Config $config
|
||||
+ __construct()
|
||||
+ value() : mixed
|
||||
# validateBefore() : bool
|
||||
# validateAfter() : bool
|
||||
# getTable() : string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
## VDM Joomla Componentbuilder Search Service
|
||||
> namespace VDM\Joomla\Componentbuilder\Search\Service
|
||||
```uml
|
||||
@startuml
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search\Service #LightGreen {
|
||||
|
||||
|
||||
class Agent #Gold {
|
||||
+ register() : void
|
||||
+ getAgent() : SearchAgent
|
||||
+ getFind() : Find
|
||||
+ getReplace() : Replace
|
||||
+ getSearch() : Search
|
||||
+ getUpdate() : Update
|
||||
}
|
||||
|
||||
class Database #Gold {
|
||||
+ register() : void
|
||||
+ getLoad() : Load
|
||||
+ getDatabaseLoad() : LoadDatabase
|
||||
+ getDatabaseInsert() : InsertDatabase
|
||||
}
|
||||
|
||||
class Model #Gold {
|
||||
+ register() : void
|
||||
+ getModelLoad() : Load
|
||||
+ getModelInsert() : Insert
|
||||
}
|
||||
|
||||
class Search #Gold {
|
||||
# $searchEngine
|
||||
+ register() : void
|
||||
+ getConfig() : Config
|
||||
+ getTable() : Table
|
||||
+ getRegex() : Regex
|
||||
+ getBasic() : Basic
|
||||
+ getSearch() : SearchEngine
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗ ██████╗ ███╗ ███╗██╗ █████╗
|
||||
██║██╔═══██╗██╔═══██╗████╗ ████║██║ ██╔══██╗
|
||||
██║██║ ██║██║ ██║██╔████╔██║██║ ███████║
|
||||
██ ██║██║ ██║██║ ██║██║╚██╔╝██║██║ ██╔══██║
|
||||
╚█████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║
|
||||
╚════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
██████╗ ██████╗ ███╗ ███╗██████╗ ██████╗ ███╗ ██╗███████╗███╗ ██╗████████╗
|
||||
██╔════╝██╔═══██╗████╗ ████║██╔══██╗██╔═══██╗████╗ ██║██╔════╝████╗ ██║╚══██╔══╝
|
||||
██║ ██║ ██║██╔████╔██║██████╔╝██║ ██║██╔██╗ ██║█████╗ ██╔██╗ ██║ ██║
|
||||
██║ ██║ ██║██║╚██╔╝██║██╔═══╝ ██║ ██║██║╚██╗██║██╔══╝ ██║╚██╗██║ ██║
|
||||
╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚██████╔╝██║ ╚████║███████╗██║ ╚████║ ██║
|
||||
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═══╝ ╚═╝
|
||||
██████╗ ██╗ ██╗██╗██╗ ██████╗ ███████╗██████╗
|
||||
██╔══██╗██║ ██║██║██║ ██╔══██╗██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║██║ ██║ ██║█████╗ ██████╔╝
|
||||
██╔══██╗██║ ██║██║██║ ██║ ██║██╔══╝ ██╔══██╗
|
||||
██████╔╝╚██████╔╝██║███████╗██████╔╝███████╗██║ ██║
|
||||
╚═════╝ ╚═════╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
54
src/01a89ba8-f8bb-435c-93de-0a8f3fa9432a/README.md
Normal file
54
src/01a89ba8-f8bb-435c-93de-0a8f3fa9432a/README.md
Normal file
@ -0,0 +1,54 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# abstract class Factory (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search**
|
||||
```uml
|
||||
@startuml
|
||||
abstract Factory #Orange {
|
||||
# static $container
|
||||
+ {static} _(string $key) : Mixed
|
||||
+ {static} getContainer() : Container
|
||||
# {static} createContainer() : Container
|
||||
}
|
||||
|
||||
note right of Factory::_
|
||||
Get any class from the search container
|
||||
|
||||
since: 3.2.0
|
||||
return: Mixed
|
||||
end note
|
||||
|
||||
note right of Factory::getContainer
|
||||
Get the global search container
|
||||
|
||||
since: 3.2.0
|
||||
return: Container
|
||||
end note
|
||||
|
||||
note right of Factory::createContainer
|
||||
Create a container object
|
||||
|
||||
since: 3.2.0
|
||||
return: Container
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
83
src/01a89ba8-f8bb-435c-93de-0a8f3fa9432a/code.php
Normal file
83
src/01a89ba8-f8bb-435c-93de-0a8f3fa9432a/code.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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;
|
||||
use VDM\Joomla\Componentbuilder\Search\Service\Search;
|
||||
use VDM\Joomla\Componentbuilder\Search\Service\Model;
|
||||
use VDM\Joomla\Componentbuilder\Search\Service\Database;
|
||||
use VDM\Joomla\Componentbuilder\Search\Service\Agent;
|
||||
use VDM\Joomla\Componentbuilder\Interfaces\FactoryInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Search Factory
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
abstract class Factory implements FactoryInterface
|
||||
{
|
||||
/**
|
||||
* Global Search Container
|
||||
*
|
||||
* @var Container
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected static $container = null;
|
||||
|
||||
/**
|
||||
* Get any class from the search container
|
||||
*
|
||||
* @param string $key The container class key
|
||||
*
|
||||
* @return Mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public static function _(string $key)
|
||||
{
|
||||
return self::getContainer()->get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the global search 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
|
||||
{
|
||||
return (new Container())
|
||||
->registerServiceProvider(new Search())
|
||||
->registerServiceProvider(new Model())
|
||||
->registerServiceProvider(new Database())
|
||||
->registerServiceProvider(new Agent());
|
||||
}
|
||||
|
||||
}
|
||||
|
51
src/01a89ba8-f8bb-435c-93de-0a8f3fa9432a/code.power
Normal file
51
src/01a89ba8-f8bb-435c-93de-0a8f3fa9432a/code.power
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Global Search Container
|
||||
*
|
||||
* @var Container
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected static $container = null;
|
||||
|
||||
/**
|
||||
* Get any class from the search container
|
||||
*
|
||||
* @param string $key The container class key
|
||||
*
|
||||
* @return Mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public static function _(string $key)
|
||||
{
|
||||
return self::getContainer()->get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the global search 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
|
||||
{
|
||||
return (new Container())
|
||||
->registerServiceProvider(new Search())
|
||||
->registerServiceProvider(new Model())
|
||||
->registerServiceProvider(new Database())
|
||||
->registerServiceProvider(new Agent());
|
||||
}
|
37
src/01a89ba8-f8bb-435c-93de-0a8f3fa9432a/settings.json
Normal file
37
src/01a89ba8-f8bb-435c-93de-0a8f3fa9432a/settings.json
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "01a89ba8-f8bb-435c-93de-0a8f3fa9432a",
|
||||
"implements": [
|
||||
"caf33c5d-858c-4f9a-894f-ab302ec5445a"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Factory",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Factory",
|
||||
"type": "abstract class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "da714ea5-96bb-4eb1-959b-39b457be9cd1",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "d5de47ce-9a9e-4e76-a5c6-61ed74842ea3",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "cc6972a7-1574-4ae0-92a8-7f1012aac6f7",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Factory",
|
||||
"description": "Search Factory\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\DI\\Container;",
|
||||
"composer": ""
|
||||
}
|
85
src/02efe40a-7792-4c82-9444-7d0377243483/README.md
Normal file
85
src/02efe40a-7792-4c82-9444-7d0377243483/README.md
Normal file
@ -0,0 +1,85 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Insert (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Model**
|
||||
```uml
|
||||
@startuml
|
||||
class Insert #Gold {
|
||||
# Config $config
|
||||
+ __construct(?Config $config = null, ?Table $table = null)
|
||||
+ value(mixed $value, string $field, ...) : mixed
|
||||
# validateBefore(mixed $value, ?string $field = null, ...) : bool
|
||||
# validateAfter(mixed $value, ?string $field = null, ...) : bool
|
||||
# getTable() : string
|
||||
}
|
||||
|
||||
note right of Insert::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note right of Insert::value
|
||||
Model the value
|
||||
Example: $this->value(value, 'field_key', 'table_name');
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
|
||||
arguments:
|
||||
mixed $value
|
||||
string $field
|
||||
?string $table = null
|
||||
end note
|
||||
|
||||
note right of Insert::validateBefore
|
||||
Validate before the value is modelled (basic, override in child class)
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
|
||||
arguments:
|
||||
mixed $value
|
||||
?string $field = null
|
||||
?string $table = null
|
||||
end note
|
||||
|
||||
note right of Insert::validateAfter
|
||||
Validate after the value is modelled (basic, override in child class)
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
|
||||
arguments:
|
||||
mixed $value
|
||||
?string $field = null
|
||||
?string $table = null
|
||||
end note
|
||||
|
||||
note right of Insert::getTable
|
||||
Get the current active table
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
137
src/02efe40a-7792-4c82-9444-7d0377243483/code.php
Normal file
137
src/02efe40a-7792-4c82-9444-7d0377243483/code.php
Normal file
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Table;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Interfaces\ModelInterface;
|
||||
use VDM\Joomla\Componentbuilder\Abstraction\Model;
|
||||
|
||||
|
||||
/**
|
||||
* Search Insert Model
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Insert extends Model implements ModelInterface
|
||||
{
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
parent::__construct($table ?? Factory::_('Table'));
|
||||
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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->getTable();
|
||||
}
|
||||
|
||||
// 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((string) $value);
|
||||
break;
|
||||
case 'json':
|
||||
$value = json_encode($value, JSON_FORCE_OBJECT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate before the value is modelled (basic, override in child class)
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param string|null $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function validateBefore(&$value, ?string $field = null, ?string $table = null): bool
|
||||
{
|
||||
// check values
|
||||
if (StringHelper::check($value) || ArrayHelper::check($value, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// remove empty values
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate after the value is modelled (basic, override in child class)
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param string|null $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function validateAfter(&$value, ?string $field = null, ?string $table = null): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current active table
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getTable(): string
|
||||
{
|
||||
return $this->config->table_name;
|
||||
}
|
||||
|
||||
}
|
||||
|
106
src/02efe40a-7792-4c82-9444-7d0377243483/code.power
Normal file
106
src/02efe40a-7792-4c82-9444-7d0377243483/code.power
Normal file
@ -0,0 +1,106 @@
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
parent::__construct($table ?? Factory::_('Table'));
|
||||
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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->getTable();
|
||||
}
|
||||
|
||||
// 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((string) $value);
|
||||
break;
|
||||
case 'json':
|
||||
$value = json_encode($value, JSON_FORCE_OBJECT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate before the value is modelled (basic, override in child class)
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param string|null $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function validateBefore(&$value, ?string $field = null, ?string $table = null): bool
|
||||
{
|
||||
// check values
|
||||
if (StringHelper::check($value) || ArrayHelper::check($value, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// remove empty values
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate after the value is modelled (basic, override in child class)
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param string|null $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function validateAfter(&$value, ?string $field = null, ?string $table = null): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current active table
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getTable(): string
|
||||
{
|
||||
return $this->config->table_name;
|
||||
}
|
33
src/02efe40a-7792-4c82-9444-7d0377243483/settings.json
Normal file
33
src/02efe40a-7792-4c82-9444-7d0377243483/settings.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "584747d1-3a86-453d-b7a3-a2219de8d777",
|
||||
"guid": "02efe40a-7792-4c82-9444-7d0377243483",
|
||||
"implements": [
|
||||
"8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Insert",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Model.Insert",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "01a89ba8-f8bb-435c-93de-0a8f3fa9432a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "6e2ca779-f70e-4871-a138-0ee5eaec6a97",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Model.Insert",
|
||||
"description": "Search Insert Model\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
163
src/0b658434-3767-401e-addc-eabfd1d0e94a/README.md
Normal file
163
src/0b658434-3767-401e-addc-eabfd1d0e94a/README.md
Normal file
@ -0,0 +1,163 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Agent (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search**
|
||||
```uml
|
||||
@startuml
|
||||
class Agent #Gold {
|
||||
# Config $config
|
||||
# Load $load
|
||||
# Insert $insert
|
||||
# Find $find
|
||||
# Replace $replace
|
||||
# Search $search
|
||||
# Update $update
|
||||
# Table $table
|
||||
# string $return
|
||||
# array $marker
|
||||
# array $markerHtml
|
||||
+ __construct(?Config $config = null, ?Load $load = null, ...)
|
||||
+ getValue(int $id, string $field, ...) : ?string
|
||||
+ setValue(mixed $value, int $id, ...) : bool
|
||||
+ table(?string $table = null) : ?array
|
||||
+ find(?string $table = null) : ?array
|
||||
+ replace(?string $table = null) : int
|
||||
# getRow(string $code, string $table, ...) : array
|
||||
# getRowCode(string $code) : string
|
||||
# getRowEditButton(string $view, string $field, ...) : string
|
||||
# setReturnValue() : void
|
||||
# setMarkers() : void
|
||||
}
|
||||
|
||||
note right of Agent::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
|
||||
arguments:
|
||||
?Config $config = null
|
||||
?Load $load = null
|
||||
?Insert $insert = null
|
||||
?Find $find = null
|
||||
?Replace $replace = null
|
||||
?Search $search = null
|
||||
?Update $update = null
|
||||
?Table $table = null
|
||||
end note
|
||||
|
||||
note left of Agent::getValue
|
||||
Get the value of a field in a row and table
|
||||
|
||||
since: 3.2.0
|
||||
return: ?string
|
||||
|
||||
arguments:
|
||||
int $id
|
||||
string $field
|
||||
mixed $line = null
|
||||
?string $table = null
|
||||
bool $update = false
|
||||
end note
|
||||
|
||||
note right of Agent::setValue
|
||||
Set the value of a field in a row and table
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
|
||||
arguments:
|
||||
mixed $value
|
||||
int $id
|
||||
string $field
|
||||
?string $table = null
|
||||
end note
|
||||
|
||||
note left of Agent::table
|
||||
Return Table Ready Search Results
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note right of Agent::find
|
||||
Search the posted table for the search value and return all
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note left of Agent::replace
|
||||
Search the posted table for the search value, and replace all
|
||||
|
||||
since: 3.2.0
|
||||
return: int
|
||||
end note
|
||||
|
||||
note right of Agent::getRow
|
||||
Return prepared code string for table
|
||||
|
||||
since: 3.2.0
|
||||
return: array
|
||||
|
||||
arguments:
|
||||
string $code
|
||||
string $table
|
||||
string $field
|
||||
int $id
|
||||
mixed $line
|
||||
end note
|
||||
|
||||
note left of Agent::getRowCode
|
||||
Return prepared code string for table
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Agent::getRowEditButton
|
||||
Get the Item button to edit an item
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
|
||||
arguments:
|
||||
string $view
|
||||
string $field
|
||||
int $id
|
||||
mixed $line
|
||||
end note
|
||||
|
||||
note left of Agent::setReturnValue
|
||||
Set the return value for this search
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Agent::setMarkers
|
||||
Set the markers of the found code
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
425
src/0b658434-3767-401e-addc-eabfd1d0e94a/code.php
Normal file
425
src/0b658434-3767-401e-addc-eabfd1d0e94a/code.php
Normal file
@ -0,0 +1,425 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\CMS\Language\Text;
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Database\Load;
|
||||
use VDM\Joomla\Componentbuilder\Search\Database\Insert;
|
||||
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;
|
||||
use VDM\Joomla\Componentbuilder\Table;
|
||||
|
||||
|
||||
/**
|
||||
* Search Agent
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Agent
|
||||
{
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Search Load Database
|
||||
*
|
||||
* @var Load
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Load $load;
|
||||
|
||||
/**
|
||||
* Search Insert Database
|
||||
*
|
||||
* @var Insert
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Insert $insert;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Update
|
||||
*
|
||||
* @var Update
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Update $update;
|
||||
|
||||
/**
|
||||
* Table
|
||||
*
|
||||
* @var Table
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Table $table;
|
||||
|
||||
/**
|
||||
* Return value to search view
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $return;
|
||||
|
||||
/**
|
||||
* Marker start and end values
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $marker;
|
||||
|
||||
/**
|
||||
* Marker start and end html values
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $markerHtml;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
* @param Load|null $load The search load database object.
|
||||
* @param Insert|null $insert The search insert 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.
|
||||
* @param Update|null $update The update object.
|
||||
* @param Table|null $table The table object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Load $load = null,
|
||||
?Insert $insert = null, ?Find $find = null, ?Replace $replace = null,
|
||||
?Search $search = null, ?Update $update = null, ?Table $table = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
$this->load = $load ?: Factory::_('Load.Database');
|
||||
$this->insert = $insert ?: Factory::_('Insert.Database');
|
||||
$this->find = $find ?: Factory::_('Agent.Find');
|
||||
$this->replace = $replace ?: Factory::_('Agent.Replace');
|
||||
$this->search = $search ?: Factory::_('Agent.Search');
|
||||
$this->update = $update ?: Factory::_('Agent.Update');
|
||||
$this->table = $table ?: Factory::_('Table');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of a field in a row and table
|
||||
*
|
||||
* @param int $id The item ID
|
||||
* @param string $field The field key
|
||||
* @param mixed $line The field line
|
||||
* @param string|null $table The table
|
||||
* @param bool $update The switch to triger an update (default is false)
|
||||
*
|
||||
* @return string|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getValue(int $id, string $field, $line = null,
|
||||
?string $table = null, bool $update = false): ?string
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
if (($value = $this->load->value($id, $field, $table)) !== null)
|
||||
{
|
||||
// we only return strings that can load in an editor
|
||||
if (is_string($value))
|
||||
{
|
||||
// try to update the value if required
|
||||
if ($update && ($updated_value = $this->update->value($value, $line)) !== null)
|
||||
{
|
||||
return $updated_value;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
return '// VALUE CAN NOT BE LOADED (AT THIS TIME) SINCE ITS NOT A STRING';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of a field in a row and table
|
||||
*
|
||||
* @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 setValue($value, int $id, string $field, ?string $table = null): bool
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
return $this->insert->value($value, $id, $field, $table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Table Ready Search Results
|
||||
*
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function table(?string $table = null): ?array
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
if(($values = $this->find($table)) !== null)
|
||||
{
|
||||
// build return value
|
||||
$this->setReturnValue();
|
||||
|
||||
// set the markers
|
||||
$this->setMarkers();
|
||||
|
||||
// start table bucket
|
||||
$table_rows = [];
|
||||
|
||||
foreach ($values as $id => $fields)
|
||||
{
|
||||
foreach ($fields as $field => $lines)
|
||||
{
|
||||
foreach ($lines as $line => $code)
|
||||
{
|
||||
$table_rows[] = $this->getRow($code, $table, $field, $id, $line);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $table_rows;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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->load->items($table, $set)) !== null)
|
||||
{
|
||||
$this->find->items($items, $table);
|
||||
$set++;
|
||||
}
|
||||
|
||||
return $this->search->get($table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search the posted table for the search value, and replace all
|
||||
*
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return int
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function replace(?string $table = null): int
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
$set = 1;
|
||||
$replaced = 0;
|
||||
|
||||
// continue loading items until all was loaded
|
||||
while(($items = $this->load->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
|
||||
if ($this->insert->items($this->replace->get($table), $table))
|
||||
{
|
||||
$replaced++;
|
||||
}
|
||||
|
||||
// reset found items
|
||||
$this->find->reset($table);
|
||||
$this->replace->reset($table);
|
||||
|
||||
$set++;
|
||||
}
|
||||
|
||||
// we return the number of times we replaced
|
||||
return $replaced;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prepared code string for table
|
||||
*
|
||||
* @param string $code The code value fro the table
|
||||
* @param string|null $table The table
|
||||
* @param string $field The field key
|
||||
* @param int $id The the row id
|
||||
* @param mixed $line The code line where found
|
||||
*
|
||||
* @return array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getRow(string $code, string $table, string $field, int $id, $line): array
|
||||
{
|
||||
return [
|
||||
'edit' => $this->getRowEditButton($table, $field, $id, $line),
|
||||
'code' => $this->getRowCode($code),
|
||||
'table' => $table,
|
||||
'field' => $field,
|
||||
'id' => $id,
|
||||
'line' => $line
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prepared code string for table
|
||||
*
|
||||
* @param string $code The code value fro the table
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getRowCode(string $code): string
|
||||
{
|
||||
return str_replace($this->marker, $this->markerHtml, htmlentities($code));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item button to edit an item
|
||||
*
|
||||
* @param string|null $view The single view
|
||||
* @param string $field The field key
|
||||
* @param int $id The the row id
|
||||
* @param mixed $line The code line where found
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getRowEditButton(string $view, string $field, int $id, $line): string
|
||||
{
|
||||
// get list view
|
||||
$views = $this->table->get($view, $field, 'list');
|
||||
$tab = $this->table->get($view, $field, 'tab_name');
|
||||
|
||||
// return edit link
|
||||
return '<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder' .
|
||||
'&view=' . $views .
|
||||
'&task=' . $view . '.edit' .
|
||||
'&id=' . $id .
|
||||
'&open_tab=' . $tab .
|
||||
'&open_field=' . $field .
|
||||
'&return=' . $this->return . '" title="' .
|
||||
Text::sprintf('COM_COMPONENTBUILDER_EDIT_S_S_DIRECTLY', $view, $field) . '." ><span class="icon-edit"></span></a>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the return value for this search
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function setReturnValue()
|
||||
{
|
||||
// set the return value so the search auto load on return
|
||||
$this->return = urlencode(base64_encode('index.php?option=com_componentbuilder&view=search' .
|
||||
'&type_search=' . (int) $this->config->type_search .
|
||||
'&match_case=' . (int) $this->config->match_case .
|
||||
'&whole_word=' . (int) $this->config->whole_word .
|
||||
'®ex_search=' . (int) $this->config->regex_search .
|
||||
'&search_value=' . (string) urlencode((string) $this->config->search_value) .
|
||||
'&replace_value=' . (string) urlencode((string) $this->config->replace_value)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the markers of the found code
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function setMarkers()
|
||||
{
|
||||
// set the markers
|
||||
$this->marker = [$this->config->marker_start, $this->config->marker_end];
|
||||
$this->markerHtml = ['<span class="found_code">','</span>'];
|
||||
}
|
||||
|
||||
}
|
||||
|
389
src/0b658434-3767-401e-addc-eabfd1d0e94a/code.power
Normal file
389
src/0b658434-3767-401e-addc-eabfd1d0e94a/code.power
Normal file
@ -0,0 +1,389 @@
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Search Load Database
|
||||
*
|
||||
* @var Load
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Load $load;
|
||||
|
||||
/**
|
||||
* Search Insert Database
|
||||
*
|
||||
* @var Insert
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Insert $insert;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Update
|
||||
*
|
||||
* @var Update
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Update $update;
|
||||
|
||||
/**
|
||||
* Table
|
||||
*
|
||||
* @var Table
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Table $table;
|
||||
|
||||
/**
|
||||
* Return value to search view
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $return;
|
||||
|
||||
/**
|
||||
* Marker start and end values
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $marker;
|
||||
|
||||
/**
|
||||
* Marker start and end html values
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $markerHtml;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
* @param Load|null $load The search load database object.
|
||||
* @param Insert|null $insert The search insert 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.
|
||||
* @param Update|null $update The update object.
|
||||
* @param Table|null $table The table object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Load $load = null,
|
||||
?Insert $insert = null, ?Find $find = null, ?Replace $replace = null,
|
||||
?Search $search = null, ?Update $update = null, ?Table $table = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
$this->load = $load ?: Factory::_('Load.Database');
|
||||
$this->insert = $insert ?: Factory::_('Insert.Database');
|
||||
$this->find = $find ?: Factory::_('Agent.Find');
|
||||
$this->replace = $replace ?: Factory::_('Agent.Replace');
|
||||
$this->search = $search ?: Factory::_('Agent.Search');
|
||||
$this->update = $update ?: Factory::_('Agent.Update');
|
||||
$this->table = $table ?: Factory::_('Table');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of a field in a row and table
|
||||
*
|
||||
* @param int $id The item ID
|
||||
* @param string $field The field key
|
||||
* @param mixed $line The field line
|
||||
* @param string|null $table The table
|
||||
* @param bool $update The switch to triger an update (default is false)
|
||||
*
|
||||
* @return string|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getValue(int $id, string $field, $line = null,
|
||||
?string $table = null, bool $update = false): ?string
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
if (($value = $this->load->value($id, $field, $table)) !== null)
|
||||
{
|
||||
// we only return strings that can load in an editor
|
||||
if (is_string($value))
|
||||
{
|
||||
// try to update the value if required
|
||||
if ($update && ($updated_value = $this->update->value($value, $line)) !== null)
|
||||
{
|
||||
return $updated_value;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
return '// VALUE CAN NOT BE LOADED (AT THIS TIME) SINCE ITS NOT A STRING';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of a field in a row and table
|
||||
*
|
||||
* @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 setValue($value, int $id, string $field, ?string $table = null): bool
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
return $this->insert->value($value, $id, $field, $table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Table Ready Search Results
|
||||
*
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function table(?string $table = null): ?array
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
if(($values = $this->find($table)) !== null)
|
||||
{
|
||||
// build return value
|
||||
$this->setReturnValue();
|
||||
|
||||
// set the markers
|
||||
$this->setMarkers();
|
||||
|
||||
// start table bucket
|
||||
$table_rows = [];
|
||||
|
||||
foreach ($values as $id => $fields)
|
||||
{
|
||||
foreach ($fields as $field => $lines)
|
||||
{
|
||||
foreach ($lines as $line => $code)
|
||||
{
|
||||
$table_rows[] = $this->getRow($code, $table, $field, $id, $line);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $table_rows;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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->load->items($table, $set)) !== null)
|
||||
{
|
||||
$this->find->items($items, $table);
|
||||
$set++;
|
||||
}
|
||||
|
||||
return $this->search->get($table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search the posted table for the search value, and replace all
|
||||
*
|
||||
* @param string|null $table The table being searched
|
||||
*
|
||||
* @return int
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function replace(?string $table = null): int
|
||||
{
|
||||
// set the table name
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
$set = 1;
|
||||
$replaced = 0;
|
||||
|
||||
// continue loading items until all was loaded
|
||||
while(($items = $this->load->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
|
||||
if ($this->insert->items($this->replace->get($table), $table))
|
||||
{
|
||||
$replaced++;
|
||||
}
|
||||
|
||||
// reset found items
|
||||
$this->find->reset($table);
|
||||
$this->replace->reset($table);
|
||||
|
||||
$set++;
|
||||
}
|
||||
|
||||
// we return the number of times we replaced
|
||||
return $replaced;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prepared code string for table
|
||||
*
|
||||
* @param string $code The code value fro the table
|
||||
* @param string|null $table The table
|
||||
* @param string $field The field key
|
||||
* @param int $id The the row id
|
||||
* @param mixed $line The code line where found
|
||||
*
|
||||
* @return array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getRow(string $code, string $table, string $field, int $id, $line): array
|
||||
{
|
||||
return [
|
||||
'edit' => $this->getRowEditButton($table, $field, $id, $line),
|
||||
'code' => $this->getRowCode($code),
|
||||
'table' => $table,
|
||||
'field' => $field,
|
||||
'id' => $id,
|
||||
'line' => $line
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prepared code string for table
|
||||
*
|
||||
* @param string $code The code value fro the table
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getRowCode(string $code): string
|
||||
{
|
||||
return str_replace($this->marker, $this->markerHtml, htmlentities($code));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item button to edit an item
|
||||
*
|
||||
* @param string|null $view The single view
|
||||
* @param string $field The field key
|
||||
* @param int $id The the row id
|
||||
* @param mixed $line The code line where found
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getRowEditButton(string $view, string $field, int $id, $line): string
|
||||
{
|
||||
// get list view
|
||||
$views = $this->table->get($view, $field, 'list');
|
||||
$tab = $this->table->get($view, $field, 'tab_name');
|
||||
|
||||
// return edit link
|
||||
return '<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder' .
|
||||
'&view=' . $views .
|
||||
'&task=' . $view . '.edit' .
|
||||
'&id=' . $id .
|
||||
'&open_tab=' . $tab .
|
||||
'&open_field=' . $field .
|
||||
'&return=' . $this->return . '" title="' .
|
||||
Text::sprintf('Edit %s (%s) directly', $view, $field) . '." ><span class="icon-edit"></span></a>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the return value for this search
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function setReturnValue()
|
||||
{
|
||||
// set the return value so the search auto load on return
|
||||
$this->return = urlencode(base64_encode('index.php?option=com_componentbuilder&view=search' .
|
||||
'&type_search=' . (int) $this->config->type_search .
|
||||
'&match_case=' . (int) $this->config->match_case .
|
||||
'&whole_word=' . (int) $this->config->whole_word .
|
||||
'®ex_search=' . (int) $this->config->regex_search .
|
||||
'&search_value=' . (string) urlencode((string) $this->config->search_value) .
|
||||
'&replace_value=' . (string) urlencode((string) $this->config->replace_value)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the markers of the found code
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function setMarkers()
|
||||
{
|
||||
// set the markers
|
||||
$this->marker = [$this->config->marker_start, $this->config->marker_end];
|
||||
$this->markerHtml = ['<span class="found_code">','</span>'];
|
||||
}
|
55
src/0b658434-3767-401e-addc-eabfd1d0e94a/settings.json
Normal file
55
src/0b658434-3767-401e-addc-eabfd1d0e94a/settings.json
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "0b658434-3767-401e-addc-eabfd1d0e94a",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "Agent",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Agent",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "01a89ba8-f8bb-435c-93de-0a8f3fa9432a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "6e2ca779-f70e-4871-a138-0ee5eaec6a97",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "2dabfb4a-64cd-4c04-9772-4a75f9f3b710",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "6caf9473-133c-49a9-afa0-9f84151b5155",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "15d9e1a9-3364-4d69-9d9f-9b87db820e5c",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection5": {
|
||||
"use": "abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection6": {
|
||||
"use": "e544a248-4b6a-46cb-9926-a3ac9937807c",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection7": {
|
||||
"use": "3ac29912-0681-4ca9-8197-d5a8f6a49ac7",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection8": {
|
||||
"use": "bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Agent",
|
||||
"description": "Search Agent\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\CMS\\Language\\Text;",
|
||||
"composer": ""
|
||||
}
|
59
src/0d9442ab-54d9-4947-a219-244cfaea3084/README.md
Normal file
59
src/0d9442ab-54d9-4947-a219-244cfaea3084/README.md
Normal file
@ -0,0 +1,59 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface SearchInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Interfaces**
|
||||
```uml
|
||||
@startuml
|
||||
interface SearchInterface #Lavender {
|
||||
+ get(string $table) : ?array
|
||||
+ value(mixed $value, int $id, ...) : bool
|
||||
+ reset(string $table) : void
|
||||
}
|
||||
|
||||
note right of SearchInterface::get
|
||||
Get found values
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note right of SearchInterface::value
|
||||
Search inside a value
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
|
||||
arguments:
|
||||
mixed $value
|
||||
int $id
|
||||
string $field
|
||||
string $table
|
||||
end note
|
||||
|
||||
note right of SearchInterface::reset
|
||||
Empty the found values
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
56
src/0d9442ab-54d9-4947-a219-244cfaea3084/code.php
Normal file
56
src/0d9442ab-54d9-4947-a219-244cfaea3084/code.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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 Interface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface SearchInterface
|
||||
{
|
||||
/**
|
||||
* Get found values
|
||||
*
|
||||
* @param string $table The table being searched
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(string $table): ?array;
|
||||
|
||||
/**
|
||||
* Search inside a value
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param int $id The item ID
|
||||
* @param string $field The field key
|
||||
* @param string $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value($value, int $id, string $field, string $table): bool;
|
||||
|
||||
/**
|
||||
* Empty the found values
|
||||
*
|
||||
* @param string $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function reset(string $table);
|
||||
|
||||
}
|
||||
|
32
src/0d9442ab-54d9-4947-a219-244cfaea3084/code.power
Normal file
32
src/0d9442ab-54d9-4947-a219-244cfaea3084/code.power
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Get found values
|
||||
*
|
||||
* @param string $table The table being searched
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(string $table): ?array;
|
||||
|
||||
/**
|
||||
* Search inside a value
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param int $id The item ID
|
||||
* @param string $field The field key
|
||||
* @param string $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value($value, int $id, string $field, string $table): bool;
|
||||
|
||||
/**
|
||||
* Empty the found values
|
||||
*
|
||||
* @param string $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function reset(string $table);
|
18
src/0d9442ab-54d9-4947-a219-244cfaea3084/settings.json
Normal file
18
src/0d9442ab-54d9-4947-a219-244cfaea3084/settings.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "0d9442ab-54d9-4947-a219-244cfaea3084",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "SearchInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Interfaces.SearchInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Interfaces.SearchInterface",
|
||||
"description": "Search Interface\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
45
src/117d8c9e-3f8d-40ae-b375-1efa2fe5538a/README.md
Normal file
45
src/117d8c9e-3f8d-40ae-b375-1efa2fe5538a/README.md
Normal file
@ -0,0 +1,45 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface SearchTypeInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Interfaces**
|
||||
```uml
|
||||
@startuml
|
||||
interface SearchTypeInterface #Lavender {
|
||||
+ string(string $value) : ?string
|
||||
+ replace(string $value) : string
|
||||
}
|
||||
|
||||
note right of SearchTypeInterface::string
|
||||
Search inside a string
|
||||
|
||||
since: 3.2.0
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
note right of SearchTypeInterface::replace
|
||||
Replace found instances inside string value
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
43
src/117d8c9e-3f8d-40ae-b375-1efa2fe5538a/code.php
Normal file
43
src/117d8c9e-3f8d-40ae-b375-1efa2fe5538a/code.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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 Type Interface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface SearchTypeInterface
|
||||
{
|
||||
/**
|
||||
* Search inside a string
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return string|null The marked string if found, else null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function string(string $value): ?string;
|
||||
|
||||
/**
|
||||
* Replace found instances inside string value
|
||||
*
|
||||
* @param string $value The string value to update
|
||||
*
|
||||
* @return string The updated string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function replace(string $value): string;
|
||||
|
||||
}
|
||||
|
19
src/117d8c9e-3f8d-40ae-b375-1efa2fe5538a/code.power
Normal file
19
src/117d8c9e-3f8d-40ae-b375-1efa2fe5538a/code.power
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Search inside a string
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return string|null The marked string if found, else null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function string(string $value): ?string;
|
||||
|
||||
/**
|
||||
* Replace found instances inside string value
|
||||
*
|
||||
* @param string $value The string value to update
|
||||
*
|
||||
* @return string The updated string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function replace(string $value): string;
|
18
src/117d8c9e-3f8d-40ae-b375-1efa2fe5538a/settings.json
Normal file
18
src/117d8c9e-3f8d-40ae-b375-1efa2fe5538a/settings.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "117d8c9e-3f8d-40ae-b375-1efa2fe5538a",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "SearchTypeInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Interfaces.SearchTypeInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Interfaces.SearchTypeInterface",
|
||||
"description": "Search Type Interface\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
76
src/15d9e1a9-3364-4d69-9d9f-9b87db820e5c/README.md
Normal file
76
src/15d9e1a9-3364-4d69-9d9f-9b87db820e5c/README.md
Normal file
@ -0,0 +1,76 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Find (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Agent**
|
||||
```uml
|
||||
@startuml
|
||||
class Find #Gold {
|
||||
# array $found
|
||||
# Config $config
|
||||
# Search $search
|
||||
+ __construct(?Config $config = null, ?Search $search = null)
|
||||
+ get(?string $table = null) : ?array
|
||||
+ item(object $item, ?int $id = null, ...) : void
|
||||
+ items(?array $items = null, ?string $table = null) : void
|
||||
+ reset(?string $table = null) : void
|
||||
}
|
||||
|
||||
note right of Find::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note right of Find::get
|
||||
Get found values
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note right of Find::item
|
||||
Search over an item fields
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
|
||||
arguments:
|
||||
object $item
|
||||
?int $id = null
|
||||
?string $table = null
|
||||
end note
|
||||
|
||||
note right of Find::items
|
||||
Search over an array of items
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Find::reset
|
||||
Reset all found values of a table
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
180
src/15d9e1a9-3364-4d69-9d9f-9b87db820e5c/code.php
Normal file
180
src/15d9e1a9-3364-4d69-9d9f-9b87db820e5c/code.php
Normal file
@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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]);
|
||||
}
|
||||
|
||||
}
|
||||
|
148
src/15d9e1a9-3364-4d69-9d9f-9b87db820e5c/code.power
Normal file
148
src/15d9e1a9-3364-4d69-9d9f-9b87db820e5c/code.power
Normal file
@ -0,0 +1,148 @@
|
||||
/**
|
||||
* 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]);
|
||||
}
|
41
src/15d9e1a9-3364-4d69-9d9f-9b87db820e5c/settings.json
Normal file
41
src/15d9e1a9-3364-4d69-9d9f-9b87db820e5c/settings.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "15d9e1a9-3364-4d69-9d9f-9b87db820e5c",
|
||||
"implements": [
|
||||
"55280ec7-e48d-431b-af25-10308dd30636"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Find",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Agent.Find",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "91004529-94a9-4590-b842-e7c6b624ecf5",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "01a89ba8-f8bb-435c-93de-0a8f3fa9432a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "6e2ca779-f70e-4871-a138-0ee5eaec6a97",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "e544a248-4b6a-46cb-9926-a3ac9937807c",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Agent.Find",
|
||||
"description": "Search Agent Find\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
61
src/2bd1a32c-3d90-4646-9314-28d44d164f76/README.md
Normal file
61
src/2bd1a32c-3d90-4646-9314-28d44d164f76/README.md
Normal file
@ -0,0 +1,61 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface LoadInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Interfaces**
|
||||
```uml
|
||||
@startuml
|
||||
interface LoadInterface #Lavender {
|
||||
+ value(int $id, string $field, ...) : mixed
|
||||
+ item(int $id, string $table = null) : ?object
|
||||
+ items(string $table = null, int $bundle) : ?array
|
||||
}
|
||||
|
||||
note right of LoadInterface::value
|
||||
Get a value from a given table
|
||||
Example: $this->value(23, 'value_key', 'table_name');
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
|
||||
arguments:
|
||||
int $id
|
||||
string $field
|
||||
string $table = null
|
||||
end note
|
||||
|
||||
note right of LoadInterface::item
|
||||
Get values from a given table
|
||||
Example: $this->item(23, 'table_name');
|
||||
|
||||
since: 3.2.0
|
||||
return: ?object
|
||||
end note
|
||||
|
||||
note right of LoadInterface::items
|
||||
Get values from a given table
|
||||
Example: $this->items('table_name');
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
60
src/2bd1a32c-3d90-4646-9314-28d44d164f76/code.php
Normal file
60
src/2bd1a32c-3d90-4646-9314-28d44d164f76/code.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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 Load Interface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface LoadInterface
|
||||
{
|
||||
/**
|
||||
* Get a value from a given table
|
||||
* Example: $this->value(23, 'value_key', 'table_name');
|
||||
*
|
||||
* @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(int $id, string $field, 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;
|
||||
|
||||
}
|
||||
|
36
src/2bd1a32c-3d90-4646-9314-28d44d164f76/code.power
Normal file
36
src/2bd1a32c-3d90-4646-9314-28d44d164f76/code.power
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Get a value from a given table
|
||||
* Example: $this->value(23, 'value_key', 'table_name');
|
||||
*
|
||||
* @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(int $id, string $field, 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;
|
18
src/2bd1a32c-3d90-4646-9314-28d44d164f76/settings.json
Normal file
18
src/2bd1a32c-3d90-4646-9314-28d44d164f76/settings.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "2bd1a32c-3d90-4646-9314-28d44d164f76",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "LoadInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Interfaces.LoadInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Interfaces.LoadInterface",
|
||||
"description": "Search Database Load Interface\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
108
src/2dabfb4a-64cd-4c04-9772-4a75f9f3b710/README.md
Normal file
108
src/2dabfb4a-64cd-4c04-9772-4a75f9f3b710/README.md
Normal file
@ -0,0 +1,108 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Load (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Database**
|
||||
```uml
|
||||
@startuml
|
||||
class Load #Gold {
|
||||
# int $bundle
|
||||
# Config $config
|
||||
# Table $table
|
||||
# Model $model
|
||||
# Database $load
|
||||
+ __construct(?Config $config = null, ?Table $table = null, ...)
|
||||
+ value(int $id, string $field, ...) : mixed
|
||||
+ item(int $id, string $table = null) : ?object
|
||||
+ items(string $table = null, int $bundle) : ?array
|
||||
# next(string $table, int $bundle) : int
|
||||
# incremental(int $bundle) : int
|
||||
# setDatabaseFields(string $table, string $key = 'a', ...) : ?array
|
||||
}
|
||||
|
||||
note right of Load::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
|
||||
arguments:
|
||||
?Config $config = null
|
||||
?Table $table = null
|
||||
?Model $model = null
|
||||
?Database $load = null
|
||||
end note
|
||||
|
||||
note right of Load::value
|
||||
Get a value from a given table
|
||||
Example: $this->value(23, 'value_key', 'table_name');
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
|
||||
arguments:
|
||||
int $id
|
||||
string $field
|
||||
string $table = null
|
||||
end note
|
||||
|
||||
note right of Load::item
|
||||
Get values from a given table
|
||||
Example: $this->item(23, 'table_name');
|
||||
|
||||
since: 3.2.0
|
||||
return: ?object
|
||||
end note
|
||||
|
||||
note right of Load::items
|
||||
Get values from a given table
|
||||
Example: $this->items('table_name');
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note right of Load::next
|
||||
Get next id to call
|
||||
|
||||
since: 3.2.0
|
||||
return: int
|
||||
end note
|
||||
|
||||
note right of Load::incremental
|
||||
Get Incremental number where the set starts
|
||||
|
||||
since: 3.2.0
|
||||
return: int
|
||||
end note
|
||||
|
||||
note right of Load::setDatabaseFields
|
||||
Get Fields ready to use in database call
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
|
||||
arguments:
|
||||
string $table
|
||||
string $key = 'a'
|
||||
bool $addId = true
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
305
src/2dabfb4a-64cd-4c04-9772-4a75f9f3b710/code.php
Normal file
305
src/2dabfb4a-64cd-4c04-9772-4a75f9f3b710/code.php
Normal file
@ -0,0 +1,305 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\Table;
|
||||
use VDM\Joomla\Componentbuilder\Search\Model\Load as Model;
|
||||
use VDM\Joomla\Componentbuilder\Database\Load as Database;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\LoadInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Search Database Load
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Load implements LoadInterface
|
||||
{
|
||||
/**
|
||||
* 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 load class
|
||||
*
|
||||
* @var Database
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Database $load;
|
||||
|
||||
/**
|
||||
* 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 Database|null $load The database object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Table $table = null,
|
||||
?Model $model = null, ?Database $load = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
$this->table = $table ?: Factory::_('Table');
|
||||
$this->model = $model ?: Factory::_('Load.Model');
|
||||
$this->load = $load ?: Factory::_('Load');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from a given table
|
||||
* Example: $this->value(23, 'value_key', 'table_name');
|
||||
*
|
||||
* @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(int $id, string $field, string $table = null)
|
||||
{
|
||||
// load the table
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// check if this is a valid table
|
||||
if ($id > 0 && $this->table->exist($table, $field) &&
|
||||
($value = $this->load->value(
|
||||
["a.${field}" => $field], // select
|
||||
['a' => $table], // tables
|
||||
['a.id' => $id] // where
|
||||
)) !== null)
|
||||
{
|
||||
return $this->model->value(
|
||||
$value, $field, $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->setDatabaseFields($table)) !== null &&
|
||||
($item = $this->load->item(
|
||||
$fields, // select
|
||||
['a' => $table], // tables
|
||||
['a.id' => $id] // where
|
||||
)) !== null)
|
||||
{
|
||||
// return found values
|
||||
return $this->model->item($item, $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->setDatabaseFields($table)) !== null)
|
||||
{
|
||||
// add a key to the selection return set
|
||||
$fields['key'] = 'id';
|
||||
// get the title value
|
||||
$title = $this->table->titleName($table);
|
||||
// set order
|
||||
$order = ['a.' . $title => 'ASC'];
|
||||
// select all
|
||||
$where = null;
|
||||
// no limit
|
||||
$limit = null;
|
||||
|
||||
// add limitation and pagination
|
||||
if ($bundle > 0)
|
||||
{
|
||||
// get the incremental number
|
||||
$where = ['a.id' => [
|
||||
'operator' => '>=',
|
||||
'value' => $this->next($table, $bundle)
|
||||
]
|
||||
];
|
||||
|
||||
// only return a limited number
|
||||
$limit = $this->bundle;
|
||||
}
|
||||
|
||||
if (($items = $this->load->items(
|
||||
$fields, // select
|
||||
['a' => $table], // tables
|
||||
$where,
|
||||
$order,
|
||||
$limit
|
||||
)) !== null)
|
||||
{
|
||||
// return found values
|
||||
return $this->model->items($items, $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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Fields ready to use in database call
|
||||
*
|
||||
* @param string $table The table which fields we want to get
|
||||
* @param string $key The table key to which the fields belong
|
||||
* @param bool $addId The switch to add ID
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function setDatabaseFields(string $table, string $key = 'a', bool $addId = true): ?array
|
||||
{
|
||||
if (($fields = $this->table->fields($table)) !== null)
|
||||
{
|
||||
// add the ID
|
||||
if ($addId)
|
||||
{
|
||||
array_unshift($fields , 'id');
|
||||
}
|
||||
|
||||
$bucket = [];
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$bucket[$key . '.' . $field] = $field;
|
||||
}
|
||||
|
||||
return $bucket;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
272
src/2dabfb4a-64cd-4c04-9772-4a75f9f3b710/code.power
Normal file
272
src/2dabfb4a-64cd-4c04-9772-4a75f9f3b710/code.power
Normal file
@ -0,0 +1,272 @@
|
||||
/**
|
||||
* 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 load class
|
||||
*
|
||||
* @var Database
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Database $load;
|
||||
|
||||
/**
|
||||
* 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 Database|null $load The database object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?Table $table = null,
|
||||
?Model $model = null, ?Database $load = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
$this->table = $table ?: Factory::_('Table');
|
||||
$this->model = $model ?: Factory::_('Load.Model');
|
||||
$this->load = $load ?: Factory::_('Load');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from a given table
|
||||
* Example: $this->value(23, 'value_key', 'table_name');
|
||||
*
|
||||
* @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(int $id, string $field, string $table = null)
|
||||
{
|
||||
// load the table
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// check if this is a valid table
|
||||
if ($id > 0 && $this->table->exist($table, $field) &&
|
||||
($value = $this->load->value(
|
||||
["a.${field}" => $field], // select
|
||||
['a' => $table], // tables
|
||||
['a.id' => $id] // where
|
||||
)) !== null)
|
||||
{
|
||||
return $this->model->value(
|
||||
$value, $field, $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->setDatabaseFields($table)) !== null &&
|
||||
($item = $this->load->item(
|
||||
$fields, // select
|
||||
['a' => $table], // tables
|
||||
['a.id' => $id] // where
|
||||
)) !== null)
|
||||
{
|
||||
// return found values
|
||||
return $this->model->item($item, $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->setDatabaseFields($table)) !== null)
|
||||
{
|
||||
// add a key to the selection return set
|
||||
$fields['key'] = 'id';
|
||||
// get the title value
|
||||
$title = $this->table->titleName($table);
|
||||
// set order
|
||||
$order = ['a.' . $title => 'ASC'];
|
||||
// select all
|
||||
$where = null;
|
||||
// no limit
|
||||
$limit = null;
|
||||
|
||||
// add limitation and pagination
|
||||
if ($bundle > 0)
|
||||
{
|
||||
// get the incremental number
|
||||
$where = ['a.id' => [
|
||||
'operator' => '>=',
|
||||
'value' => $this->next($table, $bundle)
|
||||
]
|
||||
];
|
||||
|
||||
// only return a limited number
|
||||
$limit = $this->bundle;
|
||||
}
|
||||
|
||||
if (($items = $this->load->items(
|
||||
$fields, // select
|
||||
['a' => $table], // tables
|
||||
$where,
|
||||
$order,
|
||||
$limit
|
||||
)) !== null)
|
||||
{
|
||||
// return found values
|
||||
return $this->model->items($items, $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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Fields ready to use in database call
|
||||
*
|
||||
* @param string $table The table which fields we want to get
|
||||
* @param string $key The table key to which the fields belong
|
||||
* @param bool $addId The switch to add ID
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function setDatabaseFields(string $table, string $key = 'a', bool $addId = true): ?array
|
||||
{
|
||||
if (($fields = $this->table->fields($table)) !== null)
|
||||
{
|
||||
// add the ID
|
||||
if ($addId)
|
||||
{
|
||||
array_unshift($fields , 'id');
|
||||
}
|
||||
|
||||
$bucket = [];
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$bucket[$key . '.' . $field] = $field;
|
||||
}
|
||||
|
||||
return $bucket;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
41
src/2dabfb4a-64cd-4c04-9772-4a75f9f3b710/settings.json
Normal file
41
src/2dabfb4a-64cd-4c04-9772-4a75f9f3b710/settings.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "2dabfb4a-64cd-4c04-9772-4a75f9f3b710",
|
||||
"implements": [
|
||||
"2bd1a32c-3d90-4646-9314-28d44d164f76"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Load",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Database.Load",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "01a89ba8-f8bb-435c-93de-0a8f3fa9432a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "6e2ca779-f70e-4871-a138-0ee5eaec6a97",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "f523ab49-907a-4356-b064-51c85a187fbd",
|
||||
"as": "Model"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "06f8eada-d59b-441c-b287-0aea1793da5a",
|
||||
"as": "Database"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Database.Load",
|
||||
"description": "Search Database Load\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\CMS\\Factory as JoomlaFactory;",
|
||||
"composer": ""
|
||||
}
|
76
src/3ac29912-0681-4ca9-8197-d5a8f6a49ac7/README.md
Normal file
76
src/3ac29912-0681-4ca9-8197-d5a8f6a49ac7/README.md
Normal file
@ -0,0 +1,76 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Update (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Agent**
|
||||
```uml
|
||||
@startuml
|
||||
class Update #Gold {
|
||||
# SearchEngine $search
|
||||
+ __construct(?SearchEngine $search = null)
|
||||
+ value(mixed $value, mixed $line) : mixed
|
||||
# updateValue(mixed $value, mixed $line) : mixed
|
||||
# validateUpdateKey(int $line, mixed $keys = null, ...) : bool
|
||||
# string(string $value, int $line) : string
|
||||
}
|
||||
|
||||
note right of Update::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note right of Update::value
|
||||
Update the value
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
note right of Update::updateValue
|
||||
Update all search-replace instances inside a value
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
note right of Update::validateUpdateKey
|
||||
Check if the keys are valid for search when working with arrays
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
|
||||
arguments:
|
||||
int $line
|
||||
mixed $keys = null
|
||||
mixed $key = null
|
||||
$ke = null
|
||||
mixed $k = null
|
||||
end note
|
||||
|
||||
note right of Update::string
|
||||
Update all search-replace instances inside a string
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
236
src/3ac29912-0681-4ca9-8197-d5a8f6a49ac7/code.php
Normal file
236
src/3ac29912-0681-4ca9-8197-d5a8f6a49ac7/code.php
Normal file
@ -0,0 +1,236 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\StringHelper;
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\SearchTypeInterface as SearchEngine;
|
||||
|
||||
|
||||
/**
|
||||
* Search Agent Update
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Update
|
||||
{
|
||||
/**
|
||||
* Search Engine
|
||||
*
|
||||
* @var SearchEngine
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected SearchEngine $search;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param SearchEngine|null $search The search engine object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?SearchEngine $search = null)
|
||||
{
|
||||
$this->search = $search ?: Factory::_('Search');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the value
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param mixed $line The line to update (0 = all)
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value($value, $line = 0)
|
||||
{
|
||||
// update the value
|
||||
$update = $this->updateValue($value, $line);
|
||||
|
||||
// was anything updated
|
||||
if ($value === $update)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return $update;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all search-replace instances inside a value
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param mixed $line The line to update (0 = all)
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function updateValue($value, $line = 0)
|
||||
{
|
||||
// I know this is a little crazy... TODO refactor into recursion functions
|
||||
// the possibility of updating sub-forms in sub-forms
|
||||
if (ArrayHelper::check($value))
|
||||
{
|
||||
if (strpos((string) $line, '.') !== false)
|
||||
{
|
||||
$line = explode('.', (string) $line);
|
||||
}
|
||||
// first layer
|
||||
foreach ($value as $keys => &$rows)
|
||||
{
|
||||
if (ArrayHelper::check($rows))
|
||||
{
|
||||
// second layer
|
||||
foreach ($rows as $key => &$row)
|
||||
{
|
||||
if (ArrayHelper::check($row))
|
||||
{
|
||||
// third layer
|
||||
foreach ($row as $ke => &$ro)
|
||||
{
|
||||
if (ArrayHelper::check($ro))
|
||||
{
|
||||
// forth layer
|
||||
foreach ($ro as $k => &$r)
|
||||
{
|
||||
if (StringHelper::check($r) &&
|
||||
$this->validateUpdateKey($line, $keys, $key, $ke, $k))
|
||||
{
|
||||
$_line = (isset($line[4])) ? $line[4] : 0;
|
||||
$r = $this->string($r, $_line);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($ro) &&
|
||||
$this->validateUpdateKey($line, $keys, $key, $ke))
|
||||
{
|
||||
$_line = (isset($line[3])) ? $line[3] : 0;
|
||||
$ro = $this->string($ro, $_line);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($row) &&
|
||||
$this->validateUpdateKey($line, $keys, $key))
|
||||
{
|
||||
$_line = (isset($line[2])) ? $line[2] : 0;
|
||||
$row = $this->string($row, $_line);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($rows) &&
|
||||
$this->validateUpdateKey($line, $keys))
|
||||
{
|
||||
$_line = (isset($line[1])) ? $line[1] : 0;
|
||||
$rows = $this->string($rows, $_line);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($value))
|
||||
{
|
||||
$value = $this->string($value, $line);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the keys are valid for search when working with arrays
|
||||
*
|
||||
* @param int $line The lines array
|
||||
* @param mixed $keys The line keys
|
||||
* @param mixed $key The line key
|
||||
* @param mixed $k The line ke
|
||||
* @param mixed $k The line k
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function validateUpdateKey($line, $keys = null, $key = null, $ke = null, $k = null): bool
|
||||
{
|
||||
if (ArrayHelper::check($line))
|
||||
{
|
||||
$_keys = (isset($line[0])) ? $line[0] : null;
|
||||
$_key = (isset($line[1])) ? $line[1] : null;
|
||||
$_ke = (isset($line[2])) ? $line[2] : null;
|
||||
$_k = (isset($line[3])) ? $line[3] : null;
|
||||
|
||||
if ($keys && $_keys && $_keys !== $keys)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($key && $_key && $_key !== $key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($ke && $_ke && $_ke !== $ke)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($k && $_k && $_k !== $k)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all search-replace instances inside a string
|
||||
*
|
||||
* @param string $value The field value
|
||||
* @param int $line The line to update (0 = all)
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function string(string $value, int $line = 0): string
|
||||
{
|
||||
// check if string has a new line
|
||||
if (\preg_match('/\R/', $value) && $line > 0)
|
||||
{
|
||||
// line counter
|
||||
$line_number = 1;
|
||||
|
||||
$search_array = \preg_split('/\R/', $value);
|
||||
|
||||
// loop over the lines
|
||||
foreach ($search_array as $nr => $line_value)
|
||||
{
|
||||
if ($line_number == $line)
|
||||
{
|
||||
$search_array[$nr] = $this->search->replace($line_value);
|
||||
|
||||
// since we are targeting on line (and possibly one number)
|
||||
// this can only happen once, and so we return at this point
|
||||
return implode(PHP_EOL, $search_array);
|
||||
}
|
||||
// next line
|
||||
$line_number++;
|
||||
}
|
||||
|
||||
// no update took place so we just return the original value
|
||||
return $value;
|
||||
}
|
||||
|
||||
return $this->search->replace($value);
|
||||
}
|
||||
|
||||
}
|
||||
|
206
src/3ac29912-0681-4ca9-8197-d5a8f6a49ac7/code.power
Normal file
206
src/3ac29912-0681-4ca9-8197-d5a8f6a49ac7/code.power
Normal file
@ -0,0 +1,206 @@
|
||||
/**
|
||||
* Search Engine
|
||||
*
|
||||
* @var SearchEngine
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected SearchEngine $search;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param SearchEngine|null $search The search engine object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?SearchEngine $search = null)
|
||||
{
|
||||
$this->search = $search ?: Factory::_('Search');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the value
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param mixed $line The line to update (0 = all)
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value($value, $line = 0)
|
||||
{
|
||||
// update the value
|
||||
$update = $this->updateValue($value, $line);
|
||||
|
||||
// was anything updated
|
||||
if ($value === $update)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return $update;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all search-replace instances inside a value
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param mixed $line The line to update (0 = all)
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function updateValue($value, $line = 0)
|
||||
{
|
||||
// I know this is a little crazy... TODO refactor into recursion functions
|
||||
// the possibility of updating sub-forms in sub-forms
|
||||
if (ArrayHelper::check($value))
|
||||
{
|
||||
if (strpos((string) $line, '.') !== false)
|
||||
{
|
||||
$line = explode('.', (string) $line);
|
||||
}
|
||||
// first layer
|
||||
foreach ($value as $keys => &$rows)
|
||||
{
|
||||
if (ArrayHelper::check($rows))
|
||||
{
|
||||
// second layer
|
||||
foreach ($rows as $key => &$row)
|
||||
{
|
||||
if (ArrayHelper::check($row))
|
||||
{
|
||||
// third layer
|
||||
foreach ($row as $ke => &$ro)
|
||||
{
|
||||
if (ArrayHelper::check($ro))
|
||||
{
|
||||
// forth layer
|
||||
foreach ($ro as $k => &$r)
|
||||
{
|
||||
if (StringHelper::check($r) &&
|
||||
$this->validateUpdateKey($line, $keys, $key, $ke, $k))
|
||||
{
|
||||
$_line = (isset($line[4])) ? $line[4] : 0;
|
||||
$r = $this->string($r, $_line);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($ro) &&
|
||||
$this->validateUpdateKey($line, $keys, $key, $ke))
|
||||
{
|
||||
$_line = (isset($line[3])) ? $line[3] : 0;
|
||||
$ro = $this->string($ro, $_line);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($row) &&
|
||||
$this->validateUpdateKey($line, $keys, $key))
|
||||
{
|
||||
$_line = (isset($line[2])) ? $line[2] : 0;
|
||||
$row = $this->string($row, $_line);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($rows) &&
|
||||
$this->validateUpdateKey($line, $keys))
|
||||
{
|
||||
$_line = (isset($line[1])) ? $line[1] : 0;
|
||||
$rows = $this->string($rows, $_line);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($value))
|
||||
{
|
||||
$value = $this->string($value, $line);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the keys are valid for search when working with arrays
|
||||
*
|
||||
* @param int $line The lines array
|
||||
* @param mixed $keys The line keys
|
||||
* @param mixed $key The line key
|
||||
* @param mixed $k The line ke
|
||||
* @param mixed $k The line k
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function validateUpdateKey($line, $keys = null, $key = null, $ke = null, $k = null): bool
|
||||
{
|
||||
if (ArrayHelper::check($line))
|
||||
{
|
||||
$_keys = (isset($line[0])) ? $line[0] : null;
|
||||
$_key = (isset($line[1])) ? $line[1] : null;
|
||||
$_ke = (isset($line[2])) ? $line[2] : null;
|
||||
$_k = (isset($line[3])) ? $line[3] : null;
|
||||
|
||||
if ($keys && $_keys && $_keys !== $keys)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($key && $_key && $_key !== $key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($ke && $_ke && $_ke !== $ke)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($k && $_k && $_k !== $k)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all search-replace instances inside a string
|
||||
*
|
||||
* @param string $value The field value
|
||||
* @param int $line The line to update (0 = all)
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function string(string $value, int $line = 0): string
|
||||
{
|
||||
// check if string has a new line
|
||||
if (\preg_match('/\R/', $value) && $line > 0)
|
||||
{
|
||||
// line counter
|
||||
$line_number = 1;
|
||||
|
||||
$search_array = \preg_split('/\R/', $value);
|
||||
|
||||
// loop over the lines
|
||||
foreach ($search_array as $nr => $line_value)
|
||||
{
|
||||
if ($line_number == $line)
|
||||
{
|
||||
$search_array[$nr] = $this->search->replace($line_value);
|
||||
|
||||
// since we are targeting on line (and possibly one number)
|
||||
// this can only happen once, and so we return at this point
|
||||
return implode(PHP_EOL, $search_array);
|
||||
}
|
||||
// next line
|
||||
$line_number++;
|
||||
}
|
||||
|
||||
// no update took place so we just return the original value
|
||||
return $value;
|
||||
}
|
||||
|
||||
return $this->search->replace($value);
|
||||
}
|
35
src/3ac29912-0681-4ca9-8197-d5a8f6a49ac7/settings.json
Normal file
35
src/3ac29912-0681-4ca9-8197-d5a8f6a49ac7/settings.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "3ac29912-0681-4ca9-8197-d5a8f6a49ac7",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "Update",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Agent.Update",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "01a89ba8-f8bb-435c-93de-0a8f3fa9432a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "117d8c9e-3f8d-40ae-b375-1efa2fe5538a",
|
||||
"as": "SearchEngine"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Agent.Update",
|
||||
"description": "Search Agent Update\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
62
src/4c44e5d3-750c-4609-88c8-aa441838b8fe/README.md
Normal file
62
src/4c44e5d3-750c-4609-88c8-aa441838b8fe/README.md
Normal file
@ -0,0 +1,62 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface InsertInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Interfaces**
|
||||
```uml
|
||||
@startuml
|
||||
interface InsertInterface #Lavender {
|
||||
+ value(mixed $value, int $id, ...) : bool
|
||||
+ item(object $item, ?string $table = null) : bool
|
||||
+ items(array $items, string $table = null) : bool
|
||||
}
|
||||
|
||||
note right of InsertInterface::value
|
||||
Set values to a given table
|
||||
Example: $this->value(Value, 23, 'value_key', 'table_name');
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
|
||||
arguments:
|
||||
mixed $value
|
||||
int $id
|
||||
string $field
|
||||
?string $table = null
|
||||
end note
|
||||
|
||||
note right of InsertInterface::item
|
||||
Set values to a given table
|
||||
Example: $this->item(Object, 23, 'table_name');
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note right of InsertInterface::items
|
||||
Set values to a given table
|
||||
Example: $this->items(Array, 'table_name');
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
60
src/4c44e5d3-750c-4609-88c8-aa441838b8fe/code.php
Normal file
60
src/4c44e5d3-750c-4609-88c8-aa441838b8fe/code.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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 Insert Interface
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
interface InsertInterface
|
||||
{
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
37
src/4c44e5d3-750c-4609-88c8-aa441838b8fe/code.power
Normal file
37
src/4c44e5d3-750c-4609-88c8-aa441838b8fe/code.power
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 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;
|
18
src/4c44e5d3-750c-4609-88c8-aa441838b8fe/settings.json
Normal file
18
src/4c44e5d3-750c-4609-88c8-aa441838b8fe/settings.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "4c44e5d3-750c-4609-88c8-aa441838b8fe",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "InsertInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Interfaces.InsertInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Interfaces.InsertInterface",
|
||||
"description": "Search Database Insert Interface\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
66
src/55280ec7-e48d-431b-af25-10308dd30636/README.md
Normal file
66
src/55280ec7-e48d-431b-af25-10308dd30636/README.md
Normal file
@ -0,0 +1,66 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface FindInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Interfaces**
|
||||
```uml
|
||||
@startuml
|
||||
interface FindInterface #Lavender {
|
||||
+ get(?string $table = null) : ?array
|
||||
+ item(object $item, ?int $id = null, ...) : void
|
||||
+ items(?array $items = null, ?string $table = null) : void
|
||||
+ reset(?string $table = null) : void
|
||||
}
|
||||
|
||||
note right of FindInterface::get
|
||||
Get found values
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note right of FindInterface::item
|
||||
Search over an item fields
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
|
||||
arguments:
|
||||
object $item
|
||||
?int $id = null
|
||||
?string $table = null
|
||||
end note
|
||||
|
||||
note right of FindInterface::items
|
||||
Search over an array of items
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of FindInterface::reset
|
||||
Reset all found values of a table
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
66
src/55280ec7-e48d-431b-af25-10308dd30636/code.php
Normal file
66
src/55280ec7-e48d-431b-af25-10308dd30636/code.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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);
|
||||
|
||||
}
|
||||
|
42
src/55280ec7-e48d-431b-af25-10308dd30636/code.power
Normal file
42
src/55280ec7-e48d-431b-af25-10308dd30636/code.power
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* 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);
|
18
src/55280ec7-e48d-431b-af25-10308dd30636/settings.json
Normal file
18
src/55280ec7-e48d-431b-af25-10308dd30636/settings.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "55280ec7-e48d-431b-af25-10308dd30636",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "FindInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Interfaces.FindInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Interfaces.FindInterface",
|
||||
"description": "Search Find Interface\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
79
src/6caf9473-133c-49a9-afa0-9f84151b5155/README.md
Normal file
79
src/6caf9473-133c-49a9-afa0-9f84151b5155/README.md
Normal file
@ -0,0 +1,79 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Insert (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Database**
|
||||
```uml
|
||||
@startuml
|
||||
class Insert #Gold {
|
||||
# Config $config
|
||||
# Table $table
|
||||
# Model $model
|
||||
# \JDatabaseDriver $db
|
||||
+ __construct(?Config $config = null, ?Table $table = null, ...)
|
||||
+ value(mixed $value, int $id, ...) : bool
|
||||
+ item(object $item, ?string $table = null) : bool
|
||||
+ items(?array $items, string $table = null) : bool
|
||||
}
|
||||
|
||||
note right of Insert::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
|
||||
arguments:
|
||||
?Config $config = null
|
||||
?Table $table = null
|
||||
?Model $model = null
|
||||
?\JDatabaseDriver $db = null
|
||||
end note
|
||||
|
||||
note right of Insert::value
|
||||
Set values to a given table
|
||||
Example: $this->value(Value, 23, 'value_key', 'table_name');
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
|
||||
arguments:
|
||||
mixed $value
|
||||
int $id
|
||||
string $field
|
||||
?string $table = null
|
||||
end note
|
||||
|
||||
note right of Insert::item
|
||||
Set values to a given table
|
||||
Example: $this->item(Object, 'table_name');
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note right of Insert::items
|
||||
Set values to a given table
|
||||
Example: $this->items(Array, 'table_name');
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
188
src/6caf9473-133c-49a9-afa0-9f84151b5155/code.php
Normal file
188
src/6caf9473-133c-49a9-afa0-9f84151b5155/code.php
Normal file
@ -0,0 +1,188 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\Table;
|
||||
use VDM\Joomla\Componentbuilder\Search\Model\Insert as Model;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\InsertInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Search Database Set
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Insert implements InsertInterface
|
||||
{
|
||||
/**
|
||||
* 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::_('Insert.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, '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|null $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))
|
||||
{
|
||||
$success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $success;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
155
src/6caf9473-133c-49a9-afa0-9f84151b5155/code.power
Normal file
155
src/6caf9473-133c-49a9-afa0-9f84151b5155/code.power
Normal file
@ -0,0 +1,155 @@
|
||||
/**
|
||||
* 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::_('Insert.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, '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|null $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))
|
||||
{
|
||||
$success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $success;
|
||||
}
|
||||
return false;
|
||||
}
|
41
src/6caf9473-133c-49a9-afa0-9f84151b5155/settings.json
Normal file
41
src/6caf9473-133c-49a9-afa0-9f84151b5155/settings.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "6caf9473-133c-49a9-afa0-9f84151b5155",
|
||||
"implements": [
|
||||
"4c44e5d3-750c-4609-88c8-aa441838b8fe"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Insert",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Database.Insert",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "01a89ba8-f8bb-435c-93de-0a8f3fa9432a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "6e2ca779-f70e-4871-a138-0ee5eaec6a97",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "02efe40a-7792-4c82-9444-7d0377243483",
|
||||
"as": "Model"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Database.Insert",
|
||||
"description": "Search Database Set\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\CMS\\Factory as JoomlaFactory;",
|
||||
"composer": ""
|
||||
}
|
141
src/6e2ca779-f70e-4871-a138-0ee5eaec6a97/README.md
Normal file
141
src/6e2ca779-f70e-4871-a138-0ee5eaec6a97/README.md
Normal file
@ -0,0 +1,141 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Config (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search**
|
||||
```uml
|
||||
@startuml
|
||||
class Config #Gold {
|
||||
# getTypesearch() : ?int
|
||||
# getSearchvalue() : ?string
|
||||
# getReplacevalue() : string
|
||||
# getMatchcase() : int
|
||||
# getWholeword() : int
|
||||
# getRegexsearch() : int
|
||||
# getComponentid() : int
|
||||
# getTablename() : ?string
|
||||
# getFieldname() : ?string
|
||||
# getItemid() : int
|
||||
# getFieldcounter() : int
|
||||
# getLinecounter() : int
|
||||
# getMarkerstart() : string
|
||||
# getMarkerend() : string
|
||||
}
|
||||
|
||||
note right of Config::getTypesearch
|
||||
get type search being preformed
|
||||
|
||||
since: 3.2.0
|
||||
return: ?int
|
||||
end note
|
||||
|
||||
note left of Config::getSearchvalue
|
||||
get posted search value
|
||||
|
||||
since: 3.2.0
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
note right of Config::getReplacevalue
|
||||
get posted replace value
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note left of Config::getMatchcase
|
||||
get posted search match case
|
||||
|
||||
since: 3.2.0
|
||||
return: int
|
||||
end note
|
||||
|
||||
note right of Config::getWholeword
|
||||
get posted search whole word
|
||||
|
||||
since: 3.2.0
|
||||
return: int
|
||||
end note
|
||||
|
||||
note left of Config::getRegexsearch
|
||||
get posted search regex
|
||||
|
||||
since: 3.2.0
|
||||
return: int
|
||||
end note
|
||||
|
||||
note right of Config::getComponentid
|
||||
get posted component
|
||||
|
||||
since: 3.2.0
|
||||
return: int
|
||||
end note
|
||||
|
||||
note left of Config::getTablename
|
||||
get posted area/table
|
||||
|
||||
since: 3.2.0
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
note right of Config::getFieldname
|
||||
get posted field
|
||||
|
||||
since: 3.2.0
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
note left of Config::getItemid
|
||||
get posted item id
|
||||
|
||||
since: 3.2.0
|
||||
return: int
|
||||
end note
|
||||
|
||||
note right of Config::getFieldcounter
|
||||
get field counter
|
||||
|
||||
since: 3.2.0
|
||||
return: int
|
||||
end note
|
||||
|
||||
note left of Config::getLinecounter
|
||||
get line counter
|
||||
|
||||
since: 3.2.0
|
||||
return: int
|
||||
end note
|
||||
|
||||
note right of Config::getMarkerstart
|
||||
get the start marker
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note left of Config::getMarkerend
|
||||
get the end marker
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
180
src/6e2ca779-f70e-4871-a138-0ee5eaec6a97/code.php
Normal file
180
src/6e2ca779-f70e-4871-a138-0ee5eaec6a97/code.php
Normal file
@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\Abstraction\BaseConfig;
|
||||
|
||||
|
||||
/**
|
||||
* Search Configurations
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Config extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* get type search being preformed
|
||||
*
|
||||
* @return int the search type 1 = search, 2 = search & replace
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getTypesearch(): ?int
|
||||
{
|
||||
return $this->input->get('type_search', 1, 'INT');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted search value
|
||||
*
|
||||
* @return string|null Raw search value
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getSearchvalue(): ?string
|
||||
{
|
||||
return $this->input->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->get('replace_value', '', 'RAW');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted search match case
|
||||
*
|
||||
* @return int Match case
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getMatchcase(): int
|
||||
{
|
||||
return $this->input->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->get('whole_word', 0, 'INT');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted search regex
|
||||
*
|
||||
* @return int Regex
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getRegexsearch(): int
|
||||
{
|
||||
return $this->input->get('regex_search', 0, 'INT');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted component
|
||||
*
|
||||
* @return int Component ID
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getComponentid(): int
|
||||
{
|
||||
return $this->input->get('component_id', 0, 'INT');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted area/table
|
||||
*
|
||||
* @return string|null Table name
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getTablename(): ?string
|
||||
{
|
||||
return $this->input->get('table_name', null, 'word');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted field
|
||||
*
|
||||
* @return string|null Field name
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getFieldname(): ?string
|
||||
{
|
||||
return $this->input->get('field_name', null, 'word');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted item id
|
||||
*
|
||||
* @return int Item id
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getItemid(): int
|
||||
{
|
||||
return $this->input->get('item_id', 0, 'INT');
|
||||
}
|
||||
|
||||
/**
|
||||
* get field counter
|
||||
*
|
||||
* @return int we start at 0
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getFieldcounter(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* get line counter
|
||||
*
|
||||
* @return int we start at 0
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getLinecounter(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the start marker
|
||||
*
|
||||
* @return string The string to use as the start marker
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getMarkerstart(): string
|
||||
{
|
||||
return '{+' . '|' . '=[';
|
||||
}
|
||||
|
||||
/**
|
||||
* get the end marker
|
||||
*
|
||||
* @return string The string to use as the end marker
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getMarkerend(): string
|
||||
{
|
||||
return ']=' . '|' . '+}';
|
||||
}
|
||||
|
||||
}
|
||||
|
153
src/6e2ca779-f70e-4871-a138-0ee5eaec6a97/code.power
Normal file
153
src/6e2ca779-f70e-4871-a138-0ee5eaec6a97/code.power
Normal file
@ -0,0 +1,153 @@
|
||||
/**
|
||||
* get type search being preformed
|
||||
*
|
||||
* @return int the search type 1 = search, 2 = search & replace
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getTypesearch(): ?int
|
||||
{
|
||||
return $this->input->get('type_search', 1, 'INT');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted search value
|
||||
*
|
||||
* @return string|null Raw search value
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getSearchvalue(): ?string
|
||||
{
|
||||
return $this->input->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->get('replace_value', '', 'RAW');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted search match case
|
||||
*
|
||||
* @return int Match case
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getMatchcase(): int
|
||||
{
|
||||
return $this->input->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->get('whole_word', 0, 'INT');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted search regex
|
||||
*
|
||||
* @return int Regex
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getRegexsearch(): int
|
||||
{
|
||||
return $this->input->get('regex_search', 0, 'INT');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted component
|
||||
*
|
||||
* @return int Component ID
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getComponentid(): int
|
||||
{
|
||||
return $this->input->get('component_id', 0, 'INT');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted area/table
|
||||
*
|
||||
* @return string|null Table name
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getTablename(): ?string
|
||||
{
|
||||
return $this->input->get('table_name', null, 'word');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted field
|
||||
*
|
||||
* @return string|null Field name
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getFieldname(): ?string
|
||||
{
|
||||
return $this->input->get('field_name', null, 'word');
|
||||
}
|
||||
|
||||
/**
|
||||
* get posted item id
|
||||
*
|
||||
* @return int Item id
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getItemid(): int
|
||||
{
|
||||
return $this->input->get('item_id', 0, 'INT');
|
||||
}
|
||||
|
||||
/**
|
||||
* get field counter
|
||||
*
|
||||
* @return int we start at 0
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getFieldcounter(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* get line counter
|
||||
*
|
||||
* @return int we start at 0
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getLinecounter(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the start marker
|
||||
*
|
||||
* @return string The string to use as the start marker
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getMarkerstart(): string
|
||||
{
|
||||
return '{+' . '|' . '=[';
|
||||
}
|
||||
|
||||
/**
|
||||
* get the end marker
|
||||
*
|
||||
* @return string The string to use as the end marker
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getMarkerend(): string
|
||||
{
|
||||
return ']=' . '|' . '+}';
|
||||
}
|
18
src/6e2ca779-f70e-4871-a138-0ee5eaec6a97/settings.json
Normal file
18
src/6e2ca779-f70e-4871-a138-0ee5eaec6a97/settings.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "9769f3b2-17bf-4f20-b54b-3a4ebe572b36",
|
||||
"guid": "6e2ca779-f70e-4871-a138-0ee5eaec6a97",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "Config",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Config",
|
||||
"type": "class",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Config",
|
||||
"description": "Search Configurations\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
53
src/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a/README.md
Normal file
53
src/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a/README.md
Normal file
@ -0,0 +1,53 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Model (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Service**
|
||||
```uml
|
||||
@startuml
|
||||
class Model #Gold {
|
||||
+ register(Container $container) : void
|
||||
+ getModelLoad(Container $container) : Load
|
||||
+ getModelInsert(Container $container) : Insert
|
||||
}
|
||||
|
||||
note right of Model::register
|
||||
Registers the service provider with a DI container.
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Model::getModelLoad
|
||||
Get the Load Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Load
|
||||
end note
|
||||
|
||||
note right of Model::getModelInsert
|
||||
Get the Insert Model
|
||||
|
||||
since: 3.2.0
|
||||
return: Insert
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
77
src/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a/code.php
Normal file
77
src/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a/code.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\Load;
|
||||
use VDM\Joomla\Componentbuilder\Search\Model\Insert;
|
||||
|
||||
|
||||
/**
|
||||
* 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(Load::class, 'Load.Model')
|
||||
->share('Load.Model', [$this, 'getModelLoad'], true);
|
||||
$container->alias(Insert::class, 'Insert.Model')
|
||||
->share('Insert.Model', [$this, 'getModelInsert'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Load Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Load
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelLoad(Container $container): Load
|
||||
{
|
||||
return new Load(
|
||||
$container->get('Config'),
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Insert Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Insert
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelInsert(Container $container): Insert
|
||||
{
|
||||
return new Insert(
|
||||
$container->get('Config'),
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
47
src/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a/code.power
Normal file
47
src/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a/code.power
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* 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(Load::class, 'Load.Model')
|
||||
->share('Load.Model', [$this, 'getModelLoad'], true);
|
||||
$container->alias(Insert::class, 'Insert.Model')
|
||||
->share('Insert.Model', [$this, 'getModelInsert'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Load Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Load
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelLoad(Container $container): Load
|
||||
{
|
||||
return new Load(
|
||||
$container->get('Config'),
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Insert Model
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Insert
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getModelInsert(Container $container): Insert
|
||||
{
|
||||
return new Insert(
|
||||
$container->get('Config'),
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
30
src/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a/settings.json
Normal file
30
src/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a/settings.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a",
|
||||
"implements": [
|
||||
"-1"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Model",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Service.Model",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "f523ab49-907a-4356-b064-51c85a187fbd",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "02efe40a-7792-4c82-9444-7d0377243483",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Service.Model",
|
||||
"description": "Model Service Provider\r\n\r\n@since 3.2.0",
|
||||
"implements_custom": "ServiceProviderInterface",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;",
|
||||
"composer": ""
|
||||
}
|
61
src/83efa9a0-4aec-41f8-9c05-b1ac9617746e/README.md
Normal file
61
src/83efa9a0-4aec-41f8-9c05-b1ac9617746e/README.md
Normal file
@ -0,0 +1,61 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Regex (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Engine**
|
||||
```uml
|
||||
@startuml
|
||||
class Regex #Gold {
|
||||
# string $regexValue
|
||||
+ __construct(?Config $config = null)
|
||||
+ string(string $value) : ?string
|
||||
+ replace(string $value) : string
|
||||
+ match(string $value) : bool
|
||||
}
|
||||
|
||||
note right of Regex::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note right of Regex::string
|
||||
Search inside a string
|
||||
|
||||
since: 3.2.0
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
note right of Regex::replace
|
||||
Replace found instances inside string value
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Regex::match
|
||||
Math the Regular Expression
|
||||
|
||||
since: 3.0.9
|
||||
return: bool
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
128
src/83efa9a0-4aec-41f8-9c05-b1ac9617746e/code.php
Normal file
128
src/83efa9a0-4aec-41f8-9c05-b1ac9617746e/code.php
Normal file
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\Engine;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\SearchTypeInterface;
|
||||
use VDM\Joomla\Componentbuilder\Search\Abstraction\Engine;
|
||||
|
||||
|
||||
/**
|
||||
* Search Type Regex
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Regex extends Engine implements SearchTypeInterface
|
||||
{
|
||||
/**
|
||||
* Regex Search Value
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $regexValue = '';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null)
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
// set search based on match case
|
||||
$case = '';
|
||||
if ($this->matchCase == 0)
|
||||
{
|
||||
$case = 'i';
|
||||
}
|
||||
|
||||
$this->regexValue = "/(" . $this->searchValue . ")/" . $case;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search inside a string
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return string|null The marked string if found, else null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function string(string $value): ?string
|
||||
{
|
||||
// we count every line
|
||||
$this->lineCounter();
|
||||
|
||||
if (StringHelper::check($this->searchValue) && $this->match($value))
|
||||
{
|
||||
return trim(preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
$this->start . "$1" . $this->end,
|
||||
$value
|
||||
));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace found instances inside string value
|
||||
*
|
||||
* @param string $value The string value to update
|
||||
*
|
||||
* @return string The updated string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function replace(string $value): string
|
||||
{
|
||||
if (StringHelper::check($this->searchValue) && $this->match($value))
|
||||
{
|
||||
return preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
(string) $this->replaceValue,
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Math the Regular Expression
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return bool true if match is found
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public function match(string $value): bool
|
||||
{
|
||||
$match = [];
|
||||
|
||||
preg_match($this->regexValue, $value, $match);
|
||||
|
||||
$match = array_filter(
|
||||
$match,
|
||||
fn($found) => !empty($found)
|
||||
);
|
||||
|
||||
return (bool) ArrayHelper::check($match);
|
||||
}
|
||||
|
||||
}
|
||||
|
97
src/83efa9a0-4aec-41f8-9c05-b1ac9617746e/code.power
Normal file
97
src/83efa9a0-4aec-41f8-9c05-b1ac9617746e/code.power
Normal file
@ -0,0 +1,97 @@
|
||||
/**
|
||||
* Regex Search Value
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $regexValue = '';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null)
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
// set search based on match case
|
||||
$case = '';
|
||||
if ($this->matchCase == 0)
|
||||
{
|
||||
$case = 'i';
|
||||
}
|
||||
|
||||
$this->regexValue = "/(" . $this->searchValue . ")/" . $case;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search inside a string
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return string|null The marked string if found, else null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function string(string $value): ?string
|
||||
{
|
||||
// we count every line
|
||||
$this->lineCounter();
|
||||
|
||||
if (StringHelper::check($this->searchValue) && $this->match($value))
|
||||
{
|
||||
return trim(preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
$this->start . "$1" . $this->end,
|
||||
$value
|
||||
));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace found instances inside string value
|
||||
*
|
||||
* @param string $value The string value to update
|
||||
*
|
||||
* @return string The updated string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function replace(string $value): string
|
||||
{
|
||||
if (StringHelper::check($this->searchValue) && $this->match($value))
|
||||
{
|
||||
return preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
(string) $this->replaceValue,
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Math the Regular Expression
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return bool true if match is found
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public function match(string $value): bool
|
||||
{
|
||||
$match = [];
|
||||
|
||||
preg_match($this->regexValue, $value, $match);
|
||||
|
||||
$match = array_filter(
|
||||
$match,
|
||||
fn($found) => !empty($found)
|
||||
);
|
||||
|
||||
return (bool) ArrayHelper::check($match);
|
||||
}
|
33
src/83efa9a0-4aec-41f8-9c05-b1ac9617746e/settings.json
Normal file
33
src/83efa9a0-4aec-41f8-9c05-b1ac9617746e/settings.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "8f9449fc-bfbc-49a5-b146-d58c8c17dfdf",
|
||||
"guid": "83efa9a0-4aec-41f8-9c05-b1ac9617746e",
|
||||
"implements": [
|
||||
"117d8c9e-3f8d-40ae-b375-1efa2fe5538a"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Regex",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Engine.Regex",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "6e2ca779-f70e-4871-a138-0ee5eaec6a97",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Engine.Regex",
|
||||
"description": "Search Type Regex\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
50
src/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf/README.md
Normal file
50
src/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf/README.md
Normal file
@ -0,0 +1,50 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# abstract class Engine (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Abstraction**
|
||||
```uml
|
||||
@startuml
|
||||
abstract Engine #Orange {
|
||||
# Config $config
|
||||
# ?string $searchValue
|
||||
# string $replaceValue
|
||||
# int $matchCase
|
||||
# int $wholeWord
|
||||
# string $start
|
||||
# string $end
|
||||
+ __construct(?Config $config = null)
|
||||
# lineCounter()
|
||||
}
|
||||
|
||||
note right of Engine::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note right of Engine::lineCounter
|
||||
we count every line being searched
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
123
src/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf/code.php
Normal file
123
src/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf/code.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\Abstraction;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
|
||||
|
||||
/**
|
||||
* Search Engine
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
abstract class Engine
|
||||
{
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Search Value
|
||||
*
|
||||
* @var string|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?string $searchValue;
|
||||
|
||||
/**
|
||||
* Replace Value
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $replaceValue;
|
||||
|
||||
/**
|
||||
* Search Should Match Case
|
||||
*
|
||||
* @var int
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected int $matchCase = 0;
|
||||
|
||||
/**
|
||||
* Search Should Match Whole Word
|
||||
*
|
||||
* @var int
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected int $wholeWord = 0;
|
||||
|
||||
/**
|
||||
* Start marker
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $start = '';
|
||||
|
||||
/**
|
||||
* End marker
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $end = '';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
|
||||
// set search value
|
||||
$this->searchValue = $this->config->search_value;
|
||||
|
||||
// set replace value
|
||||
$this->replaceValue = $this->config->replace_value;
|
||||
|
||||
// set match case
|
||||
$this->matchCase = $this->config->match_case;
|
||||
|
||||
// set whole word
|
||||
$this->wholeWord = $this->config->whole_word;
|
||||
|
||||
// set start marker
|
||||
$this->start = $this->config->marker_start;
|
||||
|
||||
// set end marker
|
||||
$this->end = $this->config->marker_end;
|
||||
}
|
||||
|
||||
/**
|
||||
* we count every line being searched
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function lineCounter()
|
||||
{
|
||||
// we count every line we search
|
||||
$this->config->line_counter += 1;
|
||||
}
|
||||
}
|
||||
|
96
src/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf/code.power
Normal file
96
src/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf/code.power
Normal file
@ -0,0 +1,96 @@
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Search Value
|
||||
*
|
||||
* @var string|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?string $searchValue;
|
||||
|
||||
/**
|
||||
* Replace Value
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $replaceValue;
|
||||
|
||||
/**
|
||||
* Search Should Match Case
|
||||
*
|
||||
* @var int
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected int $matchCase = 0;
|
||||
|
||||
/**
|
||||
* Search Should Match Whole Word
|
||||
*
|
||||
* @var int
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected int $wholeWord = 0;
|
||||
|
||||
/**
|
||||
* Start marker
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $start = '';
|
||||
|
||||
/**
|
||||
* End marker
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $end = '';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
|
||||
// set search value
|
||||
$this->searchValue = $this->config->search_value;
|
||||
|
||||
// set replace value
|
||||
$this->replaceValue = $this->config->replace_value;
|
||||
|
||||
// set match case
|
||||
$this->matchCase = $this->config->match_case;
|
||||
|
||||
// set whole word
|
||||
$this->wholeWord = $this->config->whole_word;
|
||||
|
||||
// set start marker
|
||||
$this->start = $this->config->marker_start;
|
||||
|
||||
// set end marker
|
||||
$this->end = $this->config->marker_end;
|
||||
}
|
||||
|
||||
/**
|
||||
* we count every line being searched
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function lineCounter()
|
||||
{
|
||||
// we count every line we search
|
||||
$this->config->line_counter += 1;
|
||||
}
|
27
src/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf/settings.json
Normal file
27
src/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf/settings.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "8f9449fc-bfbc-49a5-b146-d58c8c17dfdf",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "Engine",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Abstraction.Engine",
|
||||
"type": "abstract class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "01a89ba8-f8bb-435c-93de-0a8f3fa9432a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "6e2ca779-f70e-4871-a138-0ee5eaec6a97",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Abstraction.Engine",
|
||||
"description": "Search Engine\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
76
src/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7/README.md
Normal file
76
src/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7/README.md
Normal file
@ -0,0 +1,76 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Replace (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Agent**
|
||||
```uml
|
||||
@startuml
|
||||
class Replace #Gold {
|
||||
# array $updated
|
||||
# Config $config
|
||||
# Update $update
|
||||
+ __construct(?Config $config = null, ?Update $update = null)
|
||||
+ get(?string $table = null) : ?array
|
||||
+ item(object $item, ?int $id = null, ...) : void
|
||||
+ items(?array $items = null, ?string $table = null) : void
|
||||
+ reset(?string $table = null) : void
|
||||
}
|
||||
|
||||
note right of Replace::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note right of Replace::get
|
||||
Get updated values
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note right of Replace::item
|
||||
Search over an item fields
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
|
||||
arguments:
|
||||
object $item
|
||||
?int $id = null
|
||||
?string $table = null
|
||||
end note
|
||||
|
||||
note right of Replace::items
|
||||
Search over an array of items
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Replace::reset
|
||||
Reset all updated values of a table
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
181
src/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7/code.php
Normal file
181
src/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7/code.php
Normal file
@ -0,0 +1,181 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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)) !== 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]);
|
||||
}
|
||||
|
||||
}
|
||||
|
149
src/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7/code.power
Normal file
149
src/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7/code.power
Normal file
@ -0,0 +1,149 @@
|
||||
/**
|
||||
* 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)) !== 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]);
|
||||
}
|
41
src/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7/settings.json
Normal file
41
src/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7/settings.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7",
|
||||
"implements": [
|
||||
"afdae35d-fe7f-4055-99ea-afd8ff8349b6"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Replace",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Agent.Replace",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "91004529-94a9-4590-b842-e7c6b624ecf5",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "01a89ba8-f8bb-435c-93de-0a8f3fa9432a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "6e2ca779-f70e-4871-a138-0ee5eaec6a97",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "3ac29912-0681-4ca9-8197-d5a8f6a49ac7",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Agent.Replace",
|
||||
"description": "Search Agent Replace\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
66
src/afdae35d-fe7f-4055-99ea-afd8ff8349b6/README.md
Normal file
66
src/afdae35d-fe7f-4055-99ea-afd8ff8349b6/README.md
Normal file
@ -0,0 +1,66 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface ReplaceInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Interfaces**
|
||||
```uml
|
||||
@startuml
|
||||
interface ReplaceInterface #Lavender {
|
||||
+ get(?string $table = null) : ?array
|
||||
+ item(object $item, ?int $id = null, ...) : void
|
||||
+ items(?array $items = null, ?string $table = null) : void
|
||||
+ reset(?string $table = null) : void
|
||||
}
|
||||
|
||||
note right of ReplaceInterface::get
|
||||
Get updated values
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note right of ReplaceInterface::item
|
||||
Search over an item fields
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
|
||||
arguments:
|
||||
object $item
|
||||
?int $id = null
|
||||
?string $table = null
|
||||
end note
|
||||
|
||||
note right of ReplaceInterface::items
|
||||
Search over an array of items
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of ReplaceInterface::reset
|
||||
Reset all updated values of a table
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
66
src/afdae35d-fe7f-4055-99ea-afd8ff8349b6/code.php
Normal file
66
src/afdae35d-fe7f-4055-99ea-afd8ff8349b6/code.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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);
|
||||
|
||||
}
|
||||
|
42
src/afdae35d-fe7f-4055-99ea-afd8ff8349b6/code.power
Normal file
42
src/afdae35d-fe7f-4055-99ea-afd8ff8349b6/code.power
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* 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);
|
18
src/afdae35d-fe7f-4055-99ea-afd8ff8349b6/settings.json
Normal file
18
src/afdae35d-fe7f-4055-99ea-afd8ff8349b6/settings.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "afdae35d-fe7f-4055-99ea-afd8ff8349b6",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "ReplaceInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Interfaces.ReplaceInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Interfaces.ReplaceInterface",
|
||||
"description": "Search Replace Interface\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
77
src/cc6972a7-1574-4ae0-92a8-7f1012aac6f7/README.md
Normal file
77
src/cc6972a7-1574-4ae0-92a8-7f1012aac6f7/README.md
Normal file
@ -0,0 +1,77 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Agent (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Service**
|
||||
```uml
|
||||
@startuml
|
||||
class Agent #Gold {
|
||||
+ register(Container $container) : void
|
||||
+ getAgent(Container $container) : SearchAgent
|
||||
+ getFind(Container $container) : Find
|
||||
+ getReplace(Container $container) : Replace
|
||||
+ getSearch(Container $container) : Search
|
||||
+ getUpdate(Container $container) : Update
|
||||
}
|
||||
|
||||
note right of Agent::register
|
||||
Registers the service provider with a DI container.
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Agent::getAgent
|
||||
Get the Search Agent
|
||||
|
||||
since: 3.2.0
|
||||
return: SearchAgent
|
||||
end note
|
||||
|
||||
note right of Agent::getFind
|
||||
Get the Search Agent Find
|
||||
|
||||
since: 3.2.0
|
||||
return: Find
|
||||
end note
|
||||
|
||||
note right of Agent::getReplace
|
||||
Get the Search Agent Replace
|
||||
|
||||
since: 3.2.0
|
||||
return: Replace
|
||||
end note
|
||||
|
||||
note right of Agent::getSearch
|
||||
Get the Search Agent Search
|
||||
|
||||
since: 3.2.0
|
||||
return: Search
|
||||
end note
|
||||
|
||||
note right of Agent::getUpdate
|
||||
Get the Search Agent Update
|
||||
|
||||
since: 3.2.0
|
||||
return: Update
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
143
src/cc6972a7-1574-4ae0-92a8-7f1012aac6f7/code.php
Normal file
143
src/cc6972a7-1574-4ae0-92a8-7f1012aac6f7/code.php
Normal file
@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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('Load.Database'),
|
||||
$container->get('Insert.Database'),
|
||||
$container->get('Agent.Find'),
|
||||
$container->get('Agent.Replace'),
|
||||
$container->get('Agent.Search'),
|
||||
$container->get('Agent.Update'),
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('Search')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('Search')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
110
src/cc6972a7-1574-4ae0-92a8-7f1012aac6f7/code.power
Normal file
110
src/cc6972a7-1574-4ae0-92a8-7f1012aac6f7/code.power
Normal file
@ -0,0 +1,110 @@
|
||||
/**
|
||||
* 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('Load.Database'),
|
||||
$container->get('Insert.Database'),
|
||||
$container->get('Agent.Find'),
|
||||
$container->get('Agent.Replace'),
|
||||
$container->get('Agent.Search'),
|
||||
$container->get('Agent.Update'),
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('Search')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('Search')
|
||||
);
|
||||
}
|
42
src/cc6972a7-1574-4ae0-92a8-7f1012aac6f7/settings.json
Normal file
42
src/cc6972a7-1574-4ae0-92a8-7f1012aac6f7/settings.json
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "cc6972a7-1574-4ae0-92a8-7f1012aac6f7",
|
||||
"implements": [
|
||||
"-1"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Agent",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Service.Agent",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "0b658434-3767-401e-addc-eabfd1d0e94a",
|
||||
"as": "SearchAgent"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "15d9e1a9-3364-4d69-9d9f-9b87db820e5c",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "e544a248-4b6a-46cb-9926-a3ac9937807c",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "3ac29912-0681-4ca9-8197-d5a8f6a49ac7",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Service.Agent",
|
||||
"description": "Agent Service Provider\r\n\r\n@since 3.2.0",
|
||||
"implements_custom": "ServiceProviderInterface",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;",
|
||||
"composer": ""
|
||||
}
|
61
src/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3/README.md
Normal file
61
src/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3/README.md
Normal file
@ -0,0 +1,61 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Database (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Service**
|
||||
```uml
|
||||
@startuml
|
||||
class Database #Gold {
|
||||
+ register(Container $container) : void
|
||||
+ getLoad(Container $container) : Load
|
||||
+ getDatabaseLoad(Container $container) : LoadDatabase
|
||||
+ getDatabaseInsert(Container $container) : InsertDatabase
|
||||
}
|
||||
|
||||
note right of Database::register
|
||||
Registers the service provider with a DI container.
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Database::getLoad
|
||||
Get the Core Load Database
|
||||
|
||||
since: 3.2.0
|
||||
return: Load
|
||||
end note
|
||||
|
||||
note right of Database::getDatabaseLoad
|
||||
Get the Load Database
|
||||
|
||||
since: 3.2.0
|
||||
return: LoadDatabase
|
||||
end note
|
||||
|
||||
note right of Database::getDatabaseInsert
|
||||
Get the Insert Database
|
||||
|
||||
since: 3.2.0
|
||||
return: InsertDatabase
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
98
src/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3/code.php
Normal file
98
src/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3/code.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\Database\Load;
|
||||
use VDM\Joomla\Componentbuilder\Search\Database\Load as LoadDatabase;
|
||||
use VDM\Joomla\Componentbuilder\Search\Database\Insert as InsertDatabase;
|
||||
|
||||
|
||||
/**
|
||||
* 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(Load::class, 'Load')
|
||||
->share('Load', [$this, 'getLoad'], true);
|
||||
|
||||
$container->alias(LoadDatabase::class, 'Load.Database')
|
||||
->share('Load.Database', [$this, 'getDatabaseLoad'], true);
|
||||
|
||||
$container->alias(InsertDatabase::class, 'Insert.Database')
|
||||
->share('Insert.Database', [$this, 'getDatabaseInsert'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Core Load Database
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Load
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getLoad(Container $container): Load
|
||||
{
|
||||
return new Load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Load Database
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return LoadDatabase
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getDatabaseLoad(Container $container): LoadDatabase
|
||||
{
|
||||
return new LoadDatabase(
|
||||
$container->get('Config'),
|
||||
$container->get('Table'),
|
||||
$container->get('Load.Model'),
|
||||
$container->get('Load')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Insert Database
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return InsertDatabase
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getDatabaseInsert(Container $container): InsertDatabase
|
||||
{
|
||||
return new InsertDatabase(
|
||||
$container->get('Config'),
|
||||
$container->get('Table'),
|
||||
$container->get('Insert.Model')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
67
src/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3/code.power
Normal file
67
src/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3/code.power
Normal file
@ -0,0 +1,67 @@
|
||||
/**
|
||||
* 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(Load::class, 'Load')
|
||||
->share('Load', [$this, 'getLoad'], true);
|
||||
|
||||
$container->alias(LoadDatabase::class, 'Load.Database')
|
||||
->share('Load.Database', [$this, 'getDatabaseLoad'], true);
|
||||
|
||||
$container->alias(InsertDatabase::class, 'Insert.Database')
|
||||
->share('Insert.Database', [$this, 'getDatabaseInsert'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Core Load Database
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Load
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getLoad(Container $container): Load
|
||||
{
|
||||
return new Load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Load Database
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return LoadDatabase
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getDatabaseLoad(Container $container): LoadDatabase
|
||||
{
|
||||
return new LoadDatabase(
|
||||
$container->get('Config'),
|
||||
$container->get('Table'),
|
||||
$container->get('Load.Model'),
|
||||
$container->get('Load')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Insert Database
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return InsertDatabase
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getDatabaseInsert(Container $container): InsertDatabase
|
||||
{
|
||||
return new InsertDatabase(
|
||||
$container->get('Config'),
|
||||
$container->get('Table'),
|
||||
$container->get('Insert.Model')
|
||||
);
|
||||
}
|
34
src/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3/settings.json
Normal file
34
src/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3/settings.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "d5de47ce-9a9e-4e76-a5c6-61ed74842ea3",
|
||||
"implements": [
|
||||
"-1"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Database",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Service.Database",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "06f8eada-d59b-441c-b287-0aea1793da5a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "2dabfb4a-64cd-4c04-9772-4a75f9f3b710",
|
||||
"as": "LoadDatabase"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "6caf9473-133c-49a9-afa0-9f84151b5155",
|
||||
"as": "InsertDatabase"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Service.Database",
|
||||
"description": "Database Service Provider\r\n\r\n@since 3.2.0",
|
||||
"implements_custom": "ServiceProviderInterface",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;",
|
||||
"composer": ""
|
||||
}
|
78
src/da714ea5-96bb-4eb1-959b-39b457be9cd1/README.md
Normal file
78
src/da714ea5-96bb-4eb1-959b-39b457be9cd1/README.md
Normal file
@ -0,0 +1,78 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Search (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Service**
|
||||
```uml
|
||||
@startuml
|
||||
class Search #Gold {
|
||||
# $searchEngine
|
||||
+ register(Container $container) : void
|
||||
+ getConfig(Container $container) : Config
|
||||
+ getTable(Container $container) : Table
|
||||
+ getRegex(Container $container) : Regex
|
||||
+ getBasic(Container $container) : Basic
|
||||
+ getSearch(Container $container) : SearchEngine
|
||||
}
|
||||
|
||||
note right of Search::register
|
||||
Registers the service provider with a DI container.
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Search::getConfig
|
||||
Get the Config
|
||||
|
||||
since: 3.2.0
|
||||
return: Config
|
||||
end note
|
||||
|
||||
note right of Search::getTable
|
||||
Get the Table
|
||||
|
||||
since: 3.2.0
|
||||
return: Table
|
||||
end note
|
||||
|
||||
note right of Search::getRegex
|
||||
Get the Regex Type Search Engine
|
||||
|
||||
since: 3.2.0
|
||||
return: Regex
|
||||
end note
|
||||
|
||||
note right of Search::getBasic
|
||||
Get the Basic Type Search Engine
|
||||
|
||||
since: 3.2.0
|
||||
return: Basic
|
||||
end note
|
||||
|
||||
note right of Search::getSearch
|
||||
Get the Search Engine
|
||||
|
||||
since: 3.2.0
|
||||
return: SearchEngine
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
149
src/da714ea5-96bb-4eb1-959b-39b457be9cd1/code.php
Normal file
149
src/da714ea5-96bb-4eb1-959b-39b457be9cd1/code.php
Normal file
@ -0,0 +1,149 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\Table;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\SearchTypeInterface as SearchEngine;
|
||||
use VDM\Joomla\Componentbuilder\Search\Engine\Regex;
|
||||
use VDM\Joomla\Componentbuilder\Search\Engine\Basic;
|
||||
|
||||
|
||||
/**
|
||||
* Search Service Provider
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Search implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Selected search engine
|
||||
*
|
||||
* @var int
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected $searchEngine = 101;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
$container->alias(Regex::class, 'Search.Regex')
|
||||
->share('Search.Regex', [$this, 'getRegex'], true);
|
||||
|
||||
$container->alias(Basic::class, 'Search.Basic')
|
||||
->share('Search.Basic', [$this, 'getBasic'], true);
|
||||
|
||||
$container->alias(SearchEngine::class, 'Search')
|
||||
->share('Search', [$this, 'getSearch'], 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Regex Type Search Engine
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Regex
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getRegex(Container $container): Regex
|
||||
{
|
||||
return new Regex(
|
||||
$container->get('Config')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Basic Type Search Engine
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Basic
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getBasic(Container $container): Basic
|
||||
{
|
||||
return new Basic(
|
||||
$container->get('Config')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Search Engine
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return SearchEngine
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getSearch(Container $container): SearchEngine
|
||||
{
|
||||
// set the search engine to use for this container
|
||||
if ($this->searchEngine == 101)
|
||||
{
|
||||
$this->searchEngine = (int) $container->get('Config')->regex_search;
|
||||
}
|
||||
|
||||
// get the correct type of search engine
|
||||
if ($this->searchEngine == 1)
|
||||
{
|
||||
return $container->get('Search.Regex');
|
||||
}
|
||||
|
||||
// the default is the basic
|
||||
return $container->get('Search.Basic');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
116
src/da714ea5-96bb-4eb1-959b-39b457be9cd1/code.power
Normal file
116
src/da714ea5-96bb-4eb1-959b-39b457be9cd1/code.power
Normal file
@ -0,0 +1,116 @@
|
||||
/**
|
||||
* Selected search engine
|
||||
*
|
||||
* @var int
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected $searchEngine = 101;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
$container->alias(Regex::class, 'Search.Regex')
|
||||
->share('Search.Regex', [$this, 'getRegex'], true);
|
||||
|
||||
$container->alias(Basic::class, 'Search.Basic')
|
||||
->share('Search.Basic', [$this, 'getBasic'], true);
|
||||
|
||||
$container->alias(SearchEngine::class, 'Search')
|
||||
->share('Search', [$this, 'getSearch'], 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Regex Type Search Engine
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Regex
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getRegex(Container $container): Regex
|
||||
{
|
||||
return new Regex(
|
||||
$container->get('Config')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Basic Type Search Engine
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Basic
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getBasic(Container $container): Basic
|
||||
{
|
||||
return new Basic(
|
||||
$container->get('Config')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Search Engine
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return SearchEngine
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getSearch(Container $container): SearchEngine
|
||||
{
|
||||
// set the search engine to use for this container
|
||||
if ($this->searchEngine == 101)
|
||||
{
|
||||
$this->searchEngine = (int) $container->get('Config')->regex_search;
|
||||
}
|
||||
|
||||
// get the correct type of search engine
|
||||
if ($this->searchEngine == 1)
|
||||
{
|
||||
return $container->get('Search.Regex');
|
||||
}
|
||||
|
||||
// the default is the basic
|
||||
return $container->get('Search.Basic');
|
||||
}
|
||||
|
42
src/da714ea5-96bb-4eb1-959b-39b457be9cd1/settings.json
Normal file
42
src/da714ea5-96bb-4eb1-959b-39b457be9cd1/settings.json
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "da714ea5-96bb-4eb1-959b-39b457be9cd1",
|
||||
"implements": [
|
||||
"-1"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Search",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Service.Search",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "6e2ca779-f70e-4871-a138-0ee5eaec6a97",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "117d8c9e-3f8d-40ae-b375-1efa2fe5538a",
|
||||
"as": "SearchEngine"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "83efa9a0-4aec-41f8-9c05-b1ac9617746e",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "db093eca-63b3-4d6c-9232-3ceb058121c0",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Service.Search",
|
||||
"description": "Search Service Provider\r\n\r\n@since 3.2.0",
|
||||
"implements_custom": "ServiceProviderInterface",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;",
|
||||
"composer": ""
|
||||
}
|
93
src/db093eca-63b3-4d6c-9232-3ceb058121c0/README.md
Normal file
93
src/db093eca-63b3-4d6c-9232-3ceb058121c0/README.md
Normal file
@ -0,0 +1,93 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Basic (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Engine**
|
||||
```uml
|
||||
@startuml
|
||||
class Basic #Gold {
|
||||
# string $regexValue
|
||||
+ __construct(?Config $config = null)
|
||||
+ string(string $value) : ?string
|
||||
+ replace(string $value) : string
|
||||
# replaceWhole(string $value) : string
|
||||
# searchWhole(string $value) : ?string
|
||||
+ match(string $value) : bool
|
||||
# searchAll(string $value) : ?string
|
||||
# replaceAll(string $value) : string
|
||||
}
|
||||
|
||||
note right of Basic::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note left of Basic::string
|
||||
Search inside a string
|
||||
|
||||
since: 3.2.0
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
note right of Basic::replace
|
||||
Replace found instances inside string value
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note left of Basic::replaceWhole
|
||||
Replace whole words
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Basic::searchWhole
|
||||
Search for whole words
|
||||
|
||||
since: 3.2.0
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
note left of Basic::match
|
||||
Math the Regular Expression
|
||||
|
||||
since: 3.0.9
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note right of Basic::searchAll
|
||||
Search for all instances
|
||||
|
||||
since: 3.2.0
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
note left of Basic::replaceAll
|
||||
Replace for all instances
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
271
src/db093eca-63b3-4d6c-9232-3ceb058121c0/code.php
Normal file
271
src/db093eca-63b3-4d6c-9232-3ceb058121c0/code.php
Normal file
@ -0,0 +1,271 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\Engine;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\SearchTypeInterface;
|
||||
use VDM\Joomla\Componentbuilder\Search\Abstraction\Engine;
|
||||
|
||||
|
||||
/**
|
||||
* Search Type String
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Basic extends Engine implements SearchTypeInterface
|
||||
{
|
||||
/**
|
||||
* Regex Search Value
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $regexValue = '';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null)
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
// quote all regular expression characters
|
||||
$searchValue = preg_quote((string) $this->searchValue, '/');
|
||||
|
||||
$start = ''; $end = '';
|
||||
|
||||
// if this is a whole word search we need to do some prep
|
||||
if ($this->wholeWord == 1)
|
||||
{
|
||||
// get first character of search string
|
||||
$first = mb_substr((string) $this->searchValue, 0, 1);
|
||||
// get last character of search string
|
||||
$last = mb_substr((string) $this->searchValue, -1);
|
||||
|
||||
// set the start boundary behavior
|
||||
$start = '(\b)';
|
||||
if (\preg_match("/\W/", $first))
|
||||
{
|
||||
$start = '(\b|\B)';
|
||||
}
|
||||
|
||||
// set the boundary behavior
|
||||
$end = '(\b)';
|
||||
if (\preg_match("/\W/", $last))
|
||||
{
|
||||
$end = '(\b|\B)';
|
||||
}
|
||||
}
|
||||
|
||||
// set search based on match case
|
||||
$case = '';
|
||||
if ($this->matchCase == 0)
|
||||
{
|
||||
$case = 'i';
|
||||
}
|
||||
|
||||
$this->regexValue = "/" . $start . '(' . $searchValue . ')' . $end . "/" . $case;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search inside a string
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return string|null The marked string if found, else null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function string(string $value): ?string
|
||||
{
|
||||
// we count every line
|
||||
$this->lineCounter();
|
||||
|
||||
if (StringHelper::check($this->searchValue))
|
||||
{
|
||||
if ($this->wholeWord == 1)
|
||||
{
|
||||
return $this->searchWhole($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->searchAll($value);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace found instances inside string value
|
||||
*
|
||||
* @param string $value The string value to update
|
||||
*
|
||||
* @return string The updated string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function replace(string $value): string
|
||||
{
|
||||
if (StringHelper::check($this->searchValue))
|
||||
{
|
||||
if ($this->wholeWord == 1)
|
||||
{
|
||||
return $this->replaceWhole($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->replaceAll($value);
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace whole words
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return string The marked string if found, else null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function replaceWhole(string $value): string
|
||||
{
|
||||
if ($this->match($value))
|
||||
{
|
||||
return preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
"$1" . $this->replaceValue . "$3",
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for whole words
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return string|null The marked string if found, else null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function searchWhole(string $value): ?string
|
||||
{
|
||||
if ($this->match($value))
|
||||
{
|
||||
return trim(preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
"$1" . $this->start . "$2" . $this->end . "$3",
|
||||
$value
|
||||
));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Math the Regular Expression
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return bool true if match is found
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public function match(string $value): bool
|
||||
{
|
||||
$match = [];
|
||||
|
||||
preg_match($this->regexValue, $value, $match);
|
||||
|
||||
$match = array_filter(
|
||||
$match,
|
||||
fn($found) => !empty($found)
|
||||
);
|
||||
|
||||
return (bool) ArrayHelper::check($match);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for all instances
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return string|null The marked string if found, else null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function searchAll(string $value): ?string
|
||||
{
|
||||
if ($this->matchCase == 1)
|
||||
{
|
||||
if (strpos($value, (string) $this->searchValue) !== false)
|
||||
{
|
||||
return trim(preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
$this->start . "$1" . $this->end,
|
||||
$value
|
||||
));
|
||||
}
|
||||
}
|
||||
elseif (stripos($value, (string) $this->searchValue) !== false)
|
||||
{
|
||||
return trim(preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
$this->start . "$1" . $this->end,
|
||||
$value
|
||||
));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace for all instances
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return string The marked string if found, else null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function replaceAll(string $value): string
|
||||
{
|
||||
if ($this->matchCase == 1)
|
||||
{
|
||||
if (strpos($value, (string) $this->searchValue) !== false)
|
||||
{
|
||||
return preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
(string) $this->replaceValue,
|
||||
$value
|
||||
);
|
||||
}
|
||||
}
|
||||
elseif (stripos($value, (string) $this->searchValue) !== false)
|
||||
{
|
||||
return preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
(string) $this->replaceValue,
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
240
src/db093eca-63b3-4d6c-9232-3ceb058121c0/code.power
Normal file
240
src/db093eca-63b3-4d6c-9232-3ceb058121c0/code.power
Normal file
@ -0,0 +1,240 @@
|
||||
/**
|
||||
* Regex Search Value
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected string $regexValue = '';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null)
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
// quote all regular expression characters
|
||||
$searchValue = preg_quote((string) $this->searchValue, '/');
|
||||
|
||||
$start = ''; $end = '';
|
||||
|
||||
// if this is a whole word search we need to do some prep
|
||||
if ($this->wholeWord == 1)
|
||||
{
|
||||
// get first character of search string
|
||||
$first = mb_substr((string) $this->searchValue, 0, 1);
|
||||
// get last character of search string
|
||||
$last = mb_substr((string) $this->searchValue, -1);
|
||||
|
||||
// set the start boundary behavior
|
||||
$start = '(\b)';
|
||||
if (\preg_match("/\W/", $first))
|
||||
{
|
||||
$start = '(\b|\B)';
|
||||
}
|
||||
|
||||
// set the boundary behavior
|
||||
$end = '(\b)';
|
||||
if (\preg_match("/\W/", $last))
|
||||
{
|
||||
$end = '(\b|\B)';
|
||||
}
|
||||
}
|
||||
|
||||
// set search based on match case
|
||||
$case = '';
|
||||
if ($this->matchCase == 0)
|
||||
{
|
||||
$case = 'i';
|
||||
}
|
||||
|
||||
$this->regexValue = "/" . $start . '(' . $searchValue . ')' . $end . "/" . $case;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search inside a string
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return string|null The marked string if found, else null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function string(string $value): ?string
|
||||
{
|
||||
// we count every line
|
||||
$this->lineCounter();
|
||||
|
||||
if (StringHelper::check($this->searchValue))
|
||||
{
|
||||
if ($this->wholeWord == 1)
|
||||
{
|
||||
return $this->searchWhole($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->searchAll($value);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace found instances inside string value
|
||||
*
|
||||
* @param string $value The string value to update
|
||||
*
|
||||
* @return string The updated string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function replace(string $value): string
|
||||
{
|
||||
if (StringHelper::check($this->searchValue))
|
||||
{
|
||||
if ($this->wholeWord == 1)
|
||||
{
|
||||
return $this->replaceWhole($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->replaceAll($value);
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace whole words
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return string The marked string if found, else null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function replaceWhole(string $value): string
|
||||
{
|
||||
if ($this->match($value))
|
||||
{
|
||||
return preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
"$1" . $this->replaceValue . "$3",
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for whole words
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return string|null The marked string if found, else null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function searchWhole(string $value): ?string
|
||||
{
|
||||
if ($this->match($value))
|
||||
{
|
||||
return trim(preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
"$1" . $this->start . "$2" . $this->end . "$3",
|
||||
$value
|
||||
));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Math the Regular Expression
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return bool true if match is found
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public function match(string $value): bool
|
||||
{
|
||||
$match = [];
|
||||
|
||||
preg_match($this->regexValue, $value, $match);
|
||||
|
||||
$match = array_filter(
|
||||
$match,
|
||||
fn($found) => !empty($found)
|
||||
);
|
||||
|
||||
return (bool) ArrayHelper::check($match);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for all instances
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return string|null The marked string if found, else null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function searchAll(string $value): ?string
|
||||
{
|
||||
if ($this->matchCase == 1)
|
||||
{
|
||||
if (strpos($value, (string) $this->searchValue) !== false)
|
||||
{
|
||||
return trim(preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
$this->start . "$1" . $this->end,
|
||||
$value
|
||||
));
|
||||
}
|
||||
}
|
||||
elseif (stripos($value, (string) $this->searchValue) !== false)
|
||||
{
|
||||
return trim(preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
$this->start . "$1" . $this->end,
|
||||
$value
|
||||
));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace for all instances
|
||||
*
|
||||
* @param string $value The string value
|
||||
*
|
||||
* @return string The marked string if found, else null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function replaceAll(string $value): string
|
||||
{
|
||||
if ($this->matchCase == 1)
|
||||
{
|
||||
if (strpos($value, (string) $this->searchValue) !== false)
|
||||
{
|
||||
return preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
(string) $this->replaceValue,
|
||||
$value
|
||||
);
|
||||
}
|
||||
}
|
||||
elseif (stripos($value, (string) $this->searchValue) !== false)
|
||||
{
|
||||
return preg_replace(
|
||||
$this->regexValue . 'm',
|
||||
(string) $this->replaceValue,
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
33
src/db093eca-63b3-4d6c-9232-3ceb058121c0/settings.json
Normal file
33
src/db093eca-63b3-4d6c-9232-3ceb058121c0/settings.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "8f9449fc-bfbc-49a5-b146-d58c8c17dfdf",
|
||||
"guid": "db093eca-63b3-4d6c-9232-3ceb058121c0",
|
||||
"implements": [
|
||||
"117d8c9e-3f8d-40ae-b375-1efa2fe5538a"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Basic",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Engine.Basic",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "6e2ca779-f70e-4871-a138-0ee5eaec6a97",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Engine.Basic",
|
||||
"description": "Search Type String\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
105
src/e544a248-4b6a-46cb-9926-a3ac9937807c/README.md
Normal file
105
src/e544a248-4b6a-46cb-9926-a3ac9937807c/README.md
Normal file
@ -0,0 +1,105 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Search (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Agent**
|
||||
```uml
|
||||
@startuml
|
||||
class Search #Gold {
|
||||
# array $found
|
||||
# Config $config
|
||||
# SearchEngine $search
|
||||
+ __construct(?Config $config = null, ?SearchEngine $search = null)
|
||||
+ get(string $table) : ?array
|
||||
+ value(mixed $value, int $id, ...) : bool
|
||||
+ reset(string $table) : void
|
||||
# searchValue(mixed $value) : ?array
|
||||
# string(string $value) : ?array
|
||||
# prep(int $id, string $field, ...) : void
|
||||
# fieldCounter()
|
||||
}
|
||||
|
||||
note right of Search::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note left of Search::get
|
||||
Get found values
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note right of Search::value
|
||||
Search inside a value
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
|
||||
arguments:
|
||||
mixed $value
|
||||
int $id
|
||||
string $field
|
||||
string $table
|
||||
end note
|
||||
|
||||
note left of Search::reset
|
||||
Empty the found values
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Search::searchValue
|
||||
Search inside a string
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note left of Search::string
|
||||
Search inside a string
|
||||
|
||||
since: 3.2.0
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note right of Search::prep
|
||||
Prep the bucket
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
|
||||
arguments:
|
||||
int $id
|
||||
string $field
|
||||
string $table
|
||||
end note
|
||||
|
||||
note left of Search::fieldCounter
|
||||
we count every field being searched
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
302
src/e544a248-4b6a-46cb-9926-a3ac9937807c/code.php
Normal file
302
src/e544a248-4b6a-46cb-9926-a3ac9937807c/code.php
Normal file
@ -0,0 +1,302 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\StringHelper;
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\SearchTypeInterface as SearchEngine;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\SearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Search Agent Search
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Search implements SearchInterface
|
||||
{
|
||||
/**
|
||||
* Search results found
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $found = [];
|
||||
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Search Engine
|
||||
*
|
||||
* @var SearchEngine
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected SearchEngine $search;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
* @param SearchEngine|null $search The search engine object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?SearchEngine $search = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
$this->search = $search ?: Factory::_('Search');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get found values
|
||||
*
|
||||
* @param string $table The table being searched
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(string $table): ?array
|
||||
{
|
||||
if (isset($this->found[$table]))
|
||||
{
|
||||
return $this->found[$table];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search inside a value
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param int $id The item ID
|
||||
* @param string $field The field key
|
||||
* @param string $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value($value, int $id, string $field, string $table): bool
|
||||
{
|
||||
// search the mixed value
|
||||
$found = $this->searchValue($value);
|
||||
|
||||
// check if we found any match
|
||||
if (ArrayHelper::check($found))
|
||||
{
|
||||
foreach ($found as $line => $line_value)
|
||||
{
|
||||
// may not be needed... but being old school
|
||||
$this->prep($id, $field, $table);
|
||||
|
||||
// load the detail into our multidimensional array... lol
|
||||
// Table->Item_id->Field_name->Line_number = marked_full_line
|
||||
// Search Example: soon...
|
||||
// Marked Line Example: Soon....
|
||||
$this->found[$table][$id][$field][$line] = $line_value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty the found values
|
||||
*
|
||||
* @param string $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function reset(string $table)
|
||||
{
|
||||
unset($this->found[$table]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search inside a string
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function searchValue($value): ?array
|
||||
{
|
||||
// check if this is an array
|
||||
$found = null;
|
||||
|
||||
// I know this is a little crazy... TODO refactor into recursion functions
|
||||
// the possibility of searching sub-forms in sub-forms
|
||||
if (ArrayHelper::check($value))
|
||||
{
|
||||
// first layer
|
||||
foreach ($value as $keys => $rows)
|
||||
{
|
||||
if (ArrayHelper::check($rows))
|
||||
{
|
||||
// second layer
|
||||
foreach ($rows as $key => $row)
|
||||
{
|
||||
if (ArrayHelper::check($row))
|
||||
{
|
||||
// third layer
|
||||
foreach ($row as $ke => $ro)
|
||||
{
|
||||
if (ArrayHelper::check($ro))
|
||||
{
|
||||
// forth layer
|
||||
foreach ($ro as $k => $r)
|
||||
{
|
||||
if (StringHelper::check($r) && ($_found = $this->string($r)) !== null)
|
||||
{
|
||||
foreach ($_found as $_n => $_f)
|
||||
{
|
||||
$found[$keys . '.' . $key . '.' . $ke . '.' . $k . '.' . $_n] = $_f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($ro) && ($_found = $this->string($ro)) !== null)
|
||||
{
|
||||
foreach ($_found as $_n => $_f)
|
||||
{
|
||||
$found[$keys. '.' . $key . '.' . $ke . '.' . $_n] = $_f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($row) && ($_found = $this->string($row)) !== null)
|
||||
{
|
||||
foreach ($_found as $_n => $_f)
|
||||
{
|
||||
$found[$keys. '.' . $key . '.' . $_n] = $_f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($rows) && ($_found = $this->string($rows)) !== null)
|
||||
{
|
||||
foreach ($_found as $_n => $_f)
|
||||
{
|
||||
$found[$keys. '.' . $_n] = $_f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($value))
|
||||
{
|
||||
$found = $this->string($value);
|
||||
}
|
||||
|
||||
return $found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search inside a string
|
||||
*
|
||||
* @param string $value The field value
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function string(string $value): ?array
|
||||
{
|
||||
// line counter
|
||||
$line = 1;
|
||||
|
||||
// we count every field we search
|
||||
$this->fieldCounter();
|
||||
|
||||
// check if string has a new line
|
||||
if (\preg_match('/\R/', $value))
|
||||
{
|
||||
$search_array = \preg_split('/\R/', $value);
|
||||
|
||||
// start search bucket
|
||||
$found = [];
|
||||
|
||||
// loop over the lines
|
||||
foreach ($search_array as $line_value)
|
||||
{
|
||||
if (($_found = $this->search->string($line_value)) !== null)
|
||||
{
|
||||
$found[$line] = $_found;
|
||||
}
|
||||
|
||||
// next line
|
||||
$line++;
|
||||
}
|
||||
|
||||
if (ArrayHelper::check($found))
|
||||
{
|
||||
return $found;
|
||||
}
|
||||
}
|
||||
elseif (($found = $this->search->string($value)) !== null)
|
||||
{
|
||||
return [$line => $found];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prep the bucket
|
||||
*
|
||||
* @param int $id The item ID
|
||||
* @param string $field The field key
|
||||
* @param string $table The table
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function prep(int $id, string $field, string $table)
|
||||
{
|
||||
if (empty($this->found[$table]))
|
||||
{
|
||||
$this->found[$table] = [];
|
||||
}
|
||||
if (empty($this->found[$table][$id]))
|
||||
{
|
||||
$this->found[$table][$id] = [];
|
||||
}
|
||||
if (empty($this->found[$table][$id][$field]))
|
||||
{
|
||||
$this->found[$table][$id][$field] = [];
|
||||
}
|
||||
// we should add a call to get the item name if the table has a name field TODO
|
||||
}
|
||||
|
||||
/**
|
||||
* we count every field being searched
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function fieldCounter()
|
||||
{
|
||||
// we count every field we search
|
||||
$this->config->field_counter += 1;
|
||||
}
|
||||
}
|
||||
|
271
src/e544a248-4b6a-46cb-9926-a3ac9937807c/code.power
Normal file
271
src/e544a248-4b6a-46cb-9926-a3ac9937807c/code.power
Normal file
@ -0,0 +1,271 @@
|
||||
/**
|
||||
* Search results found
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected array $found = [];
|
||||
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Search Engine
|
||||
*
|
||||
* @var SearchEngine
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected SearchEngine $search;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
* @param SearchEngine|null $search The search engine object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?SearchEngine $search = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
$this->search = $search ?: Factory::_('Search');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get found values
|
||||
*
|
||||
* @param string $table The table being searched
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(string $table): ?array
|
||||
{
|
||||
if (isset($this->found[$table]))
|
||||
{
|
||||
return $this->found[$table];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search inside a value
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param int $id The item ID
|
||||
* @param string $field The field key
|
||||
* @param string $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function value($value, int $id, string $field, string $table): bool
|
||||
{
|
||||
// search the mixed value
|
||||
$found = $this->searchValue($value);
|
||||
|
||||
// check if we found any match
|
||||
if (ArrayHelper::check($found))
|
||||
{
|
||||
foreach ($found as $line => $line_value)
|
||||
{
|
||||
// may not be needed... but being old school
|
||||
$this->prep($id, $field, $table);
|
||||
|
||||
// load the detail into our multidimensional array... lol
|
||||
// Table->Item_id->Field_name->Line_number = marked_full_line
|
||||
// Search Example: soon...
|
||||
// Marked Line Example: Soon....
|
||||
$this->found[$table][$id][$field][$line] = $line_value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty the found values
|
||||
*
|
||||
* @param string $table The table being searched
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function reset(string $table)
|
||||
{
|
||||
unset($this->found[$table]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search inside a string
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function searchValue($value): ?array
|
||||
{
|
||||
// check if this is an array
|
||||
$found = null;
|
||||
|
||||
// I know this is a little crazy... TODO refactor into recursion functions
|
||||
// the possibility of searching sub-forms in sub-forms
|
||||
if (ArrayHelper::check($value))
|
||||
{
|
||||
// first layer
|
||||
foreach ($value as $keys => $rows)
|
||||
{
|
||||
if (ArrayHelper::check($rows))
|
||||
{
|
||||
// second layer
|
||||
foreach ($rows as $key => $row)
|
||||
{
|
||||
if (ArrayHelper::check($row))
|
||||
{
|
||||
// third layer
|
||||
foreach ($row as $ke => $ro)
|
||||
{
|
||||
if (ArrayHelper::check($ro))
|
||||
{
|
||||
// forth layer
|
||||
foreach ($ro as $k => $r)
|
||||
{
|
||||
if (StringHelper::check($r) && ($_found = $this->string($r)) !== null)
|
||||
{
|
||||
foreach ($_found as $_n => $_f)
|
||||
{
|
||||
$found[$keys . '.' . $key . '.' . $ke . '.' . $k . '.' . $_n] = $_f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($ro) && ($_found = $this->string($ro)) !== null)
|
||||
{
|
||||
foreach ($_found as $_n => $_f)
|
||||
{
|
||||
$found[$keys. '.' . $key . '.' . $ke . '.' . $_n] = $_f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($row) && ($_found = $this->string($row)) !== null)
|
||||
{
|
||||
foreach ($_found as $_n => $_f)
|
||||
{
|
||||
$found[$keys. '.' . $key . '.' . $_n] = $_f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($rows) && ($_found = $this->string($rows)) !== null)
|
||||
{
|
||||
foreach ($_found as $_n => $_f)
|
||||
{
|
||||
$found[$keys. '.' . $_n] = $_f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($value))
|
||||
{
|
||||
$found = $this->string($value);
|
||||
}
|
||||
|
||||
return $found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search inside a string
|
||||
*
|
||||
* @param string $value The field value
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function string(string $value): ?array
|
||||
{
|
||||
// line counter
|
||||
$line = 1;
|
||||
|
||||
// we count every field we search
|
||||
$this->fieldCounter();
|
||||
|
||||
// check if string has a new line
|
||||
if (\preg_match('/\R/', $value))
|
||||
{
|
||||
$search_array = \preg_split('/\R/', $value);
|
||||
|
||||
// start search bucket
|
||||
$found = [];
|
||||
|
||||
// loop over the lines
|
||||
foreach ($search_array as $line_value)
|
||||
{
|
||||
if (($_found = $this->search->string($line_value)) !== null)
|
||||
{
|
||||
$found[$line] = $_found;
|
||||
}
|
||||
|
||||
// next line
|
||||
$line++;
|
||||
}
|
||||
|
||||
if (ArrayHelper::check($found))
|
||||
{
|
||||
return $found;
|
||||
}
|
||||
}
|
||||
elseif (($found = $this->search->string($value)) !== null)
|
||||
{
|
||||
return [$line => $found];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prep the bucket
|
||||
*
|
||||
* @param int $id The item ID
|
||||
* @param string $field The field key
|
||||
* @param string $table The table
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function prep(int $id, string $field, string $table)
|
||||
{
|
||||
if (empty($this->found[$table]))
|
||||
{
|
||||
$this->found[$table] = [];
|
||||
}
|
||||
if (empty($this->found[$table][$id]))
|
||||
{
|
||||
$this->found[$table][$id] = [];
|
||||
}
|
||||
if (empty($this->found[$table][$id][$field]))
|
||||
{
|
||||
$this->found[$table][$id][$field] = [];
|
||||
}
|
||||
// we should add a call to get the item name if the table has a name field TODO
|
||||
}
|
||||
|
||||
/**
|
||||
* we count every field being searched
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function fieldCounter()
|
||||
{
|
||||
// we count every field we search
|
||||
$this->config->field_counter += 1;
|
||||
}
|
41
src/e544a248-4b6a-46cb-9926-a3ac9937807c/settings.json
Normal file
41
src/e544a248-4b6a-46cb-9926-a3ac9937807c/settings.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "e544a248-4b6a-46cb-9926-a3ac9937807c",
|
||||
"implements": [
|
||||
"0d9442ab-54d9-4947-a219-244cfaea3084"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Search",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Agent.Search",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "01a89ba8-f8bb-435c-93de-0a8f3fa9432a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "6e2ca779-f70e-4871-a138-0ee5eaec6a97",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "117d8c9e-3f8d-40ae-b375-1efa2fe5538a",
|
||||
"as": "SearchEngine"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Agent.Search",
|
||||
"description": "Search Agent Search\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
85
src/f523ab49-907a-4356-b064-51c85a187fbd/README.md
Normal file
85
src/f523ab49-907a-4356-b064-51c85a187fbd/README.md
Normal file
@ -0,0 +1,85 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Load (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Search\Model**
|
||||
```uml
|
||||
@startuml
|
||||
class Load #Gold {
|
||||
# Config $config
|
||||
+ __construct(?Config $config = null, ?Table $table = null)
|
||||
+ value(mixed $value, string $field, ...) : mixed
|
||||
# validateBefore(mixed $value, ?string $field = null, ...) : bool
|
||||
# validateAfter(mixed $value, ?string $field = null, ...) : bool
|
||||
# getTable() : string
|
||||
}
|
||||
|
||||
note right of Load::__construct
|
||||
Constructor
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note right of Load::value
|
||||
Model the value
|
||||
Example: $this->value(value, 'value_key', 'table_name');
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
|
||||
arguments:
|
||||
mixed $value
|
||||
string $field
|
||||
?string $table = null
|
||||
end note
|
||||
|
||||
note right of Load::validateBefore
|
||||
Validate before the value is modelled (basic, override in child class)
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
|
||||
arguments:
|
||||
mixed $value
|
||||
?string $field = null
|
||||
?string $table = null
|
||||
end note
|
||||
|
||||
note right of Load::validateAfter
|
||||
Validate after the value is modelled (basic, override in child class)
|
||||
|
||||
since: 3.2.0
|
||||
return: bool
|
||||
|
||||
arguments:
|
||||
mixed $value
|
||||
?string $field = null
|
||||
?string $table = null
|
||||
end note
|
||||
|
||||
note right of Load::getTable
|
||||
Get the current active table
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
142
src/f523ab49-907a-4356-b064-51c85a187fbd/code.php
Normal file
142
src/f523ab49-907a-4356-b064-51c85a187fbd/code.php
Normal file
@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @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\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Table;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Componentbuilder\Interfaces\ModelInterface;
|
||||
use VDM\Joomla\Componentbuilder\Abstraction\Model;
|
||||
|
||||
|
||||
/**
|
||||
* Search Load Model
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Load extends Model implements ModelInterface
|
||||
{
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
parent::__construct($table ?? Factory::_('Table'));
|
||||
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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->getTable();
|
||||
}
|
||||
|
||||
// check if this is a valid table
|
||||
if (StringHelper::check($value) && ($store = $this->table->get($table, $field, 'store')) !== null)
|
||||
{
|
||||
// open the value based on the store method
|
||||
switch($store)
|
||||
{
|
||||
case 'base64':
|
||||
$value = base64_decode((string) $value);
|
||||
break;
|
||||
case 'json':
|
||||
// check if there is a json string
|
||||
if (JsonHelper::check($value))
|
||||
{
|
||||
$value = json_decode((string) $value, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate before the value is modelled (basic, override in child class)
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param string|null $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function validateBefore(&$value, ?string $field = null, ?string $table = null): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate after the value is modelled (basic, override in child class)
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param string|null $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function validateAfter(&$value, ?string $field = null, ?string $table = null): bool
|
||||
{
|
||||
// check values
|
||||
if (StringHelper::check($value) || ArrayHelper::check($value, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// remove empty values
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current active table
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getTable(): string
|
||||
{
|
||||
return $this->config->table_name;
|
||||
}
|
||||
|
||||
}
|
||||
|
109
src/f523ab49-907a-4356-b064-51c85a187fbd/code.power
Normal file
109
src/f523ab49-907a-4356-b064-51c85a187fbd/code.power
Normal file
@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
parent::__construct($table ?? Factory::_('Table'));
|
||||
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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->getTable();
|
||||
}
|
||||
|
||||
// check if this is a valid table
|
||||
if (StringHelper::check($value) && ($store = $this->table->get($table, $field, 'store')) !== null)
|
||||
{
|
||||
// open the value based on the store method
|
||||
switch($store)
|
||||
{
|
||||
case 'base64':
|
||||
$value = base64_decode((string) $value);
|
||||
break;
|
||||
case 'json':
|
||||
// check if there is a json string
|
||||
if (JsonHelper::check($value))
|
||||
{
|
||||
$value = json_decode((string) $value, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate before the value is modelled (basic, override in child class)
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param string|null $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function validateBefore(&$value, ?string $field = null, ?string $table = null): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate after the value is modelled (basic, override in child class)
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param string|null $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function validateAfter(&$value, ?string $field = null, ?string $table = null): bool
|
||||
{
|
||||
// check values
|
||||
if (StringHelper::check($value) || ArrayHelper::check($value, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// remove empty values
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current active table
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getTable(): string
|
||||
{
|
||||
return $this->config->table_name;
|
||||
}
|
41
src/f523ab49-907a-4356-b064-51c85a187fbd/settings.json
Normal file
41
src/f523ab49-907a-4356-b064-51c85a187fbd/settings.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "584747d1-3a86-453d-b7a3-a2219de8d777",
|
||||
"guid": "f523ab49-907a-4356-b064-51c85a187fbd",
|
||||
"implements": [
|
||||
"8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Load",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Search.Model.Load",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "01a89ba8-f8bb-435c-93de-0a8f3fa9432a",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "6e2ca779-f70e-4871-a138-0ee5eaec6a97",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder.Search.Model.Load",
|
||||
"description": "Search Load Model\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
242
super-powers.json
Normal file
242
super-powers.json
Normal file
@ -0,0 +1,242 @@
|
||||
{
|
||||
"6e2ca779-f70e-4871-a138-0ee5eaec6a97": {
|
||||
"name": "Config",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search",
|
||||
"code": "src\/6e2ca779-f70e-4871-a138-0ee5eaec6a97\/code.php",
|
||||
"power": "src\/6e2ca779-f70e-4871-a138-0ee5eaec6a97\/code.power",
|
||||
"settings": "src\/6e2ca779-f70e-4871-a138-0ee5eaec6a97\/settings.json",
|
||||
"path": "src\/6e2ca779-f70e-4871-a138-0ee5eaec6a97",
|
||||
"guid": "6e2ca779-f70e-4871-a138-0ee5eaec6a97"
|
||||
},
|
||||
"117d8c9e-3f8d-40ae-b375-1efa2fe5538a": {
|
||||
"name": "SearchTypeInterface",
|
||||
"type": "interface",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Interfaces",
|
||||
"code": "src\/117d8c9e-3f8d-40ae-b375-1efa2fe5538a\/code.php",
|
||||
"power": "src\/117d8c9e-3f8d-40ae-b375-1efa2fe5538a\/code.power",
|
||||
"settings": "src\/117d8c9e-3f8d-40ae-b375-1efa2fe5538a\/settings.json",
|
||||
"path": "src\/117d8c9e-3f8d-40ae-b375-1efa2fe5538a",
|
||||
"guid": "117d8c9e-3f8d-40ae-b375-1efa2fe5538a"
|
||||
},
|
||||
"8f9449fc-bfbc-49a5-b146-d58c8c17dfdf": {
|
||||
"name": "Engine",
|
||||
"type": "abstract class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Abstraction",
|
||||
"code": "src\/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf\/code.php",
|
||||
"power": "src\/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf\/code.power",
|
||||
"settings": "src\/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf\/settings.json",
|
||||
"path": "src\/8f9449fc-bfbc-49a5-b146-d58c8c17dfdf",
|
||||
"guid": "8f9449fc-bfbc-49a5-b146-d58c8c17dfdf"
|
||||
},
|
||||
"83efa9a0-4aec-41f8-9c05-b1ac9617746e": {
|
||||
"name": "Regex",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Engine",
|
||||
"code": "src\/83efa9a0-4aec-41f8-9c05-b1ac9617746e\/code.php",
|
||||
"power": "src\/83efa9a0-4aec-41f8-9c05-b1ac9617746e\/code.power",
|
||||
"settings": "src\/83efa9a0-4aec-41f8-9c05-b1ac9617746e\/settings.json",
|
||||
"path": "src\/83efa9a0-4aec-41f8-9c05-b1ac9617746e",
|
||||
"guid": "83efa9a0-4aec-41f8-9c05-b1ac9617746e"
|
||||
},
|
||||
"db093eca-63b3-4d6c-9232-3ceb058121c0": {
|
||||
"name": "Basic",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Engine",
|
||||
"code": "src\/db093eca-63b3-4d6c-9232-3ceb058121c0\/code.php",
|
||||
"power": "src\/db093eca-63b3-4d6c-9232-3ceb058121c0\/code.power",
|
||||
"settings": "src\/db093eca-63b3-4d6c-9232-3ceb058121c0\/settings.json",
|
||||
"path": "src\/db093eca-63b3-4d6c-9232-3ceb058121c0",
|
||||
"guid": "db093eca-63b3-4d6c-9232-3ceb058121c0"
|
||||
},
|
||||
"da714ea5-96bb-4eb1-959b-39b457be9cd1": {
|
||||
"name": "Search",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Service",
|
||||
"code": "src\/da714ea5-96bb-4eb1-959b-39b457be9cd1\/code.php",
|
||||
"power": "src\/da714ea5-96bb-4eb1-959b-39b457be9cd1\/code.power",
|
||||
"settings": "src\/da714ea5-96bb-4eb1-959b-39b457be9cd1\/settings.json",
|
||||
"path": "src\/da714ea5-96bb-4eb1-959b-39b457be9cd1",
|
||||
"guid": "da714ea5-96bb-4eb1-959b-39b457be9cd1"
|
||||
},
|
||||
"f523ab49-907a-4356-b064-51c85a187fbd": {
|
||||
"name": "Load",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Model",
|
||||
"code": "src\/f523ab49-907a-4356-b064-51c85a187fbd\/code.php",
|
||||
"power": "src\/f523ab49-907a-4356-b064-51c85a187fbd\/code.power",
|
||||
"settings": "src\/f523ab49-907a-4356-b064-51c85a187fbd\/settings.json",
|
||||
"path": "src\/f523ab49-907a-4356-b064-51c85a187fbd",
|
||||
"guid": "f523ab49-907a-4356-b064-51c85a187fbd"
|
||||
},
|
||||
"02efe40a-7792-4c82-9444-7d0377243483": {
|
||||
"name": "Insert",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Model",
|
||||
"code": "src\/02efe40a-7792-4c82-9444-7d0377243483\/code.php",
|
||||
"power": "src\/02efe40a-7792-4c82-9444-7d0377243483\/code.power",
|
||||
"settings": "src\/02efe40a-7792-4c82-9444-7d0377243483\/settings.json",
|
||||
"path": "src\/02efe40a-7792-4c82-9444-7d0377243483",
|
||||
"guid": "02efe40a-7792-4c82-9444-7d0377243483"
|
||||
},
|
||||
"7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a": {
|
||||
"name": "Model",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Service",
|
||||
"code": "src\/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a\/code.php",
|
||||
"power": "src\/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a\/code.power",
|
||||
"settings": "src\/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a\/settings.json",
|
||||
"path": "src\/7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a",
|
||||
"guid": "7f40cc7d-9ab8-4601-8a2b-4eb3d712a40a"
|
||||
},
|
||||
"2bd1a32c-3d90-4646-9314-28d44d164f76": {
|
||||
"name": "LoadInterface",
|
||||
"type": "interface",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Interfaces",
|
||||
"code": "src\/2bd1a32c-3d90-4646-9314-28d44d164f76\/code.php",
|
||||
"power": "src\/2bd1a32c-3d90-4646-9314-28d44d164f76\/code.power",
|
||||
"settings": "src\/2bd1a32c-3d90-4646-9314-28d44d164f76\/settings.json",
|
||||
"path": "src\/2bd1a32c-3d90-4646-9314-28d44d164f76",
|
||||
"guid": "2bd1a32c-3d90-4646-9314-28d44d164f76"
|
||||
},
|
||||
"2dabfb4a-64cd-4c04-9772-4a75f9f3b710": {
|
||||
"name": "Load",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Database",
|
||||
"code": "src\/2dabfb4a-64cd-4c04-9772-4a75f9f3b710\/code.php",
|
||||
"power": "src\/2dabfb4a-64cd-4c04-9772-4a75f9f3b710\/code.power",
|
||||
"settings": "src\/2dabfb4a-64cd-4c04-9772-4a75f9f3b710\/settings.json",
|
||||
"path": "src\/2dabfb4a-64cd-4c04-9772-4a75f9f3b710",
|
||||
"guid": "2dabfb4a-64cd-4c04-9772-4a75f9f3b710"
|
||||
},
|
||||
"4c44e5d3-750c-4609-88c8-aa441838b8fe": {
|
||||
"name": "InsertInterface",
|
||||
"type": "interface",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Interfaces",
|
||||
"code": "src\/4c44e5d3-750c-4609-88c8-aa441838b8fe\/code.php",
|
||||
"power": "src\/4c44e5d3-750c-4609-88c8-aa441838b8fe\/code.power",
|
||||
"settings": "src\/4c44e5d3-750c-4609-88c8-aa441838b8fe\/settings.json",
|
||||
"path": "src\/4c44e5d3-750c-4609-88c8-aa441838b8fe",
|
||||
"guid": "4c44e5d3-750c-4609-88c8-aa441838b8fe"
|
||||
},
|
||||
"6caf9473-133c-49a9-afa0-9f84151b5155": {
|
||||
"name": "Insert",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Database",
|
||||
"code": "src\/6caf9473-133c-49a9-afa0-9f84151b5155\/code.php",
|
||||
"power": "src\/6caf9473-133c-49a9-afa0-9f84151b5155\/code.power",
|
||||
"settings": "src\/6caf9473-133c-49a9-afa0-9f84151b5155\/settings.json",
|
||||
"path": "src\/6caf9473-133c-49a9-afa0-9f84151b5155",
|
||||
"guid": "6caf9473-133c-49a9-afa0-9f84151b5155"
|
||||
},
|
||||
"d5de47ce-9a9e-4e76-a5c6-61ed74842ea3": {
|
||||
"name": "Database",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Service",
|
||||
"code": "src\/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3\/code.php",
|
||||
"power": "src\/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3\/code.power",
|
||||
"settings": "src\/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3\/settings.json",
|
||||
"path": "src\/d5de47ce-9a9e-4e76-a5c6-61ed74842ea3",
|
||||
"guid": "d5de47ce-9a9e-4e76-a5c6-61ed74842ea3"
|
||||
},
|
||||
"55280ec7-e48d-431b-af25-10308dd30636": {
|
||||
"name": "FindInterface",
|
||||
"type": "interface",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Interfaces",
|
||||
"code": "src\/55280ec7-e48d-431b-af25-10308dd30636\/code.php",
|
||||
"power": "src\/55280ec7-e48d-431b-af25-10308dd30636\/code.power",
|
||||
"settings": "src\/55280ec7-e48d-431b-af25-10308dd30636\/settings.json",
|
||||
"path": "src\/55280ec7-e48d-431b-af25-10308dd30636",
|
||||
"guid": "55280ec7-e48d-431b-af25-10308dd30636"
|
||||
},
|
||||
"0d9442ab-54d9-4947-a219-244cfaea3084": {
|
||||
"name": "SearchInterface",
|
||||
"type": "interface",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Interfaces",
|
||||
"code": "src\/0d9442ab-54d9-4947-a219-244cfaea3084\/code.php",
|
||||
"power": "src\/0d9442ab-54d9-4947-a219-244cfaea3084\/code.power",
|
||||
"settings": "src\/0d9442ab-54d9-4947-a219-244cfaea3084\/settings.json",
|
||||
"path": "src\/0d9442ab-54d9-4947-a219-244cfaea3084",
|
||||
"guid": "0d9442ab-54d9-4947-a219-244cfaea3084"
|
||||
},
|
||||
"e544a248-4b6a-46cb-9926-a3ac9937807c": {
|
||||
"name": "Search",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Agent",
|
||||
"code": "src\/e544a248-4b6a-46cb-9926-a3ac9937807c\/code.php",
|
||||
"power": "src\/e544a248-4b6a-46cb-9926-a3ac9937807c\/code.power",
|
||||
"settings": "src\/e544a248-4b6a-46cb-9926-a3ac9937807c\/settings.json",
|
||||
"path": "src\/e544a248-4b6a-46cb-9926-a3ac9937807c",
|
||||
"guid": "e544a248-4b6a-46cb-9926-a3ac9937807c"
|
||||
},
|
||||
"15d9e1a9-3364-4d69-9d9f-9b87db820e5c": {
|
||||
"name": "Find",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Agent",
|
||||
"code": "src\/15d9e1a9-3364-4d69-9d9f-9b87db820e5c\/code.php",
|
||||
"power": "src\/15d9e1a9-3364-4d69-9d9f-9b87db820e5c\/code.power",
|
||||
"settings": "src\/15d9e1a9-3364-4d69-9d9f-9b87db820e5c\/settings.json",
|
||||
"path": "src\/15d9e1a9-3364-4d69-9d9f-9b87db820e5c",
|
||||
"guid": "15d9e1a9-3364-4d69-9d9f-9b87db820e5c"
|
||||
},
|
||||
"afdae35d-fe7f-4055-99ea-afd8ff8349b6": {
|
||||
"name": "ReplaceInterface",
|
||||
"type": "interface",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Interfaces",
|
||||
"code": "src\/afdae35d-fe7f-4055-99ea-afd8ff8349b6\/code.php",
|
||||
"power": "src\/afdae35d-fe7f-4055-99ea-afd8ff8349b6\/code.power",
|
||||
"settings": "src\/afdae35d-fe7f-4055-99ea-afd8ff8349b6\/settings.json",
|
||||
"path": "src\/afdae35d-fe7f-4055-99ea-afd8ff8349b6",
|
||||
"guid": "afdae35d-fe7f-4055-99ea-afd8ff8349b6"
|
||||
},
|
||||
"3ac29912-0681-4ca9-8197-d5a8f6a49ac7": {
|
||||
"name": "Update",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Agent",
|
||||
"code": "src\/3ac29912-0681-4ca9-8197-d5a8f6a49ac7\/code.php",
|
||||
"power": "src\/3ac29912-0681-4ca9-8197-d5a8f6a49ac7\/code.power",
|
||||
"settings": "src\/3ac29912-0681-4ca9-8197-d5a8f6a49ac7\/settings.json",
|
||||
"path": "src\/3ac29912-0681-4ca9-8197-d5a8f6a49ac7",
|
||||
"guid": "3ac29912-0681-4ca9-8197-d5a8f6a49ac7"
|
||||
},
|
||||
"abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7": {
|
||||
"name": "Replace",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Agent",
|
||||
"code": "src\/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7\/code.php",
|
||||
"power": "src\/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7\/code.power",
|
||||
"settings": "src\/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7\/settings.json",
|
||||
"path": "src\/abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7",
|
||||
"guid": "abc37ddd-1ff5-4204-9e5b-015ab4f3d4c7"
|
||||
},
|
||||
"0b658434-3767-401e-addc-eabfd1d0e94a": {
|
||||
"name": "Agent",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search",
|
||||
"code": "src\/0b658434-3767-401e-addc-eabfd1d0e94a\/code.php",
|
||||
"power": "src\/0b658434-3767-401e-addc-eabfd1d0e94a\/code.power",
|
||||
"settings": "src\/0b658434-3767-401e-addc-eabfd1d0e94a\/settings.json",
|
||||
"path": "src\/0b658434-3767-401e-addc-eabfd1d0e94a",
|
||||
"guid": "0b658434-3767-401e-addc-eabfd1d0e94a"
|
||||
},
|
||||
"cc6972a7-1574-4ae0-92a8-7f1012aac6f7": {
|
||||
"name": "Agent",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search\\Service",
|
||||
"code": "src\/cc6972a7-1574-4ae0-92a8-7f1012aac6f7\/code.php",
|
||||
"power": "src\/cc6972a7-1574-4ae0-92a8-7f1012aac6f7\/code.power",
|
||||
"settings": "src\/cc6972a7-1574-4ae0-92a8-7f1012aac6f7\/settings.json",
|
||||
"path": "src\/cc6972a7-1574-4ae0-92a8-7f1012aac6f7",
|
||||
"guid": "cc6972a7-1574-4ae0-92a8-7f1012aac6f7"
|
||||
},
|
||||
"01a89ba8-f8bb-435c-93de-0a8f3fa9432a": {
|
||||
"name": "Factory",
|
||||
"type": "abstract class",
|
||||
"namespace": "VDM\\Joomla\\Componentbuilder\\Search",
|
||||
"code": "src\/01a89ba8-f8bb-435c-93de-0a8f3fa9432a\/code.php",
|
||||
"power": "src\/01a89ba8-f8bb-435c-93de-0a8f3fa9432a\/code.power",
|
||||
"settings": "src\/01a89ba8-f8bb-435c-93de-0a8f3fa9432a\/settings.json",
|
||||
"path": "src\/01a89ba8-f8bb-435c-93de-0a8f3fa9432a",
|
||||
"guid": "01a89ba8-f8bb-435c-93de-0a8f3fa9432a"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user