403Webshell
Server IP : 89.108.64.180  /  Your IP : 216.73.216.60
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux 89-108-64-180.cloudvps.regruhosting.ru 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : www-root ( 1010)
PHP Version : 8.0.30
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/calypso-hotel.ru/wp-content/plugins/popup-maker/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/calypso-hotel.ru/wp-content/plugins/popup-maker/classes/Previews.php
<?php
/*******************************************************************************
 * Copyright (c) 2019, Code Atlantic LLC
 ******************************************************************************/

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Class PUM_Previews
 *
 * This class sets up the necessary changes to allow admins & editors to preview popups on the front end.
 */
class PUM_Previews {

	/**
	 * Initiator method.
	 */
	public static function init() {
		// add_filter( 'template_include', array( __CLASS__, 'template_include' ), 1000, 2 );
		add_filter( 'pum_popup_is_loadable', array( __CLASS__, 'is_loadable' ), 1000, 2 );
		add_filter( 'pum_popup_data_attr', array( __CLASS__, 'data_attr' ), 1000, 2 );
		add_filter( 'pum_popup_get_public_settings', array( __CLASS__, 'get_public_settings' ), 1000, 2 );

	}

	/**
	 * This changes the template to a blank one to prevent duplicate content issues.
	 *
	 * @param $template
	 *
	 * @return string
	 */
	public static function template_include( $template ) {
		if ( ! is_singular( 'popup' ) ) {
			return $template;
		}

		return POPMAKE_DIR . 'templates/single-popup.php';
	}

	/**
	 * For popup previews this will force only the correct popup to load.
	 *
	 * @param bool $loadable
	 * @param int $popup_id
	 *
	 * @return bool
	 */
	public static function is_loadable( $loadable, $popup_id ) {
		return self::should_preview_popup( $popup_id ) ? true : $loadable;
	}

	/**
	 * Sets the Popup Post Type public arg to true for content editors.
	 *
	 * This enables them to use the built in preview links.
	 *
	 * @param int $popup_id
	 *
	 * @return bool
	 */
	public static function should_preview_popup( $popup_id = 0 ) {
		if ( defined( "DOING_AJAX" ) && DOING_AJAX ) {
			return false;
		}


		if ( isset( $_GET['popup_preview'] ) && $_GET['popup_preview'] && isset( $_GET['popup'] ) ) {

			static $popup;

			if ( ! isset( $popup ) ) {
				if ( is_numeric( $_GET['popup'] ) && absint( $_GET['popup'] ) > 0 ) {
					$popup = absint( $_GET['popup'] );
				} else {
					$post  = get_page_by_path( sanitize_text_field( $_GET['popup'] ), OBJECT, 'popup' );
					$popup = $post->ID;
				}
			}

			if ( $popup_id == $popup && current_user_can( 'edit_post', $popup ) ) {
				return true;
			}
		}

		return false;
	}

	/**
	 * On popup previews add an admin debug trigger.
	 *
	 * @param $data_attr
	 * @param $popup_id
	 *
	 * @return mixed
	 */
	public static function data_attr( $data_attr, $popup_id ) {
		if ( ! self::should_preview_popup( $popup_id ) ) {
			return $data_attr;
		}

		$data_attr['triggers'] = array(
			array(
				'type' => 'admin_debug',
			),
		);

		return $data_attr;
	}

	/**
	 * On popup previews add an admin debug trigger.
	 *
	 * @param array $settings
	 * @param PUM_Model_Popup $popup
	 *
	 * @return array
	 */
	public static function get_public_settings( $settings, $popup ) {
		if ( ! self::should_preview_popup( $popup->ID ) ) {
			return $settings;
		}

		$settings['triggers'] = array(
			array(
				'type' => 'admin_debug',
			),
		);

		return $settings;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit