2025-12-21 04:56:50 +01:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Admin settings and configuration
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (!defined('ABSPATH')) {
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class WC_TPP_Admin {
|
|
|
|
|
|
|
|
|
|
public function __construct() {
|
2025-12-21 05:14:19 +01:00
|
|
|
add_filter('woocommerce_get_settings_pages', array($this, 'add_settings_page'));
|
2025-12-21 04:56:50 +01:00
|
|
|
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-21 05:14:19 +01:00
|
|
|
/**
|
|
|
|
|
* Add settings page to WooCommerce settings
|
|
|
|
|
*/
|
|
|
|
|
public function add_settings_page($settings) {
|
|
|
|
|
$settings[] = include WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-settings.php';
|
|
|
|
|
return $settings;
|
2025-12-21 04:56:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function enqueue_admin_scripts($hook) {
|
2025-12-21 05:14:19 +01:00
|
|
|
if ('woocommerce_page_wc-settings' === $hook || 'post.php' === $hook || 'post-new.php' === $hook) {
|
2025-12-21 04:56:50 +01:00
|
|
|
wp_enqueue_style('wc-tpp-admin', WC_TPP_PLUGIN_URL . 'assets/css/admin.css', array(), WC_TPP_VERSION);
|
|
|
|
|
wp_enqueue_script('wc-tpp-admin', WC_TPP_PLUGIN_URL . 'assets/js/admin.js', array('jquery'), WC_TPP_VERSION, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
new WC_TPP_Admin();
|