Skip to content

Commit

Permalink
phpcs happy now
Browse files Browse the repository at this point in the history
  • Loading branch information
HughParry committed Apr 24, 2024
1 parent a981c02 commit 0a8f6f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 340 deletions.
338 changes: 0 additions & 338 deletions src/php/Settings/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,6 @@ public function init_form_fields() {
'lp_ignore' => 'true',
'section' => self::SECTION_KEYS,
],
// 'secret_key' => [
// 'label' => __( 'Secret Key', 'procaptcha-wordpress' ),
// 'type' => 'password',
// 'section' => self::SECTION_KEYS,
// ],
'sample_hcaptcha' => [
'label' => __( 'Active hCaptcha to Check Site Config', 'procaptcha-wordpress' ),
'type' => 'hcaptcha',
Expand All @@ -198,12 +193,6 @@ public function init_form_fields() {
'text' => __( 'Check', 'procaptcha-wordpress' ),
'section' => self::SECTION_KEYS,
],
// 'reset_notifications' => [
// 'label' => __( 'Reset Notifications', 'procaptcha-wordpress' ),
// 'type' => 'button',
// 'text' => __( 'Reset', 'procaptcha-wordpress' ),
// 'section' => self::SECTION_KEYS,
// ],
'theme' => [
'label' => __( 'Theme', 'procaptcha-wordpress' ),
'type' => 'select',
Expand All @@ -226,333 +215,6 @@ public function init_form_fields() {
],
'helper' => __( 'Select hCaptcha size.', 'procaptcha-wordpress' ),
],
// 'language' => [
// 'label' => __( 'Language', 'procaptcha-wordpress' ),
// 'type' => 'select',
// 'section' => self::SECTION_APPEARANCE,
// 'options' => [
// '' => __( '--- Auto-Detect ---', 'procaptcha-wordpress' ),
// 'af' => __( 'Afrikaans', 'procaptcha-wordpress' ),
// 'sq' => __( 'Albanian', 'procaptcha-wordpress' ),
// 'am' => __( 'Amharic', 'procaptcha-wordpress' ),
// 'ar' => __( 'Arabic', 'procaptcha-wordpress' ),
// 'hy' => __( 'Armenian', 'procaptcha-wordpress' ),
// 'az' => __( 'Azerbaijani', 'procaptcha-wordpress' ),
// 'eu' => __( 'Basque', 'procaptcha-wordpress' ),
// 'be' => __( 'Belarusian', 'procaptcha-wordpress' ),
// 'bn' => __( 'Bengali', 'procaptcha-wordpress' ),
// 'bg' => __( 'Bulgarian', 'procaptcha-wordpress' ),
// 'bs' => __( 'Bosnian', 'procaptcha-wordpress' ),
// 'my' => __( 'Burmese', 'procaptcha-wordpress' ),
// 'ca' => __( 'Catalan', 'procaptcha-wordpress' ),
// 'ceb' => __( 'Cebuano', 'procaptcha-wordpress' ),
// 'zh' => __( 'Chinese', 'procaptcha-wordpress' ),
// 'zh-CN' => __( 'Chinese Simplified', 'procaptcha-wordpress' ),
// 'zh-TW' => __( 'Chinese Traditional', 'procaptcha-wordpress' ),
// 'co' => __( 'Corsican', 'procaptcha-wordpress' ),
// 'hr' => __( 'Croatian', 'procaptcha-wordpress' ),
// 'cs' => __( 'Czech', 'procaptcha-wordpress' ),
// 'da' => __( 'Danish', 'procaptcha-wordpress' ),
// 'nl' => __( 'Dutch', 'procaptcha-wordpress' ),
// 'en' => __( 'English', 'procaptcha-wordpress' ),
// 'eo' => __( 'Esperanto', 'procaptcha-wordpress' ),
// 'et' => __( 'Estonian', 'procaptcha-wordpress' ),
// 'fa' => __( 'Persian', 'procaptcha-wordpress' ),
// 'fi' => __( 'Finnish', 'procaptcha-wordpress' ),
// 'fr' => __( 'French', 'procaptcha-wordpress' ),
// 'fy' => __( 'Frisian', 'procaptcha-wordpress' ),
// 'gd' => __( 'Gaelic', 'procaptcha-wordpress' ),
// 'gl' => __( 'Galician', 'procaptcha-wordpress' ),
// 'ka' => __( 'Georgian', 'procaptcha-wordpress' ),
// 'de' => __( 'German', 'procaptcha-wordpress' ),
// 'el' => __( 'Greek', 'procaptcha-wordpress' ),
// 'gu' => __( 'Gujarati', 'procaptcha-wordpress' ),
// 'ht' => __( 'Haitian', 'procaptcha-wordpress' ),
// 'ha' => __( 'Hausa', 'procaptcha-wordpress' ),
// 'haw' => __( 'Hawaiian', 'procaptcha-wordpress' ),
// 'he' => __( 'Hebrew', 'procaptcha-wordpress' ),
// 'hi' => __( 'Hindi', 'procaptcha-wordpress' ),
// 'hmn' => __( 'Hmong', 'procaptcha-wordpress' ),
// 'hu' => __( 'Hungarian', 'procaptcha-wordpress' ),
// 'is' => __( 'Icelandic', 'procaptcha-wordpress' ),
// 'ig' => __( 'Igbo', 'procaptcha-wordpress' ),
// 'id' => __( 'Indonesian', 'procaptcha-wordpress' ),
// 'ga' => __( 'Irish', 'procaptcha-wordpress' ),
// 'it' => __( 'Italian', 'procaptcha-wordpress' ),
// 'ja' => __( 'Japanese', 'procaptcha-wordpress' ),
// 'jw' => __( 'Javanese', 'procaptcha-wordpress' ),
// 'kn' => __( 'Kannada', 'procaptcha-wordpress' ),
// 'kk' => __( 'Kazakh', 'procaptcha-wordpress' ),
// 'km' => __( 'Khmer', 'procaptcha-wordpress' ),
// 'rw' => __( 'Kinyarwanda', 'procaptcha-wordpress' ),
// 'ky' => __( 'Kirghiz', 'procaptcha-wordpress' ),
// 'ko' => __( 'Korean', 'procaptcha-wordpress' ),
// 'ku' => __( 'Kurdish', 'procaptcha-wordpress' ),
// 'lo' => __( 'Lao', 'procaptcha-wordpress' ),
// 'la' => __( 'Latin', 'procaptcha-wordpress' ),
// 'lv' => __( 'Latvian', 'procaptcha-wordpress' ),
// 'lt' => __( 'Lithuanian', 'procaptcha-wordpress' ),
// 'lb' => __( 'Luxembourgish', 'procaptcha-wordpress' ),
// 'mk' => __( 'Macedonian', 'procaptcha-wordpress' ),
// 'mg' => __( 'Malagasy', 'procaptcha-wordpress' ),
// 'ms' => __( 'Malay', 'procaptcha-wordpress' ),
// 'ml' => __( 'Malayalam', 'procaptcha-wordpress' ),
// 'mt' => __( 'Maltese', 'procaptcha-wordpress' ),
// 'mi' => __( 'Maori', 'procaptcha-wordpress' ),
// 'mr' => __( 'Marathi', 'procaptcha-wordpress' ),
// 'mn' => __( 'Mongolian', 'procaptcha-wordpress' ),
// 'ne' => __( 'Nepali', 'procaptcha-wordpress' ),
// 'no' => __( 'Norwegian', 'procaptcha-wordpress' ),
// 'ny' => __( 'Nyanja', 'procaptcha-wordpress' ),
// 'or' => __( 'Oriya', 'procaptcha-wordpress' ),
// 'pl' => __( 'Polish', 'procaptcha-wordpress' ),
// 'pt' => __( 'Portuguese', 'procaptcha-wordpress' ),
// 'ps' => __( 'Pashto', 'procaptcha-wordpress' ),
// 'pa' => __( 'Punjabi', 'procaptcha-wordpress' ),
// 'ro' => __( 'Romanian', 'procaptcha-wordpress' ),
// 'ru' => __( 'Russian', 'procaptcha-wordpress' ),
// 'sm' => __( 'Samoan', 'procaptcha-wordpress' ),
// 'sn' => __( 'Shona', 'procaptcha-wordpress' ),
// 'sd' => __( 'Sindhi', 'procaptcha-wordpress' ),
// 'si' => __( 'Sinhala', 'procaptcha-wordpress' ),
// 'sr' => __( 'Serbian', 'procaptcha-wordpress' ),
// 'sk' => __( 'Slovak', 'procaptcha-wordpress' ),
// 'sl' => __( 'Slovenian', 'procaptcha-wordpress' ),
// 'so' => __( 'Somali', 'procaptcha-wordpress' ),
// 'st' => __( 'Southern Sotho', 'procaptcha-wordpress' ),
// 'es' => __( 'Spanish', 'procaptcha-wordpress' ),
// 'su' => __( 'Sundanese', 'procaptcha-wordpress' ),
// 'sw' => __( 'Swahili', 'procaptcha-wordpress' ),
// 'sv' => __( 'Swedish', 'procaptcha-wordpress' ),
// 'tl' => __( 'Tagalog', 'procaptcha-wordpress' ),
// 'tg' => __( 'Tajik', 'procaptcha-wordpress' ),
// 'ta' => __( 'Tamil', 'procaptcha-wordpress' ),
// 'tt' => __( 'Tatar', 'procaptcha-wordpress' ),
// 'te' => __( 'Telugu', 'procaptcha-wordpress' ),
// 'th' => __( 'Thai', 'procaptcha-wordpress' ),
// 'tr' => __( 'Turkish', 'procaptcha-wordpress' ),
// 'tk' => __( 'Turkmen', 'procaptcha-wordpress' ),
// 'ug' => __( 'Uyghur', 'procaptcha-wordpress' ),
// 'uk' => __( 'Ukrainian', 'procaptcha-wordpress' ),
// 'ur' => __( 'Urdu', 'procaptcha-wordpress' ),
// 'uz' => __( 'Uzbek', 'procaptcha-wordpress' ),
// 'vi' => __( 'Vietnamese', 'procaptcha-wordpress' ),
// 'cy' => __( 'Welsh', 'procaptcha-wordpress' ),
// 'xh' => __( 'Xhosa', 'procaptcha-wordpress' ),
// 'yi' => __( 'Yiddish', 'procaptcha-wordpress' ),
// 'yo' => __( 'Yoruba', 'procaptcha-wordpress' ),
// 'zu' => __( 'Zulu', 'procaptcha-wordpress' ),
// ],
// 'helper' => __(
// "By default, hCaptcha will automatically detect the user's locale and localize widgets accordingly.",
// 'procaptcha-wordpress'
// ),
// ],
// 'mode' => [
// 'label' => __( 'Mode', 'procaptcha-wordpress' ),
// 'type' => 'select',
// 'section' => self::SECTION_APPEARANCE,
// // phpcs:disable WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned, WordPress.Arrays.MultipleStatementAlignment.LongIndexSpaceBeforeDoubleArrow
// 'options' => [
// self::MODE_LIVE => __( 'Live', 'procaptcha-wordpress' ),
// self::MODE_TEST_PUBLISHER => __( 'Test: Publisher Account', 'procaptcha-wordpress' ),
// self::MODE_TEST_ENTERPRISE_SAFE_END_USER => __( 'Test: Enterprise Account (Safe End User)', 'procaptcha-wordpress' ),
// self::MODE_TEST_ENTERPRISE_BOT_DETECTED => __( 'Test: Enterprise Account (Bot Detected)', 'procaptcha-wordpress' ),
// ],
// // phpcs:enable WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned, WordPress.Arrays.MultipleStatementAlignment.LongIndexSpaceBeforeDoubleArrow
// 'default' => self::MODE_LIVE,
// 'helper' => __(
// 'Select live or test mode. In test mode, predefined keys are used.',
// 'procaptcha-wordpress'
// ),
// ],
// 'force' => [
// 'label' => __( 'Force hCaptcha', 'procaptcha-wordpress' ),
// 'type' => 'checkbox',
// 'section' => self::SECTION_APPEARANCE,
// 'options' => [
// 'on' => __( 'Force hCaptcha', 'procaptcha-wordpress' ),
// ],
// 'helper' => __( 'Force hCaptcha check before submit.', 'procaptcha-wordpress' ),
// ],
// 'custom_themes' => [
// 'label' => __( 'Custom Themes', 'procaptcha-wordpress' ),
// 'type' => 'checkbox',
// 'section' => self::SECTION_CUSTOM,
// 'options' => [
// 'on' => __( 'Enable Custom Themes', 'procaptcha-wordpress' ),
// ],
// 'helper' => sprintf(
// * translators: 1: hCaptcha Pro link, 2: hCaptcha Enterprise link. */
// __( 'Note: only works on hCaptcha %1$s and %2$s site keys.', 'procaptcha-wordpress' ),
// sprintf(
// '<a href="https://www.prosopo.io/pro?utm_source=wordpress&utm_medium=wpplugin&utm_campaign=upgrade" target="_blank">%s</a>',
// __( 'Pro', 'procaptcha-wordpress' )
// ),
// sprintf(
// '<a href="https://www.prosopo.io/enterprise?utm_source=wordpress&utm_medium=wpplugin&utm_campaign=upgrade" target="_blank">%s</a>',
// __( 'Enterprise', 'procaptcha-wordpress' )
// )
// ),
// ],
// 'custom_prop' => [
// 'label' => __( 'Property', 'procaptcha-wordpress' ),
// 'type' => 'select',
// 'options' => [],
// 'section' => self::SECTION_CUSTOM,
// 'helper' => __( 'Select custom theme property.', 'procaptcha-wordpress' ),
// ],
// 'custom_value' => [
// 'label' => __( 'Value', 'procaptcha-wordpress' ),
// 'type' => 'text',
// 'section' => self::SECTION_CUSTOM,
// 'helper' => __( 'Set property value.', 'procaptcha-wordpress' ),
// ],
// 'config_params' => [
// 'label' => __( 'Config Params', 'procaptcha-wordpress' ),
// 'type' => 'textarea',
// 'section' => self::SECTION_CUSTOM,
// 'helper' => sprintf(
// * translators: 1: hCaptcha render params doc link. */
// __( 'hCaptcha render %s (optional). Must be a valid JSON.', 'procaptcha-wordpress' ),
// sprintf(
// '<a href="https://docs.prosopo.io/configuration/#hcaptcharendercontainer-params?utm_source=wordpress&utm_medium=wpplugin&utm_campaign=docs" target="_blank">%s</a>',
// __( 'parameters', 'procaptcha-wordpress' )
// )
// ),
// ],
// 'api_host' => [
// 'label' => __( 'API Host', 'procaptcha-wordpress' ),
// 'type' => 'text',
// 'section' => self::SECTION_ENTERPRISE,
// 'default' => Main::API_HOST,
// 'helper' => __( 'See Enterprise docs.' ),
// ],
// 'asset_host' => [
// 'label' => __( 'Asset Host', 'procaptcha-wordpress' ),
// 'type' => 'text',
// 'section' => self::SECTION_ENTERPRISE,
// 'helper' => __( 'See Enterprise docs.', 'procaptcha-wordpress' ),
// ],
// 'endpoint' => [
// 'label' => __( 'Endpoint', 'procaptcha-wordpress' ),
// 'type' => 'text',
// 'section' => self::SECTION_ENTERPRISE,
// 'helper' => __( 'See Enterprise docs.', 'procaptcha-wordpress' ),
// ],
// 'host' => [
// 'label' => __( 'Host', 'procaptcha-wordpress' ),
// 'type' => 'text',
// 'section' => self::SECTION_ENTERPRISE,
// 'helper' => __( 'See Enterprise docs.', 'procaptcha-wordpress' ),
// ],
// 'image_host' => [
// 'label' => __( 'Image Host', 'procaptcha-wordpress' ),
// 'type' => 'text',
// 'section' => self::SECTION_ENTERPRISE,
// 'helper' => __( 'See Enterprise docs.', 'procaptcha-wordpress' ),
// ],
// 'report_api' => [
// 'label' => __( 'Report API', 'procaptcha-wordpress' ),
// 'type' => 'text',
// 'section' => self::SECTION_ENTERPRISE,
// 'helper' => __( 'See Enterprise docs.', 'procaptcha-wordpress' ),
// ],
// 'sentry' => [
// 'label' => __( 'Sentry', 'procaptcha-wordpress' ),
// 'type' => 'text',
// 'section' => self::SECTION_ENTERPRISE,
// 'helper' => __( 'See Enterprise docs.', 'procaptcha-wordpress' ),
// ],
// 'backend' => [
// 'label' => __( 'Backend', 'procaptcha-wordpress' ),
// 'type' => 'text',
// 'section' => self::SECTION_ENTERPRISE,
// 'default' => Main::VERIFY_HOST,
// 'helper' => __( 'See Enterprise docs.', 'procaptcha-wordpress' ),
// ],
// 'off_when_logged_in' => [
// 'label' => __( 'Other Settings', 'procaptcha-wordpress' ),
// 'type' => 'checkbox',
// 'section' => self::SECTION_OTHER,
// 'options' => [
// 'on' => __( 'Turn Off When Logged In', 'procaptcha-wordpress' ),
// ],
// 'helper' => __( 'Do not show hCaptcha to logged-in users.', 'procaptcha-wordpress' ),
// ],
// 'recaptcha_compat_off' => [
// 'type' => 'checkbox',
// 'section' => self::SECTION_OTHER,
// 'options' => [
// 'on' => __( 'Disable reCAPTCHA Compatibility', 'procaptcha-wordpress' ),
// ],
// 'helper' => __( 'Use if including both hCaptcha and reCAPTCHA on the same page.', 'procaptcha-wordpress' ),
// ],
// self::NETWORK_WIDE => [
// 'type' => 'checkbox',
// 'section' => self::SECTION_OTHER,
// 'options' => [
// 'on' => __( 'Use network-wide settings', 'procaptcha-wordpress' ),
// ],
// 'helper' => __( 'On multisite, use same settings for all sites of the network.', 'procaptcha-wordpress' ),
// ],
// 'whitelisted_ips' => [
// 'label' => __( 'Whitelisted IPs', 'procaptcha-wordpress' ),
// 'type' => 'textarea',
// 'section' => self::SECTION_OTHER,
// 'helper' => __( 'Do not show hCaptcha for listed IP addresses. Please specify one IP address per line.', 'procaptcha-wordpress' ),
// ],
// 'login_limit' => [
// 'label' => __( 'Login attempts before hCaptcha', 'procaptcha-wordpress' ),
// 'type' => 'number',
// 'section' => self::SECTION_OTHER,
// 'default' => 0,
// 'min' => 0,
// 'helper' => __( 'Maximum number of failed login attempts before showing hCaptcha.', 'procaptcha-wordpress' ),
// ],
// 'login_interval' => [
// 'label' => __( 'Failed login attempts interval, min', 'procaptcha-wordpress' ),
// 'type' => 'number',
// 'section' => self::SECTION_OTHER,
// 'default' => 15,
// 'min' => 1,
// 'helper' => __( 'Time interval in minutes when failed login attempts are counted.', 'procaptcha-wordpress' ),
// ],
// 'delay' => [
// 'label' => __( 'Delay showing hCaptcha, ms', 'procaptcha-wordpress' ),
// 'type' => 'number',
// 'section' => self::SECTION_OTHER,
// 'default' => -100,
// 'min' => -100,
// 'step' => 100,
// 'helper' => __( 'Delay time for loading the hCaptcha API script. Any negative value will prevent the API script from loading until user interaction: mouseenter, click, scroll or touch. This significantly improves Google Pagespeed Insights score.', 'procaptcha-wordpress' ),
// ],
// 'statistics' => [
// 'label' => __( 'Statistics', 'procaptcha-wordpress' ),
// 'type' => 'checkbox',
// 'section' => self::SECTION_STATISTICS,
// 'options' => [
// 'on' => __( 'Enable Statistics', 'procaptcha-wordpress' ),
// ],
// 'helper' => __( 'By turning the statistics on, you agree to the collection of non-personal data to improve the plugin.', 'procaptcha-wordpress' ),
// ],
// 'collect_ip' => [
// 'label' => __( 'Collection', 'procaptcha-wordpress' ),
// 'type' => 'checkbox',
// 'section' => self::SECTION_STATISTICS,
// 'options' => [
// 'on' => __( 'Collect IP', 'procaptcha-wordpress' ),
// ],
// 'helper' => __( 'Allow collecting of IP addresses from which forms were sent.', 'procaptcha-wordpress' ),
// ],
// 'collect_ua' => [
// 'type' => 'checkbox',
// 'section' => self::SECTION_STATISTICS,
// 'options' => [
// 'on' => __( 'Collect User Agent', 'procaptcha-wordpress' ),
// ],
// 'helper' => __( 'Allow collecting of User Agent headers of users sending forms.', 'procaptcha-wordpress' ),
// ],
];

if ( ! is_multisite() ) {
Expand Down
4 changes: 2 additions & 2 deletions src/php/includes/request.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function hcap_check_site_config(): array {
$raw_response = wp_remote_post(
$url,
array(
'body' => json_encode( $params ),
'body' => wp_json_encode( $params ),
'headers' => array(
'Content-Type' => 'application/json; charset=utf-8',
),
Expand Down Expand Up @@ -166,7 +166,7 @@ function hcap_check_site_config(): array {
];
}

if ( isset( $body['dapp']['status'] ) && 'Active' != $body['dapp']['status'] ) {
if ( isset( $body['dapp']['status'] ) && 'Active' !== $body['dapp']['status'] ) {
return [
'error' => __( 'Site key is not active', 'procaptcha-wordpress' ),
];
Expand Down

0 comments on commit 0a8f6f1

Please sign in to comment.