| @@ -4,8 +4,9 @@ | ||
| 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 | 11 | /** |
| 11 | 12 | * Class WPDA_Settings |
| @@ -24,9 +25,9 @@ | ||
| 24 | 25 | * |
| 25 | 26 | * @author Peter Schulz |
| 26 | 27 | * @since 1.0.0 |
| 27 | 28 | */ |
| 28 | -class WPDA_Settings { | |
| 29 | +abstract class WPDA_Settings { | |
| 29 | 30 | /** |
| 30 | 31 | * Menu slug of the current page |
| 31 | 32 | * |
| 32 | 33 | * @var string |
| @@ -51,9 +52,9 @@ | ||
| 51 | 52 | * WPDA_Settings constructor |
| 52 | 53 | * |
| 53 | 54 | * Member $this->tabs is filled in the constructor to support i18n. |
| 54 | 55 | * |
| 55 | - * 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 | |
| 56 | 57 | * be performed before checking the user menu model, which is part of the constructor as well, necessary to |
| 57 | 58 | * inform the user if any errors were reported. |
| 58 | 59 | * |
| 59 | 60 | * @param $current_tab Current tab label |
| @@ -63,29 +64,30 @@ | ||
| 63 | 64 | public function __construct( $current_tab ) { |
| 64 | 65 | // Get menu slug of current page. |
| 65 | 66 | if ( isset( $_REQUEST['page'] ) ) { |
| 66 | 67 | $this->page = sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ); |
| 67 | - // input var okay. | |
| 68 | 68 | } else { |
| 69 | 69 | // In order to show a list table we need a page. |
| 70 | - 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' ) ); | |
| 71 | 71 | } |
| 72 | 72 | $this->current_tab = $current_tab; |
| 73 | 73 | // Tabs array is filled in constructor to add i18n. |
| 74 | 74 | $this->tabs = array( |
| 75 | 75 | 'plugin' => 'Plugin', |
| 76 | + 'apps' => 'Apps', | |
| 76 | 77 | 'backend' => 'Back-end', |
| 77 | 78 | 'frontend' => 'Front-end', |
| 78 | - 'datatables' => 'Data Tables', | |
| 79 | - 'databackup' => 'Data Backup', | |
| 80 | 79 | 'uninstall' => 'Uninstall', |
| 81 | 80 | 'repository' => 'Repository', |
| 82 | - 'roles' => 'Roles', | |
| 83 | 81 | 'mail' => 'Mail', |
| 82 | + 'drives' => 'Drives', | |
| 83 | + 'legacy' => 'Legacy Tools', | |
| 84 | 84 | 'system' => 'System Info', |
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | + protected abstract function add_content(); | |
| 89 | + | |
| 88 | 90 | /** |
| 89 | 91 | * Show setting page |
| 90 | 92 | * |
| 91 | 93 | * Consists of tabs {@see WPDA_Settings::add_tabs()} and the content of the selected tab |
| @@ -100,9 +102,9 @@ | ||
| 100 | 102 | ?> |
| 101 | 103 | <div class="wrap"> |
| 102 | 104 | <h1> |
| 103 | 105 | <?php |
| 104 | - echo __( 'WP Data Access Settings', 'wp-data-access' ); | |
| 106 | + esc_html_e( 'WP Data Access Settings', 'wp-data-access' ); | |
| 105 | 107 | ?> |
| 106 | 108 | </h1> |
| 107 | 109 | <?php |
| 108 | 110 | $this->add_tabs(); |
| @@ -135,4 +137,6 @@ | ||
| 135 | 137 | <?php |
| 136 | 138 | } |
| 137 | 139 | |
| 138 | 140 | } |
| 141 | + | |
| 142 | +// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |