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