PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.4
JetFormBuilder — Dynamic Blocks Form Builder v3.6.4
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 1.1.2 1.1.3 1.1.4 1.1.5 All 130 releases
jetformbuilder / includes / admin / pages / base-page.php
base-page.php
73 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Jet_Form_Builder\Admin\Pages;
4
5 use JFB_Components\Admin\Page\Interfaces\Admin_Dashboard_Page_It;
6 use Jet_Form_Builder\Admin\Exceptions\Not_Found_Page_Exception;
7 use JFB_Components\Admin\Page\Traits\Admin_Dashboard_Page_Trait;
8 use JFB_Components\Admin\Vui_Boxes\Traits\With_Boxes_Trait;
9 use JFB_Components\Repository\Repository_Item_Instance_Trait;
10 use Jet_Form_Builder\Classes\Theme\With_Theme_Info;
11 use JFB_Components\Admin\Notices\Traits\With_Notices_Trait;
12
13 // If this file is called directly, abort.
14 if ( ! defined( 'WPINC' ) ) {
15 die;
16 }
17
18 /**
19 * Base dashboard page
20 */
21 abstract class Base_Page implements
22 Repository_Item_Instance_Trait,
23 Admin_Dashboard_Page_It {
24
25 use Admin_Dashboard_Page_Trait;
26 use With_Notices_Trait;
27 use With_Theme_Info;
28 use With_Boxes_Trait;
29
30 public function rep_item_id(): string {
31 return $this->slug();
32 }
33
34 /**
35 * If it returns FALSE, this page is not registered
36 *
37 * @return bool
38 */
39 public function is_active(): bool {
40 return true;
41 }
42
43 /**
44 * @throws Not_Found_Page_Exception
45 */
46 public function render() {
47 try {
48 Pages_Manager::instance()->get_current()->render_page();
49 } catch ( Not_Found_Page_Exception $exception ) {
50 wp_die(
51 esc_html__( 'You do not have access to view this page.', 'jet-form-builder' )
52 );
53 }
54 }
55
56 /**
57 * Returns current page url
58 *
59 * @param array $query_args
60 *
61 * @return string
62 */
63 public function get_url( $query_args = array() ): string {
64 return $this->admin_url(
65 array_merge(
66 array( 'page' => $this->slug() ),
67 $query_args
68 )
69 );
70 }
71
72 }
73