| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\App\Modules; |
| 4 |
|
| 5 |
use FluentForm\App\Modules\Acl\Acl; |
| 6 |
|
| 7 |
class ProcessExteriorModule |
| 8 |
{ |
| 9 |
public function handleExteriorPages() |
| 10 |
{ |
| 11 |
if (isset($_GET['fluentform_pages']) && $_GET['fluentform_pages'] == 1) { |
| 12 |
if (isset($_GET['preview_id']) && $_GET['preview_id']) { |
| 13 |
$this->renderFormPreview(intval($_GET['preview_id'])); |
| 14 |
} |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
public function renderFormPreview($form_id) |
| 19 |
{ |
| 20 |
if (Acl::hasAnyFormPermission($form_id)) { |
| 21 |
add_filter('fluentform_is_form_renderable', function ($renderable) { |
| 22 |
$renderable['status'] = true; |
| 23 |
return $renderable; |
| 24 |
}); |
| 25 |
|
| 26 |
$form = wpFluent()->table('fluentform_forms')->find($form_id); |
| 27 |
if ($form) { |
| 28 |
echo \FluentForm\View::make('frameless.show_review', [ |
| 29 |
'form_id' => $form_id, |
| 30 |
'form' => $form |
| 31 |
]); |
| 32 |
exit(); |
| 33 |
} |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
private function loadDefaultPageTemplate() |
| 38 |
{ |
| 39 |
add_filter('template_include', function ($original) { |
| 40 |
return locate_template(['page.php', 'single.php', 'index.php']); |
| 41 |
}); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Set the posts to one |
| 46 |
* |
| 47 |
* @param WP_Query $query |
| 48 |
* |
| 49 |
* @return void |
| 50 |
*/ |
| 51 |
public function pre_get_posts($query) |
| 52 |
{ |
| 53 |
if ($query->is_main_query()) { |
| 54 |
$query->set('posts_per_page', 1); |
| 55 |
} |
| 56 |
} |
| 57 |
} |
| 58 |
|