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 / Iframe.php
kirki / includes / Frontend Last commit date
Preview 4 weeks ago views 1 month ago Editor.php 2 weeks ago Iframe.php 2 months ago TheFrontend.php 2 months ago TheFrontendHooks.php 2 months ago
Iframe.php
110 lines
1 <?php
2 /**
3 * Iframe class for controlling editor and iframe related customize post content.
4 *
5 * @package kirki
6 */
7
8 namespace Kirki\Frontend;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly.
12 }
13
14 use Kirki\Frontend\Preview\Preview;
15 use Kirki\HelperFunctions;
16 use Kirki\Staging;
17
18 /**
19 * Iframe class
20 */
21 class Iframe {
22
23
24 /**
25 * Initialize the class
26 *
27 * @return void
28 */
29 public function __construct( $staging_version = false ) {
30 $this->render_editor();
31
32 if ( ! $staging_version ) {
33 $staging_version = Staging::get_most_recent_stage_version( HelperFunctions::get_post_id_if_possible_from_url(), false );
34 }
35 new TheFrontend( 'iframe', $staging_version );
36
37 add_action( 'wp_enqueue_scripts', array( $this, 'load_assets' ) );
38 add_action( 'init', array( $this, 'disable_wp_emojicons' ) );
39 add_action( 'wp_default_scripts', array( $this, 'remove_jquery_migrate' ) );
40 }
41
42 public function disable_wp_emojicons() {
43 // Remove emoji script and styles from front-end and admin
44 remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
45 remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
46 remove_action( 'wp_print_styles', 'print_emoji_styles' );
47 remove_action( 'admin_print_styles', 'print_emoji_styles' );
48
49 // Remove from RSS feeds
50 remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
51 remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
52
53 // Remove from emails
54 remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
55
56 // Remove TinyMCE emoji plugin
57 add_filter(
58 'tiny_mce_plugins',
59 function ( $plugins ) {
60 return is_array( $plugins ) ? array_diff( $plugins, array( 'wpemoji' ) ) : array();
61 }
62 );
63
64 // Disable DNS prefetch
65 add_filter( 'emoji_svg_url', '__return_false' );
66 }
67
68 public function remove_jquery_migrate( $scripts ) {
69 if ( isset( $scripts->registered['jquery'] ) ) {
70 $script = $scripts->registered['jquery'];
71 if ( $script->deps ) {
72 $script->deps = array_diff( $script->deps, array( 'jquery-migrate' ) );
73 }
74 }
75 }
76
77 /**
78 * Render the editor
79 *
80 * @return void
81 */
82 public function render_editor() {
83 if ( ! $this->has_editor_access() ) {
84 //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped,WordPress.WP.I18n.NonSingularStringLiteralDomain
85 wp_die( __( 'Sorry you are not allowed to access this page', 'kirki' ), 403 );
86 }
87 HelperFunctions::remove_wp_assets();
88 }
89
90
91 /**
92 * Load assets for Editor
93 *
94 * @return void
95 */
96 public function load_assets() {
97 $version = KIRKI_VERSION;
98 wp_enqueue_style('kirki-iframe', KIRKI_ASSETS_URL . 'css/kirki-iframe.min.css', null, $version );
99 }
100
101 /**
102 * Check the editor access
103 *
104 * @return boolean
105 */
106 public function has_editor_access() {
107 return HelperFunctions::user_has_editor_access();
108 }
109 }
110