PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.8.0
Kubio AI Page Builder v2.8.0
2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / lib / api / contact-form.php
kubio / lib / api Last commit date
multilanguage 1 year ago recommendations 3 months ago colibri.php 1 year ago contact-form.php 1 year ago entity.php 4 years ago get-body-class.php 1 year ago get-classic-page-template.php 1 year ago get-page-query.php 1 year ago get-page-title.php 1 year ago get-post-content.php 1 year ago get-post-styles.php 1 year ago index.php 11 months ago kubio-cloud.php 1 year ago page-templates.php 4 years ago save-template-parts-filter.php 1 year ago subscribe-form.php 4 years ago typekit.php 4 years ago update-settings-flags.php 1 year ago
contact-form.php
82 lines
1 <?php
2
3
4 function kubio_wpform_get_forms() {
5 $wp_forms = wpforms()->form->get( '', array( 'order' => 'DESC' ) );
6 $wp_forms = ! empty( $wp_forms ) ? $wp_forms : array();
7 $wp_forms = array_map(
8 function ( $form ) {
9 return array(
10 'label' => htmlspecialchars_decode( $form->post_title, ENT_QUOTES ),
11 'value' => $form->ID,
12 );
13 },
14 $wp_forms
15 );
16 return $wp_forms;
17 }
18 function kubio_contact_forms_by_type( WP_REST_Request $data ) {
19
20 $forms = array();
21 if ( class_exists( '\Forminator_GFBlock_Forms' ) ) {
22 $forminator_forms = Forminator_GFBlock_Forms::get_instance()->get_forms();
23
24 // remove the empty form
25 array_shift( $forminator_forms );
26 if ( count( $forminator_forms ) === 0 ) {
27 kubio_forminator_create_sample_form();
28 $forminator_forms = Forminator_GFBlock_Forms::get_instance()->get_forms();
29 array_shift( $forminator_forms );
30 }
31 if ( count( $forminator_forms ) > 0 ) {
32 $forms['forminator'] = $forminator_forms;
33 }
34 }
35 if ( class_exists( '\WPCF7' ) ) {
36 $contact_form7_items = array();
37 $args = array(
38 'post_type' => 'wpcf7_contact_form',
39 'posts_per_page' => - 1,
40 );
41 if ( $data = get_posts( $args ) ) {
42 foreach ( $data as $key ) {
43 $contact_form7_items[] = array(
44 'label' => $key->post_title,
45 'value' => $key->ID,
46 );
47 }
48 }
49 if ( count( $contact_form7_items ) > 0 ) {
50 $forms['contactForm7'] = $contact_form7_items;
51 }
52 }
53 if ( class_exists( 'WPForms' ) ) {
54 $wp_forms = kubio_wpform_get_forms();
55 if ( count( $wp_forms ) > 0 ) {
56
57 $forms['wpForms'] = $wp_forms;
58 }
59 }
60
61 return $forms;
62 }
63
64 add_action(
65 'rest_api_init',
66 function () {
67 $namespace = 'kubio/v1';
68 register_rest_route(
69 $namespace,
70 '/contact-form/forms_by_type',
71 array(
72 'methods' => 'GET',
73 'callback' => 'kubio_contact_forms_by_type',
74 'permission_callback' => function () {
75 return current_user_can( 'edit_posts' );
76 },
77
78 )
79 );
80 }
81 );
82