ver. 0.283: Legacy class cleanup — S, Html, Email, Image, Log, Mobile_Detect → Shared namespace

- Migrate class.S → Shared\Helpers\Helpers (140+ files), remove 12 unused methods
- Migrate class.Html → Shared\Html\Html
- Migrate class.Email → Shared\Email\Email
- Migrate class.Image → Shared\Image\ImageManipulator
- Delete class.Log (unused), class.Mobile_Detect (outdated UA detection)
- Remove grid library loading from admin (index.php, ajax.php)
- Replace gridEdit usage in 10 admin templates with grid-edit-replacement.php
- Fix grid-edit-replacement.php AJAX to send values as JSON (grid.js compat)
- Remove mobile layout conditionals (m_html/m_css/m_js) from Site + LayoutsRepository
- Remove \Log::save_log() calls from OrderAdminService, ShopOrder, Order

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-16 23:06:06 +01:00
parent 8e97413361
commit 431add234c
159 changed files with 1501 additions and 3043 deletions

View File

@@ -634,9 +634,9 @@ class ProductRepository
$this->cleanupDeletedImages( $productId );
}
\S::htacces();
\S::delete_dir( '../temp/' );
\S::delete_dir( '../thumbs/' );
\Shared\Helpers\Helpers::htacces();
\Shared\Helpers\Helpers::delete_dir( '../temp/' );
\Shared\Helpers\Helpers::delete_dir( '../thumbs/' );
if ( !$isNew ) {
$redis = \Shared\Cache\RedisConnection::getInstance()->getConnection();
@@ -660,7 +660,7 @@ class ProductRepository
'description' => $this->nullIfEmpty( $d['description'][$lid] ?? null ),
'meta_description' => $this->nullIfEmpty( $d['meta_description'][$lid] ?? null ),
'meta_keywords' => $this->nullIfEmpty( $d['meta_keywords'][$lid] ?? null ),
'seo_link' => !empty( $d['seo_link'][$lid] ) ? \S::seo( $d['seo_link'][$lid] ) : null,
'seo_link' => !empty( $d['seo_link'][$lid] ) ? \Shared\Helpers\Helpers::seo( $d['seo_link'][$lid] ) : null,
'copy_from' => $this->nullIfEmpty( $d['copy_from'][$lid] ?? null ),
'warehouse_message_zero' => $this->nullIfEmpty( $d['warehouse_message_zero'][$lid] ?? null ),
'warehouse_message_nonzero' => $this->nullIfEmpty( $d['warehouse_message_nonzero'][$lid] ?? null ),
@@ -684,7 +684,7 @@ class ProductRepository
if ( $translationId ) {
$currentSeoLink = $this->db->get( 'pp_shop_products_langs', 'seo_link', [ 'id' => $translationId ] );
$newSeoLink = $langData['seo_link'] ?: \S::seo( 'p-' . $productId . '-' . ( $d['name'][$lid] ?? '' ) );
$newSeoLink = $langData['seo_link'] ?: \Shared\Helpers\Helpers::seo( 'p-' . $productId . '-' . ( $d['name'][$lid] ?? '' ) );
if ( $newSeoLink !== $currentSeoLink && $currentSeoLink != '' ) {
$this->handleSeoRedirects( $productId, $lid, $newSeoLink, $currentSeoLink );
@@ -733,7 +733,7 @@ class ProductRepository
] );
if ( !$this->db->count( 'pp_redirects', [ 'from' => $currentSeoLink, 'to' => $newSeoLink, 'lang_id' => $langId, 'product_id' => $productId ] ) ) {
if ( \S::canAddRedirect( $currentSeoLink, $newSeoLink, $langId ) ) {
if ( \Shared\Helpers\Helpers::canAddRedirect( $currentSeoLink, $newSeoLink, $langId ) ) {
$this->db->insert( 'pp_redirects', [ 'from' => $currentSeoLink, 'to' => $newSeoLink, 'lang_id' => $langId, 'product_id' => $productId ] );
}
}
@@ -947,8 +947,8 @@ class ProductRepository
$this->db->delete( 'pp_routes', [ 'product_id' => $productId ] );
$this->db->delete( 'pp_redirects', [ 'product_id' => $productId ] );
\S::delete_dir( '../upload/product_images/product_' . $productId . '/' );
\S::delete_dir( '../upload/product_files/product_' . $productId . '/' );
\Shared\Helpers\Helpers::delete_dir( '../upload/product_images/product_' . $productId . '/' );
\Shared\Helpers\Helpers::delete_dir( '../upload/product_files/product_' . $productId . '/' );
return true;
}
@@ -993,7 +993,7 @@ class ProductRepository
// Atrybuty
$attributes = $this->db->select( 'pp_shop_products_attributes', '*', [ 'product_id' => $productId ] );
if ( \S::is_array_fix( $attributes ) ) {
if ( \Shared\Helpers\Helpers::is_array_fix( $attributes ) ) {
foreach ( $attributes as $row ) {
$this->db->insert( 'pp_shop_products_attributes', [
'product_id' => $newProductId,
@@ -1005,7 +1005,7 @@ class ProductRepository
// Kategorie
$categories = $this->db->select( 'pp_shop_products_categories', '*', [ 'product_id' => $productId ] );
if ( \S::is_array_fix( $categories ) ) {
if ( \Shared\Helpers\Helpers::is_array_fix( $categories ) ) {
foreach ( $categories as $row ) {
$this->db->insert( 'pp_shop_products_categories', [
'product_id' => $newProductId,
@@ -1017,7 +1017,7 @@ class ProductRepository
// Języki
$langs = $this->db->select( 'pp_shop_products_langs', '*', [ 'product_id' => $productId ] );
if ( \S::is_array_fix( $langs ) ) {
if ( \Shared\Helpers\Helpers::is_array_fix( $langs ) ) {
foreach ( $langs as $row ) {
$this->db->insert( 'pp_shop_products_langs', [
'product_id' => $newProductId,
@@ -1040,7 +1040,7 @@ class ProductRepository
// Custom fields
$customFields = $this->db->select( 'pp_shop_products_custom_fields', '*', [ 'id_product' => $productId ] );
if ( \S::is_array_fix( $customFields ) ) {
if ( \Shared\Helpers\Helpers::is_array_fix( $customFields ) ) {
foreach ( $customFields as $row ) {
$this->db->insert( 'pp_shop_products_custom_fields', [
'id_product' => $newProductId,
@@ -1052,7 +1052,7 @@ class ProductRepository
// Duplikowanie kombinacji
if ( $withCombinations ) {
$productCombinations = $this->db->select( 'pp_shop_products', '*', [ 'parent_id' => $productId ] );
if ( \S::is_array_fix( $productCombinations ) ) {
if ( \Shared\Helpers\Helpers::is_array_fix( $productCombinations ) ) {
foreach ( $productCombinations as $comb ) {
$this->db->insert( 'pp_shop_products', [
'parent_id' => $newProductId,
@@ -1073,7 +1073,7 @@ class ProductRepository
$combNewId = $this->db->id();
if ( $combNewId ) {
$combAttrs = $this->db->select( 'pp_shop_products_attributes', '*', [ 'product_id' => $comb['id'] ] );
if ( \S::is_array_fix( $combAttrs ) ) {
if ( \Shared\Helpers\Helpers::is_array_fix( $combAttrs ) ) {
foreach ( $combAttrs as $attr ) {
$this->db->insert( 'pp_shop_products_attributes', [
'product_id' => $combNewId,
@@ -1114,7 +1114,7 @@ class ProductRepository
public function updatePriceBrutto(int $productId, $price): bool
{
$vat = (float) $this->db->get( 'pp_shop_products', 'vat', [ 'id' => $productId ] );
$priceNetto = \S::normalize_decimal( (float) $price / ( 100 + $vat ) * 100, 2 );
$priceNetto = \Shared\Helpers\Helpers::normalize_decimal( (float) $price / ( 100 + $vat ) * 100, 2 );
$this->db->update( 'pp_shop_products', [
'price_brutto' => $price != 0.00 ? $price : null,
@@ -1134,7 +1134,7 @@ class ProductRepository
public function updatePriceBruttoPromo(int $productId, $price): bool
{
$vat = (float) $this->db->get( 'pp_shop_products', 'vat', [ 'id' => $productId ] );
$priceNetto = \S::normalize_decimal( (float) $price / ( 100 + $vat ) * 100, 2 );
$priceNetto = \Shared\Helpers\Helpers::normalize_decimal( (float) $price / ( 100 + $vat ) * 100, 2 );
$this->db->update( 'pp_shop_products', [
'price_brutto_promo' => $price != 0.00 ? $price : null,
@@ -1195,7 +1195,7 @@ class ProductRepository
{
$products = [];
$results = $this->db->select( 'pp_shop_products', 'id', [ 'parent_id' => $productId ] );
if ( \S::is_array_fix( $results ) ) {
if ( \Shared\Helpers\Helpers::is_array_fix( $results ) ) {
foreach ( $results as $row ) {
$detail = $this->findForAdmin( (int) $row );
if ( $detail ) {
@@ -1219,7 +1219,7 @@ class ProductRepository
$attributeRepository = new \Domain\Attribute\AttributeRepository( $this->db );
$permutations = \shop\Product::array_cartesian( $attributes );
if ( !\S::is_array_fix( $permutations ) ) {
if ( !\Shared\Helpers\Helpers::is_array_fix( $permutations ) ) {
return true;
}
@@ -1229,7 +1229,7 @@ class ProductRepository
$permutationHash = '';
if ( \S::is_array_fix( $permutation ) ) {
if ( \Shared\Helpers\Helpers::is_array_fix( $permutation ) ) {
foreach ( $permutation as $key => $val ) {
if ( $permutationHash ) {
$permutationHash .= '|';
@@ -1374,7 +1374,7 @@ class ProductRepository
public function updateImageAlt(int $imageId, string $alt): bool
{
$result = $this->db->update( 'pp_shop_products_images', [ 'alt' => $alt ], [ 'id' => $imageId ] );
\S::delete_cache();
\Shared\Helpers\Helpers::delete_cache();
return (bool) $result;
}
@@ -1542,7 +1542,7 @@ class ProductRepository
'AND' => [ 'status' => '1', 'archive' => 0, 'parent_id' => null ],
] );
if ( \S::is_array_fix( $rows ) ) {
if ( \Shared\Helpers\Helpers::is_array_fix( $rows ) ) {
foreach ( $rows as $productId ) {
$product = \shop\Product::getFromCache( $productId, $lang_id );
@@ -1587,9 +1587,9 @@ class ProductRepository
$itemNode->appendChild( $doc->createElement( 'g:description', html_entity_decode( strip_tags( $desc ) ) ) );
if ( $product->language['seo_link'] ) {
$link = $domainPrefix . '://' . $url . '/' . \S::seo( $product->language['seo_link'] ) . '/' . str_replace( '|', '/', $combination->permutation_hash );
$link = $domainPrefix . '://' . $url . '/' . \Shared\Helpers\Helpers::seo( $product->language['seo_link'] ) . '/' . str_replace( '|', '/', $combination->permutation_hash );
} else {
$link = $domainPrefix . '://' . $url . '/p-' . $product->id . '-' . \S::seo( $product->language['name'] ) . '/' . str_replace( '|', '/', $combination->permutation_hash );
$link = $domainPrefix . '://' . $url . '/p-' . $product->id . '-' . \Shared\Helpers\Helpers::seo( $product->language['name'] ) . '/' . str_replace( '|', '/', $combination->permutation_hash );
}
$itemNode->appendChild( $doc->createElement( 'link', $link ) );
@@ -1652,9 +1652,9 @@ class ProductRepository
$itemNode->appendChild( $doc->createElement( 'g:description', html_entity_decode( strip_tags( $desc ) ) ) );
if ( $product->language['seo_link'] ) {
$link = $domainPrefix . '://' . $url . '/' . \S::seo( $product->language['seo_link'] );
$link = $domainPrefix . '://' . $url . '/' . \Shared\Helpers\Helpers::seo( $product->language['seo_link'] );
} else {
$link = $domainPrefix . '://' . $url . '/p-' . $product->id . '-' . \S::seo( $product->language['name'] );
$link = $domainPrefix . '://' . $url . '/p-' . $product->id . '-' . \Shared\Helpers\Helpers::seo( $product->language['name'] );
}
$itemNode->appendChild( $doc->createElement( 'link', $link ) );
@@ -1771,9 +1771,9 @@ class ProductRepository
}
}
$combNetto = \S::normalize_decimal( $combBrutto / ( 100 + $vat ) * 100, 2 );
$combNetto = \Shared\Helpers\Helpers::normalize_decimal( $combBrutto / ( 100 + $vat ) * 100, 2 );
$combNettoPromo = $combBruttoPromo !== null
? \S::normalize_decimal( $combBruttoPromo / ( 100 + $vat ) * 100, 2 )
? \Shared\Helpers\Helpers::normalize_decimal( $combBruttoPromo / ( 100 + $vat ) * 100, 2 )
: null;
$this->db->update( 'pp_shop_products', [
@@ -1796,9 +1796,9 @@ class ProductRepository
*/
private function updateCombinationPrices(int $productId, float $priceNetto, float $vat, ?float $priceNettoPromo): void
{
$priceBrutto = \S::normalize_decimal( $priceNetto * ( 100 + $vat ) / 100, 2 );
$priceBrutto = \Shared\Helpers\Helpers::normalize_decimal( $priceNetto * ( 100 + $vat ) / 100, 2 );
$priceBruttoPromo = $priceNettoPromo !== null
? \S::normalize_decimal( $priceNettoPromo * ( 100 + $vat ) / 100, 2 )
? \Shared\Helpers\Helpers::normalize_decimal( $priceNettoPromo * ( 100 + $vat ) / 100, 2 )
: null;
$combinations = $this->db->query(
@@ -1835,9 +1835,9 @@ class ProductRepository
}
}
$combNetto = \S::normalize_decimal( $combBrutto / ( 100 + $vat ) * 100, 2 );
$combNetto = \Shared\Helpers\Helpers::normalize_decimal( $combBrutto / ( 100 + $vat ) * 100, 2 );
$combNettoPromo = $combBruttoPromo !== null
? \S::normalize_decimal( $combBruttoPromo / ( 100 + $vat ) * 100, 2 )
? \Shared\Helpers\Helpers::normalize_decimal( $combBruttoPromo / ( 100 + $vat ) * 100, 2 )
: null;
$this->db->update( 'pp_shop_products', [