| @@ -38,17 +38,8 @@ | ||
| 38 | 38 | /** |
| 39 | 39 | * Handle plugin cookies |
| 40 | 40 | * |
| 41 | 41 | * Cookies are use to remember values during navigation: (max 1 hour) |
| 42 | - * 1) SCHEMA NAME | |
| 43 | - * The schema name is saved as a cookie when changed in the Data Explorer. As long as the user stays within the | |
| 44 | - * page the saved schema is used. When the user moves to another page the value is destroyed. The user gets the | |
| 45 | - * default value on the next visit. | |
| 46 | - * 2) FAVOURITE SELECTION | |
| 47 | - * The favourite selection is saved as cookie when changed in the Data Explorer. As long as the user stays within | |
| 48 | - * the page the saved selection is used. When the user moves to another page the value is destroyed. The user gets | |
| 49 | - * the default value on the next visit. | |
| 50 | - * 3) SEARCH ARGUMENT | |
| 51 | 42 | * Search arguments are saved as cookies per table. As long as the user stays within the same page the saved |
| 52 | 43 | * search value is used. When the user moves to another page the value is destroyed. This allows users to navigate |
| 53 | 44 | * between pages without losing the search value. |
| 54 | 45 | * |
| @@ -55,55 +46,8 @@ | ||
| 55 | 46 | * @since 1.6.0 |
| 56 | 47 | */ |
| 57 | 48 | public function handle_plugin_cookies() { |
| 58 | 49 | $panel_cookies = WPDA::get_option( WPDA::OPTION_PLUGIN_PANEL_COOKIES ); |
| 59 | - | |
| 60 | - if ( \WP_Data_Access_Admin::PAGE_MAIN === $this->page ) { | |
| 61 | - // Handle Data Explorer cookies (search cookie is handled in next section). | |
| 62 | - // Handle cookie to remember active schema. | |
| 63 | - $cookie_name = \WP_Data_Access_Admin::PAGE_MAIN . '_schema_name'; | |
| 64 | - if ( isset( $_REQUEST['wpda_main_db_schema'] ) && '' !== $_REQUEST['wpda_main_db_schema'] ) { // phpcs:ignore WordPress.Security.NonceVerification | |
| 65 | - $requested_db_schema = sanitize_text_field( wp_unslash( $_REQUEST['wpda_main_db_schema'] ) ); // phpcs:ignore WordPress.Security.NonceVerification | |
| 66 | - $this->set_cookie( $cookie_name, $requested_db_schema, time() + self::COOKIE_TIME_EXPIRATION ); | |
| 67 | - } else { | |
| 68 | - if ( 'clear' === $panel_cookies ) { | |
| 69 | - // Check referer: clear cookie on new page request. | |
| 70 | - $url = wp_parse_url( wp_get_referer() ); | |
| 71 | - if ( isset( $url['query'] ) ) { | |
| 72 | - parse_str( $url['query'], $path ); | |
| 73 | - if ( isset( $path['page'] ) ) { | |
| 74 | - $page = $path['page']; | |
| 75 | - if ( $this->page !== $page ) { | |
| 76 | - // New page request: reset cookie. | |
| 77 | - $this->set_cookie( $cookie_name, '', time() - self::COOKIE_TIME_EXPIRATION ); | |
| 78 | - } | |
| 79 | - } | |
| 80 | - } | |
| 81 | - } | |
| 82 | - } | |
| 83 | - | |
| 84 | - // Handle cookie to remember favourite selection. | |
| 85 | - $cookie_name = $this->page . '_favourites'; | |
| 86 | - if ( isset( $_REQUEST['wpda_main_favourites'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification | |
| 87 | - $favourites = sanitize_text_field( wp_unslash( $_REQUEST['wpda_main_favourites'] ) ); // phpcs:ignore WordPress.Security.NonceVerification | |
| 88 | - $this->set_cookie( $cookie_name, $favourites, time() + self::COOKIE_TIME_EXPIRATION ); | |
| 89 | - } else { | |
| 90 | - if ( 'clear' === $panel_cookies ) { | |
| 91 | - // Check referer: clear cookie on new page request. | |
| 92 | - $url = wp_parse_url( wp_get_referer() ); | |
| 93 | - if ( isset( $url['query'] ) ) { | |
| 94 | - parse_str( $url['query'], $path ); | |
| 95 | - if ( isset( $path['page'] ) ) { | |
| 96 | - $page = $path['page']; | |
| 97 | - if ( $this->page !== $page ) { | |
| 98 | - // New page request: reset cookie. | |
| 99 | - $this->set_cookie( $cookie_name, '', time() - self::COOKIE_TIME_EXPIRATION ); | |
| 100 | - } | |
| 101 | - } | |
| 102 | - } | |
| 103 | - } | |
| 104 | - } | |
| 105 | - } | |
| 106 | 50 | |
| 107 | 51 | // Handle cookie for search value. |
| 108 | 52 | if ( 'wpda_wpdp_' === substr( $this->page, 0, 10 ) ) { |
| 109 | 53 | if ( isset( $_REQUEST['child_request'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification |