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:
@@ -216,7 +216,7 @@ class ShopProductController
|
||||
|
||||
$db = $GLOBALS['mdb'];
|
||||
|
||||
$product = $this->repository->findForAdmin( (int) \S::get( 'id' ) );
|
||||
$product = $this->repository->findForAdmin( (int) \Shared\Helpers\Helpers::get( 'id' ) );
|
||||
$languages = ( new \Domain\Languages\LanguagesRepository( $db ) )->languagesList();
|
||||
$categories = ( new CategoryRepository( $db ) )->subcategories( null );
|
||||
$layouts = $this->layoutsForProductEdit( $db );
|
||||
@@ -568,7 +568,7 @@ class ShopProductController
|
||||
$productId = (int) ( $product['id'] ?? 0 );
|
||||
$sku = $this->escapeHtml( (string) ( $product['sku'] ?? '' ) );
|
||||
|
||||
return \Html::input_icon( [
|
||||
return \Shared\Html\Html::input_icon( [
|
||||
'label' => 'Kod SKU',
|
||||
'name' => 'sku',
|
||||
'id' => 'sku',
|
||||
@@ -731,7 +731,7 @@ class ShopProductController
|
||||
|
||||
private function resolveSavePayload(): array
|
||||
{
|
||||
$legacyRaw = \S::get( 'values' );
|
||||
$legacyRaw = \Shared\Helpers\Helpers::get( 'values' );
|
||||
if ( $legacyRaw !== null && $legacyRaw !== '' ) {
|
||||
$legacy = json_decode( (string) $legacyRaw, true );
|
||||
if ( is_array( $legacy ) ) {
|
||||
@@ -771,10 +771,10 @@ class ShopProductController
|
||||
*/
|
||||
public function duplicate_product(): void
|
||||
{
|
||||
if ( $this->repository->duplicate( (int) \S::get( 'product-id' ), (bool) (int) \S::get( 'combination' ) ) ) {
|
||||
\S::set_message( 'Produkt został zduplikowany.' );
|
||||
if ( $this->repository->duplicate( (int) \Shared\Helpers\Helpers::get( 'product-id' ), (bool) (int) \Shared\Helpers\Helpers::get( 'combination' ) ) ) {
|
||||
\Shared\Helpers\Helpers::set_message( 'Produkt został zduplikowany.' );
|
||||
} else {
|
||||
\S::alert( 'Podczas duplikowania produktu wystąpił błąd. Proszę spróbować ponownie' );
|
||||
\Shared\Helpers\Helpers::alert( 'Podczas duplikowania produktu wystąpił błąd. Proszę spróbować ponownie' );
|
||||
}
|
||||
|
||||
header( 'Location: /admin/shop_product/view_list/' );
|
||||
@@ -786,10 +786,10 @@ class ShopProductController
|
||||
*/
|
||||
public function product_archive(): void
|
||||
{
|
||||
if ( $this->repository->archive( (int) \S::get( 'product_id' ) ) ) {
|
||||
\S::alert( 'Produkt został przeniesiony do archiwum.' );
|
||||
if ( $this->repository->archive( (int) \Shared\Helpers\Helpers::get( 'product_id' ) ) ) {
|
||||
\Shared\Helpers\Helpers::alert( 'Produkt został przeniesiony do archiwum.' );
|
||||
} else {
|
||||
\S::alert( 'Podczas przenoszenia produktu do archiwum wystąpił błąd. Proszę spróbować ponownie' );
|
||||
\Shared\Helpers\Helpers::alert( 'Podczas przenoszenia produktu do archiwum wystąpił błąd. Proszę spróbować ponownie' );
|
||||
}
|
||||
|
||||
header( 'Location: /admin/shop_product/view_list/' );
|
||||
@@ -801,10 +801,10 @@ class ShopProductController
|
||||
*/
|
||||
public function product_unarchive(): void
|
||||
{
|
||||
if ( $this->repository->unarchive( (int) \S::get( 'product_id' ) ) ) {
|
||||
\S::alert( 'Produkt został przywrócony z archiwum.' );
|
||||
if ( $this->repository->unarchive( (int) \Shared\Helpers\Helpers::get( 'product_id' ) ) ) {
|
||||
\Shared\Helpers\Helpers::alert( 'Produkt został przywrócony z archiwum.' );
|
||||
} else {
|
||||
\S::alert( 'Podczas przywracania produktu z archiwum wystąpił błąd. Proszę spróbować ponownie' );
|
||||
\Shared\Helpers\Helpers::alert( 'Podczas przywracania produktu z archiwum wystąpił błąd. Proszę spróbować ponownie' );
|
||||
}
|
||||
|
||||
header( 'Location: /admin/product_archive/list/' );
|
||||
@@ -816,10 +816,10 @@ class ShopProductController
|
||||
*/
|
||||
public function product_delete(): void
|
||||
{
|
||||
if ( $this->repository->delete( (int) \S::get( 'id' ) ) ) {
|
||||
\S::set_message( 'Produkt został usunięty.' );
|
||||
if ( $this->repository->delete( (int) \Shared\Helpers\Helpers::get( 'id' ) ) ) {
|
||||
\Shared\Helpers\Helpers::set_message( 'Produkt został usunięty.' );
|
||||
} else {
|
||||
\S::alert( 'Podczas usuwania produktu wystąpił błąd. Proszę spróbować ponownie' );
|
||||
\Shared\Helpers\Helpers::alert( 'Podczas usuwania produktu wystąpił błąd. Proszę spróbować ponownie' );
|
||||
}
|
||||
|
||||
header( 'Location: /admin/shop_product/view_list/' );
|
||||
@@ -831,8 +831,8 @@ class ShopProductController
|
||||
*/
|
||||
public function change_product_status(): void
|
||||
{
|
||||
if ( $this->repository->toggleStatus( (int) \S::get( 'product-id' ) ) ) {
|
||||
\S::set_message( 'Status produktu został zmieniony' );
|
||||
if ( $this->repository->toggleStatus( (int) \Shared\Helpers\Helpers::get( 'product-id' ) ) ) {
|
||||
\Shared\Helpers\Helpers::set_message( 'Status produktu został zmieniony' );
|
||||
}
|
||||
|
||||
header( 'Location: ' . $_SERVER['HTTP_REFERER'] );
|
||||
@@ -846,7 +846,7 @@ class ShopProductController
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zmiany ceny wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
if ( $this->repository->updatePriceBrutto( (int) \S::get( 'product_id' ), \S::get( 'price' ) ) ) {
|
||||
if ( $this->repository->updatePriceBrutto( (int) \Shared\Helpers\Helpers::get( 'product_id' ), \Shared\Helpers\Helpers::get( 'price' ) ) ) {
|
||||
$response = [ 'status' => 'ok' ];
|
||||
}
|
||||
|
||||
@@ -861,7 +861,7 @@ class ShopProductController
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zmiany ceny wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
if ( $this->repository->updatePriceBruttoPromo( (int) \S::get( 'product_id' ), \S::get( 'price' ) ) ) {
|
||||
if ( $this->repository->updatePriceBruttoPromo( (int) \Shared\Helpers\Helpers::get( 'product_id' ), \Shared\Helpers\Helpers::get( 'price' ) ) ) {
|
||||
$response = [ 'status' => 'ok' ];
|
||||
}
|
||||
|
||||
@@ -876,7 +876,7 @@ class ShopProductController
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zmiany google xml label wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
if ( $this->repository->updateCustomLabel( (int) \S::get( 'product_id' ), \S::get( 'custom_label' ), \S::get( 'value' ) ) ) {
|
||||
if ( $this->repository->updateCustomLabel( (int) \Shared\Helpers\Helpers::get( 'product_id' ), \Shared\Helpers\Helpers::get( 'custom_label' ), \Shared\Helpers\Helpers::get( 'value' ) ) ) {
|
||||
$response = [ 'status' => 'ok' ];
|
||||
}
|
||||
|
||||
@@ -891,7 +891,7 @@ class ShopProductController
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas pobierania sugestii dla custom label wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
$suggestions = $this->repository->customLabelSuggestions( \S::get( 'custom_label' ), \S::get( 'label_type' ) );
|
||||
$suggestions = $this->repository->customLabelSuggestions( \Shared\Helpers\Helpers::get( 'custom_label' ), \Shared\Helpers\Helpers::get( 'label_type' ) );
|
||||
if ( $suggestions ) {
|
||||
$response = [ 'status' => 'ok', 'suggestions' => $suggestions ];
|
||||
}
|
||||
@@ -907,7 +907,7 @@ class ShopProductController
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania custom label wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
if ( $this->repository->saveCustomLabel( (int) \S::get( 'product_id' ), \S::get( 'custom_label' ), \S::get( 'label_type' ) ) ) {
|
||||
if ( $this->repository->saveCustomLabel( (int) \Shared\Helpers\Helpers::get( 'product_id' ), \Shared\Helpers\Helpers::get( 'custom_label' ), \Shared\Helpers\Helpers::get( 'label_type' ) ) ) {
|
||||
$response = [ 'status' => 'ok' ];
|
||||
}
|
||||
|
||||
@@ -920,7 +920,7 @@ class ShopProductController
|
||||
*/
|
||||
public function ajax_product_url(): void
|
||||
{
|
||||
echo json_encode( [ 'url' => \shop\Product::getProductUrl( (int) \S::get( 'product_id' ) ) ] );
|
||||
echo json_encode( [ 'url' => \shop\Product::getProductUrl( (int) \Shared\Helpers\Helpers::get( 'product_id' ) ) ] );
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -931,7 +931,7 @@ class ShopProductController
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas generowania kodu sku wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
$sku = \shop\Product::generate_sku_code( (int) \S::get( 'product_id' ) );
|
||||
$sku = \shop\Product::generate_sku_code( (int) \Shared\Helpers\Helpers::get( 'product_id' ) );
|
||||
if ( $sku ) {
|
||||
$response = [ 'status' => 'ok', 'sku' => $sku ];
|
||||
}
|
||||
@@ -950,10 +950,10 @@ class ShopProductController
|
||||
$db = $GLOBALS['mdb'];
|
||||
|
||||
return \Tpl::view( 'shop-product/product-combination', [
|
||||
'product' => $this->repository->findForAdmin( (int) \S::get( 'product_id' ) ),
|
||||
'product' => $this->repository->findForAdmin( (int) \Shared\Helpers\Helpers::get( 'product_id' ) ),
|
||||
'attributes' => ( new \Domain\Attribute\AttributeRepository( $db ) )->getAttributesListForCombinations(),
|
||||
'default_language' => $this->languagesRepository->defaultLanguage(),
|
||||
'product_permutations' => $this->repository->getCombinationsForTable( (int) \S::get( 'product_id' ) ),
|
||||
'product_permutations' => $this->repository->getCombinationsForTable( (int) \Shared\Helpers\Helpers::get( 'product_id' ) ),
|
||||
] );
|
||||
}
|
||||
|
||||
@@ -970,11 +970,11 @@ class ShopProductController
|
||||
}
|
||||
}
|
||||
|
||||
if ( $this->repository->generateCombinations( (int) \S::get( 'product_id' ), $attributes ) ) {
|
||||
\S::alert( 'Kombinacje produktu zostały wygenerowane.' );
|
||||
if ( $this->repository->generateCombinations( (int) \Shared\Helpers\Helpers::get( 'product_id' ), $attributes ) ) {
|
||||
\Shared\Helpers\Helpers::alert( 'Kombinacje produktu zostały wygenerowane.' );
|
||||
}
|
||||
|
||||
header( 'Location: /admin/shop_product/product_combination/product_id=' . (int) \S::get( 'product_id' ) );
|
||||
header( 'Location: /admin/shop_product/product_combination/product_id=' . (int) \Shared\Helpers\Helpers::get( 'product_id' ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -983,13 +983,13 @@ class ShopProductController
|
||||
*/
|
||||
public function delete_combination(): void
|
||||
{
|
||||
if ( $this->repository->deleteCombination( (int) \S::get( 'combination_id' ) ) ) {
|
||||
\S::alert( 'Kombinacja produktu została usunięta' );
|
||||
if ( $this->repository->deleteCombination( (int) \Shared\Helpers\Helpers::get( 'combination_id' ) ) ) {
|
||||
\Shared\Helpers\Helpers::alert( 'Kombinacja produktu została usunięta' );
|
||||
} else {
|
||||
\S::alert( 'Podczas usuwania kombinacji produktu wystąpił błąd. Proszę spróbować ponownie' );
|
||||
\Shared\Helpers\Helpers::alert( 'Podczas usuwania kombinacji produktu wystąpił błąd. Proszę spróbować ponownie' );
|
||||
}
|
||||
|
||||
header( 'Location: /admin/shop_product/product_combination/product_id=' . \S::get( 'product_id' ) );
|
||||
header( 'Location: /admin/shop_product/product_combination/product_id=' . \Shared\Helpers\Helpers::get( 'product_id' ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -998,7 +998,7 @@ class ShopProductController
|
||||
*/
|
||||
public function product_combination_stock_0_buy_save(): void
|
||||
{
|
||||
$this->repository->saveCombinationStock0Buy( (int) \S::get( 'product_id' ), \S::get( 'stock_0_buy' ) );
|
||||
$this->repository->saveCombinationStock0Buy( (int) \Shared\Helpers\Helpers::get( 'product_id' ), \Shared\Helpers\Helpers::get( 'stock_0_buy' ) );
|
||||
echo json_encode( [ 'status' => 'ok' ] );
|
||||
exit;
|
||||
}
|
||||
@@ -1008,7 +1008,7 @@ class ShopProductController
|
||||
*/
|
||||
public function product_combination_sku_save(): void
|
||||
{
|
||||
$this->repository->saveCombinationSku( (int) \S::get( 'product_id' ), \S::get( 'sku' ) );
|
||||
$this->repository->saveCombinationSku( (int) \Shared\Helpers\Helpers::get( 'product_id' ), \Shared\Helpers\Helpers::get( 'sku' ) );
|
||||
echo json_encode( [ 'status' => 'ok' ] );
|
||||
exit;
|
||||
}
|
||||
@@ -1018,7 +1018,7 @@ class ShopProductController
|
||||
*/
|
||||
public function product_combination_quantity_save(): void
|
||||
{
|
||||
$this->repository->saveCombinationQuantity( (int) \S::get( 'product_id' ), \S::get( 'quantity' ) );
|
||||
$this->repository->saveCombinationQuantity( (int) \Shared\Helpers\Helpers::get( 'product_id' ), \Shared\Helpers\Helpers::get( 'quantity' ) );
|
||||
echo json_encode( [ 'status' => 'ok' ] );
|
||||
exit;
|
||||
}
|
||||
@@ -1028,7 +1028,7 @@ class ShopProductController
|
||||
*/
|
||||
public function product_combination_price_save(): void
|
||||
{
|
||||
$this->repository->saveCombinationPrice( (int) \S::get( 'product_id' ), \S::get( 'price' ) );
|
||||
$this->repository->saveCombinationPrice( (int) \Shared\Helpers\Helpers::get( 'product_id' ), \Shared\Helpers\Helpers::get( 'price' ) );
|
||||
echo json_encode( [ 'status' => 'ok' ] );
|
||||
exit;
|
||||
}
|
||||
@@ -1040,7 +1040,7 @@ class ShopProductController
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas usuwania kombinacji wystąpił błąd.' ];
|
||||
|
||||
if ( $this->repository->deleteCombination( (int) \S::get( 'combination_id' ) ) ) {
|
||||
if ( $this->repository->deleteCombination( (int) \Shared\Helpers\Helpers::get( 'combination_id' ) ) ) {
|
||||
$response = [ 'status' => 'ok' ];
|
||||
}
|
||||
|
||||
@@ -1057,7 +1057,7 @@ class ShopProductController
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas usuwania zdjecia wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
if ( $this->repository->deleteImage( (int) \S::get( 'image_id' ) ) ) {
|
||||
if ( $this->repository->deleteImage( (int) \Shared\Helpers\Helpers::get( 'image_id' ) ) ) {
|
||||
$response = [ 'status' => 'ok' ];
|
||||
}
|
||||
|
||||
@@ -1070,7 +1070,7 @@ class ShopProductController
|
||||
*/
|
||||
public function images_order_save(): void
|
||||
{
|
||||
if ( $this->repository->saveImagesOrder( (int) \S::get( 'product_id' ), \S::get( 'order' ) ) ) {
|
||||
if ( $this->repository->saveImagesOrder( (int) \Shared\Helpers\Helpers::get( 'product_id' ), \Shared\Helpers\Helpers::get( 'order' ) ) ) {
|
||||
echo json_encode( [ 'status' => 'ok', 'msg' => 'Produkt został zapisany.' ] );
|
||||
}
|
||||
|
||||
@@ -1084,7 +1084,7 @@ class ShopProductController
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zmiany atrybutu alt zdjęcia wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
if ( $this->repository->updateImageAlt( (int) \S::get( 'image_id' ), \S::get( 'image_alt' ) ) ) {
|
||||
if ( $this->repository->updateImageAlt( (int) \Shared\Helpers\Helpers::get( 'image_id' ), \Shared\Helpers\Helpers::get( 'image_alt' ) ) ) {
|
||||
$response = [ 'status' => 'ok' ];
|
||||
}
|
||||
|
||||
@@ -1099,7 +1099,7 @@ class ShopProductController
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas usuwania pliku wystąpił błąd.' ];
|
||||
|
||||
if ( $this->repository->deleteFile( (int) \S::get( 'file_id' ) ) ) {
|
||||
if ( $this->repository->deleteFile( (int) \Shared\Helpers\Helpers::get( 'file_id' ) ) ) {
|
||||
$response = [ 'status' => 'ok' ];
|
||||
}
|
||||
|
||||
@@ -1114,7 +1114,7 @@ class ShopProductController
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zmiany nazwy pliku wystąpił błąd.' ];
|
||||
|
||||
if ( $this->repository->updateFileName( (int) \S::get( 'file_id' ), \S::get( 'file_name' ) ) ) {
|
||||
if ( $this->repository->updateFileName( (int) \Shared\Helpers\Helpers::get( 'file_id' ), \Shared\Helpers\Helpers::get( 'file_name' ) ) ) {
|
||||
$response = [ 'status' => 'ok' ];
|
||||
}
|
||||
|
||||
@@ -1129,7 +1129,7 @@ class ShopProductController
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas usuwania zdjęcia wystąpił błąd.' ];
|
||||
|
||||
if ( $this->repository->deleteImage( (int) \S::get( 'image_id' ) ) ) {
|
||||
if ( $this->repository->deleteImage( (int) \Shared\Helpers\Helpers::get( 'image_id' ) ) ) {
|
||||
$response = [ 'status' => 'ok' ];
|
||||
}
|
||||
|
||||
@@ -1158,8 +1158,8 @@ class ShopProductController
|
||||
*/
|
||||
public function mass_edit_save(): void
|
||||
{
|
||||
$discountPercent = \S::get( 'discount_percent' );
|
||||
$products = \S::get( 'products' );
|
||||
$discountPercent = \Shared\Helpers\Helpers::get( 'discount_percent' );
|
||||
$products = \Shared\Helpers\Helpers::get( 'products' );
|
||||
|
||||
if ( $discountPercent != '' && $products && is_array( $products ) && count( $products ) > 0 ) {
|
||||
$productId = (int) $products[0];
|
||||
@@ -1184,7 +1184,7 @@ class ShopProductController
|
||||
*/
|
||||
public function get_products_by_category(): void
|
||||
{
|
||||
$categoryId = (int) \S::get( 'category_id' );
|
||||
$categoryId = (int) \Shared\Helpers\Helpers::get( 'category_id' );
|
||||
$products = $this->repository->getProductsByCategory( $categoryId );
|
||||
|
||||
echo json_encode( [ 'status' => 'ok', 'products' => $products ] );
|
||||
|
||||
Reference in New Issue
Block a user