| 1 |
<?php |
| 2 |
/** |
| 3 |
* Settings helpers. |
| 4 |
* |
| 5 |
* @since 1.6.0 |
| 6 |
* |
| 7 |
* @package woo-additional-terms |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace Woo_Additional_Terms\Helper; |
| 11 |
|
| 12 |
/** |
| 13 |
* Helpers for the plugin settings. |
| 14 |
*/ |
| 15 |
abstract class Settings { |
| 16 |
|
| 17 |
/** |
| 18 |
* Check if the current page is the settings page. |
| 19 |
* |
| 20 |
* @since 1.6.0 |
| 21 |
* |
| 22 |
* @return bool |
| 23 |
*/ |
| 24 |
public static function is_page() { |
| 25 |
|
| 26 |
// phpcs:disable WordPress.Security.NonceVerification.Recommended |
| 27 |
return ( |
| 28 |
isset( $_GET['page'] ) |
| 29 |
&& 'wc-settings' === $_GET['page'] |
| 30 |
&& isset( $_GET['tab'] ) |
| 31 |
&& woo_additional_terms()->get_slug() === $_GET['tab'] |
| 32 |
); |
| 33 |
// phpcs:enable WordPress.Security.NonceVerification.Recommended |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Get the plugin settings URI. |
| 38 |
* |
| 39 |
* @since 1.6.0 |
| 40 |
* |
| 41 |
* @return string |
| 42 |
*/ |
| 43 |
public static function page_uri() { |
| 44 |
|
| 45 |
// e.g, "http://example.com/wp-admin/admin.php?page=wc-settings&tab=woo-additional-terms". |
| 46 |
return add_query_arg( |
| 47 |
array( |
| 48 |
'page' => 'wc-settings', |
| 49 |
'tab' => woo_additional_terms()->get_slug(), |
| 50 |
), |
| 51 |
admin_url( 'admin.php' ) |
| 52 |
); |
| 53 |
} |
| 54 |
} |
| 55 |
|