HEX
Server: LiteSpeed
System: Linux s787.bom1.mysecurecloudhost.com 4.18.0-477.13.1.lve.el8.x86_64 #1 SMP Thu Jun 1 16:40:47 EDT 2023 x86_64
User: mobilech (5348)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //proc/thread-self/cwd/wp-content/plugins/tutor/includes/kirki/backend/Iframe.php
<?php
/**
 * Preview script for html markup generator
 *
 * @package tutor-kirki-elements
 */

namespace TutorLMSKirki;

use TUTOR\Input;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Class Iframe
 */
class Iframe {


	/**
	 * Class constructor
	 *
	 * @since 1.0.0
	 */
	public function __construct() {
		$post_id = Input::get( 'post_id', 0, Input::TYPE_INT );
		if ( $post_id ) {
			$post = get_post( $post_id );
			if ( $post && ( $post->post_type === TDE_APP_PREFIX . '-course-template' || $post->post_type === TDE_APP_PREFIX . '-courses-template' ) ) {
				// add_action( 'template_include', array( $this, 'load_page_template' ) );
				add_action( 'template_redirect', array( $this, 'load_page_template' ) );
				add_filter( 'kirki_assets_should_load', array( $this, 'load_kirki_assets' ) );
			}
		}
	}

	/**
	 * Load kirki page template
	 * it will include the template file insted of original template file
	 * $loadForIframe = true if load for iframe
	 *
	 * @param string $original wp action for template file load.
	 * @return string template name.
	 */
	public static function load_page_template() {
		get_header() . the_content() . get_footer();
		exit();
	}

	/**
	 * Load kirki assets
	 *
	 * @param bool $default_value default value.
	 * @return bool
	 * @since 1.0.0
	 */
	public function load_kirki_assets( $default_value ) {
		return true;
	}
}