← All changes
|
src/Controllers/Hooks/Settings/class-settings-controller.php
+23
-23
3.0.7
→
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(), | |
| 55 | - \__( 'seQura', 'sequra' ), | |
| 56 | - \__( 'seQura', 'sequra' ), | |
| 54 | + $this->settings_service->get_parent_page(), | |
| 55 | + __( 'seQura', 'sequra' ), | |
| 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. |
| @@ -97,9 +97,9 @@ | ||
| 97 | 97 | public function add_action_link( $actions, $plugin_file, $plugin_data, $context ) { |
| 98 | 98 | $this->logger->log_debug( 'Hook executed', __FUNCTION__, __CLASS__ ); |
| 99 | 99 | $args = array( |
| 100 | 100 | 'href' => $this->get_settings_page_url(), |
| 101 | - 'text' => \esc_attr__( 'Settings', 'sequra' ), | |
| 101 | + 'text' => esc_attr__( 'Settings', 'sequra' ), | |
| 102 | 102 | ); |
| 103 | 103 | ob_start(); |
| 104 | 104 | \wc_get_template( 'admin/action_link.php', $args, '', $this->templates_path ); |
| 105 | 105 | $actions['settings'] = ob_get_clean(); |
| @@ -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 | } |
| @@ -139,10 +139,10 @@ | ||
| 139 | 139 | * @since 2.0.0 |
| 140 | 140 | */ |
| 141 | 141 | \apply_filters( 'sequrapayment_docs_url', 'https://sequra.atlassian.net/wiki/spaces/DOC/pages/2247524378/WOOCOMMERCE' ) |
| 142 | 142 | ), |
| 143 | - \esc_attr__( 'View WooCommerce documentation', 'sequra' ), | |
| 144 | - \esc_html__( 'Docs', 'woocommerce' ) | |
| 143 | + esc_attr__( 'View WooCommerce documentation', 'sequra' ), | |
| 144 | + esc_html__( 'Docs', 'woocommerce' ) | |
| 145 | 145 | ), |
| 146 | 146 | 'apidocs' => sprintf( |
| 147 | 147 | '<a href="%s" aria-label="%s" target="_blank">%s</a>', |
| 148 | 148 | \esc_url( |
| @@ -152,10 +152,10 @@ | ||
| 152 | 152 | * @since 2.0.0 |
| 153 | 153 | */ |
| 154 | 154 | \apply_filters( 'sequrapayment_apidocs_url', 'https://docs.sequrapi.com/' ) |
| 155 | 155 | ), |
| 156 | - \esc_attr__( 'View WooCommerce API docs', 'sequra' ), | |
| 157 | - \esc_html__( 'API docs', 'sequra' ) | |
| 156 | + esc_attr__( 'View WooCommerce API docs', 'sequra' ), | |
| 157 | + esc_html__( 'API docs', 'sequra' ) | |
| 158 | 158 | ), |
| 159 | 159 | 'support' => sprintf( |
| 160 | 160 | '<a href="%s" aria-label="%s" target="_blank">%s</a>', |
| 161 | 161 | \esc_url( |
| @@ -165,10 +165,10 @@ | ||
| 165 | 165 | * @since 2.0.0 |
| 166 | 166 | */ |
| 167 | 167 | \apply_filters( 'sequrapayment_support_url', 'https://sequra.atlassian.net/servicedesk/customer/portal/5/group/-1' ) |
| 168 | 168 | ), |
| 169 | - \esc_attr__( 'Support', 'sequra' ), | |
| 170 | - \esc_html__( 'Support', 'sequra' ) | |
| 169 | + esc_attr__( 'Support', 'sequra' ), | |
| 170 | + esc_html__( 'Support', 'sequra' ) | |
| 171 | 171 | ), |
| 172 | 172 | ); |
| 173 | 173 | |
| 174 | 174 | return array_merge( $links, $row_meta ); |