← All changes
|
src/Controllers/Hooks/Settings/class-settings-controller.php
+14
-14
3.2.0
→
4.1.0
View file →
| @@ -8,10 +8,10 @@ | ||
| 8 | 8 | |
| 9 | 9 | namespace SeQura\WC\Controllers\Hooks\Settings; |
| 10 | 10 | |
| 11 | 11 | use SeQura\WC\Controllers\Controller; |
| 12 | -use SeQura\WC\Core\Extension\Infrastructure\Configuration\Configuration; | |
| 13 | -use SeQura\WC\Services\Interface_Logger_Service; | |
| 12 | +use SeQura\WC\Services\Log\Interface_Logger_Service; | |
| 13 | +use SeQura\WC\Services\Service\Interface_Settings_Service; | |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Implementation for the settings controller. |
| 17 | 17 | */ |
| @@ -17,13 +17,13 @@ | ||
| 17 | 17 | */ |
| 18 | 18 | class Settings_Controller extends Controller implements Interface_Settings_Controller { |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | - * Configuration service. | |
| 21 | + * Settings service. | |
| 22 | 22 | * |
| 23 | - * @var Configuration | |
| 23 | + * @var Interface_Settings_Service | |
| 24 | 24 | */ |
| 25 | - private $configuration; | |
| 25 | + private $settings_service; | |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * Plugin basename. |
| 29 | 29 | */ |
| @@ -33,15 +33,15 @@ | ||
| 33 | 33 | * Constructor. |
| 34 | 34 | */ |
| 35 | 35 | public function __construct( |
| 36 | 36 | string $templates_path, |
| 37 | - Configuration $configuration, | |
| 37 | + Interface_Settings_Service $settings_service, | |
| 38 | 38 | Interface_Logger_Service $logger, |
| 39 | 39 | string $plugin_basename |
| 40 | 40 | ) { |
| 41 | 41 | parent::__construct( $logger, $templates_path ); |
| 42 | - $this->configuration = $configuration; | |
| 43 | - $this->plugin_basename = $plugin_basename; | |
| 42 | + $this->settings_service = $settings_service; | |
| 43 | + $this->plugin_basename = $plugin_basename; | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Register the settings page. |
| @@ -50,18 +50,18 @@ | ||
| 50 | 50 | */ |
| 51 | 51 | public function register_page() { |
| 52 | 52 | $this->logger->log_debug( 'Hook executed', __FUNCTION__, __CLASS__ ); |
| 53 | 53 | \add_submenu_page( |
| 54 | - $this->configuration->get_parent_page(), | |
| 54 | + $this->settings_service->get_parent_page(), | |
| 55 | 55 | __( 'seQura', 'sequra' ), |
| 56 | 56 | __( 'seQura', 'sequra' ), |
| 57 | 57 | 'manage_options', |
| 58 | - $this->configuration->get_page(), | |
| 58 | + $this->settings_service->get_page(), | |
| 59 | 59 | array( $this, 'render_page' ) |
| 60 | 60 | ); |
| 61 | 61 | |
| 62 | 62 | // Additionally remove WP version footer text if we are in the settings page. |
| 63 | - if ( $this->configuration->is_settings_page() ) { | |
| 63 | + if ( $this->settings_service->is_settings_page() ) { | |
| 64 | 64 | \remove_filter( 'update_footer', 'core_update_footer' ); |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| @@ -70,9 +70,9 @@ | ||
| 70 | 70 | * |
| 71 | 71 | * @return void |
| 72 | 72 | */ |
| 73 | 73 | public function render_page() { |
| 74 | - $this->logger->log_info( 'Callback executed', __FUNCTION__, __CLASS__ ); | |
| 74 | + $this->logger->log_debug( 'Callback executed', __FUNCTION__, __CLASS__ ); | |
| 75 | 75 | \wc_get_template( 'admin/settings_page.php', array(), '', $this->templates_path ); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
| @@ -81,9 +81,9 @@ | ||
| 81 | 81 | * @param string|null $url The URL. |
| 82 | 82 | * @return string |
| 83 | 83 | */ |
| 84 | 84 | public function get_settings_page_url( $url = null ) { |
| 85 | - return \admin_url( 'admin.php?page=' . $this->configuration->get_page() ); | |
| 85 | + return \admin_url( 'admin.php?page=' . $this->settings_service->get_page() ); | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | 89 | * Add action links to the plugin settings page. |
| @@ -113,9 +113,9 @@ | ||
| 113 | 113 | * @return string |
| 114 | 114 | */ |
| 115 | 115 | public function remove_footer_admin( $text ) { |
| 116 | 116 | $this->logger->log_debug( 'Hook executed', __FUNCTION__, __CLASS__ ); |
| 117 | - if ( ! $this->configuration->is_settings_page() ) { | |
| 117 | + if ( ! $this->settings_service->is_settings_page() ) { | |
| 118 | 118 | return $text; |
| 119 | 119 | } |
| 120 | 120 | return ''; |
| 121 | 121 | } |