ver. 0.293: front\controls\Site + front\view\Site → front\App + front\LayoutEngine
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2
ajax.php
2
ajax.php
@@ -48,7 +48,7 @@ if ( !$lang = \Shared\Helpers\Helpers::get_session( 'lang' ) )
|
||||
\Shared\Helpers\Helpers::set_session( 'lang', $lang );
|
||||
}
|
||||
|
||||
\front\controls\Site::check_url_params();
|
||||
\front\App::checkUrlParams();
|
||||
|
||||
if ( !$settings = \Shared\Helpers\Helpers::get_session( 'settings' ) )
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace front\controls;
|
||||
namespace front;
|
||||
|
||||
class Site
|
||||
class App
|
||||
{
|
||||
static public function page_title()
|
||||
static public function pageTitle()
|
||||
{
|
||||
$moduleName = implode( '', array_map( 'ucfirst', explode( '_', \Shared\Helpers\Helpers::get( 'module' ) ) ) );
|
||||
$action = \Shared\Helpers\Helpers::get( 'action' );
|
||||
@@ -122,14 +122,14 @@ class Site
|
||||
/* strona kontaktu */
|
||||
case 4:
|
||||
$out = \front\Views\Articles::fullArticlesList( $articlesForPage, $pageArticlesResult['ls'], $bs ?: 1, $page );
|
||||
$out .= \front\view\Site::contact();
|
||||
$out .= \front\LayoutEngine::contact();
|
||||
return $out;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function check_url_params()
|
||||
public static function checkUrlParams()
|
||||
{
|
||||
global $lang, $config;
|
||||
|
||||
@@ -207,4 +207,3 @@ class Site
|
||||
];
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace front\view;
|
||||
namespace front;
|
||||
use shop\Product;
|
||||
|
||||
class Site
|
||||
class LayoutEngine
|
||||
{
|
||||
const menu_pattern = '/MENU:[0-9]*/';
|
||||
const menu_main_pattern = '/MENU_GLOWNE:[0-9]*/';
|
||||
@@ -56,10 +56,10 @@ class Site
|
||||
}
|
||||
|
||||
if ( $settings['facebook_link'] )
|
||||
$html = str_replace( '</body>', \front\view\Site::facebook( $settings['facebook_link'] ) . '</body>', $html );
|
||||
$html = str_replace( '</body>', self::facebook( $settings['facebook_link'] ) . '</body>', $html );
|
||||
|
||||
$html = str_replace( '[COPYRIGHT]',
|
||||
\front\view\Site::copyright(),
|
||||
self::copyright(),
|
||||
$html );
|
||||
|
||||
$html = str_replace( '[BANER_STRONA_GLOWNA]', \front\Views\Banners::mainBanner( $bannerRepo->mainBanner( $lang_id ) ), $html );
|
||||
@@ -233,7 +233,7 @@ class Site
|
||||
}
|
||||
|
||||
$html = str_replace( '[CANONICAL]', '', $html );
|
||||
$html = str_replace( '[ZAWARTOSC]', \front\controls\Site::route( $product, $category ), $html );
|
||||
$html = str_replace( '[ZAWARTOSC]', \front\App::route( $product, $category ), $html );
|
||||
|
||||
/* pojedynczy produkt */
|
||||
preg_match_all( self::single_product_pattern, $html, $single_product_array );
|
||||
@@ -315,7 +315,7 @@ class Site
|
||||
|
||||
$products_id_arr = ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->newProductIds( $limit );
|
||||
|
||||
|
||||
|
||||
foreach ( $products_id_arr as $product_id ){
|
||||
$top_products_arr[] = Product::getFromCache( (int)$product_id, $lang_id );
|
||||
}
|
||||
@@ -412,7 +412,7 @@ class Site
|
||||
$html = str_replace( $pattern, \front\Views\Articles::newsList( $topArticles ), $html );
|
||||
}
|
||||
|
||||
$html = str_replace( '[ALERT]', \front\view\Site::alert(), $html );
|
||||
$html = str_replace( '[ALERT]', self::alert(), $html );
|
||||
|
||||
preg_match_all( self::container_pattern, $html, $container_list );
|
||||
if ( is_array( $container_list[0] ) ) foreach( $container_list[0] as $container_list_tmp )
|
||||
@@ -473,10 +473,9 @@ class Site
|
||||
return $tpl -> render( 'site/contact' );
|
||||
}
|
||||
|
||||
public static function cookie_information()
|
||||
public static function cookieInformation()
|
||||
{
|
||||
$tpl = new \Shared\Tpl\Tpl;
|
||||
return $tpl -> render( 'site/cookie-information' );
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -4,6 +4,28 @@ Logi zmian z migracji na Domain-Driven Architecture. Najnowsze na gorze.
|
||||
|
||||
---
|
||||
|
||||
## ver. 0.293 (2026-02-17) - front\controls\Site + front\view\Site → front\App + front\LayoutEngine
|
||||
|
||||
- **front\controls\Site → front\App** — migracja routera na nowy namespace
|
||||
- Port 1:1 z camelCase: `check_url_params()` → `checkUrlParams()`, `page_title()` → `pageTitle()`
|
||||
- Wewnętrzna zmiana: `\front\view\Site::contact()` → `\front\LayoutEngine::contact()`
|
||||
- USUNIETA: `autoload/front/controls/class.Site.php`
|
||||
- **front\view\Site → front\LayoutEngine** — migracja layout engine na nowy namespace
|
||||
- Port 1:1 z camelCase: `cookie_information()` → `cookieInformation()`
|
||||
- Wewnętrzne zmiany: `\front\controls\Site::route()` → `\front\App::route()`, self-referencje na `self::`
|
||||
- 13 stałych regex i ~30 tag replacements przeniesione 1:1
|
||||
- USUNIETA: `autoload/front/view/class.Site.php`
|
||||
- **Call sites** — 4 miejsca przepięte:
|
||||
- `index.php:62` — `\front\App::checkUrlParams()`
|
||||
- `index.php:157` — `\front\LayoutEngine::show()`
|
||||
- `index.php:160` — `\front\LayoutEngine::cookieInformation()`
|
||||
- `ajax.php:51` — `\front\App::checkUrlParams()`
|
||||
- USUNIETE puste foldery: `autoload/front/controls/`, `autoload/front/view/`
|
||||
- **Pelna migracja frontendu zakonczona** — `autoload/front/` zawiera: `App.php`, `LayoutEngine.php`, `Controllers/`, `Views/`
|
||||
- Testy: 610 OK, 1816 asercji (bez zmian — czysty rename/restructure)
|
||||
|
||||
---
|
||||
|
||||
## ver. 0.292 (2026-02-17) - ShopProduct + ShopPaymentMethod + ShopPromotion + ShopStatuses + ShopTransport frontend migration
|
||||
|
||||
- **Pelna migracja front\factory\** — USUNIETY caly folder `autoload/front/factory/` (wszystkie 20 klas zmigrowane do Domain)
|
||||
@@ -803,4 +825,4 @@ Logi zmian z migracji na Domain-Driven Architecture. Najnowsze na gorze.
|
||||
- Metoda `clear_product_cache()` w klasie S
|
||||
|
||||
---
|
||||
*Dokument aktualizowany: 2026-02-17 (ver. 0.292)*
|
||||
*Dokument aktualizowany: 2026-02-17 (ver. 0.293)*
|
||||
|
||||
@@ -13,7 +13,7 @@ Panel administratora (33 moduły) został w pełni zmigrowany na architekturę D
|
||||
### front/controls/ (8 klas — handlery requestów)
|
||||
| Klasa | Status | Logika biznesowa |
|
||||
|-------|--------|-----------------|
|
||||
| Site | Router główny | route(), check_url_params(), title() |
|
||||
| Site | ZMIGROWANY do `front\App` — usunięty | route(), checkUrlParams(), title(), pageTitle(), getControllerFactories() |
|
||||
| ShopBasket | ZMIGROWANY do `front\Controllers\ShopBasketController` | Operacje koszyka, add/remove/quantity, checkout |
|
||||
| ShopClient | ZMIGROWANY do `front\Controllers\ShopClientController` | Logowanie, rejestracja, odzyskiwanie hasla, adresy, zamowienia |
|
||||
| ShopOrder | ZMIGROWANY do `front\Controllers\ShopOrderController` | Webhooki płatności + order details |
|
||||
@@ -49,7 +49,7 @@ Panel administratora (33 moduły) został w pełni zmigrowany na architekturę D
|
||||
### front/view/ (12 klas — renderowanie)
|
||||
| Klasa | Status |
|
||||
|-------|--------|
|
||||
| Site | KRYTYCZNY — show() ~600 linii, pattern substitution engine |
|
||||
| Site | ZMIGROWANY do `front\LayoutEngine` — usunięty |
|
||||
| ShopCategory | PRZENIESIONA do `front\Views\ShopCategory` |
|
||||
| Articles | Czyste VIEW |
|
||||
| Scontainers | PRZENIESIONA do `front\Views\Scontainers` |
|
||||
|
||||
@@ -108,10 +108,10 @@ shopPRO/
|
||||
│ │ ├── Helpers/ # Helpers (ex class.S.php)
|
||||
│ │ └── Tpl/ # Tpl (silnik szablonow)
|
||||
│ ├── front/ # Klasy frontendu
|
||||
│ │ ├── Controllers/ # Nowe kontrolery DI (Newsletter, ShopBasket, ShopClient, ShopCoupon, ShopOrder, ShopProducer)
|
||||
│ │ ├── Views/ # Nowe widoki (Newsletter, Articles, Languages, Banners, Menu, Scontainers, ShopCategory, ShopClient)
|
||||
│ │ ├── controls/ # Kontroler legacy (tylko Site — router)
|
||||
│ │ └── view/ # Widok legacy (tylko Site — layout engine)
|
||||
│ │ ├── App.php # Router (ex controls/Site) — route(), checkUrlParams(), getControllerFactories()
|
||||
│ │ ├── LayoutEngine.php # Layout engine (ex view/Site) — show(), contact(), cookieInformation()
|
||||
│ │ ├── Controllers/ # Kontrolery DI (Newsletter, ShopBasket, ShopClient, ShopCoupon, ShopOrder, ShopProducer, ShopProduct)
|
||||
│ │ └── Views/ # Widoki (Newsletter, Articles, Languages, Banners, Menu, Scontainers, ShopCategory, ShopClient)
|
||||
│ └── shop/ # Klasy sklepu
|
||||
├── docs/ # Dokumentacja techniczna
|
||||
├── libraries/ # Biblioteki zewnętrzne
|
||||
@@ -177,6 +177,8 @@ Główna klasa helper (przeniesiona z `class.S.php`) z metodami:
|
||||
- `\Domain\` - repozytoria/logika domenowa
|
||||
- `\admin\factory\` - helpery/fabryki admin
|
||||
- ~~`\front\factory\`~~ - USUNIĘTY — wszystkie fabryki zmigrowane do Domain
|
||||
- ~~`\front\controls\`~~ - USUNIĘTY — router przeniesiony do `\front\App`
|
||||
- ~~`\front\view\`~~ - USUNIĘTY — layout engine przeniesiony do `\front\LayoutEngine`
|
||||
- `\shop\` - klasy sklepu (Product, Order, itp.)
|
||||
|
||||
### Cachowanie produktów
|
||||
@@ -241,10 +243,10 @@ autoload/
|
||||
│ ├── factory/ # Stare helpery (niezależny fallback)
|
||||
│ └── view/ # Widoki (statyczne - bez zmian)
|
||||
├── front/
|
||||
│ ├── Controllers/ # Nowe kontrolery frontendowe (namespace \front\Controllers\) z DI
|
||||
│ ├── Views/ # Nowe widoki (namespace \front\Views\) — czyste VIEW, statyczne (Menu, Newsletter, Articles, Languages, Banners, Scontainers, ShopCategory, ShopClient)
|
||||
│ ├── controls/ # Legacy kontroler (tylko Site — router)
|
||||
│ └── view/ # Legacy widok (tylko Site — layout engine)
|
||||
│ ├── App.php # Router (namespace \front\) — route(), checkUrlParams(), getControllerFactories()
|
||||
│ ├── LayoutEngine.php # Layout engine (namespace \front\) — show(), contact(), cookieInformation()
|
||||
│ ├── Controllers/ # Kontrolery frontendowe (namespace \front\Controllers\) z DI
|
||||
│ └── Views/ # Widoki (namespace \front\Views\) — czyste VIEW, statyczne
|
||||
├── shop/ # Legacy - fasady do Domain
|
||||
```
|
||||
|
||||
@@ -479,6 +481,14 @@ Pelna dokumentacja testow: `TESTING.md`
|
||||
- UPDATE: `front\view\Site::show()` — przepiecie na `$producerRepo->findForFrontend()`
|
||||
- UPDATE: `front\controls\Site::getControllerFactories()` — zarejestrowany `ShopProducer`
|
||||
|
||||
## Aktualizacja 2026-02-17 (ver. 0.293) - front\controls\Site + front\view\Site → front\App + front\LayoutEngine
|
||||
- Przemianowano `front\controls\Site` na `front\App` (plik `App.php`) — router z camelCase metodami.
|
||||
- Przemianowano `front\view\Site` na `front\LayoutEngine` (plik `LayoutEngine.php`) — layout engine z camelCase metodami.
|
||||
- Przepiete call sites: `index.php` (3 miejsca), `ajax.php` (1 miejsce).
|
||||
- Usuniete pliki: `autoload/front/controls/class.Site.php`, `autoload/front/view/class.Site.php`.
|
||||
- Usuniete puste foldery: `autoload/front/controls/`, `autoload/front/view/`.
|
||||
- Pelna migracja frontendu zakonczona — struktura `autoload/front/`: `App.php`, `LayoutEngine.php`, `Controllers/`, `Views/`.
|
||||
|
||||
## Aktualizacja 2026-02-17 (ver. 0.292) - ShopProduct + ShopPaymentMethod + ShopPromotion + ShopStatuses + ShopTransport frontend migration
|
||||
- **Pelna migracja front\factory\** — USUNIETY caly folder `autoload/front/factory/`; 5 ostatnich klas zmigrowanych:
|
||||
- `front\factory\ShopProduct` (~410 linii) → `ProductRepository` (~20 nowych metod frontendowych)
|
||||
@@ -488,7 +498,7 @@ Pelna dokumentacja testow: `TESTING.md`
|
||||
- `front\factory\ShopTransport` → `TransportRepository` (4 metody frontendowe z Redis cache)
|
||||
- Usuniete legacy: `front\controls\class.ShopProduct.php`, `front\view\class.ShopPaymentMethod.php`, `front\view\class.ShopTransport.php`, `shop\class.PaymentMethod.php`
|
||||
- FIX: broken `transports_list()` w ajax.php → nowa metoda `forPaymentMethod()`
|
||||
- Pozostale w front\: `controls/class.Site.php` (router), `view/class.Site.php` (layout engine)
|
||||
- Pelna migracja frontendu zakonczona — `autoload/front/`: `App.php`, `LayoutEngine.php`, `Controllers/`, `Views/`
|
||||
|
||||
---
|
||||
*Dokument aktualizowany: 2026-02-17 (ver. 0.292)*
|
||||
*Dokument aktualizowany: 2026-02-17 (ver. 0.293)*
|
||||
|
||||
@@ -39,6 +39,12 @@ Ostatnio zweryfikowano: 2026-02-17
|
||||
OK (610 tests, 1816 assertions)
|
||||
```
|
||||
|
||||
Aktualizacja po migracji front\controls\Site + front\view\Site (2026-02-17, ver. 0.293):
|
||||
```text
|
||||
Pelny suite: OK (610 tests, 1816 assertions)
|
||||
Brak nowych testow — czysty rename/restructure (klasy statyczne, bez logiki biznesowej)
|
||||
```
|
||||
|
||||
Aktualizacja po migracji ShopProduct + ShopPaymentMethod + ShopPromotion + ShopStatuses + ShopTransport frontend (2026-02-17, ver. 0.292):
|
||||
```text
|
||||
Pelny suite: OK (610 tests, 1816 assertions)
|
||||
|
||||
@@ -18,14 +18,14 @@ Aktualizacje znajdują się w folderze `updates/0.XX/` gdzie XX oznacza dziesią
|
||||
|
||||
## Procedura tworzenia nowej aktualizacji
|
||||
|
||||
## Status biezacej aktualizacji (ver. 0.292)
|
||||
## Status biezacej aktualizacji (ver. 0.293)
|
||||
|
||||
- Wersja udostepniona: `0.292` (data: 2026-02-17).
|
||||
- Wersja udostepniona: `0.293` (data: 2026-02-17).
|
||||
- Pliki publikacyjne:
|
||||
- `temp/update_build/ver_0.292.zip`, `ver_0.292_files.txt`
|
||||
- `temp/update_build/ver_0.293.zip`, `ver_0.293_files.txt`
|
||||
- Pliki metadanych aktualizacji:
|
||||
- `updates/changelog.php` (dodany wpis `ver. 0.292`)
|
||||
- `updates/versions.php` (`$current_ver = 292`)
|
||||
- `updates/changelog.php` (dodany wpis `ver. 0.293`)
|
||||
- `updates/versions.php` (`$current_ver = 293`)
|
||||
- Weryfikacja testow przed publikacja:
|
||||
- `OK (610 tests, 1816 assertions)`
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ $mdb = new medoo( [
|
||||
'time_debug' => $database['time_debug']
|
||||
] );
|
||||
|
||||
\front\controls\Site::check_url_params();
|
||||
\front\App::checkUrlParams();
|
||||
|
||||
$langRepo = new \Domain\Languages\LanguagesRepository( $mdb );
|
||||
|
||||
@@ -154,10 +154,10 @@ if ( !is_array( $page ) or !(int)$page['id'] )
|
||||
if ( \Shared\Helpers\Helpers::get( 'devel' ) )
|
||||
$settings[ 'devel' ] = true;
|
||||
|
||||
$out = \front\view\Site::show();
|
||||
$out = \front\LayoutEngine::show();
|
||||
|
||||
if ( !isset( $_COOKIE[ "cookie_information" ] ) )
|
||||
$out = strrev( implode( strrev( \front\view\Site::cookie_information() . '</body>' ), explode( strrev( '</body>' ), strrev( $out ), 2 ) ) );
|
||||
$out = strrev( implode( strrev( \front\LayoutEngine::cookieInformation() . '</body>' ), explode( strrev( '</body>' ), strrev( $out ), 2 ) ) );
|
||||
|
||||
if ( $settings[ 'statistic_code' ] )
|
||||
$out = strrev( implode( strrev( $settings[ 'statistic_code' ] . '</body>' ), explode( strrev( '</body>' ), strrev( $out ), 2 ) ) );
|
||||
|
||||
BIN
temp/update_build/ver_0.293.zip
Normal file
BIN
temp/update_build/ver_0.293.zip
Normal file
Binary file not shown.
2
temp/update_build/ver_0.293_files.txt
Normal file
2
temp/update_build/ver_0.293_files.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
F: ../autoload/front/controls/class.Site.php
|
||||
F: ../autoload/front/view/class.Site.php
|
||||
@@ -1,3 +1,10 @@
|
||||
<b>ver. 0.293 - 17.02.2026</b><br />
|
||||
- UPDATE - front\controls\Site przemianowany na front\App (router, camelCase: checkUrlParams, pageTitle)
|
||||
- UPDATE - front\view\Site przemianowany na front\LayoutEngine (layout engine, camelCase: cookieInformation)
|
||||
- UPDATE - przepiete call sites w index.php (3 miejsca) i ajax.php (1 miejsce)
|
||||
- CLEANUP - usuniete autoload/front/controls/ i autoload/front/view/ (puste foldery + pliki legacy)
|
||||
- UPDATE - pelna migracja frontendu zakonczona: autoload/front/ = App.php + LayoutEngine.php + Controllers/ + Views/
|
||||
<hr>
|
||||
<b>ver. 0.292 - 17.02.2026</b><br />
|
||||
- UPDATE - pelna migracja front\factory\ do Domain (5 ostatnich klas: ShopProduct, ShopPaymentMethod, ShopPromotion, ShopStatuses, ShopTransport)
|
||||
- UPDATE - ProductRepository: ~20 nowych metod frontendowych (cache Redis, lazy loading, SKU/EAN fallback)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?
|
||||
$current_ver = 292;
|
||||
$current_ver = 293;
|
||||
|
||||
for ($i = 1; $i <= $current_ver; $i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user