Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions classes/controllers/FrmAbilitiesEntriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ private static function register_list_entries_ability() {
'description' => __( 'Retrieve a list of Formidable entries (form submissions). Use list-forms to find the form_id.', 'formidable' ),
'category' => FrmAbilitiesController::CATEGORY,
'input_schema' => array(
'default' => array(),
'type' => 'object',
'properties' => array(
'form_id' => array(
Expand Down
1 change: 1 addition & 0 deletions classes/controllers/FrmAbilitiesFormsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ private static function register_list_forms_ability() {
),
'category' => FrmAbilitiesController::CATEGORY,
'input_schema' => array(
'default' => array(),
'type' => 'object',
'properties' => array(
'page' => array(
Expand Down
1 change: 1 addition & 0 deletions classes/controllers/FrmAbilitiesPaymentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ private static function register_list_payments_ability() {
),
'category' => FrmAbilitiesController::CATEGORY,
'input_schema' => array(
'default' => array(),
'type' => 'object',
'properties' => array(
'form_id' => array(
Expand Down
1 change: 1 addition & 0 deletions classes/controllers/FrmAbilitiesStylesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ private static function register_list_styles_ability() {
),
'category' => FrmAbilitiesController::CATEGORY,
'input_schema' => array(
'default' => array(),
'type' => 'object',
'properties' => array(
'page' => array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ private static function register_list_subscriptions_ability() {
),
'category' => FrmAbilitiesController::CATEGORY,
'input_schema' => array(
'default' => array(),
'type' => 'object',
'properties' => array(
'form_id' => array(
Expand Down
4 changes: 1 addition & 3 deletions classes/controllers/FrmMcpSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,7 @@ private static function build_connection_prompt( $install_step ) {
home_url()
),
$install_step . ' ' . __( 'If the skill only loads after a restart, tell me.', 'formidable' ),
// The config directory, not the skill's scripts directory: a plugin
// install keeps scripts in a versioned cache that every update replaces.
__( '2. Find the newest frm-mcp*.env file in my Downloads folder and move it to ~/.config/formidable-mcp/frm-mcp.env.', 'formidable' )
__( '2. Move the newest frm-mcp*.env file from my Downloads folder to frm-mcp.env beside the installed skill\'s scripts/frm-mcp helper.', 'formidable' )
. ' ' . __( 'Create the folder if needed, and replace any older file there.', 'formidable' )
. ' ' . __( 'Do not open, print, or paste the file or its credentials into chat.', 'formidable' ),
__( '3. Run the skill\'s scripts/frm-mcp-setup script to confirm the connection, then use the scripts/frm-mcp helper for my Formidable requests.', 'formidable' )
Expand Down
2 changes: 2 additions & 0 deletions classes/models/FrmHcaptchaSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public function get_error_code_messages() {
array(
'invalid-or-already-seen-response' => __( 'The CAPTCHA response expired or was already used.', 'formidable' ),
'not-using-dummy-passcode' => __( 'A test site key is paired with a live secret key. Use a matching pair in the global CAPTCHA settings.', 'formidable' ),
'not-using-dummy-secret' => __( 'A test site key is paired with a live secret key. Use a matching pair in the global CAPTCHA settings.', 'formidable' ),
'sitekey-secret-mismatch' => __( 'The site key and secret key in the global CAPTCHA settings belong to different hCaptcha accounts.', 'formidable' ),
'invalid-sitekey' => __( 'The site key in the global CAPTCHA settings is not valid.', 'formidable' ),
'invalid-remoteip' => __( 'The visitor IP address sent for verification was not valid.', 'formidable' ),
Expand All @@ -96,6 +97,7 @@ public function get_configuration_error_codes() {
parent::get_configuration_error_codes(),
array(
'not-using-dummy-passcode',
'not-using-dummy-secret',
'sitekey-secret-mismatch',
'invalid-sitekey',
)
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmMcpCompat.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ private static function detect_unsupported_reason() {
}

if ( array() !== self::missing_ability_functions() ) {
return __( 'The WordPress Abilities API the MCP server is built on is not available on this site. It is part of WordPress 7.0 and newer.', 'formidable' );
return __( 'The WordPress Abilities API the MCP server is built on is not available on this site. It is part of WordPress 6.9 and newer.', 'formidable' );
}

if ( ! class_exists( self::ADAPTER_CLASS ) ) {
Expand Down
2 changes: 1 addition & 1 deletion classes/views/frm-fields/back-end/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@
<p class="frm_form_field">
<label class="frm-force-flex frm-gap-xs" for="frm_show_image_<?php echo esc_attr( $field['id'] ); ?>">
<input class="frm-m-0" type="checkbox" id="frm_show_image_<?php echo esc_attr( $field['id'] ); ?>" name="field_options[show_image_<?php echo esc_attr( $field['id'] ); ?>]" value="1" <?php checked( $field['show_image'], 1 ); ?> />
<span class="-frm-mt-2xs"><?php esc_html_e( 'If this URL points to an image, show to image on the entries listing page.', 'formidable' ); ?></span>
<span class="-frm-mt-2xs"><?php esc_html_e( 'If this URL points to an image, show the image on the entries listing page.', 'formidable' ); ?></span>
</label>
</p>
<?php } ?>
Expand Down
26 changes: 26 additions & 0 deletions tests/phpunit/abilities/test_FrmAbilitiesContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,34 @@ class test_FrmAbilitiesContract extends FrmUnitTest {
'formidable-forms/list-forms',
'formidable-forms/list-entries',
'formidable-forms/list-styles',
'formidable-forms/list-payments',
'formidable-forms/list-subscriptions',
);

/**
* @return void
*/
public function test_optional_input_abilities_accept_omitted_input() {
foreach ( self::$no_required_input_abilities as $name ) {
$this->assertNotWPError( wp_get_ability( $name )->execute(), $name . ' should accept omitted input.' );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call to an undefined method test_FrmAbilitiesContract::assertNotWPError()


The method you are trying to call is not defined, which can result in a fatal error.

}
}

/**
* @return void
*/
public function test_required_input_abilities_reject_omitted_input() {
foreach ( $this->get_formidable_abilities() as $name => $ability ) {
$schema = $ability->get_input_schema();

if ( empty( $schema['required'] ) ) {
continue;
}

$this->assertWPError( $ability->execute(), $name . ' should require its input.' );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call to an undefined method test_FrmAbilitiesContract::assertWPError()


The method you are trying to call is not defined, which can result in a fatal error.

}
}

/**
* @return void
*/
Expand Down
30 changes: 30 additions & 0 deletions tests/phpunit/fields/test_FrmCaptchaSpam.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,36 @@ public function test_configuration_error_can_be_saved_with_actual_reason() {
$this->assertStringContainsString( 'invalid-input-secret', $reason, 'The configuration error code should be stored.' );
}

/**
* @return void
*/
public function test_hcaptcha_test_key_mismatch_keeps_configuration_message() {
$settings = FrmAppHelper::get_settings();
$settings->active_captcha = 'hcaptcha';
$settings->hcaptcha_pubkey = 'test-site-key';
$settings->hcaptcha_privkey = 'test-secret-key';
$_POST = array( 'h-captcha-response' => 'test-token' );

foreach ( array( 'not-using-dummy-passcode', 'not-using-dummy-secret' ) as $code ) {
FrmSpamEntriesHelper::reset_flags();
$settings->spam_handling['captcha'] = FrmSpamEntriesHelper::BLOCK;
$this->response = array(
'body' => wp_json_encode(
array(
'success' => false,
'error-codes' => array( $code ),
)
),
);
$errors = $this->validate_captcha();
$this->assertStringContainsString( 'not set up correctly', $errors[ 'field' . $this->captcha->id ], $code );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call to an undefined method test_FrmCaptchaSpam::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

$settings->spam_handling['captcha'] = FrmSpamEntriesHelper::SAVE;
$this->assertSame( array(), $this->validate_captcha() );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call to an undefined method test_FrmCaptchaSpam::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

$reason = FrmSpamEntriesHelper::get_flagged_reason( array( 'form_id' => $this->captcha->form_id ) );
$this->assertStringContainsString( 'matching pair', $reason, $code );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call to an undefined method test_FrmCaptchaSpam::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

}
}

public function test_unknown_service_error_code_is_preserved() {
FrmAppHelper::get_settings()->spam_handling['captcha'] = FrmSpamEntriesHelper::SAVE;
$this->response = array(
Expand Down
Loading