FileAccess Orion

Localization extends Master
in package
implements WithIncludes

Implement interfaces for system localisation

This class provides interfaces to administrate locales, countries and translations It provides the user an option for batch editing translations on top

Tags
category

Kernel

author

Tobias Teichner webmaster@teichner.biz

since

File available since v0.12

Interfaces, Classes, Traits and Enums

WithIncludes

Table of Contents

$request  : Request|null
$endpoint  : Endpoint|null
$response  : Response|null
$setup  : Widget|null
$checked_files  : string
The extensions to check
$git_repo  : array<string|int, mixed>
$short_length  : int
The length
$valid_key  : string
keys with this structure are valid
__construct()  : mixed
Needs to be there even if it is empty
addTranslationList()  : void
add to translation list
call()  : mixed
createCountry()  : void
createLanguage()  : void
dropSingleCountry()  : void
dropSingleLanguage()  : void
dropSingleTranslation()  : void
Endpoint()  : Endpoint|null
Get/Set endpoint
ExportExecute()  : void
fetchCountries()  : void
FetchCountryProcessed()  : void
fetchLanguages()  : void
fetchTranslations()  : void
fetchTranslationsProcessed()  : void
GitRepo()  : Git
Git object
ImportExecute()  : void
ImportPreset()  : void
loadSingleCountry()  : void
loadSingleLanguage()  : void
loadSingleTranslation()  : void
loadTranslationList()  : void
load translation list
OpenFile()  : void
RegisterIncludes()  : array<string|int, mixed>
Register includes on add the widget to certain page
Request()  : Request
The request Sets or gets the widget request object
Response()  : Response
Response object Get / Set the widget response
Setup()  : Widget|null
Get/Set the widget context
updateSingleCountry()  : void
updateSingleLanguage()  : void
updateSingleTranslation()  : void
ConfigGet()  : void
Get a configuration by name
ConfigGetPreset()  : void
Get the configuration preset data
ConfigGetRaw()  : Result
Get configuration data as object from setup handler
ConfigSave()  : void
Store a configuration with values from body and a given name
CopyEntity()  : void
copy a single content links the frontend to the copy handler for single contents identified by rest end point argument
CreateEntity()  : mixed
create new object
deleteEntity()  : void
Delete a single content
fetchAssignedEntityList()  : mixed
fetchEntityList()  : void
Fetch list of entries Use the direct loader method to retrieve a list obf objects
fetchEntityListFiltered()  : void
Fetch filtered list
fetchObject()  : BaseContent|bool|null
Retrieve an object from storage
handleSubViewList()  : mixed
Handle the list/object loading for sub view of contents
loadSingleEntity()  : void
load a single content implements the loader for single contents identified by rest end point argument
prepareObjectLogs()  : void
Prepare the object comment and arguments for changes in diff
UpdateEntity()  : void
Update a single content
matchTranslations()  : void
parse translations out of file data

Properties

$checked_files

The extensions to check

private string $checked_files = '/^(js)|(css)|(php)|(html)|(txt)|(tpl)$/'

$git_repo

private array<string|int, mixed> $git_repo = array()

$short_length

The length

private int $short_length = 64

$valid_key

keys with this structure are valid

private string $valid_key = '/^[a-z0-9_\\-.]+$/'

Methods

__construct()

Needs to be there even if it is empty

public __construct() : mixed
Return values
mixed

addTranslationList()

add to translation list

public addTranslationList() : void

interface to add, update and delete translations from verification list the single elements will be handled step by step

Tags
payload

uses a associative list of hash keys with minimal translation objects

Return values
void

call()

public call() : mixed
Return values
mixed

createCountry()

public createCountry() : void
Return values
void

createLanguage()

public createLanguage() : void
Return values
void

dropSingleCountry()

public dropSingleCountry() : void
Return values
void

dropSingleLanguage()

public dropSingleLanguage() : void
Return values
void

dropSingleTranslation()

public dropSingleTranslation() : void
Return values
void

Endpoint()

Get/Set endpoint

public Endpoint([Endpoint|null $endpoint = null ]) : Endpoint|null

Sets or gets the widget arguments, they contain the endpoint this widget was called at

Parameters
$endpoint : Endpoint|null = null

A system request list

Return values
Endpoint|null

A system endpoint object

ExportExecute()

public ExportExecute() : void
Return values
void

fetchCountries()

public fetchCountries() : void
Return values
void

FetchCountryProcessed()

public FetchCountryProcessed() : void
Return values
void

fetchLanguages()

public fetchLanguages() : void
Return values
void

fetchTranslations()

public fetchTranslations() : void
Return values
void

fetchTranslationsProcessed()

public fetchTranslationsProcessed() : void
Return values
void

GitRepo()

Git object

public GitRepo([string $path = 'data' ]) : Git

Gets the widget git instance, either for config or, for data repo

Parameters
$path : string = 'data'

The target repo, default is data

Return values
Git

A system git object with data folder as start point

ImportExecute()

public ImportExecute() : void
Return values
void

ImportPreset()

public ImportPreset() : void
Return values
void

loadSingleCountry()

public loadSingleCountry() : void
Return values
void

loadSingleLanguage()

public loadSingleLanguage() : void
Return values
void

loadSingleTranslation()

public loadSingleTranslation() : void
Return values
void

loadTranslationList()

load translation list

public loadTranslationList() : void

will deliver a list of translations for verification, unused translations will be offered for delete, used but dirty will be shown yellow and until now not registered will be green

to be valid, a translation key must match /^[a-z-_.]+$/ to be considered as registered a translation must occur in a fat block

Tags
payload

void

Return values
void

OpenFile()

