| @@ -4,11 +4,11 @@ | ||
| 4 | 4 | * Suppress "error - 0 - No summary was found for this file" on phpdoc generation |
| 5 | 5 | * |
| 6 | 6 | * @package WPDataAccess\Settings |
| 7 | 7 | */ |
| 8 | +// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing -- verified on page | |
| 8 | 9 | namespace WPDataAccess\Settings; |
| 9 | 10 | |
| 10 | -use WPDataAccess\Utilities\WPDA_Import; | |
| 11 | 11 | /** |
| 12 | 12 | * Class WPDA_Settings |
| 13 | 13 | * |
| 14 | 14 | * All tabs have the following similar structure: |
| @@ -25,9 +25,9 @@ | ||
| 25 | 25 | * |
| 26 | 26 | * @author Peter Schulz |
| 27 | 27 | * @since 1.0.0 |
| 28 | 28 | */ |
| 29 | -class WPDA_Settings { | |
| 29 | +abstract class WPDA_Settings { | |
| 30 | 30 | /** |
| 31 | 31 | * Menu slug of the current page |
| 32 | 32 | * |
| 33 | 33 | * @var string |
| @@ -48,60 +48,46 @@ | ||
| 48 | 48 | */ |
| 49 | 49 | protected $current_tab; |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * Reference to wpda import object | |
| 53 | - * | |
| 54 | - * @var WPDA_Import | |
| 55 | - */ | |
| 56 | - protected $wpda_import; | |
| 57 | - | |
| 58 | - /** | |
| 59 | - * URL to help page on plugin website | |
| 60 | - * | |
| 61 | - * @var string | |
| 62 | - */ | |
| 63 | - protected $help_url; | |
| 64 | - | |
| 65 | - /** | |
| 66 | 52 | * WPDA_Settings constructor |
| 67 | 53 | * |
| 68 | 54 | * Member $this->tabs is filled in the constructor to support i18n. |
| 69 | 55 | * |
| 70 | - * If a request was send for recreation of the repository, this is done in the constructor. This action must | |
| 56 | + * If a request was sent for recreation of the repository, this is done in the constructor. This action must | |
| 71 | 57 | * be performed before checking the user menu model, which is part of the constructor as well, necessary to |
| 72 | 58 | * inform the user if any errors were reported. |
| 73 | 59 | * |
| 74 | 60 | * @param $current_tab Current tab label |
| 75 | - * @param $help_url URL help page plugin website | |
| 76 | 61 | * |
| 77 | 62 | * @since 1.0.0 |
| 78 | 63 | */ |
| 79 | - public function __construct( $current_tab, $help_url ) { | |
| 80 | - // Get menu slag of current page. | |
| 64 | + public function __construct( $current_tab ) { | |
| 65 | + // Get menu slug of current page. | |
| 81 | 66 | if ( isset( $_REQUEST['page'] ) ) { |
| 82 | 67 | $this->page = sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ); |
| 83 | - // input var okay. | |
| 84 | 68 | } else { |
| 85 | 69 | // In order to show a list table we need a page. |
| 86 | - wp_die( __( 'ERROR: Wrong arguments [missing page argument]', 'wp-data-access' ) ); | |
| 70 | + wp_die( esc_attr__( 'ERROR: Wrong arguments [missing page argument]', 'wp-data-access' ) ); | |
| 87 | 71 | } |
| 88 | 72 | $this->current_tab = $current_tab; |
| 89 | - $this->help_url = $help_url; | |
| 90 | 73 | // Tabs array is filled in constructor to add i18n. |
| 91 | 74 | $this->tabs = array( |
| 92 | 75 | 'plugin' => 'Plugin', |
| 76 | + 'apps' => 'Apps', | |
| 93 | 77 | 'backend' => 'Back-end', |
| 94 | 78 | 'frontend' => 'Front-end', |
| 95 | - 'datatables' => 'Data Tables', | |
| 96 | - 'databackup' => 'Data Backup', | |
| 97 | 79 | 'uninstall' => 'Uninstall', |
| 98 | 80 | 'repository' => 'Repository', |
| 99 | - 'roles' => 'Roles', | |
| 81 | + 'mail' => 'Mail', | |
| 82 | + 'drives' => 'Drives', | |
| 83 | + 'legacy' => 'Legacy Tools', | |
| 100 | 84 | 'system' => 'System Info', |
| 101 | 85 | ); |
| 102 | 86 | } |
| 103 | 87 | |
| 88 | + protected abstract function add_content(); | |
| 89 | + | |
| 104 | 90 | /** |
| 105 | 91 | * Show setting page |
| 106 | 92 | * |
| 107 | 93 | * Consists of tabs {@see WPDA_Settings::add_tabs()} and the content of the selected tab |
| @@ -116,9 +102,9 @@ | ||
| 116 | 102 | ?> |
| 117 | 103 | <div class="wrap"> |
| 118 | 104 | <h1> |
| 119 | 105 | <?php |
| 120 | - echo __( 'WP Data Access Settings', 'wp-data-access' ); | |
| 106 | + esc_html_e( 'WP Data Access Settings', 'wp-data-access' ); | |
| 121 | 107 | ?> |
| 122 | 108 | </h1> |
| 123 | 109 | <?php |
| 124 | 110 | $this->add_tabs(); |
| @@ -151,4 +137,6 @@ | ||
| 151 | 137 | <?php |
| 152 | 138 | } |
| 153 | 139 | |
| 154 | 140 | } |
| 141 | + | |
| 142 | +// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |