PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.0.13
Kirki – Freeform Page Builder, Website Builder & Customizer v6.0.13
6.1.1 6.1.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.19 4.0.20 4.0.21 4.0.22 4.0.23 4.0.24 4.1 4.2.0 5.0.0 5.1.0 5.1.1 5.2.0 5.2.1 5.2.2 5.2.3 6.0.0 trunk 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.1.0 3.1.1 3.1.2
kirki / includes / Frontend.php
kirki / includes Last commit date
API 3 weeks ago Admin 3 weeks ago Ajax 3 weeks ago ExportImport 3 weeks ago FormValidator 2 months ago Frontend 3 weeks ago Manager 3 weeks ago API.php 3 weeks ago Admin.php 2 months ago Ajax.php 3 weeks ago Apps.php 3 weeks ago ContentManager.php 2 months ago DbQueryUtils.php 2 months ago ElementVisibilityConditions.php 2 months ago Frontend.php 2 months ago HelperFunctions.php 3 weeks ago KirkiBase.php 3 weeks ago PostsQueryUtils.php 2 months ago Staging.php 3 weeks ago View.php 1 month ago
Frontend.php
77 lines
1 <?php
2 /**
3 * This class act like controller for Editor, Iframe, Frontend
4 *
5 * @package kirki
6 */
7
8 namespace Kirki;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly.
12 }
13
14 use Kirki\Frontend\Editor;
15 use Kirki\Frontend\Iframe;
16 use Kirki\Frontend\TheFrontend;
17 use Kirki\Manager\TemplateRedirection;
18
19 /**
20 * Frontend handler class
21 */
22 class Frontend {
23
24 /**
25 * Initialize the class
26 *
27 * @return void
28 */
29 public function __construct() {
30 new TemplateRedirection();
31 $this->plugin_editor_page_or_iframe_or_the_content();
32 }
33
34
35 /**
36 * This action trigger when post data loaded done
37 *
38 * @param object $post WordPress post object.
39 * @return void
40 */
41 public function post_loaded( $post ) {
42 if ( ! HelperFunctions::user_has_editor_access() ) {
43 //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
44 wp_die( __( 'Sorry, you are not allowed to access this page.', 'kirki' ) );
45 }
46 }
47
48 /**
49 * Render the plugin editor page
50 *
51 * @return void
52 */
53 public function plugin_editor_page_or_iframe_or_the_content() {
54 //phpcs:ignore WordPress.Security.NonceVerification.Missing,WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.MissingUnslash,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
55 $action = HelperFunctions::sanitize_text( isset( $_GET['action'] ) ? $_GET['action'] : '' );
56 $staging_version = isset( $_GET['staging_version'] ) ? intval( HelperFunctions::sanitize_text( $_GET['staging_version'] ) ) : false;
57 $nonce = HelperFunctions::sanitize_text( isset( $_GET['nonce'] ) ? $_GET['nonce'] : 'false' );
58 $preview_staging_version = ( $staging_version && wp_verify_nonce( $nonce, 'kirki_preview_staging_nonce' ) ) ? $staging_version : false;
59
60 if ( $action === KIRKI_EDITOR_ACTION ) {
61 add_action( 'the_post', array( $this, 'post_loaded' ) );
62
63 //phpcs:ignore WordPress.Security.NonceVerification.Missing,WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.MissingUnslash,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
64 $load_for = HelperFunctions::sanitize_text( isset( $_GET['load_for'] ) ? $_GET['load_for'] : '' );
65 if ( $load_for === 'kirki-iframe' ) {
66 new Iframe( $staging_version );
67 } elseif ( $load_for === 'migration' ) {
68 new TheFrontend( 'migration' );
69 } else {
70 new Editor();
71 }
72 } else {
73 new TheFrontend( null, $preview_staging_version );
74 }
75 }
76 }
77