Skip to content

Rock: NPS Survey in Lite Plugin#3087

Draft
shervElmi wants to merge 13 commits intomasterfrom
rock/nps-survey-lite
Draft

Rock: NPS Survey in Lite Plugin#3087
shervElmi wants to merge 13 commits intomasterfrom
rock/nps-survey-lite

Conversation

@shervElmi
Copy link
Copy Markdown
Contributor

@shervElmi shervElmi commented Apr 22, 2026

@shervElmi shervElmi self-assigned this Apr 22, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: affa881b-c794-4fd5-aed9-e789a72044ba

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rock/nps-survey-lite

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@deepsource-io
Copy link
Copy Markdown

deepsource-io Bot commented Apr 22, 2026

DeepSource Code Review

We reviewed changes in 1d27050...47372a0 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Apr 28, 2026 3:54p.m. Review ↗
JavaScript Apr 28, 2026 3:54p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

*
* @var string
*/
const PLUGIN_FEEDBACK_META_KEY = 'frm-plugin-feedback';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Visibility should be explicitly set for `PLUGIN_FEEDBACK_META_KEY` constant


Visibility (also know as Access Modifiers) can be used to define where it can be accessed. There are three access modifiers available in PHP:

  • public - The class members can be accessed from everywhere. This is default.
  • protected - The class members can be accessed within the class and by classes derived from that class.
  • private - The class members can only be accessed within the class.

The class members(properties, constants, or methods) declared without any explicit visibility keyword are by default considered as public. It is recommended to set visibility explicitly, which increases code readability. In addition, it gives the developer a mental model of where the class member would be accessible, which also leads to a better API design and makes sure that you are not making something public which isn't supposed to be.
Also, as per PSR-12: Extended Coding Style, visibility should be explicitly declared with all class properties, constants and methods.

*
* @var string
*/
const SOURCE = 'lite';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Visibility should be explicitly set for `SOURCE` constant


Visibility (also know as Access Modifiers) can be used to define where it can be accessed. There are three access modifiers available in PHP:

  • public - The class members can be accessed from everywhere. This is default.
  • protected - The class members can be accessed within the class and by classes derived from that class.
  • private - The class members can only be accessed within the class.

The class members(properties, constants, or methods) declared without any explicit visibility keyword are by default considered as public. It is recommended to set visibility explicitly, which increases code readability. In addition, it gives the developer a mental model of where the class member would be accessible, which also leads to a better API design and makes sure that you are not making something public which isn't supposed to be.
Also, as per PSR-12: Extended Coding Style, visibility should be explicitly declared with all class properties, constants and methods.


$input_attrs = array(
'type' => 'radio',
'name' => $args['name'],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $args might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

<div class="frm-nps__buttons frm-flex frm-justify-center" role="radiogroup">
<?php
for ( $i = 0; $i <= 10; $i++ ) {
$input_attrs['id'] = $args['id'] . '-' . $i;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $args might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

$input_attrs['id'] = $args['id'] . '-' . $i;
$input_attrs['value'] = $i;
?>
<input <?php FrmAppHelper::array_to_html_params( $input_attrs, true ); ?> <?php checked( $i, $args['value'] ); ?>/>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $args might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

printf(
/* translators: %s is the negative statement. */
esc_html__( '0 - %s', 'formidable' ),
'<span>' . esc_html( $args['negative_statement'] ) . '</span>'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $args might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

printf(
/* translators: %s is the positive statement. */
esc_html__( '10 - %s', 'formidable' ),
'<span>' . esc_html( $args['positive_statement'] ) . '</span>'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $args might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

die( 'You are not allowed to call this page directly.' );
}
?>
<div id="frm-plugin-feedback" class="frm_wrap frm-dismissible" data-step="<?php echo esc_attr( $step ); ?>">
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $step might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

</a>

<form id="frm-plugin-feedback-form" class="frm-flex-col frm-gap-md frm-items-start" method="post" action="">
<div id="frm-plugin-feedback-nps-step" class="frm-plugin-feedback-step frm-flex-col frm-gap-xs <?php echo esc_attr( $step === 'nps' ? '' : 'frm_hidden' ); ?>">
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $step might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

<div id="frm-plugin-feedback-reasons-step" class="frm-plugin-feedback-step frm-w-full frm-flex-col frm-gap-sm <?php echo esc_attr( $step === 'reasons' ? '' : 'frm_hidden' ); ?>">
<h3 class="frm-text-md frm-font-semibold frm-m-0"><?php esc_html_e( 'Please select all the reasons for your score:', 'formidable' ); ?></h3>
<div class="frm_grid_container">
<?php foreach ( $reasons as $value => $label ) { ?>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $reasons might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

…cessibility. Changed private properties to protected, updated method visibility, and streamlined feedback display logic.
…t and dismiss actions to improve AJAX functionality.
… submit and dismiss actions, enhancing AJAX request handling.
die( 'You are not allowed to call this page directly.' );
}
?>
<div id="frm-plugin-feedback" class="frm_wrap frm-dismissible" data-step="<?php echo esc_attr( $step ); ?>" data-submit-action="<?php echo esc_attr( $config['ajax']['submit'] ); ?>" data-dismiss-action="<?php echo esc_attr( $config['ajax']['dismiss'] ); ?>">
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $config might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant