Current File : /home/kelaby89/kelaby.company/wp-content/plugins/advanced-google-recaptcha/libs/admin.php |
<?php
/**
* WP Captcha Pro
* https://getwpcaptcha.com/
* (c) WebFactory Ltd, 2022 - 2023, www.webfactoryltd.com
*/
use IconCaptcha\IconCaptcha;
class WPCaptcha_Admin extends WPCaptcha
{
/**
* Enqueue Admin Scripts
*
* @since 5.0
*
* @return null
*/
static function admin_enqueue_scripts($hook)
{
global $wpcaptcha_licensing;
$options = WPCaptcha_Setup::get_options();
if ('settings_page_wpcaptcha' == $hook) {
wp_enqueue_style('wpcaptcha-admin', WPCAPTCHA_PLUGIN_URL . 'css/wpcaptcha.css', array(), self::$version);
wp_enqueue_style('wpcaptcha-dataTables', WPCAPTCHA_PLUGIN_URL . 'css/jquery.dataTables.min.css', array(), self::$version);
wp_enqueue_style('wpcaptcha-select2', WPCAPTCHA_PLUGIN_URL . 'css/select2.css', array(), self::$version);
wp_enqueue_style('wpcaptcha-sweetalert', WPCAPTCHA_PLUGIN_URL . 'css/sweetalert2.min.css', array(), self::$version);
wp_enqueue_style('wpcaptcha-tooltipster', WPCAPTCHA_PLUGIN_URL . 'css/tooltipster.bundle.min.css', array(), self::$version);
wp_enqueue_style('wpcaptcha-iconcaptcha', WPCAPTCHA_PLUGIN_URL . 'css/icon-captcha.min.css', array(), self::$version);
wp_enqueue_style('wp-color-picker');
wp_enqueue_script('jquery-ui-tabs');
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-position');
wp_enqueue_script('jquery-effects-core');
wp_enqueue_script('jquery-effects-blind');
wp_enqueue_script('wpcaptcha-tooltipster', WPCAPTCHA_PLUGIN_URL . 'js/tooltipster.bundle.min.js', array('jquery'), self::$version, true);
wp_enqueue_script('wpcaptcha-dataTables', WPCAPTCHA_PLUGIN_URL . 'js/jquery.dataTables.min.js', array(), self::$version, true);
wp_enqueue_script('wpcaptcha-select2', WPCAPTCHA_PLUGIN_URL . 'js/select2.js', array(), self::$version, true);
wp_enqueue_script('wpcaptcha-chart', WPCAPTCHA_PLUGIN_URL . 'js/chart.min.js', array(), self::$version, true);
wp_enqueue_script('wpcaptcha-moment', WPCAPTCHA_PLUGIN_URL . 'js/moment.min.js', array(), self::$version, true);
wp_enqueue_script('wpcaptcha-d3', WPCAPTCHA_PLUGIN_URL . 'js/d3.min.js', array(), self::$version, true);
wp_enqueue_script('wpcaptcha-topojson', WPCAPTCHA_PLUGIN_URL . 'js/topojson.min.js', array(), self::$version, true);
wp_enqueue_script('wpcaptcha-worldmap', WPCAPTCHA_PLUGIN_URL . 'js/datamaps.world.min.js', array(), self::$version, true);
wp_enqueue_script('wpcaptcha-sweetalert', WPCAPTCHA_PLUGIN_URL . 'js/sweetalert2.min.js', array(), self::$version, true);
wp_enqueue_script('wpcaptcha-ace-editor', WPCAPTCHA_PLUGIN_URL . 'js/editor/ace.js', false, self::$version, true);
wp_enqueue_script('wpcaptcha-iconcaptcha', WPCAPTCHA_PLUGIN_URL . 'js/icon-captcha.min.js', false, self::$version, true);
wp_enqueue_script('wp-color-picker');
wp_enqueue_media();
$current_user = wp_get_current_user();
$license = $wpcaptcha_licensing->get_license();
$support_text = 'My site details: WP ' . get_bloginfo('version') . ', WP Captcha v' . self::$version . ', ';
if (!empty($license['license_key'])) {
$support_text .= 'license key: ' . $license['license_key'] . '.';
} else {
$support_text .= 'no license info.';
}
if (strtolower($current_user->display_name) != 'admin' && strtolower($current_user->display_name) != 'administrator') {
$support_name = $current_user->display_name;
} else {
$support_name = '';
}
IconCaptcha::options([
'iconPath' => WPCAPTCHA_PLUGIN_DIR . '/css/iconcaptcha/',
'messages' => [
'wrong_icon' => 'You\'ve selected the wrong image.',
'no_selection' => 'No image has been selected.',
'empty_form' => 'You\'ve not submitted any form.',
'invalid_id' => 'The captcha ID was invalid.',
'form_token' => 'The form token was invalid.'
],
'image' => [
'availableIcons' => 180,
'amount' => [
'min' => 5,
'max' => 5
],
'rotate' => true,
'flip' => [
'horizontally' => true,
'vertically' => true,
],
'border' => true
],
'attempts' => [
'amount' => 5,
'timeout' => 60
],
'token' => true
]);
$js_localize = array(
'undocumented_error' => __('An undocumented error has occurred. Please refresh the page and try again.', 'advanced-google-recaptcha'),
'documented_error' => __('An error has occurred.', 'advanced-google-recaptcha'),
'plugin_name' => __('WP Captcha PRO', 'advanced-google-recaptcha'),
'plugin_url' => WPCAPTCHA_PLUGIN_URL,
'icon_url' => WPCAPTCHA_PLUGIN_URL . 'images/wp-captcha-loader.gif',
'settings_url' => admin_url('options-general.php?page=wpcaptcha'),
'version' => self::$version,
'site' => get_home_url(),
'url' => WPCAPTCHA_PLUGIN_URL,
'support_text' => $support_text,
'support_name' => $support_name,
'nonce_lc_check' => wp_create_nonce('wpcaptcha_save_lc'),
'cancel_button' => __('Cancel', 'advanced-google-recaptcha'),
'ok_button' => __('OK', 'advanced-google-recaptcha'),
'run_tool_nonce' => wp_create_nonce('wpcaptcha_run_tool'),
'stats_unavailable' => 'Stats will be available once enough data is collected.',
'stats_locks' => WPCaptcha_Stats::get_stats('locks'),
'stats_fails' => WPCaptcha_Stats::get_stats('fails'),
'stats_locks_devices' => WPCaptcha_Stats::get_device_stats('locks'),
'stats_fails_devices' => WPCaptcha_Stats::get_device_stats('fails'),
'stats_map' => WPCaptcha_Stats::get_map_stats('fails'),
'rebranded' => (self::get_rebranding() !== false ? true : false),
'whitelabel' => WPCaptcha_Utility::whitelabel_filter(),
'is_active' => $wpcaptcha_licensing->is_active(),
'iconcaptcha_token' => IconCaptcha::token()
);
if (self::get_rebranding() !== false) {
$brand_color = self::get_rebranding('color');
if (empty($brand_color)) {
$brand_color = '#ff6144';
}
$js_localize['chart_colors'] = array($brand_color, self::color_luminance($brand_color, 0.2), self::color_luminance($brand_color, 0.4), self::color_luminance($brand_color, 0.6));
} else {
$js_localize['chart_colors'] = array('#4285f4', '#ff5429', '#ff7d5c', '#ffac97');
}
wp_enqueue_script('wpcaptcha-admin', WPCAPTCHA_PLUGIN_URL . 'js/wpcaptcha.js', array('jquery'), self::$version, true);
wp_localize_script('wpcaptcha-admin', 'wpcaptcha_vars', $js_localize);
// fix for aggressive plugins that include their CSS or JS on all pages
wp_dequeue_style('uiStyleSheet');
wp_dequeue_style('wpcufpnAdmin');
wp_dequeue_style('unifStyleSheet');
wp_dequeue_style('wpcufpn_codemirror');
wp_dequeue_style('wpcufpn_codemirrorTheme');
wp_dequeue_style('collapse-admin-css');
wp_dequeue_style('jquery-ui-css');
wp_dequeue_style('tribe-common-admin');
wp_dequeue_style('file-manager__jquery-ui-css');
wp_dequeue_style('file-manager__jquery-ui-css-theme');
wp_dequeue_style('wpmegmaps-jqueryui');
wp_dequeue_style('wp-botwatch-css');
wp_dequeue_style('njt-filebird-admin');
wp_dequeue_style('ihc_jquery-ui.min.css');
wp_dequeue_style('badgeos-juqery-autocomplete-css');
wp_dequeue_style('mainwp');
wp_dequeue_style('mainwp-responsive-layouts');
wp_dequeue_style('jquery-ui-style');
wp_dequeue_style('additional_style');
wp_dequeue_style('wobd-jqueryui-style');
wp_dequeue_style('wpdp-style3');
wp_dequeue_style('jquery_smoothness_ui');
wp_dequeue_style('uap_main_admin_style');
wp_dequeue_style('uap_font_awesome');
wp_dequeue_style('uap_jquery-ui.min.css');
wp_dequeue_style('wqm-select2-style');
wp_deregister_script('wqm-select2-script');
}
$rebranding = false;
if ($hook == 'plugins.php') {
$rebranding = self::get_rebranding();
}
$pointers = get_option(WPCAPTCHA_POINTERS_KEY);
if ('settings_page_wpcaptcha' != $hook) {
if ($pointers) {
$pointers['run_tool_nonce'] = wp_create_nonce('wpcaptcha_run_tool');
wp_enqueue_script('wp-pointer');
wp_enqueue_style('wp-pointer');
wp_localize_script('wp-pointer', 'wpcaptcha_pointers', $pointers);
}
if ($pointers || false !== $rebranding) {
wp_enqueue_script('wpcaptcha-admin-global', WPCAPTCHA_PLUGIN_URL . 'js/wpcaptcha-global.js', array('jquery'), self::$version, true);
}
if (false !== $rebranding) {
wp_localize_script('wpcaptcha-admin-global', 'wpcaptcha_rebranding', $rebranding);
}
}
} // admin_enqueue_scripts
static function admin_notices()
{
$notices = get_option(WPCAPTCHA_NOTICES_KEY);
if (is_array($notices)) {
foreach ($notices as $id => $notice) {
echo '<div class="notice-' . $notice['type'] . ' notice is-dismissible"><p>' . $notice['text'] . '<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></p></div>';
if ($notice['once'] == true) {
unset($notices[$id]);
update_option(WPCAPTCHA_NOTICES_KEY, $notices);
}
}
}
} // notices
static function add_notice($id = false, $text = '', $type = 'warning', $show_once = false)
{
if ($id) {
$notices = get_option(WPCAPTCHA_NOTICES_KEY, array());
$notices[$id] = array('text' => $text, 'type' => $type, 'once' => $show_once);
update_option(WPCAPTCHA_NOTICES_KEY, $notices);
}
}
static function admin_bar()
{
global $wp_admin_bar, $wpcaptcha_licensing;
$options = WPCaptcha_Setup::get_options();
if (
!$options['show_admin_menu'] ||
!$wpcaptcha_licensing->is_active() ||
false === current_user_can('administrator') ||
false === apply_filters('wp_force_ssl_show_admin_bar', true)
) {
return;
}
$plugin_name = self::get_rebranding('name');
if ($plugin_name == false) {
$plugin_name = 'WP Captcha';
}
$plugin_logo = self::get_rebranding('logo_url');
if ($plugin_logo == false) {
$plugin_logo = WPCAPTCHA_PLUGIN_URL . 'images/wp-captcha-icon.png';
}
$title = '<div class="wpcaptcha-adminbar-icon" style="display:inline-block;"><img style="height: 22px; padding: 4px; margin-bottom: -10px; filter: invert(1) brightness(1.2) grayscale(1);" src="' . $plugin_logo . '" alt="' . $plugin_name . '" title="' . $plugin_name . '"></div> <span class="ab-label">' . $plugin_name . '</span>';
$wp_admin_bar->add_node(array(
'id' => 'wpcaptcha-ab',
'title' => $title,
'href' => '#',
'parent' => '',
));
$wp_admin_bar->add_node(array(
'id' => 'wpcaptcha-login-protection',
'title' => 'Login Protection',
'href' => admin_url('options-general.php?page=wpcaptcha#wpcaptcha_login_form'),
'parent' => 'wpcaptcha-ab'
));
$wp_admin_bar->add_node(array(
'id' => 'wpcaptcha-activity',
'title' => 'Activity',
'href' => admin_url('options-general.php?page=wpcaptcha#wpcaptcha_activity'),
'parent' => 'wpcaptcha-ab'
));
$wp_admin_bar->add_node(array(
'id' => 'wpcaptcha-geoip',
'title' => 'GeoIP',
'href' => admin_url('options-general.php?page=wpcaptcha#wpcaptcha_geoip'),
'parent' => 'wpcaptcha-ab'
));
$wp_admin_bar->add_node(array(
'id' => 'wpcaptcha-2fa',
'title' => '2FA',
'href' => admin_url('options-general.php?page=wpcaptcha#wpcaptcha_2FA'),
'parent' => 'wpcaptcha-ab'
));
$wp_admin_bar->add_node(array(
'id' => 'wpcaptcha-captcha',
'title' => 'Captcha',
'href' => admin_url('options-general.php?page=wpcaptcha#wpcaptcha_captcha'),
'parent' => 'wpcaptcha-ab'
));
} // admin_bar
/**
* Admin menu entry
*
* @since 5.0
*
* @return null
*/
static function admin_menu()
{
$page_title = self::get_rebranding('name');
if ($page_title === false || empty($page_title)) {
$page_title = 'WP Captcha PRO';
}
$menu_title = self::get_rebranding('short_name');
if ($menu_title === false || empty($menu_title)) {
$menu_title = '<span>WP Captcha <span style="color: #4285f4; vertical-align: super; font-size: 9px;">PRO</span></span>';
}
add_options_page(
__($page_title, 'advanced-google-recaptcha'),
$menu_title,
'manage_options',
'wpcaptcha',
array(__CLASS__, 'main_page')
);
} // admin_menu
/**
* Add settings link to plugins page
*
* @since 5.0
*
* @return null
*/
static function plugin_action_links($links)
{
$plugin_name = self::get_rebranding('name');
if ($plugin_name === false || empty($plugin_name)) {
$plugin_name = __('WP Captcha PRO Settings', 'advanced-google-recaptcha');
}
$settings_link = '<a href="' . admin_url('options-general.php?page=wpcaptcha') . '" title="' . $plugin_name . '">' . __('Settings', 'advanced-google-recaptcha') . '</a>';
array_unshift($links, $settings_link);
return $links;
} // plugin_action_links
/**
* Add links to plugin's description in plugins table
*
* @since 5.0
*
* @return null
*/
static function plugin_meta_links($links, $file)
{
if ($file !== 'advanced-google-recaptcha/advanced-google-recaptcha.php') {
return $links;
}
if (self::get_rebranding('url')) {
unset($links[1]);
unset($links[2]);
$links[] = '<a target="_blank" href="' . self::get_rebranding('company_url') . '" title="Get help">' . self::get_rebranding('company_name') . '</a>';
$links[] = '<a target="_blank" href="' . self::get_rebranding('url') . '" title="Get help">Support</a>';
} else {
$support_link = '<a href="https://getwpcaptcha.com/support/" title="' . __('Get help', 'advanced-google-recaptcha') . '">' . __('Support', 'advanced-google-recaptcha') . '</a>';
$links[] = $support_link;
}
if (!WPCaptcha_Utility::whitelabel_filter()) {
unset($links[1]);
unset($links[2]);
unset($links[3]);
}
return $links;
} // plugin_meta_links
/**
* Admin footer text
*
* @since 5.0
*
* @return null
*/
static function admin_footer_text($text)
{
if (!self::is_plugin_page() || !WPCaptcha_Utility::whitelabel_filter()) {
return $text;
}
if (self::get_rebranding()) {
$text = '<i class="wpcaptcha-footer"><a href="' . self::get_rebranding('company_url') . '" title="Visit ' . self::get_rebranding('name') . ' page for more info" target="_blank">' . self::get_rebranding('name') . '</a> v' . self::$version . '. ' . self::get_rebranding('footer_text') . '</i>';
} else {
$text = '<i class="wpcaptcha-footer">WP Captcha v' . self::$version . ' <a href="' . self::generate_web_link('admin_footer') . '" title="Visit WP Captcha PRO page for more info" target="_blank">WebFactory Ltd</a>. Please <a target="_blank" href="https://wordpress.org/support/plugin/advanced-google-recaptcha/reviews/#new-post" title="Rate the plugin">rate the plugin <span>★★★★★</span></a> to help us spread the word. Thank you 🙌 from the WebFactory team!</i>';
}
echo '<script type="text/javascript">!function(e,t,n){function a(){var e=t.getElementsByTagName("script")[0],n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://beacon-v2.helpscout.net",e.parentNode.insertBefore(n,e)}if(e.Beacon=n=function(t,n,a){e.Beacon.readyQueue.push({method:t,options:n,data:a})},n.readyQueue=[],"complete"===t.readyState)return a();e.attachEvent?e.attachEvent("onload",a):e.addEventListener("load",a,!1)}(window,document,window.Beacon||function(){});</script>';
return $text;
} // admin_footer_text
/**
* Helper function for generating UTM tagged links
*
* @param string $placement Optional. UTM content param.
* @param string $page Optional. Page to link to.
* @param array $params Optional. Extra URL params.
* @param string $anchor Optional. URL anchor part.
*
* @return string
*/
static function generate_web_link($placement = '', $page = '/', $params = array(), $anchor = '')
{
$base_url = 'https://getwpcaptcha.com';
if ('/' != $page) {
$page = '/' . trim($page, '/') . '/';
}
if ($page == '//') {
$page = '/';
}
$parts = array_merge(array('utm_source' => 'advanced-google-recaptcha', 'utm_medium' => 'plugin', 'utm_content' => $placement, 'utm_campaign' => 'wpcaptcha-pro-v' . self::$version), $params);
if (!empty($anchor)) {
$anchor = '#' . trim($anchor, '#');
}
$out = $base_url . $page . '?' . http_build_query($parts, '', '&') . $anchor;
return $out;
} // generate_web_link
/**
* Change luminance of a hex color
*
* @since 5.0
*
* @param string hex color
* @param int percent to adjust color luminance by
*
* @return string new hex color
*/
static function color_luminance($hex, $percent)
{
$hex = preg_replace('/[^0-9a-f]/i', '', $hex);
$new_hex = '#';
if (strlen($hex) < 6) {
$hex = $hex[0] + $hex[0] + $hex[1] + $hex[1] + $hex[2] + $hex[2];
}
// convert to decimal and change luminosity
for ($i = 0; $i < 3; $i++) {
$dec = hexdec(substr($hex, $i * 2, 2));
$dec = min(max(0, $dec + $dec * $percent), 255);
$new_hex .= str_pad(dechex($dec), 2, 0, STR_PAD_LEFT);
}
return $new_hex;
}
/**
* Helper function for generating dashboard UTM tagged links
*
* @param string $placement Optional. UTM content param.
* @param string $page Optional. Page to link to.
* @param array $params Optional. Extra URL params.
* @param string $anchor Optional. URL anchor part.
*
* @return string
*/
static function generate_dashboard_link($placement = '', $page = '/', $params = array(), $anchor = '')
{
$base_url = 'https://dashboard.getwpcaptcha.com';
if ('/' != $page) {
$page = '/' . trim($page, '/') . '/';
}
if ($page == '//') {
$page = '/';
}
$parts = array_merge(array('utm_source' => 'wpcaptcha-pro', 'utm_medium' => 'plugin', 'utm_content' => $placement, 'utm_campaign' => 'wpcaptcha-pro-v' . self::$version), $params);
if (!empty($anchor)) {
$anchor = '#' . trim($anchor, '#');
}
$out = $base_url . $page . '?' . http_build_query($parts, '', '&') . $anchor;
return $out;
} // generate_dashboard_link
/**
* Test if we're on plugin's page
*
* @since 5.0
*
* @return null
*/
static function is_plugin_page()
{
$current_screen = get_current_screen();
if ($current_screen->id == 'settings_page_wpcaptcha') {
return true;
} else {
return false;
}
} // is_plugin_page
/**
* Settings Page HTML
*
* @since 5.0
*
* @return null
*/
static function main_page()
{
global $wpcaptcha_licensing;
if (!current_user_can('manage_options')) {
wp_die('You do not have sufficient permissions to access this page.');
}
if (self::get_rebranding()) {
echo '<style>';
echo self::get_rebranding('admin_css_predefined');
echo self::get_rebranding('admin_css');
echo '</style>';
}
$options = WPCaptcha_Setup::get_options();
// auto remove welcome pointer when options are opened
$pointers = get_option(WPCAPTCHA_POINTERS_KEY);
if (isset($pointers['welcome'])) {
unset($pointers['welcome']);
update_option(WPCAPTCHA_POINTERS_KEY, $pointers);
}
$plugin_name = self::get_rebranding('name');
if ($plugin_name === false || empty($plugin_name)) {
$plugin_name = 'WP Captcha PRO';
}
echo '<div class="wrap">
<div class="wpcaptcha-header">
<div class="wp-captcha-logo">';
if (self::get_rebranding('logo_url') !== false) {
echo '<img src="' . self::get_rebranding('logo_url') . '" />';
} else {
echo '<img src="' . WPCAPTCHA_PLUGIN_URL . '/images/wp-captcha-logo.png" alt="WP Captcha PRO" height="60" title="WP Captcha PRO">';
}
echo '</div>';
echo '<a data-tab="firewall" title="Click to open Firewall Settings" class="tooltip change_tab wpcaptcha-header-status wpcaptcha-header-status-' . ($options['firewall_block_bots'] == 1 ? 'enabled' : 'disabled') . '" style="width: 142px;">';
echo '<span class="dashicons dashicons-yes"></span>';
echo '<div class="option">Firewall</span></div>';
if ($options['firewall_block_bots'] == 'disabled') {
echo '<div class="status">Disabled</div>';
} else {
echo '<div class="status">Enabled</div>';
}
echo '</a>';
echo '<a data-tab="login_form" title="Click to open Login Protection settings" class="tooltip change_tab wpcaptcha-header-status wpcaptcha-header-status-' . ($options['login_protection'] == 1 ? 'enabled' : 'disabled') . '">';
echo '<span class="dashicons dashicons-yes"></span>';
echo '<div class="option">Login Protection</span></div>';
if ($options['login_protection'] == 'disabled') {
echo '<div class="status">Disabled</div>';
} else {
echo '<div class="status">Enabled</div>';
}
echo '</a>';
echo '<a data-tab="captcha" title="Click to open Captcha settings" class="tooltip change_tab wpcaptcha-header-status wpcaptcha-header-status-' . ($options['captcha'] == 'disabled' ? 'disabled' : 'enabled') . '" style="width: 142px;">';
echo '<span class="dashicons dashicons-yes"></span>';
echo '<div class="option">Captcha</span></div>';
if ($options['captcha'] == 'disabled') {
echo '<div class="status">Disabled</div>';
} else {
echo '<div class="status">Enabled</div>';
}
echo '</a>';
echo '</div>';
echo '<h1></h1>';
echo '<form method="post" action="options.php" enctype="multipart/form-data" id="wpcaptcha_form">';
settings_fields(WPCAPTCHA_OPTIONS_KEY);
$license = $wpcaptcha_licensing->get_license();
$tabs = array();
if ($wpcaptcha_licensing->is_active()) {
$tabs[] = array('id' => 'wpcaptcha_captcha', 'icon' => 'wpcaptcha-icon wpcaptcha-make-group', 'class' => '', 'label' => __('Captcha', 'advanced-google-recaptcha'), 'callback' => array('WPCaptcha_Tab_Captcha', 'display'));
$tabs[] = array('id' => 'wpcaptcha_activity', 'icon' => 'wpcaptcha-icon wpcaptcha-log', 'class' => '', 'label' => __('Activity', 'advanced-google-recaptcha'), 'callback' => array('WPCaptcha_Tab_Activity', 'display'));
$tabs[] = array('id' => 'wpcaptcha_login_form', 'icon' => 'wpcaptcha-icon wpcaptcha-enter', 'class' => '', 'label' => __('Login Protection', 'advanced-google-recaptcha'), 'callback' => array('WPCaptcha_Tab_Login_Form', 'display'));
$tabs[] = array('id' => 'wpcaptcha_firewall', 'icon' => 'wpcaptcha-icon wpcaptcha-check', 'class' => '', 'label' => __('Firewall', 'advanced-google-recaptcha'), 'callback' => array('WPCaptcha_Tab_Firewall', 'display'));
$tabs[] = array('id' => 'wpcaptcha_geoip', 'icon' => 'wpcaptcha-icon wpcaptcha-globe', 'class' => '', 'label' => __('Country Blocking', 'advanced-google-recaptcha'), 'callback' => array('WPCaptcha_Tab_GeoIP', 'display'));
$tabs[] = array('id' => 'wpcaptcha_design', 'icon' => 'wpcaptcha-icon wpcaptcha-settings', 'class' => '', 'label' => __('Design', 'advanced-google-recaptcha'), 'callback' => array('WPCaptcha_Tab_Design', 'display'));
$tabs[] = array('id' => 'wpcaptcha_temp_access', 'icon' => 'wpcaptcha-icon wpcaptcha-hour-glass', 'class' => '', 'label' => __('Temp Access', 'advanced-google-recaptcha'), 'callback' => array('WPCaptcha_Tab_Temporary_Access', 'display'));
if (WPCaptcha_Utility::whitelabel_filter()) {
$tabs[] = array('id' => 'wpcaptcha_license', 'icon' => 'wpcaptcha-icon wpcaptcha-key', 'class' => '', 'label' => __('License', 'advanced-google-recaptcha'), 'callback' => array('WPCaptcha_Tab_License', 'display'));
}
} else {
$tabs[] = array('id' => 'wpcaptcha_license', 'icon' => 'wpcaptcha-icon wpcaptcha-key', 'class' => '', 'label' => __('License', 'advanced-google-recaptcha'), 'callback' => array('WPCaptcha_Tab_License', 'display'));
}
$tabs = apply_filters('wpcaptcha_tabs', $tabs);
echo '<div id="wpcaptcha_tabs" class="ui-tabs" style="display: none;">';
echo '<ul class="wpcaptcha-main-tab">';
foreach ($tabs as $tab) {
echo '<li><a href="#' . $tab['id'] . '" class="' . $tab['class'] . '"><span class="icon"><i class="' . $tab['icon'] . '"></i></span></span><span class="label">' . $tab['label'] . '</span></a></li>';
}
echo '</ul>';
foreach ($tabs as $tab) {
if (is_callable($tab['callback'])) {
echo '<div style="display: none;" id="' . $tab['id'] . '">';
call_user_func($tab['callback']);
echo '</div>';
} else {
echo $tab['id'] . 'NF';
}
} // foreach
echo '</div>'; // wpcaptcha_tabs
echo '</form>';
echo '</div>'; // wrap
if ($wpcaptcha_licensing->is_active()) {
self::show_wizard($options['wizard_complete']);
}
} // options_page
/**
* Reset pointers
*
* @since 5.0
*
* @return null
*/
static function reset_pointers()
{
$pointers = array();
$pointers['welcome'] = array('target' => '#menu-settings', 'edge' => 'left', 'align' => 'right', 'content' => 'Thank you for installing the <b style="font-weight: 800; font-variant: small-caps;">WP Captcha Pro</b> plugin! Please open <a href="' . admin_url('options-general.php?page=wpcaptcha') . '">Settings - WP Captcha Pro</a> to set up your captcha and login protection settings.');
update_option(WPCAPTCHA_POINTERS_KEY, $pointers);
} // reset_pointers
/**
* Settings footer submit button HTML
*
* @since 5.0
*
* @return null
*/
static function footer_save_button()
{
echo '<p class="submit">';
echo '<button class="button button-primary button-large">' . __('Save Changes', 'advanced-google-recaptcha') . ' <i class="wpcaptcha-icon wpcaptcha-checkmark"></i></button>';
echo '</p>';
} // footer_save_button
/**
* Get rebranding data, return false if not rebranded
*
* @since 5.0
*
* @return bool|string requested property or false if not rebranded
*/
static function get_rebranding($key = false)
{
global $wpcaptcha_licensing;
$license = $wpcaptcha_licensing->get_license();
if (is_array($license) && array_key_exists('meta', $license) && is_array($license['meta']) && array_key_exists('rebrand', $license['meta']) && !empty($license['meta']['rebrand'])) {
if (!empty($key)) {
return $license['meta']['rebrand'][$key];
}
return $license['meta']['rebrand'];
} else {
return false;
}
}
static function show_wizard($hidden = 1)
{
$options = WPCaptcha_Setup::get_options();
echo '<div class="wpcaptcha-wizard-wrapper" ' . ($hidden ? 'style="display:none;"' : '') . '>';
echo '<div class="wpcaptcha-wizard-popup">';
echo '<h2 align="center">Welcome</h2>';
echo '<p>Thank you for installing WP Captcha PRO!</p>';
echo '<p style="color:red;font-weight:bold;">IMPORTANT! In case you lock yourself out and need to whitelist your IP address, please save the link below somewhere safe:</p>';
echo '<a href="' . site_url('/?wpcaptcha_unblock=' . $options['global_unblock_key']) . '">' . site_url('/?wpcaptcha_unblock=' . $options['global_unblock_key']) . '</a>';
/*
echo '<p>To help you get going fast, we have created a few configuration sets that you can deploy by clicking on the one that fits your website best:</p>';
echo '<div class="wpcaptcha-wizard-button" data-config="personal">';
echo '<h2>Company website/Personal Blog</h2>';
echo '<p>Select this if you have a personal website that only you manage from a single administrator account</p>';
echo '</div>';
echo '<div class="wpcaptcha-wizard-button" data-config="medium">';
echo '<h2>Medium website</h2>';
echo '<p>Select this if you have a medium website where multiple people have accounts</p>';
echo '</div>';
echo '<div class="wpcaptcha-wizard-button" data-config="store">';
echo '<h2>Online Store/Forum</h2>';
echo '<p>Select this if you have a store or forum where a lot of users have accounts</p>';
echo '</div>';
*/
echo '<br><br><button class="wpcaptcha-wizard-button button button-gray button-large" data-config="skip" style="margin:0 auto; display: block; width: 120px;">Close</button>';
echo '</div>';
echo '</div>';
}
} // class