public OpenFile() : void
Return values
void

RegisterIncludes()

Register includes on add the widget to certain page

public RegisterIncludes(Request $request) : array<string|int, mixed>
Parameters
$request : Request
Return values
array<string|int, mixed>

Request()

The request Sets or gets the widget request object

public Request([Request|null $request = null ]) : Request
Parameters
$request : Request|null = null

A system request object

Return values
Request

A system request object

Response()

Response object Get / Set the widget response

public Response([Response|null $response = null ]) : Response
Parameters
$response : Response|null = null
Return values
Response

A system response object

Setup()

Get/Set the widget context

public Setup([Widget|null $setup = null ]) : Widget|null
Parameters
$setup : Widget|null = null
Return values
Widget|null

updateSingleCountry()

public updateSingleCountry() : void
Return values
void

updateSingleLanguage()

public updateSingleLanguage() : void
Return values
void

updateSingleTranslation()

public updateSingleTranslation() : void
Return values
void

ConfigGet()

Get a configuration by name

protected ConfigGet(string $name) : void
Parameters
$name : string

The name of the config file

Return values
void

ConfigGetPreset()

Get the configuration preset data

protected ConfigGetPreset(string $name) : void
Parameters
$name : string

The name of the config file

Return values
void

ConfigGetRaw()

Get configuration data as object from setup handler

protected ConfigGetRaw(string $name) : Result
Parameters
$name : string

The name of the config file

Return values
Result

ConfigSave()

Store a configuration with values from body and a given name

protected ConfigSave(string $name) : void
Parameters
$name : string

The name of the config file

Return values
void

CopyEntity()

copy a single content links the frontend to the copy handler for single contents identified by rest end point argument

protected CopyEntity(array<string|int, mixed>|string $type, int|string $epIndex) : void
Parameters
$type : array<string|int, mixed>|string

The requested content type

$epIndex : int|string

Parse this parameter as id

Return values
void

CreateEntity()

create new object

protected CreateEntity(string $type) : mixed

this method creates a new instance of a specific system content type

Parameters
$type : string

A registered system content type

Return values
mixed

deleteEntity()

Delete a single content

protected deleteEntity(string|array<string|int, string> $type, int|string $epIndex) : void

Implements the delete handler for single contents identified by rest end point argument

Parameters
$type : string|array<string|int, string>

The requested content type

$epIndex : int|string

Parse this parameter as id

Return values
void

fetchAssignedEntityList()

protected fetchAssignedEntityList( $list[, null $language = null ]) : mixed
Parameters
$list :
$language : null = null
Tags
deprecated

This method is obsolete and a relic from a certain project

Return values
mixed

fetchEntityList()

Fetch list of entries Use the direct loader method to retrieve a list obf objects

protected fetchEntityList(string $type[, bool $raw = false ]) : void
Parameters
$type : string

Fetch list of elements

$raw : bool = false

Return as raw object and not plain

Return values
void

fetchEntityListFiltered()

Fetch filtered list

protected fetchEntityListFiltered(string|array<string|int, string> $type[, array<string|int, mixed>|null $extra_payload = null ]) : void

Implements the server side data tables processing functions Supports free text search, paging and ordering at the moment

Parameters
$type : string|array<string|int, string>

The requested content type(s)

$extra_payload : array<string|int, mixed>|null = null

Additional filter operators

Return values
void

fetchObject()

Retrieve an object from storage

protected fetchObject(int|string $id, string|array<string|int, string> $type[, string $right = 'view' ]) : BaseContent|bool|null

Load a single content from storage as instance If object was not found it will set the 404 error code

Parameters
$id : int|string

A object id

$type : string|array<string|int, string>

A object type

$right : string = 'view'

An access level to test against

Return values
BaseContent|bool|null

A base content or null when not found or false when not access

handleSubViewList()

Handle the list/object loading for sub view of contents

protected handleSubViewList(array<string|int, mixed> $payload) : mixed
Parameters
$payload : array<string|int, mixed>

The request payload parent_type string Name of the parent type to manage inside parent string/int The id of the parent content attr string The attribute name to manage type string Type of the content to assign elements array List of elements when type is __multi content int Id when a direct content edit is performed (e.g. in child contents)

Tags
deprecated

This method is deprecated

Return values
mixed

loadSingleEntity()

load a single content implements the loader for single contents identified by rest end point argument

protected loadSingleEntity(string $type, int|string $epIndex[, string|null $language = null ]) : void
Parameters
$type : string

The requested content type

$epIndex : int|string

Parse this parameter as id

$language : string|null = null

Language code to fetch element in

Return values
void

prepareObjectLogs()

Prepare the object comment and arguments for changes in diff

protected prepareObjectLogs(BaseContent $item) : void
Parameters
$item : BaseContent
Return values
void

UpdateEntity()

Update a single content

protected UpdateEntity(string|array<string|int, string> $type, int|string $epIndex[, bool $return = false ]) : void

Implements the update handler for single contents identified by rest end point argument Does return the values when config option says so

Parameters
$type : string|array<string|int, string>

The requested content type or, a list of allowed types

$epIndex : int|string

Parse this parameter as id

$return : bool = false
Return values
void

matchTranslations()

parse translations out of file data

private matchTranslations(array<string|int, mixed> $existing, array<string|int, mixed> &$translations, string $file) : void

the method takes the data from a file parses all translation setters using regex and adds the to the reference result it will add not existing ones and on top dirty entries with no plain definition

Parameters
$existing : array<string|int, mixed>

A list of already registered translations

$translations : array<string|int, mixed>

The result list

$file : string

Absolute path to checked file

Return values
void

Search results