PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.1.4
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.1.4
6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 3.6.66 All 195 releases
fluentform / app / Modules / ProcessExteriorModule.php

ProcessExteriorModule.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.1.4, at app/Modules/ProcessExteriorModule.php

67 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Modules;
4
5 use FluentForm\App\Models\Form;
6 use FluentForm\App\Modules\Acl\Acl;
7
8 class ProcessExteriorModule
9 {
10 public function handleExteriorPages()
11 {
12 if (defined('CT_VERSION')) {
13 // oxygen page compatibility
14 remove_action('wp_head', 'oxy_print_cached_css', 999999);
15 }
16 wp_register_script(
17 'fluentform_editor_helper',
18 fluentFormMix('js/fluent_forms_editor_helper.js'),
19 array('jquery'),
20 FLUENTFORM_VERSION,
21 true
22 );
23 $this->renderFormPreview(intval(wpFluentForm('request')->get('preview_id')));
24 }
25
26 public function renderFormPreview($form_id)
27 {
28 if (Acl::hasAnyFormPermission($form_id)) {
29 add_filter('fluentform/is_form_renderable', function ($renderable) {
30 $renderable['status'] = true;
31 return $renderable;
32 });
33
34 $form = Form::find($form_id);
35 if ($form) {
36 wp_enqueue_script('fluentform_editor_helper');
37 wpFluentForm('view')->render('frameless.show_preview', [
38 'form_id' => $form_id,
39 'form' => $form,
40 ]);
41 exit();
42 }
43 }
44 }
45
46 private function loadDefaultPageTemplate()
47 {
48 add_filter('template_include', function ($original) {
49 return locate_template(['page.php', 'single.php', 'index.php']);
50 });
51 }
52
53 /**
54 * Set the posts to one
55 *
56 * @param WP_Query $query
57 *
58 * @return void
59 */
60 public function pre_get_posts($query)
61 {
62 if ($query->is_main_query()) {
63 $query->set('posts_per_page', 1);
64 }
65 }
66 }
67