| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | class FrmForm { |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * @param array $values |
| 10 | - * @return int|bool id on success or false on failure. | |
| 10 | + * @return int|boolean id on success or false on failure | |
| 11 | 11 | */ |
| 12 | 12 | public static function create( $values ) { |
| 13 | 13 | global $wpdb; |
| 14 | 14 | |
| @@ -284,8 +284,13 @@ | ||
| 284 | 284 | $options['before_html'] = isset( $values['options']['before_html'] ) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html( 'before' ); |
| 285 | 285 | $options['after_html'] = isset( $values['options']['after_html'] ) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html( 'after' ); |
| 286 | 286 | $options['submit_html'] = ( isset( $values['options']['submit_html'] ) && '' !== $values['options']['submit_html'] ) ? $values['options']['submit_html'] : FrmFormsHelper::get_default_html( 'submit' ); |
| 287 | 287 | |
| 288 | + if ( ! empty( $options['success_url'] ) && ! empty( $args['form_id'] ) ) { | |
| 289 | + $options['success_url'] = FrmFormsHelper::maybe_add_sanitize_url_attr( $options['success_url'], (int) $args['form_id'] ); | |
| 290 | + $values['options']['success_url'] = $options['success_url']; | |
| 291 | + } | |
| 292 | + | |
| 288 | 293 | /** |
| 289 | 294 | * Allows modifying form options before updating or creating. |
| 290 | 295 | * |
| 291 | 296 | * @since 5.4 Added the third param. |
| @@ -365,18 +370,8 @@ | ||
| 365 | 370 | 'field_options' => $field->field_options, |
| 366 | 371 | 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
| 367 | 372 | ); |
| 368 | 373 | |
| 369 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { | |
| 370 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { | |
| 371 | - if ( is_array( $option ) ) { | |
| 372 | - foreach ( $option as $key => $item ) { | |
| 373 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); | |
| 374 | - } | |
| 375 | - } | |
| 376 | - } | |
| 377 | - } | |
| 378 | - | |
| 379 | 374 | self::prepare_field_update_values( $field, $values, $new_field ); |
| 380 | 375 | |
| 381 | 376 | FrmField::update( $field_id, $new_field ); |
| 382 | 377 | |
| @@ -812,13 +807,9 @@ | ||
| 812 | 807 | /** |
| 813 | 808 | * Get all published forms |
| 814 | 809 | * |
| 815 | 810 | * @since 2.0 |
| 816 | - * | |
| 817 | - * @param array $query | |
| 818 | - * @param int $limit | |
| 819 | - * @param string $inc_children | |
| 820 | - * @return array|object of forms A single form object would be passed if $limit was set to 1. | |
| 811 | + * @return array of forms | |
| 821 | 812 | */ |
| 822 | 813 | public static function get_published_forms( $query = array(), $limit = 999, $inc_children = 'exclude' ) { |
| 823 | 814 | $query['is_template'] = 0; |
| 824 | 815 | $query['status'] = array( null, '', 'published' ); |
| @@ -1118,39 +1109,23 @@ | ||
| 1118 | 1109 | return admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ); |
| 1119 | 1110 | } |
| 1120 | 1111 | |
| 1121 | 1112 | /** |
| 1122 | - * Check if the "Submit this form with AJAX" setting is toggled on. | |
| 1123 | - * | |
| 1124 | - * @since 6.2 | |
| 1125 | - * | |
| 1126 | - * @param stdClass $form | |
| 1127 | - * @return bool | |
| 1128 | - */ | |
| 1129 | - public static function is_ajax_on( $form ) { | |
| 1130 | - return ! empty( $form->options['ajax_submit'] ); | |
| 1131 | - } | |
| 1132 | - | |
| 1133 | - /** | |
| 1134 | - * @deprecated 2.03.05 This is still referenced in a few add ons (API, locations). | |
| 1113 | + * @deprecated 3.0 | |
| 1135 | 1114 | * @codeCoverageIgnore |
| 1136 | 1115 | * |
| 1137 | 1116 | * @param string $key |
| 1117 | + * | |
| 1138 | 1118 | * @return int form id |
| 1139 | 1119 | */ |
| 1140 | 1120 | public static function getIdByKey( $key ) { |
| 1141 | - _deprecated_function( __FUNCTION__, '2.03.05', 'FrmForm::get_id_by_key' ); | |
| 1142 | - return self::get_id_by_key( $key ); | |
| 1121 | + return FrmFormDeprecated::getIdByKey( $key ); | |
| 1143 | 1122 | } |
| 1144 | 1123 | |
| 1145 | 1124 | /** |
| 1146 | - * @deprecated 2.03.05 This is still referenced in the API add on as of v1.13. | |
| 1125 | + * @deprecated 3.0 | |
| 1147 | 1126 | * @codeCoverageIgnore |
| 1148 | - * | |
| 1149 | - * @param string|int $id | |
| 1150 | - * @return string | |
| 1151 | 1127 | */ |
| 1152 | 1128 | public static function getKeyById( $id ) { |
| 1153 | - _deprecated_function( __FUNCTION__, '2.03.05', 'FrmForm::get_key_by_id' ); | |
| 1154 | - return self::get_key_by_id( $id ); | |
| 1129 | + return FrmFormDeprecated::getKeyById( $id ); | |
| 1155 | 1130 | } |
| 1156 | 1131 | } |