PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.0
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.0
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmXMLController.php +4 -49 6.36.0 View file →
@@ -4,18 +4,12 @@
4 4 }
5 5
6 6 class FrmXMLController {
7 7
8 - /**
9 - * @return void
10 - */
11 8 public static function menu() {
12 9 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route' );
13 10 }
14 11
15 - /**
16 - * @return void
17 - */
18 12 public static function add_default_templates() {
19 13 if ( FrmXMLHelper::check_if_libxml_disable_entity_loader_exists() ) {
20 14 // XML import is not enabled on your server
21 15 return;
@@ -153,10 +147,8 @@
153 147 /**
154 148 * Get a different URL depending on the selection in the form.
155 149 *
156 150 * @since 4.06.02
157 - *
158 - * @return void
159 151 */
160 152 private static function override_url( $form, &$url ) {
161 153 $selected_form = self::get_selected_in_form( $form, 'form' );
162 154 if ( empty( $selected_form ) ) {
@@ -172,11 +164,8 @@
172 164 }
173 165
174 166 /**
175 167 * @since 4.06.02
176 - *
177 - * @param string $value
178 - * @param array $form
179 168 */
180 169 private static function get_selected_in_form( $form, $value = 'form' ) {
181 170 if ( ! empty( $form ) && isset( $form[ $value ] ) && ! empty( $form[ $value ] ) ) {
182 171 return $form[ $value ];
@@ -276,11 +265,8 @@
276 265 $form->form_key = FrmAppHelper::get_unique_key( $sanitized_form_name, 'frm_forms', 'form_key' );
277 266 }
278 267 }
279 268
280 - /**
281 - * @return void
282 - */
283 269 public static function route() {
284 270 $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
285 271 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
286 272 FrmAppHelper::include_svg();
@@ -285,22 +271,16 @@
285 271 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
286 272 FrmAppHelper::include_svg();
287 273
288 274 if ( 'import_xml' === $action ) {
289 - self::import_xml();
275 + return self::import_xml();
290 276 } elseif ( 'export_xml' === $action ) {
291 - self::export_xml();
277 + return self::export_xml();
292 278 } elseif ( apply_filters( 'frm_xml_route', true, $action ) ) {
293 - self::form();
279 + return self::form();
294 280 }
295 281 }
296 282
297 - /**
298 - * @param string[] $errors
299 - * @param string $message
300 - *
301 - * @return void
302 - */
303 283 public static function form( $errors = array(), $message = '' ) {
304 284 $where = array(
305 285 'status' => array( null, '', 'published' ),
306 286 );
@@ -325,14 +305,11 @@
325 305 ),
326 306 );
327 307 $export_format = apply_filters( 'frm_export_formats', $export_format );
328 308
329 - include FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php';
309 + include( FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php' );
330 310 }
331 311
332 - /**
333 - * @return void
334 - */
335 312 public static function import_xml() {
336 313 $errors = array();
337 314 $message = '';
338 315
@@ -405,11 +382,8 @@
405 382
406 383 self::form( $errors, $message );
407 384 }
408 385
409 - /**
410 - * @return void
411 - */
412 386 public static function export_xml() {
413 387 $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' );
414 388 if ( ! empty( $error ) ) {
415 389 wp_die( esc_html( $error ) );
@@ -434,15 +408,8 @@
434 408
435 409 wp_die();
436 410 }
437 411
438 - /**
439 - * @param array $args
440 - *
441 - * @psalm-param array{ids?: mixed} $args
442 - *
443 - * @return void
444 - */
445 412 public static function generate_xml( $type, $args = array() ) {
446 413 global $wpdb;
447 414
448 415 self::prepare_types_array( $type );
@@ -552,11 +519,8 @@
552 519 echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo( 'charset' ) ) . "\" ?>\n";
553 520 include FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php';
554 521 }
555 522
556 - /**
557 - * @return void
558 - */
559 523 private static function prepare_types_array( &$type ) {
560 524 $type = (array) $type;
561 525 if ( ! in_array( 'forms', $type ) && ( in_array( 'items', $type ) || in_array( 'posts', $type ) ) ) {
562 526 // make sure the form is included if there are entries
@@ -576,10 +540,8 @@
576 540 * @since 3.06
577 541 *
578 542 * @param array $type
579 543 * @param array $records
580 - * @param array $args
581 - *
582 544 * @return string
583 545 */
584 546 private static function get_file_name( $args, $type, $records ) {
585 547 $has_one_form = isset( $records['forms'] ) && ! empty( $records['forms'] ) && count( $args['ids'] ) === 1;
@@ -613,13 +575,8 @@
613 575 */
614 576 return apply_filters( 'frm_xml_filename', $filename );
615 577 }
616 578
617 - /**
618 - * @param array $atts
619 - *
620 - * @return void
621 - */
622 579 public static function generate_csv( $atts ) {
623 580 $form_ids = $atts['ids'];
624 581 if ( empty( $form_ids ) ) {
625 582 wp_die( esc_html__( 'Please select a form', 'formidable' ) );
@@ -630,10 +587,8 @@
630 587 /**
631 588 * Export to CSV
632 589 *
633 590 * @since 2.0.19
634 - *
635 - * @return void
636 591 */
637 592 public static function csv( $form_id = false, $search = '', $fid = '' ) {
638 593 FrmAppHelper::permission_check( 'frm_view_entries' );
639 594