diff --git a/classes/controllers/FrmAddonsController.php b/classes/controllers/FrmAddonsController.php index 3a1812967f..ba75000939 100644 --- a/classes/controllers/FrmAddonsController.php +++ b/classes/controllers/FrmAddonsController.php @@ -103,7 +103,7 @@ public static function menu() { add_submenu_page( 'formidable', 'Formidable | ' . __( 'Add-Ons', 'formidable' ), $label, 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' ); - // remove default created subpage, make the page with highest priority as default. + // Remove default created subpage, make the page with highest priority as default. remove_submenu_page( 'formidable', 'formidable' ); if ( ! FrmAppHelper::pro_is_installed() ) { @@ -451,7 +451,7 @@ public static function get_pro_license() { } if ( str_contains( $license, '-' ) ) { - // this is a fix for licenses saved in the past + // This is a fix for licenses saved in the past $license = strtoupper( $license ); } @@ -571,7 +571,7 @@ public static function check_update( $transient ) { } if ( ! self::is_installed( $folder ) ) { - // don't show an update if the plugin isn't installed + // Don't show an update if the plugin isn't installed continue; } @@ -634,7 +634,7 @@ protected static function fill_update_addon_info( $installed_addons ) { foreach ( $installed_addons as $addon ) { if ( $addon->store_url !== 'https://formidableforms.com' ) { - // check if this is a third-party addon + // Check if this is a third-party addon continue; } @@ -661,7 +661,7 @@ protected static function fill_update_addon_info( $installed_addons ) { $download_id = $plugin['id'] ?? 0; if ( $download_id && ! isset( $version_info[ $download_id ]['package'] ) ) { - // if this addon is using its own license, get the update url + // If this addon is using its own license, get the update url $addon_info = $api->get_api_info(); $version_info[ $download_id ] = $addon_info[ $download_id ]; diff --git a/classes/controllers/FrmAppController.php b/classes/controllers/FrmAppController.php index 1f1886fb38..02ca28610c 100644 --- a/classes/controllers/FrmAppController.php +++ b/classes/controllers/FrmAppController.php @@ -634,7 +634,7 @@ public static function admin_init() { } if ( ! FrmAppHelper::doing_ajax() ) { - // don't continue during ajax calls + // Don't continue during ajax calls self::admin_js(); } @@ -1167,7 +1167,7 @@ public static function network_upgrade_site( $blog_id = 0 ) { } if ( $response->is_error() ) { - // if the remove post fails, use javascript instead + // If the remove post fails, use javascript instead add_action( 'admin_notices', 'FrmAppController::install_js_fallback' ); } } diff --git a/classes/controllers/FrmApplicationsController.php b/classes/controllers/FrmApplicationsController.php index bc27f1faa9..49b07d6343 100644 --- a/classes/controllers/FrmApplicationsController.php +++ b/classes/controllers/FrmApplicationsController.php @@ -82,7 +82,7 @@ public static function get_applications_data() { if ( 'applications' !== $view ) { FrmAppHelper::permission_check( self::get_required_capability() ); - // view may be 'applications', 'templates', or empty. + // View may be 'applications', 'templates', or empty. $data['templates'] = self::get_prepared_template_data(); $data['categories'] = FrmApplicationTemplate::get_categories(); } else { diff --git a/classes/controllers/FrmDashboardController.php b/classes/controllers/FrmDashboardController.php index 3c269f38ff..178c91d8a3 100644 --- a/classes/controllers/FrmDashboardController.php +++ b/classes/controllers/FrmDashboardController.php @@ -445,7 +445,7 @@ private static function inbox_prepare_messages( $data ) { * @return string */ private static function inbox_clean_messages_cta( $cta ) { - // remove dismiss button + // Remove dismiss button $pattern = '/]*class="[^"]*frm_inbox_dismiss[^"]*"[^>]*>.*?<\/a>/is'; return preg_replace( $pattern, ' ', $cta ); } diff --git a/classes/controllers/FrmFieldsController.php b/classes/controllers/FrmFieldsController.php index ecf2a91ba8..d326cd5d9c 100644 --- a/classes/controllers/FrmFieldsController.php +++ b/classes/controllers/FrmFieldsController.php @@ -37,7 +37,7 @@ public static function load_field() { $field = json_decode( $field ); if ( ! isset( $field->id ) || ! is_numeric( $field->id ) ) { - // this field may have already been loaded + // This field may have already been loaded continue; } @@ -73,7 +73,7 @@ public static function create() { $field = self::include_new_field( $field_type, $form_id, $field_options ); - // this hook will allow for multiple fields to be added at once + // This hook will allow for multiple fields to be added at once do_action( 'frm_after_field_created', $field, $form_id ); wp_die(); @@ -625,7 +625,7 @@ private static function add_html_cols( $field, array &$add_html ) { 'em' => 0.544, ); - // include "col" for valid html + // Include "col" for valid html $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); if ( ! isset( $calc[ $unit ] ) ) { @@ -684,7 +684,7 @@ private static function add_html_placeholder( $field, array &$add_html, array &$ // phpcs:ignore Universal.Operators.StrictComparisons if ( $field['placeholder'] == '' || is_array( $field['placeholder'] ) ) { - // don't include a json placeholder + // Don't include a json placeholder return; } diff --git a/classes/controllers/FrmFormActionsController.php b/classes/controllers/FrmFormActionsController.php index 3872d7d195..ad33f6b6e7 100644 --- a/classes/controllers/FrmFormActionsController.php +++ b/classes/controllers/FrmFormActionsController.php @@ -386,7 +386,7 @@ public static function list_actions( $form, $values ) { foreach ( $form_actions as $action ) { if ( ! isset( $action_map[ $action->post_excerpt ] ) ) { - // don't try and show settings if action no longer exists + // Don't try and show settings if action no longer exists continue; } @@ -695,7 +695,7 @@ public static function trigger_actions( $event, $form, $entry, $type = 'all', $a $child_entry = ( is_numeric( $form->parent_form_id ) && $form->parent_form_id ) || ( $entry && ( (int) $entry->form_id !== (int) $form->id || $entry->parent_item_id ) ) || ! empty( $args['is_child'] ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong if ( $child_entry ) { - // maybe trigger actions for sub forms + // Maybe trigger actions for sub forms $trigger_children = apply_filters( 'frm_use_embedded_form_actions', false, compact( 'form', 'entry' ) ); if ( ! $trigger_children ) { @@ -839,7 +839,7 @@ public function _register_actions() { $keys = array_keys( $this->actions ); foreach ( $keys as $key ) { - // don't register new action if old action with the same id is already registered + // Don't register new action if old action with the same id is already registered if ( ! isset( $this->actions[ $key ] ) ) { $this->actions[ $key ]->_register(); } diff --git a/classes/controllers/FrmFormsController.php b/classes/controllers/FrmFormsController.php index 0b5b3a15ad..a3205657ec 100644 --- a/classes/controllers/FrmFormsController.php +++ b/classes/controllers/FrmFormsController.php @@ -603,7 +603,7 @@ private static function fallback_when_page_template_part_is_not_supported_by_the the_post(); self::get_template( 'header' ); - // add some generic class names to the container to add some natural padding to the content. + // Add some generic class names to the container to add some natural padding to the content. // .entry-content catches the WordPress TwentyTwenty theme. // .container catches Customizr content. echo '
'; @@ -1068,7 +1068,7 @@ public static function insert_form_button() { // Store the result in memory and re-use it when this function is called multiple times. // This helps speed up the form builder when there are a lot of HTML fields, where this - // button is inserted once per HTML field. + // Button is inserted once per HTML field. // In a form with 66 HTML fields, this saves 0.5 seconds on page load time, tested locally. if ( ! isset( self::$formidable_tinymce_button ) ) { FrmAppHelper::load_admin_wide_js(); @@ -1100,7 +1100,7 @@ public static function insert_form_popup() { include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php'; if ( FrmAppHelper::is_form_builder_page() && ! class_exists( '_WP_Editors', false ) ) { - // initialize a wysiwyg so we have usable settings defined in tinyMCEPreInit.mceInit + // Initialize a wysiwyg so we have usable settings defined in tinyMCEPreInit.mceInit require ABSPATH . WPINC . '/class-wp-editor.php'; ?>
@@ -1163,7 +1163,7 @@ public static function get_shortcode_opts() { $opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode ); if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) { - // allow other shortcodes to use the required form id option + // Allow other shortcodes to use the required form id option $form_id = $opts['form_id']; unset( $opts['form_id'] ); } @@ -2100,7 +2100,7 @@ public static function route() { // phpcs:ignore Generic.Metrics.CyclomaticCompl $json_vars = json_decode( $json_vars, true ); if ( ! $json_vars ) { - // json decoding failed so we should return an error message. + // Json decoding failed so we should return an error message. $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); if ( 'edit' === $action ) { @@ -2447,7 +2447,7 @@ public static function show_form( $id = '', $key = '', $title = false, $descript $frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form->id ) ); if ( self::is_viewable_draft_form( $form ) ) { - // don't show a draft form on a page + // Don't show a draft form on a page $form = __( 'Please select a valid form', 'formidable' ); } elseif ( ! FrmForm::is_visible_to_user( $form ) ) { $form = do_shortcode( $frm_settings->login_msg ); @@ -3433,7 +3433,7 @@ public static function front_head() { add_filter( 'script_loader_tag', 'FrmFormsController::defer_script_loading', 10, 2 ); if ( FrmAppHelper::is_admin() ) { - // don't load this in back-end + // Don't load this in back-end return; } @@ -3528,7 +3528,7 @@ public static function footer_js( $location = 'footer' ) { FrmStylesController::enqueue_css(); if ( ! FrmAppHelper::is_admin() && $location !== 'header' && ! empty( $frm_vars['forms_loaded'] ) ) { - // load formidable js + // Load formidable js wp_enqueue_script( 'formidable' ); FrmHoneypot::maybe_print_honeypot_js(); @@ -3544,7 +3544,7 @@ public static function footer_js( $location = 'footer' ) { * @return void */ private static function maybe_minimize_form( $atts, &$content ) { - // check if minimizing is turned on + // Check if minimizing is turned on if ( self::is_minification_on( $atts ) ) { $content = str_replace( array( "\r\n", "\r", "\n", "\t", ' ' ), '', $content ); } diff --git a/classes/controllers/FrmSimpleBlocksController.php b/classes/controllers/FrmSimpleBlocksController.php index b186c9510d..d31dec3518 100644 --- a/classes/controllers/FrmSimpleBlocksController.php +++ b/classes/controllers/FrmSimpleBlocksController.php @@ -222,7 +222,7 @@ public static function simple_form_render( $attributes ) { unset( $params['formId'] ); // Still pass false for title and description options if nothing is set, - // so a default doesn't overwrite the block option. + // So a default doesn't overwrite the block option. $params['title'] = ! empty( $params['title'] ); $params['description'] = ! empty( $params['description'] ); diff --git a/classes/controllers/FrmStylesController.php b/classes/controllers/FrmStylesController.php index 58ce5c1718..c47638c0f9 100644 --- a/classes/controllers/FrmStylesController.php +++ b/classes/controllers/FrmStylesController.php @@ -1045,7 +1045,7 @@ public static function change_styling() { * @return void */ public static function add_meta_boxes() { - // setup meta boxes + // Setup meta boxes $meta_boxes = array( 'general' => __( 'General', 'formidable' ), 'form-title' => __( 'Form Title', 'formidable' ), @@ -1343,7 +1343,7 @@ public static function important_style( $important, $field ) { public static function do_accordion_sections( $screen, $context, $data_object ) { // phpcs:ignore SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh global $wp_meta_boxes; - // the symbol id from icons.svg + // The symbol id from icons.svg $icon_ids = array( 'ranking-fields-style' => 'frm_chart_bar_icon', 'section-fields-style' => 'frm-form-title-style', diff --git a/classes/controllers/FrmXMLController.php b/classes/controllers/FrmXMLController.php index 8c63cc6a27..3208c81d9b 100644 --- a/classes/controllers/FrmXMLController.php +++ b/classes/controllers/FrmXMLController.php @@ -385,7 +385,7 @@ public static function import_xml() { $file_type = strtolower( pathinfo( $file_type, PATHINFO_EXTENSION ) ); if ( 'xml' !== $file_type && isset( $export_format[ $file_type ] ) ) { - // allow other file types to be imported + // Allow other file types to be imported do_action( 'frm_before_import_' . $file_type ); return; @@ -604,12 +604,12 @@ private static function prepare_types_array( &$type ) { $type = (array) $type; if ( ! in_array( 'forms', $type, true ) && ( in_array( 'items', $type, true ) || in_array( 'posts', $type, true ) ) ) { - // make sure the form is included if there are entries + // Make sure the form is included if there are entries $type[] = 'forms'; } if ( in_array( 'forms', $type, true ) ) { - // include actions with forms + // Include actions with forms $type[] = 'actions'; } } @@ -629,7 +629,7 @@ private static function get_file_name( $args, $records ) { $has_one_form = ! empty( $records['forms'] ) && count( $args['ids'] ) === 1; if ( $has_one_form ) { - // one form is being exported + // One form is being exported $selected_form_id = reset( $args['ids'] ); $filename = 'form-' . $selected_form_id . '.xml'; @@ -782,12 +782,12 @@ public static function get_fields_for_csv_export( $form_id, $form ) { */ public static function allow_mime( $mimes ) { if ( ! isset( $mimes['csv'] ) ) { - // allow csv files + // Allow csv files $mimes['csv'] = 'text/csv'; } if ( ! isset( $mimes['xml'] ) ) { - // allow xml + // Allow xml $mimes['xml'] = 'text/xml'; } diff --git a/classes/factories/FrmFieldFactory.php b/classes/factories/FrmFieldFactory.php index a2b42619ae..19e07d743e 100644 --- a/classes/factories/FrmFieldFactory.php +++ b/classes/factories/FrmFieldFactory.php @@ -122,7 +122,7 @@ private static function get_field_type_class( $field_type ) { public static function field_has_html( $type ) { $has_html = self::field_has_property( $type, 'has_html' ); - // this hook is here for reverse compatibility since 3.0 + // This hook is here for reverse compatibility since 3.0 return apply_filters( 'frm_show_custom_html', $has_html, $type ); } diff --git a/classes/helpers/FrmApiHelper.php b/classes/helpers/FrmApiHelper.php index e00f04f142..2973b099f3 100644 --- a/classes/helpers/FrmApiHelper.php +++ b/classes/helpers/FrmApiHelper.php @@ -100,7 +100,7 @@ private static function is_first_30() { if ( false === $activation_timestamp ) { // If the option does not exist, assume that it is - // because the user was active before this option was introduced. + // Because the user was active before this option was introduced. return false; } diff --git a/classes/helpers/FrmAppHelper.php b/classes/helpers/FrmAppHelper.php index df5d8922f7..5eff10c80a 100644 --- a/classes/helpers/FrmAppHelper.php +++ b/classes/helpers/FrmAppHelper.php @@ -498,7 +498,7 @@ public static function is_admin_page( $page = 'formidable' ) { $get_page = self::simple_get( 'page', 'sanitize_title' ); if ( $pagenow ) { - // allow this to be true during ajax load i.e. ajax form builder loading + // Allow this to be true during ajax load i.e. ajax form builder loading $is_page = ( $pagenow === 'admin.php' || $pagenow === 'admin-ajax.php' ) && $get_page === $page; if ( $is_page ) { @@ -3591,7 +3591,7 @@ public static function prepare_and_encode( $post_content ) { // Add extra slashes for \r\n since WP strips them. $post_content = str_replace( array( '\\r', '\\n', '\\u', '\\t' ), array( '\\\\r', '\\\\n', '\\\\u', '\\\\t' ), $post_content ); - // allow for " + // Allow for " return str_replace( '"', '\\"', $post_content ); } @@ -3939,7 +3939,7 @@ public static function localize_script( $location ) { 'noTitleText' => FrmFormsHelper::get_no_title_text(), // In older versions this event listener causes the section to immediately close again - // when the h3 element is clicked. It's only required in WP 6.7+. + // When the h3 element is clicked. It's only required in WP 6.7+. 'requireAccordionTitleClickListener' => version_compare( $wp_version, '6.7', '>=' ), ); /** @@ -4187,10 +4187,10 @@ public static function locales( $type = 'date' ) { ); if ( $type === 'captcha' ) { - // remove the languages unavailable for the captcha + // Remove the languages unavailable for the captcha $unset = array( 'sq', 'bs', 'eo', 'fo', 'fr-CH', 'sr-SR', 'ar-DZ', 'be', 'cy-GB', 'kk', 'km', 'ky', 'lb', 'mk', 'nb', 'nn', 'rm', 'tj' ); } else { - // remove the languages unavailable for the datepicker + // Remove the languages unavailable for the datepicker $unset = array( 'fil', 'fr-CA', 'de-AT', 'de-CH', 'iw', 'hi', 'pt', 'pt-PT', 'es-419', 'mr', 'lo', 'kn', 'si', 'gu', 'bn', 'zu', 'ur', 'te', 'sw', 'am' ); } diff --git a/classes/helpers/FrmCSVExportHelper.php b/classes/helpers/FrmCSVExportHelper.php index 90956ddf85..6bf31c5bd6 100644 --- a/classes/helpers/FrmCSVExportHelper.php +++ b/classes/helpers/FrmCSVExportHelper.php @@ -509,7 +509,7 @@ private static function prepare_next_csv_rows( $next_set ) { $order_by = ' ORDER BY parent_item_id DESC'; } else { // When Pro is not installed, only query for direct ID matches only as we do not expect parent item id - // matches and the more simplified query is faster. + // Matches and the more simplified query is faster. $where = array( 'id' => $next_set, ); @@ -557,11 +557,11 @@ private static function prepare_csv_row() { */ private static function add_repeat_field_values_to_csv( &$entries ) { if ( isset( self::$entry->metas ) ) { - // add child entries to the parent + // Add child entries to the parent foreach ( self::$entry->metas as $meta_id => $meta_value ) { if ( ! is_numeric( $meta_id ) || '' === $meta_value ) { - // if the hook is being used to include field keys in the metas array, - // we need to skip the keys and only process field ids + // If the hook is being used to include field keys in the metas array, + // We need to skip the keys and only process field ids continue; } @@ -573,8 +573,8 @@ private static function add_repeat_field_values_to_csv( &$entries ) { if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { - // if the data is here, it should be an array but if this field has collected data - // both while inside and outside of the repeating section, it's possible this is a string. + // If the data is here, it should be an array but if this field has collected data + // Both while inside and outside of the repeating section, it's possible this is a string. $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; } @@ -586,7 +586,7 @@ private static function add_repeat_field_values_to_csv( &$entries ) { $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; }//end if - // add the embedded form id + // Add the embedded form id if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); } @@ -803,7 +803,7 @@ private static function print_csv_row( $rows ) { } if ( is_array( $row ) ) { - // implode the repeated field values + // Implode the repeated field values $row = implode( self::$separator, FrmAppHelper::array_flatten( $row, 'reset' ) ); } @@ -845,7 +845,7 @@ public static function encode_value( $line ) { switch ( self::$to_encoding ) { case 'macintosh': - // this map was derived from the differences between the MacRoman and UTF-8 Charsets + // This map was derived from the differences between the MacRoman and UTF-8 Charsets // Reference: // http://www.alanwood.net/demos/macroman.html. $convmap = array( 256, 304, 0, 0xffff, 306, 337, 0, 0xffff, 340, 375, 0, 0xffff, 377, 401, 0, 0xffff, 403, 709, 0, 0xffff, 712, 727, 0, 0xffff, 734, 936, 0, 0xffff, 938, 959, 0, 0xffff, 961, 8210, 0, 0xffff, 8213, 8215, 0, 0xffff, 8219, 8219, 0, 0xffff, 8227, 8229, 0, 0xffff, 8231, 8239, 0, 0xffff, 8241, 8248, 0, 0xffff, 8251, 8259, 0, 0xffff, 8261, 8363, 0, 0xffff, 8365, 8481, 0, 0xffff, 8483, 8705, 0, 0xffff, 8707, 8709, 0, 0xffff, 8711, 8718, 0, 0xffff, 8720, 8720, 0, 0xffff, 8722, 8729, 0, 0xffff, 8731, 8733, 0, 0xffff, 8735, 8746, 0, 0xffff, 8748, 8775, 0, 0xffff, 8777, 8799, 0, 0xffff, 8801, 8803, 0, 0xffff, 8806, 9673, 0, 0xffff, 9675, 63742, 0, 0xffff, 63744, 64256, 0, 0xffff ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong diff --git a/classes/helpers/FrmEntriesHelper.php b/classes/helpers/FrmEntriesHelper.php index 723c6d07a5..fb81851ce2 100644 --- a/classes/helpers/FrmEntriesHelper.php +++ b/classes/helpers/FrmEntriesHelper.php @@ -272,7 +272,7 @@ public static function prepare_display_value( $entry, $field, $atts ) { $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value( $child_entry, $field ); if ( $entry_val || '0' === $entry_val ) { - // foreach entry get display_value. + // For each entry get display_value. $field_value[] = self::display_value( $entry_val, $field, $atts ); } @@ -678,18 +678,18 @@ public static function get_browser( $u_agent ) { } } - // finally get the correct version number + // Finally get the correct version number $known = array( 'Version', $ub, 'other' ); $pattern = '#(?' . implode( '|', $known ) . ')[/ ]+(?[0-9.|a-zA-Z.]*)#'; // Get the matching numbers. preg_match_all( $pattern, $u_agent, $matches ); - // see how many we have + // See how many we have $i = count( $matches['browser'] ); if ( $i > 1 ) { // We will have two since we are not using 'other' argument yet - // see if version is before or after the name. + // See if version is before or after the name. $version = strripos( $u_agent, 'Version' ) < strripos( $u_agent, $ub ) ? $matches['version'][0] : $matches['version'][1]; } elseif ( $i === 1 ) { $version = $matches['version'][0]; @@ -697,7 +697,7 @@ public static function get_browser( $u_agent ) { $version = ''; } - // check if we have a number + // Check if we have a number if ( $version === '' ) { $version = '?'; } diff --git a/classes/helpers/FrmFieldsHelper.php b/classes/helpers/FrmFieldsHelper.php index 723d75cb1e..391479ed92 100644 --- a/classes/helpers/FrmFieldsHelper.php +++ b/classes/helpers/FrmFieldsHelper.php @@ -564,7 +564,7 @@ public static function get_default_html( $type = 'text' ) { $field = FrmFieldFactory::get_field_type( $type ); $default_html = $field->default_html(); - // these hooks are here for reverse compatibility since 3.0 + // These hooks are here for reverse compatibility since 3.0 if ( ! apply_filters( 'frm_normal_field_type_html', true, $type ) ) { $default_html = apply_filters( 'frm_other_custom_html', '', $type ); } @@ -892,12 +892,12 @@ public static function value_meets_condition( $observed_value, $cond, $hide_opt $m = stripos( $observed_value, $hide_opt ); $m = $cond === 'not LIKE' ? $m === false : $m !== false; } elseif ( $cond === '%LIKE' ) { - // ends with + // Ends with $length = strlen( $hide_opt ); $substr = substr( $observed_value, strlen( $observed_value ) - $length ); $m = 0 === strcasecmp( $substr, $hide_opt ); } elseif ( 'LIKE%' === $cond ) { - // starts with + // Starts with $length = strlen( $hide_opt ); $substr = substr( $observed_value, 0, $length ); $m = 0 === strcasecmp( $substr, $hide_opt ); @@ -967,7 +967,7 @@ public static function array_value_condition( $observed_value, $cond, $hide_opt $m = $m === false; } } elseif ( $cond === '%LIKE' ) { - // ends with + // Ends with foreach ( $observed_value as $ob ) { if ( $hide_opt === substr( $ob, strlen( $ob ) - strlen( $hide_opt ) ) ) { $m = true; @@ -975,7 +975,7 @@ public static function array_value_condition( $observed_value, $cond, $hide_opt } } } elseif ( $cond === 'LIKE%' ) { - // starts with + // Starts with foreach ( $observed_value as $ob ) { if ( str_starts_with( $ob, $hide_opt ) ) { $m = true; @@ -1529,7 +1529,7 @@ public static function get_other_val( $args ) { // phpcs:ignore SlevomatCodingSt $other_val = ''; // If option is an "other" option and there is a value set for this field, - // check if the value belongs in the current "Other" option text field + // Check if the value belongs in the current "Other" option text field if ( ! self::is_other_opt( $opt_key ) || ! FrmField::is_option_true( $field, 'value' ) ) { return $other_val; } @@ -1719,7 +1719,7 @@ public static function include_other_input( $args ) { $classes = array( 'frm_other_input' ); if ( ! $args['checked'] || trim( $args['checked'] ) === '' ) { - // hide the field if the other option is not selected + // Hide the field if the other option is not selected $classes[] = 'frm_pos_none'; } diff --git a/classes/helpers/FrmFormsHelper.php b/classes/helpers/FrmFormsHelper.php index c9a9b4ff23..6f2ce29fa2 100644 --- a/classes/helpers/FrmFormsHelper.php +++ b/classes/helpers/FrmFormsHelper.php @@ -879,7 +879,7 @@ public static function maybe_create_end_section( &$open, &$reset_fields, &$add_o FrmField::create( $end_section_values ); if ( $move === 'move' ) { - // bump the order of current field unless we're at the end of the form + // Bump the order of current field unless we're at the end of the form FrmField::update( $field->id, array( 'field_order' => $field->field_order + 2 ) ); } @@ -1031,7 +1031,7 @@ public static function get_form_style_class( $form = false ) { */ private static function form_should_be_inline_and_missing_class( $form ) { if ( isset( $form['form_class'] ) && str_contains( ' ' . $form['form_class'] . ' ', ' frm_inline_form ' ) ) { - // not missing class, avoid adding it twice. + // Not missing class, avoid adding it twice. return false; } return ! empty( $form['submit_html'] ) && str_contains( $form['submit_html'], 'frm_inline_submit' ); @@ -1107,7 +1107,7 @@ public static function get_form_style( $form ) { } if ( is_object( $form ) && $form->parent_form_id ) { - // get the parent form if this is a child + // Get the parent form if this is a child $form = $form->parent_form_id; } elseif ( is_array( $form ) && ! empty( $form['parent_form_id'] ) ) { $form = $form['parent_form_id']; @@ -1162,7 +1162,7 @@ public static function show_errors( $args ) { * @return void */ public static function show_error( $args ) { - // remove any blank messages + // Remove any blank messages $args['errors'] = array_filter( (array) $args['errors'] ); $line_break_first = $args['show_img']; diff --git a/classes/helpers/FrmListHelper.php b/classes/helpers/FrmListHelper.php index 6f9de581be..d633ac5fe7 100644 --- a/classes/helpers/FrmListHelper.php +++ b/classes/helpers/FrmListHelper.php @@ -819,7 +819,7 @@ protected function get_default_primary_column_name() { $column = ''; // We need a primary defined so responsive views show something, - // so let's fall back to the first non-checkbox column. + // So let's fall back to the first non-checkbox column. foreach ( $columns as $col => $column_name ) { if ( 'cb' === $col ) { continue; @@ -844,7 +844,7 @@ protected function get_primary_column_name() { $default = $this->get_default_primary_column_name(); // If the primary column doesn't exist fall back to the - // first non-checkbox column. + // First non-checkbox column. if ( ! isset( $columns[ $default ] ) ) { $default = self::get_default_primary_column_name(); } @@ -1139,7 +1139,7 @@ protected function display_tablenav( $which ) { return; } } elseif ( ! $this->has_min_items() ) { - // don't show the bulk actions when there aren't many rows. + // Don't show the bulk actions when there aren't many rows. return; } ?> diff --git a/classes/helpers/FrmStylesHelper.php b/classes/helpers/FrmStylesHelper.php index 7b631a1cc0..d8d1dfa723 100644 --- a/classes/helpers/FrmStylesHelper.php +++ b/classes/helpers/FrmStylesHelper.php @@ -1116,7 +1116,7 @@ public static function get_submit_image_bg_url( $settings ) { } // Handle the case where the submit_bg_img is a full URL string. If the - // settings were saved with the older styler version prior to 6.14, the + // Settings were saved with the older styler version prior to 6.14, the // submit_bg_img will be a full URL string. if ( ! is_numeric( $background_image ) ) { return $background_image; diff --git a/classes/helpers/FrmXMLHelper.php b/classes/helpers/FrmXMLHelper.php index 885c392d27..567574206c 100644 --- a/classes/helpers/FrmXMLHelper.php +++ b/classes/helpers/FrmXMLHelper.php @@ -74,7 +74,7 @@ public static function import_xml( $file ) { $xml = simplexml_import_dom( $dom ); unset( $dom ); - // halt if loading produces an error + // Halt if loading produces an error if ( ! $xml ) { return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this XML file', 'formidable' ), libxml_get_errors() ); } @@ -334,7 +334,7 @@ private static function fill_form( $item ) { * @return false|object */ private static function maybe_get_form( $form ) { - // if template, allow to edit if form keys match, otherwise, creation date must also match + // If template, allow to edit if form keys match, otherwise, creation date must also match $edit_query = array( 'form_key' => $form['form_key'], 'is_template' => $form['is_template'], @@ -498,7 +498,7 @@ private static function import_xml_fields( $xml_fields, $form_id, $this_form, &$ self::migrate_placeholders( $f ); if ( $this_form ) { - // check for field to edit by field id + // Check for field to edit by field id if ( isset( $form_fields[ $f['id'] ] ) ) { FrmField::update( $f['id'], $f ); ++$imported['updated']['fields']; @@ -513,7 +513,7 @@ private static function import_xml_fields( $xml_fields, $form_id, $this_form, &$ $keys_by_original_field_id[ $f['id'] ] = $f['field_key']; $old_field_id = $f['id']; - // check for field to edit by field key + // Check for field to edit by field key unset( $f['id'] ); FrmField::update( $form_fields[ $f['field_key'] ], $f ); @@ -941,7 +941,7 @@ private static function update_custom_style_setting_on_import( &$form ) { return; } - // save the old style to maybe update after styles import + // Save the old style to maybe update after styles import $form['options']['old_style'] = $form['options']['custom_style']; // Set to default @@ -1099,7 +1099,7 @@ public static function import_xml_views( $views, $imported ) { // phpcs:ignore S unset( $posts_with_shortcodes, $view_ids ); if ( ! empty( $imported['forms'] ) ) { - // clear imported forms style cache to make sure the new styles are applied to the forms + // Clear imported forms style cache to make sure the new styles are applied to the forms self::clear_forms_style_caches( $imported['forms'] ); } @@ -1264,7 +1264,7 @@ private static function populate_post( &$post, $item, $imported ) { } if ( $post['post_type'] === FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { - // update to new form id + // Update to new form id $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; } @@ -1448,7 +1448,7 @@ private static function maybe_editing_post( &$post ) { // phpcs:ignore Universal.Operators.StrictComparisons if ( $editing && current( $editing )->post_date == $post['post_date'] ) { - // set the id of the post to edit + // Set the id of the post to edit $post['ID'] = current( $editing )->ID; } } @@ -1544,7 +1544,7 @@ public static function parse_message( $result, &$message, &$errors ) { foreach ( $error_codes as $error_code ) { // Clone WP_Error data because WP_Error removes all error messages and data - // associated with the specified error code when an item is removed. + // Associated with the specified error code when an item is removed. // Source: https://developer.wordpress.org/reference/classes/wp_error/remove/#source $error_details = $result->get_error_data( $error_code ); @@ -1579,7 +1579,7 @@ public static function parse_message( $result, &$message, &$errors ) { foreach ( $result as $type => $results ) { if ( ! isset( $t_strings[ $type ] ) ) { - // only print imported and updated + // Only print imported and updated continue; } @@ -2029,7 +2029,7 @@ private static function migrate_post_settings_to_action( $form_options, $form_id ); if ( ! $exists ) { - // this isn't an email, but we need to use a class that will always be included + // This isn't an email, but we need to use a class that will always be included FrmDb::save_json_post( $new_action ); ++$imported['imported']['actions']; } @@ -2178,10 +2178,10 @@ private static function remove_deprecated_notification_settings( $form_id, $form */ private static function migrate_notifications_to_action( $form_options, $form_id, &$notifications ) { if ( ! isset( $form_options['notification'] ) && ! empty( $form_options['email_to'] ) ) { - // add old settings into notification array + // Add old settings into notification array $form_options['notification'] = array( 0 => $form_options ); } elseif ( isset( $form_options['notification']['email_to'] ) ) { - // make sure it's in the correct format + // Make sure it's in the correct format $form_options['notification'] = array( 0 => $form_options['notification'] ); } @@ -2364,12 +2364,12 @@ private static function migrate_autoresponder_to_action( $form_options, $form_id return; } - // migrate autoresponder + // Migrate autoresponder $email_field = $form_options['ar_email_to'] ?? 0; if ( str_contains( $email_field, '|' ) ) { - // data from entries field + // Data from entries field $email_field = explode( '|', $email_field ); if ( isset( $email_field[1] ) ) { diff --git a/classes/models/FrmAddon.php b/classes/models/FrmAddon.php index 62daf27099..2fa3c67b98 100644 --- a/classes/models/FrmAddon.php +++ b/classes/models/FrmAddon.php @@ -200,7 +200,7 @@ public function plugins_api_filter( $_data, $_action = '', $_args = null ) { // Force new API info so we can pull changelog data. // Change log data is intentionally omitted from the cached API response - // to help reduce the size of the autoloaded option. + // To help reduce the size of the autoloaded option. $api->force_api_request(); $plugins = $api->get_api_info(); @@ -256,7 +256,7 @@ public function get_license() { * @return false|string */ protected function maybe_get_pro_license() { - // prevent a loop if $this is the pro plugin + // Prevent a loop if $this is the pro plugin $get_license = FrmAppHelper::pro_is_installed() && is_callable( 'FrmProAppHelper::get_updater' ) && $this->plugin_name !== 'Formidable Pro'; if ( ! $get_license ) { @@ -468,7 +468,7 @@ protected function delete_cache() { */ public function maybe_show_license_message( $file, $plugin ) { if ( $this->is_expired_addon || isset( $plugin['package'] ) ) { - // let's not show a ton of duplicate messages + // Let's not show a ton of duplicate messages return; } @@ -527,7 +527,7 @@ public function clear_expired_download( $transient ) { } elseif ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) { $this->prepare_update_details( $transient->response[ $this->plugin_folder ] ); - // if the transient has expired, clear the update and trigger it again + // If the transient has expired, clear the update and trigger it again if ( $transient->response[ $this->plugin_folder ] === false ) { if ( ! $this->has_been_cleared() ) { $this->cleared_plugins(); @@ -586,11 +586,11 @@ protected function get_api_info( $license ) { $api = new FrmFormApi( $license ); $addon = $api->get_addon_for_license( $this ); - // if there is no download url, this license does not apply to the addon + // If there is no download url, this license does not apply to the addon if ( isset( $addon['package'] ) ) { $this->is_parent_licence = true; } elseif ( isset( $addon['error'] ) ) { - // if the license is expired, we must assume all add-ons were packaged + // If the license is expired, we must assume all add-ons were packaged $this->is_parent_licence = true; $this->is_expired_addon = true; } diff --git a/classes/models/FrmAntiSpam.php b/classes/models/FrmAntiSpam.php index 0691990b98..55b00021ba 100644 --- a/classes/models/FrmAntiSpam.php +++ b/classes/models/FrmAntiSpam.php @@ -101,7 +101,7 @@ private function get_valid_tokens() { $current_date = time(); // Create our array of times to check before today. A user with a longer - // cache time can extend this. A user with a shorter cache time can remove times. + // Cache time can extend this. A user with a shorter cache time can remove times. $valid_token_times_before = apply_filters( 'frm_form_token_check_before_today', array( @@ -209,7 +209,7 @@ public function validate() { // If the antispam setting is enabled and we don't have a token, bail. if ( ! $token ) { if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) { - // add an exception for the entries page. + // Add an exception for the entries page. return true; } @@ -274,7 +274,7 @@ private function maybe_get_support_text() { // If the user is an admin, return text with a link to support. // We add a space here to separate the sentences, but outside of the localized - // text to avoid it being removed. + // Text to avoid it being removed. return ' ' . sprintf( // translators: %1$s start link, %2$s end link. esc_html__( 'Please check out our %1$stroubleshooting guide%2$s for details on resolving this issue.', 'formidable' ), diff --git a/classes/models/FrmCreateFile.php b/classes/models/FrmCreateFile.php index 751d792227..59f01e9e08 100644 --- a/classes/models/FrmCreateFile.php +++ b/classes/models/FrmCreateFile.php @@ -170,7 +170,7 @@ private function check_permission() { $this->has_permission = true; if ( ! $creds || ! WP_Filesystem( $creds ) ) { - // initialize the API - any problems and we exit + // Initialize the API - any problems and we exit $this->show_error_message(); $this->has_permission = false; } diff --git a/classes/models/FrmDb.php b/classes/models/FrmDb.php index 6c49cfcb53..876dbe2a7d 100644 --- a/classes/models/FrmDb.php +++ b/classes/models/FrmDb.php @@ -56,7 +56,7 @@ public function __construct() { */ public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) { if ( ! $args ) { - // add an arg to prevent prepare from failing + // Add an arg to prevent prepare from failing $args = array( 'where' => $starts_with . '1=%d', 'values' => array( 1 ), @@ -143,7 +143,7 @@ private static function interpret_array_to_sql( $key, $value, &$where, &$values $lowercase_key = end( $lowercase_key ); if ( is_array( $value ) ) { - // translate array of values to "in" + // Translate array of values to "in" if ( str_contains( $lowercase_key, 'like' ) ) { $where = preg_replace( '/' . $key . '$/', '', $where ); $where .= '('; @@ -388,7 +388,7 @@ private static function get_group_and_table_name( &$table, &$group ) { $table = $wpdb->prefix . $table; } - // switch to singular group name + // Switch to singular group name $group = rtrim( $group, 's' ); } @@ -685,7 +685,7 @@ public static function save_settings( $settings, $group ) { unset( $settings['ID'] ); } - // delete all caches for this group + // Delete all caches for this group self::cache_delete_group( $group ); return self::save_json_post( $settings ); @@ -716,7 +716,7 @@ public static function save_json_post( $settings ) { $post = wp_insert_post( $settings ); - // add the content filters back for views or posts + // Add the content filters back for views or posts if ( isset( $filters ) ) { $wp_filter['content_save_pre'] = $filters; } diff --git a/classes/models/FrmEmail.php b/classes/models/FrmEmail.php index c0aa4ce3c4..854869e0a8 100644 --- a/classes/models/FrmEmail.php +++ b/classes/models/FrmEmail.php @@ -721,7 +721,7 @@ private function format_from( $from ) { list( $from_name, $from_email ) = $this->get_name_and_email_for_sender( $from ); } - // if sending the email from a yahoo address, change it to the WordPress default + // If sending the email from a yahoo address, change it to the WordPress default if ( str_contains( $from_email, '@yahoo.com' ) ) { // Get the site domain and get rid of www. $sitename = strtolower( FrmAppHelper::get_server_value( 'SERVER_NAME' ) ); diff --git a/classes/models/FrmEntry.php b/classes/models/FrmEntry.php index 66ecaf3519..e9c65b7fdc 100644 --- a/classes/models/FrmEntry.php +++ b/classes/models/FrmEntry.php @@ -106,7 +106,7 @@ public static function is_duplicate( $new_values, $values ) { foreach ( $entry_exists as $entry_exist ) { $is_duplicate = true; - // make sure it's a duplicate + // Make sure it's a duplicate $metas = FrmEntryMeta::get_entry_meta_info( $entry_exist ); $field_metas = array(); @@ -127,7 +127,7 @@ public static function is_duplicate( $new_values, $values ) { return false; } - // compare serialized values and not arrays + // Compare serialized values and not arrays $new_meta = array_map( 'maybe_serialize', $filtered_vals ); if ( $field_metas === $new_meta ) { @@ -577,7 +577,7 @@ public static function get_meta( $entry ) { continue; } - // include sub entries in an array + // Include sub entries in an array if ( ! isset( $entry->metas[ $meta_val->field_id ] ) ) { $entry->metas[ $meta_val->field_id ] = array(); } @@ -639,7 +639,7 @@ public static function getAll( $where, $order_by = '', $limit = '', $meta = fals unset( $order_matches ); } - // prepare the query + // Prepare the query $query = 'SELECT ' . $fields . ' FROM ' . $table . FrmDb::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit; $entries = $wpdb->get_results( $query, OBJECT_K ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared diff --git a/classes/models/FrmEntryMeta.php b/classes/models/FrmEntryMeta.php index fb91fcfa62..4b5455cfe4 100644 --- a/classes/models/FrmEntryMeta.php +++ b/classes/models/FrmEntryMeta.php @@ -17,7 +17,7 @@ public static function add_entry_meta( $entry_id, $field_id, $meta_key, $meta_va global $wpdb; if ( FrmAppHelper::is_empty_value( $meta_value ) ) { - // don't save blank fields + // Don't save blank fields return 0; } @@ -153,7 +153,7 @@ public static function update_entry_metas( $entry_id, $values ) { self::get_value_to_save( compact( 'field', 'field_id', 'entry_id' ), $meta_value ); if ( ! $previous_field_ids || ! in_array( $field_id, $previous_field_ids, true ) ) { - // if value does not exist, then create it + // If value does not exist, then create it self::add_entry_meta( $entry_id, $field_id, '', $meta_value ); continue; } @@ -162,7 +162,7 @@ public static function update_entry_metas( $entry_id, $values ) { // Remove blank fields. unset( $values_indexed_by_field_id[ $field_id ] ); } else { - // if value exists, then update it + // If value exists, then update it self::update_entry_meta( $entry_id, $field_id, '', $meta_value ); } }//end foreach @@ -177,7 +177,7 @@ public static function update_entry_metas( $entry_id, $values ) { return; } - // prepare the query + // Prepare the query $where = array( 'item_id' => $entry_id, 'field_id' => $field_ids_to_remove, @@ -575,7 +575,7 @@ function ( $total, $current ) { } if ( str_contains( $where, ' GROUP BY ' ) ) { - // don't inject WHERE filtering after GROUP BY + // Don't inject WHERE filtering after GROUP BY $parts = explode( ' GROUP BY ', $where ); $where = $parts[0]; $where .= $draft_where . $user_where; diff --git a/classes/models/FrmEntryValidate.php b/classes/models/FrmEntryValidate.php index 45aabd2a77..495a5dccd7 100644 --- a/classes/models/FrmEntryValidate.php +++ b/classes/models/FrmEntryValidate.php @@ -548,7 +548,7 @@ public static function spam_check( $exclude, $values, &$errors ) { } if ( $exclude || empty( $values['item_meta'] ) || $errors ) { - // only check spam if there are no other errors + // Only check spam if there are no other errors return; } diff --git a/classes/models/FrmField.php b/classes/models/FrmField.php index 8d2f00ef15..2cde473ad6 100644 --- a/classes/models/FrmField.php +++ b/classes/models/FrmField.php @@ -616,7 +616,7 @@ public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $b // If this is a repeating section, create new form if ( self::is_repeating_field( $field ) ) { - // create the repeatable form + // Create the repeatable form $new_repeat_form_id = apply_filters( 'frm_create_repeat_form', 0, @@ -686,12 +686,12 @@ public static function update( $id, $values ) { $values = apply_filters( 'frm_clean_' . $values['type'] . '_field_options_before_update', $values, $id ); if ( $values['type'] === 'hidden' && isset( $values['field_options'] ) && isset( $values['field_options']['clear_on_focus'] ) ) { - // don't keep the old placeholder setting for hidden fields + // Don't keep the old placeholder setting for hidden fields $values['field_options']['clear_on_focus'] = 0; } } - // serialize array values + // Serialize array values foreach ( array( 'field_options', 'options' ) as $opt ) { if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { if ( 'field_options' === $opt ) { @@ -1071,7 +1071,7 @@ public static function getAll( $where = array(), $order_by = '', $limit = '', $b $cache_key = FrmAppHelper::maybe_json_encode( $where ) . $order_by . 'l' . $limit . 'b' . $blog_id; if ( self::$use_cache ) { - // make sure old cache doesn't get saved as a transient + // Make sure old cache doesn't get saved as a transient $results = wp_cache_get( $cache_key, 'frm_field' ); if ( false !== $results ) { @@ -1105,7 +1105,7 @@ public static function getAll( $where = array(), $order_by = '', $limit = '', $b ); $results = FrmDb::get_var( $table_name . ' fi JOIN ' . $form_table_name . ' fr ON fi.form_id=fr.id', $where, 'fi.*, fr.name as form_name', $args, '', $query_type ); } else { - // if the query is not an array, then it has already been prepared + // If the query is not an array, then it has already been prepared $query .= FrmDb::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit; $function_name = $query_type === 'row' ? 'get_row' : 'get_results'; @@ -1233,7 +1233,7 @@ private static function get_next_transient( &$fields, $base_name, $next = 0 ) { $fields = array_merge( $fields, $next_fields ); if ( count( $next_fields ) >= self::$transient_size ) { - // if this transient is full, check for another + // If this transient is full, check for another ++$next; self::get_next_transient( $fields, $base_name, $next ); } @@ -1261,9 +1261,9 @@ private static function set_field_transient( &$fields, $form_id, $next = 0, $arg $set = set_transient( $name, $field, 60 * 60 * 6 ); if ( ! $set ) { - // the transient didn't save + // The transient didn't save if ( $name !== $base_name ) { - // if the first saved an others fail, this will show an incomplete form + // If the first saved an others fail, this will show an incomplete form self::delete_form_transient( $form_id ); } diff --git a/classes/models/FrmFieldFormHtml.php b/classes/models/FrmFieldFormHtml.php index 970e9ceba9..96010557e1 100644 --- a/classes/models/FrmFieldFormHtml.php +++ b/classes/models/FrmFieldFormHtml.php @@ -180,7 +180,7 @@ private function replace_field_values() { // Replace [id]. $this->html = str_replace( '[id]', $this->field_id, $this->html ); - // set the label for + // Set the label for $this->html = str_replace( 'field_[key]', $this->html_id, $this->html ); // Replace [key]. @@ -508,7 +508,7 @@ private function add_field_div_classes() { $classes = $this->get_field_div_classes(); if ( in_array( $this->field_obj->get_field_column( 'type' ), array( 'html', 'summary' ), true ) && ! str_contains( $this->html, '[error_class]' ) ) { - // there is no error_class shortcode for HTML fields + // There is no error_class shortcode for HTML fields $this->html = str_replace( 'class="frm_form_field', 'class="frm_form_field ' . esc_attr( $classes ), $this->html ); return; } diff --git a/classes/models/FrmForm.php b/classes/models/FrmForm.php index f99c6be98b..d032d8245a 100644 --- a/classes/models/FrmForm.php +++ b/classes/models/FrmForm.php @@ -127,7 +127,7 @@ public static function duplicate( $id, $template = false, $copy_keys = false, $b $form_id = $wpdb->insert_id; FrmField::duplicate( $id, $form_id, $copy_keys, $blog_id ); - // update form settings after fields are created + // Update form settings after fields are created do_action( 'frm_after_duplicate_form', $form_id, $new_values, array( 'old_id' => $id ) ); return $form_id; @@ -921,7 +921,7 @@ private static function prepare_form_row_data( $row ) { public static function getAll( $where = array(), $order_by = '', $limit = '' ) { if ( is_array( $where ) && $where ) { if ( ! empty( $where['is_template'] ) && ! isset( $where['status'] ) && ! isset( $where['status !'] ) ) { - // don't get trashed templates + // Don't get trashed templates $where['status'] = array( null, '', 'published' ); } @@ -942,7 +942,7 @@ public static function getAll( $where = array(), $order_by = '', $limit = '' ) { } if ( $limit === ' LIMIT 1' || (int) $limit === 1 ) { - // return the first form object if we are only getting one form + // Return the first form object if we are only getting one form $results = reset( $results ); } diff --git a/classes/models/FrmFormAction.php b/classes/models/FrmFormAction.php index 0ffc267a2e..8f93d76919 100644 --- a/classes/models/FrmFormAction.php +++ b/classes/models/FrmFormAction.php @@ -297,7 +297,7 @@ public function prepare_new( $form_id = false ) { $post_content = array(); $default_values = $this->get_global_defaults(); - // fill default values + // Fill default values $post_content = wp_parse_args( $post_content, $default_values ); if ( ! isset( $post_content['event'] ) && ! $this->action_options['force_event'] ) { @@ -340,7 +340,7 @@ public function create( $form_id ) { public function duplicate_form_actions( $form_id, $old_id ) { // phpcs:ignore Universal.Operators.StrictComparisons if ( $form_id == $old_id ) { - // don't duplicate the actions if this is a template getting updated + // Don't duplicate the actions if this is a template getting updated return; } @@ -394,7 +394,7 @@ public function duplicate_one( $action, $form_id ) { } elseif ( ! is_array( $val ) ) { $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); } elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { - // loop through each value if empty + // Loop through each value if empty if ( empty( $switch[ $key ] ) ) { $switch[ $key ] = array_keys( $val ); } @@ -485,7 +485,7 @@ public function update_callback( $form_id ) { $new_instance['post_status'] = 'draft'; } - // settings were never opened, so don't update + // Settings were never opened, so don't update if ( ! isset( $new_instance['post_title'] ) ) { $this->maybe_update_status( $new_instance, $old_instance ); $action_ids[] = $new_instance['ID']; @@ -599,7 +599,7 @@ public static function get_action_for_form( $form_id, $type = 'all', $atts = arr $action_controls = FrmFormActionsController::get_form_actions( $type ); if ( ! $action_controls ) { - // don't continue if there are no available actions + // Don't continue if there are no available actions return array(); } @@ -625,7 +625,7 @@ public static function get_action_for_form( $form_id, $type = 'all', $atts = arr $settings = array(); foreach ( $actions as $action ) { - // some plugins/themes are formatting the post_excerpt + // Some plugins/themes are formatting the post_excerpt $action->post_excerpt = sanitize_title( $action->post_excerpt ); if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { @@ -673,7 +673,7 @@ public static function get_action_limit( $form_id, $limit = 99 ) { */ protected static function prepare_get_action( &$args, $default_status = 'publish' ) { if ( is_numeric( $args ) ) { - // for reverse compatibility. $limit was changed to $args + // For reverse compatibility. $limit was changed to $args $args = array( 'limit' => $args, ); @@ -805,7 +805,7 @@ public function prepare_action( $action ) { $default_values = $this->get_global_defaults(); - // fill default values + // Fill default values $action->post_content += $default_values; foreach ( $default_values as $k => $vals ) { @@ -913,7 +913,7 @@ public function migrate_to_2( $form, $update = 'update' ) { $action = $this->prepare_new( $form->id ); FrmAppHelper::unserialize_or_decode( $form->options ); - // fill with existing options + // Fill with existing options foreach ( $action->post_content as $name => $val ) { if ( isset( $form->options[ $name ] ) ) { $action->post_content[ $name ] = $form->options[ $name ]; @@ -923,7 +923,7 @@ public function migrate_to_2( $form, $update = 'update' ) { $action = $this->migrate_values( $action, $form ); - // check if action already exists + // Check if action already exists $post_id = get_posts( array( 'name' => $action->post_name, @@ -934,7 +934,7 @@ public function migrate_to_2( $form, $update = 'update' ) { ); if ( ! $post_id ) { - // create action now + // Create action now $post_id = $this->save_settings( $action ); } @@ -945,7 +945,7 @@ public function migrate_to_2( $form, $update = 'update' ) { global $wpdb; $form->options = maybe_serialize( $form->options ); - // update form options + // Update form options $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => $form->options ), array( 'id' => $form->id ) ); FrmForm::clear_form_cache(); diff --git a/classes/models/FrmFormApi.php b/classes/models/FrmFormApi.php index 9d89f145bd..83927cc898 100644 --- a/classes/models/FrmFormApi.php +++ b/classes/models/FrmFormApi.php @@ -440,7 +440,7 @@ private function should_include_addon_in_cached_data( $addon ) { if ( isset( $addon['categories'] ) ) { if ( 'views' === $addon['slug'] ) { // Legacy views has no categories set, but we should still - // include it in cache since it is a valid add-on. + // Include it in cache since it is a valid add-on. return true; } diff --git a/classes/models/FrmFormMigrator.php b/classes/models/FrmFormMigrator.php index 8903d11e4a..b41d04b147 100644 --- a/classes/models/FrmFormMigrator.php +++ b/classes/models/FrmFormMigrator.php @@ -65,7 +65,7 @@ public function __construct() { $this->source_active = is_plugin_active( $this->path ); if ( ! $this->source_active ) { - // if source plugin is not installed, do nothing + // If source plugin is not installed, do nothing return; } @@ -263,7 +263,7 @@ protected function prepare_new_form( $source_id, $source_form_name ) { * @return void */ protected function prepare_form( $form, &$new_form ) { - // customize this function + // Customize this function } /** @@ -280,7 +280,7 @@ protected function prepare_fields( $fields, &$form ) { $label = $this->get_field_label( $field ); $type = $this->get_field_type( $field ); - // check if field is unsupported. If unsupported make note and continue + // Check if field is unsupported. If unsupported make note and continue if ( $this->is_unsupported_field( $type ) ) { $this->response['unsupported'][] = $label; continue; @@ -314,14 +314,14 @@ protected function prepare_fields( $fields, &$form ) { } // This may occasionally skip one level/order e.g. after adding a - // list field, as field_order would already be prepared to be used. + // List field, as field_order would already be prepared to be used. ++$field_order; if ( ! empty( $new_field['fields'] ) && is_array( $new_field['fields'] ) ) { // we have (inner) fields to merge $form['fields'] = array_merge( $form['fields'], $new_field['fields'] ); - // set the new field_order as it would have changed + // Set the new field_order as it would have changed $field_order = $new_field['current_order']; } }//end foreach @@ -334,7 +334,7 @@ protected function prepare_fields( $fields, &$form ) { * @return void */ protected function prepare_field( $field, &$new_field ) { - // customize this function + // Customize this function } /** diff --git a/classes/models/FrmHoneypot.php b/classes/models/FrmHoneypot.php index 2866e3d314..c49d08ab41 100644 --- a/classes/models/FrmHoneypot.php +++ b/classes/models/FrmHoneypot.php @@ -43,7 +43,7 @@ private static function is_enabled() { */ public function validate() { if ( ! $this->is_option_on() || ! $this->check_honeypot_filter() ) { - // never flag as honeypot spam if disabled. + // Never flag as honeypot spam if disabled. return true; } return ! $this->is_honeypot_spam(); diff --git a/classes/models/FrmInbox.php b/classes/models/FrmInbox.php index 4a1e46294c..974242fb46 100644 --- a/classes/models/FrmInbox.php +++ b/classes/models/FrmInbox.php @@ -112,8 +112,8 @@ private function add_api_messages() { */ public function add_message( $message ) { if ( ! is_array( $message ) || ! isset( $message['key'] ) ) { - // if the API response is invalid, $message may not be an array. - // if there are no messages from the API, it is returning a "No Entries Found" item with no key, so check for a key as well. + // If the API response is invalid, $message may not be an array. + // If there are no messages from the API, it is returning a "No Entries Found" item with no key, so check for a key as well. return; } @@ -475,7 +475,7 @@ public static function maybe_disable_screen_options() { self::$banner_messages = self::get_banner_messages(); if ( self::$banner_messages ) { - // disable screen options tab when displaying banner messages because it gets in the way of the banner. + // Disable screen options tab when displaying banner messages because it gets in the way of the banner. add_filter( 'screen_options_show_screen', '__return_false' ); } } diff --git a/classes/models/FrmInstallerSkin.php b/classes/models/FrmInstallerSkin.php index 9813f4acb4..1a1e549e77 100644 --- a/classes/models/FrmInstallerSkin.php +++ b/classes/models/FrmInstallerSkin.php @@ -12,7 +12,7 @@ } if ( ! class_exists( 'WP_Upgrader_Skin' ) ) { - // this is to prevent a unit test from failing + // This is to prevent a unit test from failing return; } diff --git a/classes/models/FrmMigrate.php b/classes/models/FrmMigrate.php index f5e94e7693..ccb064bafc 100644 --- a/classes/models/FrmMigrate.php +++ b/classes/models/FrmMigrate.php @@ -54,7 +54,7 @@ public function upgrade() { if ( $needs_upgrade ) { $this->maybe_delete_htaccess_file(); - // update rewrite rules for views and other custom post types + // Update rewrite rules for views and other custom post types flush_rewrite_rules(); require_once ABSPATH . 'wp-admin/includes/upgrade.php'; @@ -85,7 +85,7 @@ public function upgrade() { FrmAppHelper::save_combined_js(); - // update the styling settings + // Update the styling settings if ( function_exists( 'get_filesystem_method' ) ) { $frm_style = new FrmStyle(); $frm_style->update( 'default' ); @@ -376,7 +376,7 @@ private function migrate_data( $old_db_version ) { } if ( ! is_numeric( $old_db_version ) ) { - // bail if we don't know the previous version + // Bail if we don't know the previous version return; } @@ -426,9 +426,9 @@ public function uninstall() { } unset( $roles, $frm_roles ); - // delete actions, views, and styles + // Delete actions, views, and styles - // prevent the post deletion from triggering entries to be deleted + // Prevent the post deletion from triggering entries to be deleted remove_action( 'before_delete_post', 'FrmProDisplaysController::before_delete_post' ); remove_action( 'deleted_post', 'FrmProEntriesController::delete_entry' ); @@ -440,7 +440,7 @@ public function uninstall() { } unset( $post_ids ); - // delete transients + // Delete transients delete_transient( 'frmpro_css' ); delete_transient( 'frm_options' ); delete_transient( 'frmpro_options' ); @@ -587,7 +587,7 @@ private function migrate_to_86() { unset( $f ); } - // reverse the extra size changes in widgets + // Reverse the extra size changes in widgets $widgets = get_option( 'widget_frm_show_form' ); if ( ! $widgets ) { @@ -687,7 +687,7 @@ private function maybe_convert_migrated_size( &$size ) { * @return void */ private function migrate_to_25() { - // get the style that was created with the style migration + // Get the style that was created with the style migration $frm_style = new FrmStyle(); $styles = $frm_style->get_all( 'post_date', 'ASC', 1 ); @@ -819,7 +819,7 @@ private function migrate_to_16() { */ foreach ( $forms as $form ) { if ( $form->is_template && $form->default_template ) { - // don't migrate the default templates since the email will be added anyway + // Don't migrate the default templates since the email will be added anyway continue; } diff --git a/classes/models/FrmPersonalData.php b/classes/models/FrmPersonalData.php index eb58aa13d8..f2576deeaf 100644 --- a/classes/models/FrmPersonalData.php +++ b/classes/models/FrmPersonalData.php @@ -150,7 +150,7 @@ private function get_user_entries( $email ) { $entries_by_email = FrmDb::get_col( 'frm_item_metas', array( 'meta_value' => $email ), 'item_id', $query_args ); if ( ! $user ) { - // no matching user, so return the entry ids we have + // No matching user, so return the entry ids we have return $entries_by_email; } diff --git a/classes/models/FrmPluginSearch.php b/classes/models/FrmPluginSearch.php index 867bab8cae..f32df98445 100644 --- a/classes/models/FrmPluginSearch.php +++ b/classes/models/FrmPluginSearch.php @@ -272,10 +272,10 @@ protected function should_display_hint( $hint ) { private function sanitize_search_term( $term ) { $term = strtolower( urldecode( $term ) ); - // remove non-alpha/space chars. + // Remove non-alpha/space chars. $term = preg_replace( '/[^a-z ]/', '', $term ); - // remove strings that don't help matches. + // Remove strings that don't help matches. return trim( str_replace( array( 'formidable', 'free', 'wordpress', 'wp ', 'plugin' ), '', $term ) ); } diff --git a/classes/models/FrmReviews.php b/classes/models/FrmReviews.php index 8093a2c841..0e9376b0ad 100644 --- a/classes/models/FrmReviews.php +++ b/classes/models/FrmReviews.php @@ -84,7 +84,7 @@ private function set_review_status() { * @return void */ private function review() { - // show the review request 3 times, depending on the number of entries + // Show the review request 3 times, depending on the number of entries $show_intervals = array( 50, 200, 500 ); $asked = $this->review_status['asked']; @@ -98,7 +98,7 @@ private function review() { // Only show review request if the site has collected enough entries if ( $entries < $count ) { - // check the entry count again in a week + // Check the entry count again in a week $this->review_status['time'] = time(); update_user_meta( $user->ID, $this->option_name, $this->review_status ); @@ -240,7 +240,7 @@ public function dismiss_review() { } if ( isset( $review['dismissed'] ) && $review['dismissed'] === 'done' ) { - // if feedback was submitted, don't update it again when the review is dismissed + // If feedback was submitted, don't update it again when the review is dismissed $this->set_inbox_dismissed(); wp_die(); } diff --git a/classes/models/FrmSalesApi.php b/classes/models/FrmSalesApi.php index 73bade588a..4cd0159142 100644 --- a/classes/models/FrmSalesApi.php +++ b/classes/models/FrmSalesApi.php @@ -192,8 +192,8 @@ private function add_sale( $sale ) { } if ( ! is_array( $sale ) || ! isset( $sale['key'] ) ) { - // if the API response is invalid, $sale may not be an array. - // if there are no sales from the API, it is returning a "No Entries Found" item with no key, so check for a key as well. + // If the API response is invalid, $sale may not be an array. + // If there are no sales from the API, it is returning a "No Entries Found" item with no key, so check for a key as well. return; } diff --git a/classes/models/FrmStyle.php b/classes/models/FrmStyle.php index 25d1653a71..108010f736 100644 --- a/classes/models/FrmStyle.php +++ b/classes/models/FrmStyle.php @@ -497,7 +497,7 @@ public function get_one() { $default_values = $this->get_defaults(); - // fill default values + // Fill default values $style->post_content = $this->override_defaults( $style->post_content ); $style->post_content = wp_parse_args( $style->post_content, $default_values ); @@ -524,12 +524,12 @@ public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { if ( ! $temp_styles ) { global $wpdb; - // make sure there wasn't a conflict with the query + // Make sure there wasn't a conflict with the query $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_type=%s AND post_status=%s ORDER BY post_title ASC LIMIT 99', FrmStylesController::$post_type, 'publish' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong $temp_styles = FrmDb::check_cache( 'frm_backup_style_check', 'frm_styles', $query, 'get_results' ); if ( ! $temp_styles ) { - // create a new style if there are none + // Create a new style if there are none $new = $this->get_new(); $new->post_title = __( 'Formidable Style', 'formidable' ); $new->post_name = $new->post_title; @@ -551,17 +551,17 @@ public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { if ( $style->menu_order ) { if ( $default_style ) { - // only return one default + // Only return one default $style->menu_order = 0; } else { - // check for a default style + // Check for a default style $default_style = $style->ID; } } $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content ); - // fill default values + // Fill default values $style->post_content = $this->override_defaults( $style->post_content ); $style->post_content = wp_parse_args( $style->post_content, $default_values ); diff --git a/classes/models/FrmUsage.php b/classes/models/FrmUsage.php index 1cdbc64843..704b4b8fcd 100644 --- a/classes/models/FrmUsage.php +++ b/classes/models/FrmUsage.php @@ -59,7 +59,7 @@ public function uuid( $regenerate = false ) { if ( $regenerate || ! $uuid ) { // Definitely not cryptographically secure but - // close enough to provide an unique id + // close enough to provide a unique id $uuid = md5( uniqid() . site_url() ); update_option( $uuid_key, $uuid, 'no' ); } diff --git a/classes/models/fields/FrmFieldCaptcha.php b/classes/models/fields/FrmFieldCaptcha.php index f6c2ce9f20..4330f2f5eb 100644 --- a/classes/models/fields/FrmFieldCaptcha.php +++ b/classes/models/fields/FrmFieldCaptcha.php @@ -240,7 +240,7 @@ protected function turnstile_api_url() { $api_js_url = apply_filters( 'frm_turnstile_js_url', $api_js_url ); // Prevent render=explicit from happening twice in case someone patched - // the double rendering issue using the frm_turnstile_js_url hook. + // The double rendering issue using the frm_turnstile_js_url hook. return str_replace( '&render=explicit&render=explicit', '&render=explicit', @@ -404,7 +404,7 @@ protected function should_validate() { return false; } - // don't require the captcha if it shouldn't be shown + // Don't require the captcha if it shouldn't be shown return self::should_show_captcha(); } diff --git a/classes/models/fields/FrmFieldType.php b/classes/models/fields/FrmFieldType.php index c7b0dc8e04..2726d6adef 100644 --- a/classes/models/fields/FrmFieldType.php +++ b/classes/models/fields/FrmFieldType.php @@ -1264,7 +1264,7 @@ protected function prepare_esc_value() { * @return void */ protected function add_extra_html_atts( $args, &$input_html ) { - // override from other fields + // Override from other fields } /** diff --git a/classes/models/fields/FrmFieldUrl.php b/classes/models/fields/FrmFieldUrl.php index 75a175c616..0f947476cb 100644 --- a/classes/models/fields/FrmFieldUrl.php +++ b/classes/models/fields/FrmFieldUrl.php @@ -79,7 +79,7 @@ public function validate( $args ) { $errors = array(); - // validate the url format + // Validate the url format if ( $value && ! preg_match( '/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value ) ) { $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); } elseif ( $this->field->required == '1' && ! $value ) { // phpcs:ignore Universal.Operators.StrictComparisons diff --git a/classes/views/frm-entries/errors.php b/classes/views/frm-entries/errors.php index 4be6788876..49417d78fc 100644 --- a/classes/views/frm-entries/errors.php +++ b/classes/views/frm-entries/errors.php @@ -17,7 +17,7 @@ } else { FrmFormsHelper::maybe_get_scroll_js( $form->id ); - // we need to allow scripts here for javascript in the success message + // We need to allow scripts here for javascript in the success message echo FrmAppHelper::maybe_kses( $message ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } diff --git a/classes/views/frm-entries/form.php b/classes/views/frm-entries/form.php index 87ef302608..e0f607a6f1 100644 --- a/classes/views/frm-entries/form.php +++ b/classes/views/frm-entries/form.php @@ -99,13 +99,13 @@ global $frm_vars; -// close open section div +// Close open section div if ( ! empty( $frm_vars['div'] ) ) { echo "
\n"; unset( $frm_vars['div'] ); } -// close open collapsible toggle div +// Close open collapsible toggle div if ( ! empty( $frm_vars['collapse_div'] ) ) { echo "
\n"; unset( $frm_vars['collapse_div'] ); diff --git a/classes/views/frm-fields/front-end/checkbox-field.php b/classes/views/frm-fields/front-end/checkbox-field.php index 765b570606..f443d83255 100644 --- a/classes/views/frm-fields/front-end/checkbox-field.php +++ b/classes/views/frm-fields/front-end/checkbox-field.php @@ -41,7 +41,7 @@ if ( ! FrmFieldsHelper::is_other_opt( $opt_key ) ) { // Let the checked state of 'Other' fields be determined solely by FrmFieldsHelper::prepare_other_input as below. // Without this check, one 'Other' field being checked leads to making all 'Other' fields checked on submit error - // since they all have the same value attr of 'Other'. + // Since they all have the same value attr of 'Other'. $checked = FrmAppHelper::check_selected( $field['value'], $field_val ) ? ' checked="checked"' : ''; } diff --git a/classes/views/frm-form-actions/form_action.php b/classes/views/frm-form-actions/form_action.php index dc7e66e1f3..5521915f01 100644 --- a/classes/views/frm-form-actions/form_action.php +++ b/classes/views/frm-form-actions/form_action.php @@ -62,10 +62,10 @@ class="widget frm_form_action_settings frm_single_ diff --git a/classes/views/styles/manage.php b/classes/views/styles/manage.php index 6fc14e2b70..fe14cdd9c9 100644 --- a/classes/views/styles/manage.php +++ b/classes/views/styles/manage.php @@ -58,7 +58,7 @@ function ( $form ) use ( $styles, $default_style, $row_view_file_path ) { $active_style_id = isset( $form->options['custom_style'] ) ? (int) $form->options['custom_style'] : 1; if ( 1 === $active_style_id ) { - // use the default style + // Use the default style $active_style_id = $default_style->ID; } diff --git a/classes/views/xml/forms_xml.php b/classes/views/xml/forms_xml.php index 15dc06c4d0..8a873cc97f 100644 --- a/classes/views/xml/forms_xml.php +++ b/classes/views/xml/forms_xml.php @@ -13,7 +13,7 @@ return; } -// fetch 20 posts at a time rather than loading the entire table into memory +// Fetch 20 posts at a time rather than loading the entire table into memory while ( $next_set = array_splice( $item_ids, 0, 20 ) ) { $forms = FrmDb::get_results( 'frm_forms', array( 'id' => $next_set ) ); diff --git a/classes/views/xml/posts_xml.php b/classes/views/xml/posts_xml.php index 2454d6a8c7..448284d7e7 100644 --- a/classes/views/xml/posts_xml.php +++ b/classes/views/xml/posts_xml.php @@ -19,7 +19,7 @@ // Fake being in the loop. $wp_query->in_the_loop = true; -// fetch 20 posts at a time rather than loading the entire table into memory +// Fetch 20 posts at a time rather than loading the entire table into memory while ( $next_posts = array_splice( $item_ids, 0, 20 ) ) { $posts = FrmDb::get_results( $wpdb->posts, array( 'ID' => $next_posts ) ); diff --git a/phpcs-sniffs/Formidable/Sniffs/Commenting/CommentSpacingSniff.php b/phpcs-sniffs/Formidable/Sniffs/Commenting/CommentSpacingSniff.php new file mode 100644 index 0000000000..cad5605e2f --- /dev/null +++ b/phpcs-sniffs/Formidable/Sniffs/Commenting/CommentSpacingSniff.php @@ -0,0 +1,246 @@ +getTokens(); + $content = $tokens[ $stackPtr ]['content']; + + // Only process // style comments. + if ( strpos( $content, '//' ) !== 0 ) { + return; + } + + // Skip //end comments. + if ( preg_match( '/^\/\/\s*end\b/i', $content ) ) { + return; + } + + // Get the comment text after //. + $commentText = substr( $content, 2 ); + + // Skip empty comments (just //). + if ( trim( $commentText ) === '' ) { + return; + } + + $hasSpaceAfterSlash = strpos( $content, '// ' ) === 0; + $trimmedText = ltrim( $commentText ); + $firstChar = substr( $trimmedText, 0, 1 ); + + // Check if first character should be capitalized. + // Skip if it starts with: $variable, @annotation, numbers, special chars, looks like code, single word, underscore/hyphen word, abbreviations, or is a continuation comment. + $looksLikeCode = $this->looksLikeCode( $trimmedText ); + $isSingleWord = $this->isSingleWord( $trimmedText ); + $startsWithSpecialWord = $this->startsWithSpecialWord( $trimmedText ); + $isContinuationComment = $this->isContinuationComment( $phpcsFile, $stackPtr ); + $shouldCapitalize = $hasSpaceAfterSlash + && preg_match( '/^[a-z]/', $firstChar ) + && ! $looksLikeCode + && ! $isSingleWord + && ! $startsWithSpecialWord + && ! $isContinuationComment + && ! preg_match( '/^(end\b|phpcs:|eslint|TODO|FIXME|translators:|e\.g\.|i\.e\.|etc\.|iDeal)/i', $trimmedText ); + + if ( ! $hasSpaceAfterSlash ) { + $fix = $phpcsFile->addFixableError( + 'Single-line comment must have a space after //.', + $stackPtr, + 'NoSpaceAfterDoubleSlash' + ); + + if ( true === $fix ) { + $newText = $trimmedText; + + // Also capitalize if needed (but not for code-like comments, single words, underscore/hyphen words, abbreviations, or continuation comments). + if ( preg_match( '/^[a-z]/', $firstChar ) && ! $looksLikeCode && ! $isSingleWord && ! $startsWithSpecialWord && ! $isContinuationComment && ! preg_match( '/^(end\b|phpcs:|eslint|translators:|e\.g\.|i\.e\.|etc\.|iDeal)/i', $trimmedText ) ) { + $newText = ucfirst( $trimmedText ); + } + + $newContent = '// ' . $newText; + $phpcsFile->fixer->replaceToken( $stackPtr, $newContent ); + } + + return; + } + + if ( $shouldCapitalize ) { + $fix = $phpcsFile->addFixableError( + 'Single-line comment must start with a capital letter.', + $stackPtr, + 'LowercaseComment' + ); + + if ( true === $fix ) { + $newContent = '// ' . ucfirst( $trimmedText ); + $phpcsFile->fixer->replaceToken( $stackPtr, $newContent ); + } + } + } + + /** + * Check if the comment text looks like code. + * + * @param string $text The comment text to check. + * + * @return bool True if the text looks like code. + */ + private function looksLikeCode( $text ) { + // Starts with $ (variable). + if ( strpos( $text, '$' ) === 0 ) { + return true; + } + + // Starts with @ (annotation). + if ( strpos( $text, '@' ) === 0 ) { + return true; + } + + // Contains -> or :: (object/static access). + if ( strpos( $text, '->' ) !== false || strpos( $text, '::' ) !== false ) { + return true; + } + + // Contains = (assignment). + if ( preg_match( '/\s*=\s*/', $text ) ) { + return true; + } + + // Contains () (function call). + if ( preg_match( '/\w+\s*\(/', $text ) ) { + return true; + } + + // Contains [] (array access). + if ( strpos( $text, '[' ) !== false && strpos( $text, ']' ) !== false ) { + return true; + } + + // Starts with a function/method name pattern like "function_name" or contains underscores typical of code. + if ( preg_match( '/^[a-z_]+\s*$/', $text ) ) { + return true; + } + + return false; + } + + /** + * Check if the comment is a single word. + * + * @param string $text The comment text to check. + * + * @return bool True if the text is a single word. + */ + private function isSingleWord( $text ) { + $text = rtrim( $text ); + + // Single word: no spaces, just letters/numbers/underscores. + return preg_match( '/^\S+$/', $text ) && ! preg_match( '/\s/', $text ); + } + + /** + * Check if the comment starts with a word containing underscores or hyphens (function name, CSS class, etc.). + * + * @param string $text The comment text to check. + * + * @return bool True if the first word contains underscores or hyphens. + */ + private function startsWithSpecialWord( $text ) { + // Get the first word. + $parts = preg_split( '/\s+/', $text, 2 ); + + if ( empty( $parts[0] ) ) { + return false; + } + + $firstWord = $parts[0]; + + // Check if the first word contains an underscore or hyphen. + return strpos( $firstWord, '_' ) !== false || strpos( $firstWord, '-' ) !== false; + } + + /** + * Check if this comment is a continuation of a previous comment (multiline comment using //). + * + * @param File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token. + * + * @return bool True if this comment follows another comment on the previous line. + */ + private function isContinuationComment( File $phpcsFile, $stackPtr ) { + $tokens = $phpcsFile->getTokens(); + $currentLine = $tokens[ $stackPtr ]['line']; + + // Look for a comment on the previous line. + for ( $i = $stackPtr - 1; $i >= 0; $i-- ) { + $tokenLine = $tokens[ $i ]['line']; + + // Stop if we've gone back more than one line. + if ( $tokenLine < $currentLine - 1 ) { + return false; + } + + // Skip whitespace on the same or previous line. + if ( $tokens[ $i ]['code'] === T_WHITESPACE ) { + continue; + } + + // If we find a comment on the previous line, this is a continuation. + if ( $tokenLine === $currentLine - 1 && $tokens[ $i ]['code'] === T_COMMENT ) { + // Make sure it's also a // style comment. + if ( strpos( $tokens[ $i ]['content'], '//' ) === 0 ) { + return true; + } + } + + // Found something else, not a continuation. + return false; + } + + return false; + } +} diff --git a/phpcs-sniffs/Formidable/ruleset.xml b/phpcs-sniffs/Formidable/ruleset.xml index 8c7f1a4ad4..4b1d8f5a1c 100644 --- a/phpcs-sniffs/Formidable/ruleset.xml +++ b/phpcs-sniffs/Formidable/ruleset.xml @@ -64,6 +64,7 @@ + diff --git a/rector.php b/rector.php index 38b8dcb6ad..38cb45152f 100644 --- a/rector.php +++ b/rector.php @@ -80,7 +80,7 @@ __DIR__ . '/tests', ) ) - // here we can define, what prepared sets of rules will be applied + // Here we can define, what prepared sets of rules will be applied ->withPreparedSets( // deadCode true, @@ -179,7 +179,7 @@ RemoveAlwaysTrueIfConditionRector::class, // The FrmFieldType.php file has a few empty functions with only a return; line. // We may want to remove that at some point, but I think it's there to prevent another - // static analysis error. + // Static analysis error. RemoveDeadReturnRector::class, RemoveParentCallWithoutParentRector::class, RemoveUnusedConstructorParamRector::class, diff --git a/square/helpers/FrmSquareLiteConnectHelper.php b/square/helpers/FrmSquareLiteConnectHelper.php index 989428b7df..ab8296056c 100644 --- a/square/helpers/FrmSquareLiteConnectHelper.php +++ b/square/helpers/FrmSquareLiteConnectHelper.php @@ -538,8 +538,8 @@ private static function post_with_authenticated_body( $action, $additional_body } if ( is_array( $response ) ) { - // reformat empty arrays as empty objects - // if the response is an array, it's because it's empty. Everything with data is already an object. + // Reformat empty arrays as empty objects + // If the response is an array, it's because it's empty. Everything with data is already an object. return new stdClass(); } diff --git a/stripe/controllers/FrmTransLiteActionsController.php b/stripe/controllers/FrmTransLiteActionsController.php index ca79711a90..6bc44467de 100755 --- a/stripe/controllers/FrmTransLiteActionsController.php +++ b/stripe/controllers/FrmTransLiteActionsController.php @@ -106,7 +106,7 @@ public static function trigger_action( $action, $entry, $form ) { $response = $class_name::trigger_gateway( $action, $entry, $form ); if ( ! $response['success'] && $response['show_errors'] ) { - // the payment failed + // The payment failed self::show_failed_message( compact( 'action', 'entry', 'form', 'response' ) ); } } diff --git a/stripe/controllers/FrmTransLiteListsController.php b/stripe/controllers/FrmTransLiteListsController.php index c6633338e3..3d9f68db88 100755 --- a/stripe/controllers/FrmTransLiteListsController.php +++ b/stripe/controllers/FrmTransLiteListsController.php @@ -181,7 +181,7 @@ public static function display_list( $response = array() ) { $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); if ( $pagenum > $total_pages && $total_pages > 0 ) { - // if the current page is higher than the total pages, + // If the current page is higher than the total pages, // reset it and prepare again to get the right entries. $_GET['paged'] = $total_pages; $_REQUEST['paged'] = $total_pages; diff --git a/stripe/helpers/FrmStrpLiteConnectHelper.php b/stripe/helpers/FrmStrpLiteConnectHelper.php index bfeb33c4f8..d3463f3450 100644 --- a/stripe/helpers/FrmStrpLiteConnectHelper.php +++ b/stripe/helpers/FrmStrpLiteConnectHelper.php @@ -734,8 +734,8 @@ private static function post_with_authenticated_body( $action, $additional_body } if ( is_array( $response ) ) { - // reformat empty arrays as empty objects - // if the response is an array, it's because it's empty. Everything with data is already an object. + // Reformat empty arrays as empty objects + // If the response is an array, it's because it's empty. Everything with data is already an object. return new stdClass(); } diff --git a/tests/phpunit/base/FrmAjaxUnitTest.php b/tests/phpunit/base/FrmAjaxUnitTest.php index bfe0b99c3f..c09d058cfc 100644 --- a/tests/phpunit/base/FrmAjaxUnitTest.php +++ b/tests/phpunit/base/FrmAjaxUnitTest.php @@ -32,12 +32,12 @@ public function setUp(): void { } public function set_as_user_role( $role ) { - // create user + // Create user $user_id = $this->factory->user->create( array( 'role' => $role ) ); $user = new WP_User( $user_id ); $this->assertTrue( $user->exists(), 'Problem getting user ' . $user_id ); - // log in as user + // Log in as user wp_set_current_user( $user_id ); $this->user_id = $user_id; $this->assertTrue( current_user_can( $role ) ); diff --git a/tests/phpunit/base/FrmUnitTest.php b/tests/phpunit/base/FrmUnitTest.php index 9a83e61989..791d1868a5 100644 --- a/tests/phpunit/base/FrmUnitTest.php +++ b/tests/phpunit/base/FrmUnitTest.php @@ -78,7 +78,7 @@ public static function empty_tables() { */ public static function frm_install() { if ( ! defined( 'WP_IMPORTING' ) ) { - // set this to false so all our tests won't be done with this active + // Set this to false so all our tests won't be done with this active define( 'WP_IMPORTING', false ); } @@ -143,7 +143,7 @@ public static function do_tables_exist( $should_exist = true ) { } public static function import_xml() { - // install test data in older format + // Install test data in older format add_filter( 'frm_default_templates_files', 'FrmUnitTest::install_data' ); FrmXMLController::add_default_templates(); @@ -481,12 +481,12 @@ public static function generate_xml( $type, $xml_args ) { // phpcs:ignore Slevom $type = (array) $type; if ( in_array( 'items', $type, true ) && ! in_array( 'forms', $type, true ) ) { - // make sure the form is included if there are entries + // Make sure the form is included if there are entries $type[] = 'forms'; } if ( in_array( 'forms', $type, true ) ) { - // include actions with forms + // Include actions with forms $type[] = 'actions'; } @@ -694,7 +694,7 @@ protected function use_frm_role( $role ) { case 'formidable_custom_role': $user = wp_get_current_user(); - // remove any standard roles to make room for a custom one + // Remove any standard roles to make room for a custom one foreach ( array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' ) as $role ) { $user->remove_role( $role ); } diff --git a/tests/phpunit/base/frm_factory.php b/tests/phpunit/base/frm_factory.php index bbf12f07a9..da6417014e 100644 --- a/tests/phpunit/base/frm_factory.php +++ b/tests/phpunit/base/frm_factory.php @@ -26,7 +26,7 @@ public function __construct( $factory = null ) { $defaults = FrmFormsHelper::setup_new_vars( false ); if ( isset( $defaults['submit_conditions'] ) ) { - // the array default is causing errors with unit test code + // The array default is causing errors with unit test code unset( $defaults['submit_conditions'] ); } $this->default_generation_definitions = $defaults; diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index 528791cad5..9804034027 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -28,7 +28,7 @@ require_once __DIR__ . '/base/frm_factory.php'; -// include unit test base class +// Include unit test base class require_once __DIR__ . '/base/FrmUnitTest.php'; require_once __DIR__ . '/base/FrmAjaxUnitTest.php'; diff --git a/tests/phpunit/database/test_FrmMigrate.php b/tests/phpunit/database/test_FrmMigrate.php index 547bb8a71a..651f04733d 100644 --- a/tests/phpunit/database/test_FrmMigrate.php +++ b/tests/phpunit/database/test_FrmMigrate.php @@ -53,28 +53,28 @@ public function test_migrate_to_17() { 'type' => 'text', 'form_id' => $form_id, 'field_options' => array( - 'size' => '10', // the old size in characters + 'size' => '10', // The old size in characters ), ) ); $this->assertNotEmpty( $field ); $field_id = $field->id; $frmdb = new FrmMigrate(); - update_option( 'frm_db_version', 16 ); // trigger migration 17 + update_option( 'frm_db_version', 16 ); // Trigger migration 17 $frmdb->upgrade(); $field = $this->factory->field->get_object_by_id( $field_id ); $expected_size = '90px'; $this->assertEquals( $expected_size, $field->field_options['size'] ); - // set it to a numeric value + // Set it to a numeric value $expected_size = '10'; $field->field_options['size'] = $expected_size; FrmField::update( $field_id, array( 'field_options' => $field->field_options ) ); $field = $this->factory->field->get_object_by_id( $field_id ); $this->assertEquals( $expected_size, $field->field_options['size'] ); - // make sure 17 does not fire and change the size again + // Make sure 17 does not fire and change the size again update_option( 'frm_db_version', 20 ); $frmdb->upgrade(); @@ -356,7 +356,7 @@ public function test_migrate_from_12_to_current() { FrmForm::create( $form_values ); - // migrate data + // Migrate data FrmAppController::install(); $form = FrmForm::getOne( 'contact-db12-copy' ); diff --git a/tests/phpunit/emails/test_FrmEmail.php b/tests/phpunit/emails/test_FrmEmail.php index d1d2da0bc9..ef34218983 100644 --- a/tests/phpunit/emails/test_FrmEmail.php +++ b/tests/phpunit/emails/test_FrmEmail.php @@ -537,8 +537,8 @@ public function test_set_reply_to() { ); $this->check_private_properties( $reply_to, 'reply_to' ); - // create an entry with no email and then try to use its shortcode to get a reply_to value. - // the default should use the from email, not the admin "default email". + // Create an entry with no email and then try to use its shortcode to get a reply_to value. + // The default should use the from email, not the admin "default email". $email_field_key = 'free_field_types' === $this->contact_form->form_key ? 'free-email-field' : 'contact-email'; $entry_data = $this->factory->field->generate_entry_array( $this->contact_form ); $email_field = FrmField::getOne( $email_field_key ); diff --git a/tests/phpunit/emails/test_FrmEmailSummaryHelper.php b/tests/phpunit/emails/test_FrmEmailSummaryHelper.php index e37ac25bef..bf1ef543ee 100644 --- a/tests/phpunit/emails/test_FrmEmailSummaryHelper.php +++ b/tests/phpunit/emails/test_FrmEmailSummaryHelper.php @@ -121,19 +121,19 @@ public function test_should_send_email() { $this->save_options( $options ); $this->assertEquals( array( 'monthly' ), FrmEmailSummaryHelper::should_send_emails() ); - // renewal date is coming, but monthly was sent less than 30 days ago. + // Renewal date is coming, but monthly was sent less than 30 days ago. $options['last_monthly'] = FrmEmailSummaryHelper::get_date_from_today( '-29 days' ); $options['renewal_date'] = FrmEmailSummaryHelper::get_date_from_today( '+1 day' ); $this->save_options( $options ); $this->assertEquals( array(), FrmEmailSummaryHelper::should_send_emails() ); - // renewal date is coming, but yearly was sent less than 1 year ago. + // Renewal date is coming, but yearly was sent less than 1 year ago. $options['last_monthly'] = ''; $options['last_yearly'] = FrmEmailSummaryHelper::get_date_from_today( '-300 days' ); $this->save_options( $options ); $this->assertEquals( array( 'monthly' ), FrmEmailSummaryHelper::should_send_emails() ); - // renewal date is coming in more than 45 days, but yearly was sent more than 1 year ago. + // Renewal date is coming in more than 45 days, but yearly was sent more than 1 year ago. $options['last_yearly'] = FrmEmailSummaryHelper::get_date_from_today( '-365 days' ); $this->save_options( $options ); $this->assertEquals( array( 'yearly' ), FrmEmailSummaryHelper::should_send_emails() ); diff --git a/tests/phpunit/entries/test_FrmEntriesController.php b/tests/phpunit/entries/test_FrmEntriesController.php index 810003f1f5..d57a0331e7 100644 --- a/tests/phpunit/entries/test_FrmEntriesController.php +++ b/tests/phpunit/entries/test_FrmEntriesController.php @@ -60,7 +60,7 @@ private function create_post_entry( $form, $entry_key ) { $this->assertNotEmpty( $entry ); $this->assertEquals( $entry->post_id, $new_post->ID ); - FrmFormsController::get_form( $form, false, false ); // this is where the entry is deleted + FrmFormsController::get_form( $form, false, false ); // This is where the entry is deleted return $new_post->ID; } diff --git a/tests/phpunit/entries/test_FrmPersonalData.php b/tests/phpunit/entries/test_FrmPersonalData.php index 81b2165d77..00591aa501 100644 --- a/tests/phpunit/entries/test_FrmPersonalData.php +++ b/tests/phpunit/entries/test_FrmPersonalData.php @@ -22,7 +22,7 @@ public function setUp(): void { public function test_get_user_entries() { $form = $this->factory->form->get_object_by_id( $this->contact_form_key ); $entry_data = $this->factory->field->generate_entry_array( $form ); - $this->factory->entry->create_object( $entry_data ); // create a non-matching entry + $this->factory->entry->create_object( $entry_data ); // Create a non-matching entry $email = 'notauser@mail.com'; $expected = $this->create_entries_for_email( $entry_data, $email ); @@ -47,13 +47,13 @@ private function create_entries_for_user( $entry_data, $email ) { $email_field = $this->factory->field->get_id_by_key( 'contact-email' ); $entry_ids = $this->create_entries_for_email( $entry_data, $email ); - // with user id and matching email + // With user id and matching email $entry_data['item_meta'][ $email_field ] = $email; $entry_data['item_meta'][ $user_id_field ] = $user->ID; $entry_data['frm_user_id'] = $user->ID; $entry_ids[] = (string) $this->factory->entry->create_object( $entry_data ); - // with user id by different email + // With user id by different email $entry_data['item_meta'][ $email_field ] = 'something@different.com'; $entry_ids[] = (string) $this->factory->entry->create_object( $entry_data ); @@ -69,11 +69,11 @@ private function create_entries_for_user( $entry_data, $email ) { private function create_entries_for_email( $entry_data, $email ) { $email_field = $this->factory->field->get_id_by_key( 'contact-email' ); - // similar email should not match + // Similar email should not match $entry_data['item_meta'][ $email_field ] = '2nd' . $email; $this->factory->entry->create_object( $entry_data ); - // with email but no user ID + // With email but no user ID $entry_data['item_meta'][ $email_field ] = $email; $entry_ids = array(); $entry_ids[] = (string) $this->factory->entry->create_object( $entry_data ); diff --git a/tests/phpunit/fields/test_FrmFieldValidate.php b/tests/phpunit/fields/test_FrmFieldValidate.php index 8677811952..6e7b2e6133 100644 --- a/tests/phpunit/fields/test_FrmFieldValidate.php +++ b/tests/phpunit/fields/test_FrmFieldValidate.php @@ -282,7 +282,7 @@ public function test_phone_format() { array( 'field_key' => 'phone_with_regex', 'format' => '^\d{3}-\d{4}$', - 'expected' => '^\d{3}-\d{4}$', // leave it alone + 'expected' => '^\d{3}-\d{4}$', // Leave it alone ), ); diff --git a/tests/phpunit/fields/test_FrmFieldsAjax.php b/tests/phpunit/fields/test_FrmFieldsAjax.php index 266d3a6001..82b0b42c2a 100644 --- a/tests/phpunit/fields/test_FrmFieldsAjax.php +++ b/tests/phpunit/fields/test_FrmFieldsAjax.php @@ -47,7 +47,7 @@ public function test_create() { $this->assertIsNumeric( $this->field_id ); $this->assertNotEmpty( $this->field_id ); - // make sure the field exists + // Make sure the field exists $field = FrmField::getOne( $this->field_id ); $this->assertIsObject( $field ); } diff --git a/tests/phpunit/forms/test_FrmForm.php b/tests/phpunit/forms/test_FrmForm.php index e401740806..602a51fe75 100644 --- a/tests/phpunit/forms/test_FrmForm.php +++ b/tests/phpunit/forms/test_FrmForm.php @@ -29,7 +29,7 @@ public function test_duplicate() { $this->assertIsNumeric( $id ); $this->assertNotEmpty( $id ); - // check the number of form actions + // Check the number of form actions $original_actions = FrmFormAction::get_action_for_form( $form->id ); $new_actions = FrmFormAction::get_action_for_form( $id ); $this->assertEquals( count( $original_actions ), count( $new_actions ) ); @@ -93,7 +93,7 @@ public function test_is_form_visible_to_user() { $this->assert_form_is_hidden( 'subscriber', array( 'editor', 'author' ), 'Contributors should not set a form assigned to editors and authors' ); $this->assert_form_is_hidden( 'subscriber', array( 'author', 'administrator' ), 'Contributors should not set a form assigned to authors and administrators' ); - // test custom roles + // Test custom roles $this->assert_form_is_visible( 'formidable_custom_role', 'formidable_custom_role', 'Custom role should be able to see a form assigned to it' ); $this->assert_form_is_visible( 'formidable_custom_role', '', 'Custom role should be able to see a form assigned to logged in users' ); $this->assert_form_is_hidden( 'formidable_custom_role', array( 'administrator' ), 'Custom role should not be able to see a form not assigned to it' ); diff --git a/tests/phpunit/forms/test_FrmFormsController.php b/tests/phpunit/forms/test_FrmFormsController.php index 01c5c1f00e..45258fc6da 100644 --- a/tests/phpunit/forms/test_FrmFormsController.php +++ b/tests/phpunit/forms/test_FrmFormsController.php @@ -232,7 +232,7 @@ public function test_multiple_on_submit_actions() { $this->assertEquals( wp_list_pluck( $actions, 'ID' ), array( $page_action->ID, $redirect_action_2->ID ) ); // Test the output. - $response = FrmFormsController::show_form( $form->id ); // this is where the message is returned + $response = FrmFormsController::show_form( $form->id ); // This is where the message is returned $contains = array( 'frmFrontForm.scrollMsg(' . $form->id . ')', 'Done!', @@ -341,7 +341,7 @@ public function run_message_after_create( $show_form = 0 ) { $created_entry = FrmEntry::get_id_by_key( $entry_key ); $this->assertNotEmpty( $created_entry, 'No entry found with key ' . $entry_key ); - $response = FrmFormsController::show_form( $form->id ); // this is where the message is returned + $response = FrmFormsController::show_form( $form->id ); // This is where the message is returned $this->assertStringContainsString( '
Done!
', $response ); $this->assertStringContainsString( 'frmFrontForm.scrollMsg(' . $form->id . ')', $response ); diff --git a/tests/phpunit/misc/test_FrmAppController.php b/tests/phpunit/misc/test_FrmAppController.php index 7e37cb42b7..ca9c8cb6e6 100644 --- a/tests/phpunit/misc/test_FrmAppController.php +++ b/tests/phpunit/misc/test_FrmAppController.php @@ -146,12 +146,12 @@ public function test_compare_for_update() { ), array( 'version' => FrmAppHelper::plugin_version(), - 'db' => FrmAppHelper::$db_version - 1, // previous version + 'db' => FrmAppHelper::$db_version - 1, // Previous version 'expected' => true, ), array( 'version' => FrmAppHelper::plugin_version(), - 'db' => FrmAppHelper::$db_version + 1, // next version + 'db' => FrmAppHelper::$db_version + 1, // Next version 'expected' => false, ), ); diff --git a/tests/phpunit/misc/test_FrmAppHelper.php b/tests/phpunit/misc/test_FrmAppHelper.php index 46487cf0f2..2484a41225 100644 --- a/tests/phpunit/misc/test_FrmAppHelper.php +++ b/tests/phpunit/misc/test_FrmAppHelper.php @@ -539,7 +539,7 @@ public function test_get_unique_key() { $this->assertIsNotNumeric( $key, 'key should never be numeric.' ); $super_long_form_key = 'formkeywithlikeseventycharacterscanyouevenimaginehavingthismanyletters'; - // reserve the form key so one has to be generated with this as the base. + // Reserve the form key so one has to be generated with this as the base. $this->factory->form->create( array( 'form_key' => $super_long_form_key ) ); diff --git a/tests/phpunit/misc/test_FrmCSVExportHelper.php b/tests/phpunit/misc/test_FrmCSVExportHelper.php index 2db4cf8bc3..b8ad9a479f 100644 --- a/tests/phpunit/misc/test_FrmCSVExportHelper.php +++ b/tests/phpunit/misc/test_FrmCSVExportHelper.php @@ -14,7 +14,7 @@ public function test_csv_headings() { $headings = $this->csv_headings(); $expected = array( - // default expected + // Default expected 'created_at' => 'Timestamp', 'updated_at' => 'Last Updated', 'user_id' => 'Created By', @@ -30,7 +30,7 @@ public function test_csv_headings() { $this->assertContains( $key, $keys, "{$label} is not present in CSV Headings" ); } - // expected for all_field_types form + // Expected for all_field_types form $expected = array( 'Paragraph Text', 'Checkboxes - colors', diff --git a/tests/phpunit/styles/test_FrmStylesController.php b/tests/phpunit/styles/test_FrmStylesController.php index ddc7f3881c..8449953014 100644 --- a/tests/phpunit/styles/test_FrmStylesController.php +++ b/tests/phpunit/styles/test_FrmStylesController.php @@ -10,7 +10,7 @@ class test_FrmStylesController extends FrmUnitTest { public function test_front_head() { $this->set_front_end(); - // reset if the style was loaded in another test + // Reset if the style was loaded in another test global $frm_vars, $wp_styles; $frm_vars['css_loaded'] = false; diff --git a/tests/phpunit/test_ajax.php b/tests/phpunit/test_ajax.php index c493a72d6a..0601853bf9 100644 --- a/tests/phpunit/test_ajax.php +++ b/tests/phpunit/test_ajax.php @@ -12,7 +12,7 @@ public function test_plugin_activated() { * Prevent unauthorized user from uninstalling */ public function test_block_uninstall() { - // log in as user + // Log in as user $role = 'editor'; $user_id = $this->factory->user->create( compact( 'role' ) ); wp_set_current_user( $user_id );