* @license GPL-3.0 * @link https://iplocationblock.com/ * @copyright 2021 darkog * @copyright 2013-2019 tokkonopapa */ class IP_Location_Block_Admin { /** * Constants for admin class * */ const INTERVAL_LIVE_UPDATE = 5; // interval for live update [sec] const TIMEOUT_LIVE_UPDATE = 60; // timeout of pausing live update [sec] /** * Globals in this class * */ private static $instance = null; private $is_network_admin = false; private $admin_tab = 0; /** * Initialize the plugin by loading admin scripts & styles * and adding a settings page and menu. */ private function __construct() { // Control tab number if ( isset( $_REQUEST['page'] ) && 'ip-location-block' === $_REQUEST['page'] ) { $this->admin_tab = isset( $_REQUEST['tab'] ) ? intval( $_REQUEST['tab'] ) : 0; } else { $this->admin_tab = - 1; } // Load plugin text domain and add body class add_action( 'init', array( $this, 'admin_init' ) ); // Add suggest text for inclusion in the site's privacy policy. @since 4.9.6 // add_action( 'admin_init', array( $this, 'add_privacy_policy' ) ); // Setup a nonce to validate authentication. add_filter( 'wp_redirect', array( $this, 'add_redirect_nonce' ), 10, 2 ); // @since 0.2.1.0 } /** * Return an instance of this class. * */ public static function get_instance() { return self::$instance ? self::$instance : ( self::$instance = new self ); } /** * Print admin notice welcome screen * @return void */ public function show_intro_notice() { if ( ! current_user_can( 'manage_options' ) ) { return; } $settings = IP_Location_Block::get_option(); if ( ! isset( $settings['welcome'] ) || ! $settings['welcome'] ) { ob_start(); echo '
%1$s, which uses server-level page caching that runs before PHP. When "Front-end target settings" validation is enabled, cached pages may be served to all visitors without geolocation checks. Learn how to configure %1$s for compatibility.', 'ip-location-block' ), $host_name, $article_url ); ?>
'; if ( 'updated' === $type ) { echo '', IP_Location_Block_Util::kses( $msg ), ''; } else { echo 'IP Location Block: ', IP_Location_Block_Util::kses( $msg ); } echo '
', implode( '
', $tab ), "
', __( 'Thanks for providing these great services for free.', 'ip-location-block' ), "
\n";
echo __( '(Most browsers will redirect you to each site without referrer when you click the link.)', 'ip-location-block' ), "
| %s', esc_attr( $checked ), esc_attr( $disabled ), esc_attr( $id ), esc_attr( $name ), esc_attr( $val ), esc_attr( $cssClass ), IP_Location_Block_Provider::format_provider_meta( $key, 'name' ) ); ?> | ', esc_attr( $name ), esc_attr( $value ), __( 'API Key', 'ip-location-block' ) ); } ?> | ', IP_Location_Block_Provider::supports( $key, 'ipv4' ) ? 'dashicons-yes' : 'dashicons-no' ); ?> | ', IP_Location_Block_Provider::supports( $key, 'ipv6' ) ? 'dashicons-yes' : 'dashicons-no' ); ?> | ', IP_Location_Block_Provider::supports( $key, array( 'asn', 'asn_database' ) ) ? 'dashicons-yes' : 'dashicons-no' ); ?> | ', IP_Location_Block_Provider::supports( $key, array( 'city' ) ) ? 'dashicons-yes' : 'dashicons-no' ); ?> | ', IP_Location_Block_Provider::supports( $key, array( 'state' ) ) ? 'dashicons-yes' : 'dashicons-no' ); ?> |
', $desc, "
\n"; } if ( 'select' === $args['type'] ) { break; } echo "