Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate admin classes to Includes/Admin/ #424

Merged
merged 9 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .wordpress-org/banner-1544x500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/banner-772x250.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/icon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/icon-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/Admin/Orders.php → includes/Admin/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace WooCommerceSerialNumbers\Admin;

defined( 'ABSPATH' ) || exit;
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.

/**
* Class Orders.
Expand Down
62 changes: 58 additions & 4 deletions src/Admin/Metaboxes.php → includes/Admin/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,82 @@

namespace WooCommerceSerialNumbers\Admin;

defined( 'ABSPATH' ) || exit;
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.

/**
* Class Metaboxes.
* Class Products.
*
* @since 1.0.0
* @package WooCommerceSerialNumbers\Admin
*/
class Metaboxes {
class Products {

/**
* Metaboxes constructor.
* Products constructor.
*
* @since 1.0.0
*/
public function __construct() {
add_action( 'admin_head', array( __CLASS__, 'print_style' ) );
add_filter( 'woocommerce_product_data_tabs', array( __CLASS__, 'product_data_tab' ) );
add_action( 'woocommerce_product_data_panels', array( __CLASS__, 'product_write_panel' ) );
add_filter( 'woocommerce_process_product_meta', array( __CLASS__, 'product_save_data' ) );
add_action( 'woocommerce_product_after_variable_attributes', array( __CLASS__, 'variable_product_content' ), 10, 3 );
}

/**
* Print style
*
* @since 1.0.0
*/
public static function print_style() {
?>
<style>
#woocommerce-product-data ul.wc-tabs li.wc_serial_numbers_options a:before {
font-family: 'dashicons';
content: "\f112";
}

._serial_key_source_field label {
margin: 0 !important;
width: 100% !important;
}

.wc-serial-numbers-upgrade-box {
background: #f1f1f1;
padding: 10px;
border-left: 2px solid #007cba;
}

.wc-serial-numbers-variation-settings .wc-serial-numbers-settings-title {
border-bottom: 1px solid #eee;
padding-left: 0 !important;
font-weight: 600;
font-size: 1em;
padding-bottom: 5px;
}

.wc-serial-numbers-variation-settings label, .wc-serial-numbers-variation-settings legend {
margin-bottom: 5px !important;
display: inline-block;
}

.wc-serial-numbers-variation-settings .wc-radios li {
padding-bottom: 0 !important;

}

.wc-serial-numbers-variation-settings .woocommerce-help-tip {
margin-top: -5px;
}

.wc-serial-numbers-variation-settings .short {
min-width: 200px;
}
</style>
<?php
}

/**
* Add product data tab.
*
Expand Down
2 changes: 1 addition & 1 deletion includes/Admin/Requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use WooCommerceSerialNumbers\Models\Key;

defined( 'ABSPATH' ) || exit;
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.

/**
* Class Requests.
Expand Down
Loading
Loading