mirror of
https://github.com/Karaka-Management/Developer-Guide.git
synced 2026-01-12 04:48:41 +00:00
parent
28c8888f10
commit
dd4f5f12b2
|
|
@ -46,7 +46,7 @@ The following directory structure should roughly visualize how modules are struc
|
|||
* NullYourPHPModel.php
|
||||
* YourPHPModelMapper.php
|
||||
* ... more models/mappers/enums
|
||||
* YourJavaScriptModels.js
|
||||
* YourJSModels.js
|
||||
* Theme
|
||||
* Backend
|
||||
* Css
|
||||
|
|
@ -60,7 +60,7 @@ The following directory structure should roughly visualize how modules are struc
|
|||
* your_template_files.tpl.php
|
||||
* Views
|
||||
* YourPhpViews.php
|
||||
* YourJavaScriptViews.js
|
||||
* YourJSViews.js
|
||||
* info.json
|
||||
* README.md
|
||||
```
|
||||
|
|
@ -249,7 +249,7 @@ All module specific images (not theme specific images). E.g. Module preview imag
|
|||
|
||||
## Models
|
||||
|
||||
All models and data mapper classes should be stored in here (PHP & JS). How to create a data mapper for a model is described in the data mapper chapter. All JavaScript files need to be provided un-optimized (not minified or concatenated).
|
||||
All models and data mapper classes should be stored in here (PHP & JS). How to create a data mapper for a model is described in the data mapper chapter. All JS files need to be provided un-optimized (not minified or concatenated).
|
||||
|
||||
## Theme
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ The following dev tools are highly recommended and the documentation assumes you
|
|||
### Quick software overview
|
||||
|
||||
```sh
|
||||
# For php/html/javascript developers
|
||||
# For php/html/js developers
|
||||
sudo apt-get install git poppler-utils mariadb-server mariadb-client postgresql postgresql-contrib vsftpd tesseract-ocr wget curl grep sed composer nodejs npm software-properties-common php8.3 php8.3-dev php8.3-cli php8.3-common php8.3-intl php8.3-mysql php8.3-pgsql php8.3-xdebug php8.3-opcache php8.3-pdo php8.3-sqlite php8.3-mbstring php8.3-curl php8.3-imap php8.3-bcmath php8.3-zip php8.3-dom php8.3-xml php8.3-phar php8.3-gd php-pear apache2 redis redis-server memcached sqlite3 wkhtmltopdf imagemagick
|
||||
|
||||
sudo systemctl enable apache2
|
||||
|
|
|
|||
|
|
@ -48,4 +48,4 @@ $result = Rest::request($request);
|
|||
|
||||
## Websocket Requests
|
||||
|
||||
## JavaScript Requests
|
||||
## JS Requests
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ For caching the `CacheManager` provides access to the caching systems in place.
|
|||
|
||||
## HTTP Cache
|
||||
|
||||
By default only stylesheets, javascript and layout images as well as module images are cached. Everything else is considered volatile and not cached. If a response specific response should be cached feel free to use the response header:
|
||||
By default only stylesheets, js and layout images as well as module images are cached. Everything else is considered volatile and not cached. If a response specific response should be cached feel free to use the response header:
|
||||
|
||||
Example usage for 30 days caching:
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ Example usage for 30 days caching:
|
|||
$response->setHeader('Cache-Control', 'Cache-Control: max-age=2592000');
|
||||
```
|
||||
|
||||
In order to trigger a re-cache of stylesheets or javascript files make sure to update the version in the `Controller.php` file. This way version updates will result in a new virtual file uri and result in a re-cache.
|
||||
In order to trigger a re-cache of stylesheets or js files make sure to update the version in the `Controller.php` file. This way version updates will result in a new virtual file uri and result in a re-cache.
|
||||
|
||||
Example usage:
|
||||
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@
|
|||
|
||||
Only use cookies when absolutely necessary. Most of the time session data or local storage is the preferred choice. The `CookieJar` class provides you with all the necessary functionality similar to the `SessionManager`. The super global `$_COOKIE` is also overwritten and shouldn't be used anywhere.
|
||||
|
||||
## JavaScript
|
||||
## JS
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Code Inspections & Tests
|
||||
|
||||
Code inspections are very important in order to maintain the same code quality throughout the application. The [Build](https://github.com/Karaka-Management/Build) repository and package managers such as `composer` and `npm` contain all essential configuration files for the respective php and javascript inspection tools. The framework and every module will be evaluated based on the defined code and quality standards. Only code that passes all code, quality and test standards is accepted. Updates and bug fixes also must follow these standards.
|
||||
Code inspections are very important in order to maintain the same code quality throughout the application. The [Build](https://github.com/Karaka-Management/Build) repository and package managers such as `composer` and `npm` contain all essential configuration files for the respective php and JS inspection tools. The framework and every module will be evaluated based on the defined code and quality standards. Only code that passes all code, quality and test standards is accepted. Updates and bug fixes also must follow these standards.
|
||||
|
||||
## Summary
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ php vendor/bin/phpunit -c tests/PHPUnit/phpunit_no_coverage.xml
|
|||
In order to also create a code coverage report run:
|
||||
|
||||
```sh
|
||||
php -dxdebug.mode=coverage,develop,debug vendor/bin/phpunit -c tests/phpunit_default.xml --log-junit Build/test/junit_php.xml --coverage-html Build/coverage
|
||||
php -dxdebug.remote_enable=1 -dxdebug.start_with_request=yes -dxdebug.mode=coverage,develop,debug vendor/bin/phpunit -c tests/phpunit_default.xml --log-junit Build/test/junit_php.xml --coverage-html Build/coverage
|
||||
```
|
||||
|
||||
A visualization of the coverage can be found at http://127.0.0.1/Build/coverage
|
||||
|
|
@ -242,7 +242,7 @@ find . -regex '.*\.\(cpp\|h\)' -exec clang-format -style=file:Build/Config/.clan
|
|||
|
||||
### Jasmine
|
||||
|
||||
The javascript testing is done with jasmine. The javascript testing directory is structured the same way as the `Framework`. Unit tests for specific classes need to be named in the same manner as the testing class.
|
||||
The JS testing is done with jasmine. The JS testing directory is structured the same way as the `Framework`. Unit tests for specific classes need to be named in the same manner as the testing class.
|
||||
|
||||
```sh
|
||||
./Build/Config/jasmine_build.sh && npx jasmine --config=Build/Config/jasmine.json
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ The following headers must be set for every web application. By default they are
|
|||
|
||||
### Content-Security-Policy
|
||||
|
||||
Scripts and frames must be provided by the own server. This is important in order to prevent the injection of other scripts and clickjacking. Inline javascript is prohibited and may only be defined in the application and not in any modules.
|
||||
Scripts and frames must be provided by the own server. This is important in order to prevent the injection of other scripts and clickjacking. Inline JS is prohibited and may only be defined in the application and not in any modules.
|
||||
|
||||
The default CSP looks like the following:
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ $response->header->set('content-security-policy',
|
|||
);
|
||||
```
|
||||
|
||||
Javascript can now be included like this:
|
||||
JS can now be included like this:
|
||||
|
||||
```php
|
||||
$head = $response->data['Content']->head;
|
||||
|
|
@ -115,7 +115,7 @@ In some cases superglobals will even be overwritten by values from these classes
|
|||
|
||||
Input validation can be implemented on multiple levels.
|
||||
|
||||
1. Regex validation in html/javascript by using the `pattern=""` attribute
|
||||
1. Regex validation in html/js by using the `pattern=""` attribute
|
||||
2. Type hints for method parameters wherever possible.
|
||||
3. Making use of the `Validation` classes as much as possible
|
||||
4. **Do not** sanitize! Accept or dismiss!
|
||||
|
|
|
|||
|
|
@ -109,9 +109,9 @@ Example:
|
|||
/** @var TestObject[] $myArray */
|
||||
```
|
||||
|
||||
## JavaScript
|
||||
## JS
|
||||
|
||||
The javascript documentation is based on JsDoc, therefore only valid JsDoc comments are valid for all js files.
|
||||
The JS documentation is based on JsDoc, therefore only valid JsDoc comments are valid for all js files.
|
||||
|
||||
### File
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user