PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.6
JetFormBuilder — Dynamic Blocks Form Builder v3.6.6
3.6.6.1 3.6.6 3.6.5.4 3.6.5.3 3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 134 releases
jetformbuilder / includes / admin / pages / action-pages-manager.php

action-pages-manager.php in JetFormBuilder — Dynamic Blocks Form Builder 3.6.6, at includes/admin/pages/action-pages-manager.php

74 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace Jet_Form_Builder\Admin\Pages;
5
6 use Jet_Form_Builder\Admin\Exceptions\Not_Found_Page_Exception;
7 use Jet_Form_Builder\Classes\Tools;
8 use Jet_Form_Builder\Exceptions\Repository_Exception;
9 use JFB_Components\Admin\Page\Interfaces\Action_Page_It;
10 use JFB_Components\Repository\Repository_Pattern_Trait;
11
12 // If this file is called directly, abort.
13 if ( ! defined( 'WPINC' ) ) {
14 die;
15 }
16
17 class Action_Pages_Manager {
18
19 use Repository_Pattern_Trait;
20
21 public function __construct() {
22 add_action(
23 'admin_action_jfb',
24 array( $this, 'do_action' )
25 );
26 }
27
28 public function rep_instances(): array {
29 return apply_filters(
30 'jet-form-builder/admin/action-pages',
31 array()
32 );
33 }
34
35 /**
36 * @param $item
37 *
38 * @throws Repository_Exception
39 */
40 public function rep_before_install_item( $item ) {
41 if ( $item instanceof Action_Page_It ) {
42 return;
43 }
44 $this->_rep_abort_this();
45 }
46
47 public function do_action() {
48 $slug = Tools::sanitize_get_param( 'slug' );
49
50 try {
51 /** @var Action_Page_It $page */
52 $page = $this->rep_get_item( $slug );
53 } catch ( Repository_Exception $exception ) {
54 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
55 wp_die( $exception->getMessage() );
56 }
57
58 if ( ! $page->check_permission() ) {
59 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
60 wp_die( __( 'You do not have access to view this page', 'jet-form-builder' ) );
61 }
62
63 Pages_Manager::instance()->set_current_page_raw( $page );
64
65 try {
66 $page->render_page();
67 } catch ( Not_Found_Page_Exception $exception ) {
68 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
69 wp_die( $exception->getMessage() );
70 }
71 }
72
73 }
74