actions
2 years ago
settings
2 years ago
action-pages-manager.php
2 years ago
addons-page.php
2 years ago
base-page.php
2 years ago
pages-manager.php
2 years ago
single-pages-manager.php
2 years ago
stable-pages-manager.php
2 years ago
single-pages-manager.php
82 lines
| 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\Exceptions\Repository_Exception; |
| 8 | use JFB_Components\Admin\Print_Page\Footer; |
| 9 | use JFB_Components\Admin\Print_Page\Header; |
| 10 | use JFB_Components\Repository\Repository_Pattern_Trait; |
| 11 | use JFB_Modules\Framework\Module; |
| 12 | |
| 13 | // If this file is called directly, abort. |
| 14 | if ( ! defined( 'WPINC' ) ) { |
| 15 | die; |
| 16 | } |
| 17 | |
| 18 | class Single_Pages_Manager { |
| 19 | |
| 20 | use Repository_Pattern_Trait; |
| 21 | |
| 22 | /** |
| 23 | * Register admin pages |
| 24 | */ |
| 25 | public function rep_instances(): array { |
| 26 | return apply_filters( |
| 27 | 'jet-form-builder/admin/single-pages', |
| 28 | array() |
| 29 | ); |
| 30 | } |
| 31 | |
| 32 | public function render_standalone() { |
| 33 | try { |
| 34 | $page = Pages_Manager::instance()->get_current(); |
| 35 | |
| 36 | $page->make(); |
| 37 | } catch ( Not_Found_Page_Exception $exception ) { |
| 38 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 39 | wp_die( 'Invalid request: ' . $exception->getMessage() ); |
| 40 | } |
| 41 | |
| 42 | try { |
| 43 | Pages_Manager::instance()->assets(); |
| 44 | |
| 45 | /** @var Module $framework */ |
| 46 | $framework = jet_form_builder()->module( 'framework' ); |
| 47 | |
| 48 | } catch ( Repository_Exception $exception ) { |
| 49 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 50 | wp_die( 'Something wen\'t wrong: ' . $exception->getMessage() ); |
| 51 | } |
| 52 | |
| 53 | $header = new Header(); |
| 54 | $footer = new Footer(); |
| 55 | |
| 56 | $header->add_styles( |
| 57 | array( |
| 58 | 'dashicons', |
| 59 | 'common', |
| 60 | 'edit', |
| 61 | ) |
| 62 | ); |
| 63 | $footer->add_scripts( |
| 64 | array( |
| 65 | 'cx-vue-ui', |
| 66 | Pages_Manager::SCRIPT_VUEX_PACKAGE, |
| 67 | $page->slug(), |
| 68 | ) |
| 69 | ); |
| 70 | |
| 71 | do_action( 'jet-form-builder/before-print-page/header', $header, $page ); |
| 72 | |
| 73 | $header->output(); |
| 74 | $page->render_page(); |
| 75 | $framework->get_cx_vue_ui()->print_templates(); |
| 76 | |
| 77 | do_action( 'jet-form-builder/before-print-page/footer', $footer, $page ); |
| 78 | |
| 79 | $footer->output(); |
| 80 | } |
| 81 | } |
| 82 |