diff --git a/classes/controllers/FrmAddonsController.php b/classes/controllers/FrmAddonsController.php index 285a418843..ec1b8501f2 100644 --- a/classes/controllers/FrmAddonsController.php +++ b/classes/controllers/FrmAddonsController.php @@ -27,6 +27,8 @@ class FrmAddonsController { /** * @since 6.15 + * + * @return void */ public static function load_admin_hooks() { add_action( 'admin_menu', self::class . '::menu', 100 ); @@ -420,6 +422,8 @@ public static function get_pro_download_url() { /** * @since 4.08 + * + * @return string */ public static function get_pro_license() { $pro_cred_store = 'frmpro-credentials'; @@ -458,6 +462,8 @@ protected static function get_pro_from_addons( $addons ) { /** * @since 4.06 + * + * @return string */ public static function license_type() { if ( is_callable( 'FrmProAddonsController::license_type' ) ) { @@ -1034,6 +1040,8 @@ public static function url_is_allowed( $download_url ) { * so let's install the plugin. * * @since 3.04.02 + * + * @return array|string */ protected static function install_addon() { require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; diff --git a/classes/controllers/FrmAppController.php b/classes/controllers/FrmAppController.php index 9dae1047b2..2c76c759bf 100644 --- a/classes/controllers/FrmAppController.php +++ b/classes/controllers/FrmAppController.php @@ -32,6 +32,8 @@ private static function get_menu_position() { /** * @since 3.05 + * + * @return string */ private static function menu_icon() { $icon = FrmAppHelper::svg_logo( @@ -136,6 +138,8 @@ private static function get_os() { /** * @since 3.0 + * + * @return bool */ private static function is_white_page() { $white_pages = array( @@ -818,6 +822,8 @@ private static function enqueue_builder_assets( $plugin_url, $version ) { * Enqueues global settings scripts. * * @param string $page The `page` param in URL. + * + * @return void */ private static function enqueue_global_settings_scripts( $page ) { if ( 'formidable-settings' === $page ) { @@ -1076,6 +1082,8 @@ public static function create_rest_routes() { * We don't want to run manually by people calling the API. * * @since 4.06.02 + * + * @return bool */ public static function can_update_db() { return get_transient( 'frm_updating_api' ); @@ -1187,6 +1195,11 @@ public static function uninstall() { wp_die(); } + /** + * @param array $tables + * + * @return array + */ public static function drop_tables( $tables ) { global $wpdb; $tables[] = $wpdb->prefix . 'frm_fields'; @@ -1236,6 +1249,11 @@ private static function maybe_activate_payment_cron() { FrmTransLiteAppController::maybe_schedule_cron(); } + /** + * @param string $text + * + * @return string + */ public static function set_footer_text( $text ) { if ( FrmAppHelper::is_formidable_admin() ) { $text = ''; diff --git a/classes/controllers/FrmCronController.php b/classes/controllers/FrmCronController.php index db5494ffac..909545d568 100644 --- a/classes/controllers/FrmCronController.php +++ b/classes/controllers/FrmCronController.php @@ -35,6 +35,8 @@ private static function get_events() { * Schedules cron events. * * @since 6.7 + * + * @return void */ public static function schedule_events() { $events = self::get_events(); diff --git a/classes/controllers/FrmDashboardController.php b/classes/controllers/FrmDashboardController.php index 6f94a7e4f5..40c6d836fc 100644 --- a/classes/controllers/FrmDashboardController.php +++ b/classes/controllers/FrmDashboardController.php @@ -442,6 +442,12 @@ private static function inbox_prepare_messages( $data ) { return $data; } + /** + * Clean messages CTA. + * + * @param string $cta + * @return string + */ private static function inbox_clean_messages_cta( $cta ) { // remove dismiss button diff --git a/classes/controllers/FrmEmailStylesController.php b/classes/controllers/FrmEmailStylesController.php index e80a4b9d1c..bbc4fcc292 100644 --- a/classes/controllers/FrmEmailStylesController.php +++ b/classes/controllers/FrmEmailStylesController.php @@ -330,6 +330,8 @@ private static function get_content_type_header( $email_style ) { /** * Shows placeholder Pro settings. + * + * @return void */ public static function show_upsell_settings() { include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/email/settings.php'; diff --git a/classes/controllers/FrmEmailSummaryController.php b/classes/controllers/FrmEmailSummaryController.php index b27a3b67c8..16acc64c25 100644 --- a/classes/controllers/FrmEmailSummaryController.php +++ b/classes/controllers/FrmEmailSummaryController.php @@ -17,6 +17,8 @@ class FrmEmailSummaryController { /** * Maybe send summary emails. + * + * @return void */ public static function maybe_send_emails() { $emails = FrmEmailSummaryHelper::should_send_emails(); diff --git a/classes/controllers/FrmEntriesController.php b/classes/controllers/FrmEntriesController.php index 9936499731..6c81efeb00 100644 --- a/classes/controllers/FrmEntriesController.php +++ b/classes/controllers/FrmEntriesController.php @@ -5,6 +5,9 @@ class FrmEntriesController { + /** + * @return void + */ public static function menu() { FrmAppHelper::force_capability( 'frm_view_entries' ); @@ -90,6 +93,8 @@ private static function add_url_params_to_views_redirect_query_args( $query_args /** * @since 2.05.07 + * + * @return void */ private static function load_manage_entries_hooks() { if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show', 'new', 'duplicate' ), true ) ) { @@ -106,6 +111,8 @@ private static function load_manage_entries_hooks() { /** * Display in Back End. + * + * @return mixed */ public static function route() { $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); @@ -122,7 +129,8 @@ public static function route() { return; } - return self::display_list(); + self::display_list(); + return; } } @@ -148,6 +156,11 @@ public static function remove_screen_options( $show_screen, $screen ) { return $show_screen; } + /** + * @param array $columns + * + * @return array + */ public static function manage_columns( $columns ) { global $frm_vars; $form_id = FrmForm::get_current_form_id(); @@ -185,6 +198,12 @@ public static function manage_columns( $columns ) { return $columns; } + /** + * @param int|string $form_id + * @param array $columns + * + * @return void + */ private static function get_columns_for_form( $form_id, &$columns ) { $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' ); @@ -424,6 +443,9 @@ public static function save_per_page( $save, $option, $value ) { return $save; } + /** + * @return array + */ public static function sortable_columns() { $form_id = FrmForm::get_current_form_id(); $fields = FrmField::get_all_for_form( $form_id ); @@ -556,6 +578,12 @@ private static function remove_excess_cols( $atts, &$result ) { } } + /** + * @param string $message + * @param array $errors + * + * @return void + */ public static function display_list( $message = '', $errors = array() ) { global $wpdb, $frm_vars; @@ -683,6 +711,12 @@ public static function destroy() { self::display_list( $message ); } + /** + * @param array|string $errors + * @param bool $ajax + * + * @return void + */ public static function process_entry( $errors = '', $ajax = false ) { $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing @@ -876,6 +910,11 @@ public static function show_entry_shortcode( $atts ) { return $formatted_entry; } + /** + * @param false|object $entry + * + * @return void + */ public static function entry_sidebar( $entry = false ) { $data = array(); $id = 0; diff --git a/classes/controllers/FrmFieldsController.php b/classes/controllers/FrmFieldsController.php index 82f67a322f..4c9132ddf4 100644 --- a/classes/controllers/FrmFieldsController.php +++ b/classes/controllers/FrmFieldsController.php @@ -159,6 +159,8 @@ public static function get_field_array_from_id( $field_id ) { * @param array|int|object $field_object * @param array $values * @param int $form_id + * + * @return void */ public static function load_single_field( $field_object, $values, $form_id = 0 ) { global $frm_vars; @@ -506,6 +508,12 @@ public static function show_format_option( $field, $is_hidden = false ) { include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/value-format.php'; } + /** + * @param array $field + * @param bool $echo + * + * @return string + */ public static function input_html( $field, $echo = true ) { $class = array(); self::add_input_classes( $field, $class ); @@ -767,6 +775,12 @@ private static function add_frmval_to_input( $field, &$add_html ) { } } + /** + * @param array $field + * @param array $add_html + * + * @return void + */ private static function add_validation_messages( $field, array &$add_html ) { $field_validation_messages_status = self::get_validation_data_attribute_visibility_info( $field ); @@ -999,6 +1013,13 @@ private static function add_pattern_attribute( $field, array &$add_html ) { } } + /** + * @param mixed $opt + * @param mixed $opt_key + * @param array|object $field + * + * @return mixed + */ public static function check_value( $opt, $opt_key, $field ) { if ( is_array( $opt ) ) { if ( FrmField::is_option_true( $field, 'separate_value' ) ) { @@ -1011,6 +1032,11 @@ public static function check_value( $opt, $opt_key, $field ) { return $opt; } + /** + * @param mixed $opt + * + * @return mixed + */ public static function check_label( $opt ) { if ( is_array( $opt ) ) { $opt = $opt['label'] ?? reset( $opt ); diff --git a/classes/controllers/FrmFormActionsController.php b/classes/controllers/FrmFormActionsController.php index b437ce52e7..96d486b778 100644 --- a/classes/controllers/FrmFormActionsController.php +++ b/classes/controllers/FrmFormActionsController.php @@ -407,6 +407,15 @@ private static function maybe_show_limit_warning( $form_id, $form_actions ) { echo ''; } + /** + * @param WP_Post $form_action + * @param object $form + * @param int $action_key Action ID. + * @param FrmFormAction $action_control + * @param array $values + * + * @return void + */ public static function action_control( $form_action, $form, $action_key, $action_control, $values ) { $action_control->_set( $action_key ); @@ -563,6 +572,11 @@ public static function update_settings( $form_id ) { FrmOnSubmitHelper::save_on_submit_settings( $form_id ); } + /** + * @param array $old_actions + * + * @return void + */ public static function delete_missing_actions( $old_actions ) { if ( ! empty( $old_actions ) ) { foreach ( $old_actions as $old_id ) { @@ -706,6 +720,13 @@ public static function trigger_actions( $event, $form, $entry, $type = 'all', $a }//end if } + /** + * @param int|string $form_id + * @param array $values + * @param array $args + * + * @return void + */ public static function duplicate_form_actions( $form_id, $values, $args = array() ) { if ( empty( $args['old_id'] ) ) { // Continue if we know which actions to copy. @@ -723,6 +744,11 @@ public static function duplicate_form_actions( $form_id, $values, $args = array( } } + /** + * @param string $where + * + * @return string + */ public static function limit_by_type( $where ) { global $frm_vars, $wpdb; @@ -759,10 +785,20 @@ public function __construct() { add_action( 'frm_form_actions_init', array( $this, '_register_actions' ), 100 ); } + /** + * @param string $action_class + * + * @return void + */ public function register( $action_class ) { $this->actions[ $action_class ] = new $action_class(); } + /** + * @param string $action_class + * + * @return void + */ public function unregister( $action_class ) { if ( isset( $this->actions[ $action_class ] ) ) { unset( $this->actions[ $action_class ] ); diff --git a/classes/controllers/FrmFormTemplatesController.php b/classes/controllers/FrmFormTemplatesController.php index 33178176ac..1e19fc92c7 100644 --- a/classes/controllers/FrmFormTemplatesController.php +++ b/classes/controllers/FrmFormTemplatesController.php @@ -143,6 +143,8 @@ class FrmFormTemplatesController { * Initialize hooks for template page only. * * @since 6.7 + * + * @return void */ public static function load_admin_hooks() { self::init_template_resources(); diff --git a/classes/controllers/FrmFormsController.php b/classes/controllers/FrmFormsController.php index 5a96c6f052..997934c98e 100644 --- a/classes/controllers/FrmFormsController.php +++ b/classes/controllers/FrmFormsController.php @@ -1234,6 +1234,13 @@ public static function hidden_columns( $hidden_columns ) { return $hidden_columns; } + /** + * @param mixed $save + * @param string $option + * @param int $value + * + * @return mixed + */ public static function save_per_page( $save, $option, $value ) { if ( $option === 'formidable_page_formidable_per_page' ) { $save = (int) $value; @@ -1912,6 +1919,13 @@ private static function get_entry_by_param( &$entry ) { } } + /** + * @param string $content + * @param false|object $entry + * @param array $shortcodes + * + * @return string + */ public static function replace_content_shortcodes( $content, $entry, $shortcodes ) { return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes ); } @@ -2122,6 +2136,11 @@ public static function rename_form() { wp_send_json_success( compact( 'form_key' ) ); } + /** + * @param array $errors + * + * @return array + */ public static function json_error( $errors ) { $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' ); @@ -2366,10 +2385,23 @@ private static function maybe_get_form_to_show( $id ) { return $form; } + /** + * @param object $form + * + * @return bool + */ private static function is_viewable_draft_form( $form ) { return $form->status === 'draft' && current_user_can( 'frm_edit_forms' ) && ! FrmAppHelper::is_preview_page(); } + /** + * @param object $form + * @param bool $title + * @param bool $description + * @param array $atts + * + * @return string + */ public static function get_form( $form, $title, $description, $atts = array() ) { ob_start(); @@ -2386,10 +2418,23 @@ public static function get_form( $form, $title, $description, $atts = array() ) return $contents; } + /** + * @param array $params + * + * @return void + */ public static function enqueue_scripts( $params ) { do_action( 'frm_enqueue_form_scripts', $params ); } + /** + * @param object $form + * @param bool $title + * @param bool $description + * @param array $atts + * + * @return void + */ public static function get_form_contents( $form, $title, $description, $atts ) { $params = FrmForm::get_params( $form ); $errors = self::get_saved_errors( $form, $params ); @@ -2510,6 +2555,13 @@ private static function get_confirmation_method( $atts ) { return $method; } + /** + * @param object $form + * @param array $params + * @param array $args + * + * @return void + */ public static function maybe_trigger_redirect( $form, $params, $args ) { if ( ! isset( $params['id'] ) ) { global $frm_vars; @@ -2551,6 +2603,13 @@ public static function maybe_trigger_redirect_with_action( $conf_method, $form, } } + /** + * @param object $form + * @param array $params + * @param array $args + * + * @return void + */ public static function trigger_redirect( $form, $params, $args ) { $success_args = array( 'action' => $params['action'], @@ -3270,6 +3329,13 @@ public static function has_combo_js_file() { return is_readable( FrmAppHelper::plugin_path() . '/js/frm.min.js' ); } + /** + * @param object $form + * @param int|string $this_load + * @param bool $global_load + * + * @return void + */ public static function maybe_load_css( $form, $this_load, $global_load ) { $load_css = FrmForm::is_form_loaded( $form, $this_load, $global_load ); diff --git a/classes/controllers/FrmOnboardingWizardController.php b/classes/controllers/FrmOnboardingWizardController.php index 5ceee84979..4269171e70 100644 --- a/classes/controllers/FrmOnboardingWizardController.php +++ b/classes/controllers/FrmOnboardingWizardController.php @@ -120,6 +120,8 @@ class FrmOnboardingWizardController { * Initialize hooks for template page only. * * @since 6.9 + * + * @return void */ public static function load_admin_hooks() { self::set_page_url(); diff --git a/classes/controllers/FrmOverlayController.php b/classes/controllers/FrmOverlayController.php index f0affeb3a8..068a74d51d 100644 --- a/classes/controllers/FrmOverlayController.php +++ b/classes/controllers/FrmOverlayController.php @@ -53,6 +53,9 @@ class FrmOverlayController { */ private $options_data = array(); + /** + * @param array $config + */ public function __construct( $config = array() ) { if ( ! isset( $config['config-option-name'] ) || ! isset( $config['execution-frequency'] ) ) { return; diff --git a/classes/controllers/FrmSettingsController.php b/classes/controllers/FrmSettingsController.php index 3b36c3f123..83345a816d 100644 --- a/classes/controllers/FrmSettingsController.php +++ b/classes/controllers/FrmSettingsController.php @@ -14,6 +14,9 @@ class FrmSettingsController { */ private static $removed_payments_sections = array(); + /** + * @return void + */ public static function menu() { // Make sure admins can see the menu items FrmAppHelper::force_capability( 'frm_change_settings' ); @@ -33,6 +36,12 @@ public static function license_box() { include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php'; } + /** + * @param array $errors + * @param string $message + * + * @return void + */ public static function display_form( $errors = array(), $message = '' ) { global $frm_vars; @@ -285,6 +294,8 @@ public static function maybe_render_currency_selector( $frm_settings, $more_html /** * @since 4.0 + * + * @return void */ public static function message_settings() { $frm_settings = FrmAppHelper::get_settings(); @@ -294,6 +305,8 @@ public static function message_settings() { /** * @since 4.0 + * + * @return void */ public static function captcha_settings() { $frm_settings = FrmAppHelper::get_settings(); @@ -306,6 +319,8 @@ public static function captcha_settings() { * Shows email settings. * * @since 6.25 + * + * @return void */ public static function email_settings() { $frm_settings = FrmAppHelper::get_settings(); @@ -315,6 +330,8 @@ public static function email_settings() { /** * @since 4.0 + * + * @return void */ public static function permission_settings() { $frm_settings = FrmAppHelper::get_settings(); @@ -323,6 +340,9 @@ public static function permission_settings() { include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php'; } + /** + * @return void + */ public static function payments_settings() { $payment_sections = self::$removed_payments_sections; @@ -338,6 +358,8 @@ public static function payments_settings() { /** * @since 4.0 + * + * @return void */ public static function misc_settings() { $frm_settings = FrmAppHelper::get_settings(); @@ -396,12 +418,19 @@ public static function process_form( $stop_load = false ) { * Include the Update button on the global settings page. * * @since 4.0.02 + * + * @return void */ public static function save_button() { echo ''; } + /** + * @param bool|string $stop_load + * + * @return void + */ public static function route( $stop_load = false ) { $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); @@ -487,6 +516,8 @@ public static function page_search() { * @since 6.25 * * @param string $color Color value. + * + * @return void */ public static function fake_color_picker( $color ) { ?> diff --git a/classes/controllers/FrmStylesController.php b/classes/controllers/FrmStylesController.php index 4f42f1b7c2..8dc39adf18 100644 --- a/classes/controllers/FrmStylesController.php +++ b/classes/controllers/FrmStylesController.php @@ -20,12 +20,18 @@ class FrmStylesController { */ private static $message; + /** + * @return void + */ public static function load_pro_hooks() { if ( FrmAppHelper::pro_is_installed() ) { FrmProStylesController::load_pro_hooks(); } } + /** + * @return void + */ public static function register_post_types() { register_post_type( self::$post_type, @@ -240,6 +246,8 @@ private static function get_url_to_custom_style( &$stylesheet_urls ) { * Use a different stylesheet per site in a multisite install * * @since 3.0.03 + * + * @return string */ public static function get_file_name() { if ( is_multisite() ) { @@ -252,8 +260,14 @@ public static function get_file_name() { return $name; } + /** + * @param string $css_key + * @param string $version + * + * @return string + */ private static function get_css_version( $css_key, $version ) { - if ( 'formidable' == $css_key ) { + if ( 'formidable' === $css_key ) { $this_version = get_option( 'frm_last_style_update' ); if ( ! $this_version ) { $this_version = $version; @@ -1118,6 +1132,8 @@ public static function replace_relative_url( $css ) { * then enqueue it for the footer * * @since 2.0 + * + * @return void */ public static function enqueue_style() { global $frm_vars; @@ -1166,6 +1182,8 @@ public static function get_form_style( $form = 'default' ) { /** * @param string $class * @param string $style + * + * @return string */ public static function get_form_style_class( $class, $style ) { if ( 1 == $style ) { @@ -1187,6 +1205,8 @@ public static function get_form_style_class( $class, $style ) { * @since 3.0 * @param object $style * @param string $class + * + * @return void */ private static function maybe_add_rtl_class( $style, &$class ) { $is_rtl = isset( $style->post_content['direction'] ) && 'rtl' === $style->post_content['direction']; @@ -1198,6 +1218,8 @@ private static function maybe_add_rtl_class( $style, &$class ) { /** * @param string $val Style setting key. * @param int|string $form Form ID or 'default'. + * + * @return mixed */ public static function get_style_val( $val, $form = 'default' ) { $style = self::get_form_style( $form ); @@ -1206,6 +1228,11 @@ public static function get_style_val( $val, $form = 'default' ) { } } + /** + * @param array $default_styles + * + * @return array + */ public static function show_entry_styles( $default_styles ) { $frm_style = new FrmStyle( 'default' ); $style = $frm_style->get_one(); @@ -1228,6 +1255,12 @@ public static function show_entry_styles( $default_styles ) { return $default_styles; } + /** + * @param string $important + * @param array $field + * + * @return string + */ public static function &important_style( $important, $field ) { $important = self::get_style_val( 'important_style', $field['form_id'] ); diff --git a/classes/controllers/FrmUsageController.php b/classes/controllers/FrmUsageController.php index d1b74740af..f0562216cd 100644 --- a/classes/controllers/FrmUsageController.php +++ b/classes/controllers/FrmUsageController.php @@ -94,6 +94,8 @@ public static function send_snapshot() { * Loads scripts. * * @since 6.16.1 + * + * @return void */ public static function load_scripts() { if ( self::is_forms_list_page() || FrmAppHelper::is_admin_page( 'formidable-form-templates' ) || FrmAppHelper::is_admin_page() ) { @@ -122,6 +124,8 @@ private static function is_forms_list_page() { * AJAX handler to track flows. * * @since 6.16.1 + * + * @return void */ public static function ajax_track_flows() { FrmAppHelper::permission_check( 'frm_view_forms' ); diff --git a/classes/controllers/FrmWelcomeTourController.php b/classes/controllers/FrmWelcomeTourController.php index 5546aa42b1..f40a8ec98c 100644 --- a/classes/controllers/FrmWelcomeTourController.php +++ b/classes/controllers/FrmWelcomeTourController.php @@ -300,6 +300,8 @@ public static function render() { * Shows links after completing the Welcome tour. * * @param int $current_form_id Current form ID. + * + * @return void */ public static function show_completed_links( $current_form_id ) { $links = array( @@ -516,6 +518,8 @@ private static function get_welcome_tour_progress_bar_percent() { * Saves the checklist data. * * @param array|null $checklist The checklist data to set. + * + * @return void */ public static function save_checklist( $checklist = null ) { update_option( self::CHECKLIST_OPTION, $checklist ?? self::$checklist, false ); diff --git a/classes/controllers/FrmXMLController.php b/classes/controllers/FrmXMLController.php index 6fef5c2a51..b6b4216fdd 100644 --- a/classes/controllers/FrmXMLController.php +++ b/classes/controllers/FrmXMLController.php @@ -182,6 +182,8 @@ private static function override_url( $form, &$url ) { * * @param array $form * @param string $value + * + * @return string */ private static function get_selected_in_form( $form, $value = 'form' ) { if ( ! empty( $form ) && ! empty( $form[ $value ] ) ) { @@ -750,6 +752,11 @@ public static function get_fields_for_csv_export( $form_id, $form ) { return apply_filters( 'frm_fields_for_csv_export', $csv_fields, compact( 'form' ) ); } + /** + * @param array $mimes + * + * @return array + */ public static function allow_mime( $mimes ) { if ( ! isset( $mimes['csv'] ) ) { // allow csv files diff --git a/classes/factories/FrmFieldFactory.php b/classes/factories/FrmFieldFactory.php index e0a750ee00..831f120153 100644 --- a/classes/factories/FrmFieldFactory.php +++ b/classes/factories/FrmFieldFactory.php @@ -135,6 +135,8 @@ public static function field_has_html( $type ) { * * @param string $type * @param string $property + * + * @return mixed */ public static function field_has_property( $type, $property ) { $field = self::get_field_type( $type ); diff --git a/classes/helpers/FrmAppHelper.php b/classes/helpers/FrmAppHelper.php index 879e48fcd7..5532801bee 100644 --- a/classes/helpers/FrmAppHelper.php +++ b/classes/helpers/FrmAppHelper.php @@ -711,6 +711,14 @@ private static function should_use_custom_header_ip() { return apply_filters( 'frm_use_custom_header_ip', $should_use_custom_header_ip ); } + /** + * @param string $param + * @param mixed $default + * @param string $src + * @param callable|string $sanitize + * + * @return mixed + */ public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) { if ( strpos( $param, '[' ) ) { $params = explode( '[', $param ); @@ -881,6 +889,12 @@ public static function sanitize_value( $sanitize, &$value ) { $value = call_user_func( $sanitize, $value ); } + /** + * @param array $sanitize_method + * @param array $values + * + * @return void + */ public static function sanitize_request( $sanitize_method, &$values ) { $temp_values = $values; foreach ( $temp_values as $k => $val ) { @@ -2356,6 +2370,12 @@ public static function check_selected( $values, $current ) { return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current ); } + /** + * @param array|string $value + * @param callable|string $function + * + * @return array|string + */ public static function recursive_function_map( $value, $function ) { if ( is_array( $value ) ) { $original_function = $function; @@ -2397,6 +2417,11 @@ private static function maybe_update_value_if_null( $value, $function ) { return $value; } + /** + * @param array $array + * + * @return bool + */ public static function is_assoc( $array ) { return (bool) count( array_filter( array_keys( $array ), 'is_string' ) ); } @@ -2528,6 +2553,11 @@ public static function js_redirect( $url, $echo = false ) { return self::clip( $callback, $echo ); } + /** + * @param int|string $user_id + * + * @return int|string + */ public static function get_user_id_param( $user_id ) { if ( ! $user_id || is_numeric( $user_id ) ) { return $user_id; @@ -2746,6 +2776,14 @@ public static function setup_edit_vars( $record, $table, $fields = '', $default return $values; } + /** + * @param array $fields + * @param object $record + * @param array $values + * @param array $args + * + * @return void + */ private static function prepare_field_arrays( $fields, $record, array &$values, $args ) { if ( ! empty( $fields ) ) { foreach ( (array) $fields as $field ) { @@ -2759,6 +2797,14 @@ private static function prepare_field_arrays( $fields, $record, array &$values, } } + /** + * @param object $field + * @param object $record + * @param array $values + * @param array $args + * + * @return void + */ private static function fill_field_defaults( $field, $record, array &$values, $args ) { $post_values = $args['post_values']; @@ -3354,6 +3400,13 @@ public static function add_value_to_array( $name, $l1, $val, &$vars ) { } } + /** + * @param string $name + * @param string $class + * @param string $form_name + * + * @return void + */ public static function maybe_add_tooltip( $name, $class = 'closed', $form_name = '' ) { $tooltips = array( 'action_title' => __( 'Give this action a label for easy reference.', 'formidable' ), @@ -3441,6 +3494,13 @@ public static function prepare_and_encode( $post_content ) { return $post_content; } + /** + * @param array|string $val + * @param int|string $key + * @param array $post_content + * + * @return void + */ private static function prepare_action_slashes( $val, $key, &$post_content ) { if ( ! isset( $post_content[ $key ] ) || is_numeric( $val ) ) { return; diff --git a/classes/helpers/FrmCSVExportHelper.php b/classes/helpers/FrmCSVExportHelper.php index 6bdb6b05a2..c0c65c3b04 100644 --- a/classes/helpers/FrmCSVExportHelper.php +++ b/classes/helpers/FrmCSVExportHelper.php @@ -241,6 +241,9 @@ private static function get_standard_filter_args() { ); } + /** + * @return void + */ private static function set_class_parameters() { $args = self::get_standard_filter_args(); self::$separator = apply_filters( 'frm_csv_sep', self::$separator, $args ); @@ -254,10 +257,20 @@ private static function set_class_parameters() { self::$column_separator = apply_filters( 'frm_csv_column_sep', $col_sep, $args ); } + /** + * @param object $form + * + * @return void + */ private static function set_has_parent_id( $form ) { self::$has_parent_id = $form->parent_form_id > 0; } + /** + * @param string $filename + * + * @return void + */ private static function print_file_headers( $filename ) { header( 'Content-Description: File Transfer' ); header( 'Content-Disposition: attachment; filename="' . esc_attr( $filename ) . '"' ); @@ -297,6 +310,9 @@ public static function get_csv_format() { self::$to_encoding = $csv_format; } + /** + * @return void + */ private static function prepare_csv_headings() { $headings = array(); self::csv_headings( $headings ); @@ -314,6 +330,11 @@ private static function prepare_csv_headings() { self::print_csv_row( $headings ); } + /** + * @param object $col + * + * @return array + */ private static function field_headings( $col ) { $field_type_obj = FrmFieldFactory::get_field_factory( $col ); if ( ! empty( $field_type_obj->is_combo_field ) ) { @@ -344,6 +365,11 @@ private static function field_headings( $col ) { return $field_headings; } + /** + * @param array $headings + * + * @return void + */ private static function csv_headings( &$headings ) { $fields_by_repeater_id = array(); $repeater_ids = array(); @@ -455,10 +481,18 @@ private static function is_the_child_of_a_repeater( $field ) { return FrmField::is_repeating_field( $section ); } + /** + * @return bool + */ private static function has_parent_id() { return self::$has_parent_id; } + /** + * @param array $next_set + * + * @return void + */ private static function prepare_next_csv_rows( $next_set ) { if ( FrmAppHelper::pro_is_installed() ) { $where = array( @@ -491,6 +525,9 @@ private static function prepare_next_csv_rows( $next_set ) { } } + /** + * @return void + */ private static function prepare_csv_row() { $row = array(); self::add_field_values_to_csv( $row ); @@ -508,6 +545,11 @@ private static function prepare_csv_row() { self::print_csv_row( $row ); } + /** + * @param array $entries + * + * @return void + */ private static function add_repeat_field_values_to_csv( &$entries ) { if ( isset( self::$entry->metas ) ) { // add child entries to the parent @@ -583,6 +625,11 @@ private static function fill_missing_repeater_metas( $metas, &$entries ) { return $metas; } + /** + * @param int|string $field_id + * + * @return false|object + */ private static function get_field( $field_id ) { $field_id = (int) $field_id; foreach ( self::$fields as $field ) { @@ -593,6 +640,11 @@ private static function get_field( $field_id ) { return false; } + /** + * @param array $row + * + * @return void + */ private static function add_field_values_to_csv( &$row ) { foreach ( self::$fields as $col ) { $field_value = self::$entry->metas[ $col->id ] ?? false; @@ -685,6 +737,11 @@ private static function add_array_values_to_columns( &$row, $atts ) { } } + /** + * @param array $row + * + * @return void + */ private static function add_entry_data_to_csv( &$row ) { $row['created_at'] = FrmAppHelper::get_formatted_time( self::$entry->created_at, self::$wp_date_format, ' ' ); $row['updated_at'] = FrmAppHelper::get_formatted_time( self::$entry->updated_at, self::$wp_date_format, ' ' ); @@ -699,6 +756,11 @@ private static function add_entry_data_to_csv( &$row ) { } } + /** + * @param array $rows + * + * @return void + */ private static function print_csv_row( $rows ) { $sep = ''; $echo = 'echo' === self::$mode; @@ -748,6 +810,11 @@ private static function print_csv_row( $rows ) { } } + /** + * @param string $line + * + * @return string + */ public static function encode_value( $line ) { if ( '' === $line ) { return $line; diff --git a/classes/helpers/FrmEmailSummaryHelper.php b/classes/helpers/FrmEmailSummaryHelper.php index a316a87de3..29511f4f59 100644 --- a/classes/helpers/FrmEmailSummaryHelper.php +++ b/classes/helpers/FrmEmailSummaryHelper.php @@ -82,6 +82,8 @@ private static function get_options() { * Saves summary emails options. * * @param array $options Options data. + * + * @return void */ private static function save_options( $options ) { update_option( self::$option_name, $options ); @@ -133,6 +135,8 @@ public static function should_send_emails() { /** * Sends monthly email. + * + * @return void */ public static function send_monthly() { $monthly_email = new FrmEmailMonthly(); @@ -144,6 +148,8 @@ public static function send_monthly() { /** * Sends yearly email. + * + * @return void */ public static function send_yearly() { $yearly_email = new FrmEmailYearly(); @@ -249,6 +255,8 @@ public static function get_last_sent_date( $type ) { * * @param string $type Email type. * @param mixed $value Set custom value. If this is null, set the current date. + * + * @return void */ public static function set_last_sent_date( $type, $value = null ) { $options = self::get_options(); @@ -339,6 +347,8 @@ public static function get_top_forms( $from_date, $to_date, $limit = 5 ) { * Shows the comparison HTML in the email. * * @param float $diff Percentage of difference. + * + * @return void */ public static function show_comparison( $diff ) { if ( ! $diff ) { @@ -409,6 +419,8 @@ public static function get_button_style( $display_block = false ) { * * @param string $icon Icon file name, without file path and extension. Use .png image. * @param string $text Heading text. + * + * @return void */ public static function section_heading_with_icon( $icon, $text ) { ?> @@ -555,6 +567,8 @@ public static function maybe_remove_recipients_from_api( &$recipients ) { * @since 6.8 * * @param string $string string. + * + * @return void */ public static function plain_text_echo( $string ) { echo wp_strip_all_tags( $string ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped diff --git a/classes/helpers/FrmEntriesHelper.php b/classes/helpers/FrmEntriesHelper.php index f951797e65..8447d31481 100644 --- a/classes/helpers/FrmEntriesHelper.php +++ b/classes/helpers/FrmEntriesHelper.php @@ -21,6 +21,14 @@ class FrmEntriesHelper { */ const DRAFT_ENTRY_STATUS = 1; + /** + * @param array $fields + * @param object|string $form + * @param bool $reset + * @param array $args + * + * @return array + */ public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) { remove_action( 'media_buttons', 'FrmFormsController::insert_form_button' ); @@ -80,6 +88,8 @@ public static function setup_new_vars( $fields, $form = '', $reset = false, $arg * @since 2.05 * * @param object $field + * + * @return void */ private static function prepare_field_default_value( &$field ) { // If checkbox, multi-select dropdown, or checkbox data from entries field, the value should be an array. @@ -148,6 +158,12 @@ public static function value_is_posted( $field, $args ) { return $value_is_posted; } + /** + * @param array $values + * @param object $record + * + * @return array + */ public static function setup_edit_vars( $values, $record ) { remove_action( 'media_buttons', 'FrmFormsController::insert_form_button' ); @@ -158,6 +174,12 @@ public static function setup_edit_vars( $values, $record ) { return apply_filters( 'frm_setup_edit_entry_vars', $values, $record ); } + /** + * @param string $message + * @param array $atts + * + * @return string + */ public static function replace_default_message( $message, $atts ) { if ( strpos( $message, '[default-message' ) === false && strpos( $message, '[default_message' ) === false && @@ -339,6 +361,13 @@ public static function display_value( $value, $field, $atts = array() ) { return apply_filters( 'frm_display_value', $value, $field, $atts ); } + /** + * @param object $field + * @param mixed $value + * @param array $args + * + * @return void + */ public static function set_posted_value( $field, $value, $args ) { // If validating a field with "other" opt, set back to prev value now. if ( ! empty( $args['other'] ) ) { @@ -376,6 +405,13 @@ private static function set_parent_field_posted_value( $field, $value, $args ) { $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; // phpcs:ignore WordPress.Security.NonceVerification.Missing } + /** + * @param array|int|object $field + * @param mixed $value + * @param array $args + * + * @return void + */ public static function get_posted_value( $field, &$value, $args ) { if ( is_array( $field ) ) { $field_id = $field['id']; @@ -428,6 +464,8 @@ private static function get_posted_meta( $field_id, $args ) { * @param object $field Field object. * @param array|string $value Field value, passed by reference. * @param array $args Arguments array, passed by reference. + * + * @return void */ public static function maybe_set_other_validation( $field, &$value, &$args ) { $args['other'] = false; @@ -469,6 +507,8 @@ public static function maybe_set_other_validation( $field, &$value, &$args ) { * @param object $field Field object. * @param array|string $value Field value, passed by reference. * @param array $args Arguments array, passed by reference. + * + * @return void */ public static function set_other_repeating_vals( $field, &$value, &$args ) { if ( ! $args['parent_field_id'] ) { @@ -502,6 +542,8 @@ public static function set_other_repeating_vals( $field, &$value, &$args ) { * @param array|string $other_vals (usually of posted values). * @param object $field * @param array $args + * + * @return void */ public static function set_other_validation_val( &$value, $other_vals, $field, &$args ) { // Checkboxes and multi-select dropdowns. diff --git a/classes/helpers/FrmEntriesListHelper.php b/classes/helpers/FrmEntriesListHelper.php index 1eda6eec8b..f1aafe9b3f 100644 --- a/classes/helpers/FrmEntriesListHelper.php +++ b/classes/helpers/FrmEntriesListHelper.php @@ -38,6 +38,11 @@ public function prepare_items() { $this->prepare_pagination(); } + /** + * @param array $s_query + * + * @return void + */ protected function set_total_items( $s_query ) { $this->total_items = FrmEntry::getRecordCount( $s_query ); } @@ -46,6 +51,8 @@ protected function set_total_items( $s_query ) { * Prepares pagination. * * @since 6.5.4 + * + * @return void */ protected function prepare_pagination() { global $per_page; @@ -62,6 +69,8 @@ protected function prepare_pagination() { * Sets the global $per_page variable * * @since 6.5.4 + * + * @return void */ protected function set_per_page() { global $per_page; @@ -390,6 +399,8 @@ private function get_action_columns() { /** * @param object $item + * + * @return mixed */ private function column_value( $item ) { $col_name = $this->maybe_fix_column_name( $this->column_name ); diff --git a/classes/helpers/FrmFieldGridHelper.php b/classes/helpers/FrmFieldGridHelper.php index e75580bb2b..c36acd67ad 100644 --- a/classes/helpers/FrmFieldGridHelper.php +++ b/classes/helpers/FrmFieldGridHelper.php @@ -54,6 +54,9 @@ class FrmFieldGridHelper { private $section_is_open = false; + /** + * @param bool $nested + */ public function __construct( $nested = false ) { $this->parent_li = false; $this->current_list_size = 0; diff --git a/classes/helpers/FrmFieldsHelper.php b/classes/helpers/FrmFieldsHelper.php index 3c66867125..cc6f441005 100644 --- a/classes/helpers/FrmFieldsHelper.php +++ b/classes/helpers/FrmFieldsHelper.php @@ -12,6 +12,12 @@ class FrmFieldsHelper { */ private static $context_is_safe_to_load_field_options_from_request_data; + /** + * @param string $type + * @param int|string $form_id + * + * @return array + */ public static function setup_new_vars( $type = '', $form_id = '' ) { if ( strpos( $type, '|' ) ) { @@ -48,16 +54,33 @@ public static function setup_new_vars( $type = '', $form_id = '' ) { return $values; } + /** + * @param array $field + * @param string $plus + * + * @return string + */ public static function get_html_id( $field, $plus = '' ) { return apply_filters( 'frm_field_html_id', 'field_' . $field['field_key'] . $plus, $field ); } + /** + * @param object $field + * @param bool $doing_ajax + * + * @return array + */ public static function setup_edit_vars( $field, $doing_ajax = false ) { $values = self::field_object_to_array( $field ); return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) ); } + /** + * @param object $field + * + * @return array + */ public static function field_object_to_array( $field ) { $values = (array) $field; @@ -68,6 +91,12 @@ public static function field_object_to_array( $field ) { return $values; } + /** + * @param object $field + * @param array $field_array + * + * @return void + */ private static function fill_field_array( $field, array &$field_array ) { $field_array['options'] = $field->options; $field_array['value'] = $field->default_value; @@ -164,6 +193,8 @@ public static function get_default_field_options( $type ) { * * @param object $field * @param array $values + * + * @return void */ private static function fill_default_field_opts( $field, array &$values ) { $check_post = self::context_is_safe_to_load_field_options_from_request_data(); @@ -240,6 +271,8 @@ private static function context_is_safe_to_load_field_options_from_request_data( * * @param object $field * @param array $field_array + * + * @return void */ private static function fill_cleared_strings( $field, array &$field_array ) { if ( '' == $field_array['blank'] && '1' === $field_array['required'] ) { @@ -301,6 +334,8 @@ public static function default_blank_msg() { * * @param string $setting * @param mixed $value + * + * @return void */ private static function get_posted_field_setting( $setting, &$value ) { if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing @@ -363,6 +398,8 @@ private static function get_original_field( $field ) { * @param array $field_array * @param object $field * @param array $atts + * + * @return void */ private static function prepare_field_options_for_display( &$field_array, $field, $atts ) { $field_obj = FrmFieldFactory::get_field_object( $field ); @@ -382,6 +419,14 @@ public static function get_default_field( $type ) { return $field_type->get_new_field_defaults(); } + /** + * @param array $values + * @param object $field + * @param int|string $form_id + * @param string $new_key + * + * @return void + */ public static function fill_field( &$values, $field, $form_id, $new_key = '' ) { global $wpdb; @@ -443,6 +488,8 @@ public static function get_error_msg( $field, $error ) { * @param string $msg * @param string $error * @param array|object $field + * + * @return string */ private static function maybe_replace_substrings_with_field_name( $msg, $error, $field ) { $field_name = is_array( $field ) ? $field['name'] : $field->name; @@ -498,12 +545,23 @@ private static function get_substrings_to_replace_with_field_name( $field_name, return $substrings; } + /** + * @param int|string $form_id + * @param array $error + * + * @return array + */ public static function get_form_fields( $form_id, $error = array() ) { $fields = FrmField::get_all_for_form( $form_id ); return apply_filters( 'frm_get_paged_fields', $fields, $form_id, $error ); } + /** + * @param string $type + * + * @return string + */ public static function get_default_html( $type = 'text' ) { $field = FrmFieldFactory::get_field_type( $type ); $default_html = $field->default_html(); @@ -521,6 +579,8 @@ public static function get_default_html( $type = 'text' ) { * @param array $errors * @param object $form * @param object $form_action + * + * @return void */ public static function show_fields( $fields, $errors, $form, $form_action ) { foreach ( $fields as $field ) { @@ -534,6 +594,8 @@ public static function show_fields( $fields, $errors, $form, $form_action ) { * * @param array $atts * @param array|string $value + * + * @return void */ public static function run_wpautop( $atts, &$value ) { $autop = $atts['wpautop'] ?? true; @@ -591,6 +653,13 @@ public static function is_placeholder_field_type( $type ) { return ! in_array( $type, array( 'radio', 'checkbox', 'hidden', 'file' ), true ); } + /** + * @param array $field + * @param int|string $opt_key + * @param string $type + * + * @return string + */ public static function get_checkbox_id( $field, $opt_key, $type = 'checkbox' ) { $id = $field['id']; if ( isset( $field['in_section'] ) && $field['in_section'] && ! FrmAppHelper::is_admin_page( 'formidable' ) ) { @@ -600,6 +669,11 @@ public static function get_checkbox_id( $field, $opt_key, $type = 'checkbox' ) { return 'frm_' . $type . '_' . $id . '-' . $opt_key; } + /** + * @param array $field + * + * @return void + */ public static function show_single_option( $field ) { self::hidden_field_option( $field ); @@ -638,7 +712,10 @@ public static function show_single_option( $field ) { * Include hidden row for javascript to duplicate. * * @since 4.0 + * * @param array $field + * + * @return void */ private static function hidden_field_option( $field ) { // Don't duplicate during an ajax add option. @@ -674,12 +751,26 @@ private static function get_default_value_type( $field ) { return $default_type; } + /** + * @param array|string $opt + * @param int|string $opt_key + * @param array $field + * + * @return mixed + */ public static function get_value_from_array( $opt, $opt_key, $field ) { $opt = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field ); return FrmFieldsController::check_value( $opt, $opt_key, $field ); } + /** + * @param array|string $opt + * @param int|string $opt_key + * @param array $field + * + * @return string + */ public static function get_label_from_array( $opt, $opt_key, $field ) { $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field ); @@ -693,6 +784,8 @@ public static function get_label_from_array( $opt, $opt_key, $field ) { * @since 6.4.1 Added `inside_class` in the arguments. * * @param array $args The arguments. + * + * @return void */ public static function inline_modal( $args ) { $defaults = array( @@ -712,6 +805,8 @@ public static function inline_modal( $args ) { /** * @since 4.0 + * + * @return void */ public static function smart_values() { $continue = apply_filters( 'frm_smart_values_box', true ); @@ -726,6 +821,8 @@ public static function smart_values() { /** * @since 4.0 + * + * @return void */ public static function input_mask() { include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/input-mask-info.php'; @@ -733,6 +830,8 @@ public static function input_mask() { /** * @since 4.0 + * + * @return void */ public static function layout_classes() { include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/layout-classes.php'; @@ -762,6 +861,13 @@ public static function get_term_link( $tax_id ) { return $link; } + /** + * @param array|string $observed_value + * @param string $cond + * @param array|string $hide_opt + * + * @return bool + */ public static function value_meets_condition( $observed_value, $cond, $hide_opt ) { $hide_opt = self::get_value_for_comparison( $hide_opt ); $observed_value = self::get_value_for_comparison( $observed_value ); @@ -811,7 +917,7 @@ public static function value_meets_condition( $observed_value, $cond, $hide_opt * @since 2.05 * * @param array|string $value - * @return string + * @return array|string */ private static function get_value_for_comparison( $value ) { // Remove white space from hide_opt @@ -824,6 +930,13 @@ private static function get_value_for_comparison( $value ) { return $value; } + /** + * @param array $observed_value + * @param string $cond + * @param array|string $hide_opt + * + * @return bool + */ public static function array_value_condition( $observed_value, $cond, $hide_opt ) { $m = false; if ( $cond === '==' ) { @@ -897,6 +1010,12 @@ public static function basic_replace_shortcodes( $value, $form, $entry ) { return $value; } + /** + * @param string $content + * @param int|string $form_id + * + * @return array + */ public static function get_shortcodes( $content, $form_id ) { if ( FrmAppHelper::pro_is_installed() ) { return FrmProDisplaysHelper::get_shortcodes( $content, $form_id ); @@ -916,6 +1035,11 @@ public static function get_shortcodes( $content, $form_id ) { return $matches; } + /** + * @param array $fields + * + * @return string + */ public static function allowed_shortcodes( $fields = array() ) { $tagregexp = array( 'editlink', @@ -945,6 +1069,13 @@ public static function allowed_shortcodes( $fields = array() ) { return $tagregexp; } + /** + * @param string $content + * @param false|object $entry + * @param array $shortcodes + * + * @return string + */ public static function replace_content_shortcodes( $content, $entry, $shortcodes ) { foreach ( $shortcodes[0] as $short_key => $tag ) { if ( empty( $tag ) ) { @@ -1210,6 +1341,13 @@ public static function process_get_shortcode( $atts, $return_array = false ) { return $new_value; } + /** + * @param mixed $value + * @param object $field + * @param array $atts + * + * @return mixed + */ public static function get_display_value( $value, $field, $atts = array() ) { $value = apply_filters( 'frm_get_' . $field->type . '_display_value', $value, $field, $atts ); @@ -1222,6 +1360,8 @@ public static function get_display_value( $value, $field, $atts = array() ) { /** * @param array $atts Includes value, field, and atts. + * + * @return mixed */ public static function get_unfiltered_display_value( $atts ) { $value = $atts['value']; @@ -1308,6 +1448,8 @@ public static function get_field_types( $type ) { * Get a list of all fields that use a single value input. * * @since 4.0 + * + * @return array */ public static function single_input_fields() { $fields = array( @@ -1363,6 +1505,8 @@ public static function is_other_opt( $opt_key ) { * @since 2.0.6 * * @param array $args + * + * @return string */ public static function get_other_val( $args ) { $defaults = array( @@ -1495,8 +1639,11 @@ public static function prepare_other_input( $args, &$other_opt, &$checked ) { /** * @since 2.0.6 + * * @param array $args * @param array $other_args + * + * @return void */ private static function set_other_name( $args, &$other_args ) { // Set up name for other field @@ -1515,8 +1662,11 @@ private static function set_other_name( $args, &$other_args ) { * Find the parent and pointer, and get text for "other" text field * * @since 2.0.6 + * * @param array $args * @param array $other_args + * + * @return void */ private static function set_other_value( $args, &$other_args ) { $parent = ''; @@ -1546,7 +1696,10 @@ private static function set_other_value( $args, &$other_args ) { * If this field includes an other option, show it * * @since 2.0.6 + * * @param array $args + * + * @return void */ public static function include_other_input( $args ) { if ( ! $args['other_opt'] ) { @@ -1604,6 +1757,11 @@ public static function get_other_field_html_id( $type, $html_id, $opt_key = fals return $other_id; } + /** + * @param string $val + * + * @return string + */ public static function switch_field_ids( $val ) { global $frm_duplicate_ids; $replace = array(); @@ -1682,6 +1840,8 @@ private static function switch_ids_except_strings( $replace, $replace_with, $exc /** * @since 4.0 + * + * @return void */ public static function bulk_options_overlay() { $prepop = array(); @@ -1690,6 +1850,9 @@ public static function bulk_options_overlay() { include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/bulk-options-overlay.php'; } + /** + * @return array + */ public static function get_us_states() { $states = array( 'AL' => 'Alabama', @@ -1748,6 +1911,9 @@ public static function get_us_states() { return apply_filters( 'frm_us_states', $states ); } + /** + * @return array + */ public static function get_countries() { $countries = array( __( 'Afghanistan', 'formidable' ), @@ -2014,6 +2180,8 @@ public static function get_countries() { * * @param array $prepop Bulk options. * @param array|false $include_class Include the class in the bulk options. + * + * @return void */ public static function get_bulk_prefilled_opts( array &$prepop, $include_class = false ) { // Countries. @@ -2131,6 +2299,8 @@ public static function get_bulk_prefilled_opts( array &$prepop, $include_class = * * @param int $selector_field_id * @param array $selector_args + * + * @return void */ public static function display_field_value_selector( $selector_field_id, $selector_args ) { $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args ); @@ -2248,6 +2418,8 @@ public static function show_add_field_buttons( $args ) { * @since 5.0.04 * * @param array $field Field data. + * + * @return void */ public static function show_radio_display_format( $field ) { $options = self::get_display_format_options( $field ); @@ -2471,6 +2643,8 @@ public static function get_all_draft_field_ids( $form_id ) { * * @param array $args Field arguments. * @param bool $should_hide_bulk_edit Whether to hide bulk edit. + * + * @return void */ public static function render_ai_generate_options_button( $args, $should_hide_bulk_edit = false ) { $attributes = array( 'class' => self::get_ai_generate_options_button_class() ); diff --git a/classes/helpers/FrmFormActionsHelper.php b/classes/helpers/FrmFormActionsHelper.php index 9a4135fe4b..a33268c6b4 100644 --- a/classes/helpers/FrmFormActionsHelper.php +++ b/classes/helpers/FrmFormActionsHelper.php @@ -12,6 +12,8 @@ class FrmFormActionsHelper { * @param int|string $form_id * @param string $type * @param int $limit + * + * @return array */ public static function get_action_for_form( $form_id, $type = 'all', $limit = 99 ) { _deprecated_function( __FUNCTION__, '2.0.9', 'FrmFormAction::get_action_for_form' ); diff --git a/classes/helpers/FrmFormMigratorsHelper.php b/classes/helpers/FrmFormMigratorsHelper.php index f1538a90d1..7699ca706f 100644 --- a/classes/helpers/FrmFormMigratorsHelper.php +++ b/classes/helpers/FrmFormMigratorsHelper.php @@ -111,6 +111,11 @@ private static function importable_forms() { ); } + /** + * @param array $install + * + * @return string|null + */ private static function install_banner( $install ) { if ( empty( $install['link'] ) ) { return ''; diff --git a/classes/helpers/FrmFormTemplatesHelper.php b/classes/helpers/FrmFormTemplatesHelper.php index b4741cf5ba..b9ebafbcd1 100644 --- a/classes/helpers/FrmFormTemplatesHelper.php +++ b/classes/helpers/FrmFormTemplatesHelper.php @@ -22,6 +22,8 @@ class FrmFormTemplatesHelper { * @param array $template Template data. * @param string $pricing Upgrade link URL. * @param string $license_type License type. + * + * @return void */ public static function prepare_template_details( &$template, $pricing, $license_type ) { $template['is_featured'] = ! empty( $template['is_featured'] ); diff --git a/classes/helpers/FrmFormsHelper.php b/classes/helpers/FrmFormsHelper.php index 163418b05d..63f2425fbe 100644 --- a/classes/helpers/FrmFormsHelper.php +++ b/classes/helpers/FrmFormsHelper.php @@ -16,11 +16,19 @@ class FrmFormsHelper { /** * @since 2.2.10 + * + * @return string */ public static function form_error_class() { return apply_filters( 'frm_form_error_class', 'frm_error_style' ); } + /** + * @param string $key + * @param false|object $form + * + * @return string + */ public static function get_direct_link( $key, $form = false ) { $target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $key ) ); $target_url = apply_filters( 'frm_direct_link', $target_url, $key, $form ); @@ -28,6 +36,13 @@ public static function get_direct_link( $key, $form = false ) { return $target_url; } + /** + * @param string $field_name + * @param int|string $field_value + * @param array $args + * + * @return void + */ public static function forms_dropdown( $field_name, $field_value = '', $args = array() ) { $defaults = array( 'blank' => true, @@ -72,9 +87,12 @@ public static function forms_dropdown( $field_name, $field_value = '', $args = a /** * @since 2.0.6 + * * @param string $class * @param string $param * @param array $add_html + * + * @return void */ public static function add_html_attr( $class, $param, &$add_html ) { if ( ! empty( $class ) ) { @@ -84,6 +102,8 @@ public static function add_html_attr( $class, $param, &$add_html ) { /** * @param false|object|string $selected - The label for the placeholder, or the form object. + * + * @return void */ public static function form_switcher( $selected = false ) { $where = apply_filters( 'frm_forms_dropdown', array(), '' ); @@ -209,6 +229,13 @@ public static function form_switcher( $selected = false ) { [draft_label][/if save_draft]'; @@ -498,6 +540,15 @@ public static function get_start_over_shortcode() { return '[if start_over][start_over_label][/if start_over]'; } + /** + * @param string $html + * @param object $form + * @param string $submit + * @param object|null $form_action + * @param array $values + * + * @return void + */ public static function get_custom_submit( $html, $form, $submit, $form_action, $values ) { $button = self::replace_shortcodes( $html, $form, $submit, $form_action, $values ); if ( ! strpos( $button, '[button_action]' ) ) { @@ -532,6 +583,8 @@ public static function get_custom_submit( $html, $form, $submit, $form_action, $ /** * @since 4.0 + * + * @return array */ public static function html_shortcodes() { $codes = array( @@ -691,7 +744,10 @@ private static function get_field_type_data_for_insert_opt_html() { /** * @since 4.0 + * * @param array $args + * + * @return void */ public static function insert_code_html( $args ) { $defaults = array( @@ -744,6 +800,8 @@ public static function prepare_field_type( &$field ) { * @param object $form * @param array $fields * @param bool $reset_fields + * + * @return void */ public static function auto_add_end_section_fields( $form, $fields, &$reset_fields ) { if ( empty( $fields ) ) { @@ -806,6 +864,8 @@ public static function auto_add_end_section_fields( $form, $fields, &$reset_fiel * @param array $end_section_values * @param object $field * @param string $move + * + * @return void */ public static function maybe_create_end_section( &$open, &$reset_fields, &$add_order, $end_section_values, $field, $move = 'no' ) { if ( ! $open ) { @@ -826,6 +886,15 @@ public static function maybe_create_end_section( &$open, &$reset_fields, &$add_o $reset_fields = true; } + /** + * @param string $html + * @param object $form + * @param bool $title + * @param bool $description + * @param array $values + * + * @return string + */ public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) { $codes = array( 'form_name' => $title, @@ -880,6 +949,11 @@ public static function replace_shortcodes( $html, $form, $title = false, $descri return $html; } + /** + * @param string $submit + * + * @return string + */ public static function submit_button_label( $submit ) { if ( ! $submit ) { $frm_settings = FrmAppHelper::get_settings(); @@ -1050,7 +1124,10 @@ public static function get_form_style( $form ) { * Display the validation error messages when an entry is submitted * * @since 2.0.6 + * * @param array $args Includes img, errors. + * + * @return void */ public static function show_errors( $args ) { $invalid_msg = self::get_invalid_error_message( $args ); @@ -1077,7 +1154,10 @@ public static function show_errors( $args ) { * If the message in the global settings is empty, show every validation message in the error box * * @since 2.0.6 + * * @param array $args Includes img, errors, and show_img. + * + * @return void */ public static function show_error( $args ) { // remove any blank messages @@ -1104,6 +1184,11 @@ public static function show_error( $args ) { } } + /** + * @param int|string $id + * + * @return void + */ public static function maybe_get_scroll_js( $id ) { $offset = apply_filters( 'frm_scroll_offset', 4, array( 'form_id' => $id ) ); if ( $offset != - 1 ) { @@ -1111,6 +1196,11 @@ public static function maybe_get_scroll_js( $id ) { } } + /** + * @param int|string $form_id + * + * @return void + */ public static function get_scroll_js( $form_id ) { echo ''; } @@ -1335,6 +1425,8 @@ public static function delete_trash_links( $id ) { /** * @since 3.0 + * + * @return array */ public static function css_classes() { $classes = array( diff --git a/classes/helpers/FrmListHelper.php b/classes/helpers/FrmListHelper.php index 813e40427d..2bf8ffd8b2 100644 --- a/classes/helpers/FrmListHelper.php +++ b/classes/helpers/FrmListHelper.php @@ -275,6 +275,11 @@ public function search_box( $text, $input_id ) { FrmAppHelper::show_search_box( compact( 'text', 'input_id' ) ); } + /** + * @param string $param_name + * + * @return void + */ private function hidden_search_inputs( $param_name ) { if ( ! empty( $_REQUEST[ $param_name ] ) ) { $value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) ); @@ -444,6 +449,11 @@ public function current_action() { return $action; } + /** + * @param string $action_name + * + * @return false|string + */ private function get_bulk_action( $action_name ) { $action = false; $action_param = $this->get_param( @@ -669,6 +679,11 @@ protected function pagination( $which ) { echo $this->_pagination; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } + /** + * @param int $total_pages + * + * @return array + */ private function disabled_pages( $total_pages ) { $current = $this->get_pagenum(); $disable = array( @@ -695,6 +710,11 @@ private function disabled_pages( $total_pages ) { return $disable; } + /** + * @param string $link + * + * @return string + */ private function link_label( $link ) { $labels = array( 'first' => __( 'First page', 'formidable' ), @@ -712,6 +732,11 @@ private function current_url() { return remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url ); } + /** + * @param array $atts + * + * @return string + */ private function add_page_link( $atts ) { if ( $atts['disabled'] ) { $link = $this->add_disabled_link( $atts['arrow'] ); @@ -722,10 +747,20 @@ private function add_page_link( $atts ) { return $link; } + /** + * @param string $label + * + * @return string + */ private function add_disabled_link( $label ) { return ''; } + /** + * @param array $atts + * + * @return string + */ private function add_active_link( $atts ) { $url = esc_url( add_query_arg( 'paged', $atts['number'], $this->current_url() ) ); $label = $this->link_label( $atts['page'] ); diff --git a/classes/helpers/FrmOnSubmitHelper.php b/classes/helpers/FrmOnSubmitHelper.php index aaa2e56f65..83be911a31 100644 --- a/classes/helpers/FrmOnSubmitHelper.php +++ b/classes/helpers/FrmOnSubmitHelper.php @@ -24,6 +24,8 @@ class FrmOnSubmitHelper { * @type string $action_key Action key. * @type array $values Contains `fields` (form fields) and `id` (form ID). * } + * + * @return void */ public static function show_message_settings( $args ) { $id_attr = $args['action_control']->get_field_id( 'success_msg' ); @@ -81,6 +83,8 @@ public static function show_message_settings( $args ) { * @type string $action_key Action key. * @type array $values Contains `fields` (form fields) and `id` (form ID). * } + * + * @return void */ public static function show_redirect_settings( $args ) { include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/on_submit_redirect_settings.php'; @@ -98,6 +102,8 @@ public static function show_redirect_settings( $args ) { * @type string $action_key Action key. * @type array $values Contains `fields` (form fields) and `id` (form ID). * } + * + * @return void */ public static function show_page_settings( $args ) { $name_attr = $args['action_control']->get_field_name( 'success_page_id' ); @@ -153,15 +159,24 @@ public static function get_action_type( $action ) { return $action->post_content['success_action'] ?? self::get_default_action_type(); } + /** + * @return string + */ public static function get_default_action_type() { return 'message'; } + /** + * @return string + */ public static function get_default_msg() { $msg = FrmAppHelper::get_settings()->success_msg; return $msg ? $msg : __( 'Your responses were successfully submitted. Thank you!', 'formidable' ); } + /** + * @return string + */ public static function get_default_redirect_msg() { return __( 'Please wait while you are redirected.', 'formidable' ); } @@ -181,6 +196,8 @@ public static function get_default_new_tab_msg() { * Adds the first On Submit action data to the form options to be saved. * * @param int $form_id Form ID. + * + * @return void */ public static function save_on_submit_settings( $form_id ) { $actions = self::get_actions( $form_id ); @@ -215,6 +232,8 @@ public static function save_on_submit_settings( $form_id ) { * @param array $form_options Form options. * @param object $action Optional. The On Submit action object. * @param string $event Form event. Default is `create`. + * + * @return void */ public static function populate_on_submit_data( &$form_options, $action = null, $event = 'create' ) { $opt = 'update' === $event ? 'edit_' : 'success_'; @@ -253,6 +272,8 @@ public static function populate_on_submit_data( &$form_options, $action = null, * @since 6.1.1 * * @param int $form_id Form ID. + * + * @return void */ public static function maybe_migrate_submit_settings_to_action( $form_id ) { $form = FrmDb::get_row( 'frm_forms', array( 'id' => $form_id ), 'options,editable' ); diff --git a/classes/helpers/FrmShortcodeHelper.php b/classes/helpers/FrmShortcodeHelper.php index 2b38e0ae1b..a47e402799 100644 --- a/classes/helpers/FrmShortcodeHelper.php +++ b/classes/helpers/FrmShortcodeHelper.php @@ -128,6 +128,14 @@ public static function get_shortcode_tag( $shortcodes, $short_key, $args = array return $tag; } + /** + * @param bool $no_vars + * @param string $code + * @param string $replace_with + * @param string $html + * + * @return void + */ public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) { if ( $no_vars ) { $html = str_replace( '[if ' . $code . ']', '', $html ); diff --git a/classes/helpers/FrmStylesHelper.php b/classes/helpers/FrmStylesHelper.php index e1b99518ff..eb3a531f6e 100644 --- a/classes/helpers/FrmStylesHelper.php +++ b/classes/helpers/FrmStylesHelper.php @@ -5,6 +5,9 @@ class FrmStylesHelper { + /** + * @return array + */ public static function get_upload_base() { $uploads = wp_upload_dir(); if ( is_ssl() && ! preg_match( '/^https:\/\/.*\..*$/', $uploads['baseurl'] ) ) { @@ -18,6 +21,8 @@ public static function get_upload_base() { * Called from the admin header. * * @since 4.0 + * + * @return void */ public static function save_button() { ?> @@ -27,6 +32,8 @@ public static function save_button() { /** * @since 2.05 + * + * @return array */ public static function get_css_label_positions() { return array( @@ -67,6 +74,9 @@ public static function get_single_label_positions( $field = array() ) { return apply_filters( 'frm_single_label_positions', $label_positions, $field ); } + /** + * @return array + */ public static function minus_icons() { return array( 0 => array( @@ -92,6 +102,9 @@ public static function minus_icons() { ); } + /** + * @return array + */ public static function arrow_icons() { $minus_icons = self::minus_icons(); @@ -261,6 +274,8 @@ private static function get_rgb_array_from_hex( $hex ) { * * @param string $hex Hex color string. * @param float|int|string $a Alpha channel value. + * + * @return string */ public static function hex2rgba( $hex, $a ) { $rgb = self::hex2rgb( $hex ); @@ -349,6 +364,8 @@ private static function hsl_to_hex( $hsl ) { * @since 2.3 * @param string $hex string The original color in hex format #ffffff. * @param int $steps integer Should be between -255 and 255. Negative = darker, positive = lighter. + * + * @return string */ public static function adjust_brightness( $hex, $steps ) { $steps = max( - 255, min( 255, $steps ) ); diff --git a/classes/helpers/FrmSubmitHelper.php b/classes/helpers/FrmSubmitHelper.php index 82beef2fc5..db11a18027 100644 --- a/classes/helpers/FrmSubmitHelper.php +++ b/classes/helpers/FrmSubmitHelper.php @@ -146,6 +146,8 @@ public static function copy_submit_field_settings_to_form( $form ) { * @param object $form Form object. * @param array $fields Array of fields. * @param bool $reset_fields Flag to refresh fields after one is created or updated. + * + * @return void */ public static function maybe_create_submit_field( $form, $fields, &$reset_fields ) { if ( self::has_submit_field_in_list( $fields ) ) { @@ -173,6 +175,8 @@ public static function maybe_create_submit_field( $form, $fields, &$reset_fields * Removes submit field from the list of fields. * * @param array $fields Array of fields. + * + * @return void */ public static function remove_submit_field_from_list( &$fields ) { foreach ( $fields as $key => $field ) { @@ -206,6 +210,8 @@ public static function only_contains_submit_field( $fields ) { * @since 6.25.1 * * @param int $field_count The current field count. + * + * @return void */ public static function update_last_row_fields_order_when_adding_field( $field_count ) { $last_row_field_ids = FrmAppHelper::get_post_param( 'last_row_field_ids', array() ); @@ -233,6 +239,8 @@ public static function update_last_row_fields_order_when_adding_field( $field_co * Prints the hidden input that contains the last row fields order to be processed in JS after adding new field. * * @since 6.25.1 + * + * @return void */ public static function print_last_row_fields_order_input() { if ( ! self::$last_row_fields_order ) { diff --git a/classes/helpers/FrmTipsHelper.php b/classes/helpers/FrmTipsHelper.php index cbf52dbd80..2de7aea0ae 100644 --- a/classes/helpers/FrmTipsHelper.php +++ b/classes/helpers/FrmTipsHelper.php @@ -390,6 +390,11 @@ public static function get_import_tip() { return $tips; } + /** + * @param array $tips + * + * @return array + */ public static function get_random_tip( $tips ) { $random = random_int( 0, count( $tips ) - 1 ); diff --git a/classes/helpers/FrmXMLHelper.php b/classes/helpers/FrmXMLHelper.php index eead897256..8edfe081d8 100644 --- a/classes/helpers/FrmXMLHelper.php +++ b/classes/helpers/FrmXMLHelper.php @@ -10,6 +10,12 @@ class FrmXMLHelper { */ private static $installing_template = false; + /** + * @param array|string $opt + * @param string $padding + * + * @return void + */ public static function get_xml_values( $opt, $padding ) { if ( is_array( $opt ) ) { foreach ( $opt as $ok => $ov ) { @@ -280,6 +286,11 @@ public static function import_xml_forms( $forms, $imported ) { return $imported; } + /** + * @param object $item + * + * @return array + */ private static function fill_form( $item ) { $form = array( 'id' => (int) $item->id, @@ -309,6 +320,11 @@ private static function fill_form( $item ) { return $form; } + /** + * @param array $form + * + * @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 $edit_query = array( @@ -330,6 +346,13 @@ private static function maybe_get_form( $form ) { return $form; } + /** + * @param object $this_form + * @param array $form + * @param array $imported + * + * @return void + */ private static function update_form( $this_form, $form, &$imported ) { $form_id = $this_form->id; FrmForm::update( $form_id, $form ); @@ -342,6 +365,11 @@ private static function update_form( $this_form, $form, &$imported ) { $imported['form_status'][ $form_id ] = 'updated'; } + /** + * @param int|string $form_id + * + * @return array + */ private static function get_form_fields( $form_id ) { $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); $old_fields = array(); @@ -541,6 +569,12 @@ private static function do_after_field_imported_action( $field_array, $form_fiel do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[ $field_array['field_key'] ], $old_field_id ); } + /** + * @param object $field + * @param int|string $form_id + * + * @return array + */ private static function fill_field( $field, $form_id ) { return array( 'id' => (int) $field->id, @@ -1177,6 +1211,13 @@ private static function maybe_prepare_json_view_content( $content ) { return $content; } + /** + * @param array $post + * @param object $item + * @param array $imported + * + * @return void + */ private static function populate_post( &$post, $item, $imported ) { if ( isset( $item->attachment_url ) ) { $post['attachment_url'] = (string) $item->attachment_url; @@ -1296,6 +1337,12 @@ private static function populate_postmeta( &$post, $meta, $imported ) { $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; } + /** + * @param array $post + * @param object $layout + * + * @return void + */ private static function populate_layout( &$post, $layout ) { $post['layout'][ (string) $layout->type ] = (string) $layout->data; } @@ -1412,6 +1459,11 @@ private static function update_layout( &$post, $post_id ) { } } + /** + * @param array $imported + * + * @return void + */ private static function maybe_update_stylesheet( $imported ) { $new_styles = ! empty( $imported['imported']['styles'] ); $updated_styles = ! empty( $imported['updated']['styles'] ); diff --git a/classes/models/FrmAddon.php b/classes/models/FrmAddon.php index 52b0312fc4..377b827b41 100644 --- a/classes/models/FrmAddon.php +++ b/classes/models/FrmAddon.php @@ -64,17 +64,30 @@ public function __construct() { $this->edd_plugin_updater(); } + /** + * @return void + */ public static function load_hooks() { add_filter( 'frm_include_addon_page', '__return_true' ); new static(); } + /** + * @param array $plugins + * + * @return array + */ public function insert_installed_addon( $plugins ) { $plugins[ $this->plugin_slug ] = $this; return $plugins; } + /** + * @param string $plugin_slug + * + * @return false|FrmAddon + */ public static function get_addon( $plugin_slug ) { $plugins = apply_filters( 'frm_installed_addons', array() ); $plugin = false; @@ -85,6 +98,9 @@ public static function get_addon( $plugin_slug ) { return $plugin; } + /** + * @return void + */ public function edd_plugin_updater() { $this->is_license_revoked(); @@ -152,6 +168,9 @@ public function plugins_api_filter( $_data, $_action = '', $_args = null ) { return (object) $_data; } + /** + * @return string + */ public function get_license() { $license = $this->maybe_get_pro_license(); if ( ! empty( $license ) ) { @@ -168,6 +187,8 @@ public function get_license() { /** * @since 3.04.03 + * + * @return false|string */ protected function maybe_get_pro_license() { // prevent a loop if $this is the pro plugin @@ -196,6 +217,8 @@ protected function maybe_get_pro_license() { * Activate the license in wp-config.php * * @since 2.04 + * + * @return string */ public function activate_defined_license() { $license = $this->get_defined_license(); @@ -213,6 +236,8 @@ public function activate_defined_license() { * Check the wp-config.php for the license key * * @since 2.04 + * + * @return false|string */ public function get_defined_license() { $constant_name = 'FRM_' . strtoupper( $this->plugin_slug ) . '_LICENSE'; @@ -220,10 +245,18 @@ public function get_defined_license() { return defined( $constant_name ) ? constant( $constant_name ) : false; } + /** + * @param string $license + * + * @return void + */ public function set_license( $license ) { update_option( $this->option_name . 'key', $license ); } + /** + * @return mixed + */ public function is_active() { return get_option( $this->option_name . 'active' ); } @@ -232,6 +265,8 @@ public function is_active() { * @since 3.04.03 * * @param array|string $error + * + * @return void */ public function maybe_clear_license( $error ) { if ( is_array( $error ) && $error['code'] === 'disabled' && $error['license'] === $this->license ) { @@ -239,6 +274,9 @@ public function maybe_clear_license( $error ) { } } + /** + * @return void + */ public function clear_license() { delete_option( $this->option_name . 'active' ); delete_option( $this->option_name . 'key' ); @@ -274,6 +312,11 @@ protected function maybe_set_active( $is_valid ) { $this->license = ''; } + /** + * @param bool $is_active + * + * @return void + */ public function set_active( $is_active ) { $this->delete_cache(); FrmAppHelper::save_combined_js(); @@ -284,6 +327,8 @@ public function set_active( $is_active ) { * Updates roles capabilities after pro license is active. * * @since 5.0 + * + * @return void */ protected function update_pro_capabilities() { global $wp_roles; @@ -315,6 +360,8 @@ protected function update_pro_capabilities() { /** * @since 3.04.03 + * + * @return void */ protected function delete_cache() { delete_transient( 'frm_api_licence' ); @@ -385,6 +432,11 @@ public function show_license_message( $file, $plugin ) { echo '

'; } + /** + * @param mixed $transient + * + * @return mixed + */ public function clear_expired_download( $transient ) { if ( ! is_object( $transient ) ) { return $transient; @@ -417,6 +469,8 @@ public function clear_expired_download( $transient ) { * @since 3.04.03 * * @param object $transient The current plugin info saved for update. + * + * @return void */ private function prepare_update_details( &$transient ) { $version_info = $transient; @@ -502,6 +556,11 @@ private function maybe_use_beta_url( &$version_info ) { } } + /** + * @param object $transient + * + * @return bool + */ private function is_current_version( $transient ) { if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) { return false; @@ -523,10 +582,16 @@ private function has_been_cleared() { return $last_cleared && $last_cleared > gmdate( 'Y-m-d H:i:s', strtotime( '-5 minutes' ) ); } + /** + * @return void + */ private function cleared_plugins() { update_option( 'frm_last_cleared', gmdate( 'Y-m-d H:i:s' ) ); } + /** + * @return void + */ private function is_license_revoked() { if ( empty( $this->license ) || empty( $this->plugin_slug ) || isset( $_POST['license'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing return; @@ -607,11 +672,16 @@ private function update_last_checked() { /** * Use a new cache after the license is changed, or Formidable is updated. + * + * @return string */ private function transient_key() { return 'frm_' . md5( sanitize_key( $this->license . '_' . $this->plugin_slug ) ); } + /** + * @return void + */ public static function activate() { FrmAppHelper::permission_check( 'frm_change_settings' ); check_ajax_referer( 'frm_ajax', 'nonce' ); @@ -702,6 +772,9 @@ private function die_if_not_allowed() { ); } + /** + * @return array + */ private function get_license_status() { $this->set_running(); @@ -737,6 +810,9 @@ private function get_license_status() { return $response; } + /** + * @return array + */ private function get_messages() { return array( 'valid' => __( 'Your license has been activated. Enjoy!', 'formidable' ), @@ -751,6 +827,8 @@ private function get_messages() { /** * @since 4.03 + * + * @return void */ public static function reset_cache() { FrmAppHelper::permission_check( 'frm_change_settings' ); @@ -767,6 +845,9 @@ public static function reset_cache() { wp_send_json( $response ); } + /** + * @return void + */ public static function deactivate() { FrmAppHelper::permission_check( 'frm_change_settings' ); check_ajax_referer( 'frm_ajax', 'nonce' ); @@ -798,6 +879,8 @@ public static function deactivate() { /** * @since 4.03 + * + * @return FrmAddon */ private static function set_license_from_post() { $plugin_slug = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' ); @@ -867,6 +950,9 @@ public function send_mothership_request( $action ) { return $message; } + /** + * @return void + */ public function manually_queue_update() { $updates = new stdClass(); $updates->last_checked = 0; diff --git a/classes/models/FrmAntiSpam.php b/classes/models/FrmAntiSpam.php index 0b423f3631..450ed50b3f 100644 --- a/classes/models/FrmAntiSpam.php +++ b/classes/models/FrmAntiSpam.php @@ -72,6 +72,9 @@ private function get( $current = true ) { return $form_token_string; } + /** + * @return string + */ private function get_antispam_secret_key() { $secret_key = get_option( 'frm_antispam_secret_key' ); diff --git a/classes/models/FrmCreateFile.php b/classes/models/FrmCreateFile.php index 6619803545..e147249f4a 100644 --- a/classes/models/FrmCreateFile.php +++ b/classes/models/FrmCreateFile.php @@ -14,6 +14,9 @@ class FrmCreateFile { public $chmod_file = 0644; private $has_permission = false; + /** + * @param array $atts + */ public function __construct( $atts ) { $this->folder_name = $atts['folder_name'] ?? ''; $this->file_name = $atts['file_name']; @@ -183,6 +186,9 @@ private function get_needed_dirs() { return $needed_dirs; } + /** + * @return array|bool + */ private function get_creds() { if ( ! function_exists( 'get_filesystem_method' ) ) { include_once ABSPATH . 'wp-admin/includes/file.php'; @@ -200,6 +206,8 @@ private function get_creds() { /** * @param string $type + * + * @return array|false */ private function get_ftp_creds( $type ) { $credentials = get_option( diff --git a/classes/models/FrmDb.php b/classes/models/FrmDb.php index 41d6796375..f9700defbf 100644 --- a/classes/models/FrmDb.php +++ b/classes/models/FrmDb.php @@ -56,6 +56,8 @@ public static function get_where_clause_and_values( &$args, $starts_with = ' WHE * @param string $base_where * @param string $where * @param array $values + * + * @return void */ public static function parse_where_from_array( $args, $base_where, &$where, &$values ) { $condition = ' AND'; @@ -172,6 +174,8 @@ private static function interpret_array_to_sql( $key, $value, &$where, &$values * @param string $key * @param int|string $value * @param string $where + * + * @return void */ private static function add_query_placeholder( $key, $value, &$where ) { if ( is_numeric( $value ) && ( strpos( $key, 'meta_value' ) === false || strpos( $key, '+0' ) !== false ) ) { @@ -333,6 +337,8 @@ public static function append_where_is( $where_is ) { * * @param string $table * @param string $group + * + * @return void */ private static function get_group_and_table_name( &$table, &$group ) { global $wpdb, $wpmuBaseTablePrefix; @@ -367,6 +373,13 @@ private static function maybe_remove_prefix( $prefix, &$name ) { } } + /** + * @param array|string $args + * @param string $order_by + * @param int|string $limit + * + * @return void + */ private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) { if ( ! is_array( $args ) ) { $args = array( 'order_by' => $args ); @@ -537,6 +550,8 @@ public static function esc_order_by( &$order_by ) { /** * @since 2.05.06 * @param string $limit + * + * @return string */ public static function esc_limit( $limit ) { if ( empty( $limit ) ) { diff --git a/classes/models/FrmEmail.php b/classes/models/FrmEmail.php index c4eae6e1c2..16870979ac 100644 --- a/classes/models/FrmEmail.php +++ b/classes/models/FrmEmail.php @@ -816,6 +816,8 @@ private function get_name_and_email_for_sender( $sender ) { * * @param string $name * @param string $email + * + * @return string */ private function format_from_email( $name, $email ) { if ( '' !== $name ) { diff --git a/classes/models/FrmEmailStats.php b/classes/models/FrmEmailStats.php index 1359dbe003..2cb9815e1a 100644 --- a/classes/models/FrmEmailStats.php +++ b/classes/models/FrmEmailStats.php @@ -125,6 +125,8 @@ protected function get_content_args() { * Adds entries comparison data. * * @param array $stats Statistics section data. + * + * @return void */ protected function add_entries_comparison_data( &$stats ) { if ( ! $this->has_comparison ) { @@ -139,6 +141,8 @@ protected function add_entries_comparison_data( &$stats ) { * Adds payments count and total data. * * @param array $stats Statistics section data. + * + * @return void */ protected function add_payments_data( &$stats ) { $payment_data = FrmEmailSummaryHelper::get_payments_data( $this->from_date, $this->to_date ); diff --git a/classes/models/FrmEntry.php b/classes/models/FrmEntry.php index d9d56c3275..2bb43764f7 100644 --- a/classes/models/FrmEntry.php +++ b/classes/models/FrmEntry.php @@ -201,6 +201,8 @@ private static function maybe_check_for_unique_id_match( $values, $created_at ) /** * @since 6.16.3 + * + * @return bool */ private static function should_check_for_unique_id_match() { /** @@ -264,6 +266,11 @@ private static function is_duplicate_check_needed( $values, $duplicate_entry_tim return true; } + /** + * @param int|string $id + * + * @return false|int + */ public static function duplicate( $id ) { global $wpdb; @@ -386,6 +393,13 @@ public static function destroy( $id ) { return $result; } + /** + * @param int $id + * @param mixed $value + * @param int|string $form_id + * + * @return false|int + */ public static function update_form( $id, $value, $form_id ) { global $wpdb; $form_id = isset( $value ) ? $form_id : null; @@ -402,6 +416,8 @@ public static function update_form( $id, $value, $form_id ) { * Called when an entry is changed * * @since 2.0.5 + * + * @return void */ public static function clear_cache() { FrmDb::cache_delete_group( 'frm_entry' ); @@ -445,6 +461,12 @@ public static function maybe_get_entry( &$entry ) { } } + /** + * @param int|string $id + * @param bool $meta + * + * @return object|null + */ public static function getOne( $id, $meta = false ) { global $wpdb; @@ -478,6 +500,8 @@ public static function getOne( $id, $meta = false ) { * @since 4.02.03 * * @param object $entry + * + * @return void */ private static function prepare_entry( &$entry ) { if ( empty( $entry ) ) { @@ -493,6 +517,8 @@ private static function prepare_entry( &$entry ) { * @since 4.02.03 * * @param array $entries + * + * @return void */ private static function prepare_entries( &$entries ) { foreach ( $entries as $k => $entry ) { @@ -501,6 +527,11 @@ private static function prepare_entries( &$entries ) { } } + /** + * @param object|null $entry + * + * @return object|null + */ public static function get_meta( $entry ) { if ( ! $entry ) { return $entry; @@ -548,6 +579,8 @@ public static function get_meta( $entry ) { /** * @param string $id + * + * @return bool */ public static function exists( $id ) { global $wpdb; @@ -568,6 +601,15 @@ public static function exists( $id ) { return $id && $id > 0; } + /** + * @param array|string $where + * @param string $order_by + * @param string $limit + * @param bool $meta + * @param bool $inc_form + * + * @return array + */ public static function getAll( $where, $order_by = '', $limit = '', $meta = false, $inc_form = true ) { global $wpdb; @@ -768,6 +810,8 @@ private static function continue_to_create_entry( $values, $new_values ) { * @since 2.0 * * @param array $values The POST values by reference. + * + * @return void */ public static function sanitize_entry_post( &$values ) { $sanitize_method = array( @@ -823,6 +867,13 @@ private static function package_entry_data( &$values ) { return $new_values; } + /** + * @param array $values + * @param string $name + * @param mixed $default + * + * @return mixed + */ private static function get_entry_value( $values, $name, $default ) { return $values[ $name ] ?? $default; } @@ -972,6 +1023,8 @@ private static function insert_entry_into_database( $new_values ) { * @since 2.0.16 * * @param int $entry_id + * + * @return void */ private static function add_new_entry_to_frm_vars( $entry_id ) { global $frm_vars; @@ -1044,6 +1097,8 @@ private static function maybe_add_captcha_meta( $form_id, $entry_id ) { * @param int $entry_id * @param array $values * @param array $new_values + * + * @return void */ private static function after_entry_created_actions( $entry_id, $values, $new_values ) { // This is a child entry. @@ -1061,6 +1116,8 @@ private static function after_entry_created_actions( $entry_id, $values, $new_va * @param array $values * @param array $new_values * @param int $entry_id + * + * @return void */ private static function after_insert_entry_in_database( $values, $new_values, $entry_id ) { @@ -1151,6 +1208,8 @@ private static function package_entry_to_update( $id, $values ) { * @param int $id * @param array $values * @param array $new_values + * + * @return void */ private static function after_update_entry( $query_results, $id, $values, $new_values ) { if ( $query_results ) { diff --git a/classes/models/FrmEntryFormatter.php b/classes/models/FrmEntryFormatter.php index d7da63c2ec..9920abcfbc 100644 --- a/classes/models/FrmEntryFormatter.php +++ b/classes/models/FrmEntryFormatter.php @@ -125,6 +125,8 @@ public function __construct( $atts ) { * @since 2.04 * * @param array $atts + * + * @return void */ protected function init_entry( $atts ) { if ( isset( $atts['entry'] ) && is_object( $atts['entry'] ) ) { @@ -145,6 +147,8 @@ protected function init_entry( $atts ) { * @since 2.04 * * @param array $atts + * + * @return void */ protected function init_entry_values( $atts ) { $entry_atts = $this->prepare_entry_attributes( $atts ); @@ -179,18 +183,15 @@ protected function prepare_entry_attributes( $atts ) { * @since 2.04 * * @param array $atts + * + * @return void */ protected function init_format( $atts ) { if ( $atts['format'] === 'array' ) { - $this->format = 'array'; - } elseif ( $atts['format'] === 'json' ) { - $this->format = 'json'; - } elseif ( $atts['format'] === 'text' ) { - if ( $this->is_plain_text === true ) { $this->format = 'plain_text_block'; } else { @@ -223,6 +224,8 @@ protected function init_format( $atts ) { * @since 2.05 * * @param array $atts + * + * @return void */ protected function init_array_key( $atts ) { if ( isset( $atts['array_key'] ) && $atts['array_key'] === 'id' ) { @@ -236,6 +239,8 @@ protected function init_array_key( $atts ) { * @since 2.04 * * @param array $atts + * + * @return void */ protected function init_is_plain_text( $atts ) { if ( isset( $atts['plain_text'] ) && $atts['plain_text'] ) { @@ -251,6 +256,8 @@ protected function init_is_plain_text( $atts ) { * @since 2.04 * * @param array $atts + * + * @return void */ protected function init_include_blank( $atts ) { if ( isset( $atts['include_blank'] ) && $atts['include_blank'] ) { @@ -264,6 +271,8 @@ protected function init_include_blank( $atts ) { * @since 2.04 * * @param array $atts + * + * @return void */ protected function init_direction( $atts ) { if ( isset( $atts['direction'] ) && $atts['direction'] === 'rtl' ) { @@ -277,6 +286,8 @@ protected function init_direction( $atts ) { * @since 2.04 * * @param array $atts + * + * @return void */ protected function init_include_user_info( $atts ) { if ( isset( $atts['user_info'] ) && $atts['user_info'] ) { @@ -288,6 +299,8 @@ protected function init_include_user_info( $atts ) { * Which fields to skip by default * * @since 3.0 + * + * @return array */ protected function skip_fields() { return array( 'captcha', 'html', FrmSubmitHelper::FIELD_TYPE ); @@ -299,6 +312,8 @@ protected function skip_fields() { * @since 3.0 * * @param array $atts + * + * @return void */ protected function init_include_extras( $atts ) { if ( isset( $atts['include_extras'] ) && $atts['include_extras'] ) { @@ -310,6 +325,8 @@ protected function init_include_extras( $atts ) { * Initialize the single_cell_fields property * * @since 3.0 + * + * @return void */ protected function init_single_cell_fields() { $this->single_cell_fields = array( 'html' ); @@ -321,6 +338,8 @@ protected function init_single_cell_fields() { * @since 2.04 * * @param array $atts + * + * @return void */ protected function init_table_generator( $atts ) { $this->table_generator = new FrmTableHTMLGenerator( 'entry', $atts ); @@ -332,6 +351,8 @@ protected function init_table_generator( $atts ) { * @since 2.04 * * @param array $atts + * + * @return void */ protected function init_is_clickable( $atts ) { if ( isset( $atts['clickable'] ) && $atts['clickable'] ) { @@ -453,10 +474,11 @@ protected function prepare_html_table() { * @since 2.05 * * @param string $content + * + * @return void */ protected function add_field_values_to_content( &$content ) { foreach ( $this->entry_values->get_field_values() as $field_value ) { - /** * @var FrmFieldValue $field_value */ @@ -503,6 +525,8 @@ protected function prepare_array() { * * @param array $field_values * @param array $output + * + * @return void */ protected function push_field_values_to_array( $field_values, &$output ) { foreach ( $field_values as $field_value ) { @@ -521,6 +545,8 @@ protected function push_field_values_to_array( $field_values, &$output ) { * * @param FrmFieldValue $field_value * @param array $output + * + * @return void */ protected function push_single_field_to_array( $field_value, &$output ) { if ( $this->include_field_in_content( $field_value ) ) { @@ -544,11 +570,13 @@ protected function push_single_field_to_array( $field_value, &$output ) { * @param string $label * @param mixed $display_value * @param string $content + * + * @return void */ protected function add_plain_text_row( $label, $display_value, &$content ) { $display_value = $this->prepare_display_value_for_plain_text_content( $display_value ); - if ( 'rtl' == $this->direction ) { + if ( 'rtl' === $this->direction ) { $content .= wp_kses_post( $display_value . ' :' . $label ) . "\r\n"; } else { $content .= wp_kses_post( $label . ': ' . $display_value ) . "\r\n"; @@ -562,6 +590,8 @@ protected function add_plain_text_row( $label, $display_value, &$content ) { * * @param FrmFieldValue $field_value * @param string $content + * + * @return void */ protected function add_field_value_to_content( $field_value, &$content ) { if ( $this->is_extra_field( $field_value ) ) { @@ -579,6 +609,8 @@ protected function add_field_value_to_content( $field_value, &$content ) { * * @param FrmFieldValue $field_value * @param string $content + * + * @return void */ protected function add_row_for_extra_field( $field_value, &$content ) { if ( ! $this->include_field_in_content( $field_value ) ) { @@ -599,6 +631,8 @@ protected function add_row_for_extra_field( $field_value, &$content ) { * * @param FrmFieldValue $field_value * @param string $content + * + * @return void */ protected function add_row_for_standard_field( $field_value, &$content ) { if ( ! $this->include_field_in_content( $field_value ) ) { @@ -620,6 +654,8 @@ protected function add_row_for_standard_field( $field_value, &$content ) { * * @param FrmFieldValue $field_value * @param string $content + * + * @return void */ protected function add_html_row_for_included_extra( $field_value, &$content ) { $this->prepare_html_display_value_for_extra_fields( $field_value, $display_value ); @@ -639,6 +675,8 @@ protected function add_html_row_for_included_extra( $field_value, &$content ) { * * @param FrmFieldValue $field_value * @param string $content + * + * @return void */ protected function add_plain_text_row_for_included_extra( $field_value, &$content ) { $this->prepare_plain_text_display_value_for_extra_fields( $field_value, $display_value ); @@ -657,6 +695,8 @@ protected function add_plain_text_row_for_included_extra( $field_value, &$conten * * @param string $display_value * @param string $content + * + * @return void */ protected function add_single_cell_html_row( $display_value, &$content ) { // TODO: maybe move to FrmFieldValue @@ -672,6 +712,8 @@ protected function add_single_cell_html_row( $display_value, &$content ) { * * @param string $display_value * @param string $content + * + * @return void */ protected function add_single_value_plain_text_row( $display_value, &$content ) { $content .= $this->prepare_display_value_for_plain_text_content( $display_value ); @@ -684,6 +726,8 @@ protected function add_single_value_plain_text_row( $display_value, &$content ) * * @param FrmFieldValue $field_value * @param mixed $display_value + * + * @return void */ protected function prepare_html_display_value_for_extra_fields( $field_value, &$display_value ) { $display_value = $field_value->get_displayed_value(); @@ -696,6 +740,8 @@ protected function prepare_html_display_value_for_extra_fields( $field_value, &$ * * @param FrmFieldValue $field_value * @param mixed $display_value + * + * @return void */ protected function prepare_plain_text_display_value_for_extra_fields( $field_value, &$display_value ) { $display_value = $field_value->get_displayed_value() . "\r\n"; @@ -708,6 +754,8 @@ protected function prepare_plain_text_display_value_for_extra_fields( $field_val * * @param FrmFieldValue $field_value * @param string $content + * + * @return void */ protected function add_standard_row( $field_value, &$content ) { if ( $this->format === 'plain_text_block' ) { @@ -741,12 +789,12 @@ protected function package_value_args( $field_value ) { * @since 2.04 * * @param string $content + * + * @return void */ protected function add_user_info_to_html_table( &$content ) { if ( $this->include_user_info ) { - foreach ( $this->entry_values->get_user_info() as $user_info ) { - $value_args = array( 'label' => $user_info['label'], 'value' => $user_info['value'], @@ -764,6 +812,8 @@ protected function add_user_info_to_html_table( &$content ) { * @since 2.04 * * @param string $content + * + * @return void */ protected function add_user_info_to_plain_text_content( &$content ) { if ( $this->include_user_info ) { @@ -833,6 +883,8 @@ protected function is_extra_field_included( $field_value ) { * 'field_type' => (string) The field type. Blank string if not a field. * ] * @param string $content + * + * @return void */ protected function add_html_row( $value_args, &$content ) { $display_value = $this->prepare_display_value_for_html_table( $value_args['value'], $value_args['field_type'] ); @@ -920,9 +972,7 @@ protected function flatten_array( $value ) { * @return mixed */ protected function strip_html( $value ) { - if ( $this->is_plain_text ) { - if ( is_array( $value ) ) { foreach ( $value as $key => $single_value ) { $value[ $key ] = $this->strip_html( $single_value ); diff --git a/classes/models/FrmEntryMeta.php b/classes/models/FrmEntryMeta.php index 51b07c6a5b..cf7d9e5c08 100644 --- a/classes/models/FrmEntryMeta.php +++ b/classes/models/FrmEntryMeta.php @@ -188,6 +188,12 @@ public static function update_entry_metas( $entry_id, $values ) { self::clear_cache(); } + /** + * @param int $old_id + * @param int $new_id + * + * @return void + */ public static function duplicate_entry_metas( $old_id, $new_id ) { $metas = self::get_entry_meta_info( $old_id ); @@ -206,6 +212,12 @@ public static function duplicate_entry_metas( $old_id, $new_id ) { self::clear_cache(); } + /** + * @param int $entry_id + * @param int $field_id + * + * @return false|int + */ public static function delete_entry_meta( $entry_id, $field_id ) { global $wpdb; self::clear_cache(); @@ -218,6 +230,8 @@ public static function delete_entry_meta( $entry_id, $field_id ) { * Called when a meta is added or changed * * @since 2.0.5 + * + * @return void */ public static function clear_cache() { FrmDb::cache_delete_group( 'frm_entry_meta' ); @@ -282,6 +296,14 @@ public static function get_entry_meta_by_field( $entry_id, $field_id ) { return $result; } + /** + * @param int|string $field_id + * @param string $order + * @param string $limit + * @param array $args + * + * @return array + */ public static function get_entry_metas_for_field( $field_id, $order = '', $limit = '', $args = array() ) { $defaults = array( 'value' => false, @@ -317,6 +339,8 @@ public static function get_entry_metas_for_field( $field_id, $order = '', $limit * @param string $limit * @param array $args * @param array $query + * + * @return void */ private static function meta_field_query( $field_id, $order, $limit, $args, array &$query ) { global $wpdb; @@ -344,6 +368,11 @@ private static function meta_field_query( $field_id, $order, $limit, $args, arra $query[] = $order . $limit; } + /** + * @param int|string $entry_id + * + * @return array + */ public static function get_entry_meta_info( $entry_id ) { return FrmDb::get_results( 'frm_item_metas', array( 'item_id' => $entry_id ) ); } @@ -378,6 +407,15 @@ public static function getAll( $where = array(), $order_by = '', $limit = '', $s return $results; } + /** + * @param array|string $where + * @param string $order_by + * @param string $limit + * @param bool $unique + * @param array $args + * + * @return array|string|null + */ public static function getEntryIds( $where = array(), $order_by = '', $limit = '', $unique = true, $args = array() ) { $defaults = array( 'is_draft' => false, @@ -543,6 +581,13 @@ function ( $total, $current ) { $query[] = FrmDb::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit; } + /** + * @param array|string $search + * @param int|string $field_id + * @param string $operator + * + * @return array + */ public static function search_entry_metas( $search, $field_id, $operator ) { $cache_key = 'search_' . FrmAppHelper::maybe_json_encode( $search ) . $field_id . $operator; $results = wp_cache_get( $cache_key, 'frm_entry' ); diff --git a/classes/models/FrmEntryShortcodeFormatter.php b/classes/models/FrmEntryShortcodeFormatter.php index 9f0a4f1d72..751ecbbc90 100644 --- a/classes/models/FrmEntryShortcodeFormatter.php +++ b/classes/models/FrmEntryShortcodeFormatter.php @@ -153,6 +153,8 @@ protected function init_table_generator() { * Return the default HTML for an entry * * @since 2.04 + * + * @return array|string */ public function content() { if ( ! $this->form_id || empty( $this->fields ) ) { diff --git a/classes/models/FrmEntryValidate.php b/classes/models/FrmEntryValidate.php index bef0ad3f26..810adfa3fb 100644 --- a/classes/models/FrmEntryValidate.php +++ b/classes/models/FrmEntryValidate.php @@ -84,6 +84,11 @@ private static function maybe_fix_item_meta() { } } + /** + * @param array $values + * + * @return void + */ private static function set_item_key( &$values ) { if ( ! isset( $values['item_key'] ) || $values['item_key'] == '' ) { global $wpdb; @@ -92,6 +97,12 @@ private static function set_item_key( &$values ) { } } + /** + * @param array $values + * @param array|string $exclude + * + * @return array + */ private static function get_fields_to_validate( $values, $exclude ) { $where = apply_filters( 'frm_posted_field_ids', array( 'fi.form_id' => $values['form_id'] ) ); @@ -116,6 +127,14 @@ private static function get_fields_to_validate( $values, $exclude ) { return apply_filters( 'frm_fields_to_validate', $fields, compact( 'values', 'exclude', 'where' ) ); } + /** + * @param object $posted_field + * @param array $errors + * @param array $values + * @param array $args + * + * @return void + */ public static function validate_field( $posted_field, &$errors, $values, $args = array() ) { $defaults = array( 'id' => $posted_field->id, @@ -354,6 +373,8 @@ private static function options_are_dynamic_based_on_hook( $field_object, $value * * @param array|string $value Field value. * @param object $field Field object. + * + * @return void */ private static function maybe_add_item_name( $value, $field ) { $item_name = false; @@ -375,6 +396,8 @@ private static function maybe_add_item_name( $value, $field ) { * * @param object $field * @param string $value + * + * @return void */ private static function maybe_clear_value_for_default_blank_setting( $field, &$value ) { $position = FrmField::get_option( $field, 'label' ); @@ -387,6 +410,14 @@ private static function maybe_clear_value_for_default_blank_setting( $field, &$v } } + /** + * @param array $errors + * @param object $posted_field + * @param mixed $value + * @param array $args + * + * @return void + */ public static function validate_field_types( &$errors, $posted_field, $value, $args ) { $field_obj = FrmFieldFactory::get_field_object( $posted_field ); $args['value'] = $value; @@ -398,6 +429,14 @@ public static function validate_field_types( &$errors, $posted_field, $value, $a } } + /** + * @param array $errors + * @param object $field + * @param string $value + * @param array $args + * + * @return void + */ public static function validate_phone_field( &$errors, $field, $value, $args ) { $format_value = FrmField::get_option( $field, 'format' ); @@ -410,6 +449,11 @@ public static function validate_phone_field( &$errors, $field, $value, $args ) { } } + /** + * @param object $field + * + * @return string + */ public static function phone_format( $field ) { if ( FrmField::is_option_empty( $field, 'format' ) ) { $pattern = self::default_phone_format(); @@ -434,6 +478,8 @@ public static function phone_format( $field ) { /** * @since 3.01 + * + * @return string */ private static function default_phone_format() { return '^((\+\d{1,3}(-|.| )?\(?\d\)?(-| |.)?\d{1,5})|(\(?\d{2,6}\)?))(-|.| )?(\d{3,4})(-|.| )?(\d{4})(( x| ext)\d{1,5}){0,1}$'; @@ -483,6 +529,8 @@ private static function create_regular_expression_from_format( $pattern ) { * @param bool $exclude * @param array $values * @param array $errors By reference. + * + * @return void */ public static function spam_check( $exclude, $values, &$errors ) { if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) { @@ -639,6 +687,11 @@ private static function parse_akismet_array( &$datas, $values ) { self::add_comment_content_to_akismet( $datas, $values ); } + /** + * @param array $datas + * + * @return void + */ private static function add_site_info_to_akismet( &$datas ) { $datas['blog'] = FrmAppHelper::site_url(); $datas['user_ip'] = preg_replace( '/[^0-9., ]/', '', FrmAppHelper::get_ip_address() ); @@ -652,6 +705,12 @@ private static function add_site_info_to_akismet( &$datas ) { } } + /** + * @param array $datas + * @param array $values + * + * @return void + */ private static function add_user_info_to_akismet( &$datas, $values ) { $user_info = self::get_spam_check_user_info( $values ); $datas = $datas + $user_info; @@ -725,6 +784,8 @@ private static function get_spam_check_user_info_for_guest( $values ) { * @param array $datas Guest data. * @param array $values The values. * @param int|null $custom_index Custom index (or field ID). + * + * @return void */ private static function recursive_add_akismet_guest_info( &$datas, $values, $custom_index = null ) { foreach ( $values as $index => $value ) { @@ -830,6 +891,11 @@ private static function get_name_text_fields( $form_id ) { return self::$name_text_fields[ $form_id ]; } + /** + * @param array $datas + * + * @return void + */ private static function add_server_values_to_akismet( &$datas ) { foreach ( $_SERVER as $key => $value ) { $include_value = is_string( $value ) && ! preg_match( '/^HTTP_COOKIE/', $key ) && preg_match( '/^(HTTP_|REMOTE_ADDR|REQUEST_URI|DOCUMENT_URI)/', $key ); @@ -849,6 +915,8 @@ private static function add_server_values_to_akismet( &$datas ) { * * @param array $datas The array of values being sent to Akismet. * @param array $values Entry values. + * + * @return void */ private static function add_comment_content_to_akismet( &$datas, $values ) { if ( isset( $datas['frm_duplicated'] ) ) { @@ -871,6 +939,8 @@ private static function add_comment_content_to_akismet( &$datas, $values ) { * @since 5.0.09 * * @param array $values Entry values. + * + * @return void */ private static function skip_adding_values_to_akismet( &$values ) { $skipped_fields = self::get_akismet_skipped_field_ids( $values ); @@ -968,6 +1038,8 @@ private static function get_akismet_skipped_field_ids( $values ) { * @since 6.21 This changed from private to public. * * @param array $values Entry values. + * + * @return void */ public static function prepare_values_for_spam_check( &$values ) { $form_ids = self::get_all_form_ids_and_flatten_meta( $values ); diff --git a/classes/models/FrmField.php b/classes/models/FrmField.php index 0cfb89bef9..f0d00ab1f7 100644 --- a/classes/models/FrmField.php +++ b/classes/models/FrmField.php @@ -8,6 +8,9 @@ class FrmField { public static $use_cache = true; public static $transient_size = 200; + /** + * @return array + */ public static function field_selection() { $fields = array( 'text' => array( @@ -96,6 +99,9 @@ private static function get_captcha_field_name() { return 'Captcha'; } + /** + * @return array + */ public static function pro_field_selection() { $images_url = FrmAppHelper::plugin_url() . '/images/'; $fields = array( @@ -484,6 +490,14 @@ public static function duplicate_single_field( $field_id, $form_id ) { return compact( 'field_id', 'values' ); } + /** + * @param int|string $old_form_id + * @param int|string $form_id + * @param bool $copy_keys + * @param false|int $blog_id + * + * @return void + */ public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { global $frm_duplicate_ids; @@ -624,6 +638,8 @@ public static function update( $id, $values ) { * @since 2.0.8 * * @param array $values Pass by reference. + * + * @return void */ private static function preserve_format_option_backslashes( &$values ) { if ( isset( $values['field_options']['format'] ) ) { @@ -631,6 +647,11 @@ private static function preserve_format_option_backslashes( &$values ) { } } + /** + * @param int|string $id + * + * @return bool|int + */ public static function destroy( $id ) { global $wpdb; @@ -686,6 +707,8 @@ public static function maybe_get_field( &$field ) { /** * @param int|string $id The field id or key. * @param bool $filter When true, run the frm_field filter. + * + * @return object|null */ public static function getOne( $id, $filter = false ) { if ( empty( $id ) ) { @@ -718,8 +741,11 @@ public static function getOne( $id, $filter = false ) { /** * @since 3.06.01 + * * @param bool $filter When true, run the frm_field filter. * @param object $results + * + * @return void */ private static function filter_field( $filter, &$results ) { if ( $filter ) { @@ -735,6 +761,8 @@ private static function filter_field( $filter, &$results ) { * * @param int|string $id The field id or key. * @param mixed $col The name of the column in the fields database table. + * + * @return mixed */ public static function get_type( $id, $col = 'type' ) { $field = FrmDb::check_cache( $id, 'frm_field' ); @@ -757,6 +785,8 @@ public static function get_type( $id, $col = 'type' ) { * @param string $type * @param int|string $limit * @param string $inc_sub + * + * @return array|object */ public static function get_all_types_in_form( $form_id, $type, $limit = '', $inc_sub = 'exclude' ) { if ( ! $form_id ) { @@ -862,6 +892,8 @@ public static function get_all_for_form( $form_id, $limit = '', $inc_embed = 'ex * * @param string $inc_repeat * @param array $where Pass by reference. + * + * @return void */ private static function maybe_include_repeating_fields( $inc_repeat, &$where ) { if ( $inc_repeat === 'include' ) { @@ -875,6 +907,14 @@ private static function maybe_include_repeating_fields( $inc_repeat, &$where ) { } } + /** + * @param array $results + * @param string $inc_embed + * @param string $type + * @param int|string $form_id + * + * @return void + */ public static function include_sub_fields( &$results, $inc_embed, $type = 'all', $form_id = '' ) { $no_sub_forms = empty( $results ) && $type === 'all'; if ( 'include' != $inc_embed || $no_sub_forms ) { @@ -908,6 +948,14 @@ public static function include_sub_fields( &$results, $inc_embed, $type = 'all', } } + /** + * @param array|string $where + * @param string $order_by + * @param string $limit + * @param false|int $blog_id + * + * @return array|object|null + */ public static function getAll( $where = array(), $order_by = '', $limit = '', $blog_id = false ) { $cache_key = FrmAppHelper::maybe_json_encode( $where ) . $order_by . 'l' . $limit . 'b' . $blog_id; if ( self::$use_cache ) { @@ -969,7 +1017,7 @@ public static function getAll( $where = array(), $order_by = '', $limit = '', $b /** * @since 2.0.8 * - * @param array|object $results Results. + * @param array|object|null $results Results. * @return void */ private static function format_field_results( &$results ) { @@ -1381,6 +1429,11 @@ public static function get_key_by_id( $id ) { return FrmDb::get_var( 'frm_fields', array( 'id' => $id ), 'field_key' ); } + /** + * @param array|object $field + * + * @return bool + */ public static function is_image( $field ) { $type = self::get_field_type( $field ); diff --git a/classes/models/FrmFieldFormHtml.php b/classes/models/FrmFieldFormHtml.php index 144963a481..27bee1a964 100644 --- a/classes/models/FrmFieldFormHtml.php +++ b/classes/models/FrmFieldFormHtml.php @@ -42,6 +42,8 @@ public function __construct( $atts ) { * * @param string $param * @param array $atts + * + * @return void */ private function _set( $param, $atts ) { if ( isset( $atts[ $param ] ) ) { @@ -53,6 +55,8 @@ private function _set( $param, $atts ) { * @since 3.0 * * @param array $atts + * + * @return void */ private function set_html( $atts ) { $this->set_from_field( @@ -68,6 +72,8 @@ private function set_html( $atts ) { * @since 3.0 * * @param array $atts + * + * @return void */ private function set_field_id( $atts ) { $this->set_from_field( @@ -83,6 +89,8 @@ private function set_field_id( $atts ) { * @since 3.0 * * @param array $atts + * + * @return void */ private function set_pass_args( $atts ) { $this->pass_args = $atts; @@ -100,6 +108,8 @@ private function set_pass_args( $atts ) { * * @param array $atts * @param array $set + * + * @return void */ private function set_from_field( $atts, $set ) { if ( isset( $atts[ $set['param'] ] ) ) { @@ -109,6 +119,9 @@ private function set_from_field( $atts, $set ) { } } + /** + * @return string + */ public function get_html() { $this->replace_shortcodes_before_input(); $this->replace_shortcodes_with_atts(); @@ -119,6 +132,8 @@ public function get_html() { /** * @since 3.0 + * + * @return void */ private function replace_shortcodes_before_input() { $this->html = apply_filters( 'frm_before_replace_shortcodes', $this->html, $this->field_obj->get_field(), $this->pass_args['errors'], $this->form ); @@ -142,6 +157,8 @@ private function replace_shortcodes_before_input() { /** * @since 3.0 + * + * @return void */ private function replace_field_values() { // Replace [id]. @@ -159,6 +176,8 @@ private function replace_field_values() { /** * @since 3.0 + * + * @return void */ private function replace_required_label_shortcode() { $required = FrmField::is_required( $this->field_obj->get_field() ) ? $this->field_obj->get_field_column( 'required_indicator' ) : ''; @@ -185,6 +204,8 @@ private function maybe_replace_description_shortcode( $wp_processed = false ) { /** * @since 3.0 + * + * @return void */ private function replace_description_shortcode() { $this->maybe_add_description_id(); @@ -197,6 +218,8 @@ private function replace_description_shortcode() { * This ID was added to the HTML in v3.0. * * @since 3.0 + * + * @return void */ private function maybe_add_description_id() { $description = $this->field_obj->get_field_column( 'description' ); @@ -236,6 +259,8 @@ private function add_element_id( $param, $id ) { /** * @since 3.0 + * + * @return void */ private function replace_error_shortcode() { $this->maybe_add_error_id(); @@ -278,6 +303,8 @@ private static function get_error_body( $html ) { * This ID was added to the HTML in v3.06.02. * * @since 3.06.02 + * + * @return void */ private function maybe_add_error_id() { if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { @@ -291,6 +318,8 @@ private function maybe_add_error_id() { * Replace [required_class] * * @since 3.0 + * + * @return void */ private function replace_required_class() { $required_class = FrmField::is_required( $this->field_obj->get_field() ) ? ' frm_required_field' : ''; @@ -299,6 +328,8 @@ private function replace_required_class() { /** * @since 3.0 + * + * @return void */ private function replace_form_shortcodes() { if ( ! empty( $this->form ) ) { @@ -314,6 +345,8 @@ private function replace_form_shortcodes() { /** * @since 3.0 + * + * @return void */ public function replace_shortcodes_after_input() { $this->html .= "\n"; @@ -326,6 +359,8 @@ public function replace_shortcodes_after_input() { /** * @since 3.0 + * + * @return void */ private function filter_for_more_shortcodes() { $atts = $this->pass_args; @@ -346,6 +381,8 @@ private function filter_for_more_shortcodes() { * @since 3.0 * * @param string $html + * + * @return void */ public function remove_collapse_shortcode( &$html ) { if ( strpos( $html, '[collapse_this]' ) ) { @@ -355,6 +392,8 @@ public function remove_collapse_shortcode( &$html ) { /** * @since 3.0 + * + * @return void */ private function replace_shortcodes_with_atts() { preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER ); @@ -415,6 +454,8 @@ private function prepare_input_shortcode_atts( $shortcode_atts ) { * If the label position is inside, add a class to show the label if the field has a value. * * @since 3.0 + * + * @return void */ private function add_class_to_label() { $label_class = $this->field_obj->get_label_class(); @@ -425,6 +466,8 @@ private function add_class_to_label() { * Replace [entry_key] * * @since 3.0 + * + * @return void */ private function replace_entry_key() { $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' ); @@ -435,6 +478,8 @@ private function replace_entry_key() { * Add classes to a field div * * @since 3.0 + * + * @return void */ private function add_field_div_classes() { $classes = $this->get_field_div_classes(); @@ -495,6 +540,8 @@ private function get_field_div_classes() { * This filters shortcodes in the field HTML * * @since 3.0 + * + * @return void */ private function process_wp_shortcodes() { if ( apply_filters( 'frm_do_html_shortcodes', true ) ) { diff --git a/classes/models/FrmFieldOption.php b/classes/models/FrmFieldOption.php index 04b95cab5a..9fd1adb8c5 100644 --- a/classes/models/FrmFieldOption.php +++ b/classes/models/FrmFieldOption.php @@ -34,6 +34,13 @@ class FrmFieldOption { */ protected $option_label = ''; + /** + * @param int|string $option_key + * @param array|string $option + * @param array $args + * + * @return void + */ public function __construct( $option_key, $option, $args = array() ) { $this->option_key = $option_key; $this->option = $option; diff --git a/classes/models/FrmFieldValue.php b/classes/models/FrmFieldValue.php index 482761f995..2d4d8d3fd4 100644 --- a/classes/models/FrmFieldValue.php +++ b/classes/models/FrmFieldValue.php @@ -115,6 +115,8 @@ public function prepare_displayed_value( $atts = array() ) { * @since 2.05.06 * * @param string $value + * + * @return mixed */ public function get_field_option( $value ) { return FrmField::get_option( $this->field, $value ); @@ -124,6 +126,8 @@ public function get_field_option( $value ) { * @since 4.03 * * @param string $option + * + * @return mixed */ public function get_field_attr( $option ) { return is_object( $this->field ) ? $this->field->{$option} : ''; @@ -142,6 +146,8 @@ public function get_field() { * Get the field property's label * * @since 2.04 + * + * @return string */ public function get_field_label() { return $this->get_field_attr( 'name' ); @@ -151,6 +157,8 @@ public function get_field_label() { * Get the field property's id * * @since 2.05 + * + * @return string */ public function get_field_id() { return $this->get_field_attr( 'id' ); @@ -160,6 +168,8 @@ public function get_field_id() { * Get the field property's key * * @since 2.04 + * + * @return string */ public function get_field_key() { return $this->get_field_attr( 'field_key' ); @@ -169,6 +179,8 @@ public function get_field_key() { * Get the field property's type * * @since 2.04 + * + * @return string */ public function get_field_type() { return $this->get_field_attr( 'type' ); @@ -178,6 +190,8 @@ public function get_field_type() { * Get the saved_value property * * @since 2.04 + * + * @return mixed */ public function get_saved_value() { return $this->saved_value; @@ -187,6 +201,8 @@ public function get_saved_value() { * Get the displayed_value property * * @since 2.04 + * + * @return mixed */ public function get_displayed_value() { if ( $this->displayed_value === 'frm_not_prepared' ) { diff --git a/classes/models/FrmForm.php b/classes/models/FrmForm.php index aa9a988176..f6107fb897 100644 --- a/classes/models/FrmForm.php +++ b/classes/models/FrmForm.php @@ -133,6 +133,12 @@ public static function duplicate( $id, $template = false, $copy_keys = false, $b return false; } + /** + * @param int $form_id + * @param array $values + * + * @return void + */ public static function after_duplicate( $form_id, $values ) { $new_opts = $values['options']; FrmAppHelper::unserialize_or_decode( $new_opts ); @@ -158,6 +164,8 @@ public static function after_duplicate( $form_id, $values ) { * @since 5.3 * * @param int $form_id Form ID. + * + * @return void */ private static function switch_field_ids_in_fields( $form_id ) { global $wpdb; @@ -194,6 +202,8 @@ private static function switch_field_ids_in_fields( $form_id ) { * @since 5.3 * * @param array $field Field array. + * + * @return void */ private static function switch_field_ids_in_field( $field ) { $new_values = array(); @@ -528,6 +538,13 @@ private static function get_settings_page_html( $values, &$field ) { } } + /** + * @param object $field + * @param array $values + * @param array $new_field + * + * @return void + */ private static function prepare_field_update_values( $field, $values, &$new_field ) { $field_cols = array( 'field_order' => 0, @@ -558,7 +575,10 @@ private static function prepare_field_update_values( $field, $values, &$new_fiel * on a multilingual site. * * @since 3.06.01 + * * @param object $form The form object. + * + * @return array */ public static function translatable_strings( $form ) { $strings = array( @@ -799,7 +819,10 @@ public static function get_key_by_id( $id ) { * If $form is numeric, get the form object * * @since 2.0.9 + * * @param int|object $form + * + * @return void */ public static function maybe_get_form( &$form ) { if ( ! is_object( $form ) && ! is_array( $form ) && ! empty( $form ) ) { @@ -988,6 +1011,8 @@ public static function get_count() { * or when the form status is changed * * @since 2.0.4 + * + * @return void */ public static function clear_form_cache() { FrmDb::cache_delete_group( 'frm_form' ); @@ -1002,6 +1027,11 @@ public static function validate( $values ) { return apply_filters( 'frm_validate_form', $errors, $values ); } + /** + * @param object|null $form + * + * @return array + */ public static function get_params( $form = null ) { global $frm_vars; @@ -1063,6 +1093,9 @@ public static function get_params( $form = null ) { return $values; } + /** + * @return array + */ public static function list_page_params() { $values = array(); $defaults = array( @@ -1081,6 +1114,11 @@ public static function list_page_params() { return $values; } + /** + * @param int|object|string|null $form + * + * @return array + */ public static function get_admin_params( $form = null ) { $form_id = $form; if ( $form === null ) { @@ -1109,6 +1147,11 @@ public static function get_admin_params( $form = null ) { return $values; } + /** + * @param string $default_form + * + * @return int|string + */ public static function get_current_form_id( $default_form = 'none' ) { if ( 'first' === $default_form ) { $form = self::get_current_form(); @@ -1120,6 +1163,11 @@ public static function get_current_form_id( $default_form = 'none' ) { return $form_id; } + /** + * @param int|string $form_id + * + * @return false|int|object|string + */ public static function maybe_get_current_form( $form_id = 0 ) { global $frm_vars; @@ -1135,6 +1183,11 @@ public static function maybe_get_current_form( $form_id = 0 ) { return $form_id; } + /** + * @param int $form_id + * + * @return false|object + */ public static function get_current_form( $form_id = 0 ) { $form = self::maybe_get_current_form( $form_id ); if ( is_numeric( $form ) ) { @@ -1144,6 +1197,11 @@ public static function get_current_form( $form_id = 0 ) { return $form; } + /** + * @param int $form_id + * + * @return false|object + */ public static function set_current_form( $form_id ) { global $frm_vars; @@ -1157,6 +1215,13 @@ public static function set_current_form( $form_id ) { return $frm_vars['current_form']; } + /** + * @param object $form + * @param int|string $this_load + * @param bool $global_load + * + * @return bool + */ public static function is_form_loaded( $form, $this_load, $global_load ) { global $frm_vars; $small_form = new stdClass(); @@ -1200,6 +1265,11 @@ public static function &is_visible_to_user( $form ) { return $visible; } + /** + * @param object $form + * + * @return bool + */ public static function show_submit( $form ) { $show = ( ! $form->is_template && $form->status === 'published' && ! FrmAppHelper::is_admin() ); $show = apply_filters( 'frm_show_submit_button', $show, $form ); @@ -1224,7 +1294,10 @@ public static function get_option( $atts ) { * Get the link to edit this form. * * @since 4.0 + * * @param int $form_id The id of the form. + * + * @return string */ public static function get_edit_link( $form_id ) { return admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ); diff --git a/classes/models/FrmFormAction.php b/classes/models/FrmFormAction.php index e8f9d0be33..d2ca742857 100644 --- a/classes/models/FrmFormAction.php +++ b/classes/models/FrmFormAction.php @@ -89,6 +89,8 @@ public function update( $new_instance, $old_instance ) { * * @param WP_Post $instance Current settings. * @param array $args + * + * @return string */ public function form( $instance, $args = array() ) { echo '

' . esc_html__( 'There are no options for this action.', 'formidable' ) . '

'; @@ -110,6 +112,12 @@ public function get_switch_fields() { return array(); } + /** + * @param object $action + * @param object $form + * + * @return object + */ public function migrate_values( $action, $form ) { return $action; } @@ -184,6 +192,8 @@ public function __construct( $id_base, $name, $action_options = array(), $contro * @param string $name * @param array $action_options * @param array $control_options + * + * @return void */ public function FrmFormAction( $id_base, $name, $action_options = array(), $control_options = array() ) { self::__construct( $id_base, $name, $action_options, $control_options ); @@ -401,6 +411,13 @@ public function duplicate_one( $action, $form_id ) { return $this->save_settings( $action ); } + /** + * @param array $action + * @param array|string $subkey + * @param mixed $val + * + * @return array + */ private function duplicate_array_walk( $action, $subkey, $val ) { global $frm_duplicate_ids; @@ -561,10 +578,22 @@ public function get_single_action( $id ) { return $action; } + /** + * @param int|string $form_id + * + * @return array + */ public function get_one( $form_id ) { return $this->get_all( $form_id, 1 ); } + /** + * @param int|string $form_id + * @param string $type + * @param array $atts + * + * @return array + */ public static function get_action_for_form( $form_id, $type = 'all', $atts = array() ) { $action_controls = FrmFormActionsController::get_form_actions( $type ); if ( empty( $action_controls ) ) { @@ -828,6 +857,9 @@ public static function clear_cache() { FrmDb::cache_delete_group( 'frm_actions' ); } + /** + * @return array + */ public function get_settings() { return self::get_action_for_form( $this->form_id, $this->id_base ); } @@ -852,6 +884,9 @@ public function get_global_defaults() { return $defaults; } + /** + * @return array + */ public function get_global_switch_fields() { $switch = $this->get_switch_fields(); $switch['conditions'] = array( 'hide_field' ); @@ -967,6 +1002,9 @@ public static function default_action_opts( $class = '' ) { ); } + /** + * @return array + */ public static function trigger_labels() { $triggers = array( 'draft' => __( 'Draft is saved', 'formidable' ), diff --git a/classes/models/FrmFormApi.php b/classes/models/FrmFormApi.php index 16b0eba3c2..f8eb967bb2 100644 --- a/classes/models/FrmFormApi.php +++ b/classes/models/FrmFormApi.php @@ -262,6 +262,8 @@ public function get_addon_for_license( $license_plugin, $addons = array() ) { /** * @since 3.06 + * + * @return false|object */ public function get_pro_updater() { if ( FrmAppHelper::pro_is_installed() && is_callable( 'FrmProAppHelper::get_updater' ) ) { diff --git a/classes/models/FrmFormMigrator.php b/classes/models/FrmFormMigrator.php index cd7a93af82..1e7c09c87b 100644 --- a/classes/models/FrmFormMigrator.php +++ b/classes/models/FrmFormMigrator.php @@ -44,11 +44,17 @@ public function __construct() { ); } + /** + * @return void + */ private function maybe_add_to_import_page() { add_action( 'frm_import_settings', array( $this, 'import_page' ) ); add_action( 'wp_ajax_frm_import_' . $this->slug, array( $this, 'import_forms' ) ); } + /** + * @return void + */ public function import_page() { $forms = $this->get_forms(); ?> @@ -131,6 +137,8 @@ public function import_page() { /** * Import all forms using ajax + * + * @return void */ public function import_forms() { @@ -198,6 +206,12 @@ protected function import_form( $source_id ) { return $response; } + /** + * @param int|string $source_id + * @param string $source_form_name + * + * @return array + */ protected function prepare_new_form( $source_id, $source_form_name ) { return array( 'import_form_id' => $source_id, @@ -209,6 +223,12 @@ protected function prepare_new_form( $source_id, $source_form_name ) { ); } + /** + * @param array|object $form + * @param array $new_form + * + * @return void + */ protected function prepare_form( $form, &$new_form ) { // customize this function } @@ -275,6 +295,12 @@ protected function prepare_fields( $fields, &$form ) { }//end foreach } + /** + * @param array|object $field + * @param array $new_field + * + * @return void + */ protected function prepare_field( $field, &$new_field ) { // customize this function } @@ -283,6 +309,8 @@ protected function prepare_field( $field, &$new_field ) { * Add any field types that will need an end section field. * * @since 4.04.03 + * + * @return array */ protected function fields_with_end() { return array( 'divider' ); @@ -367,6 +395,8 @@ protected function insert_fields_in_array( $subs, $start, $remove, &$fields ) { * particularly the overrides in child classes, as * there will be no need to rebuild the converter * array at usage locations. + * + * @return string */ protected function convert_field_type( $type, $field = array(), $use = '' ) { if ( empty( $field ) ) { @@ -378,10 +408,12 @@ protected function convert_field_type( $type, $field = array(), $use = '' ) { } /** - * Add the new form to the database and return AJAX data.å + * Add the new form to the database and return AJAX data. * * @param array $form Form to import. * @param array $upgrade_omit No field alternative. + * + * @return array */ protected function add_form( $form, $upgrade_omit = array() ) { @@ -443,6 +475,8 @@ protected function form_creation_error_response( $form ) { * * @param int $form_id * @param array $form + * + * @return void */ protected function create_fields( $form_id, &$form ) { foreach ( $form['fields'] as $key => $new_field ) { @@ -470,6 +504,8 @@ protected function create_emails( $form, $form_id ) { * @param array $action * @param array $form * @param int $form_id + * + * @return int|WP_Error */ protected function save_action( $action, $form, $form_id ) { /** @@ -502,6 +538,8 @@ protected function save_action( $action, $form, $form_id ) { * * @param int $source_id Imported plugin form ID. * @param int $new_form_id Formidable form ID. + * + * @return void */ protected function track_import( $source_id, $new_form_id ) { @@ -549,6 +587,11 @@ protected function unsupported_field_types() { return array(); } + /** + * @param string $type + * + * @return bool + */ private function is_unsupported_field( $type ) { $fields = $this->unsupported_field_types(); @@ -564,6 +607,11 @@ protected function skip_pro_fields() { return array(); } + /** + * @param string $type + * + * @return bool + */ protected function should_skip_field( $type ) { $skip_pro_fields = $this->skip_pro_fields(); @@ -591,6 +639,11 @@ public function get_forms() { return array(); } + /** + * @param int|string $id + * + * @return array + */ public function get_form( $id ) { return array(); } diff --git a/classes/models/FrmFormState.php b/classes/models/FrmFormState.php index 5457c2d4a8..469b1b1614 100644 --- a/classes/models/FrmFormState.php +++ b/classes/models/FrmFormState.php @@ -74,6 +74,12 @@ public static function get_from_request( $key, $default ) { return self::$instance->get( $key, $default ); } + /** + * @param string $key + * @param mixed $default + * + * @return mixed + */ public function get( $key, $default ) { return $this->state[ $key ] ?? $default; } diff --git a/classes/models/FrmFormTemplateApi.php b/classes/models/FrmFormTemplateApi.php index 7d15d8ccce..4268615045 100644 --- a/classes/models/FrmFormTemplateApi.php +++ b/classes/models/FrmFormTemplateApi.php @@ -66,6 +66,8 @@ protected function skip_categories() { * @since 6.25 * * @param string $code The license code to set. + * + * @return void */ public static function set_free_license_code( $code ) { update_option( self::$code_option_name, $code, 'no' ); diff --git a/classes/models/FrmHoneypot.php b/classes/models/FrmHoneypot.php index fbd8d404aa..1dfad01b62 100644 --- a/classes/models/FrmHoneypot.php +++ b/classes/models/FrmHoneypot.php @@ -29,6 +29,9 @@ protected function get_option_key() { return 'honeypot'; } + /** + * @return bool + */ private static function is_enabled() { $frm_settings = FrmAppHelper::get_settings(); return $frm_settings->honeypot; @@ -127,6 +130,8 @@ public static function maybe_render_field( $form_id ) { * Maybe print honeypot JS. * * @since 6.21 + * + * @return void */ public static function maybe_print_honeypot_js() { if ( FrmAppHelper::is_admin() || ! self::is_enabled() ) { @@ -159,6 +164,8 @@ public static function maybe_print_honeypot_js() { * Maybe print honeypot CSS in case JS doesn't run. * * @since 6.21 + * + * @return void */ public static function maybe_print_honeypot_css() { // Print the CSS if form is loaded by API. @@ -235,6 +242,11 @@ public function render_field( $honeypot_field_id = 0 ) { update_list(); } + /** + * @return array + */ public function unread() { $messages = $this->get_messages( 'filter' ); $user_id = get_current_user_id(); diff --git a/classes/models/FrmInstallPlugin.php b/classes/models/FrmInstallPlugin.php index e712838366..85de7e006d 100644 --- a/classes/models/FrmInstallPlugin.php +++ b/classes/models/FrmInstallPlugin.php @@ -20,12 +20,18 @@ class FrmInstallPlugin { */ protected $plugin_slug; + /** + * @param array $atts + */ public function __construct( $atts ) { $this->plugin_file = $atts['plugin_file']; list( $slug, $file ) = explode( '/', $this->plugin_file ); $this->plugin_slug = $slug; } + /** + * @return string + */ public function get_activate_link() { if ( $this->is_installed() && $this->is_active() ) { return ''; diff --git a/classes/models/FrmInstallerSkin.php b/classes/models/FrmInstallerSkin.php index 888d607a0d..fd5ac29088 100644 --- a/classes/models/FrmInstallerSkin.php +++ b/classes/models/FrmInstallerSkin.php @@ -24,6 +24,8 @@ class FrmInstallerSkin extends WP_Upgrader_Skin { * @since 3.04.02 * * @param object $upgrader The upgrader object (passed by reference). + * + * @return void */ public function set_upgrader( &$upgrader ) { if ( is_object( $upgrader ) ) { @@ -37,6 +39,8 @@ public function set_upgrader( &$upgrader ) { * @since 3.04.02 * * @param object $result The result of the install process. + * + * @return void */ public function set_result( $result ) { $this->result = $result; diff --git a/classes/models/FrmMigrate.php b/classes/models/FrmMigrate.php index c7455a2733..b6b0e87786 100644 --- a/classes/models/FrmMigrate.php +++ b/classes/models/FrmMigrate.php @@ -17,6 +17,9 @@ public function __construct() { $this->entry_metas = $wpdb->prefix . 'frm_item_metas'; } + /** + * @return void + */ public function upgrade() { do_action( 'frm_before_install' ); @@ -75,6 +78,8 @@ public function upgrade() { * Updates some settings for new installs. * * @since 6.23 + * + * @return void */ private function update_settings_for_new_install() { $settings = FrmAppHelper::get_settings(); @@ -127,6 +132,9 @@ public function collation() { return $wpdb->get_charset_collate(); } + /** + * @return void + */ private function create_tables() { $charset_collate = $this->collation(); $sql = array(); @@ -281,6 +289,9 @@ private static function index_exists( $table_name, $index_name ) { return (bool) $row; } + /** + * @return void + */ private function maybe_create_contact_form() { $form_exists = FrmForm::get_id_by_key( 'contact-form' ); if ( ! $form_exists ) { @@ -292,6 +303,8 @@ private function maybe_create_contact_form() { * Create the default contact form * * @since 3.06 + * + * @return void */ private function add_default_template() { if ( FrmXMLHelper::check_if_libxml_disable_entity_loader_exists() ) { @@ -311,6 +324,8 @@ private function add_default_template() { /** * @param int|string $old_db_version + * + * @return void */ private function migrate_data( $old_db_version ) { if ( ! $old_db_version ) { @@ -418,6 +433,8 @@ private function migrate_to_104() { * Disables summary email for multisite (not the main site) if recipient setting isn't changed. * * @since 6.8 + * + * @return void */ private function migrate_to_101() { if ( ! is_multisite() || get_main_site_id() === get_current_blog_id() ) { @@ -438,6 +455,8 @@ private function migrate_to_101() { * Clear frmpro_css transient. * * @since 4.10.02 + * + * @return void */ private function migrate_to_98() { delete_transient( 'frmpro_css' ); @@ -447,6 +466,8 @@ private function migrate_to_98() { * Move default_blank and clear_on_focus to placeholder. * * @since 4.0 + * + * @return void */ private function migrate_to_97() { $this->migrate_to_placeholder( 'clear_on_focus' ); @@ -459,6 +480,8 @@ private function migrate_to_97() { * @since 4.0 * * @param string $type Field option key to migrate. + * + * @return void */ private function migrate_to_placeholder( $type = 'clear_on_focus' ) { $query = array( @@ -484,6 +507,8 @@ private function migrate_to_placeholder( $type = 'clear_on_focus' ) { * Delete unneeded default templates * * @since 3.06 + * + * @return void */ private function migrate_to_90() { $form = FrmForm::getOne( 'contact' ); @@ -496,6 +521,8 @@ private function migrate_to_90() { * Reverse migration 17 -- Divide by 9 * * @since 3.0.05 + * + * @return void */ private function migrate_to_86() { @@ -524,6 +551,9 @@ private function migrate_to_86() { $this->revert_widget_field_size(); } + /** + * @return array + */ private function get_fields_with_size() { $field_types = array( 'textarea', @@ -553,6 +583,8 @@ private function get_fields_with_size() { * Reverse the extra size changes in widgets * * @since 3.0.05 + * + * @return void */ private function revert_widget_field_size() { $widgets = get_option( 'widget_frm_show_form' ); @@ -600,6 +632,8 @@ private function maybe_convert_migrated_size( &$size ) { * default 400px field width, switch it to 100% * * @since 2.0.4 + * + * @return void */ private function migrate_to_25() { // get the style that was created with the style migration @@ -624,6 +658,8 @@ private function migrate_to_25() { * If not, try and add it again * * @since 2.0.2 + * + * @return void */ private function migrate_to_23() { global $wpdb; @@ -635,6 +671,8 @@ private function migrate_to_23() { /** * Change field size from character to pixel -- Multiply by 9 + * + * @return void */ private function migrate_to_17() { $fields = $this->get_fields_with_size(); @@ -656,6 +694,8 @@ private function migrate_to_17() { /** * Change the characters in widgets to pixels + * + * @return void */ private function adjust_widget_size() { $widgets = get_option( 'widget_frm_show_form' ); @@ -673,6 +713,11 @@ private function adjust_widget_size() { update_option( 'widget_frm_show_form', $widgets ); } + /** + * @param string $size + * + * @return void + */ private function convert_character_to_px( &$size ) { $pixel_conversion = 9; diff --git a/classes/models/FrmOnSubmitAction.php b/classes/models/FrmOnSubmitAction.php index 0067b7e82a..59425404e8 100644 --- a/classes/models/FrmOnSubmitAction.php +++ b/classes/models/FrmOnSubmitAction.php @@ -41,8 +41,6 @@ public static function get_name() { /** * @param object $instance * @param array $args - * - * @return void */ public function form( $instance, $args = array() ) { include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/on_submit_settings.php'; diff --git a/classes/models/FrmPersonalData.php b/classes/models/FrmPersonalData.php index 3a3a0f1a8c..1e4e7351ce 100644 --- a/classes/models/FrmPersonalData.php +++ b/classes/models/FrmPersonalData.php @@ -157,6 +157,9 @@ private function get_user_entries( $email ) { return $entry_ids; } + /** + * @return string + */ private function get_current_page() { $start = ( $this->page - 1 ) * $this->limit; diff --git a/classes/models/FrmSalesApi.php b/classes/models/FrmSalesApi.php index 451a51301f..a1d24ee64a 100644 --- a/classes/models/FrmSalesApi.php +++ b/classes/models/FrmSalesApi.php @@ -485,6 +485,9 @@ private static function is_banner_dismissed( $key ) { return is_array( $dismissed_sales ) && in_array( $key, $dismissed_sales, true ); } + /** + * @return void + */ public static function menu() { if ( false === self::$sales ) { new self(); diff --git a/classes/models/FrmSettings.php b/classes/models/FrmSettings.php index 19ce3c0da0..a0af740556 100644 --- a/classes/models/FrmSettings.php +++ b/classes/models/FrmSettings.php @@ -108,6 +108,9 @@ class FrmSettings { public $allowed_words; + /** + * @param array $args + */ public function __construct( $args = array() ) { if ( ! defined( 'ABSPATH' ) ) { die( 'You are not allowed to call this page directly.' ); @@ -129,6 +132,11 @@ public function __construct( $args = array() ) { $this->maybe_filter_for_form( $args ); } + /** + * @param false|object $settings + * + * @return object + */ private function translate_settings( $settings ) { if ( $settings ) { // Workaround for W3 total cache conflict. @@ -373,6 +381,8 @@ public function maybe_filter_for_form( $args ) { /** * @param array $params * @param array $errors + * + * @return array */ public function validate( $params, $errors ) { return apply_filters( 'frm_validate_settings', $errors, $params ); diff --git a/classes/models/FrmSolution.php b/classes/models/FrmSolution.php index bf43e912d8..826de12459 100644 --- a/classes/models/FrmSolution.php +++ b/classes/models/FrmSolution.php @@ -27,6 +27,9 @@ class FrmSolution { protected $icon = 'frm_icon_font frm_settings_icon'; + /** + * @param array $atts + */ public function __construct( $atts = array() ) { if ( empty( $this->plugin_slug ) ) { return; @@ -69,6 +72,11 @@ public function load_hooks() { add_action( 'admin_head', array( $this, 'hide_menu' ) ); } + /** + * @param array $links + * + * @return array + */ public function plugin_links( $links ) { if ( ! $this->is_complete() ) { $settings = '' . __( 'Setup', 'formidable' ) . ''; @@ -309,6 +317,9 @@ protected function main_content() { $this->show_page_links( $steps['complete'] ); } + /** + * @return array + */ protected function get_steps_data() { $pro_installed = FrmAppHelper::pro_is_connected(); diff --git a/classes/models/FrmSpamCheck.php b/classes/models/FrmSpamCheck.php index 21ea131edd..4b3da98a70 100644 --- a/classes/models/FrmSpamCheck.php +++ b/classes/models/FrmSpamCheck.php @@ -19,6 +19,9 @@ abstract class FrmSpamCheck { */ protected $values; + /** + * @param array $values + */ public function __construct( $values ) { $this->values = $values; } diff --git a/classes/models/FrmSpamCheckDenylist.php b/classes/models/FrmSpamCheckDenylist.php index e50e0176b3..ba185ec37a 100644 --- a/classes/models/FrmSpamCheckDenylist.php +++ b/classes/models/FrmSpamCheckDenylist.php @@ -20,6 +20,9 @@ class FrmSpamCheckDenylist extends FrmSpamCheck { protected $denylist; + /** + * @param array $values + */ public function __construct( $values ) { $this->maybe_add_form_id_to_values( $values ); @@ -28,6 +31,9 @@ public function __construct( $values ) { $this->denylist = $this->get_denylist_array(); } + /** + * @return array + */ protected function get_posted_fields() { if ( is_null( $this->posted_fields ) ) { $this->posted_fields = FrmField::get_all_for_form( $this->values['form_id'] ); @@ -39,6 +45,8 @@ protected function get_posted_fields() { * Maybe add form ID to values. In file name validation, only item_meta in $values. * * @param array $values Spam check values. + * + * @return void */ protected function maybe_add_form_id_to_values( &$values ) { if ( ! empty( $values['form_id'] ) || empty( $values['item_meta'] ) ) { @@ -189,6 +197,8 @@ protected function check_values() { * Fills default denylist data. * * @param array $denylist Denylist. + * + * @return void */ protected function fill_default_denylist_data( &$denylist ) { $denylist = wp_parse_args( @@ -386,6 +396,8 @@ protected function should_check_this_field( $field_id, $field_ids_to_check ) { * * @param array $values_to_check Values to check array. * @param mixed $value The value. + * + * @return void */ protected function add_to_values_to_check( &$values_to_check, $value ) { $values_to_check[] = is_array( $value ) ? implode( ' ', $value ) : $value; @@ -480,6 +492,12 @@ protected function is_allowed_ip( $ip ) { return $this->ip_matches_array( $ip, FrmAntiSpamController::get_allowed_ips() ); } + /** + * @param string $line + * @param array $args + * + * @return bool + */ protected function single_line_check_ip( $line, $args ) { return $this->ip_matches( $args['ip'], $line ); } @@ -539,6 +557,11 @@ protected function get_spam_message() { return __( 'Your entry appears to be blocked spam!', 'formidable' ); } + /** + * @param string $keyword + * + * @return void + */ private function add_spam_keyword_to_option( $keyword ) { $transient_name = 'frm_recent_spam_detected'; $transient = get_transient( $transient_name ); diff --git a/classes/models/FrmStyle.php b/classes/models/FrmStyle.php index 28568fa77b..7d04ba66f6 100644 --- a/classes/models/FrmStyle.php +++ b/classes/models/FrmStyle.php @@ -560,6 +560,8 @@ public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { /** * @param array|null $styles + * + * @return object|null */ public function get_default_style( $styles = null ) { if ( ! isset( $styles ) ) { diff --git a/classes/models/fields/FrmFieldCaptcha.php b/classes/models/fields/FrmFieldCaptcha.php index da03f45944..8edfc4badc 100644 --- a/classes/models/fields/FrmFieldCaptcha.php +++ b/classes/models/fields/FrmFieldCaptcha.php @@ -275,6 +275,11 @@ protected function captcha_class( $frm_settings ) { return $settings->get_element_class_name(); } + /** + * @param FrmSettings $frm_settings + * + * @return bool + */ protected function allow_multiple( $frm_settings ) { return $frm_settings->re_multi; } @@ -396,6 +401,8 @@ protected function should_validate() { /** * @param FrmSettings $frm_settings + * + * @return array|WP_Error */ protected function send_api_check( $frm_settings ) { $captcha_settings = FrmCaptchaFactory::get_settings_object(); diff --git a/classes/models/fields/FrmFieldCheckbox.php b/classes/models/fields/FrmFieldCheckbox.php index 6801c8f4f3..a7b5919cca 100644 --- a/classes/models/fields/FrmFieldCheckbox.php +++ b/classes/models/fields/FrmFieldCheckbox.php @@ -28,6 +28,9 @@ class FrmFieldCheckbox extends FrmFieldType { */ protected $has_for_label = false; + /** + * @return string + */ protected function input_html() { return $this->multiple_input_html(); } diff --git a/classes/models/fields/FrmFieldCreditCard.php b/classes/models/fields/FrmFieldCreditCard.php index eea55d0444..c71ec70f45 100644 --- a/classes/models/fields/FrmFieldCreditCard.php +++ b/classes/models/fields/FrmFieldCreditCard.php @@ -21,6 +21,9 @@ class FrmFieldCreditCard extends FrmFieldType { */ protected $has_for_label = false; + /** + * @return array + */ protected function field_settings_for_type() { $settings = array( 'clear_on_focus' => false, diff --git a/classes/models/fields/FrmFieldHidden.php b/classes/models/fields/FrmFieldHidden.php index 42465cce98..de34245f79 100644 --- a/classes/models/fields/FrmFieldHidden.php +++ b/classes/models/fields/FrmFieldHidden.php @@ -37,6 +37,9 @@ class FrmFieldHidden extends FrmFieldType { */ protected $array_allowed = false; + /** + * @return array + */ protected function field_settings_for_type() { $settings = parent::field_settings_for_type(); $settings['css'] = false; diff --git a/classes/models/fields/FrmFieldRadio.php b/classes/models/fields/FrmFieldRadio.php index fd20751bff..6ca342fcda 100644 --- a/classes/models/fields/FrmFieldRadio.php +++ b/classes/models/fields/FrmFieldRadio.php @@ -33,6 +33,9 @@ class FrmFieldRadio extends FrmFieldType { */ protected $array_allowed = true; + /** + * @return string + */ protected function input_html() { return $this->multiple_input_html(); } diff --git a/classes/models/fields/FrmFieldType.php b/classes/models/fields/FrmFieldType.php index 8eb9d91626..374ca5651a 100644 --- a/classes/models/fields/FrmFieldType.php +++ b/classes/models/fields/FrmFieldType.php @@ -120,6 +120,8 @@ public function __get( $key ) { /** * @param string $type + * + * @return void */ protected function set_type( $type ) { if ( empty( $this->type ) ) { @@ -132,6 +134,8 @@ protected function set_type( $type ) { /** * @since 4.02 + * + * @return void */ protected function set_field_id() { if ( empty( $this->field ) ) { @@ -166,6 +170,8 @@ public function get_field_column( $column ) { /** * @param string $column * @param mixed $value + * + * @return void */ public function set_field_column( $column, $value ) { if ( is_object( $this->field ) ) { @@ -184,6 +190,8 @@ public function get_field() { /** * Field HTML + * + * @return string */ public function default_html() { if ( ! $this->has_html ) { @@ -208,6 +216,9 @@ public function default_html() { return $default_html; } + /** + * @return string + */ protected function input_html() { return '[input]'; } @@ -226,10 +237,16 @@ protected function multiple_input_html() { return '
[input]
'; } + /** + * @return string + */ protected function primary_label_element() { return $this->has_for_label ? 'label' : 'div'; } + /** + * @return string + */ protected function for_label_html() { if ( $this->has_for_label ) { $for = 'for="field_[key]"'; @@ -244,6 +261,8 @@ protected function for_label_html() { /** * @param string $name + * + * @return void */ public function show_on_form_builder( $name = '' ) { $field = FrmFieldsHelper::setup_edit_vars( $this->field ); @@ -285,6 +304,8 @@ public function show_label_on_form_builder() { * * @param string $name * @param array $field + * + * @return void */ protected function include_on_form_builder( $name, $field ) { $field_name = $this->html_name( $name ); @@ -339,16 +360,29 @@ protected function builder_text_field( $name = '' ) { return ''; } + /** + * @param string $name + * + * @return string + */ protected function html_name( $name = '' ) { $prefix = empty( $name ) ? 'item_meta' : $name; return $prefix . '[' . $this->get_field_column( 'id' ) . ']'; } + /** + * @param string $plus + * + * @return string + */ protected function html_id( $plus = '' ) { return apply_filters( 'frm_field_get_html_id', 'field_' . $this->get_field_column( 'field_key' ) . $plus, $this->field ); } + /** + * @return array + */ public function display_field_settings() { $default_settings = $this->default_field_settings(); $field_type_settings = $this->field_settings_for_type(); @@ -387,6 +421,9 @@ protected function default_field_settings() { ); } + /** + * @return array + */ protected function field_settings_for_type() { $settings = array(); if ( ! $this->has_input ) { @@ -396,6 +433,9 @@ protected function field_settings_for_type() { return $settings; } + /** + * @return array + */ private function no_input_settings() { return array( 'required' => false, @@ -410,6 +450,8 @@ private function no_input_settings() { * on a multilingual site. * * @since 3.06.01 + * + * @return array */ public function translatable_strings() { return array( @@ -424,12 +466,22 @@ public function translatable_strings() { ); } + /** + * @param string $display_type + * + * @return string + */ public function form_builder_classes( $display_type ) { $classes = 'form-field edit_form_item frm_field_box frm_top_container frm_not_divider edit_field_type_' . $display_type; return $this->alter_builder_classes( $classes ); } + /** + * @param string $classes + * + * @return string + */ protected function alter_builder_classes( $classes ) { return $classes; } @@ -440,6 +492,8 @@ protected function alter_builder_classes( $classes ) { * @param array $field Field settings array. * @param array $display Display settings. * @param array $values Form values. + * + * @return void */ public function show_options( $field, $display, $values ) { do_action( 'frm_' . $field['type'] . '_field_options_form', $field, $display, $values ); @@ -461,6 +515,8 @@ public function show_primary_options( $args ) { * @since 4.02.01 * * @param array $args - Includes field, display, and values. + * + * @return void */ public function show_field_choices( $args ) { if ( ! $this->has_field_choices( $args['field'] ) ) { @@ -480,6 +536,8 @@ public function show_field_choices( $args ) { * @since 4.04 * * @param array $args Includes 'field', 'display', and 'values'. + * + * @return void */ public function show_field_options( $args ) { if ( ! $this->should_continue_to_field_options( $args ) ) { @@ -592,6 +650,8 @@ public function field_type_has_options_settings() { /** * @since 4.04 + * + * @return string */ protected function get_bulk_edit_string() { return __( 'Bulk Edit Options', 'formidable' ); @@ -601,6 +661,8 @@ protected function get_bulk_edit_string() { * @since 4.04 * * @param array $args Includes field configuration. + * + * @return void */ protected function show_single_option( $args ) { FrmFieldsHelper::show_single_option( $args['field'] ); @@ -608,6 +670,8 @@ protected function show_single_option( $args ) { /** * @since 4.04 + * + * @return string */ protected function extra_field_choices_class() { return ''; @@ -731,6 +795,8 @@ public function show_after_default( $args ) { * @since 4.0 * * @param mixed $default_value Default value passed by reference. + * + * @return void */ public function default_value_to_string( &$default_value ) { if ( ! is_array( $default_value ) ) { @@ -747,7 +813,10 @@ public function default_value_to_string( &$default_value ) { /** * @since 4.0 + * * @param array $args Includes 'field', 'display', and 'values'. + * + * @return void */ protected function auto_width_setting( $args ) { $use_style = ( ! isset( $args['values']['custom_style'] ) || $args['values']['custom_style'] ); @@ -759,6 +828,8 @@ protected function auto_width_setting( $args ) { /** * New field + * + * @return array */ public function get_new_field_defaults() { $field = array( @@ -981,6 +1052,9 @@ protected function after_replace_html_shortcodes( $args, $html ) { return $html; } + /** + * @return string + */ public function get_container_class() { $is_radio = FrmField::is_radio( $this->field ); $is_checkbox = FrmField::is_checkbox( $this->field ); @@ -1091,6 +1165,12 @@ protected function include_front_form_file() { return ''; } + /** + * @param array $args + * @param array $shortcode_atts + * + * @return string|void + */ protected function include_on_front_form( $args, $shortcode_atts ) { global $frm_vars; @@ -1134,6 +1214,9 @@ public function front_field_input( $args, $shortcode_atts ) { return ''; } + /** + * @return string + */ protected function html5_input_type() { return $this->type; } @@ -1200,6 +1283,11 @@ protected function add_min_max( $args, &$input_html ) { $input_html .= ' min="' . esc_attr( $min ) . '" max="' . esc_attr( $max ) . '" step="' . esc_attr( $step ) . '"'; } + /** + * @param array $args + * + * @return string + */ protected function maybe_include_hidden_values( $args ) { $hidden = ''; $is_read_only = FrmField::is_read_only( $this->field ) && ! FrmAppHelper::is_admin(); @@ -1248,6 +1336,8 @@ private function include_hidden_values_for_single_opt( $args, $opt ) { /** * When the field is read only, does it need it include hidden fields? * Checkboxes and dropdowns need this + * + * @return bool */ protected function show_readonly_hidden() { return false; @@ -1256,11 +1346,18 @@ protected function show_readonly_hidden() { /** * When the field has a single value, should the name include * name[] to indicate an array? + * + * @return bool */ protected function is_readonly_array() { return false; } + /** + * @param array $args + * + * @return string + */ protected function show_hidden_values( $args ) { $selected_value = $args['field_value'] ?? $this->field['value']; $hidden = ''; @@ -1371,6 +1468,11 @@ protected function load_field_scripts( $args ) { // Override me } + /** + * @param array $args + * + * @return array + */ protected function fill_display_field_values( $args = array() ) { $defaults = array( 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', @@ -1388,6 +1490,11 @@ protected function fill_display_field_values( $args = array() ) { return $args; } + /** + * @param array $field + * + * @return string + */ protected function get_field_input_html_hook( $field ) { $field['input_class'] = $this->add_input_class(); @@ -1470,6 +1577,8 @@ public function validate( $args ) { * @since 4.02 * * @param mixed $value Value passed by reference. + * + * @return void */ public function maybe_trim_excess_values( &$value ) { // Override in a child class. @@ -1534,6 +1643,8 @@ private function value_exists_in_meta_for_another_entry( $value, $entry_id ) { * Track that a value has been flagged as unique so that no other iterations can be for the same value for this field * * @param mixed $value + * + * @return void */ private function value_validated_as_unique( $value ) { global $frm_validated_unique_values; @@ -1764,6 +1875,8 @@ protected function get_multi_opts_for_import( $value ) { /** * @param array|string $value * @param array $defaults + * + * @return void */ protected function fill_values( &$value, $defaults ) { if ( empty( $value ) ) { @@ -1893,6 +2006,8 @@ protected function get_select_atributes( $values ) { /** * @since 4.04 * @deprecated 6.24 + * + * @return string */ protected function get_add_option_string() { _deprecated_function( __METHOD__, '6.24' ); diff --git a/classes/models/fields/FrmFieldUserID.php b/classes/models/fields/FrmFieldUserID.php index 690e01d129..bf1d354ce5 100644 --- a/classes/models/fields/FrmFieldUserID.php +++ b/classes/models/fields/FrmFieldUserID.php @@ -56,6 +56,8 @@ public function prepare_field_html( $args ) { * @since 4.03.06 * * @param array $args Field display arguments. + * + * @return int|string */ protected function get_field_value( $args ) { $user_ID = get_current_user_id(); diff --git a/classes/views/frm-form-actions/email_action.php b/classes/views/frm-form-actions/email_action.php index 3844126614..4295aebbcc 100644 --- a/classes/views/frm-form-actions/email_action.php +++ b/classes/views/frm-form-actions/email_action.php @@ -22,8 +22,6 @@ public function __construct() { /** * @param object $form_action * @param array $args - * - * @return void */ public function form( $form_action, $args = array() ) { extract( $args ); // phpcs:ignore WordPress.PHP.DontExtract diff --git a/classes/views/styles/components/FrmSliderStyleComponent.php b/classes/views/styles/components/FrmSliderStyleComponent.php index b6cfacb6ce..0b44f4557f 100644 --- a/classes/views/styles/components/FrmSliderStyleComponent.php +++ b/classes/views/styles/components/FrmSliderStyleComponent.php @@ -22,6 +22,11 @@ class FrmSliderStyleComponent extends FrmStyleComponent { */ protected $data; + /** + * @param string $field_name + * @param mixed $field_value + * @param array $data + */ public function __construct( $field_name, $field_value, $data ) { $this->init_field_data( $data, $field_name, $field_value ); diff --git a/classes/views/styles/components/FrmStyleComponent.php b/classes/views/styles/components/FrmStyleComponent.php index 2383521fc9..c3b0bca9ac 100644 --- a/classes/views/styles/components/FrmStyleComponent.php +++ b/classes/views/styles/components/FrmStyleComponent.php @@ -102,6 +102,13 @@ protected static function get_instance() { return self::$instance; } + /** + * @param array $data + * @param string $field_name + * @param mixed $field_value + * + * @return void + */ protected function init( $data, $field_name, $field_value ) { $this->init_field_data( $data, $field_name, $field_value ); self::get_instance(); @@ -212,6 +219,9 @@ protected function load_view() { include $this->view_folder . $this->view_name . '.php'; } + /** + * @return bool + */ protected function hide_component() { if ( empty( $this->data['not_show_in'] ) ) { return false; diff --git a/classes/widgets/FrmElementorWidget.php b/classes/widgets/FrmElementorWidget.php index 59ec67419a..a8d8ad1f44 100644 --- a/classes/widgets/FrmElementorWidget.php +++ b/classes/widgets/FrmElementorWidget.php @@ -6,22 +6,37 @@ if ( class_exists( '\Elementor\Widget_Base' ) ) { class FrmElementorWidget extends \Elementor\Widget_Base { + /** + * @return string + */ public function get_name() { return 'formidable'; } + /** + * @return string + */ public function get_title() { return FrmAppHelper::get_menu_name() . ' ' . __( 'Forms', 'formidable' ); } + /** + * @return string + */ public function get_icon() { return FrmAppHelper::get_menu_icon_class(); } + /** + * @return array + */ public function get_categories() { return array( 'general' ); } + /** + * @return void + */ protected function register_controls() { $this->start_controls_section( 'section_form_dropdown', @@ -57,6 +72,12 @@ protected function register_controls() { $this->end_controls_section(); } + /** + * @param string $key + * @param string $title + * + * @return void + */ private function add_basic_switcher_control( $key, $title ) { $this->add_control( $key, @@ -67,6 +88,9 @@ private function add_basic_switcher_control( $key, $title ) { ); } + /** + * @return array + */ private function get_form_options() { $query = array(); $where = apply_filters( 'frm_forms_dropdown', $query, 'form' ); @@ -81,6 +105,9 @@ private function get_form_options() { return $options; } + /** + * @return void + */ protected function render() { $settings = $this->get_settings_for_display(); $form_id = isset( $settings['form_id'] ) ? absint( $settings['form_id'] ) : 0; diff --git a/classes/widgets/FrmShowForm.php b/classes/widgets/FrmShowForm.php index 873f9dd24f..f9dd10c2d7 100644 --- a/classes/widgets/FrmShowForm.php +++ b/classes/widgets/FrmShowForm.php @@ -10,6 +10,12 @@ public function __construct() { parent::__construct( 'frm_show_form', __( 'Formidable Form', 'formidable' ), $widget_ops ); } + /** + * @param array $args + * @param array $instance + * + * @return void + */ public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); diff --git a/deprecated/FrmEDD_SL_Plugin_Updater.php b/deprecated/FrmEDD_SL_Plugin_Updater.php index 7c242b28c5..a64fdffc6c 100644 --- a/deprecated/FrmEDD_SL_Plugin_Updater.php +++ b/deprecated/FrmEDD_SL_Plugin_Updater.php @@ -88,14 +88,23 @@ public function http_request_args( $args, $url ) { return $args; } + /** + * @return void + */ public function show_changelog() { } + /** + * @return false + */ public function get_cached_version_info( $cache_key = '' ) { _deprecated_function( __METHOD__, '6.16.1' ); return false; } + /** + * @return void + */ public function set_version_info_cache( $value = '', $cache_key = '' ) { _deprecated_function( __METHOD__, '6.16.1' ); } diff --git a/phpcs.xml b/phpcs.xml index 3bdaab9826..b7dfd685d2 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -210,6 +210,7 @@ models/FrmFormAction.php helpers/FrmStylesHelper.php models/FrmEntryValidate.php + models/FrmAddon.php @@ -270,4 +271,4 @@ 8 error - \ No newline at end of file + diff --git a/phpstan.neon b/phpstan.neon index e26853d963..f2f55edcf2 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -31,14 +31,12 @@ parameters: - '#does not (accept|exist on)+#' - '#expects (array|string|int|callable|object|stdClass|float|bool|resource)+#' - '#is always (false|true)+.#' - - '#no (typehint|value type|return typehint)+ specified.#' + - '#no value type specified.#' - '#of echo cannot be converted to string.#' - '#only iterables are supported#' - '#results in an error.#' - '#should return#' - '#will always evaluate to#' - - '#has no return type specified#' - - '#with no type specified#' - '#in isset\(\) does not exist.#' - '#is unused.#' - '#is never read, only written#' @@ -60,7 +58,6 @@ parameters: - message: '#Possibly invalid array key type#' paths: - - classes/helpers/FrmCSVExportHelper.php - classes/helpers/FrmFormsListHelper.php - message: '#get_mailer\(\) expects#' @@ -136,3 +133,29 @@ parameters: - message: '#FrmFormAction::prepare_action\(\) expects WP_Post, mixed given#' path: classes/models/FrmFormAction.php + - + message: '#has no return type specified#' + paths: + - classes/controllers/FrmEmailStylesController.php + - classes/controllers/FrmFieldsController.php + - classes/helpers/FrmXMLHelper.php + - square/helpers/FrmSquareLiteConnectHelper.php + - classes/helpers/FrmListHelper.php + - classes/helpers/FrmAppHelper.php + - classes/controllers/FrmFormActionsController.php + - classes/controllers/FrmAddonsController.php + - classes/controllers/FrmAppController.php + - classes/controllers/FrmFormsController.php + - classes/controllers/FrmStylesController.php + - classes/models/FrmSalesApi.php + - square/controllers/FrmSquareLiteAppController.php + - stripe/helpers/FrmStrpLiteConnectHelper.php + - classes/models/FrmInstallerSkin.php + - classes/controllers/FrmSettingsController.php + - stripe/helpers/FrmStrpLiteLinkRedirectHelper.php + - classes/models/FrmMigrate.php + - stubs.php + - + message: '#with no type specified#' + paths: + - stubs.php diff --git a/psalm.xml b/psalm.xml index 47d02a2e83..697e2f78f3 100644 --- a/psalm.xml +++ b/psalm.xml @@ -43,7 +43,6 @@ - @@ -172,6 +171,7 @@ + @@ -368,6 +368,7 @@ + @@ -412,6 +413,8 @@ + + @@ -527,5 +530,16 @@ + + + + + + + + + + + diff --git a/square/helpers/FrmSquareLiteConnectHelper.php b/square/helpers/FrmSquareLiteConnectHelper.php index 212753b100..42550ef4a2 100644 --- a/square/helpers/FrmSquareLiteConnectHelper.php +++ b/square/helpers/FrmSquareLiteConnectHelper.php @@ -130,6 +130,9 @@ private static function register_settings_scripts() { wp_enqueue_script( 'formidable_square_settings' ); } + /** + * @return false|string + */ public static function get_oauth_redirect_url() { $mode = FrmAppHelper::get_post_param( 'mode', 'test', 'sanitize_text_field' ); @@ -204,6 +207,10 @@ private static function post_to_connect_server( $action, $additional_body = arra return $body->data ?? array(); } + /** + * @param array $response + * @return mixed + */ private static function pull_response_body( $response ) { $http_response = $response['http_response']; $response_object = $http_response->get_response_object(); @@ -474,6 +481,15 @@ private static function check_server_for_oauth_merchant_id() { return false; } + /** + * @param string $amount + * @param string $currency + * @param string $square_token + * @param string $verification_token + * @param string $description + * + * @return false|object + */ public static function create_payment( $amount, $currency, $square_token, $verification_token, $description ) { return self::post_with_authenticated_body( 'create_payment', @@ -513,6 +529,9 @@ private static function post_with_authenticated_body( $action, $additional_body return false; } + /** + * @return array + */ private static function get_standard_authenticated_body() { $mode = self::get_mode_value_from_post(); return array( @@ -536,14 +555,27 @@ private static function get_mode_value_from_post() { return $test_mode ? 'test' : 'live'; } + /** + * @return string|null + */ public static function get_latest_error_from_square_api() { return self::$latest_error_from_square_api; } + /** + * @param string $receipt_id + * + * @return false|object + */ public static function refund_payment( $receipt_id ) { return self::post_with_authenticated_body( 'refund_payment', array( 'receipt_id' => $receipt_id ) ); } + /** + * @param array $info + * + * @return false|object + */ public static function create_subscription( $info ) { return self::post_with_authenticated_body( 'create_subscription', compact( 'info' ) ); } @@ -610,27 +642,39 @@ public static function get_event( $event_id ) { /** * @param string $event_id - * @return mixed + * @return false|object */ public static function process_event( $event_id ) { return self::post_with_authenticated_body( 'process_event', compact( 'event_id' ) ); } + /** + * @param string $payment_id + * + * @return false|object + */ public static function get_payment( $payment_id ) { return self::post_with_authenticated_body( 'get_payment', compact( 'payment_id' ) ); } + /** + * @param string $payment_id + * + * @return false|object + */ public static function get_subscription_id_for_payment( $payment_id ) { return self::post_with_authenticated_body( 'get_subscription_id_for_payment', compact( 'payment_id' ) ); } + /** + * @param string $subscription_id + * + * @return false|object + */ public static function cancel_subscription( $subscription_id ) { return self::post_with_authenticated_body( 'cancel_subscription', compact( 'subscription_id' ) ); } - /** - * @return void - */ public static function handle_disconnect() { self::disconnect(); self::reset_square_api_integration(); @@ -721,6 +765,11 @@ public static function verify() { wp_send_json_error(); } + /** + * @param string $subscription_id + * + * @return false|object + */ public static function get_subscription( $subscription_id ) { $response = self::post_with_authenticated_body( 'get_subscription', array( 'subscription_id' => $subscription_id ) ); if ( is_object( $response ) && is_object( $response->subscription ) ) { diff --git a/square/models/FrmSquareLiteSettings.php b/square/models/FrmSquareLiteSettings.php index 08d86f6599..be3e5f6b3f 100644 --- a/square/models/FrmSquareLiteSettings.php +++ b/square/models/FrmSquareLiteSettings.php @@ -58,6 +58,9 @@ public function set_default_options( $settings = false ) { } } + /** + * @return object + */ public function get_options() { $settings = get_option( 'frm_' . $this->param() . '_options' ); diff --git a/stripe/controllers/FrmStrpLiteEventsController.php b/stripe/controllers/FrmStrpLiteEventsController.php index 08e0b7a89b..cfc36295ca 100644 --- a/stripe/controllers/FrmStrpLiteEventsController.php +++ b/stripe/controllers/FrmStrpLiteEventsController.php @@ -203,6 +203,9 @@ private function subscription_canceled( $status = 'canceled' ) { return true; } + /** + * @return false|object + */ private function prepare_from_invoice() { if ( empty( $this->invoice->subscription ) ) { // This isn't a subscription. @@ -321,9 +324,15 @@ private function is_first_payment( $payment ) { return ! $payment->receipt_id || 0 === strpos( $payment->receipt_id, 'pi_' ); } + /** + * @param string $sub_id + * + * @return object|null + */ private function get_subscription( $sub_id ) { $frm_sub = new FrmTransLiteSubscription(); $sub = $frm_sub->get_one_by( $sub_id, 'sub_id' ); + if ( ! $sub ) { // If this isn't an existing subscription, it must be a charge for another site/plugin. FrmTransLiteLog::log_message( 'Stripe Webhook Message', 'No action taken since there is not a matching subscription for ' . $sub_id ); @@ -338,6 +347,11 @@ private function get_subscription( $sub_id ) { return $sub; } + /** + * @param string $sub_id + * + * @return object|null + */ private function get_payment_for_sub( $sub_id ) { $frm_payment = new FrmTransLitePayment(); return $frm_payment->get_one_by( $sub_id, 'sub_id' ); diff --git a/stripe/controllers/FrmTransLiteHooksController.php b/stripe/controllers/FrmTransLiteHooksController.php index 6c06c0bd6c..f2cf84063d 100755 --- a/stripe/controllers/FrmTransLiteHooksController.php +++ b/stripe/controllers/FrmTransLiteHooksController.php @@ -67,6 +67,9 @@ function () { } } + /** + * @return void + */ private static function load_ajax_hooks() { add_action( 'wp_ajax_frm_trans_refund', 'FrmTransLitePaymentsController::refund_payment' ); add_action( 'wp_ajax_frm_trans_cancel', 'FrmTransLiteSubscriptionsController::cancel_subscription' ); diff --git a/stripe/controllers/FrmTransLiteListsController.php b/stripe/controllers/FrmTransLiteListsController.php index 2d5d9df16f..54a30a034a 100755 --- a/stripe/controllers/FrmTransLiteListsController.php +++ b/stripe/controllers/FrmTransLiteListsController.php @@ -175,6 +175,8 @@ public static function display_list( $response = array() ) { * @param mixed $save * @param string $option * @param int $value + * + * @return mixed */ public static function save_per_page( $save, $option, $value ) { if ( $option === 'formidable_page_formidable_payments_per_page' ) { diff --git a/stripe/helpers/FrmStrpLiteConnectApiAdapter.php b/stripe/helpers/FrmStrpLiteConnectApiAdapter.php index a839200228..34011e109c 100644 --- a/stripe/helpers/FrmStrpLiteConnectApiAdapter.php +++ b/stripe/helpers/FrmStrpLiteConnectApiAdapter.php @@ -157,6 +157,8 @@ public static function get_event( $event_id ) { /** * @param array $plan + * + * @return mixed */ public static function maybe_create_plan( $plan ) { return FrmStrpLiteConnectHelper::maybe_create_plan( $plan ); diff --git a/stripe/helpers/FrmStrpLiteConnectHelper.php b/stripe/helpers/FrmStrpLiteConnectHelper.php index 5f4baad3bc..0d384843f3 100644 --- a/stripe/helpers/FrmStrpLiteConnectHelper.php +++ b/stripe/helpers/FrmStrpLiteConnectHelper.php @@ -485,6 +485,11 @@ private static function validate_response( $response ) { return ! is_wp_error( $response ) && is_array( $response ) && isset( $response['http_response'] ); } + /** + * @param array $response + * + * @return object|null + */ private static function pull_response_body( $response ) { $http_response = $response['http_response']; $response_object = $http_response->get_response_object(); diff --git a/stripe/helpers/FrmStrpLiteLinkRedirectHelper.php b/stripe/helpers/FrmStrpLiteLinkRedirectHelper.php index 6efe31ca6f..a8bf418abb 100644 --- a/stripe/helpers/FrmStrpLiteLinkRedirectHelper.php +++ b/stripe/helpers/FrmStrpLiteLinkRedirectHelper.php @@ -112,6 +112,8 @@ public function handle_success( $entry, $charge_id ) { * Determine if a redirect URL is going to an external site or not. * * @param string $url + * + * @return bool */ private function url_is_external( $url ) { if ( false === strpos( $url, 'http' ) ) { diff --git a/stripe/helpers/FrmTransLiteAppHelper.php b/stripe/helpers/FrmTransLiteAppHelper.php index f42e4e8127..ba05cebb3b 100755 --- a/stripe/helpers/FrmTransLiteAppHelper.php +++ b/stripe/helpers/FrmTransLiteAppHelper.php @@ -149,6 +149,8 @@ public static function add_meta_to_payment( $meta_value, $note ) { /** * @param string $option * @param array $atts + * + * @return mixed */ public static function get_action_setting( $option, $atts ) { $settings = self::get_action_settings( $atts ); @@ -158,6 +160,8 @@ public static function get_action_setting( $option, $atts ) { /** * @param array $atts + * + * @return array */ public static function get_action_settings( $atts ) { if ( ! isset( $atts['payment'] ) ) { @@ -261,6 +265,11 @@ public static function get_repeat_label_from_value( $value, $number ) { return $value; } + /** + * @param array|float|int|object $payment + * + * @return string + */ public static function formatted_amount( $payment ) { $currency = ''; $amount = $payment; @@ -511,6 +520,9 @@ public static function count_completed_payments( $payments ) { return $count; } + /** + * @return array + */ public static function get_gateways() { $gateways = apply_filters( 'frm_payment_gateways', array() ); return $gateways; @@ -519,6 +531,8 @@ public static function get_gateways() { /** * @param array|string $gateway * @param string $setting + * + * @return mixed */ public static function get_setting_for_gateway( $gateway, $setting ) { $gateways = self::get_gateways(); @@ -541,6 +555,8 @@ public static function get_setting_for_gateway( $gateway, $setting ) { * @param string $id * @param string $name * @param array $action_settings + * + * @return void */ public static function show_currency_dropdown( $id, $name, $action_settings ) { $selected = $action_settings['currency']; diff --git a/stripe/helpers/FrmTransLiteListHelper.php b/stripe/helpers/FrmTransLiteListHelper.php index e543a08da4..702ecbe4cd 100755 --- a/stripe/helpers/FrmTransLiteListHelper.php +++ b/stripe/helpers/FrmTransLiteListHelper.php @@ -44,7 +44,12 @@ public function prepare_items() { $orderby = FrmAppHelper::get_param( 'orderby', 'id', 'get', 'sanitize_title' ); $order = FrmAppHelper::get_param( 'order', 'DESC', 'get', 'sanitize_text_field' ); - if ( ! in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ) { + + if ( ! is_string( $orderby ) ) { + $orderby = 'id'; + } + + if ( ! is_string( $order ) || ! in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ) { $order = 'DESC'; } @@ -261,6 +266,8 @@ protected function get_column_info() { /** * @param object $item * @param array $args + * + * @return string */ private function get_column_value( $item, $args ) { $column_name = $args['column_name']; @@ -478,6 +485,11 @@ private function get_end_count_column( $item ) { return sprintf( __( '%1$s of %2$s', 'formidable' ), $count, $limit ); } + /** + * @param object $item + * + * @return string + */ private function get_status_column( $item ) { $status = esc_html( FrmTransLiteAppHelper::show_status( FrmTransLiteAppHelper::get_payment_status( $item ) ) ); diff --git a/stripe/models/FrmStrpLiteAuth.php b/stripe/models/FrmStrpLiteAuth.php index d2d5e326bd..10307bccaf 100644 --- a/stripe/models/FrmStrpLiteAuth.php +++ b/stripe/models/FrmStrpLiteAuth.php @@ -739,6 +739,8 @@ private static function get_redirect_url( $atts ) { * @since 6.5, introduced in v2.0 of the Stripe add on. * * @param array $atts + * + * @return string */ private static function get_message_url( $atts ) { $url = self::get_referer_url( $atts['entry_id'], false ); diff --git a/stripe/models/FrmStrpLiteSettings.php b/stripe/models/FrmStrpLiteSettings.php index 5a662b698b..7b46dfe897 100644 --- a/stripe/models/FrmStrpLiteSettings.php +++ b/stripe/models/FrmStrpLiteSettings.php @@ -60,6 +60,9 @@ public function set_default_options( $settings = false ) { } } + /** + * @return object + */ public function get_options() { $settings = get_option( 'frm_' . $this->param() . '_options' ); diff --git a/stripe/models/FrmTransLiteDb.php b/stripe/models/FrmTransLiteDb.php index 49427981ba..756c43117c 100755 --- a/stripe/models/FrmTransLiteDb.php +++ b/stripe/models/FrmTransLiteDb.php @@ -157,7 +157,7 @@ public function &destroy( $id ) { /** * @param int|string $id - * @return array|object|void|null + * @return array|object|null */ public function get_one( $id ) { global $wpdb; @@ -196,6 +196,12 @@ public function get_one_by( $id, $field = 'receipt_id' ) { // @codingStandardsIgnoreEnd } + /** + * @param string $value + * @param string $field + * + * @return array + */ public function get_all_by( $value, $field = 'item_id' ) { if ( ! FrmTransLiteAppHelper::payments_table_exists() ) { // If no migrations have run yet return nothing. @@ -221,6 +227,11 @@ public function get_all_by( $value, $field = 'item_id' ) { // @codingStandardsIgnoreEnd } + /** + * @param int $user_id + * + * @return array + */ public function get_all_for_user( $user_id ) { global $wpdb; // @codingStandardsIgnoreStart @@ -240,10 +251,18 @@ public function get_all_for_user( $user_id ) { // @codingStandardsIgnoreEnd } + /** + * @param int|string $id + * + * @return array + */ public function get_all_for_entry( $id ) { - return $this->get_all_by( $id, $field = 'item_id' ); + return $this->get_all_by( $id, 'item_id' ); } + /** + * @return string + */ public function get_count() { global $wpdb; // @codingStandardsIgnoreStart