PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 1.2.4
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v1.2.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 1.2.4, at app/Modules/ProcessExteriorModule.php

70 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace FluentForm\App\Modules;
2
3 use FluentForm\App;
4 use FluentForm\Config;
5 use FluentForm\Request;
6 use FluentForm\View;
7
8 class ProcessExteriorModule
9 {
10 public function handleExteriorPages()
11 {
12 if(isset($_GET['fluentform_pages']) && $_GET['fluentform_pages'] == 1) {
13 if(isset($_GET['preview_id']) && $_GET['preview_id']) {
14 $form_id = intval($_GET['preview_id']);
15 $this->loadDefaultPageTemplate();
16 $this->renderFormPreview($form_id);
17 }
18 }
19 }
20
21 public function renderFormPreview($form_id)
22 {
23 if(App\Modules\Acl\Acl::hasAnyFormPermission($form_id)) {
24 $form = wpFluent()->table('fluentform_forms')
25 ->find($form_id);
26 if($form) {
27 add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 100, 1 );
28 add_filter( 'post_thumbnail_html', '__return_empty_string' );
29 add_filter( 'get_the_excerpt', function ($content) {
30 return '';
31 } );
32 add_filter('the_title', function ($title) use ($form) {
33 if(in_the_loop()) {
34 return $form->title;
35 }
36 return $title;
37 }, 100, 1);
38 add_filter('the_content', function($content) use ($form) {
39 if(in_the_loop()) {
40 return View::make( 'public.preview_form', array(
41 'form' => $form
42 ) );
43 }
44 return $content;
45 });
46 }
47 }
48 }
49
50 private function loadDefaultPageTemplate()
51 {
52 add_filter( 'template_include', function ($original) {
53 return locate_template( array( 'page.php', 'single.php', 'index.php' ) );
54 } );
55 }
56
57 /**
58 * Set the posts to one
59 *
60 * @param WP_Query $query
61 *
62 * @return void
63 */
64 public function pre_get_posts( $query ) {
65 if ( $query->is_main_query() ) {
66 $query->set( 'posts_per_page', 1 );
67 }
68 }
69
70 }